@rebilly/framepay-vue 12.230.5 → 12.231.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
- ## 12.230.5 (2026-10-13)
1
+ ## 12.231.0 (2026-10-13)
2
2
 
3
- ### 🧱 Updated Dependencies
3
+ ### Features
4
4
 
5
- - Updated framepay-npm to 5.231.5
5
+ - **framepay-vue:** allow a host-provided FramePay loader and mount extraData ([#28929](https://github.com/Rebilly/rebilly/pull/28929), [#27995](https://github.com/Rebilly/rebilly/issues/27995))
package/README.md CHANGED
@@ -21,6 +21,7 @@ This is the repo for the official Vue.js wrapper for Rebilly's [FramePay](https:
21
21
  - [At startup](#at-startup)
22
22
  - [On a component (rebilly-form, rebilly-card etc)](#on-a-component-rebilly-form-rebilly-card-etc)
23
23
  - [Lazy loading Framepay files](#lazy-loading-framepay-files)
24
+ - [Using a FramePay instance the page already loads](#using-a-framepay-instance-the-page-already-loads)
24
25
  - [Usage](#usage)
25
26
  - [Google Pay and Apple Pay](#google-pay-and-apple-pay)
26
27
  - [With rebilly-form](#with-rebilly-form)
@@ -52,6 +53,8 @@ This is the repo for the official Vue.js wrapper for Rebilly's [FramePay](https:
52
53
  - [Separate Bank Account fields](#separate-bank-account-fields)
53
54
  - [IBAN (International Bank Account Number) field](#iban-international-bank-account-number-field)
54
55
  - [Props](#props)
56
+ - [The mounted element](#the-mounted-element)
57
+ - [TypeScript](#typescript)
55
58
  - [Further Reading](#further-reading)
56
59
 
57
60
  ## FramePay Documentation
@@ -90,6 +93,8 @@ app.use(FramePay);
90
93
 
91
94
  `app.use()` also accepts an optional argument for initialization options. See [Initialization](#initialization) below.
92
95
 
96
+ The package ships TypeScript declarations. See [TypeScript](#typescript).
97
+
93
98
  ## Getting Started
94
99
 
95
100
  ### Initialization
@@ -158,13 +163,40 @@ The script will only be loaded the first time `created()` is called, so you can
158
163
  </script>
159
164
  ```
160
165
 
166
+ #### Using a FramePay instance the page already loads
167
+
168
+ By default `app.use(FramePay)` adds the FramePay script and stylesheet from the Rebilly CDN to the page. A page that loads FramePay itself, for example with a custom script URL, its own styles, or one instance shared with other code, can hand that loading to `framepay-vue` instead. Pass a `loader` as the third argument of `app.use()`: a function that returns a promise resolving with the FramePay instance.
169
+
170
+ ```javascript
171
+ // main.js
172
+ import FramePay from '@rebilly/framepay-vue';
173
+ import { loadFramepay } from '@rebilly/framepay';
174
+
175
+ const framepayLoaded = loadFramepay({
176
+ scriptLink: 'https://framepay.rebilly.com/framepay.js',
177
+ styleLink: 'no-style-script', // the page ships its own FramePay styles
178
+ }).then((framepay) => {
179
+ framepay.initialize({ publishableKey: 'pk_sandbox_1234567890' });
180
+ return framepay;
181
+ });
182
+
183
+ app.use(FramePay, {}, { loader: () => framepayLoaded });
184
+ ```
185
+
186
+ With a `loader`, `framepay-vue` injects no script and no stylesheet, and the components mount on the instance the loader resolves with.
187
+
188
+ - The loader is called once, when the plugin is installed, however many times `app.use()` runs. As with the default loading, the first call wins: a loader passed to a later `app.use()` is ignored.
189
+ - The page initializes FramePay itself. Pass no `publishableKey` or `jwt` to `framepay-vue`: it only waits for FramePay's `ready` event, which FramePay also reports to listeners added after it fired, so the order of the host's `initialize()` and the loader does not matter.
190
+ - If the loader rejects, throws, or resolves with anything but the FramePay instance, every component rejects with a `FramePayLoadError`.
191
+ - A field created while FramePay is in a failed state, after an `initialize()` that failed and before a successful retry, stays unmounted. Recreate it once FramePay is ready.
192
+
161
193
  ### Usage
162
194
 
163
195
  `framepay-vue` offers three sets of payment method components:
164
196
 
165
197
  - `RebillyCard` automatically mounts the combined credit card payment method
166
198
  - `RebillyCardCvv`, `RebillycardExpiration`, and `RebillyCardNumber` mount three separate components for collecting credit info
167
- - `RebillyBankAccountNumber`, `RebillyBankAccountType`, and `RebillyBankRoutingNumber` mount the `ach` (bank account) payment method
199
+ - `RebillyBbanAccountNumber`, `RebillyBbanAccountType`, and `RebillyBbanRoutingNumber` mount the `ach` (bank account) payment method
168
200
  - `RebillyGooglePay` and `RebillyApplePay` mount Google Pay and Apple Pay respectively. These two methods are different from the rest, as they require additional inputs and emit the payment token with a separate event.
169
201
 
170
202
  Two more components are also offered for convenience:
@@ -331,9 +363,9 @@ Framepay will automatically use the first payment method it detects in the form.
331
363
  <input data-rebilly="lastName" />
332
364
  <rebilly-card v-if="paymentMethod === 'payment-card'"></rebilly-card>
333
365
  <div v-if="paymentMethod=== 'ach'">
334
- <rebilly-bank-account-type></rebilly-bank-account-type>
335
- <rebilly-bank-account-number></rebilly-bank-account-number>
336
- <rebilly-bank-routing-number></rebilly-bank-routing-number>
366
+ <rebilly-bban-account-type></rebilly-bban-account-type>
367
+ <rebilly-bban-account-number></rebilly-bban-account-number>
368
+ <rebilly-bban-routing-number></rebilly-bban-routing-number>
337
369
  </div>
338
370
  </rebilly-form>
339
371
 
@@ -353,9 +385,9 @@ It is possible to use `v-show` instead, which will allow you to preserve the use
353
385
  <input data-rebilly="lastName" />
354
386
  <rebilly-card v-show="paymentMethod === 'payment-card'"></rebilly-card>
355
387
  <div v-show="paymentMethod=== 'ach'">
356
- <rebilly-bank-account-type></rebilly-bank-account-type>
357
- <rebilly-bank-account-number></rebilly-bank-account-number>
358
- <rebilly-bank-routing-number></rebilly-bank-routing-number>
388
+ <rebilly-bban-account-type></rebilly-bban-account-type>
389
+ <rebilly-bban-account-number></rebilly-bban-account-number>
390
+ <rebilly-bban-routing-number></rebilly-bban-routing-number>
359
391
  </div>
360
392
  </rebilly-form>
361
393
 
@@ -371,7 +403,7 @@ As covered above, `rebilly-form` emits `error` and `submit` events.
371
403
 
372
404
  #### on payment method components
373
405
 
374
- Payment method components emit the following events: `on`, `ready`, `focus` and `change`.
406
+ Payment method components emit the following events: `ready`, `change`, `focus` and `blur`.
375
407
 
376
408
  See details: https://www.rebilly.com/docs/dev-docs/element
377
409
 
@@ -403,7 +435,7 @@ See details: https://www.rebilly.com/docs/dev-docs/element
403
435
 
404
436
  By default, each payment method component's ID is the component name with `-mount` appended, eg: `rebilly-card-mount`
405
437
 
406
- This can be changed by simply passing `id` as a prop to `<rebilly-card>`, `<rebilly-bank-account-number>` etc.
438
+ This can be changed by simply passing `id` as a prop to `<rebilly-card>`, `<rebilly-bban-account-number>` etc.
407
439
 
408
440
  Because this will only change the ID of the element you are mounting Framepay to, it will not interfere any of the default or custom Framepay styling.
409
441
 
@@ -463,9 +495,9 @@ These elements must all be mounted in the same form in order to successfully cre
463
495
 
464
496
  These elements must all be mounted in the same form in order to successfully create a token.
465
497
 
466
- - `RebillyBankAccountNumber` - mounts a bank account number field
467
- - `RebillyBankAccountType` - mounts a set of inline buttons to select bank account type
468
- - `RebillyBankRoutingNumber` - mounts a bank routing number field
498
+ - `RebillyBbanAccountNumber` - mounts a bank account number field
499
+ - `RebillyBbanAccountType` - mounts a set of inline buttons to select bank account type
500
+ - `RebillyBbanRoutingNumber` - mounts a bank routing number field
469
501
 
470
502
  ##### IBAN (International Bank Account Number) field
471
503
 
@@ -479,6 +511,42 @@ Payment method components all accept the same props:
479
511
  - `@ready`, `@change`, `@focus`, `@blur`
480
512
  - the `configuration` object for initialization
481
513
 
514
+ The card components (`RebillyCard`, `RebillyCardNumber`, `RebillyCardExpiration`, `RebillyCardCvv`) also accept:
515
+
516
+ - `extraData`, passed as the third argument of `Framepay.card.mount()`. For example `{ cardType: 'Visa' }` makes a standalone CVV field validate the length for that brand. `cardType` takes the payment card's `brand` as the API returns it, such as `'Visa'` or `'American Express'`. A value FramePay does not recognize, such as `'visa'`, turns off the length check without an error. It is read once, when the field mounts. To change it, recreate the component with `v-if` or `:key`. This is not the `extraData` of `RebillyForm`, which goes to `createToken()`.
517
+
518
+ ```html
519
+ <rebilly-card-cvv :extra-data="{ cardType: card.brand }" :key="card.id" />
520
+ ```
521
+
522
+ ##### The mounted element
523
+
524
+ Each payment method component keeps the FramePay element it mounted as its `element` property. It is `null` until the field has mounted and is set before `@ready` fires. Reach it through a template ref when you need a method of the element, such as `focus()` or `invalidate()`:
525
+
526
+ ```html
527
+ <rebilly-card-cvv ref="cvv" @ready="$refs.cvv.element.focus()" />
528
+ ```
529
+
530
+ ```javascript
531
+ // On a gateway CVV mismatch, mark the field invalid without a `change` event:
532
+ this.$refs.cvv.element?.invalidate();
533
+ this.$refs.cvv.element?.focus();
534
+ ```
535
+
536
+ See the element methods here: https://www.rebilly.com/docs/dev-docs/element
537
+
538
+ ## TypeScript
539
+
540
+ The package ships declarations for the plugin, the components, `createToken()`, and `updateConfig()`. The FramePay types come from `@rebilly/framepay`, which is a dependency of this package.
541
+
542
+ ```typescript
543
+ import FramePay, { RebillyCardCvv } from '@rebilly/framepay-vue';
544
+ import type { FieldChangeEvent, FramePayLoader } from '@rebilly/framepay-vue';
545
+
546
+ const cvv = ref<InstanceType<typeof RebillyCardCvv>>();
547
+ cvv.value?.element?.focus();
548
+ ```
549
+
482
550
  ## Further Reading
483
551
 
484
552
  Rebilly API for Payment Tokens
@@ -31,15 +31,18 @@ async function p({ scriptLink: e, styleLink: t } = {}) {
31
31
  }
32
32
  //#endregion
33
33
  //#region src/install/load-script.js
34
- var m = () => p({ scriptLink: u }).catch((e) => {
34
+ var m = (e) => {
35
35
  throw new l({ details: e });
36
- }), h, g = new Promise((e) => {
37
- h = e;
38
- }), _ = h, v = g.then(m);
36
+ }, h = () => p({ scriptLink: u }).catch(m), g = (e) => {
37
+ if (typeof e?.on != "function") throw new l({ message: "The FramePay loader must resolve with the FramePay instance." });
38
+ return e;
39
+ }, _ = (e) => new Promise((t) => t(e())).catch(m).then(g), v, y = new Promise((e) => {
40
+ v = e;
41
+ }), b = (e) => v(e), x = y.then((e) => typeof e == "function" ? _(e) : h());
39
42
  //#endregion
40
43
  //#region src/helpers/initialize-framepay.js
41
- function y(e = {}) {
42
- return v.then((t) => new Promise((n, r) => {
44
+ function S(e = {}) {
45
+ return x.then((t) => new Promise((n, r) => {
43
46
  let i = !1;
44
47
  t.on("ready", () => {
45
48
  n(t);
@@ -55,7 +58,7 @@ function y(e = {}) {
55
58
  }
56
59
  }));
57
60
  }
58
- var b = {
61
+ var C = {
59
62
  REBILLY_CARD: "card",
60
63
  REBILLY_CARD_CVV: "cardCvv",
61
64
  REBILLY_CARD_NUMBER: "cardNumber",
@@ -70,26 +73,26 @@ var b = {
70
73
  };
71
74
  //#endregion
72
75
  //#region src/helpers/create-token.js
73
- function x(e, t) {
74
- return v.then((n) => {
76
+ function w(e, t) {
77
+ return x.then((n) => {
75
78
  if (!n.initialized) throw new c({ message: "Please initialize Framepay before creating a token" });
76
79
  return n.createToken(e, t);
77
80
  });
78
81
  }
79
82
  //#endregion
80
83
  //#region src/helpers/update-config.js
81
- function S(e) {
82
- return y(e).then((t) => {
84
+ function T(e) {
85
+ return S(e).then((t) => {
83
86
  t.update({ ...e });
84
87
  });
85
88
  }
86
89
  //#endregion
87
90
  //#region \0plugin-vue:export-helper
88
- var C = (e, t) => {
91
+ var E = (e, t) => {
89
92
  let n = e.__vccOpts || e;
90
93
  for (let [e, r] of t) n[e] = r;
91
94
  return n;
92
- }, w = {
95
+ }, D = {
93
96
  name: "RebillyForm",
94
97
  props: {
95
98
  extraData: {
@@ -103,35 +106,35 @@ var C = (e, t) => {
103
106
  },
104
107
  emits: ["submit", "error"],
105
108
  watch: { configuration(e) {
106
- e && S(e);
109
+ e && T(e);
107
110
  } },
108
111
  mounted() {
109
- S(this.configuration);
112
+ T(this.configuration);
110
113
  },
111
114
  methods: { handler(e) {
112
115
  let t = e.target;
113
- x(t, this.extraData).then((e) => {
116
+ w(t, this.extraData).then((e) => {
114
117
  this.$attrs.onSubmit ? this.$emit("submit", e, t) : t.submit();
115
118
  }).catch((e) => {
116
119
  this.$emit("error", e);
117
120
  });
118
121
  } }
119
- }, T = { id: "stop-wrapper" };
120
- function E(n, r, s, c, l, u) {
121
- return i(), e("div", T, [t("form", {
122
+ }, O = { id: "stop-wrapper" };
123
+ function k(n, r, s, c, l, u) {
124
+ return i(), e("div", O, [t("form", {
122
125
  id: "rebilly-form",
123
126
  onSubmit: r[0] ||= o((...e) => u.handler && u.handler(...e), ["stop", "prevent"])
124
127
  }, [a(n.$slots, "default")], 32)]);
125
128
  }
126
- var D = /*#__PURE__*/ C(w, [["render", E]]), O = { name: "RebillyToken" }, k = {
129
+ var A = /*#__PURE__*/ E(D, [["render", k]]), j = { name: "RebillyToken" }, M = {
127
130
  id: "rebilly-token",
128
131
  "data-rebilly": "token",
129
132
  type: "hidden"
130
133
  };
131
- function A(t, n, r, a, o, s) {
132
- return i(), e("input", k);
134
+ function N(t, n, r, a, o, s) {
135
+ return i(), e("input", M);
133
136
  }
134
- var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
137
+ var P = /*#__PURE__*/ E(j, [["render", N]]), F = {
135
138
  render() {
136
139
  return n("div", {
137
140
  id: this.mountId,
@@ -140,7 +143,11 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
140
143
  },
141
144
  props: {
142
145
  id: { type: String },
143
- configuration: {}
146
+ configuration: {},
147
+ extraData: {
148
+ type: Object,
149
+ default: void 0
150
+ }
144
151
  },
145
152
  data() {
146
153
  return {
@@ -150,12 +157,12 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
150
157
  },
151
158
  methods: {
152
159
  mountElement(e) {
153
- y(this.configuration).then((t) => {
160
+ S(this.configuration).then((t) => {
154
161
  try {
155
- this.elementType.startsWith("card") ? this.element = r(t.card.mount(e, this.elementType)) : this.elementType === "iban" ? this.element = r(t.iban.mount(e)) : [
156
- b.REBILLY_BBAN_ACCOUNT_TYPE,
157
- b.REBILLY_BBAN_ACCOUNT_NUMBER,
158
- b.REBILLY_BBAN_ROUTING_NUMBER
162
+ this.elementType.startsWith("card") ? this.element = r(t.card.mount(e, this.elementType, this.extraData)) : this.elementType === "iban" ? this.element = r(t.iban.mount(e)) : [
163
+ C.REBILLY_BBAN_ACCOUNT_TYPE,
164
+ C.REBILLY_BBAN_ACCOUNT_NUMBER,
165
+ C.REBILLY_BBAN_ROUTING_NUMBER
159
166
  ].includes(this.elementType) && (this.element = r(t.bban.mount(e, this.elementType))), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (e) => this.$emit("change", e)), this.element.on("focus", () => this.$emit("focus")), this.element.on("blur", () => this.$emit("blur"));
160
167
  } catch {
161
168
  throw new s();
@@ -175,7 +182,7 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
175
182
  beforeUnmount() {
176
183
  this.destroyElement();
177
184
  }
178
- }, N = {
185
+ }, I = {
179
186
  render() {
180
187
  return n("div", {
181
188
  id: this.mountId,
@@ -194,7 +201,7 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
194
201
  },
195
202
  methods: {
196
203
  mountElement(e) {
197
- y(this.configuration).then((t) => {
204
+ S(this.configuration).then((t) => {
198
205
  try {
199
206
  this.element = r(t.googlePay.mount(e)), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (e) => this.$emit("change", e)), this.element.on("focus", () => this.$emit("focus")), this.element.on("blur", () => this.$emit("blur")), this.element.on("error", () => this.$emit("error")), t.on("token-ready", (e) => {
200
207
  this.$emit("token-ready", e), this.$parent.$emit("token-ready", e);
@@ -209,7 +216,7 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
209
216
  }
210
217
  },
211
218
  watch: { configuration(e) {
212
- e && S(e);
219
+ e && T(e);
213
220
  } },
214
221
  created() {
215
222
  this.mountElement(`#${this.mountId}`);
@@ -220,7 +227,7 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
220
227
  beforeUnmount() {
221
228
  this.destroyElement();
222
229
  }
223
- }, P = {
230
+ }, L = {
224
231
  render() {
225
232
  return n("div", {
226
233
  id: this.mountId,
@@ -239,10 +246,10 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
239
246
  },
240
247
  methods: {
241
248
  mountElement(e) {
242
- y(this.configuration).then((t) => {
249
+ S(this.configuration).then((t) => {
243
250
  try {
244
251
  let n = null;
245
- this.elementType === b.REBILLY_APPLE_PAY ? n = t.applePay : this.elementType === b.REBILLY_PAYPAL && (n = t.paypal), this.element = r(n.mount(e)), t.on("token-ready", (e) => {
252
+ this.elementType === C.REBILLY_APPLE_PAY ? n = t.applePay : this.elementType === C.REBILLY_PAYPAL && (n = t.paypal), this.element = r(n.mount(e)), t.on("token-ready", (e) => {
246
253
  this.$emit("token-ready", e), this.$parent.$emit("token-ready", e);
247
254
  });
248
255
  } catch (e) {
@@ -255,7 +262,7 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
255
262
  }
256
263
  },
257
264
  watch: { configuration(e) {
258
- e && S(e);
265
+ e && T(e);
259
266
  } },
260
267
  created() {
261
268
  this.mountElement(`#${this.mountId}`);
@@ -266,74 +273,74 @@ var j = /*#__PURE__*/ C(O, [["render", A]]), M = {
266
273
  beforeUnmount() {
267
274
  this.destroyElement();
268
275
  }
269
- }, F = {
276
+ }, R = {
270
277
  name: "rebilly-card",
271
278
  data() {
272
- return { elementType: b.REBILLY_CARD };
279
+ return { elementType: C.REBILLY_CARD };
273
280
  },
274
- mixins: [M]
275
- }, I = {
281
+ mixins: [F]
282
+ }, z = {
276
283
  name: "rebilly-card-cvv",
277
284
  data() {
278
- return { elementType: b.REBILLY_CARD_CVV };
285
+ return { elementType: C.REBILLY_CARD_CVV };
279
286
  },
280
- mixins: [M]
281
- }, L = {
287
+ mixins: [F]
288
+ }, B = {
282
289
  name: "rebilly-card-expiration",
283
290
  data() {
284
- return { elementType: b.REBILLY_CARD_EXPIRATION };
291
+ return { elementType: C.REBILLY_CARD_EXPIRATION };
285
292
  },
286
- mixins: [M]
287
- }, R = {
293
+ mixins: [F]
294
+ }, V = {
288
295
  name: "rebilly-card-number",
289
296
  data() {
290
- return { elementType: b.REBILLY_CARD_NUMBER };
297
+ return { elementType: C.REBILLY_CARD_NUMBER };
291
298
  },
292
- mixins: [M]
293
- }, z = {
299
+ mixins: [F]
300
+ }, H = {
294
301
  name: "rebilly-bban-account-type",
295
302
  data() {
296
- return { elementType: b.REBILLY_BBAN_ACCOUNT_TYPE };
303
+ return { elementType: C.REBILLY_BBAN_ACCOUNT_TYPE };
297
304
  },
298
- mixins: [M]
299
- }, B = {
305
+ mixins: [F]
306
+ }, U = {
300
307
  name: "rebilly-bban-routing-number",
301
308
  data() {
302
- return { elementType: b.REBILLY_BBAN_ROUTING_NUMBER };
309
+ return { elementType: C.REBILLY_BBAN_ROUTING_NUMBER };
303
310
  },
304
- mixins: [M]
305
- }, V = {
311
+ mixins: [F]
312
+ }, W = {
306
313
  name: "rebilly-bban-account-number",
307
314
  data() {
308
- return { elementType: b.REBILLY_BBAN_ACCOUNT_NUMBER };
315
+ return { elementType: C.REBILLY_BBAN_ACCOUNT_NUMBER };
309
316
  },
310
- mixins: [M]
311
- }, H = {
317
+ mixins: [F]
318
+ }, G = {
312
319
  name: "rebilly-iban",
313
320
  data() {
314
- return { elementType: b.REBILLY_IBAN };
321
+ return { elementType: C.REBILLY_IBAN };
315
322
  },
316
- mixins: [M]
317
- }, U = {
323
+ mixins: [F]
324
+ }, K = {
318
325
  name: "rebilly-google-pay",
319
326
  data() {
320
- return { elementType: b.REBILLY_GOOGLE_PAY };
327
+ return { elementType: C.REBILLY_GOOGLE_PAY };
321
328
  },
322
- mixins: [N]
323
- }, W = {
329
+ mixins: [I]
330
+ }, q = {
324
331
  name: "rebilly-apple-pay",
325
332
  data() {
326
- return { elementType: b.REBILLY_APPLE_PAY };
333
+ return { elementType: C.REBILLY_APPLE_PAY };
327
334
  },
328
- mixins: [P]
329
- }, G = {
335
+ mixins: [L]
336
+ }, J = {
330
337
  name: "rebilly-paypal",
331
338
  data() {
332
- return { elementType: b.REBILLY_PAYPAL };
339
+ return { elementType: C.REBILLY_PAYPAL };
333
340
  },
334
- mixins: [P]
335
- }, K = { install(e, t = {}) {
336
- _(), y(t);
341
+ mixins: [L]
342
+ }, Y = { install(e, t = {}, n = {}) {
343
+ b(n?.loader), S(t).catch(() => {});
337
344
  } };
338
345
  //#endregion
339
- export { W as RebillyApplePay, V as RebillyBbanAccountNumber, z as RebillyBbanAccountType, B as RebillyBbanRoutingNumber, F as RebillyCard, I as RebillyCardCvv, L as RebillyCardExpiration, R as RebillyCardNumber, b as RebillyFieldTypes, D as RebillyForm, U as RebillyGooglePay, H as RebillyIban, G as RebillyPaypal, j as RebillyToken, x as createToken, K as default, S as updateConfig };
346
+ export { q as RebillyApplePay, W as RebillyBbanAccountNumber, H as RebillyBbanAccountType, U as RebillyBbanRoutingNumber, R as RebillyCard, z as RebillyCardCvv, B as RebillyCardExpiration, V as RebillyCardNumber, C as RebillyFieldTypes, A as RebillyForm, K as RebillyGooglePay, G as RebillyIban, J as RebillyPaypal, P as RebillyToken, w as createToken, Y as default, T as updateConfig };
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FramePayVue={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n({message:e=`Could not mount FramePay to element.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayMountError`}function r({message:e=`FramePay could not be initialized.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayInitializeError`}function i({message:e=`FramePay could not be loaded.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayLoadError`}var a=window.process?.env?.FRAMEPAY_SCRIPT_LINK;window.process?.env?.FRAMEPAY_STYLE_LINK;var o=`https://framepay.rebilly.com/framepay.js`,s=`https://framepay.rebilly.com/framepay.css`;async function c({scriptLink:e,styleLink:t}={}){return new Promise((n,r)=>{if(window.Framepay)n(window.Framepay);else{if(t!==`no-style-script`){let e=document.createElement(`link`);e.setAttribute(`href`,t||s),e.setAttribute(`rel`,`stylesheet`),document.head.prepend(e)}let i=document.createElement(`script`);i.setAttribute(`src`,e||o),i.onload=()=>n(window.Framepay),i.onerror=()=>r(Error(`@rebilly/framepay npm package: Failed to load FramePay script`)),document.head.append(i)}})}var l=()=>c({scriptLink:a}).catch(e=>{throw new i({details:e})}),u,d=new Promise(e=>{u=e}),f=u,p=d.then(l);function m(e={}){return p.then(t=>new Promise((n,i)=>{let a=!1;t.on(`ready`,()=>{n(t)}),t.on(`error`,e=>{a=!0,i(new r({details:e}))});try{!a&&!t.initialized&&(e.publishableKey||e.jwt)&&t.initialize(e).catch(e=>{i(new r({details:e}))})}catch(e){throw new r({details:e})}}))}var h={REBILLY_CARD:`card`,REBILLY_CARD_CVV:`cardCvv`,REBILLY_CARD_NUMBER:`cardNumber`,REBILLY_CARD_EXPIRATION:`cardExpiration`,REBILLY_BBAN_ACCOUNT_TYPE:`accountType`,REBILLY_BBAN_ROUTING_NUMBER:`routingNumber`,REBILLY_BBAN_ACCOUNT_NUMBER:`accountNumber`,REBILLY_IBAN:`iban`,REBILLY_GOOGLE_PAY:`googlePay`,REBILLY_APPLE_PAY:`applePay`,REBILLY_PAYPAL:`paypal`};function g(e,t){return p.then(n=>{if(!n.initialized)throw new r({message:`Please initialize Framepay before creating a token`});return n.createToken(e,t)})}function _(e){return m(e).then(t=>{t.update({...e})})}var v=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},y={name:`RebillyForm`,props:{extraData:{type:Object,default:()=>({})},configuration:{type:Object,default:()=>({})}},emits:[`submit`,`error`],watch:{configuration(e){e&&_(e)}},mounted(){_(this.configuration)},methods:{handler(e){let t=e.target;g(t,this.extraData).then(e=>{this.$attrs.onSubmit?this.$emit(`submit`,e,t):t.submit()}).catch(e=>{this.$emit(`error`,e)})}}},b={id:`stop-wrapper`};function x(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,b,[(0,t.createElementVNode)(`form`,{id:`rebilly-form`,onSubmit:n[0]||=(0,t.withModifiers)((...e)=>o.handler&&o.handler(...e),[`stop`,`prevent`])},[(0,t.renderSlot)(e.$slots,`default`)],32)])}var S=v(y,[[`render`,x]]),C={name:`RebillyToken`},w={id:`rebilly-token`,"data-rebilly":`token`,type:`hidden`};function T(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`input`,w)}var E=v(C,[[`render`,T]]),D={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){m(this.configuration).then(r=>{try{this.elementType.startsWith(`card`)?this.element=(0,t.markRaw)(r.card.mount(e,this.elementType)):this.elementType===`iban`?this.element=(0,t.markRaw)(r.iban.mount(e)):[h.REBILLY_BBAN_ACCOUNT_TYPE,h.REBILLY_BBAN_ACCOUNT_NUMBER,h.REBILLY_BBAN_ROUTING_NUMBER].includes(this.elementType)&&(this.element=(0,t.markRaw)(r.bban.mount(e,this.elementType))),this.element.on(`ready`,()=>this.$emit(`ready`)),this.element.on(`change`,e=>this.$emit(`change`,e)),this.element.on(`focus`,()=>this.$emit(`focus`)),this.element.on(`blur`,()=>this.$emit(`blur`))}catch{throw new n}})},destroyElement(){this.element&&this.element.destroy()}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},O={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){m(this.configuration).then(r=>{try{this.element=(0,t.markRaw)(r.googlePay.mount(e)),this.element.on(`ready`,()=>this.$emit(`ready`)),this.element.on(`change`,e=>this.$emit(`change`,e)),this.element.on(`focus`,()=>this.$emit(`focus`)),this.element.on(`blur`,()=>this.$emit(`blur`)),this.element.on(`error`,()=>this.$emit(`error`)),r.on(`token-ready`,e=>{this.$emit(`token-ready`,e),this.$parent.$emit(`token-ready`,e)})}catch(e){throw new n({details:e})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&_(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},k={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){m(this.configuration).then(r=>{try{let n=null;this.elementType===h.REBILLY_APPLE_PAY?n=r.applePay:this.elementType===h.REBILLY_PAYPAL&&(n=r.paypal),this.element=(0,t.markRaw)(n.mount(e)),r.on(`token-ready`,e=>{this.$emit(`token-ready`,e),this.$parent.$emit(`token-ready`,e)})}catch(e){throw new n({details:e})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&_(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},A={name:`rebilly-card`,data(){return{elementType:h.REBILLY_CARD}},mixins:[D]},j={name:`rebilly-card-cvv`,data(){return{elementType:h.REBILLY_CARD_CVV}},mixins:[D]},M={name:`rebilly-card-expiration`,data(){return{elementType:h.REBILLY_CARD_EXPIRATION}},mixins:[D]},N={name:`rebilly-card-number`,data(){return{elementType:h.REBILLY_CARD_NUMBER}},mixins:[D]},P={name:`rebilly-bban-account-type`,data(){return{elementType:h.REBILLY_BBAN_ACCOUNT_TYPE}},mixins:[D]},F={name:`rebilly-bban-routing-number`,data(){return{elementType:h.REBILLY_BBAN_ROUTING_NUMBER}},mixins:[D]},I={name:`rebilly-bban-account-number`,data(){return{elementType:h.REBILLY_BBAN_ACCOUNT_NUMBER}},mixins:[D]},L={name:`rebilly-iban`,data(){return{elementType:h.REBILLY_IBAN}},mixins:[D]},R={name:`rebilly-google-pay`,data(){return{elementType:h.REBILLY_GOOGLE_PAY}},mixins:[O]},z={name:`rebilly-apple-pay`,data(){return{elementType:h.REBILLY_APPLE_PAY}},mixins:[k]},B={name:`rebilly-paypal`,data(){return{elementType:h.REBILLY_PAYPAL}},mixins:[k]};e.RebillyApplePay=z,e.RebillyBbanAccountNumber=I,e.RebillyBbanAccountType=P,e.RebillyBbanRoutingNumber=F,e.RebillyCard=A,e.RebillyCardCvv=j,e.RebillyCardExpiration=M,e.RebillyCardNumber=N,e.RebillyFieldTypes=h,e.RebillyForm=S,e.RebillyGooglePay=R,e.RebillyIban=L,e.RebillyPaypal=B,e.RebillyToken=E,e.createToken=g,e.default={install(e,t={}){f(),m(t)}},e.updateConfig=_});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FramePayVue={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n({message:e=`Could not mount FramePay to element.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayMountError`}function r({message:e=`FramePay could not be initialized.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayInitializeError`}function i({message:e=`FramePay could not be loaded.`,details:t=null}={}){this.message=e,this.details=t,this.name=`FramePayLoadError`}var a=window.process?.env?.FRAMEPAY_SCRIPT_LINK;window.process?.env?.FRAMEPAY_STYLE_LINK;var o=`https://framepay.rebilly.com/framepay.js`,s=`https://framepay.rebilly.com/framepay.css`;async function c({scriptLink:e,styleLink:t}={}){return new Promise((n,r)=>{if(window.Framepay)n(window.Framepay);else{if(t!==`no-style-script`){let e=document.createElement(`link`);e.setAttribute(`href`,t||s),e.setAttribute(`rel`,`stylesheet`),document.head.prepend(e)}let i=document.createElement(`script`);i.setAttribute(`src`,e||o),i.onload=()=>n(window.Framepay),i.onerror=()=>r(Error(`@rebilly/framepay npm package: Failed to load FramePay script`)),document.head.append(i)}})}var l=e=>{throw new i({details:e})},u=()=>c({scriptLink:a}).catch(l),d=e=>{if(typeof e?.on!=`function`)throw new i({message:`The FramePay loader must resolve with the FramePay instance.`});return e},f=e=>new Promise(t=>t(e())).catch(l).then(d),p,m=new Promise(e=>{p=e}),h=e=>p(e),g=m.then(e=>typeof e==`function`?f(e):u());function _(e={}){return g.then(t=>new Promise((n,i)=>{let a=!1;t.on(`ready`,()=>{n(t)}),t.on(`error`,e=>{a=!0,i(new r({details:e}))});try{!a&&!t.initialized&&(e.publishableKey||e.jwt)&&t.initialize(e).catch(e=>{i(new r({details:e}))})}catch(e){throw new r({details:e})}}))}var v={REBILLY_CARD:`card`,REBILLY_CARD_CVV:`cardCvv`,REBILLY_CARD_NUMBER:`cardNumber`,REBILLY_CARD_EXPIRATION:`cardExpiration`,REBILLY_BBAN_ACCOUNT_TYPE:`accountType`,REBILLY_BBAN_ROUTING_NUMBER:`routingNumber`,REBILLY_BBAN_ACCOUNT_NUMBER:`accountNumber`,REBILLY_IBAN:`iban`,REBILLY_GOOGLE_PAY:`googlePay`,REBILLY_APPLE_PAY:`applePay`,REBILLY_PAYPAL:`paypal`};function y(e,t){return g.then(n=>{if(!n.initialized)throw new r({message:`Please initialize Framepay before creating a token`});return n.createToken(e,t)})}function b(e){return _(e).then(t=>{t.update({...e})})}var x=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},S={name:`RebillyForm`,props:{extraData:{type:Object,default:()=>({})},configuration:{type:Object,default:()=>({})}},emits:[`submit`,`error`],watch:{configuration(e){e&&b(e)}},mounted(){b(this.configuration)},methods:{handler(e){let t=e.target;y(t,this.extraData).then(e=>{this.$attrs.onSubmit?this.$emit(`submit`,e,t):t.submit()}).catch(e=>{this.$emit(`error`,e)})}}},C={id:`stop-wrapper`};function w(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,C,[(0,t.createElementVNode)(`form`,{id:`rebilly-form`,onSubmit:n[0]||=(0,t.withModifiers)((...e)=>o.handler&&o.handler(...e),[`stop`,`prevent`])},[(0,t.renderSlot)(e.$slots,`default`)],32)])}var T=x(S,[[`render`,w]]),E={name:`RebillyToken`},D={id:`rebilly-token`,"data-rebilly":`token`,type:`hidden`};function O(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createElementBlock)(`input`,D)}var k=x(E,[[`render`,O]]),A={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{},extraData:{type:Object,default:void 0}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){_(this.configuration).then(r=>{try{this.elementType.startsWith(`card`)?this.element=(0,t.markRaw)(r.card.mount(e,this.elementType,this.extraData)):this.elementType===`iban`?this.element=(0,t.markRaw)(r.iban.mount(e)):[v.REBILLY_BBAN_ACCOUNT_TYPE,v.REBILLY_BBAN_ACCOUNT_NUMBER,v.REBILLY_BBAN_ROUTING_NUMBER].includes(this.elementType)&&(this.element=(0,t.markRaw)(r.bban.mount(e,this.elementType))),this.element.on(`ready`,()=>this.$emit(`ready`)),this.element.on(`change`,e=>this.$emit(`change`,e)),this.element.on(`focus`,()=>this.$emit(`focus`)),this.element.on(`blur`,()=>this.$emit(`blur`))}catch{throw new n}})},destroyElement(){this.element&&this.element.destroy()}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},j={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){_(this.configuration).then(r=>{try{this.element=(0,t.markRaw)(r.googlePay.mount(e)),this.element.on(`ready`,()=>this.$emit(`ready`)),this.element.on(`change`,e=>this.$emit(`change`,e)),this.element.on(`focus`,()=>this.$emit(`focus`)),this.element.on(`blur`,()=>this.$emit(`blur`)),this.element.on(`error`,()=>this.$emit(`error`)),r.on(`token-ready`,e=>{this.$emit(`token-ready`,e),this.$parent.$emit(`token-ready`,e)})}catch(e){throw new n({details:e})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&b(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},M={render(){return(0,t.h)(`div`,{id:this.mountId,domProps:{id:this.mountId}})},props:{id:{type:String},configuration:{}},data(){return{element:null,mountId:this.id?this.id:`${this.$options.name}-mount`}},methods:{mountElement(e){_(this.configuration).then(r=>{try{let n=null;this.elementType===v.REBILLY_APPLE_PAY?n=r.applePay:this.elementType===v.REBILLY_PAYPAL&&(n=r.paypal),this.element=(0,t.markRaw)(n.mount(e)),r.on(`token-ready`,e=>{this.$emit(`token-ready`,e),this.$parent.$emit(`token-ready`,e)})}catch(e){throw new n({details:e})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&b(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},N={name:`rebilly-card`,data(){return{elementType:v.REBILLY_CARD}},mixins:[A]},P={name:`rebilly-card-cvv`,data(){return{elementType:v.REBILLY_CARD_CVV}},mixins:[A]},F={name:`rebilly-card-expiration`,data(){return{elementType:v.REBILLY_CARD_EXPIRATION}},mixins:[A]},I={name:`rebilly-card-number`,data(){return{elementType:v.REBILLY_CARD_NUMBER}},mixins:[A]},L={name:`rebilly-bban-account-type`,data(){return{elementType:v.REBILLY_BBAN_ACCOUNT_TYPE}},mixins:[A]},R={name:`rebilly-bban-routing-number`,data(){return{elementType:v.REBILLY_BBAN_ROUTING_NUMBER}},mixins:[A]},z={name:`rebilly-bban-account-number`,data(){return{elementType:v.REBILLY_BBAN_ACCOUNT_NUMBER}},mixins:[A]},B={name:`rebilly-iban`,data(){return{elementType:v.REBILLY_IBAN}},mixins:[A]},V={name:`rebilly-google-pay`,data(){return{elementType:v.REBILLY_GOOGLE_PAY}},mixins:[j]},H={name:`rebilly-apple-pay`,data(){return{elementType:v.REBILLY_APPLE_PAY}},mixins:[M]},U={name:`rebilly-paypal`,data(){return{elementType:v.REBILLY_PAYPAL}},mixins:[M]};e.RebillyApplePay=H,e.RebillyBbanAccountNumber=z,e.RebillyBbanAccountType=L,e.RebillyBbanRoutingNumber=R,e.RebillyCard=N,e.RebillyCardCvv=P,e.RebillyCardExpiration=F,e.RebillyCardNumber=I,e.RebillyFieldTypes=v,e.RebillyForm=T,e.RebillyGooglePay=V,e.RebillyIban=B,e.RebillyPaypal=U,e.RebillyToken=k,e.createToken=y,e.default={install(e,t={},n={}){h(n?.loader),_(t).catch(()=>{})}},e.updateConfig=b});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebilly/framepay-vue",
3
3
  "type": "module",
4
- "version": "12.230.5",
4
+ "version": "12.231.0",
5
5
  "description": "Official Vue wrapper for Rebilly FramePay",
6
6
  "author": "Rebilly",
7
7
  "repository": {
@@ -9,8 +9,10 @@
9
9
  "url": "https://github.com/Rebilly/rebilly"
10
10
  },
11
11
  "license": "MIT",
12
+ "types": "./types/index.d.ts",
12
13
  "exports": {
13
14
  ".": {
15
+ "types": "./types/index.d.ts",
14
16
  "import": "./dist/framepay-vue.js",
15
17
  "require": "./dist/framepay-vue.umd.cjs",
16
18
  "default": "./dist/framepay-vue.js"
@@ -18,6 +20,7 @@
18
20
  },
19
21
  "files": [
20
22
  "dist",
23
+ "types",
21
24
  "CHANGELOG.md"
22
25
  ],
23
26
  "keywords": [
@@ -31,11 +34,13 @@
31
34
  "peerDependencies": {
32
35
  "vue": "^3.0.0"
33
36
  },
37
+ "dependencies": {
38
+ "@rebilly/framepay": "*"
39
+ },
34
40
  "devDependencies": {
35
41
  "@playwright/test": "^1.63.0",
36
42
  "@rebilly/playwright-config": "*",
37
43
  "@rebilly/eslint-config": "*",
38
- "@rebilly/framepay": "*",
39
44
  "@types/node": "^24.13.3",
40
45
  "@vitejs/plugin-basic-ssl": "^2.3.0",
41
46
  "@vitejs/plugin-vue": "^6.0.0",
@@ -0,0 +1,184 @@
1
+ import type { App, ComponentOptionsMixin, DefineComponent, Raw } from 'vue';
2
+ import type {
3
+ ApplePayElement,
4
+ BankElement,
5
+ CardElement,
6
+ ExtraData as TokenExtraData,
7
+ FieldExtraData,
8
+ FramePay,
9
+ FramepayError,
10
+ FramepayInitializeParams,
11
+ GooglePayElement,
12
+ IbanElement,
13
+ IframeElementEventMap,
14
+ PayPalElement,
15
+ TokenData,
16
+ } from '@rebilly/framepay';
17
+
18
+ export type {
19
+ FieldExtraData,
20
+ FramePay,
21
+ FramepayError,
22
+ FramepayInitializeParams,
23
+ TokenData,
24
+ TokenExtraData,
25
+ };
26
+
27
+ /**
28
+ * Loads FramePay on behalf of framepay-vue and resolves with the page's
29
+ * FramePay instance. framepay-vue then injects no script or stylesheet.
30
+ */
31
+ export type FramePayLoader = () => Promise<FramePay>;
32
+
33
+ export interface FramePayPluginOptions {
34
+ loader?: FramePayLoader;
35
+ }
36
+
37
+ export interface FramePayPlugin {
38
+ /**
39
+ * @param configuration FramePay initialization options. Leave out the
40
+ * publishable key and JWT when the host initializes FramePay itself.
41
+ * @param options `loader` hands FramePay loading to the host.
42
+ */
43
+ install(
44
+ app: App,
45
+ configuration?: FramepayInitializeParams,
46
+ options?: FramePayPluginOptions,
47
+ ): void;
48
+ }
49
+
50
+ declare const FramePayVue: FramePayPlugin;
51
+ export default FramePayVue;
52
+
53
+ /**
54
+ * Extra data for `createToken()`. FramePay's `ExtraData` lists the known keys
55
+ * and takes any other key, so any object is accepted here.
56
+ */
57
+ export type CreateTokenExtraData = TokenExtraData | Record<string, unknown>;
58
+
59
+ /** The payload of a field's `change` event. */
60
+ export type FieldChangeEvent = IframeElementEventMap['change'][0];
61
+
62
+ /**
63
+ * The rejection of `createToken()` and of the internal loading and mounting
64
+ * chains. Plain objects, not `Error` instances.
65
+ */
66
+ export interface FramePayVueError {
67
+ name: 'FramePayLoadError' | 'FramePayInitializeError' | 'FramePayMountError';
68
+ message: string;
69
+ details: unknown;
70
+ }
71
+
72
+ export interface FieldProps {
73
+ /** The id of the element FramePay mounts into. Defaults to `<component name>-mount`. */
74
+ id?: string;
75
+ /** Initializes FramePay when the plugin was not given a key. */
76
+ configuration?: FramepayInitializeParams;
77
+ }
78
+
79
+ export interface CardFieldProps extends FieldProps {
80
+ /**
81
+ * Forwarded to `Framepay.card.mount()`, for example `{ cardType }`. Read once
82
+ * when the field mounts; recreate the component to change it.
83
+ */
84
+ extraData?: FieldExtraData;
85
+ }
86
+
87
+ export interface FieldEmits {
88
+ ready: () => void;
89
+ change: (event: FieldChangeEvent) => void;
90
+ focus: () => void;
91
+ blur: () => void;
92
+ }
93
+
94
+ export interface GooglePayEmits extends FieldEmits {
95
+ error: () => void;
96
+ 'token-ready': (token: TokenData) => void;
97
+ }
98
+
99
+ export interface WalletEmits {
100
+ 'token-ready': (token: TokenData) => void;
101
+ }
102
+
103
+ /**
104
+ * The mounted FramePay element, `null` until the field has mounted. Set
105
+ * before the `ready` event, so it is available from `@ready` on. Marked raw,
106
+ * as the component stores it.
107
+ */
108
+ export interface FieldInstance<Element> {
109
+ readonly element: Raw<Element> | null;
110
+ }
111
+
112
+ export type FieldComponent<Props, Element, Emits> = DefineComponent<
113
+ Props,
114
+ {},
115
+ FieldInstance<Element>,
116
+ {},
117
+ {},
118
+ ComponentOptionsMixin,
119
+ ComponentOptionsMixin,
120
+ Emits
121
+ >;
122
+
123
+ export type CardFieldComponent = FieldComponent<CardFieldProps, CardElement, FieldEmits>;
124
+ export type BbanFieldComponent = FieldComponent<FieldProps, BankElement, FieldEmits>;
125
+ export type IbanFieldComponent = FieldComponent<FieldProps, IbanElement, FieldEmits>;
126
+
127
+ export const RebillyCard: CardFieldComponent;
128
+ export const RebillyCardCvv: CardFieldComponent;
129
+ export const RebillyCardExpiration: CardFieldComponent;
130
+ export const RebillyCardNumber: CardFieldComponent;
131
+ export const RebillyBbanAccountType: BbanFieldComponent;
132
+ export const RebillyBbanRoutingNumber: BbanFieldComponent;
133
+ export const RebillyBbanAccountNumber: BbanFieldComponent;
134
+ export const RebillyIban: IbanFieldComponent;
135
+ export const RebillyGooglePay: FieldComponent<FieldProps, GooglePayElement, GooglePayEmits>;
136
+ export const RebillyApplePay: FieldComponent<FieldProps, ApplePayElement, WalletEmits>;
137
+ export const RebillyPaypal: FieldComponent<FieldProps, PayPalElement, WalletEmits>;
138
+
139
+ export interface RebillyFormProps {
140
+ /** Passed to `createToken()` on submit. */
141
+ extraData?: CreateTokenExtraData;
142
+ configuration?: FramepayInitializeParams;
143
+ }
144
+
145
+ export interface RebillyFormEmits {
146
+ submit: (token: TokenData, form: HTMLFormElement) => void;
147
+ error: (error: FramepayError | FramePayVueError) => void;
148
+ }
149
+
150
+ export const RebillyForm: DefineComponent<
151
+ RebillyFormProps,
152
+ {},
153
+ {},
154
+ {},
155
+ {},
156
+ ComponentOptionsMixin,
157
+ ComponentOptionsMixin,
158
+ RebillyFormEmits
159
+ >;
160
+
161
+ export const RebillyToken: DefineComponent<{}>;
162
+
163
+ export const RebillyFieldTypes: {
164
+ readonly REBILLY_CARD: 'card';
165
+ readonly REBILLY_CARD_CVV: 'cardCvv';
166
+ readonly REBILLY_CARD_NUMBER: 'cardNumber';
167
+ readonly REBILLY_CARD_EXPIRATION: 'cardExpiration';
168
+ readonly REBILLY_BBAN_ACCOUNT_TYPE: 'accountType';
169
+ readonly REBILLY_BBAN_ROUTING_NUMBER: 'routingNumber';
170
+ readonly REBILLY_BBAN_ACCOUNT_NUMBER: 'accountNumber';
171
+ readonly REBILLY_IBAN: 'iban';
172
+ readonly REBILLY_GOOGLE_PAY: 'googlePay';
173
+ readonly REBILLY_APPLE_PAY: 'applePay';
174
+ readonly REBILLY_PAYPAL: 'paypal';
175
+ };
176
+
177
+ /** Waits for FramePay to load, then calls `Framepay.createToken()`. */
178
+ export function createToken(
179
+ form: Element | object | null,
180
+ extraData?: CreateTokenExtraData,
181
+ ): Promise<TokenData>;
182
+
183
+ /** Waits for FramePay to be ready, then calls `Framepay.update()`. */
184
+ export function updateConfig(configuration: FramepayInitializeParams): Promise<void>;