@rebilly/framepay-vue 1.2.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +5 -9
  2. package/dist/build.js +123 -123
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -18,7 +18,7 @@ This is the repo for the official Vue.js wrapper for Rebilly's [FramePay](https:
18
18
  - [On a component (rebilly-form, rebilly-card etc)](#on-a-component-rebilly-form-rebilly-card-etc)
19
19
  - [Lazy loading Framepay files](#lazy-loading-framepay-files)
20
20
  - [Usage](#usage)
21
- - [Digital wallets](#digital-wallets)
21
+ - [Google Pay and Apple Pay](#google-pay-and-apple-pay)
22
22
  - [With rebilly-form](#with-rebilly-form)
23
23
  - [With rebilly-form and custom submit logic](#with-rebilly-form-and-custom-submit-logic)
24
24
  - [With rebilly-token](#with-rebilly-token)
@@ -165,26 +165,22 @@ The script will only be loaded the first time `created()` is called, so you can
165
165
  - `RebillyCard` automatically mounts the combined credit card payment method
166
166
  - `RebillyCardCvv`, `RebillycardExpiration`, and `RebillyCardNumber` mount three separate components for collecting credit info
167
167
  - `RebillyBankAccountNumber`, `RebillyBankAccountType`, and `RebillyBankRoutingNumber` mount the `ach` (bank account) payment method
168
- - `RebillyDigitalWallet` 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.
168
+ - `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
169
 
170
170
  Two more components are also offered for convenience:
171
171
 
172
172
  - `RebillyForm` wraps a regular HTML `form`. It automatically detects payment method components and performs token creation/injection when the form is submitted. It is the simplest way to get started with `framepay-vue`.
173
173
  - `RebillyToken` can be added to any standard form, and when present will automatically receive the token created by `createToken()`. You do not need to use `RebillyToken` if you are using `RebillyForm` already.
174
174
 
175
- #### Digital wallets
176
- `RebillyDigitaWallet` and `RebillyApplePay` are used like so:
175
+ #### Google Pay and Apple Pay
176
+ `RebillyGooglePay` and `RebillyApplePay` are used like so:
177
177
  ```html
178
178
  <rebilly-apple-pay
179
- :form="form"
180
- :extraData="extraData"
181
179
  @token-ready="handleToken"
182
180
  />
183
181
  ```
184
182
 
185
183
  whereas:
186
- * `:form` is the DOM element of your payment form (this does not need to be `<rebilly-form>`, it could be any DOM element).
187
- * `:extraData` is an object containing any additional information you'd like to supply for the token creation.
188
184
  * `@token-ready` is an event emitted once the payment token has been generated and its payload contains the token object.
189
185
 
190
186
  #### With rebilly-form
@@ -213,7 +209,7 @@ Any DOM attributes you attach to `RebillyForm` will automatically be passed to t
213
209
 
214
210
  `@error` will expose the error message returned if the `Rebilly.createToken()` request failed. You can inspect `error.message` and `error.code`.
215
211
 
216
- `@token-ready` will expose the token object, if a digital wallet element was mounted in the form.
212
+ `@token-ready` will expose the token object, if a Google/Apple Pay element was mounted in the form.
217
213
 
218
214
  See here for all arguments to `extraData`: https://rebilly.github.io/framepay-docs/reference/rebilly.html#extra-data.
219
215
 
package/dist/build.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { h, markRaw } from 'vue';
2
+
1
3
  function MountError() {
2
4
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3
5
  _ref$message = _ref.message,
@@ -128,8 +130,9 @@ var REBILLY_BBAN_ACCOUNT_TYPE = 'accountType';
128
130
  var REBILLY_BBAN_ROUTING_NUMBER = 'routingNumber';
129
131
  var REBILLY_BBAN_ACCOUNT_NUMBER = 'accountNumber';
130
132
  var REBILLY_IBAN = 'iban';
131
- var REBILLY_DIGITAL_WALLET = 'digitalWallet';
133
+ var REBILLY_GOOGLE_PAY = 'googlePay';
132
134
  var REBILLY_APPLE_PAY = 'applePay';
135
+ var REBILLY_PAYPAL = 'paypal';
133
136
  var FIELD_TYPES = {
134
137
  REBILLY_CARD: REBILLY_CARD,
135
138
  REBILLY_CARD_CVV: REBILLY_CARD_CVV,
@@ -139,8 +142,9 @@ var FIELD_TYPES = {
139
142
  REBILLY_BBAN_ROUTING_NUMBER: REBILLY_BBAN_ROUTING_NUMBER,
140
143
  REBILLY_BBAN_ACCOUNT_NUMBER: REBILLY_BBAN_ACCOUNT_NUMBER,
141
144
  REBILLY_IBAN: REBILLY_IBAN,
142
- REBILLY_DIGITAL_WALLET: REBILLY_DIGITAL_WALLET,
143
- REBILLY_APPLE_PAY: REBILLY_APPLE_PAY
145
+ REBILLY_GOOGLE_PAY: REBILLY_GOOGLE_PAY,
146
+ REBILLY_APPLE_PAY: REBILLY_APPLE_PAY,
147
+ REBILLY_PAYPAL: REBILLY_PAYPAL
144
148
  };
145
149
 
146
150
  function createToken (form, extraData) {
@@ -155,30 +159,14 @@ function createToken (form, extraData) {
155
159
  });
156
160
  }
157
161
 
158
- function _defineProperty(obj, key, value) {
159
- if (key in obj) {
160
- Object.defineProperty(obj, key, {
161
- value: value,
162
- enumerable: true,
163
- configurable: true,
164
- writable: true
165
- });
166
- } else {
167
- obj[key] = value;
168
- }
169
-
170
- return obj;
171
- }
172
-
173
162
  function ownKeys(object, enumerableOnly) {
174
163
  var keys = Object.keys(object);
175
164
 
176
165
  if (Object.getOwnPropertySymbols) {
177
166
  var symbols = Object.getOwnPropertySymbols(object);
178
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
167
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
179
168
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
180
- });
181
- keys.push.apply(keys, symbols);
169
+ })), keys.push.apply(keys, symbols);
182
170
  }
183
171
 
184
172
  return keys;
@@ -186,24 +174,32 @@ function ownKeys(object, enumerableOnly) {
186
174
 
187
175
  function _objectSpread2(target) {
188
176
  for (var i = 1; i < arguments.length; i++) {
189
- var source = arguments[i] != null ? arguments[i] : {};
190
-
191
- if (i % 2) {
192
- ownKeys(Object(source), true).forEach(function (key) {
193
- _defineProperty(target, key, source[key]);
194
- });
195
- } else if (Object.getOwnPropertyDescriptors) {
196
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
197
- } else {
198
- ownKeys(Object(source)).forEach(function (key) {
199
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
200
- });
201
- }
177
+ var source = null != arguments[i] ? arguments[i] : {};
178
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
179
+ _defineProperty(target, key, source[key]);
180
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
181
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
182
+ });
202
183
  }
203
184
 
204
185
  return target;
205
186
  }
206
187
 
188
+ function _defineProperty(obj, key, value) {
189
+ if (key in obj) {
190
+ Object.defineProperty(obj, key, {
191
+ value: value,
192
+ enumerable: true,
193
+ configurable: true,
194
+ writable: true
195
+ });
196
+ } else {
197
+ obj[key] = value;
198
+ }
199
+
200
+ return obj;
201
+ }
202
+
207
203
  function updateConfig (configuration) {
208
204
  return initializeRebilly(configuration).then(function (Rebilly) {
209
205
  Rebilly.update(_objectSpread2({}, configuration));
@@ -211,7 +207,7 @@ function updateConfig (configuration) {
211
207
  }
212
208
 
213
209
  //
214
- var script = {
210
+ var script$1 = {
215
211
  name: 'rebilly-form',
216
212
  props: {
217
213
  extraData: {},
@@ -330,10 +326,10 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
330
326
  }
331
327
 
332
328
  /* script */
333
- const __vue_script__ = script;
329
+ const __vue_script__$1 = script$1;
334
330
 
335
331
  /* template */
336
- var __vue_render__ = function() {
332
+ var __vue_render__$1 = function () {
337
333
  var _vm = this;
338
334
  var _h = _vm.$createElement;
339
335
  var _c = _vm._self._c || _h;
@@ -344,17 +340,17 @@ var __vue_render__ = function() {
344
340
  2
345
341
  )
346
342
  };
347
- var __vue_staticRenderFns__ = [];
348
- __vue_render__._withStripped = true;
343
+ var __vue_staticRenderFns__$1 = [];
344
+ __vue_render__$1._withStripped = true;
349
345
 
350
346
  /* style */
351
- const __vue_inject_styles__ = undefined;
347
+ const __vue_inject_styles__$1 = undefined;
352
348
  /* scoped */
353
- const __vue_scope_id__ = undefined;
349
+ const __vue_scope_id__$1 = undefined;
354
350
  /* module identifier */
355
- const __vue_module_identifier__ = undefined;
351
+ const __vue_module_identifier__$1 = undefined;
356
352
  /* functional template */
357
- const __vue_is_functional_template__ = false;
353
+ const __vue_is_functional_template__$1 = false;
358
354
  /* style inject */
359
355
 
360
356
  /* style inject SSR */
@@ -363,13 +359,13 @@ __vue_render__._withStripped = true;
363
359
 
364
360
 
365
361
 
366
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
367
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
368
- __vue_inject_styles__,
369
- __vue_script__,
370
- __vue_scope_id__,
371
- __vue_is_functional_template__,
372
- __vue_module_identifier__,
362
+ const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
363
+ { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
364
+ __vue_inject_styles__$1,
365
+ __vue_script__$1,
366
+ __vue_scope_id__$1,
367
+ __vue_is_functional_template__$1,
368
+ __vue_module_identifier__$1,
373
369
  false,
374
370
  undefined,
375
371
  undefined,
@@ -383,33 +379,33 @@ __vue_render__._withStripped = true;
383
379
  //
384
380
  //
385
381
  //
386
- var script$1 = {
382
+ var script = {
387
383
  name: 'rebilly-token'
388
384
  };
389
385
 
390
386
  /* script */
391
- const __vue_script__$1 = script$1;
387
+ const __vue_script__ = script;
392
388
 
393
389
  /* template */
394
- var __vue_render__$1 = function() {
390
+ var __vue_render__ = function () {
395
391
  var _vm = this;
396
392
  var _h = _vm.$createElement;
397
393
  var _c = _vm._self._c || _h;
398
394
  return _c("input", {
399
- attrs: { id: "rebilly-token", "data-rebilly": "token", type: "hidden" }
395
+ attrs: { id: "rebilly-token", "data-rebilly": "token", type: "hidden" },
400
396
  })
401
397
  };
402
- var __vue_staticRenderFns__$1 = [];
403
- __vue_render__$1._withStripped = true;
398
+ var __vue_staticRenderFns__ = [];
399
+ __vue_render__._withStripped = true;
404
400
 
405
401
  /* style */
406
- const __vue_inject_styles__$1 = undefined;
402
+ const __vue_inject_styles__ = undefined;
407
403
  /* scoped */
408
- const __vue_scope_id__$1 = undefined;
404
+ const __vue_scope_id__ = undefined;
409
405
  /* module identifier */
410
- const __vue_module_identifier__$1 = undefined;
406
+ const __vue_module_identifier__ = undefined;
411
407
  /* functional template */
412
- const __vue_is_functional_template__$1 = false;
408
+ const __vue_is_functional_template__ = false;
413
409
  /* style inject */
414
410
 
415
411
  /* style inject SSR */
@@ -418,13 +414,13 @@ __vue_render__$1._withStripped = true;
418
414
 
419
415
 
420
416
 
421
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
422
- { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
423
- __vue_inject_styles__$1,
424
- __vue_script__$1,
425
- __vue_scope_id__$1,
426
- __vue_is_functional_template__$1,
427
- __vue_module_identifier__$1,
417
+ const __vue_component__ = /*#__PURE__*/normalizeComponent(
418
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
419
+ __vue_inject_styles__,
420
+ __vue_script__,
421
+ __vue_scope_id__,
422
+ __vue_is_functional_template__,
423
+ __vue_module_identifier__,
428
424
  false,
429
425
  undefined,
430
426
  undefined,
@@ -432,8 +428,9 @@ __vue_render__$1._withStripped = true;
432
428
  );
433
429
 
434
430
  var BaseElementMixin = {
435
- render: function render(createElement) {
436
- return createElement('div', {
431
+ render: function render() {
432
+ return h('div', {
433
+ id: this.mountId,
437
434
  domProps: {
438
435
  id: this.mountId
439
436
  }
@@ -458,11 +455,11 @@ var BaseElementMixin = {
458
455
  initializeRebilly(this.configuration).then(function (Rebilly) {
459
456
  try {
460
457
  if (_this.elementType.startsWith('card')) {
461
- _this.element = Rebilly.card.mount(selector, _this.elementType);
458
+ _this.element = markRaw(Rebilly.card.mount(selector, _this.elementType));
462
459
  } else if (_this.elementType === 'iban') {
463
- _this.element = Rebilly.iban.mount(selector);
460
+ _this.element = markRaw(Rebilly.iban.mount(selector));
464
461
  } else if ([FIELD_TYPES.REBILLY_BBAN_ACCOUNT_TYPE, FIELD_TYPES.REBILLY_BBAN_ACCOUNT_NUMBER, FIELD_TYPES.REBILLY_BBAN_ROUTING_NUMBER].includes(_this.elementType)) {
465
- _this.element = Rebilly.bban.mount(selector, _this.elementType);
462
+ _this.element = markRaw(Rebilly.bban.mount(selector, _this.elementType));
466
463
  }
467
464
 
468
465
  _this.element.on('ready', function () {
@@ -496,9 +493,10 @@ var BaseElementMixin = {
496
493
  }
497
494
  };
498
495
 
499
- var DigitalWalletMixin = {
500
- render: function render(createElement) {
501
- return createElement('div', {
496
+ var GooglePayMixin = {
497
+ render: function render() {
498
+ return h('div', {
499
+ id: this.mountId,
502
500
  domProps: {
503
501
  id: this.mountId
504
502
  }
@@ -508,9 +506,7 @@ var DigitalWalletMixin = {
508
506
  id: {
509
507
  type: String
510
508
  },
511
- configuration: {},
512
- form: {},
513
- extraData: {}
509
+ configuration: {}
514
510
  },
515
511
  data: function data() {
516
512
  return {
@@ -524,40 +520,27 @@ var DigitalWalletMixin = {
524
520
 
525
521
  initializeRebilly(this.configuration).then(function (Rebilly) {
526
522
  try {
527
- var form = document.getElementById('rebilly-form') || _this.form;
528
-
529
- if (_this.elementType === 'digitalWallet') {
530
- _this.element = Rebilly.digitalWallet.mount(selector, {
531
- type: 'googlePay',
532
- form: form,
533
- extraData: _this.extraData
534
- });
535
-
536
- _this.element.on('ready', function () {
537
- return _this.$emit('ready');
538
- });
539
-
540
- _this.element.on('change', function (e) {
541
- return _this.$emit('change', e);
542
- });
543
-
544
- _this.element.on('focus', function () {
545
- return _this.$emit('focus');
546
- });
547
-
548
- _this.element.on('blur', function () {
549
- return _this.$emit('blur');
550
- });
551
-
552
- _this.element.on('error', function () {
553
- return _this.$emit('error');
554
- });
555
- } else if (_this.elementType === 'applePay') {
556
- _this.element = Rebilly.applePay.mount(selector, {
557
- form: form,
558
- extraData: _this.extraData
559
- });
560
- }
523
+ _this.element = markRaw(Rebilly.googlePay.mount(selector));
524
+
525
+ _this.element.on('ready', function () {
526
+ return _this.$emit('ready');
527
+ });
528
+
529
+ _this.element.on('change', function (e) {
530
+ return _this.$emit('change', e);
531
+ });
532
+
533
+ _this.element.on('focus', function () {
534
+ return _this.$emit('focus');
535
+ });
536
+
537
+ _this.element.on('blur', function () {
538
+ return _this.$emit('blur');
539
+ });
540
+
541
+ _this.element.on('error', function () {
542
+ return _this.$emit('error');
543
+ });
561
544
 
562
545
  Rebilly.on('token-ready', function (token) {
563
546
  // https://github.com/vuejs/vue/issues/4332#issuecomment-263444492
@@ -592,9 +575,10 @@ var DigitalWalletMixin = {
592
575
  }
593
576
  };
594
577
 
595
- var ApplePayMixin = {
596
- render: function render(createElement) {
597
- return createElement('div', {
578
+ var NonIframeElementMixin = {
579
+ render: function render() {
580
+ return h('div', {
581
+ id: this.mountId,
598
582
  domProps: {
599
583
  id: this.mountId
600
584
  }
@@ -618,7 +602,15 @@ var ApplePayMixin = {
618
602
 
619
603
  initializeRebilly(this.configuration).then(function (Rebilly) {
620
604
  try {
621
- _this.element = Rebilly.applePay.mount(selector);
605
+ var namespace = null;
606
+
607
+ if (_this.elementType === FIELD_TYPES.REBILLY_APPLE_PAY) {
608
+ namespace = Rebilly.applePay;
609
+ } else if (_this.elementType === FIELD_TYPES.REBILLY_PAYPAL) {
610
+ namespace = Rebilly.paypal;
611
+ }
612
+
613
+ _this.element = markRaw(namespace.mount(selector));
622
614
  Rebilly.on('token-ready', function (token) {
623
615
  // https://github.com/vuejs/vue/issues/4332#issuecomment-263444492
624
616
  // Emit token on the element level:
@@ -724,14 +716,14 @@ var RebillyIban = {
724
716
  },
725
717
  mixins: [BaseElementMixin]
726
718
  };
727
- var RebillyDigitalWallet = {
728
- name: 'rebilly-digital-wallet',
719
+ var RebillyGooglePay = {
720
+ name: 'rebilly-google-pay',
729
721
  data: function data() {
730
722
  return {
731
- elementType: FIELD_TYPES.REBILLY_DIGITAL_WALLET
723
+ elementType: FIELD_TYPES.REBILLY_GOOGLE_PAY
732
724
  };
733
725
  },
734
- mixins: [DigitalWalletMixin]
726
+ mixins: [GooglePayMixin]
735
727
  };
736
728
  var RebillyApplePay = {
737
729
  name: 'rebilly-apple-pay',
@@ -740,7 +732,16 @@ var RebillyApplePay = {
740
732
  elementType: FIELD_TYPES.REBILLY_APPLE_PAY
741
733
  };
742
734
  },
743
- mixins: [ApplePayMixin]
735
+ mixins: [NonIframeElementMixin]
736
+ };
737
+ var RebillyPaypal = {
738
+ name: 'rebilly-paypal',
739
+ data: function data() {
740
+ return {
741
+ elementType: FIELD_TYPES.REBILLY_PAYPAL
742
+ };
743
+ },
744
+ mixins: [NonIframeElementMixin]
744
745
  };
745
746
 
746
747
  var FramePay = {
@@ -751,5 +752,4 @@ var FramePay = {
751
752
  }
752
753
  };
753
754
 
754
- export default FramePay;
755
- export { RebillyApplePay, RebillyBbanAccountNumber, RebillyBbanAccountType, RebillyBbanRoutingNumber, RebillyCard, RebillyCardCvv, RebillyCardExpiration, RebillyCardNumber, RebillyDigitalWallet, FIELD_TYPES as RebillyFieldTypes, __vue_component__ as RebillyForm, RebillyIban, __vue_component__$1 as RebillyToken, createToken, updateConfig };
755
+ export { RebillyApplePay, RebillyBbanAccountNumber, RebillyBbanAccountType, RebillyBbanRoutingNumber, RebillyCard, RebillyCardCvv, RebillyCardExpiration, RebillyCardNumber, FIELD_TYPES as RebillyFieldTypes, __vue_component__$1 as RebillyForm, RebillyGooglePay, RebillyIban, RebillyPaypal, __vue_component__ as RebillyToken, createToken, FramePay as default, updateConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/framepay-vue",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Official Vue wrapper for Rebilly FramePay",
5
5
  "author": "Rebilly",
6
6
  "repository": "https://github.com/Rebilly/framepay-vue",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@testing-library/cypress": "^7.0.2",
40
- "@vue/cli-plugin-babel": "^4.5.9",
41
- "@vue/cli-plugin-eslint": "^4.5.9",
42
- "@vue/cli-plugin-unit-jest": "^4.5.9",
43
- "@vue/cli-service": "^4.5.9",
40
+ "@vue/cli-plugin-babel": "^4.5.19",
41
+ "@vue/cli-plugin-eslint": "^4.5.19",
42
+ "@vue/cli-plugin-unit-jest": "^4.5.19",
43
+ "@vue/cli-service": "^4.5.19",
44
44
  "@vue/eslint-config-airbnb": "^5.1.0",
45
45
  "@vue/test-utils": "^1.1.1",
46
46
  "babel-core": "7.0.0-bridge.0",
@@ -56,8 +56,8 @@
56
56
  "rollup-plugin-babel": "^4.3.2",
57
57
  "rollup-plugin-commonjs": "^10.0.0",
58
58
  "rollup-plugin-vue": "^5.1.9",
59
- "vue": "^2.4.0",
60
- "vue-template-compiler": "^2.5.21"
59
+ "vue": "^2.7.10",
60
+ "vue-template-compiler": "^2.7.10"
61
61
  },
62
62
  "eslintConfig": {
63
63
  "root": true,