@flopay/vue 2.0.13 → 2.1.1
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 +13 -0
- package/dist/card-setup-entry.cjs +4 -2
- package/dist/card-setup-entry.mjs +1 -1
- package/dist/{chunk-OCVTEXQA.mjs → chunk-5PV37HJM.mjs} +1 -1
- package/dist/{chunk-2VPPDVV7.mjs → chunk-XKVNXE72.mjs} +4 -2
- package/dist/flopay-runtime-card-setup.d.ts +15 -0
- package/dist/flopay-runtime-checkout.d.ts +11 -0
- package/dist/flopay-runtime-payment-method-setup.d.ts +9 -0
- package/dist/hosted-runtime-components.d.ts +27 -0
- package/dist/index.cjs +17 -4
- package/dist/index.mjs +15 -4
- package/dist/payment-method-setup-entry.cjs +4 -2
- package/dist/payment-method-setup-entry.mjs +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,6 +12,19 @@ npm install @flopay/vue
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
+
### Buyer language on SDK 2.x (`next`)
|
|
16
|
+
|
|
17
|
+
The hosted runtime sends the browser's language preferences to the API. The API chooses the merchant's
|
|
18
|
+
`locale` override, then the customer's stored preference, then the browser preference, then English.
|
|
19
|
+
Only operator-enabled translations are served; missing translations fall back to English.
|
|
20
|
+
|
|
21
|
+
Set `locale="fr"` on any 2.x checkout or setup component to override the preference. The runtime renders
|
|
22
|
+
the language and wording returned by the API; language catalogues are not bundled in the wrappers.
|
|
23
|
+
Wording precedence is the merchant's canonical key, merchant's legacy alias, API canonical key, then API legacy alias.
|
|
24
|
+
Changing a checkout's `locale` updates its existing session without creating or paying another session.
|
|
25
|
+
Changing a no-charge setup's `locale` remounts its setup form. The override requires runtime contract
|
|
26
|
+
2.7.0. Use the 2.x packages on npm's `next` channel; released 1.x packages keep their existing behavior.
|
|
27
|
+
|
|
15
28
|
Render `FloPayCheckout` with a session the merchant server created, or with an inline `createSession` draft. Notification callbacks are Vue events: React's `onComplete` is `@complete` in templates and `onComplete` in `h()`.
|
|
16
29
|
|
|
17
30
|
```ts
|
|
@@ -80,6 +80,7 @@ function setupConfig(props) {
|
|
|
80
80
|
var setupProps = {
|
|
81
81
|
sessionId: { type: String, required: true },
|
|
82
82
|
nonce: { type: String, required: true },
|
|
83
|
+
locale: { type: String, default: void 0 },
|
|
83
84
|
theme: {
|
|
84
85
|
type: [String, Object],
|
|
85
86
|
default: void 0
|
|
@@ -186,7 +187,8 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
186
187
|
setup: kind,
|
|
187
188
|
sessionId: props.sessionId,
|
|
188
189
|
nonce: props.nonce,
|
|
189
|
-
contractVersion: SETUP_CONTRACT_VERSION,
|
|
190
|
+
contractVersion: props.locale === void 0 ? SETUP_CONTRACT_VERSION : "2.7.0",
|
|
191
|
+
locale: props.locale,
|
|
190
192
|
...setupConfig(props),
|
|
191
193
|
onEvent
|
|
192
194
|
});
|
|
@@ -198,7 +200,7 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
198
200
|
};
|
|
199
201
|
(0, import_vue.onMounted)(start);
|
|
200
202
|
(0, import_vue.watch)(
|
|
201
|
-
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs],
|
|
203
|
+
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs, props.locale],
|
|
202
204
|
() => {
|
|
203
205
|
stop();
|
|
204
206
|
start();
|
|
@@ -62,6 +62,7 @@ function setupConfig(props) {
|
|
|
62
62
|
var setupProps = {
|
|
63
63
|
sessionId: { type: String, required: true },
|
|
64
64
|
nonce: { type: String, required: true },
|
|
65
|
+
locale: { type: String, default: void 0 },
|
|
65
66
|
theme: {
|
|
66
67
|
type: [String, Object],
|
|
67
68
|
default: void 0
|
|
@@ -168,7 +169,8 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
168
169
|
setup: kind,
|
|
169
170
|
sessionId: props.sessionId,
|
|
170
171
|
nonce: props.nonce,
|
|
171
|
-
contractVersion: SETUP_CONTRACT_VERSION,
|
|
172
|
+
contractVersion: props.locale === void 0 ? SETUP_CONTRACT_VERSION : "2.7.0",
|
|
173
|
+
locale: props.locale,
|
|
172
174
|
...setupConfig(props),
|
|
173
175
|
onEvent
|
|
174
176
|
});
|
|
@@ -180,7 +182,7 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
180
182
|
};
|
|
181
183
|
onMounted(start);
|
|
182
184
|
watch(
|
|
183
|
-
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs],
|
|
185
|
+
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs, props.locale],
|
|
184
186
|
() => {
|
|
185
187
|
stop();
|
|
186
188
|
start();
|
|
@@ -27,6 +27,8 @@ export interface FloPayRuntimeCardSetupProps {
|
|
|
27
27
|
/** A setup session the merchant's server created. */
|
|
28
28
|
sessionId: string;
|
|
29
29
|
nonce: string;
|
|
30
|
+
/** Merchant language override, resolved by the API. A change remounts this no-charge setup. */
|
|
31
|
+
locale?: string;
|
|
30
32
|
theme?: ThemeId | VaultCardThemeColors;
|
|
31
33
|
appearance?: FloPayAppearance;
|
|
32
34
|
buttonsStyles?: ButtonsLayoutStyles;
|
|
@@ -47,6 +49,10 @@ export declare const setupProps: {
|
|
|
47
49
|
readonly type: StringConstructor;
|
|
48
50
|
readonly required: true;
|
|
49
51
|
};
|
|
52
|
+
readonly locale: {
|
|
53
|
+
readonly type: StringConstructor;
|
|
54
|
+
readonly default: undefined;
|
|
55
|
+
};
|
|
50
56
|
readonly theme: {
|
|
51
57
|
readonly type: PropType<ThemeId | VaultCardThemeColors>;
|
|
52
58
|
readonly default: undefined;
|
|
@@ -108,6 +114,10 @@ export declare const FloPayRuntimeCardSetup: import("vue").DefineComponent<impor
|
|
|
108
114
|
readonly type: StringConstructor;
|
|
109
115
|
readonly required: true;
|
|
110
116
|
};
|
|
117
|
+
readonly locale: {
|
|
118
|
+
readonly type: StringConstructor;
|
|
119
|
+
readonly default: undefined;
|
|
120
|
+
};
|
|
111
121
|
readonly theme: {
|
|
112
122
|
readonly type: PropType<ThemeId | VaultCardThemeColors>;
|
|
113
123
|
readonly default: undefined;
|
|
@@ -154,6 +164,10 @@ export declare const FloPayRuntimeCardSetup: import("vue").DefineComponent<impor
|
|
|
154
164
|
readonly type: StringConstructor;
|
|
155
165
|
readonly required: true;
|
|
156
166
|
};
|
|
167
|
+
readonly locale: {
|
|
168
|
+
readonly type: StringConstructor;
|
|
169
|
+
readonly default: undefined;
|
|
170
|
+
};
|
|
157
171
|
readonly theme: {
|
|
158
172
|
readonly type: PropType<ThemeId | VaultCardThemeColors>;
|
|
159
173
|
readonly default: undefined;
|
|
@@ -190,6 +204,7 @@ export declare const FloPayRuntimeCardSetup: import("vue").DefineComponent<impor
|
|
|
190
204
|
onReady?: (() => any) | undefined;
|
|
191
205
|
onValidation?: ((_message: string | null) => any) | undefined;
|
|
192
206
|
}>, {
|
|
207
|
+
readonly locale: string;
|
|
193
208
|
readonly theme: VaultCardThemeColors | ThemeId;
|
|
194
209
|
readonly appearance: FloPayAppearance;
|
|
195
210
|
readonly buttonsStyles: ButtonsLayoutStyles;
|
|
@@ -16,6 +16,8 @@ export interface FloPayRuntimeCheckoutProps {
|
|
|
16
16
|
appearance?: Record<string, unknown>;
|
|
17
17
|
/** Merchant wording overrides, applied by the runtime over the strings the API returns. */
|
|
18
18
|
strings?: Record<string, string>;
|
|
19
|
+
/** Merchant language override; only the API chooses the resolved language. */
|
|
20
|
+
locale?: string;
|
|
19
21
|
/**
|
|
20
22
|
* The merchant's payment method layout rules. The runtime has the billing API resolve them
|
|
21
23
|
* for the buyer and lays out the payment method groups in that order, with the groups behind
|
|
@@ -76,6 +78,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
76
78
|
type: PropType<Record<string, string>>;
|
|
77
79
|
default: undefined;
|
|
78
80
|
};
|
|
81
|
+
locale: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
79
85
|
paymentMethodLayout: {
|
|
80
86
|
type: PropType<PaymentMethodLayoutRules>;
|
|
81
87
|
default: undefined;
|
|
@@ -130,6 +136,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
130
136
|
type: PropType<Record<string, string>>;
|
|
131
137
|
default: undefined;
|
|
132
138
|
};
|
|
139
|
+
locale: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
default: undefined;
|
|
142
|
+
};
|
|
133
143
|
paymentMethodLayout: {
|
|
134
144
|
type: PropType<PaymentMethodLayoutRules>;
|
|
135
145
|
default: undefined;
|
|
@@ -163,6 +173,7 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
|
|
|
163
173
|
createSession: Record<string, unknown>;
|
|
164
174
|
appearance: Record<string, unknown>;
|
|
165
175
|
strings: Record<string, string>;
|
|
176
|
+
locale: string;
|
|
166
177
|
paymentMethodLayout: PaymentMethodLayoutRules;
|
|
167
178
|
layout: CheckoutLayout;
|
|
168
179
|
automaticPayment: CheckoutRuntimeAutomaticPayment;
|
|
@@ -15,6 +15,10 @@ export declare const FloPayRuntimePaymentMethodSetup: import("vue").DefineCompon
|
|
|
15
15
|
readonly type: StringConstructor;
|
|
16
16
|
readonly required: true;
|
|
17
17
|
};
|
|
18
|
+
readonly locale: {
|
|
19
|
+
readonly type: StringConstructor;
|
|
20
|
+
readonly default: undefined;
|
|
21
|
+
};
|
|
18
22
|
readonly theme: {
|
|
19
23
|
readonly type: import("vue").PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
20
24
|
readonly default: undefined;
|
|
@@ -61,6 +65,10 @@ export declare const FloPayRuntimePaymentMethodSetup: import("vue").DefineCompon
|
|
|
61
65
|
readonly type: StringConstructor;
|
|
62
66
|
readonly required: true;
|
|
63
67
|
};
|
|
68
|
+
readonly locale: {
|
|
69
|
+
readonly type: StringConstructor;
|
|
70
|
+
readonly default: undefined;
|
|
71
|
+
};
|
|
64
72
|
readonly theme: {
|
|
65
73
|
readonly type: import("vue").PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
66
74
|
readonly default: undefined;
|
|
@@ -97,6 +105,7 @@ export declare const FloPayRuntimePaymentMethodSetup: import("vue").DefineCompon
|
|
|
97
105
|
onReady?: (() => any) | undefined;
|
|
98
106
|
onValidation?: ((_message: string | null) => any) | undefined;
|
|
99
107
|
}>, {
|
|
108
|
+
readonly locale: string;
|
|
100
109
|
readonly theme: import("@flopay/shared").VaultCardThemeColors | import("@flopay/shared").ThemeId;
|
|
101
110
|
readonly appearance: import("@flopay/shared").FloPayAppearance;
|
|
102
111
|
readonly buttonsStyles: import("@flopay/shared").ButtonsLayoutStyles;
|
|
@@ -70,6 +70,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
70
70
|
type: PropType<Record<string, string>>;
|
|
71
71
|
default: undefined;
|
|
72
72
|
};
|
|
73
|
+
locale: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
73
77
|
paymentMethodLayout: {
|
|
74
78
|
type: PropType<PaymentMethodLayoutRules>;
|
|
75
79
|
default: undefined;
|
|
@@ -180,6 +184,10 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
180
184
|
type: PropType<Record<string, string>>;
|
|
181
185
|
default: undefined;
|
|
182
186
|
};
|
|
187
|
+
locale: {
|
|
188
|
+
type: StringConstructor;
|
|
189
|
+
default: undefined;
|
|
190
|
+
};
|
|
183
191
|
paymentMethodLayout: {
|
|
184
192
|
type: PropType<PaymentMethodLayoutRules>;
|
|
185
193
|
default: undefined;
|
|
@@ -267,6 +275,7 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
|
|
|
267
275
|
createSession: Record<string, unknown>;
|
|
268
276
|
appearance: Record<string, unknown>;
|
|
269
277
|
strings: Record<string, string>;
|
|
278
|
+
locale: string;
|
|
270
279
|
paymentMethodLayout: PaymentMethodLayoutRules;
|
|
271
280
|
layout: "buttons" | "default";
|
|
272
281
|
automaticPayment: CheckoutRuntimeAutomaticPayment;
|
|
@@ -301,6 +310,10 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
|
|
|
301
310
|
readonly type: StringConstructor;
|
|
302
311
|
readonly required: true;
|
|
303
312
|
};
|
|
313
|
+
readonly locale: {
|
|
314
|
+
readonly type: StringConstructor;
|
|
315
|
+
readonly default: undefined;
|
|
316
|
+
};
|
|
304
317
|
readonly theme: {
|
|
305
318
|
readonly type: PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
306
319
|
readonly default: undefined;
|
|
@@ -347,6 +360,10 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
|
|
|
347
360
|
readonly type: StringConstructor;
|
|
348
361
|
readonly required: true;
|
|
349
362
|
};
|
|
363
|
+
readonly locale: {
|
|
364
|
+
readonly type: StringConstructor;
|
|
365
|
+
readonly default: undefined;
|
|
366
|
+
};
|
|
350
367
|
readonly theme: {
|
|
351
368
|
readonly type: PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
352
369
|
readonly default: undefined;
|
|
@@ -383,6 +400,7 @@ export declare const FloPayCardSetup: import("vue").DefineComponent<import("vue"
|
|
|
383
400
|
onReady?: (() => any) | undefined;
|
|
384
401
|
onValidation?: ((_message: string | null) => any) | undefined;
|
|
385
402
|
}>, {
|
|
403
|
+
readonly locale: string;
|
|
386
404
|
readonly theme: import("@flopay/shared").VaultCardThemeColors | import("@flopay/shared").ThemeId;
|
|
387
405
|
readonly appearance: import("@flopay/shared").FloPayAppearance;
|
|
388
406
|
readonly buttonsStyles: import("@flopay/shared").ButtonsLayoutStyles;
|
|
@@ -400,6 +418,10 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
|
|
|
400
418
|
readonly type: StringConstructor;
|
|
401
419
|
readonly required: true;
|
|
402
420
|
};
|
|
421
|
+
readonly locale: {
|
|
422
|
+
readonly type: StringConstructor;
|
|
423
|
+
readonly default: undefined;
|
|
424
|
+
};
|
|
403
425
|
readonly theme: {
|
|
404
426
|
readonly type: PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
405
427
|
readonly default: undefined;
|
|
@@ -446,6 +468,10 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
|
|
|
446
468
|
readonly type: StringConstructor;
|
|
447
469
|
readonly required: true;
|
|
448
470
|
};
|
|
471
|
+
readonly locale: {
|
|
472
|
+
readonly type: StringConstructor;
|
|
473
|
+
readonly default: undefined;
|
|
474
|
+
};
|
|
449
475
|
readonly theme: {
|
|
450
476
|
readonly type: PropType<import("@flopay/shared").ThemeId | import("@flopay/shared").VaultCardThemeColors>;
|
|
451
477
|
readonly default: undefined;
|
|
@@ -482,6 +508,7 @@ export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<imp
|
|
|
482
508
|
onReady?: (() => any) | undefined;
|
|
483
509
|
onValidation?: ((_message: string | null) => any) | undefined;
|
|
484
510
|
}>, {
|
|
511
|
+
readonly locale: string;
|
|
485
512
|
readonly theme: import("@flopay/shared").VaultCardThemeColors | import("@flopay/shared").ThemeId;
|
|
486
513
|
readonly appearance: import("@flopay/shared").FloPayAppearance;
|
|
487
514
|
readonly buttonsStyles: import("@flopay/shared").ButtonsLayoutStyles;
|
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,7 @@ function setupConfig(props) {
|
|
|
92
92
|
var setupProps = {
|
|
93
93
|
sessionId: { type: String, required: true },
|
|
94
94
|
nonce: { type: String, required: true },
|
|
95
|
+
locale: { type: String, default: void 0 },
|
|
95
96
|
theme: {
|
|
96
97
|
type: [String, Object],
|
|
97
98
|
default: void 0
|
|
@@ -198,7 +199,8 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
198
199
|
setup: kind,
|
|
199
200
|
sessionId: props.sessionId,
|
|
200
201
|
nonce: props.nonce,
|
|
201
|
-
contractVersion: SETUP_CONTRACT_VERSION,
|
|
202
|
+
contractVersion: props.locale === void 0 ? SETUP_CONTRACT_VERSION : "2.7.0",
|
|
203
|
+
locale: props.locale,
|
|
202
204
|
...setupConfig(props),
|
|
203
205
|
onEvent
|
|
204
206
|
});
|
|
@@ -210,7 +212,7 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
210
212
|
};
|
|
211
213
|
(0, import_vue.onMounted)(start);
|
|
212
214
|
(0, import_vue.watch)(
|
|
213
|
-
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs],
|
|
215
|
+
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs, props.locale],
|
|
214
216
|
() => {
|
|
215
217
|
stop();
|
|
216
218
|
start();
|
|
@@ -284,7 +286,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
|
284
286
|
"setup",
|
|
285
287
|
"hiddenPaymentMethods"
|
|
286
288
|
]);
|
|
287
|
-
function declaredContractVersion(savedPayment, extra) {
|
|
289
|
+
function declaredContractVersion(savedPayment, extra, locale) {
|
|
290
|
+
if (locale !== void 0) return "2.7.0";
|
|
288
291
|
if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
|
|
289
292
|
return PRESENTATION_CONTRACT_VERSION;
|
|
290
293
|
}
|
|
@@ -313,6 +316,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
313
316
|
createSession: { type: Object, default: void 0 },
|
|
314
317
|
appearance: { type: Object, default: void 0 },
|
|
315
318
|
strings: { type: Object, default: void 0 },
|
|
319
|
+
locale: { type: String, default: void 0 },
|
|
316
320
|
paymentMethodLayout: {
|
|
317
321
|
type: Object,
|
|
318
322
|
default: void 0
|
|
@@ -351,7 +355,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
351
355
|
const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
|
|
352
356
|
handle = runtime.mount(container.value, {
|
|
353
357
|
...extra,
|
|
354
|
-
contractVersion: declaredContractVersion(Boolean(mode), extra),
|
|
358
|
+
contractVersion: declaredContractVersion(Boolean(mode), extra, props.locale),
|
|
355
359
|
...mode ? {
|
|
356
360
|
automaticPayment: savedPaymentSetting(
|
|
357
361
|
mode,
|
|
@@ -364,6 +368,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
364
368
|
createSession: props.createSession,
|
|
365
369
|
appearance: props.appearance,
|
|
366
370
|
strings: props.strings,
|
|
371
|
+
locale: props.locale,
|
|
367
372
|
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
368
373
|
...props.layout ? { layout: props.layout } : {},
|
|
369
374
|
onEvent: (event) => emit("event", event)
|
|
@@ -405,6 +410,12 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
|
|
|
405
410
|
if (strings !== void 0) handle?.update({ strings });
|
|
406
411
|
}
|
|
407
412
|
);
|
|
413
|
+
(0, import_vue3.watch)(
|
|
414
|
+
() => props.locale,
|
|
415
|
+
(locale) => {
|
|
416
|
+
if (locale !== void 0) handle?.update({ locale });
|
|
417
|
+
}
|
|
418
|
+
);
|
|
408
419
|
(0, import_vue3.watch)(
|
|
409
420
|
// By value, so equal rules in a new (or reactive) object ask for no new layout.
|
|
410
421
|
() => rulesKey(props.paymentMethodLayout),
|
|
@@ -438,6 +449,7 @@ var CORE_PROPS = [
|
|
|
438
449
|
"createSession",
|
|
439
450
|
"appearance",
|
|
440
451
|
"strings",
|
|
452
|
+
"locale",
|
|
441
453
|
"paymentMethodLayout",
|
|
442
454
|
"layout",
|
|
443
455
|
"automaticPayment",
|
|
@@ -481,6 +493,7 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
|
|
|
481
493
|
createSession: { type: Object, default: void 0 },
|
|
482
494
|
appearance: { type: Object, default: void 0 },
|
|
483
495
|
strings: { type: Object, default: void 0 },
|
|
496
|
+
locale: { type: String, default: void 0 },
|
|
484
497
|
paymentMethodLayout: { type: Object, default: void 0 },
|
|
485
498
|
layout: { type: String, default: void 0 },
|
|
486
499
|
automaticPayment: {
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FloPayRuntimePaymentMethodSetup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5PV37HJM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
FloPayRuntimeCardSetup
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XKVNXE72.mjs";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { dropThirdPartyOnlyError } from "@flopay/shared";
|
|
@@ -41,7 +41,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
|
|
|
41
41
|
"setup",
|
|
42
42
|
"hiddenPaymentMethods"
|
|
43
43
|
]);
|
|
44
|
-
function declaredContractVersion(savedPayment, extra) {
|
|
44
|
+
function declaredContractVersion(savedPayment, extra, locale) {
|
|
45
|
+
if (locale !== void 0) return "2.7.0";
|
|
45
46
|
if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
|
|
46
47
|
return PRESENTATION_CONTRACT_VERSION;
|
|
47
48
|
}
|
|
@@ -70,6 +71,7 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
70
71
|
createSession: { type: Object, default: void 0 },
|
|
71
72
|
appearance: { type: Object, default: void 0 },
|
|
72
73
|
strings: { type: Object, default: void 0 },
|
|
74
|
+
locale: { type: String, default: void 0 },
|
|
73
75
|
paymentMethodLayout: {
|
|
74
76
|
type: Object,
|
|
75
77
|
default: void 0
|
|
@@ -108,7 +110,7 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
108
110
|
const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
|
|
109
111
|
handle = runtime.mount(container.value, {
|
|
110
112
|
...extra,
|
|
111
|
-
contractVersion: declaredContractVersion(Boolean(mode), extra),
|
|
113
|
+
contractVersion: declaredContractVersion(Boolean(mode), extra, props.locale),
|
|
112
114
|
...mode ? {
|
|
113
115
|
automaticPayment: savedPaymentSetting(
|
|
114
116
|
mode,
|
|
@@ -121,6 +123,7 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
121
123
|
createSession: props.createSession,
|
|
122
124
|
appearance: props.appearance,
|
|
123
125
|
strings: props.strings,
|
|
126
|
+
locale: props.locale,
|
|
124
127
|
paymentMethodLayout: rulesFromKey(mountedLayoutRules),
|
|
125
128
|
...props.layout ? { layout: props.layout } : {},
|
|
126
129
|
onEvent: (event) => emit("event", event)
|
|
@@ -162,6 +165,12 @@ var FloPayRuntimeCheckout = defineComponent({
|
|
|
162
165
|
if (strings !== void 0) handle?.update({ strings });
|
|
163
166
|
}
|
|
164
167
|
);
|
|
168
|
+
watch(
|
|
169
|
+
() => props.locale,
|
|
170
|
+
(locale) => {
|
|
171
|
+
if (locale !== void 0) handle?.update({ locale });
|
|
172
|
+
}
|
|
173
|
+
);
|
|
165
174
|
watch(
|
|
166
175
|
// By value, so equal rules in a new (or reactive) object ask for no new layout.
|
|
167
176
|
() => rulesKey(props.paymentMethodLayout),
|
|
@@ -195,6 +204,7 @@ var CORE_PROPS = [
|
|
|
195
204
|
"createSession",
|
|
196
205
|
"appearance",
|
|
197
206
|
"strings",
|
|
207
|
+
"locale",
|
|
198
208
|
"paymentMethodLayout",
|
|
199
209
|
"layout",
|
|
200
210
|
"automaticPayment",
|
|
@@ -238,6 +248,7 @@ var FloPayCheckout = defineComponent2({
|
|
|
238
248
|
createSession: { type: Object, default: void 0 },
|
|
239
249
|
appearance: { type: Object, default: void 0 },
|
|
240
250
|
strings: { type: Object, default: void 0 },
|
|
251
|
+
locale: { type: String, default: void 0 },
|
|
241
252
|
paymentMethodLayout: { type: Object, default: void 0 },
|
|
242
253
|
layout: { type: String, default: void 0 },
|
|
243
254
|
automaticPayment: {
|
|
@@ -83,6 +83,7 @@ function setupConfig(props) {
|
|
|
83
83
|
var setupProps = {
|
|
84
84
|
sessionId: { type: String, required: true },
|
|
85
85
|
nonce: { type: String, required: true },
|
|
86
|
+
locale: { type: String, default: void 0 },
|
|
86
87
|
theme: {
|
|
87
88
|
type: [String, Object],
|
|
88
89
|
default: void 0
|
|
@@ -189,7 +190,8 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
189
190
|
setup: kind,
|
|
190
191
|
sessionId: props.sessionId,
|
|
191
192
|
nonce: props.nonce,
|
|
192
|
-
contractVersion: SETUP_CONTRACT_VERSION,
|
|
193
|
+
contractVersion: props.locale === void 0 ? SETUP_CONTRACT_VERSION : "2.7.0",
|
|
194
|
+
locale: props.locale,
|
|
193
195
|
...setupConfig(props),
|
|
194
196
|
onEvent
|
|
195
197
|
});
|
|
@@ -201,7 +203,7 @@ function setupRuntimeSetup(kind, props, emit) {
|
|
|
201
203
|
};
|
|
202
204
|
(0, import_vue.onMounted)(start);
|
|
203
205
|
(0, import_vue.watch)(
|
|
204
|
-
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs],
|
|
206
|
+
() => [props.sessionId, props.nonce, props.runtimeUrl, props.runtimeTimeoutMs, props.locale],
|
|
205
207
|
() => {
|
|
206
208
|
stop();
|
|
207
209
|
start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
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.1.1",
|
|
40
|
+
"@flopay/shared": "2.1.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"vue": ">=3.3.0"
|