@flopay/vue 2.2.7 → 2.2.9

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 CHANGED
@@ -95,6 +95,10 @@ const render = () =>
95
95
 
96
96
  The checkout components accept `buttonsStyles` with the existing `ButtonsLayoutStyles` type from runtime contract 2.8.0. It preserves card, input, submit-button and address-field styling through the hosted frame. Updating the prop re-styles the existing frame without remounting or reading the session again. Omitting it keeps the current overrides; `{}` clears them. The billing API and session still own country, address requirements and payment-method availability.
97
97
 
98
+ ### Buyer country
99
+
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
+
98
102
  Every `@flopay/react` component and hook has a same-name Vue export. React's notification callbacks are Vue events with the same payloads.
99
103
 
100
104
  | Export | React (`@flopay/react`) | Vue (`@flopay/vue`) |
@@ -20,6 +20,13 @@ export interface FloPayRuntimeCheckoutProps {
20
20
  strings?: Record<string, string>;
21
21
  /** Merchant language override; only the API chooses the resolved language. */
22
22
  locale?: string;
23
+ /**
24
+ * The buyer's country (ISO alpha-2), as the 1.x `country` prop (contract 2.9.0). The runtime
25
+ * offers a payment method with a country rule only when the country is in it; the country the
26
+ * buyer picks in the AVS form wins over this one, and this one over the session's. A later
27
+ * change applies to the mounted checkout; removing it lets the session's country apply again.
28
+ */
29
+ country?: string;
23
30
  /**
24
31
  * The merchant's payment method layout rules. The runtime has the billing API resolve them
25
32
  * for the buyer and lays out the payment method groups in that order, with the groups behind
@@ -88,6 +95,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
88
95
  type: StringConstructor;
89
96
  default: undefined;
90
97
  };
98
+ country: {
99
+ type: StringConstructor;
100
+ default: undefined;
101
+ };
91
102
  paymentMethodLayout: {
92
103
  type: PropType<PaymentMethodLayoutRules>;
93
104
  default: undefined;
@@ -150,6 +161,10 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
150
161
  type: StringConstructor;
151
162
  default: undefined;
152
163
  };
164
+ country: {
165
+ type: StringConstructor;
166
+ default: undefined;
167
+ };
153
168
  paymentMethodLayout: {
154
169
  type: PropType<PaymentMethodLayoutRules>;
155
170
  default: undefined;
@@ -185,6 +200,7 @@ export declare const FloPayRuntimeCheckout: import("vue").DefineComponent<import
185
200
  buttonsStyles: ButtonsLayoutStyles;
186
201
  strings: Record<string, string>;
187
202
  locale: string;
203
+ country: string;
188
204
  paymentMethodLayout: PaymentMethodLayoutRules;
189
205
  layout: CheckoutLayout;
190
206
  automaticPayment: CheckoutRuntimeAutomaticPayment;
@@ -78,6 +78,11 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
78
78
  type: StringConstructor;
79
79
  default: undefined;
80
80
  };
81
+ /** The buyer's country (contract 2.9.0); the runtime offers what it allows. */
82
+ country: {
83
+ type: StringConstructor;
84
+ default: undefined;
85
+ };
81
86
  paymentMethodLayout: {
82
87
  type: PropType<PaymentMethodLayoutRules>;
83
88
  default: undefined;
@@ -196,6 +201,11 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
196
201
  type: StringConstructor;
197
202
  default: undefined;
198
203
  };
204
+ /** The buyer's country (contract 2.9.0); the runtime offers what it allows. */
205
+ country: {
206
+ type: StringConstructor;
207
+ default: undefined;
208
+ };
199
209
  paymentMethodLayout: {
200
210
  type: PropType<PaymentMethodLayoutRules>;
201
211
  default: undefined;
@@ -285,6 +295,7 @@ export declare const FloPayCheckout: import("vue").DefineComponent<import("vue")
285
295
  buttonsStyles: ButtonsLayoutStyles;
286
296
  strings: Record<string, string>;
287
297
  locale: string;
298
+ country: string;
288
299
  paymentMethodLayout: PaymentMethodLayoutRules;
289
300
  layout: "buttons" | "default";
290
301
  automaticPayment: CheckoutRuntimeAutomaticPayment;
package/dist/index.cjs CHANGED
@@ -286,7 +286,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
286
286
  "setup",
287
287
  "hiddenPaymentMethods"
288
288
  ]);
