@rebilly/framepay-vue 6.1.2 → 7.0.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 +1,10 @@
1
- ## [6.1.2](https://github.com/Rebilly/rebilly/compare/framepay-vue-v6.1.1...framepay-vue-v6.1.2) (2024-11-12)
1
+ ## [7.0.0](https://github.com/Rebilly/rebilly/compare/framepay-vue-v6.1.3...framepay-vue-v7.0.0) (2024-11-14)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **framepay-vue:** use @rebilly/framepay in framepay-vue (#8531)
7
+
8
+ ### Refactors
9
+
10
+ * **framepay-vue:** use @rebilly/framepay in framepay-vue ([#8531](https://github.com/Rebilly/rebilly/issues/8531)) ([ebca290](https://github.com/Rebilly/rebilly/commit/ebca2901ba85935bf390bdf125cbaaa78ddecc3e))
package/README.md CHANGED
@@ -100,13 +100,10 @@ import FramePay from '@rebilly/framepay-vue';
100
100
 
101
101
  const configuration = {
102
102
  publishableKey: 'pk_sandbox_1234567890',
103
- injectStyle: true,
104
103
  };
105
104
  app.use(FramePay, configuration);
106
105
  ```
107
106
 
108
- See [Built in Styling](#built-in-styling) for more information about the `injectStyle` option.
109
-
110
107
  #### On a component (rebilly-form, rebilly-card etc)
111
108
 
112
109
  Add the `publishableKey` on only the first component in the template.
@@ -150,7 +147,6 @@ The script will only be loaded the first time `created()` is called, so you can
150
147
  created() {
151
148
  const config = {
152
149
  publishableKey: 'pk_sandbox_1234567890',
153
- injectStyle: true,
154
150
  // etc
155
151
  };
156
152
  app.use(FramePay, config);
@@ -364,39 +360,6 @@ It is possible to use `v-show` instead, which will allow you to preserve the use
364
360
  <button @click="paymentMethod = 'ach'">Bank</button>
365
361
  ```
366
362
 
367
- ### Styling
368
-
369
- Styling can be managed using Rebilly's built in styles for Framepay, or by setting some custom options.
370
-
371
- #### Built in Styling
372
-
373
- To use the built in styling, add `injectStyle: true` to your configuration object.
374
-
375
- ```javascript
376
- //main.js
377
- import FramePay from '@rebilly/framepay-vue';
378
-
379
- const configuration = {
380
- publishableKey: 'pk_sandbox_1234567890',
381
- injectStyle: true,
382
- };
383
- app.use(FramePay, configuration);
384
- ```
385
-
386
- **OR**
387
-
388
- ```html
389
- <rebilly-form :configuration="{ publishableKey: 'pk_sandbox_1234567890', injectStyle: true }">
390
- <input data-rebilly="firstName">
391
- <input data-rebilly="lastName">
392
- <rebilly-card></rebilly-card>
393
- </rebilly-form>
394
- ```
395
-
396
- #### Custom Styling
397
-
398
- Custom styling can also be added to your configuration object. While the built-in styling affects the iframes containing Framepay fields, custom styling allows you to tweak the Framepay fields themselves. The full list of style options can be found in the table here: https://rebilly.github.io/framepay-docs/reference/rebilly.html#rebilly-initialize
399
-
400
363
  ### Events
401
364
 
402
365
  #### `rebilly-form`
@@ -1,80 +1,89 @@
1
- import { openBlock as y, createElementBlock as p, createElementVNode as B, withModifiers as I, renderSlot as A, h as c, markRaw as s } from "vue";
1
+ import { openBlock as u, createElementBlock as y, createElementVNode as I, withModifiers as B, renderSlot as A, h as c, markRaw as a } from "vue";
2
2
  function h({ message: e = "Could not mount FramePay to element.", details: t = null } = {}) {
3
3
  this.message = e, this.details = t, this.name = "FramePayMountError";
4
4
  }
5
- function b({ message: e = "FramePay could not be initialized.", details: t = null } = {}) {
5
+ function p({ message: e = "FramePay could not be initialized.", details: t = null } = {}) {
6
6
  this.message = e, this.details = t, this.name = "FramePayInitializeError";
7
7
  }
8
- function u({ message: e = "FramePay could not be loaded.", details: t = null } = {}) {
8
+ function b({ message: e = "FramePay could not be loaded.", details: t = null } = {}) {
9
9
  this.message = e, this.details = t, this.name = "FramePayLoadError";
10
10
  }
11
- const P = window.process?.env?.FRAMEPAY_SCRIPT_LINK || "https://framepay.rebilly.com/framepay.js", Y = window.process?.env?.FRAMEPAY_STYLE_LINK || "https://framepay.rebilly.com/framepay.css", T = () => new Promise((e, t) => {
12
- const n = document.createElement("script");
13
- n.src = P, n.id = "rebilly-framepay-js", n.onload = () => e(Framepay), n.onerror = () => t(), document.querySelector("head").appendChild(n);
11
+ const P = window.process?.env?.FRAMEPAY_SCRIPT_LINK || "https://framepay.rebilly.com/framepay.js";
12
+ window.process?.env?.FRAMEPAY_STYLE_LINK;
13
+ const T = "https://framepay.rebilly.com/framepay.js", Y = "https://framepay.rebilly.com/framepay.css";
14
+ async function N({
15
+ scriptLink: e,
16
+ styleLink: t
17
+ } = {}) {
18
+ return new Promise((n) => {
19
+ if (window.Framepay)
20
+ n(window.Framepay);
21
+ else {
22
+ const r = document.createElement("link");
23
+ r.setAttribute("href", t ?? Y), r.setAttribute("rel", "stylesheet"), document.head.prepend(r);
24
+ const s = document.createElement("script");
25
+ s.setAttribute("src", e ?? T), s.onload = () => n(window.Framepay), document.head.append(s);
26
+ }
27
+ });
28
+ }
29
+ const $ = () => new Promise((e) => {
30
+ N({ scriptLink: P }).then((t) => e(t));
14
31
  }).catch((e) => {
15
- throw new u({ details: e });
32
+ throw new b({ details: e });
16
33
  });
17
- let E;
18
- const N = new Promise((e) => {
19
- E = e;
20
- }), $ = E, _ = N.then(T);
21
- function C() {
22
- if (document.querySelector("link#rebilly-framepay-css"))
23
- return;
24
- const e = document.createElement("link");
25
- e.href = Y, e.id = "rebilly-framepay-css", e.type = "text/css", e.rel = "stylesheet", e.onerror = (t) => {
26
- throw new u({ details: t });
27
- }, document.querySelector("head").appendChild(e);
28
- }
29
- function a(e = {}) {
30
- return _.then(
34
+ let _;
35
+ const w = new Promise((e) => {
36
+ _ = e;
37
+ }), g = _, E = w.then($);
38
+ function l(e = {}) {
39
+ return E.then(
31
40
  (t) => new Promise((n) => {
32
41
  t.on("ready", () => {
33
42
  n(t);
34
43
  }), t.on("error", (r) => {
35
- throw new u({ details: r });
44
+ throw new b({ details: r });
36
45
  });
37
46
  try {
38
- e.injectStyle && C(), !t.initialized && (e.publishableKey || e.jwt) && t.initialize(e);
47
+ !t.initialized && (e.publishableKey || e.jwt) && t.initialize(e);
39
48
  } catch (r) {
40
- throw new b({ details: r });
49
+ throw new p({ details: r });
41
50
  }
42
51
  })
43
52
  );
44
53
  }
45
- const g = "card", w = "cardCvv", x = "cardNumber", U = "cardExpiration", S = "accountType", M = "routingNumber", O = "accountNumber", k = "iban", D = "googlePay", v = "applePay", F = "paypal", i = {
46
- REBILLY_CARD: g,
47
- REBILLY_CARD_CVV: w,
48
- REBILLY_CARD_NUMBER: x,
49
- REBILLY_CARD_EXPIRATION: U,
50
- REBILLY_BBAN_ACCOUNT_TYPE: S,
54
+ const C = "card", x = "cardCvv", U = "cardNumber", O = "cardExpiration", k = "accountType", M = "routingNumber", S = "accountNumber", D = "iban", F = "googlePay", v = "applePay", G = "paypal", i = {
55
+ REBILLY_CARD: C,
56
+ REBILLY_CARD_CVV: x,
57
+ REBILLY_CARD_NUMBER: U,
58
+ REBILLY_CARD_EXPIRATION: O,
59
+ REBILLY_BBAN_ACCOUNT_TYPE: k,
51
60
  REBILLY_BBAN_ROUTING_NUMBER: M,
52
- REBILLY_BBAN_ACCOUNT_NUMBER: O,
53
- REBILLY_IBAN: k,
54
- REBILLY_GOOGLE_PAY: D,
61
+ REBILLY_BBAN_ACCOUNT_NUMBER: S,
62
+ REBILLY_IBAN: D,
63
+ REBILLY_GOOGLE_PAY: F,
55
64
  REBILLY_APPLE_PAY: v,
56
- REBILLY_PAYPAL: F
65
+ REBILLY_PAYPAL: G
57
66
  };
58
- function G(e, t) {
59
- return _.then((n) => {
67
+ function z(e, t) {
68
+ return E.then((n) => {
60
69
  if (!n.initialized)
61
- throw new b({
70
+ throw new p({
62
71
  message: "Please initialize Framepay before creating a token"
63
72
  });
64
73
  return n.createToken(e, t);
65
74
  });
66
75
  }
67
- function l(e) {
68
- return a(e).then((t) => {
76
+ function m(e) {
77
+ return l(e).then((t) => {
69
78
  t.update({ ...e });
70
79
  });
71
80
  }
72
- const R = (e, t) => {
81
+ const L = (e, t) => {
73
82
  const n = e.__vccOpts || e;
74
- for (const [r, m] of t)
75
- n[r] = m;
83
+ for (const [r, s] of t)
84
+ n[r] = s;
76
85
  return n;
77
- }, z = {
86
+ }, j = {
78
87
  name: "RebillyForm",
79
88
  props: {
80
89
  extraData: {
@@ -89,44 +98,44 @@ const R = (e, t) => {
89
98
  emits: ["submit", "error"],
90
99
  watch: {
91
100
  configuration(e) {
92
- e && l(e);
101
+ e && m(e);
93
102
  }
94
103
  },
95
104
  mounted() {
96
- l(this.configuration);
105
+ m(this.configuration);
97
106
  },
98
107
  methods: {
99
108
  handler(e) {
100
109
  const t = e.target;
101
- G(t, this.extraData).then((n) => {
110
+ z(t, this.extraData).then((n) => {
102
111
  this.$attrs.onSubmit ? this.$emit("submit", n, t) : t.submit();
103
112
  }).catch((n) => {
104
113
  this.$emit("error", n);
105
114
  });
106
115
  }
107
116
  }
108
- }, j = { id: "stop-wrapper" };
109
- function V(e, t, n, r, m, d) {
110
- return y(), p("div", j, [
111
- B("form", {
117
+ }, K = { id: "stop-wrapper" };
118
+ function V(e, t, n, r, s, d) {
119
+ return u(), y("div", K, [
120
+ I("form", {
112
121
  id: "rebilly-form",
113
- onSubmit: t[0] || (t[0] = I((...f) => d.handler && d.handler(...f), ["stop", "prevent"]))
122
+ onSubmit: t[0] || (t[0] = B((...f) => d.handler && d.handler(...f), ["stop", "prevent"]))
114
123
  }, [
115
124
  A(e.$slots, "default")
116
125
  ], 32)
117
126
  ]);
118
127
  }
119
- const J = /* @__PURE__ */ R(z, [["render", V]]), K = {
128
+ const Q = /* @__PURE__ */ L(j, [["render", V]]), X = {
120
129
  name: "RebillyToken"
121
- }, q = {
130
+ }, W = {
122
131
  id: "rebilly-token",
123
132
  "data-rebilly": "token",
124
133
  type: "hidden"
125
134
  };
126
- function X(e, t, n, r, m, d) {
127
- return y(), p("input", q);
135
+ function q(e, t, n, r, s, d) {
136
+ return u(), y("input", W);
128
137
  }
129
- const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
138
+ const Z = /* @__PURE__ */ L(X, [["render", q]]), o = {
130
139
  render() {
131
140
  return c("div", {
132
141
  id: this.mountId,
@@ -147,13 +156,13 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
147
156
  },
148
157
  methods: {
149
158
  mountElement(e) {
150
- a(this.configuration).then((t) => {
159
+ l(this.configuration).then((t) => {
151
160
  try {
152
- this.elementType.startsWith("card") ? this.element = s(t.card.mount(e, this.elementType)) : this.elementType === "iban" ? this.element = s(t.iban.mount(e)) : [
161
+ this.elementType.startsWith("card") ? this.element = a(t.card.mount(e, this.elementType)) : this.elementType === "iban" ? this.element = a(t.iban.mount(e)) : [
153
162
  i.REBILLY_BBAN_ACCOUNT_TYPE,
154
163
  i.REBILLY_BBAN_ACCOUNT_NUMBER,
155
164
  i.REBILLY_BBAN_ROUTING_NUMBER
156
- ].includes(this.elementType) && (this.element = s(t.bban.mount(e, this.elementType))), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (n) => this.$emit("change", n)), this.element.on("focus", () => this.$emit("focus")), this.element.on("blur", () => this.$emit("blur"));
165
+ ].includes(this.elementType) && (this.element = a(t.bban.mount(e, this.elementType))), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (n) => this.$emit("change", n)), this.element.on("focus", () => this.$emit("focus")), this.element.on("blur", () => this.$emit("blur"));
157
166
  } catch {
158
167
  throw new h();
159
168
  }
@@ -175,7 +184,7 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
175
184
  beforeUnmount() {
176
185
  this.destroyElement();
177
186
  }
178
- }, W = {
187
+ }, H = {
179
188
  render() {
180
189
  return c("div", {
181
190
  id: this.mountId,
@@ -196,9 +205,9 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
196
205
  },
197
206
  methods: {
198
207
  mountElement(e) {
199
- a(this.configuration).then((t) => {
208
+ l(this.configuration).then((t) => {
200
209
  try {
201
- this.element = s(t.googlePay.mount(e)), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (n) => this.$emit("change", n)), 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", (n) => {
210
+ this.element = a(t.googlePay.mount(e)), this.element.on("ready", () => this.$emit("ready")), this.element.on("change", (n) => this.$emit("change", n)), 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", (n) => {
202
211
  this.$emit("token-ready", n), this.$parent.$emit("token-ready", n);
203
212
  });
204
213
  } catch (n) {
@@ -212,7 +221,7 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
212
221
  },
213
222
  watch: {
214
223
  configuration(e) {
215
- e && l(e);
224
+ e && m(e);
216
225
  }
217
226
  },
218
227
  created() {
@@ -227,7 +236,7 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
227
236
  beforeUnmount() {
228
237
  this.destroyElement();
229
238
  }
230
- }, L = {
239
+ }, R = {
231
240
  render() {
232
241
  return c("div", {
233
242
  id: this.mountId,
@@ -248,10 +257,10 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
248
257
  },
249
258
  methods: {
250
259
  mountElement(e) {
251
- a(this.configuration).then((t) => {
260
+ l(this.configuration).then((t) => {
252
261
  try {
253
262
  let n = null;
254
- this.elementType === i.REBILLY_APPLE_PAY ? n = t.applePay : this.elementType === i.REBILLY_PAYPAL && (n = t.paypal), this.element = s(n.mount(e)), t.on("token-ready", (r) => {
263
+ this.elementType === i.REBILLY_APPLE_PAY ? n = t.applePay : this.elementType === i.REBILLY_PAYPAL && (n = t.paypal), this.element = a(n.mount(e)), t.on("token-ready", (r) => {
255
264
  this.$emit("token-ready", r), this.$parent.$emit("token-ready", r);
256
265
  });
257
266
  } catch (n) {
@@ -265,7 +274,7 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
265
274
  },
266
275
  watch: {
267
276
  configuration(e) {
268
- e && l(e);
277
+ e && m(e);
269
278
  }
270
279
  },
271
280
  created() {
@@ -280,93 +289,93 @@ const Q = /* @__PURE__ */ R(K, [["render", X]]), o = {
280
289
  beforeUnmount() {
281
290
  this.destroyElement();
282
291
  }
283
- }, Z = {
292
+ }, ee = {
284
293
  name: "rebilly-card",
285
294
  data() {
286
295
  return { elementType: i.REBILLY_CARD };
287
296
  },
288
297
  mixins: [o]
289
- }, ee = {
298
+ }, te = {
290
299
  name: "rebilly-card-cvv",
291
300
  data() {
292
301
  return { elementType: i.REBILLY_CARD_CVV };
293
302
  },
294
303
  mixins: [o]
295
- }, te = {
304
+ }, ne = {
296
305
  name: "rebilly-card-expiration",
297
306
  data() {
298
307
  return { elementType: i.REBILLY_CARD_EXPIRATION };
299
308
  },
300
309
  mixins: [o]
301
- }, ne = {
310
+ }, ie = {
302
311
  name: "rebilly-card-number",
303
312
  data() {
304
313
  return { elementType: i.REBILLY_CARD_NUMBER };
305
314
  },
306
315
  mixins: [o]
307
- }, ie = {
316
+ }, re = {
308
317
  name: "rebilly-bban-account-type",
309
318
  data() {
310
319
  return { elementType: i.REBILLY_BBAN_ACCOUNT_TYPE };
311
320
  },
312
321
  mixins: [o]
313
- }, re = {
322
+ }, oe = {
314
323
  name: "rebilly-bban-routing-number",
315
324
  data() {
316
325
  return { elementType: i.REBILLY_BBAN_ROUTING_NUMBER };
317
326
  },
318
327
  mixins: [o]
319
- }, oe = {
328
+ }, se = {
320
329
  name: "rebilly-bban-account-number",
321
330
  data() {
322
331
  return { elementType: i.REBILLY_BBAN_ACCOUNT_NUMBER };
323
332
  },
324
333
  mixins: [o]
325
- }, se = {
334
+ }, ae = {
326
335
  name: "rebilly-iban",
327
336
  data() {
328
337
  return { elementType: i.REBILLY_IBAN };
329
338
  },
330
339
  mixins: [o]
331
- }, ae = {
340
+ }, le = {
332
341
  name: "rebilly-google-pay",
333
342
  data() {
334
343
  return { elementType: i.REBILLY_GOOGLE_PAY };
335
344
  },
336
- mixins: [W]
337
- }, le = {
345
+ mixins: [H]
346
+ }, me = {
338
347
  name: "rebilly-apple-pay",
339
348
  data() {
340
349
  return { elementType: i.REBILLY_APPLE_PAY };
341
350
  },
342
- mixins: [L]
343
- }, me = {
351
+ mixins: [R]
352
+ }, de = {
344
353
  name: "rebilly-paypal",
345
354
  data() {
346
355
  return { elementType: i.REBILLY_PAYPAL };
347
356
  },
348
- mixins: [L]
349
- }, de = {
357
+ mixins: [R]
358
+ }, ce = {
350
359
  install(e, t = {}) {
351
- $(), a(t);
360
+ g(), l(t);
352
361
  }
353
362
  };
354
363
  export {
355
- le as RebillyApplePay,
356
- oe as RebillyBbanAccountNumber,
357
- ie as RebillyBbanAccountType,
358
- re as RebillyBbanRoutingNumber,
359
- Z as RebillyCard,
360
- ee as RebillyCardCvv,
361
- te as RebillyCardExpiration,
362
- ne as RebillyCardNumber,
364
+ me as RebillyApplePay,
365
+ se as RebillyBbanAccountNumber,
366
+ re as RebillyBbanAccountType,
367
+ oe as RebillyBbanRoutingNumber,
368
+ ee as RebillyCard,
369
+ te as RebillyCardCvv,
370
+ ne as RebillyCardExpiration,
371
+ ie as RebillyCardNumber,
363
372
  i as RebillyFieldTypes,
364
- J as RebillyForm,
365
- ae as RebillyGooglePay,
366
- se as RebillyIban,
367
- me as RebillyPaypal,
368
- Q as RebillyToken,
369
- G as createToken,
370
- de as default,
371
- l as updateConfig
373
+ Q as RebillyForm,
374
+ le as RebillyGooglePay,
375
+ ae as RebillyIban,
376
+ de as RebillyPaypal,
377
+ Z as RebillyToken,
378
+ z as createToken,
379
+ ce as default,
380
+ m as updateConfig
372
381
  };
@@ -1 +1 @@
1
- (function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.FramePayVue={},i.Vue))})(this,function(i,r){"use strict";function d({message:e="Could not mount FramePay to element.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayMountError"}function h({message:e="FramePay could not be initialized.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayInitializeError"}function c({message:e="FramePay could not be loaded.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayLoadError"}const L=window.process?.env?.FRAMEPAY_SCRIPT_LINK||"https://framepay.rebilly.com/framepay.js",B=window.process?.env?.FRAMEPAY_STYLE_LINK||"https://framepay.rebilly.com/framepay.css",f=()=>new Promise((e,t)=>{const n=document.createElement("script");n.src=L,n.id="rebilly-framepay-js",n.onload=()=>e(Framepay),n.onerror=()=>t(),document.querySelector("head").appendChild(n)}).catch(e=>{throw new c({details:e})});let R;const I=new Promise(e=>{R=e}),A=R,_=I.then(f);function P(){if(document.querySelector("link#rebilly-framepay-css"))return;const e=document.createElement("link");e.href=B,e.id="rebilly-framepay-css",e.type="text/css",e.rel="stylesheet",e.onerror=t=>{throw new c({details:t})},document.querySelector("head").appendChild(e)}function s(e={}){return _.then(t=>new Promise(n=>{t.on("ready",()=>{n(t)}),t.on("error",l=>{throw new c({details:l})});try{e.injectStyle&&P(),!t.initialized&&(e.publishableKey||e.jwt)&&t.initialize(e)}catch(l){throw new h({details:l})}}))}const o={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 b(e,t){return _.then(n=>{if(!n.initialized)throw new h({message:"Please initialize Framepay before creating a token"});return n.createToken(e,t)})}function m(e){return s(e).then(t=>{t.update({...e})})}const E=(e,t)=>{const n=e.__vccOpts||e;for(const[l,y]of t)n[l]=y;return n},Y={name:"RebillyForm",props:{extraData:{type:Object,default:()=>({})},configuration:{type:Object,default:()=>({})}},emits:["submit","error"],watch:{configuration(e){e&&m(e)}},mounted(){m(this.configuration)},methods:{handler(e){const t=e.target;b(t,this.extraData).then(n=>{this.$attrs.onSubmit?this.$emit("submit",n,t):t.submit()}).catch(n=>{this.$emit("error",n)})}}},N={id:"stop-wrapper"};function T(e,t,n,l,y,u){return r.openBlock(),r.createElementBlock("div",N,[r.createElementVNode("form",{id:"rebilly-form",onSubmit:t[0]||(t[0]=r.withModifiers((...q)=>u.handler&&u.handler(...q),["stop","prevent"]))},[r.renderSlot(e.$slots,"default")],32)])}const C=E(Y,[["render",T]]),g={name:"RebillyToken"},$={id:"rebilly-token","data-rebilly":"token",type:"hidden"};function w(e,t,n,l,y,u){return r.openBlock(),r.createElementBlock("input",$)}const U=E(g,[["render",w]]),a={render(){return r.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){s(this.configuration).then(t=>{try{this.elementType.startsWith("card")?this.element=r.markRaw(t.card.mount(e,this.elementType)):this.elementType==="iban"?this.element=r.markRaw(t.iban.mount(e)):[o.REBILLY_BBAN_ACCOUNT_TYPE,o.REBILLY_BBAN_ACCOUNT_NUMBER,o.REBILLY_BBAN_ROUTING_NUMBER].includes(this.elementType)&&(this.element=r.markRaw(t.bban.mount(e,this.elementType))),this.element.on("ready",()=>this.$emit("ready")),this.element.on("change",n=>this.$emit("change",n)),this.element.on("focus",()=>this.$emit("focus")),this.element.on("blur",()=>this.$emit("blur"))}catch{throw new d}})},destroyElement(){this.element&&this.element.destroy()}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},k={render(){return r.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){s(this.configuration).then(t=>{try{this.element=r.markRaw(t.googlePay.mount(e)),this.element.on("ready",()=>this.$emit("ready")),this.element.on("change",n=>this.$emit("change",n)),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",n=>{this.$emit("token-ready",n),this.$parent.$emit("token-ready",n)})}catch(n){throw new d({details:n})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&m(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},p={render(){return r.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){s(this.configuration).then(t=>{try{let n=null;this.elementType===o.REBILLY_APPLE_PAY?n=t.applePay:this.elementType===o.REBILLY_PAYPAL&&(n=t.paypal),this.element=r.markRaw(n.mount(e)),t.on("token-ready",l=>{this.$emit("token-ready",l),this.$parent.$emit("token-ready",l)})}catch(n){throw new d({details:n})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&m(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},O={name:"rebilly-card",data(){return{elementType:o.REBILLY_CARD}},mixins:[a]},M={name:"rebilly-card-cvv",data(){return{elementType:o.REBILLY_CARD_CVV}},mixins:[a]},S={name:"rebilly-card-expiration",data(){return{elementType:o.REBILLY_CARD_EXPIRATION}},mixins:[a]},D={name:"rebilly-card-number",data(){return{elementType:o.REBILLY_CARD_NUMBER}},mixins:[a]},G={name:"rebilly-bban-account-type",data(){return{elementType:o.REBILLY_BBAN_ACCOUNT_TYPE}},mixins:[a]},F={name:"rebilly-bban-routing-number",data(){return{elementType:o.REBILLY_BBAN_ROUTING_NUMBER}},mixins:[a]},V={name:"rebilly-bban-account-number",data(){return{elementType:o.REBILLY_BBAN_ACCOUNT_NUMBER}},mixins:[a]},j={name:"rebilly-iban",data(){return{elementType:o.REBILLY_IBAN}},mixins:[a]},x={name:"rebilly-google-pay",data(){return{elementType:o.REBILLY_GOOGLE_PAY}},mixins:[k]},z={name:"rebilly-apple-pay",data(){return{elementType:o.REBILLY_APPLE_PAY}},mixins:[p]},v={name:"rebilly-paypal",data(){return{elementType:o.REBILLY_PAYPAL}},mixins:[p]},K={install(e,t={}){A(),s(t)}};i.RebillyApplePay=z,i.RebillyBbanAccountNumber=V,i.RebillyBbanAccountType=G,i.RebillyBbanRoutingNumber=F,i.RebillyCard=O,i.RebillyCardCvv=M,i.RebillyCardExpiration=S,i.RebillyCardNumber=D,i.RebillyFieldTypes=o,i.RebillyForm=C,i.RebillyGooglePay=x,i.RebillyIban=j,i.RebillyPaypal=v,i.RebillyToken=U,i.createToken=b,i.default=K,i.updateConfig=m,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.FramePayVue={},i.Vue))})(this,function(i,r){"use strict";function c({message:e="Could not mount FramePay to element.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayMountError"}function u({message:e="FramePay could not be initialized.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayInitializeError"}function h({message:e="FramePay could not be loaded.",details:t=null}={}){this.message=e,this.details=t,this.name="FramePayLoadError"}const L=window.process?.env?.FRAMEPAY_SCRIPT_LINK||"https://framepay.rebilly.com/framepay.js";window.process?.env?.FRAMEPAY_STYLE_LINK;const B="https://framepay.rebilly.com/framepay.js",f="https://framepay.rebilly.com/framepay.css";async function I({scriptLink:e,styleLink:t}={}){return new Promise(n=>{if(window.Framepay)n(window.Framepay);else{const a=document.createElement("link");a.setAttribute("href",t??f),a.setAttribute("rel","stylesheet"),document.head.prepend(a);const s=document.createElement("script");s.setAttribute("src",e??B),s.onload=()=>n(window.Framepay),document.head.append(s)}})}const A=()=>new Promise(e=>{I({scriptLink:L}).then(t=>e(t))}).catch(e=>{throw new h({details:e})});let R;const P=new Promise(e=>{R=e}),Y=R,_=P.then(A);function m(e={}){return _.then(t=>new Promise(n=>{t.on("ready",()=>{n(t)}),t.on("error",a=>{throw new h({details:a})});try{!t.initialized&&(e.publishableKey||e.jwt)&&t.initialize(e)}catch(a){throw new u({details:a})}}))}const o={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 b(e,t){return _.then(n=>{if(!n.initialized)throw new u({message:"Please initialize Framepay before creating a token"});return n.createToken(e,t)})}function d(e){return m(e).then(t=>{t.update({...e})})}const p=(e,t)=>{const n=e.__vccOpts||e;for(const[a,s]of t)n[a]=s;return n},T={name:"RebillyForm",props:{extraData:{type:Object,default:()=>({})},configuration:{type:Object,default:()=>({})}},emits:["submit","error"],watch:{configuration(e){e&&d(e)}},mounted(){d(this.configuration)},methods:{handler(e){const t=e.target;b(t,this.extraData).then(n=>{this.$attrs.onSubmit?this.$emit("submit",n,t):t.submit()}).catch(n=>{this.$emit("error",n)})}}},N={id:"stop-wrapper"};function C(e,t,n,a,s,y){return r.openBlock(),r.createElementBlock("div",N,[r.createElementVNode("form",{id:"rebilly-form",onSubmit:t[0]||(t[0]=r.withModifiers((...q)=>y.handler&&y.handler(...q),["stop","prevent"]))},[r.renderSlot(e.$slots,"default")],32)])}const w=p(T,[["render",C]]),g={name:"RebillyToken"},$={id:"rebilly-token","data-rebilly":"token",type:"hidden"};function U(e,t,n,a,s,y){return r.openBlock(),r.createElementBlock("input",$)}const k=p(g,[["render",U]]),l={render(){return r.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(t=>{try{this.elementType.startsWith("card")?this.element=r.markRaw(t.card.mount(e,this.elementType)):this.elementType==="iban"?this.element=r.markRaw(t.iban.mount(e)):[o.REBILLY_BBAN_ACCOUNT_TYPE,o.REBILLY_BBAN_ACCOUNT_NUMBER,o.REBILLY_BBAN_ROUTING_NUMBER].includes(this.elementType)&&(this.element=r.markRaw(t.bban.mount(e,this.elementType))),this.element.on("ready",()=>this.$emit("ready")),this.element.on("change",n=>this.$emit("change",n)),this.element.on("focus",()=>this.$emit("focus")),this.element.on("blur",()=>this.$emit("blur"))}catch{throw new c}})},destroyElement(){this.element&&this.element.destroy()}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},O={render(){return r.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(t=>{try{this.element=r.markRaw(t.googlePay.mount(e)),this.element.on("ready",()=>this.$emit("ready")),this.element.on("change",n=>this.$emit("change",n)),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",n=>{this.$emit("token-ready",n),this.$parent.$emit("token-ready",n)})}catch(n){throw new c({details:n})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&d(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},E={render(){return r.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(t=>{try{let n=null;this.elementType===o.REBILLY_APPLE_PAY?n=t.applePay:this.elementType===o.REBILLY_PAYPAL&&(n=t.paypal),this.element=r.markRaw(n.mount(e)),t.on("token-ready",a=>{this.$emit("token-ready",a),this.$parent.$emit("token-ready",a)})}catch(n){throw new c({details:n})}})},destroyElement(){this.element&&this.element.destroy()}},watch:{configuration(e){e&&d(e)}},created(){this.mountElement(`#${this.mountId}`)},beforeDestroy(){this.destroyElement()},beforeUnmount(){this.destroyElement()}},M={name:"rebilly-card",data(){return{elementType:o.REBILLY_CARD}},mixins:[l]},D={name:"rebilly-card-cvv",data(){return{elementType:o.REBILLY_CARD_CVV}},mixins:[l]},S={name:"rebilly-card-expiration",data(){return{elementType:o.REBILLY_CARD_EXPIRATION}},mixins:[l]},F={name:"rebilly-card-number",data(){return{elementType:o.REBILLY_CARD_NUMBER}},mixins:[l]},G={name:"rebilly-bban-account-type",data(){return{elementType:o.REBILLY_BBAN_ACCOUNT_TYPE}},mixins:[l]},V={name:"rebilly-bban-routing-number",data(){return{elementType:o.REBILLY_BBAN_ROUTING_NUMBER}},mixins:[l]},j={name:"rebilly-bban-account-number",data(){return{elementType:o.REBILLY_BBAN_ACCOUNT_NUMBER}},mixins:[l]},x={name:"rebilly-iban",data(){return{elementType:o.REBILLY_IBAN}},mixins:[l]},z={name:"rebilly-google-pay",data(){return{elementType:o.REBILLY_GOOGLE_PAY}},mixins:[O]},K={name:"rebilly-apple-pay",data(){return{elementType:o.REBILLY_APPLE_PAY}},mixins:[E]},v={name:"rebilly-paypal",data(){return{elementType:o.REBILLY_PAYPAL}},mixins:[E]},X={install(e,t={}){Y(),m(t)}};i.RebillyApplePay=K,i.RebillyBbanAccountNumber=j,i.RebillyBbanAccountType=G,i.RebillyBbanRoutingNumber=V,i.RebillyCard=M,i.RebillyCardCvv=D,i.RebillyCardExpiration=S,i.RebillyCardNumber=F,i.RebillyFieldTypes=o,i.RebillyForm=w,i.RebillyGooglePay=z,i.RebillyIban=x,i.RebillyPaypal=v,i.RebillyToken=k,i.createToken=b,i.default=X,i.updateConfig=d,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebilly/framepay-vue",
3
3
  "type": "module",
4
- "version": "6.1.2",
4
+ "version": "7.0.0",
5
5
  "description": "Official Vue wrapper for Rebilly FramePay",
6
6
  "author": "Rebilly",
7
7
  "repository": {
@@ -9,12 +9,11 @@
9
9
  "url": "https://github.com/Rebilly/rebilly"
10
10
  },
11
11
  "license": "MIT",
12
- "main": "./dist/framepay-vue.umd.cjs",
13
- "module": "./dist/framepay-vue.js",
14
12
  "exports": {
15
13
  ".": {
16
14
  "import": "./dist/framepay-vue.js",
17
- "require": "./dist/framepay-vue.umd.cjs"
15
+ "require": "./dist/framepay-vue.umd.cjs",
16
+ "default": "./dist/framepay-vue.js"
18
17
  }
19
18
  },
20
19
  "files": [
@@ -42,6 +41,7 @@
42
41
  },
43
42
  "devDependencies": {
44
43
  "@rebilly/eslint-config": "*",
44
+ "@rebilly/framepay": "*",
45
45
  "@testing-library/cypress": "^10.0.2",
46
46
  "@vitejs/plugin-vue": "^5.1.4",
47
47
  "@vue/test-utils": "^2.4.6",