@flopay/js 2.0.0 → 2.0.2
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.
|
@@ -52,7 +52,7 @@ export type CheckoutRuntimeLayout = 'default' | 'buttons';
|
|
|
52
52
|
* `strings`, leaving `paymentMethodLayout` out (or `undefined`) keeps the current layout; new
|
|
53
53
|
* rules are resolved again by the API and the frame gets the new layout in the same frame.
|
|
54
54
|
*/
|
|
55
|
-
export type CheckoutRuntimeUpdateOptions = Partial<Pick<CheckoutRuntimeMountOptions, 'appearance' | 'strings' | 'onEvent' | 'paymentMethodLayout'>>;
|
|
55
|
+
export type CheckoutRuntimeUpdateOptions = Partial<Pick<CheckoutRuntimeMountOptions, 'appearance' | 'strings' | 'onEvent' | 'paymentMethodLayout' | 'theme' | 'showCardBrandIcons' | 'showCardFieldLabels' | 'cardFieldLabels' | 'cardFieldPlaceholders'>>;
|
|
56
56
|
export interface CheckoutRuntimeHandle {
|
|
57
57
|
update(options: CheckoutRuntimeUpdateOptions): void;
|
|
58
58
|
unmount(): void;
|
|
@@ -121,6 +121,36 @@ export interface CheckoutRuntimeMountOptions {
|
|
|
121
121
|
*/
|
|
122
122
|
hiddenPaymentMethods?: readonly string[];
|
|
123
123
|
}
|
|
124
|
+
/** The 1.x presentation mount options, added in contract 2.6.0. */
|
|
125
|
+
export interface CheckoutRuntimeMountOptions {
|
|
126
|
+
/**
|
|
127
|
+
* The hosted card form's theme: a theme name, or its colours as an object. Relayed to the
|
|
128
|
+
* frame unchanged. A value of another type is ignored.
|
|
129
|
+
*/
|
|
130
|
+
theme?: string | Record<string, unknown>;
|
|
131
|
+
/** Whether the hosted card form shows the card brand icons. */
|
|
132
|
+
showCardBrandIcons?: boolean;
|
|
133
|
+
/** Whether the hosted card form shows a label above each field. */
|
|
134
|
+
showCardFieldLabels?: boolean;
|
|
135
|
+
/** The hosted card form's field labels, keyed by field (`number`, `expiry`, `cvv`, `name`). */
|
|
136
|
+
cardFieldLabels?: Record<string, string>;
|
|
137
|
+
/** The hosted card form's field placeholders, keyed by field as `cardFieldLabels` is. */
|
|
138
|
+
cardFieldPlaceholders?: Record<string, string>;
|
|
139
|
+
/**
|
|
140
|
+
* The payment methods the merchant allows, by the same method or group names as
|
|
141
|
+
* `hiddenPaymentMethods`, never by processor. An offered method is mounted only when its method
|
|
142
|
+
* or its group is listed (`card` stands for either card surface) and it is not hidden: hiding
|
|
143
|
+
* stays the stronger rule, and the runtime never adds a method the session does not offer.
|
|
144
|
+
* Left out, empty, or not a list, every offered method is mounted. A new list is a new mount.
|
|
145
|
+
*/
|
|
146
|
+
enabledPaymentMethods?: readonly string[];
|
|
147
|
+
/**
|
|
148
|
+
* An order the merchant already has for the button that pays by order, as in 1.x: the buyer's click
|
|
149
|
+
* resumes it instead of creating a new one, and approving it pays that order once. A value
|
|
150
|
+
* that is not a non-empty string is ignored. Read once at mount and never sent to the frame.
|
|
151
|
+
*/
|
|
152
|
+
initialPayPalOrderId?: string;
|
|
153
|
+
}
|
|
124
154
|
/** Which setup a hosted setup mount runs (contract 2.4.0). Never inferred from an amount. */
|
|
125
155
|
export type CheckoutRuntimeSetupKind = 'card' | 'payment_method';
|
|
126
156
|
/**
|
|
@@ -43,6 +43,12 @@ export interface ProviderServices {
|
|
|
43
43
|
};
|
|
44
44
|
/** The descriptors this mount hands to this provider, in the order the API sent them. */
|
|
45
45
|
readonly methods: readonly PaymentMethodDescriptor[];
|
|
46
|
+
/**
|
|
47
|
+
* An order the merchant already has for this checkout (contract 2.6.0), when it gave one: an
|
|
48
|
+
* adapter whose button pays by order starts the buyer's click from it instead of creating a
|
|
49
|
+
* new one. Every other adapter ignores it.
|
|
50
|
+
*/
|
|
51
|
+
readonly resumeOrderId?: string;
|
|
46
52
|
/** False once the mount is gone: nothing an adapter does afterwards reaches the merchant. */
|
|
47
53
|
active(): boolean;
|
|
48
54
|
/** Whether a new attempt could start now (none running and the session not paid). */
|
|
@@ -85,6 +85,17 @@ export declare function readHiddenPaymentMethods(value: unknown): ReadonlySet<st
|
|
|
85
85
|
* offers.
|
|
86
86
|
*/
|
|
87
87
|
export declare function isHiddenMethod(descriptor: PaymentMethodDescriptor, hidden: ReadonlySet<string>): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The merchant's allow list (contract 2.6.0) as the runtime applies it: the names in it, read as
|
|
90
|
+
* the hide list's are, or `undefined` when there is no list to apply. A value that is not a list,
|
|
91
|
+
* an empty list, or one with no name in it allows every offered method, as before.
|
|
92
|
+
*/
|
|
93
|
+
export declare function readEnabledPaymentMethods(value: unknown): ReadonlySet<string> | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the merchant lets the checkout show a card surface: `card` is not hidden, and is
|
|
96
|
+
* allowed when there is an allow list. A method must be allowed and not hidden to be mounted.
|
|
97
|
+
*/
|
|
98
|
+
export declare function cardSurfaceAllowed(hidden: ReadonlySet<string>, enabled: ReadonlySet<string> | undefined): boolean;
|
|
88
99
|
/**
|
|
89
100
|
* Whether Flo's hosted card form is the session's card surface: for a 1.x answer, and for an
|
|
90
101
|
* advertisement that selects `hosted-card` or names no card surface at all. A `provider-frame`
|
|
@@ -108,6 +119,16 @@ export interface PaymentMethodsContext {
|
|
|
108
119
|
strings: () => Record<string, string> | undefined;
|
|
109
120
|
/** The methods the merchant hid (contract 2.5.0), read by `readHiddenPaymentMethods`. */
|
|
110
121
|
hidden?: ReadonlySet<string>;
|
|
122
|
+
/**
|
|
123
|
+
* The methods the merchant allows (contract 2.6.0), read by `readEnabledPaymentMethods`;
|
|
124
|
+
* `undefined` allows every offered method.
|
|
125
|
+
*/
|
|
126
|
+
enabled?: ReadonlySet<string>;
|
|
127
|
+
/**
|
|
128
|
+
* An order the merchant already has (contract 2.6.0), handed to every adapter as
|
|
129
|
+
* `resumeOrderId`: the adapter whose button pays by order resumes it instead of creating one.
|
|
130
|
+
*/
|
|
131
|
+
resumeOrderId?: string;
|
|
111
132
|
}
|
|
112
133
|
export interface PaymentMethodsSurface {
|
|
113
134
|
setLayout(layout: PaymentMethodGroupLayout): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@flopay/shared": "2.0.
|
|
34
|
+
"@flopay/shared": "2.0.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@flopay/ui": "2.0.
|
|
37
|
+
"@flopay/ui": "2.0.2",
|
|
38
38
|
"jsdom": "^29.1.1",
|
|
39
39
|
"tsup": "^9.0.0",
|
|
40
40
|
"typescript": "^7.0.2",
|