289
- function declaredContractVersion(savedPayment, extra, locale, buttonsStyles) {
289
+ function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country) {
290
+ if (country !== void 0) return "2.9.0";
290
291
  if (buttonsStyles !== void 0) return "2.8.0";
291
292
  if (locale !== void 0) return "2.7.0";
292
293
  if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
@@ -319,6 +320,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
319
320
  buttonsStyles: { type: Object, default: void 0 },
320
321
  strings: { type: Object, default: void 0 },
321
322
  locale: { type: String, default: void 0 },
323
+ country: { type: String, default: void 0 },
322
324
  paymentMethodLayout: {
323
325
  type: Object,
324
326
  default: void 0
@@ -341,6 +343,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
341
343
  let handle = null;
342
344
  let mountedLayoutRules;
343
345
  let mountedStyles;
346
+ let mountedCountry;
344
347
  let run = 0;
345
348
  const stop = () => {
346
349
  run += 1;
@@ -355,6 +358,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
355
358
  if (current !== run || !container.value) return;
356
359
  mountedLayoutRules = rulesKey(props.paymentMethodLayout);
357
360
  mountedStyles = props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles);
361
+ mountedCountry = props.country;
358
362
  const mode = props.automaticPayment?.mode;
359
363
  const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
360
364
  handle = runtime.mount(container.value, {
@@ -363,7 +367,8 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
363
367
  Boolean(mode),
364
368
  extra,
365
369
  props.locale,
366
- props.buttonsStyles
370
+ props.buttonsStyles,
371
+ props.country
367
372
  ),
368
373
  ...mode ? {
369
374
  automaticPayment: savedPaymentSetting(
@@ -379,6 +384,7 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
379
384
  buttonsStyles: props.buttonsStyles,
380
385
  strings: props.strings,
381
386
  locale: props.locale,
387
+ ...props.country === void 0 ? {} : { country: props.country },
382
388
  paymentMethodLayout: rulesFromKey(mountedLayoutRules),
383
389
  ...props.layout ? { layout: props.layout } : {},
384
390
  onEvent: (event) => emit("event", event)
@@ -434,6 +440,14 @@ var FloPayRuntimeCheckout = (0, import_vue3.defineComponent)({
434
440
  if (locale !== void 0) handle?.update({ locale });
435
441
  }
436
442
  );
443
+ (0, import_vue3.watch)(
444
+ () => props.country,
445
+ (country) => {
446
+ if (country === mountedCountry || !handle) return;
447
+ mountedCountry = country;
448
+ handle.update({ country: country ?? "" });
449
+ }
450
+ );
437
451
  (0, import_vue3.watch)(
438
452
  // By value, so equal rules in a new (or reactive) object ask for no new layout.
439
453
  () => rulesKey(props.paymentMethodLayout),
@@ -469,6 +483,7 @@ var CORE_PROPS = [
469
483
  "appearance",
470
484
  "strings",
471
485
  "locale",
486
+ "country",
472
487
  "paymentMethodLayout",
473
488
  "layout",
474
489
  "automaticPayment",
@@ -514,6 +529,8 @@ var FloPayCheckout = (0, import_vue4.defineComponent)({
514
529
  buttonsStyles: { type: Object, default: void 0 },
515
530
  strings: { type: Object, default: void 0 },
516
531
  locale: { type: String, default: void 0 },
532
+ /** The buyer's country (contract 2.9.0); the runtime offers what it allows. */
533
+ country: { type: String, default: void 0 },
517
534
  paymentMethodLayout: { type: Object, default: void 0 },
518
535
  layout: { type: String, default: void 0 },
519
536
  automaticPayment: {
package/dist/index.mjs CHANGED
@@ -41,7 +41,8 @@ var OPTIONS_BEFORE_PRESENTATION = /* @__PURE__ */ new Set([
41
41
  "setup",
42
42
  "hiddenPaymentMethods"
43
43
  ]);
44
- function declaredContractVersion(savedPayment, extra, locale, buttonsStyles) {
44
+ function declaredContractVersion(savedPayment, extra, locale, buttonsStyles, country) {
45
+ if (country !== void 0) return "2.9.0";
45
46
  if (buttonsStyles !== void 0) return "2.8.0";
46
47
  if (locale !== void 0) return "2.7.0";
47
48
  if (extra !== void 0 && Object.keys(extra).some((name) => !OPTIONS_BEFORE_PRESENTATION.has(name))) {
@@ -74,6 +75,7 @@ var FloPayRuntimeCheckout = defineComponent({
74
75
  buttonsStyles: { type: Object, default: void 0 },
75
76
  strings: { type: Object, default: void 0 },
76
77
  locale: { type: String, default: void 0 },
78
+ country: { type: String, default: void 0 },
77
79
  paymentMethodLayout: {
78
80
  type: Object,
79
81
  default: void 0
@@ -96,6 +98,7 @@ var FloPayRuntimeCheckout = defineComponent({
96
98
  let handle = null;
97
99
  let mountedLayoutRules;
98
100
  let mountedStyles;
101
+ let mountedCountry;
99
102
  let run = 0;
100
103
  const stop = () => {
101
104
  run += 1;
@@ -110,6 +113,7 @@ var FloPayRuntimeCheckout = defineComponent({
110
113
  if (current !== run || !container.value) return;
111
114
  mountedLayoutRules = rulesKey(props.paymentMethodLayout);
112
115
  mountedStyles = props.buttonsStyles === void 0 ? void 0 : JSON.stringify(props.buttonsStyles);
116
+ mountedCountry = props.country;
113
117
  const mode = props.automaticPayment?.mode;
114
118
  const extra = props.extraMountOptions === void 0 ? void 0 : JSON.parse(JSON.stringify(props.extraMountOptions));
115
119
  handle = runtime.mount(container.value, {
@@ -118,7 +122,8 @@ var FloPayRuntimeCheckout = defineComponent({
118
122
  Boolean(mode),
119
123
  extra,
120
124
  props.locale,
121
- props.buttonsStyles
125
+ props.buttonsStyles,
126
+ props.country
122
127
  ),
123
128
  ...mode ? {
124
129
  automaticPayment: savedPaymentSetting(
@@ -134,6 +139,7 @@ var FloPayRuntimeCheckout = defineComponent({
134
139
  buttonsStyles: props.buttonsStyles,
135
140
  strings: props.strings,
136
141
  locale: props.locale,
142
+ ...props.country === void 0 ? {} : { country: props.country },
137
143
  paymentMethodLayout: rulesFromKey(mountedLayoutRules),
138
144
  ...props.layout ? { layout: props.layout } : {},
139
145
  onEvent: (event) => emit("event", event)
@@ -189,6 +195,14 @@ var FloPayRuntimeCheckout = defineComponent({
189
195
  if (locale !== void 0) handle?.update({ locale });
190
196
  }
191
197
  );
198
+ watch(
199
+ () => props.country,
200
+ (country) => {
201
+ if (country === mountedCountry || !handle) return;
202
+ mountedCountry = country;
203
+ handle.update({ country: country ?? "" });
204
+ }
205
+ );
192
206
  watch(
193
207
  // By value, so equal rules in a new (or reactive) object ask for no new layout.
194
208
  () => rulesKey(props.paymentMethodLayout),
@@ -224,6 +238,7 @@ var CORE_PROPS = [
224
238
  "appearance",
225
239
  "strings",
226
240
  "locale",
241
+ "country",
227
242
  "paymentMethodLayout",
228
243
  "layout",
229
244
  "automaticPayment",
@@ -269,6 +284,8 @@ var FloPayCheckout = defineComponent2({
269
284
  buttonsStyles: { type: Object, default: void 0 },
270
285
  strings: { type: Object, default: void 0 },
271
286
  locale: { type: String, default: void 0 },
287
+ /** The buyer's country (contract 2.9.0); the runtime offers what it allows. */
288
+ country: { type: String, default: void 0 },
272
289
  paymentMethodLayout: { type: Object, default: void 0 },
273
290
  layout: { type: String, default: void 0 },
274
291
  automaticPayment: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/vue",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
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.2.7",
40
- "@flopay/shared": "2.2.7"
39
+ "@flopay/js": "2.2.9",
40
+ "@flopay/shared": "2.2.9"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "vue": ">=3.3.0"