@flopay/vue 1.20.3 → 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 +24 -0
- package/dist/index.mjs +24 -0
- 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,6 +5353,13 @@ function asFloPayError(caught) {
|
|
|
5353
5353
|
cause: caught
|
|
5354
5354
|
});
|
|
5355
5355
|
}
|
|
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
|
+
}
|
|
5356
5363
|
var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
5357
5364
|
name: "FloPayRuntimeCheckout",
|
|
5358
5365
|
props: {
|
|
@@ -5362,6 +5369,10 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5362
5369
|
createSession: { type: Object, default: void 0 },
|
|
5363
5370
|
appearance: { type: Object, default: void 0 },
|
|
5364
5371
|
strings: { type: Object, default: void 0 },
|
|
5372
|
+
paymentMethodLayout: {
|
|
5373
|
+
type: Object,
|
|
5374
|
+
default: void 0
|
|
5375
|
+
},
|
|
5365
5376
|
runtimeUrl: { type: String, required: true },
|
|
5366
5377
|
runtimeTimeoutMs: { type: Number, default: void 0 }
|
|
5367
5378
|
},
|
|
@@ -5372,6 +5383,7 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5372
5383
|
setup(props, { emit }) {
|
|
5373
5384
|
const container = (0, import_vue14.ref)(null);
|
|
5374
5385
|
let handle = null;
|
|
5386
|
+
let mountedLayoutRules;
|
|
5375
5387
|
let run = 0;
|
|
5376
5388
|
const stop = () => {
|
|
5377
5389
|
run += 1;
|
|
@@ -5384,13 +5396,16 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5384
5396
|
(0, import_js4.loadCheckoutRuntime)({ runtimeUrl: props.runtimeUrl, timeoutMs: props.runtimeTimeoutMs }).then(
|
|
5385
5397
|
(runtime) => {
|
|
5386
5398
|
if (current !== run || !container.value) return;
|
|
5399
|
+
mountedLayoutRules = rulesKey(props.paymentMethodLayout);
|
|
5387
5400
|
handle = runtime.mount(container.value, {
|
|
5401
|
+
contractVersion: RUNTIME_CONTRACT_VERSION,
|
|
5388
5402
|
publishableKey: props.publishableKey,
|
|
5389
5403
|
sessionId: props.sessionId,
|
|
5390
5404
|
nonce: props.nonce,
|
|
5391
5405
|
createSession: props.createSession,
|
|
5392
5406
|
appearance: props.appearance,
|
|
5393
5407
|
strings: props.strings,
|
|
5408
|
+
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
5394
5409
|
onEvent: (event) => emit("event", event)
|
|
5395
5410
|
});
|
|
5396
5411
|
},
|
|
@@ -5424,6 +5439,15 @@ var FloPayRuntimeCheckout = (0, import_vue14.defineComponent)({
|
|
|
5424
5439
|
if (strings !== void 0) handle?.update({ strings });
|
|
5425
5440
|
}
|
|
5426
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
|
+
);
|
|
5427
5451
|
(0, import_vue14.onBeforeUnmount)(stop);
|
|
5428
5452
|
return () => (0, import_vue14.h)("div", { ref: container, "data-flopay-runtime-checkout": "" });
|
|
5429
5453
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3487,6 +3487,13 @@ function asFloPayError(caught) {
|
|
|
3487
3487
|
cause: caught
|
|
3488
3488
|
});
|
|
3489
3489
|
}
|
|
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
|
+
}
|
|
3490
3497
|
var FloPayRuntimeCheckout = defineComponent6({
|
|
3491
3498
|
name: "FloPayRuntimeCheckout",
|
|
3492
3499
|
props: {
|
|
@@ -3496,6 +3503,10 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3496
3503
|
createSession: { type: Object, default: void 0 },
|
|
3497
3504
|
appearance: { type: Object, default: void 0 },
|
|
3498
3505
|
strings: { type: Object, default: void 0 },
|
|
3506
|
+
paymentMethodLayout: {
|
|
3507
|
+
type: Object,
|
|
3508
|
+
default: void 0
|
|
3509
|
+
},
|
|
3499
3510
|
runtimeUrl: { type: String, required: true },
|
|
3500
3511
|
runtimeTimeoutMs: { type: Number, default: void 0 }
|
|
3501
3512
|
},
|
|
@@ -3506,6 +3517,7 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3506
3517
|
setup(props, { emit }) {
|
|
3507
3518
|
const container = ref6(null);
|
|
3508
3519
|
let handle = null;
|
|
3520
|
+
let mountedLayoutRules;
|
|
3509
3521
|
let run = 0;
|
|
3510
3522
|
const stop = () => {
|
|
3511
3523
|
run += 1;
|
|
@@ -3518,13 +3530,16 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3518
3530
|
loadCheckoutRuntime({ runtimeUrl: props.runtimeUrl, timeoutMs: props.runtimeTimeoutMs }).then(
|
|
3519
3531
|
(runtime) => {
|
|
3520
3532
|
if (current !== run || !container.value) return;
|
|
3533
|
+
mountedLayoutRules = rulesKey(props.paymentMethodLayout);
|
|
3521
3534
|
handle = runtime.mount(container.value, {
|
|
3535
|
+
contractVersion: RUNTIME_CONTRACT_VERSION,
|
|
3522
3536
|
publishableKey: props.publishableKey,
|
|
3523
3537
|
sessionId: props.sessionId,
|
|
3524
3538
|
nonce: props.nonce,
|
|
3525
3539
|
createSession: props.createSession,
|
|
3526
3540
|
appearance: props.appearance,
|
|
3527
3541
|
strings: props.strings,
|
|
3542
|
+
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
3528
3543
|
onEvent: (event) => emit("event", event)
|
|
3529
3544
|
});
|
|
3530
3545
|
},
|
|
@@ -3558,6 +3573,15 @@ var FloPayRuntimeCheckout = defineComponent6({
|
|
|
3558
3573
|
if (strings !== void 0) handle?.update({ strings });
|
|
3559
3574
|
}
|
|
3560
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
|
+
);
|
|
3561
3585
|
onBeforeUnmount6(stop);
|
|
3562
3586
|
return () => h6("div", { ref: container, "data-flopay-runtime-checkout": "" });
|
|
3563
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
|
},
|