@paystack/inline-js 2.23.0-dev.2 → 2.23.0-dev.4

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/dist/inline.js CHANGED
@@ -3,37 +3,29 @@ var PaystackPop = (function () {
3
3
 
4
4
  function _arrayLikeToArray(r, a) {
5
5
  (null == a || a > r.length) && (a = r.length);
6
-
7
6
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
8
-
9
7
  return n;
10
8
  }
11
-
12
9
  function _arrayWithHoles(r) {
13
10
  if (Array.isArray(r)) return r;
14
11
  }
15
-
16
12
  function _arrayWithoutHoles(r) {
17
13
  if (Array.isArray(r)) return _arrayLikeToArray(r);
18
14
  }
19
-
20
15
  function _classCallCheck(a, n) {
21
16
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
22
17
  }
23
-
24
18
  function _defineProperties(e, r) {
25
19
  for (var t = 0; t < r.length; t++) {
26
20
  var o = r[t];
27
21
  o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
28
22
  }
29
23
  }
30
-
31
24
  function _createClass(e, r, t) {
32
25
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
33
26
  writable: !1
34
27
  }), e;
35
28
  }
36
-
37
29
  function _defineProperty(e, r, t) {
38
30
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
31
  value: t,
@@ -42,23 +34,19 @@ var PaystackPop = (function () {
42
34
  writable: !0
43
35
  }) : e[r] = t, e;
44
36
  }
45
-
46
37
  function _iterableToArray(r) {
47
38
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
48
39
  }
49
-
50
40
  function _iterableToArrayLimit(r, l) {
51
41
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
52
-
53
42
  if (null != t) {
54
43
  var e,
55
- n,
56
- i,
57
- u,
58
- a = [],
59
- f = !0,
60
- o = !1;
61
-
44
+ n,
45
+ i,
46
+ u,
47
+ a = [],
48
+ f = !0,
49
+ o = !1;
62
50
  try {
63
51
  if (i = (t = t.call(r)).next, 0 === l) {
64
52
  if (Object(t) !== t) return;
@@ -73,32 +61,25 @@ var PaystackPop = (function () {
73
61
  if (o) throw n;
74
62
  }
75
63
  }
76
-
77
64
  return a;
78
65
  }
79
66
  }
80
-
81
67
  function _nonIterableRest() {
82
68
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
83
69
  }
84
-
85
70
  function _nonIterableSpread() {
86
71
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
87
72
  }
88
-
89
73
  function ownKeys(e, r) {
90
74
  var t = Object.keys(e);
91
-
92
75
  if (Object.getOwnPropertySymbols) {
93
76
  var o = Object.getOwnPropertySymbols(e);
94
77
  r && (o = o.filter(function (r) {
95
78
  return Object.getOwnPropertyDescriptor(e, r).enumerable;
96
79
  })), t.push.apply(t, o);
97
80
  }
98
-
99
81
  return t;
100
82
  }
101
-
102
83
  function _objectSpread2(e) {
103
84
  for (var r = 1; r < arguments.length; r++) {
104
85
  var t = null != arguments[r] ? arguments[r] : {};
@@ -108,65 +89,48 @@ var PaystackPop = (function () {
108
89
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
109
90
  });
110
91
  }
111
-
112
92
  return e;
113
93
  }
114
-
115
94
  function _objectWithoutProperties(e, t) {
116
95
  if (null == e) return {};
117
-
118
96
  var o,
119
- r,
120
- i = _objectWithoutPropertiesLoose(e, t);
121
-
97
+ r,
98
+ i = _objectWithoutPropertiesLoose(e, t);
122
99
  if (Object.getOwnPropertySymbols) {
123
100
  var n = Object.getOwnPropertySymbols(e);
124
-
125
101
  for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
126
102
  }
127
-
128
103
  return i;
129
104
  }
130
-
131
105
  function _objectWithoutPropertiesLoose(r, e) {
132
106
  if (null == r) return {};
133
107
  var t = {};
134
-
135
108
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
136
109
  if (-1 !== e.indexOf(n)) continue;
137
110
  t[n] = r[n];
138
111
  }
139
-
140
112
  return t;
141
113
  }
142
-
143
114
  function _slicedToArray(r, e) {
144
115
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
145
116
  }
146
-
147
117
  function _toConsumableArray(r) {
148
118
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
149
119
  }
150
-
151
120
  function _toPrimitive(t, r) {
152
121
  if ("object" != typeof t || !t) return t;
153
122
  var e = t[Symbol.toPrimitive];
154
-
155
123
  if (void 0 !== e) {
156
124
  var i = e.call(t, r || "default");
157
125
  if ("object" != typeof i) return i;
158
126
  throw new TypeError("@@toPrimitive must return a primitive value.");
159
127
  }
160
-
161
128
  return ("string" === r ? String : Number)(t);
162
129
  }
163
-
164
130
  function _toPropertyKey(t) {
165
131
  var i = _toPrimitive(t, "string");
166
-
167
132
  return "symbol" == typeof i ? i : i + "";
168
133
  }
169
-
170
134
  function _typeof(o) {
171
135
  "@babel/helpers - typeof";
172
136
 
@@ -176,7 +140,6 @@ var PaystackPop = (function () {
176
140
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
177
141
  }, _typeof(o);
178
142
  }
179
-
180
143
  function _unsupportedIterableToArray(r, a) {
181
144
  if (r) {
182
145
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -222,18 +185,16 @@ var PaystackPop = (function () {
222
185
  staging: stagingConfig,
223
186
  production: productionConfig
224
187
  };
225
- /* eslint-disable */
226
188
 
189
+ /* eslint-disable */
227
190
  var config = configurations['staging'] || stagingConfig;
228
191
 
229
192
  function randomId() {
230
193
  var text = '';
231
194
  var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
232
-
233
195
  for (var i = 0; i < 5; i += 1) {
234
196
  text += possible.charAt(Math.floor(Math.random() * possible.length));
235
197
  }
236
-
237
198
  return text;
238
199
  }
239
200
 
@@ -267,15 +228,12 @@ var PaystackPop = (function () {
267
228
  var scripts = document.getElementsByTagName('script');
268
229
  return scripts[scripts.length - 1];
269
230
  }
270
-
271
231
  function getSourceScript() {
272
232
  return document.currentScript || getLastScript();
273
233
  }
274
-
275
234
  function getDataAttributes() {
276
235
  var dataAttributes = [];
277
236
  var sourceScript = getSourceScript();
278
-
279
237
  if (sourceScript) {
280
238
  var attributes = Array.prototype.slice.call(sourceScript.attributes);
281
239
  dataAttributes = Object.keys(attributes).filter(function (key) {
@@ -285,10 +243,8 @@ var PaystackPop = (function () {
285
243
  return attributes[index].nodeName;
286
244
  });
287
245
  }
288
-
289
246
  return dataAttributes;
290
247
  }
291
-
292
248
  function scriptCanUseDataAttributes() {
293
249
  var hasDataAttributes = getDataAttributes().length > 0;
294
250
  var hasParentForm = getSourceScript() && getSourceScript().parentElement.tagName === 'FORM';
@@ -300,30 +256,23 @@ var PaystackPop = (function () {
300
256
  return g[1].toUpperCase();
301
257
  });
302
258
  }
303
-
304
259
  function validateLazyParameters(parameters) {
305
260
  if (parameters.buttonId && !document.getElementById(parameters.buttonId)) {
306
261
  throw new Error('Please make sure the buttonId is an element available in the DOM');
307
262
  }
308
-
309
263
  var updatedParameters = _objectSpread2({}, parameters);
310
-
311
264
  updatedParameters.buttonText = parameters.buttonText || 'Pay';
312
265
  updatedParameters.buttonVariant = 'normal';
313
266
  updatedParameters.buttonWordmarkVariant = 'normal';
314
267
  var allowedVariants = ['normal', 'light'];
315
-
316
268
  if (parameters.buttonVariant && allowedVariants.indexOf(parameters.buttonVariant) > -1) {
317
269
  updatedParameters.buttonVariant = parameters.buttonVariant;
318
270
  }
319
-
320
271
  if (parameters.buttonWordmarkVariant && allowedVariants.indexOf(parameters.buttonWordmarkVariant) > -1) {
321
272
  updatedParameters.buttonWordmarkVariant = parameters.buttonWordmarkVariant;
322
273
  }
323
-
324
274
  return updatedParameters;
325
275
  }
326
-
327
276
  var parameters = {};
328
277
  var sourceScript = getSourceScript();
329
278
  var dataAttributes = getDataAttributes();
@@ -348,7 +297,6 @@ var PaystackPop = (function () {
348
297
  var backgroundCSS = "\n z-index: 999999999999999;\n background: transparent;\n background: rgba(0, 0, 0, 0.75); \n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n transition: opacity 0.3s;\n -webkit-transition: opacity 0.3s;\n visibility: hidden;\n display: none;\n";
349
298
  var checkoutCSS = "\n z-index: 999999999999999;\n background: transparent;\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n visibility: hidden;\n display: none;\n height: 100%;\n";
350
299
  var embedCSS = "\n background: transparent;\n background: rgba(0,0,0,0);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n nmargin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n visibility: hidden;\n display: none;\n";
351
-
352
300
  function generateInlineButtonCSS(variant) {
353
301
  var baseCSS = "\n box-sizing: border-box;\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n margin: 0 0 10px;\n text-align: center;\n -webkit-appearance: none;\n outline: none;\n font-size: 14px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n padding: 16px 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.15);\n transition: all .3s ease;\n border: none;\n min-width: 190px;\n ";
354
302
  var greenCSS = "\n background: linear-gradient(180deg,#44b669 0,#40ad57);\n text-shadow: 1px 1px 1px rgba(0,0,0,.1);\n color: #ffffff;\n ";
@@ -359,7 +307,6 @@ var PaystackPop = (function () {
359
307
  };
360
308
  return "".concat(baseCSS).concat(colorVariants[variant]);
361
309
  }
362
-
363
310
  function generateInlineButtonHTML(options) {
364
311
  var wordmarkVariants = {
365
312
  normal: secureByPaystack,
@@ -380,7 +327,6 @@ var PaystackPop = (function () {
380
327
  if (!(styles && _typeof(styles) === 'object')) {
381
328
  return defaultCustomApplePayStyles;
382
329
  }
383
-
384
330
  var customStyles = Object.keys(defaultCustomApplePayStyles).reduce(function (newDefaultStyles, key) {
385
331
  return _objectSpread2(_objectSpread2({}, newDefaultStyles), {}, _defineProperty({}, key, styles[key] || defaultCustomApplePayStyles[key]));
386
332
  }, {});
@@ -388,18 +334,18 @@ var PaystackPop = (function () {
388
334
  };
389
335
  var generateApplePayCSS = function generateApplePayCSS(_ref) {
390
336
  var height = _ref.height,
391
- width = _ref.width,
392
- borderRadius = _ref.borderRadius,
393
- padding = _ref.padding;
337
+ width = _ref.width,
338
+ borderRadius = _ref.borderRadius,
339
+ padding = _ref.padding;
394
340
  return "\n apple-pay-button {\n --apple-pay-button-width: ".concat(width, ";\n --apple-pay-button-height: ").concat(height, ";\n --apple-pay-button-border-radius: ").concat(borderRadius, ";\n --apple-pay-button-padding: ").concat(padding, ";\n --apple-pay-button-box-sizing: border-box;\n width: ").concat(width, ";\n }\n");
395
341
  };
396
342
  var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
397
343
  var height = _ref2.height,
398
- width = _ref2.width,
399
- borderRadius = _ref2.borderRadius,
400
- padding = _ref2.padding,
401
- type = _ref2.type,
402
- locale = _ref2.locale;
344
+ width = _ref2.width,
345
+ borderRadius = _ref2.borderRadius,
346
+ padding = _ref2.padding,
347
+ type = _ref2.type,
348
+ locale = _ref2.locale;
403
349
  return "\n @supports (-webkit-appearance: -apple-pay-button) { \n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(width, ";\n height: ").concat(height, ";\n border-radius: ").concat(borderRadius, ";\n padding: ").concat(padding, ";\n -apple-pay-button-type: ").concat(type, ";\n -webkit-locale: ").concat(locale, ";\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n");
404
350
  };
405
351
  var preCheckoutModalCSS = "\n .pre-checkout-modal {\n display: none;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n overflow: auto;\n background-color: rgba(0, 0, 0, 0.75);\n transition: all 0.2s ease;\n }\n\n .pre-checkout-modal.show {\n display: block;\n }\n\n .pre-checkout-modal__content {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n margin-left: auto;\n margin-right: auto;\n background-color: #fefefe;\n padding: 20px;\n padding-bottom: max(30px, env(safe-area-inset-bottom));\n width: 100%;\n border-radius: 6px 6px 0 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n max-width: 350px;\n\n box-sizing: border-box;\n transform: translateY(238px);\n transition: transform 0.3s cubic-bezier(.16,.81,.32,1);\n }\n\n .modal-wrapper {\n width: 100%;\n }\n\n .payment-info {\n position: relative;\n padding-bottom: 15px;\n border-bottom: solid 1px whitesmoke;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n width: 100%;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n }\n\n .customer-email {\n color: #737373;\n font-size: 13px;\n line-height: 16px;\n }\n\n .customer-info {\n flex: 1;\n text-align: right;\n }\n\n .merchant-logo {\n display: flex;\n align-items: center;\n height: 30px;\n }\n .transaction-amount {\n margin-top: 5px;\n font-size: 13px;\n line-height: 16px;\n color: #737373;\n }\n\n .amount {\n color: #29b263;\n font-weight: bold;\n }\n\n @media only screen and (min-width: 500px) {\n .pre-checkout-modal__content {\n bottom: 0;\n top: 0;\n margin: auto;\n border-radius: 6px;\n height: fit-content;\n }\n }\n\n .pre-checkout-modal__content.show {\n transform: translateY(0);\n margin: 0 auto;\n margin-top: 100px;\n }\n\n .pre-checkout-modal__content > * {\n margin-top: 0;\n margin-bottom: 40px;\n }\n .pre-checkout-modal__content > *:last-child {\n margin-bottom: 0;\n }\n\n .pre-checkout-modal__content svg {\n margin: auto;\n width: 100%;\n }\n\n #inline-button-wordmark--white {\n position: absolute;\n bottom: -50px;\n margin: auto;\n left: 0;\n right: 0;\n width: fit-content;\n }\n\n #inline-button-wordmark--grey {\n display: none;\n }\n\n .pre-checkout-modal__content #apple-pay-mark--light {\n margin-bottom: 16px;\n }\n\n .pre-checkout-modal p {\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n color: #4E4E4E;\n line-height: 140%;\n font-size: 14px;\n font-weight: 500;\n margin: 0;\n padding: 0 20px;\n text-align: center;\n letter-spacing: -0.3px;\n }\n\n .pre-checkout-modal button {\n height: 42px;\n width: 100%;\n \n box-sizing: border-box;\n border-radius: 3px;\n font-size: 14px;\n line-height: 24px;\n cursor: pointer;\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n }\n\n .pre-checkout-modal .open-paystack-pop-button {\n background: #FAFAFA;\n border: 1px solid #F2F3F3;\n color: #4E4E4E;\n font-weight: 500;\n }\n\n .pre-checkout-modal .open-paystack-pop-button:hover, \n .pre-checkout-modal .open-paystack-pop-button:active, \n .pre-checkout-modal .open-paystack-pop-button:focus {\n background: #F2F3F3;\n }\n\n .pre-checkout-modal .pay-with-vault-button {\n font-weight: 700;\n background: #44b669;\n background: linear-gradient(to bottom, #44b669 0%, #40ad57 100%);\n border: solid 1px #49a861;\n text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);\n outline: none;\n color: white;\n transition: all 300ms;\n }\n\n .pre-checkout-modal .vault-instruction {\n color: #2f3d4d;\n font-size: 14px;\n letter-spacing: normal;\n line-height: 1.4;\n margin: 0 auto 24px;\n padding: 0;\n }\n .vault-logo-container {\n width: 74px;\n height: 20px;\n margin: 0 auto 24px\n }\n .vault-logo-container img {\n height: 100%;\n width: 100%;\n border-radius: 8px;\n }\n .vault-divider {\n margin-bottom: 16px;\n margin-top: 24px;\n position: relative;\n }\n .vault-divider__container {\n align-items: center;\n bottom: 0;\n display: flex;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n .vault-divider__line {\n border: 1px dashed #ccced0;\n width: 100%;\n }\n .vault-divider__text-container {\n display: flex;\n justify-content: center;\n position: relative;\n }\n .vault-divider__text {\n background-color: #fff;\n color: #999da1;\n font-size: 14px;\n font-weight: 500;\n letter-spacing: -.3px;\n line-height: 19.6px;\n margin-bottom: 2px;\n padding: 0 8px;\n }\n\n #payment-request-button {\n width: 100%;\n height: fit-content;\n margin: 24px 0 16px 0;\n }\n\n #paystackpop-button {\n padding: 0 16px;\n }\n\n #apple-pay-close-button {\n position: absolute;\n text-align: center;\n top: 0;\n right: -26px;\n height: 16px;\n width: 16px;\n padding: 0;\n display: inline-block;\n z-index: 3;\n border-radius: 50%;\n background: transparent;\n transition: all 300ms;\n outline: none;\n cursor: pointer;\n border: none;\n }\n\n #apple-pay-close-button svg {\n width: initial;\n }\n \n #apple-pay-close-button:hover {\n background-color: #e22b28;\n }\n\n @media only screen and (max-width: 500px) {\n .pre-checkout-modal__content {\n max-width: 500px;\n border-radius: 0;\n padding-bottom: 0;\n }\n\n .modal-wrapper {\n padding: 0;\n }\n\n .vault-logo-container {\n width: 74px;\n height: 20px;\n }\n\n #inline-button-wordmark--white {\n display: none\n }\n \n #inline-button-wordmark--grey {\n display: block;\n width: 100%;\n margin: 16px 0;\n height: 13px;\n }\n\n #apple-pay-close-button {\n display: none;\n }\n }\n";
@@ -439,7 +385,6 @@ var PaystackPop = (function () {
439
385
  UNKNOWN: 'paymentCredentialStatusUnknown',
440
386
  UNSUPPORTED: 'applePayUnsupported'
441
387
  };
442
-
443
388
  var formatIntervalString = function formatIntervalString(interval) {
444
389
  var plans = {
445
390
  biannually: 'BIANNUAL PLAN',
@@ -447,12 +392,11 @@ var PaystackPop = (function () {
447
392
  };
448
393
  return plans[interval] || "".concat(interval.toUpperCase(), " PLAN");
449
394
  };
450
-
451
395
  var generateApplePaymentRequestObject = function generateApplePaymentRequestObject(_ref) {
452
396
  var currency = _ref.currency,
453
- amount = _ref.amount,
454
- merchantName = _ref.merchantName,
455
- interval = _ref.interval;
397
+ amount = _ref.amount,
398
+ merchantName = _ref.merchantName,
399
+ interval = _ref.interval;
456
400
  return _objectSpread2({
457
401
  countryCode: 'NG',
458
402
  currencyCode: currency,
@@ -473,10 +417,10 @@ var PaystackPop = (function () {
473
417
  };
474
418
  var validateApplePaySession = function validateApplePaySession(_ref2) {
475
419
  var transactionId = _ref2.transactionId,
476
- validationURL = _ref2.validationURL,
477
- merchantName = _ref2.merchantName,
478
- _ref2$domainName = _ref2.domainName,
479
- domainName = _ref2$domainName === void 0 ? window && window.location && window.location.hostname : _ref2$domainName;
420
+ validationURL = _ref2.validationURL,
421
+ merchantName = _ref2.merchantName,
422
+ _ref2$domainName = _ref2.domainName,
423
+ domainName = _ref2$domainName === void 0 ? window && window.location && window.location.hostname : _ref2$domainName;
480
424
  var validateSessionUrl = "".concat(config.paymentBaseUrl).concat(config.applePayValidateSessionPath);
481
425
  var params = {
482
426
  transaction: transactionId,
@@ -494,7 +438,7 @@ var PaystackPop = (function () {
494
438
  };
495
439
  var chargeApplePay = function chargeApplePay(_ref3) {
496
440
  var transactionId = _ref3.transactionId,
497
- payment = _ref3.payment;
441
+ payment = _ref3.payment;
498
442
  var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
499
443
  var params = {
500
444
  transaction: transactionId,
@@ -515,32 +459,25 @@ var PaystackPop = (function () {
515
459
  return false;
516
460
  }
517
461
  };
518
-
519
462
  var getApplePayCapabilityStatusFromResponse = function getApplePayCapabilityStatusFromResponse(capabilities) {
520
463
  if (!capabilities) {
521
464
  return null;
522
465
  }
523
-
524
466
  if (typeof capabilities === 'string') {
525
467
  return capabilities;
526
468
  }
527
-
528
469
  if (typeof capabilities.paymentCredentialStatus === 'string') {
529
470
  return capabilities.paymentCredentialStatus;
530
471
  }
531
-
532
472
  return null;
533
473
  };
534
-
535
474
  var getApplePayCapabilityStatus = function getApplePayCapabilityStatus() {
536
475
  try {
537
476
  if (!deviceSupportsApplePay()) {
538
477
  return Promise.resolve(null);
539
478
  }
540
-
541
479
  var _window = window,
542
- ApplePaySession = _window.ApplePaySession;
543
-
480
+ ApplePaySession = _window.ApplePaySession;
544
481
  if (typeof ApplePaySession.applePayCapabilities === 'function') {
545
482
  return Promise.resolve(ApplePaySession.applePayCapabilities()).then(function (capabilities) {
546
483
  return getApplePayCapabilityStatusFromResponse(capabilities);
@@ -552,17 +489,14 @@ var PaystackPop = (function () {
552
489
  } catch (fallbackError) {
553
490
  return null;
554
491
  }
555
-
556
492
  return APPLE_PAY_CAPABILITY_STATUS.UNSUPPORTED;
557
493
  });
558
494
  }
559
-
560
495
  if (typeof ApplePaySession.canMakePayments === 'function') {
561
496
  return Promise.resolve(ApplePaySession.canMakePayments()).then(function (canMakePayments) {
562
497
  return canMakePayments ? APPLE_PAY_CAPABILITY_STATUS.UNKNOWN : APPLE_PAY_CAPABILITY_STATUS.UNSUPPORTED;
563
498
  });
564
499
  }
565
-
566
500
  return Promise.resolve(null);
567
501
  } catch (error) {
568
502
  try {
@@ -572,7 +506,6 @@ var PaystackPop = (function () {
572
506
  } catch (fallbackError) {
573
507
  return Promise.resolve(null);
574
508
  }
575
-
576
509
  return Promise.resolve(APPLE_PAY_CAPABILITY_STATUS.UNSUPPORTED);
577
510
  }
578
511
  };
@@ -581,11 +514,9 @@ var PaystackPop = (function () {
581
514
  };
582
515
  var canUseApplePay = function canUseApplePay(channels) {
583
516
  var availableChannels = channels || [];
584
-
585
517
  if (!availableChannels.includes('apple_pay')) {
586
518
  return Promise.resolve(false);
587
519
  }
588
-
589
520
  return getApplePayCapabilityStatus().then(function (capabilityStatus) {
590
521
  return applePayCapabilityCanShowButton(capabilityStatus);
591
522
  });
@@ -598,7 +529,6 @@ var PaystackPop = (function () {
598
529
  elements.forEach(function (element) {
599
530
  var computedStyle = window.getComputedStyle(element);
600
531
  var zIndex = parseFloat(computedStyle.zIndex);
601
-
602
532
  if (!Number.isNaN(zIndex) && zIndex > highestZIndex) {
603
533
  highestZIndex = zIndex;
604
534
  }
@@ -617,7 +547,6 @@ var PaystackPop = (function () {
617
547
  iframe.style.display = 'none';
618
548
  return iframe;
619
549
  }
620
-
621
550
  function mountCheckoutIframe(id) {
622
551
  var iframe = createIframe("inline-checkout-".concat(id));
623
552
  iframe.src = "".concat(config.checkoutUrl, "popup");
@@ -653,20 +582,17 @@ var PaystackPop = (function () {
653
582
  var applePaySdkPromise;
654
583
  var loadScript = function loadScript(url, _ref) {
655
584
  var container = _ref.container,
656
- integrity = _ref.integrity;
585
+ integrity = _ref.integrity;
657
586
  return new Promise(function (resolve, reject) {
658
587
  if (!url) {
659
588
  reject('No script url');
660
589
  }
661
-
662
590
  var script = document.createElement('script');
663
591
  script.src = url;
664
592
  script.crossOrigin = 'anonymous';
665
-
666
593
  if (integrity) {
667
594
  script.integrity = integrity;
668
595
  }
669
-
670
596
  script.addEventListener('load', function () {
671
597
  resolve(true);
672
598
  });
@@ -674,7 +600,6 @@ var PaystackPop = (function () {
674
600
  script.remove();
675
601
  reject(false);
676
602
  });
677
-
678
603
  if (container) {
679
604
  container.appendChild(script);
680
605
  } else {
@@ -682,20 +607,16 @@ var PaystackPop = (function () {
682
607
  }
683
608
  });
684
609
  };
685
-
686
610
  var applePayButtonComponentIsAvailable = function applePayButtonComponentIsAvailable() {
687
611
  return !!(window && window.customElements && window.customElements.get('apple-pay-button'));
688
612
  };
689
-
690
613
  var ensureApplePaySdkLoaded = function ensureApplePaySdkLoaded(container) {
691
614
  if (applePayButtonComponentIsAvailable()) {
692
615
  return Promise.resolve(true);
693
616
  }
694
-
695
617
  if (applePaySdkPromise) {
696
618
  return applePaySdkPromise;
697
619
  }
698
-
699
620
  applePaySdkPromise = loadScript(APPLE_PAY_SDK_SOURCE, {
700
621
  container: container,
701
622
  integrity: APPLE_PAY_SDK_INTEGRITY_HASH
@@ -718,7 +639,6 @@ var PaystackPop = (function () {
718
639
  }
719
640
  function hideLoader(iframe) {
720
641
  var bgWindow = iframe.contentWindow.document;
721
-
722
642
  if (bgWindow) {
723
643
  bgWindow.getElementById('app-loader').style.display = 'none';
724
644
  }
@@ -728,14 +648,11 @@ var PaystackPop = (function () {
728
648
  if (!domElements) {
729
649
  reject('No dom element provided');
730
650
  }
731
-
732
651
  var checkoutIframe = domElements.checkoutIframe,
733
- backgroundIframe = domElements.backgroundIframe;
734
-
652
+ backgroundIframe = domElements.backgroundIframe;
735
653
  if (!checkoutIframe || !backgroundIframe) {
736
654
  reject('No dom element provided');
737
655
  }
738
-
739
656
  checkoutIframe.style.display = '';
740
657
  checkoutIframe.style.visibility = 'visible';
741
658
  backgroundIframe.style.display = '';
@@ -748,14 +665,11 @@ var PaystackPop = (function () {
748
665
  if (!domElements) {
749
666
  reject('No dom element provided');
750
667
  }
751
-
752
668
  var checkoutIframe = domElements.checkoutIframe,
753
- backgroundIframe = domElements.backgroundIframe;
754
-
669
+ backgroundIframe = domElements.backgroundIframe;
755
670
  if (!checkoutIframe || !backgroundIframe) {
756
671
  reject('No dom element provided');
757
672
  }
758
-
759
673
  backgroundIframe.style.opacity = 0;
760
674
  checkoutIframe.style.display = 'none';
761
675
  checkoutIframe.style.visibility = 'hidden';
@@ -769,7 +683,6 @@ var PaystackPop = (function () {
769
683
  }
770
684
  function mountLazyInlineButton(options) {
771
685
  var inlineButton;
772
-
773
686
  if (options.id) {
774
687
  inlineButton = document.getElementById(options.id);
775
688
  inlineButton.setAttribute('data-inline-id', options.id);
@@ -778,34 +691,29 @@ var PaystackPop = (function () {
778
691
  inlineDiv.id = "inline-button-".concat(options.inlineId);
779
692
  inlineDiv.innerHTML = generateInlineButtonHTML(options);
780
693
  options.parent.parentNode.insertBefore(inlineDiv, options.parent.nextSibling);
781
-
782
694
  var _inlineDiv$getElement = inlineDiv.getElementsByTagName('button');
783
-
784
695
  var _inlineDiv$getElement2 = _slicedToArray(_inlineDiv$getElement, 1);
785
-
786
696
  inlineButton = _inlineDiv$getElement2[0];
787
697
  }
788
-
789
698
  return inlineButton;
790
699
  }
791
700
  function animateEmbedCheckoutIn(checkoutIframe) {
792
701
  return new Promise(function (resolve, reject) {
793
702
  if (!checkoutIframe) {
794
703
  reject('No dom element provided');
795
- } // eslint-disable-next-line no-param-reassign
796
-
797
-
798
- checkoutIframe.style.display = ''; // eslint-disable-next-line no-param-reassign
799
-
704
+ }
705
+ // eslint-disable-next-line no-param-reassign
706
+ checkoutIframe.style.display = '';
707
+ // eslint-disable-next-line no-param-reassign
800
708
  checkoutIframe.style.visibility = 'visible';
801
709
  resolve();
802
710
  });
803
711
  }
804
712
  function mountInput(options) {
805
713
  var type = options.type,
806
- value = options.value,
807
- name = options.name,
808
- parent = options.parent;
714
+ value = options.value,
715
+ name = options.name,
716
+ parent = options.parent;
809
717
  var input = document.createElement('input');
810
718
  input.type = type;
811
719
  input.value = value;
@@ -814,17 +722,15 @@ var PaystackPop = (function () {
814
722
  }
815
723
  function mountApplePayButton(container, _ref2) {
816
724
  var styles = _ref2.styles,
817
- theme = _ref2.theme;
725
+ theme = _ref2.theme;
818
726
  var style = document.createElement('style');
819
727
  var applePayCSS = generateApplePayCSS(styles);
820
728
  style.type = 'text/css';
821
-
822
729
  if (style.styleSheet) {
823
730
  style.styleSheet.cssText = applePayCSS;
824
731
  } else {
825
732
  style.appendChild(document.createTextNode(applePayCSS));
826
733
  }
827
-
828
734
  container.appendChild(style);
829
735
  var button = document.createElement('apple-pay-button');
830
736
  button.setAttribute('buttonstyle', theme === 'light' ? 'white' : 'black');
@@ -834,17 +740,15 @@ var PaystackPop = (function () {
834
740
  }
835
741
  function mountApplePayFallbackButton(container, _ref3) {
836
742
  var styles = _ref3.styles,
837
- theme = _ref3.theme;
743
+ theme = _ref3.theme;
838
744
  var style = document.createElement('style');
839
745
  var applePayCSS = generateApplePayFallbackCSS(styles);
840
746
  style.type = 'text/css';
841
-
842
747
  if (style.styleSheet) {
843
748
  style.styleSheet.cssText = applePayCSS;
844
749
  } else {
845
750
  style.appendChild(document.createTextNode(applePayCSS));
846
751
  }
847
-
848
752
  container.appendChild(style);
849
753
  var button = document.createElement('button');
850
754
  button.classList.add('apple-pay-button', theme === 'light' ? 'apple-pay-button-white' : 'apple-pay-button-black');
@@ -859,21 +763,18 @@ var PaystackPop = (function () {
859
763
  }
860
764
  function mountPaymentRequestButtons(container, _ref4) {
861
765
  var _ref4$channels = _ref4.channels,
862
- channels = _ref4$channels === void 0 ? [] : _ref4$channels,
863
- _ref4$styles = _ref4.styles,
864
- styles = _ref4$styles === void 0 ? {} : _ref4$styles;
766
+ channels = _ref4$channels === void 0 ? [] : _ref4$channels,
767
+ _ref4$styles = _ref4.styles,
768
+ styles = _ref4$styles === void 0 ? {} : _ref4$styles;
865
769
  var mountedElements = {
866
770
  applePay: false
867
771
  };
868
-
869
772
  if (!container) {
870
773
  return Promise.reject(new Error('Container to mount elements was not provided'));
871
774
  }
872
-
873
775
  if (!channels.includes('apple_pay')) {
874
776
  return Promise.reject(new Error('No wallet payment method is available on this device'));
875
777
  }
876
-
877
778
  return ensureApplePaySdkLoaded(container).catch(function () {
878
779
  // Safari can still render the fallback button using the native ApplePaySession.
879
780
  return null;
@@ -883,12 +784,10 @@ var PaystackPop = (function () {
883
784
  if (!applePayAvailable) {
884
785
  throw new Error('No wallet payment method is available on this device');
885
786
  }
886
-
887
787
  if (getApplePayButton(container)) {
888
788
  mountedElements.applePay = true;
889
789
  return mountedElements;
890
790
  }
891
-
892
791
  try {
893
792
  mountApplePayButton(container, {
894
793
  styles: parseApplePayCustomStyles(styles.applePay),
@@ -901,7 +800,6 @@ var PaystackPop = (function () {
901
800
  theme: styles.theme
902
801
  });
903
802
  }
904
-
905
803
  mountedElements.applePay = true;
906
804
  return mountedElements;
907
805
  });
@@ -916,7 +814,6 @@ var PaystackPop = (function () {
916
814
  PAYSTACK_POP_BUTTON: 'paystackpop-button',
917
815
  PAY_WITH_VAULT_BUTTON: 'pay-with-vault-button'
918
816
  };
919
-
920
817
  function createOpenPaystackPopButton(buttonText) {
921
818
  var openPaystackPopButton = document.createElement('button');
922
819
  openPaystackPopButton.id = preCheckoutModalButtonId.PAYSTACK_POP_BUTTON;
@@ -924,17 +821,14 @@ var PaystackPop = (function () {
924
821
  openPaystackPopButton.innerText = buttonText;
925
822
  return openPaystackPopButton;
926
823
  }
927
-
928
824
  function getPreCheckoutModalOpenPaystackPopButton(modal) {
929
825
  return modal.querySelector("#".concat(preCheckoutModalButtonId.PAYSTACK_POP_BUTTON));
930
826
  }
931
-
932
827
  function createPaymentRequestContainer() {
933
828
  var paymentRequestContainer = document.createElement('div');
934
829
  paymentRequestContainer.id = preCheckoutModalButtonId.PAYMENT_REQUEST_BUTTON;
935
830
  return paymentRequestContainer;
936
831
  }
937
-
938
832
  function getPreCheckoutModalPaymentRequestContainer(modal) {
939
833
  return modal.querySelector("#".concat(preCheckoutModalButtonId.PAYMENT_REQUEST_BUTTON));
940
834
  }
@@ -942,7 +836,6 @@ var PaystackPop = (function () {
942
836
  var paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(modal);
943
837
  paymentRequestContainer.remove();
944
838
  }
945
-
946
839
  function createPayWithVaultButton() {
947
840
  var payWithVaultButton = document.createElement('button');
948
841
  payWithVaultButton.className = 'pay-with-vault-button';
@@ -950,11 +843,9 @@ var PaystackPop = (function () {
950
843
  payWithVaultButton.innerText = 'Pay with Vault';
951
844
  return payWithVaultButton;
952
845
  }
953
-
954
846
  function getPreCheckoutModalPayWithVaultButton(modal) {
955
847
  return modal.querySelector("#".concat(preCheckoutModalButtonId.PAY_WITH_VAULT_BUTTON));
956
848
  }
957
-
958
849
  function vaultPreCheckoutModalView(container) {
959
850
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
960
851
  var logoContainer = document.createElement('div');
@@ -972,18 +863,15 @@ var PaystackPop = (function () {
972
863
  divider.className = 'vault-divider';
973
864
  divider.innerHTML = '<div id="vault-divider" class="vault-divider__container"><div class="vault-divider__line"></div></div><div class="vault-divider__text-container"><span class="vault-divider__text">or</span></div>';
974
865
  container.appendChild(divider);
975
-
976
866
  if (options.canPayWithApplePay) {
977
867
  var paymentRequestContainer = createPaymentRequestContainer();
978
868
  container.appendChild(paymentRequestContainer);
979
869
  }
980
-
981
870
  if (options.hasOtherPaymentMethods) {
982
871
  var openPaystackPopButton = createOpenPaystackPopButton('Use other payment methods');
983
872
  container.appendChild(openPaystackPopButton);
984
873
  }
985
874
  }
986
-
987
875
  function defaultPreCheckoutModalView(container, _ref5) {
988
876
  var hasOtherPaymentMethods = _ref5.hasOtherPaymentMethods;
989
877
  var applePayIcon = document.createElement('div');
@@ -995,31 +883,25 @@ var PaystackPop = (function () {
995
883
  container.appendChild(instruction);
996
884
  var paymentRequestContainer = createPaymentRequestContainer();
997
885
  container.appendChild(paymentRequestContainer);
998
-
999
886
  if (hasOtherPaymentMethods) {
1000
887
  var openPaystackPopButton = createOpenPaystackPopButton('More payment options');
1001
888
  container.appendChild(openPaystackPopButton);
1002
889
  }
1003
890
  }
1004
-
1005
891
  function hasNonPrecheckoutPaymentMethods(channels) {
1006
892
  return channels.some(function (channel) {
1007
893
  return channel !== 'apple_pay';
1008
894
  });
1009
895
  }
1010
-
1011
896
  function mountPreCheckoutModal(id, transaction) {
1012
897
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1013
898
  var mountedModal = document.querySelector("#pre-checkout-modal-".concat(id));
1014
-
1015
899
  if (mountedModal) {
1016
900
  if (getPreCheckoutModalOpenPaystackPopButton(mountedModal) && getPreCheckoutModalPaymentRequestContainer(mountedModal)) {
1017
901
  return mountedModal;
1018
902
  }
1019
-
1020
903
  mountedModal.remove();
1021
904
  }
1022
-
1023
905
  var modal = document.createElement('div');
1024
906
  modal.classList.add('pre-checkout-modal');
1025
907
  modal.id = "pre-checkout-modal-".concat(id);
@@ -1027,16 +909,14 @@ var PaystackPop = (function () {
1027
909
  var content = document.createElement('div');
1028
910
  content.classList.add('pre-checkout-modal__content');
1029
911
  modal.appendChild(content);
1030
-
1031
912
  var _ref6 = transaction || {},
1032
- merchantLogo = _ref6.merchant_logo,
1033
- merchantName = _ref6.merchant_name,
1034
- email = _ref6.email,
1035
- amount = _ref6.amount,
1036
- currency = _ref6.currency,
1037
- label = _ref6.label,
1038
- channels = _ref6.channels;
1039
-
913
+ merchantLogo = _ref6.merchant_logo,
914
+ merchantName = _ref6.merchant_name,
915
+ email = _ref6.email,
916
+ amount = _ref6.amount,
917
+ currency = _ref6.currency,
918
+ label = _ref6.label,
919
+ channels = _ref6.channels;
1040
920
  var formattedAmount = new Intl.NumberFormat('en', {
1041
921
  style: 'currency',
1042
922
  currency: currency,
@@ -1051,7 +931,6 @@ var PaystackPop = (function () {
1051
931
  content.innerHTML += closeButton;
1052
932
  var wrapper = document.createElement('div');
1053
933
  wrapper.classList.add('modal-wrapper');
1054
-
1055
934
  if (options.canPayWithVault) {
1056
935
  vaultPreCheckoutModalView(wrapper, {
1057
936
  canPayWithApplePay: options.canPayWithApplePay,
@@ -1062,13 +941,38 @@ var PaystackPop = (function () {
1062
941
  hasOtherPaymentMethods: hasNonPrecheckoutPaymentMethods(channels)
1063
942
  });
1064
943
  }
1065
-
1066
944
  wrapper.innerHTML = wrapper.innerHTML + secureByPaystackWhite + secureByPaystackGrey;
1067
945
  content.appendChild(wrapper);
1068
946
  var style = document.createElement('style');
1069
947
  style.textContent = preCheckoutModalCSS;
1070
- document.body.appendChild(style);
1071
- document.body.appendChild(modal);
948
+
949
+ // === TEMP (test): render the precheckout modal inside an iframe for ONE merchant — revert before commit ===
950
+ // Only the merchant whose request_inline response carries this merchant_id gets the iframe
951
+ // treatment; every other merchant keeps the original behaviour (modal appended to document.body).
952
+ var IFRAME_MODAL_MERCHANT_ID = 550652; // target merchant_id from the request inline response
953
+ var renderInIframe = transaction && String(transaction.merchant_id) === String(IFRAME_MODAL_MERCHANT_ID);
954
+ if (renderInIframe) {
955
+ // Host the modal + style in a full-viewport, same-origin (about:blank) iframe.
956
+ var hostIframe = document.createElement('iframe');
957
+ hostIframe.id = "pre-checkout-modal-iframe-".concat(id);
958
+ hostIframe.setAttribute('allow', 'payment');
959
+ hostIframe.style.cssText = ['position: fixed', 'top: 0', 'left: 0', 'width: 100%', 'height: 100%', 'border: 0', 'margin: 0', 'background: transparent', "z-index: ".concat(findHighestZIndex() + 1)].join(';');
960
+ document.body.appendChild(hostIframe);
961
+ var frameDocument = hostIframe.contentDocument || hostIframe.contentWindow.document;
962
+ frameDocument.body.style.margin = '0';
963
+ frameDocument.head.appendChild(style);
964
+ frameDocument.body.appendChild(modal);
965
+
966
+ // closePreCheckoutModal() calls modal.remove(); make that tear down the host iframe too.
967
+ modal.remove = function () {
968
+ return hostIframe.remove();
969
+ };
970
+ } else {
971
+ document.body.appendChild(style);
972
+ document.body.appendChild(modal);
973
+ }
974
+ // === END TEMP ===
975
+
1072
976
  return modal;
1073
977
  }
1074
978
  function getPreCheckoutModalCloseButton(modal) {
@@ -1099,7 +1003,6 @@ var PaystackPop = (function () {
1099
1003
  if (!modal) {
1100
1004
  return;
1101
1005
  }
1102
-
1103
1006
  var appleIcon = modal.querySelector('#apple-pay-mark--light');
1104
1007
  appleIcon.innerHTML = errorIcon;
1105
1008
  var applePayDescription = modal.querySelector('#apple-pay-description');
@@ -1336,33 +1239,32 @@ var PaystackPop = (function () {
1336
1239
  this.message = message;
1337
1240
  this.issues = issues || [];
1338
1241
  }
1339
-
1340
1242
  if (!args || _typeof(args) !== 'object') {
1341
1243
  throw new ValidationError('Transaction parameters should be a non-empty object');
1342
1244
  }
1245
+ var transactionParameters = args;
1343
1246
 
1344
- var transactionParameters = args; // If it's a transaction resumption, move on
1345
-
1247
+ // If it's a transaction resumption, move on
1346
1248
  if ('accessCode' in transactionParameters) {
1347
1249
  var accessCode = transactionParameters.accessCode;
1348
1250
  return {
1349
1251
  accessCode: accessCode
1350
1252
  };
1351
- } // Filter unneeded parameters
1352
-
1253
+ }
1353
1254
 
1255
+ // Filter unneeded parameters
1354
1256
  Object.keys(transactionParameters).forEach(function (key) {
1355
1257
  var usedParameter = allParameters.find(function (parameter) {
1356
1258
  return parameter.value === key;
1357
1259
  }) !== undefined;
1358
-
1359
1260
  if (!usedParameter) {
1360
1261
  delete transactionParameters[key];
1361
1262
  }
1362
1263
  });
1363
1264
  var transactionKeys = Object.keys(transactionParameters);
1364
- var validationErrors = []; // Check for required parameters
1265
+ var validationErrors = [];
1365
1266
 
1267
+ // Check for required parameters
1366
1268
  var requiredParameters = allParameters.filter(function (param) {
1367
1269
  return param.required;
1368
1270
  });
@@ -1371,50 +1273,44 @@ var PaystackPop = (function () {
1371
1273
  var parameterHasAlternative = key.or ? key.or.some(function (option) {
1372
1274
  return transactionParameters[option];
1373
1275
  }) : null;
1374
-
1375
1276
  if (parameterIsMissing && !parameterHasAlternative) {
1376
1277
  validationErrors.push({
1377
1278
  message: "Required parameter missing: ".concat(key.value)
1378
1279
  });
1379
1280
  }
1380
- }); // Check for validity
1281
+ });
1381
1282
 
1283
+ // Check for validity
1382
1284
  transactionKeys.forEach(function (key) {
1383
1285
  var parameterValue = transactionParameters[key];
1384
1286
  var parameterObject = allParameters.find(function (parameter) {
1385
1287
  return parameter.value === key;
1386
1288
  });
1387
-
1388
1289
  var providedType = _typeof(parameterValue);
1389
-
1390
1290
  if (providedType === 'object' && Array.isArray(parameterValue)) {
1391
1291
  providedType = 'array';
1392
1292
  }
1393
-
1394
1293
  var invalidType = parameterObject.types.indexOf(providedType) <= -1;
1395
-
1396
1294
  if (invalidType) {
1397
1295
  validationErrors.push({
1398
1296
  message: "Invalid parameter type: ".concat(key),
1399
1297
  validTypes: parameterObject.types
1400
1298
  });
1401
1299
  }
1402
- }); // Override keys where necessary
1300
+ });
1403
1301
 
1302
+ // Override keys where necessary
1404
1303
  transactionKeys.forEach(function (key) {
1405
1304
  var parameterObject = allParameters.find(function (parameter) {
1406
1305
  return parameter.value === key;
1407
1306
  });
1408
-
1409
1307
  if (parameterObject.override) {
1410
1308
  delete transactionParameters[parameterObject.override];
1411
1309
  }
1412
1310
  });
1413
-
1414
1311
  if (validationErrors.length) {
1415
1312
  throw new ValidationError('Invalid transaction parameters', validationErrors);
1416
1313
  }
1417
-
1418
1314
  return transactionParameters;
1419
1315
  }
1420
1316
 
@@ -1423,31 +1319,26 @@ var PaystackPop = (function () {
1423
1319
  if ((url === null || url === void 0 ? void 0 : url.length) > 500) {
1424
1320
  return url.split('?')[0];
1425
1321
  }
1426
-
1427
1322
  return url;
1428
1323
  }
1429
-
1430
1324
  function getReferrer() {
1431
1325
  var _window$location = window.location,
1432
- _window$location$href = _window$location.href,
1433
- href = _window$location$href === void 0 ? '' : _window$location$href,
1434
- _window$location$ance = _window$location.ancestorOrigins,
1435
- ancestorOrigins = _window$location$ance === void 0 ? [] : _window$location$ance;
1326
+ _window$location$href = _window$location.href,
1327
+ href = _window$location$href === void 0 ? '' : _window$location$href,
1328
+ _window$location$ance = _window$location.ancestorOrigins,
1329
+ ancestorOrigins = _window$location$ance === void 0 ? [] : _window$location$ance;
1436
1330
  return [href].concat(_toConsumableArray(ancestorOrigins)).map(splitURL).join(',');
1437
1331
  }
1438
1332
 
1439
1333
  function buildQuery(parameters) {
1440
1334
  var formattedParameters = _objectSpread2({}, parameters);
1441
-
1442
1335
  formattedParameters.metadata = parameters.metadata || {};
1443
1336
  formattedParameters.metadata.referrer = getReferrer();
1444
1337
  formattedParameters.metadata = JSON.stringify(formattedParameters.metadata);
1445
1338
  formattedParameters.mode = 'popup';
1446
-
1447
1339
  if (parameters.split && typeof parameters.split !== 'string') {
1448
1340
  formattedParameters.split = JSON.stringify(formattedParameters.split);
1449
1341
  }
1450
-
1451
1342
  var parametersToChange = [{
1452
1343
  to: 'firstname',
1453
1344
  from: 'firstName'
@@ -1484,21 +1375,20 @@ var PaystackPop = (function () {
1484
1375
  }, {
1485
1376
  to: 'ref',
1486
1377
  from: 'reference'
1487
- }]; // handle very old case of people disabling channels by sending card/bank params
1378
+ }];
1379
+
1380
+ // handle very old case of people disabling channels by sending card/bank params
1488
1381
 
1489
1382
  if (formattedParameters.card !== undefined && ['false', false].indexOf(formattedParameters.card) > -1) {
1490
1383
  formattedParameters.channels = ['bank'];
1491
1384
  delete formattedParameters.card;
1492
1385
  }
1493
-
1494
1386
  if (formattedParameters.bank !== undefined && ['false', false].indexOf(formattedParameters.bank) > -1) {
1495
1387
  formattedParameters.channels = ['card'];
1496
1388
  delete formattedParameters.bank;
1497
1389
  }
1498
-
1499
1390
  parametersToChange.forEach(function (key) {
1500
1391
  var hasValue = formattedParameters[key.from];
1501
-
1502
1392
  if (hasValue) {
1503
1393
  formattedParameters[key.to] = formattedParameters[key.from];
1504
1394
  delete formattedParameters[key.from];
@@ -1514,22 +1404,23 @@ var PaystackPop = (function () {
1514
1404
  }
1515
1405
 
1516
1406
  /* eslint-env browser */
1407
+
1517
1408
  var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
1409
+
1518
1410
  /**
1519
1411
  * navigator.platform is deprecated and will eventually be removed
1520
1412
  * but the recommended alternative `navigator.userAgentData` has limited browser support
1521
1413
  * so it is used as a fallback here.
1522
1414
  */
1523
-
1524
1415
  var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
1525
1416
  var isIOS = function isIOS() {
1526
1417
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1527
- platform = _ref.platform,
1528
- _ref$userAgent = _ref.userAgent,
1529
- userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1530
-
1418
+ platform = _ref.platform,
1419
+ _ref$userAgent = _ref.userAgent,
1420
+ userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1531
1421
  var devicePlatform = platform || DEVICE_PLATFORM;
1532
- return iOSDevices.includes(devicePlatform) || // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1422
+ return iOSDevices.includes(devicePlatform) ||
1423
+ // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1533
1424
  userAgent.includes('Mac') && 'ontouchend' in document;
1534
1425
  };
1535
1426
 
@@ -1563,11 +1454,10 @@ var PaystackPop = (function () {
1563
1454
  var AnalyticsFunctions = {
1564
1455
  initializeLog: function initializeLog(log) {
1565
1456
  var _ref = log || {},
1566
- attempts = _ref.attempts,
1567
- authentication = _ref.authentication,
1568
- errors = _ref.errors,
1569
- history = _ref.history;
1570
-
1457
+ attempts = _ref.attempts,
1458
+ authentication = _ref.authentication,
1459
+ errors = _ref.errors,
1460
+ history = _ref.history;
1571
1461
  this.log = {
1572
1462
  start_time: Math.round(Date.now() / 1000),
1573
1463
  time_spent: 0,
@@ -1589,10 +1479,8 @@ var PaystackPop = (function () {
1589
1479
  switch (response.status) {
1590
1480
  case 'success':
1591
1481
  return this.logApiSuccess(channel);
1592
-
1593
1482
  case 'failed':
1594
1483
  return this.logApiError(response.message);
1595
-
1596
1484
  default:
1597
1485
  return false;
1598
1486
  }
@@ -1607,11 +1495,9 @@ var PaystackPop = (function () {
1607
1495
  },
1608
1496
  logAttempt: function logAttempt(channel) {
1609
1497
  var message = 'Attempted to pay';
1610
-
1611
1498
  if (channel) {
1612
1499
  message += " with ".concat(channel);
1613
1500
  }
1614
-
1615
1501
  this.log.attempts += 1;
1616
1502
  this.log.history.push({
1617
1503
  type: 'action',
@@ -1622,11 +1508,9 @@ var PaystackPop = (function () {
1622
1508
  },
1623
1509
  logApiError: function logApiError(error) {
1624
1510
  var message = 'Error';
1625
-
1626
1511
  if (error) {
1627
1512
  message += ": ".concat(error);
1628
1513
  }
1629
-
1630
1514
  this.log.errors += 1;
1631
1515
  this.log.history.push({
1632
1516
  type: 'error',
@@ -1637,11 +1521,9 @@ var PaystackPop = (function () {
1637
1521
  },
1638
1522
  logApiSuccess: function logApiSuccess(channel) {
1639
1523
  var message = 'Successfully paid';
1640
-
1641
1524
  if (channel) {
1642
1525
  message += " with ".concat(channel);
1643
1526
  }
1644
-
1645
1527
  this.log.success = true;
1646
1528
  this.log.history.push({
1647
1529
  type: 'success',
@@ -1655,9 +1537,9 @@ var PaystackPop = (function () {
1655
1537
  if (this.response) {
1656
1538
  return AnalyticsAPI.saveLog(this.id, this.response.merchant_key, this.log);
1657
1539
  }
1658
- } catch (error) {// we don't need to do anything since this should not affect the transaction
1540
+ } catch (error) {
1541
+ // we don't need to do anything since this should not affect the transaction
1659
1542
  }
1660
-
1661
1543
  return undefined;
1662
1544
  },
1663
1545
  saveIpAddress: function saveIpAddress() {
@@ -1665,9 +1547,9 @@ var PaystackPop = (function () {
1665
1547
  if (this.response) {
1666
1548
  return AnalyticsAPI.saveIp(this.id, this.response.merchant_key);
1667
1549
  }
1668
- } catch (error) {// we don't need to do anything since this should not affect the transaction
1550
+ } catch (error) {
1551
+ // we don't need to do anything since this should not affect the transaction
1669
1552
  }
1670
-
1671
1553
  return undefined;
1672
1554
  }
1673
1555
  };
@@ -1676,20 +1558,16 @@ var PaystackPop = (function () {
1676
1558
  var TransactionApi = {
1677
1559
  requestInline: function requestInline() {
1678
1560
  var inlineTransactionInstance = this;
1679
-
1680
1561
  var _this$urlParameters = this.urlParameters,
1681
- language = _this$urlParameters.language,
1682
- connectAccount = _this$urlParameters.connect_account,
1683
- params = _objectWithoutProperties(_this$urlParameters, _excluded$1);
1684
-
1562
+ language = _this$urlParameters.language,
1563
+ connectAccount = _this$urlParameters.connect_account,
1564
+ params = _objectWithoutProperties(_this$urlParameters, _excluded$1);
1685
1565
  var request;
1686
-
1687
1566
  var headers = _objectSpread2({
1688
1567
  'Content-Type': 'application/json'
1689
1568
  }, language && {
1690
1569
  'Accept-Language': language
1691
1570
  });
1692
-
1693
1571
  if (this.accessCode) {
1694
1572
  request = fetch(new URL("transaction/verify_access_code/".concat(this.accessCode), config.paystackApiUrl).toString(), {
1695
1573
  headers: headers
@@ -1703,19 +1581,18 @@ var PaystackPop = (function () {
1703
1581
  })
1704
1582
  });
1705
1583
  }
1706
-
1707
1584
  return request.then(function (res) {
1708
1585
  return res.json();
1709
1586
  }).then(function (res) {
1710
1587
  if (res.status === false) {
1711
1588
  throw new Error(res.message);
1712
1589
  }
1713
-
1714
1590
  inlineTransactionInstance.response = res.data;
1715
1591
  inlineTransactionInstance.id = res.data.id;
1716
1592
  inlineTransactionInstance.status = res.data.transaction_status;
1717
- inlineTransactionInstance.accessCode = res.data.access_code; // Analytics
1593
+ inlineTransactionInstance.accessCode = res.data.access_code;
1718
1594
 
1595
+ // Analytics
1719
1596
  inlineTransactionInstance.log = null;
1720
1597
  Object.assign(inlineTransactionInstance, AnalyticsFunctions);
1721
1598
  inlineTransactionInstance.initializeLog(res.data.log);
@@ -1728,7 +1605,6 @@ var PaystackPop = (function () {
1728
1605
  var InlineTransaction = /*#__PURE__*/function () {
1729
1606
  function InlineTransaction(data) {
1730
1607
  _classCallCheck(this, InlineTransaction);
1731
-
1732
1608
  validate(data);
1733
1609
  this.parameters = data;
1734
1610
  this.urlParameters = buildQuery(data);
@@ -1740,12 +1616,12 @@ var PaystackPop = (function () {
1740
1616
  this.response = null;
1741
1617
  this.isActive = true;
1742
1618
  var onError = data.onError,
1743
- onLoad = data.onLoad,
1744
- onSuccess = data.onSuccess,
1745
- onCancel = data.onCancel,
1746
- callback = data.callback,
1747
- onClose = data.onClose,
1748
- onBankTransferConfirmationPending = data.onBankTransferConfirmationPending;
1619
+ onLoad = data.onLoad,
1620
+ onSuccess = data.onSuccess,
1621
+ onCancel = data.onCancel,
1622
+ callback = data.callback,
1623
+ onClose = data.onClose,
1624
+ onBankTransferConfirmationPending = data.onBankTransferConfirmationPending;
1749
1625
  this.callbacks = {
1750
1626
  onError: onError,
1751
1627
  onLoad: onLoad,
@@ -1759,12 +1635,10 @@ var PaystackPop = (function () {
1759
1635
  };
1760
1636
  Object.assign(this, TransactionApi);
1761
1637
  }
1762
-
1763
- _createClass(InlineTransaction, [{
1638
+ return _createClass(InlineTransaction, [{
1764
1639
  key: "onSetupError",
1765
1640
  value: function onSetupError(response) {
1766
1641
  this.logError(response);
1767
-
1768
1642
  if (this.callbacks.onError) {
1769
1643
  this.callbacks.onError(response);
1770
1644
  }
@@ -1773,15 +1647,14 @@ var PaystackPop = (function () {
1773
1647
  key: "onLoad",
1774
1648
  value: function onLoad(response) {
1775
1649
  var id = response.id,
1776
- customer = response.customer,
1777
- accessCode = response.accessCode;
1650
+ customer = response.customer,
1651
+ accessCode = response.accessCode;
1778
1652
  Object.assign(this, {
1779
1653
  id: id,
1780
1654
  customer: customer,
1781
1655
  accessCode: accessCode
1782
1656
  });
1783
1657
  this.authorizationUrl = "".concat(config.checkoutUrl).concat(accessCode);
1784
-
1785
1658
  if (this.callbacks.onLoad) {
1786
1659
  this.callbacks.onLoad({
1787
1660
  id: id,
@@ -1796,12 +1669,10 @@ var PaystackPop = (function () {
1796
1669
  this.isActive = false;
1797
1670
  this.response = response;
1798
1671
  this.status = response.status;
1799
-
1800
1672
  if (this.callbacks.onSuccess) {
1801
1673
  this.callbacks.onSuccess(response);
1802
- } // Added for backwards compatibility
1803
-
1804
-
1674
+ }
1675
+ // Added for backwards compatibility
1805
1676
  if (this.deprecatedCallbacks.callback) {
1806
1677
  this.deprecatedCallbacks.callback(response);
1807
1678
  }
@@ -1816,9 +1687,8 @@ var PaystackPop = (function () {
1816
1687
  value: function onCancel() {
1817
1688
  if (this.callbacks.onCancel) {
1818
1689
  this.callbacks.onCancel();
1819
- } // Added for backwards compatibility
1820
-
1821
-
1690
+ }
1691
+ // Added for backwards compatibility
1822
1692
  if (this.deprecatedCallbacks.onClose) {
1823
1693
  this.deprecatedCallbacks.onClose();
1824
1694
  }
@@ -1833,7 +1703,6 @@ var PaystackPop = (function () {
1833
1703
  key: "onBankTransferConfirmationPending",
1834
1704
  value: function onBankTransferConfirmationPending() {
1835
1705
  this.cancel();
1836
-
1837
1706
  if (this.callbacks.onBankTransferConfirmationPending) {
1838
1707
  this.callbacks.onBankTransferConfirmationPending();
1839
1708
  }
@@ -1844,13 +1713,10 @@ var PaystackPop = (function () {
1844
1713
  this.errors.push(error);
1845
1714
  }
1846
1715
  }]);
1847
-
1848
- return InlineTransaction;
1849
1716
  }();
1850
1717
 
1851
1718
  var canUseVault = function canUseVault() {
1852
1719
  var _transaction$link_con, _transaction$link_con2;
1853
-
1854
1720
  var transaction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1855
1721
  return !!((_transaction$link_con = transaction.link_config) !== null && _transaction$link_con !== void 0 && _transaction$link_con.enabled && (_transaction$link_con2 = transaction.link_config) !== null && _transaction$link_con2 !== void 0 && _transaction$link_con2.has_payment_instruments);
1856
1722
  };
@@ -1862,14 +1728,12 @@ var PaystackPop = (function () {
1862
1728
  }
1863
1729
 
1864
1730
  var _excluded = ["preload", "inlineTransaction", "transactionData"],
1865
- _excluded2 = ["container", "styles", "onElementsMount"];
1731
+ _excluded2 = ["container", "styles", "onElementsMount"];
1866
1732
  var inlineInstance;
1867
-
1868
1733
  function findResumableTransaction(transactions, parameters) {
1869
1734
  if (!transactions.length) {
1870
1735
  return null;
1871
1736
  }
1872
-
1873
1737
  var similarAbandonedTransactions = transactions.filter(function (transaction) {
1874
1738
  var isAbandoned = !transaction.status || transaction.status === 'abandoned';
1875
1739
  var hasSimilarParameters = similarObjects(transaction.parameters, parameters);
@@ -1878,39 +1742,32 @@ var PaystackPop = (function () {
1878
1742
  var resumableTransaction = similarAbandonedTransactions.length ? similarAbandonedTransactions[similarAbandonedTransactions.length - 1] : null;
1879
1743
  return resumableTransaction;
1880
1744
  }
1881
-
1882
1745
  function notifyIframeToUpdateURL(options) {
1883
1746
  var checkoutIframe = options.checkoutIframe,
1884
- urlParameters = options.urlParameters;
1885
-
1747
+ urlParameters = options.urlParameters;
1886
1748
  if (!checkoutIframe || !urlParameters) {
1887
1749
  return;
1888
1750
  }
1889
-
1890
1751
  checkoutIframe.contentWindow.postMessage({
1891
1752
  type: 'inline:url',
1892
1753
  path: 'newTransaction',
1893
1754
  params: urlParameters
1894
1755
  }, '*');
1895
1756
  }
1896
-
1897
1757
  var analyticsActions = {
1898
1758
  TRACK_CHECKOUT_CLOSED: 'trackCheckoutClosed',
1899
1759
  TRACK_PAYMENT_ERROR: 'trackPaymentError',
1900
1760
  TRACK_PAYMENT_ATTEMPT: 'trackPaymentAttempt',
1901
1761
  TRACK_PAYMENT_COMPLETION: 'trackPaymentCompletion'
1902
1762
  };
1903
-
1904
1763
  function handleError(message) {
1905
1764
  logWarning(message);
1906
1765
  throw new Error(message);
1907
1766
  }
1908
-
1909
1767
  function transactionCanUseApplePay(response, container) {
1910
1768
  if (!(response && response.channels && response.channels.includes('apple_pay'))) {
1911
1769
  return Promise.resolve(false);
1912
1770
  }
1913
-
1914
1771
  return ensureApplePaySdkLoaded(container).catch(function () {
1915
1772
  // Native Apple Pay support can still be available even if the SDK fails to load.
1916
1773
  return null;
@@ -1918,44 +1775,36 @@ var PaystackPop = (function () {
1918
1775
  return canUseApplePay(response.channels);
1919
1776
  });
1920
1777
  }
1921
-
1922
1778
  var Inline = /*#__PURE__*/function () {
1923
1779
  function Inline(params) {
1924
1780
  _classCallCheck(this, Inline);
1925
-
1926
1781
  this.id = randomId();
1927
1782
  this.transactions = [];
1928
1783
  this.isOpen = false;
1929
1784
  this.isLoaded = false;
1930
1785
  this.isDeprecatedApi = params && params.isDeprecatedApi; // track deprecatedApi
1931
-
1932
1786
  if (params && params.isEmbed) {
1933
1787
  this.isEmbed = true;
1934
1788
  } else if (params && params.isPaymentRequest) {
1935
1789
  if (!(params.container && getPaymentRequestContainer(params.container))) {
1936
1790
  handleError('A container is required to mount the payment request button');
1937
1791
  }
1938
-
1939
1792
  this.paymentRequestContainer = getPaymentRequestContainer(params.container);
1940
1793
  this.paymentRequestTransaction = null;
1941
1794
  }
1942
-
1943
1795
  this.preCheckoutModal = null;
1944
1796
  this.backgroundIframe = mountBackgroundIframe(this.id);
1945
1797
  this.checkoutIframe = mountCheckoutIframe(this.id);
1946
1798
  this.registerListeners();
1947
1799
  }
1948
-
1949
- _createClass(Inline, [{
1800
+ return _createClass(Inline, [{
1950
1801
  key: "registerListeners",
1951
1802
  value: function registerListeners() {
1952
1803
  var _this = this;
1953
-
1954
1804
  window.addEventListener('message', function (event) {
1955
1805
  var isCheckoutIframe = "".concat(event.origin, "/") === config.checkoutUrl;
1956
1806
  var isThisInline = _this.checkoutIframe && _this.checkoutIframe.contentWindow === event.source;
1957
1807
  var isEmbed = _this.isEmbed;
1958
-
1959
1808
  if (isCheckoutIframe || isThisInline) {
1960
1809
  _this.respondToEvent(event);
1961
1810
  } else if (isEmbed) {
@@ -1978,7 +1827,6 @@ var PaystackPop = (function () {
1978
1827
  if (this.activeTransaction()) {
1979
1828
  this.activeTransaction().cancel();
1980
1829
  }
1981
-
1982
1830
  inlineInstance = this;
1983
1831
  var resumableTransaction = findResumableTransaction(this.transactions, params);
1984
1832
  var transaction = resumableTransaction || new InlineTransaction(params);
@@ -1992,10 +1840,9 @@ var PaystackPop = (function () {
1992
1840
  });
1993
1841
  }).then(function (_ref) {
1994
1842
  var response = _ref.response,
1995
- canPayWithApplePay = _ref.canPayWithApplePay;
1843
+ canPayWithApplePay = _ref.canPayWithApplePay;
1996
1844
  var canPayWithVault = canUseVault(response);
1997
1845
  var shouldLoadPreCheckoutModal = canPayWithVault || canPayWithApplePay;
1998
-
1999
1846
  if (!shouldLoadPreCheckoutModal) {
2000
1847
  inlineInstance.newTransaction({
2001
1848
  inlineTransaction: transaction,
@@ -2011,11 +1858,11 @@ var PaystackPop = (function () {
2011
1858
  canPayWithVault: canPayWithVault,
2012
1859
  canPayWithApplePay: canPayWithApplePay
2013
1860
  });
1861
+
2014
1862
  /**
2015
1863
  * We attempt to mount the apple pay button only
2016
1864
  * when the customer can pay with apple pay.
2017
1865
  */
2018
-
2019
1866
  if (canPayWithApplePay) {
2020
1867
  inlineInstance.paymentRequestContainer = getPreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
2021
1868
  mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
@@ -2070,15 +1917,12 @@ var PaystackPop = (function () {
2070
1917
  key: "registerPreCheckoutModalEventListeners",
2071
1918
  value: function registerPreCheckoutModalEventListeners() {
2072
1919
  var _this2 = this;
2073
-
2074
1920
  var timer;
2075
1921
  var isShortTouch = false;
2076
1922
  var shortTouchDurationInMs = 125;
2077
1923
  var activeTransaction = this.activeTransaction();
2078
-
2079
1924
  var handleTouchStart = function handleTouchStart(event) {
2080
1925
  event.preventDefault();
2081
-
2082
1926
  if (!isShortTouch) {
2083
1927
  isShortTouch = true;
2084
1928
  timer = setTimeout(function () {
@@ -2086,51 +1930,38 @@ var PaystackPop = (function () {
2086
1930
  }, shortTouchDurationInMs);
2087
1931
  }
2088
1932
  };
2089
-
2090
1933
  var handleClosePreCheckoutModal = function handleClosePreCheckoutModal(event) {
2091
1934
  if (event.target && event.target.isSameNode(inlineInstance.preCheckoutModal) && isShortTouch) {
2092
1935
  clearTimeout(timer);
2093
1936
  inlineInstance.closePreCheckoutModal();
2094
-
2095
1937
  if (activeTransaction) {
2096
1938
  activeTransaction.cancel();
2097
1939
  }
2098
1940
  }
2099
-
2100
1941
  isShortTouch = false;
2101
1942
  };
2102
-
2103
1943
  document.addEventListener('touchstart', handleTouchStart, true);
2104
1944
  document.addEventListener('touchend', handleClosePreCheckoutModal, true);
2105
1945
  var openPaystackPopButton = getPreCheckoutModalOpenPaystackPopButton(this.preCheckoutModal);
2106
-
2107
1946
  if (openPaystackPopButton) {
2108
1947
  openPaystackPopButton.onclick = function () {
2109
1948
  _this2.closePreCheckoutModal();
2110
-
2111
1949
  _this2.animateCheckoutIn();
2112
1950
  };
2113
1951
  }
2114
-
2115
1952
  var payWithVaultButton = getPreCheckoutModalPayWithVaultButton(this.preCheckoutModal);
2116
-
2117
1953
  if (payWithVaultButton) {
2118
1954
  payWithVaultButton.onclick = function () {
2119
1955
  _this2.closePreCheckoutModal();
2120
-
2121
1956
  _this2.animateCheckoutIn();
2122
-
2123
1957
  _this2.checkoutIframe.contentWindow.postMessage({
2124
1958
  type: 'inline:pay-with-vault'
2125
1959
  }, '*');
2126
1960
  };
2127
1961
  }
2128
-
2129
1962
  var preCheckoutModalCloseButton = getPreCheckoutModalCloseButton(this.preCheckoutModal);
2130
-
2131
1963
  preCheckoutModalCloseButton.onclick = function () {
2132
1964
  _this2.sendAnalyticsEventToCheckout(analyticsActions.TRACK_CHECKOUT_CLOSED);
2133
-
2134
1965
  _this2.closePreCheckoutModalAndCancelTransaction();
2135
1966
  };
2136
1967
  }
@@ -2140,7 +1971,6 @@ var PaystackPop = (function () {
2140
1971
  if (!this.preCheckoutModal) {
2141
1972
  return;
2142
1973
  }
2143
-
2144
1974
  if (transactionStatus === 'failed') {
2145
1975
  showErrorInPreCheckoutModal(this.preCheckoutModal);
2146
1976
  animatePreCheckoutModalIn(this.preCheckoutModal);
@@ -2155,11 +1985,9 @@ var PaystackPop = (function () {
2155
1985
  value: function closePreCheckoutModalAndCancelTransaction() {
2156
1986
  if (this.preCheckoutModal) {
2157
1987
  this.cancelTransaction();
2158
-
2159
1988
  if (this.checkoutIframe && this.checkoutIframe.contentWindow) {
2160
1989
  this.checkoutIframe.contentWindow.postMessage('close', '*');
2161
1990
  }
2162
-
2163
1991
  this.closePreCheckoutModal();
2164
1992
  }
2165
1993
  }
@@ -2167,19 +1995,15 @@ var PaystackPop = (function () {
2167
1995
  key: "newTransaction",
2168
1996
  value: function newTransaction(_ref2) {
2169
1997
  var preload = _ref2.preload,
2170
- inlineTransaction = _ref2.inlineTransaction,
2171
- transactionData = _ref2.transactionData,
2172
- options = _objectWithoutProperties(_ref2, _excluded);
2173
-
1998
+ inlineTransaction = _ref2.inlineTransaction,
1999
+ transactionData = _ref2.transactionData,
2000
+ options = _objectWithoutProperties(_ref2, _excluded);
2174
2001
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
2175
-
2176
2002
  if (this.activeTransaction() && !hasPaymentRequestButtons) {
2177
2003
  this.activeTransaction().cancel();
2178
2004
  }
2179
-
2180
2005
  if (inlineTransaction && transactionData) {
2181
2006
  this.transactions.push(inlineTransaction);
2182
-
2183
2007
  if (!this.isDeprecatedApi) {
2184
2008
  // TODO: reintroduce this when we resolve checkout caching issues
2185
2009
  // this.open({ transactionData }, preload);
@@ -2188,15 +2012,11 @@ var PaystackPop = (function () {
2188
2012
  language: inlineTransaction.urlParameters.language
2189
2013
  }, preload);
2190
2014
  }
2191
-
2192
2015
  return inlineTransaction;
2193
2016
  }
2194
-
2195
2017
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2196
-
2197
2018
  if (resumableTransaction) {
2198
2019
  resumableTransaction.isActive = true;
2199
-
2200
2020
  if (!this.isDeprecatedApi) {
2201
2021
  // We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
2202
2022
  this.open({
@@ -2204,58 +2024,47 @@ var PaystackPop = (function () {
2204
2024
  language: resumableTransaction.urlParameters.language
2205
2025
  }, preload);
2206
2026
  }
2207
-
2208
2027
  return resumableTransaction;
2209
2028
  }
2210
-
2211
2029
  var transaction = inlineTransaction || new InlineTransaction(options);
2212
2030
  var params = transaction.accessCode ? {
2213
2031
  accessCode: transaction.accessCode,
2214
2032
  language: transaction.urlParameters.language
2215
2033
  } : transaction.urlParameters;
2216
2034
  this.transactions.push(transaction);
2217
-
2218
2035
  if (!this.isDeprecatedApi) {
2219
2036
  this.open(params, preload);
2220
2037
  }
2221
-
2222
2038
  return transaction;
2223
2039
  }
2224
2040
  }, {
2225
2041
  key: "preloadTransaction",
2226
2042
  value: function preloadTransaction(options) {
2227
2043
  var _this3 = this;
2228
-
2229
2044
  this.newTransaction(_objectSpread2(_objectSpread2({}, options), {}, {
2230
2045
  preload: true
2231
2046
  }));
2232
-
2233
2047
  var loadPopup = function loadPopup() {
2234
2048
  return _this3.animateCheckoutIn();
2235
2049
  };
2236
-
2237
2050
  return loadPopup;
2238
2051
  }
2239
2052
  }, {
2240
2053
  key: "paymentRequest",
2241
2054
  value: function paymentRequest(parameters) {
2242
2055
  var container = parameters.container,
2243
- styles = parameters.styles,
2244
- onElementsMount = parameters.onElementsMount,
2245
- transactionParams = _objectWithoutProperties(parameters, _excluded2);
2246
-
2056
+ styles = parameters.styles,
2057
+ onElementsMount = parameters.onElementsMount,
2058
+ transactionParams = _objectWithoutProperties(parameters, _excluded2);
2247
2059
  inlineInstance = this;
2248
2060
  return new Promise(function (resolve, reject) {
2249
2061
  var loadPaystackCheckoutButton = document.querySelector("#".concat(parameters.loadPaystackCheckoutButton));
2250
-
2251
2062
  if (inlineInstance.activeTransaction()) {
2252
2063
  inlineInstance.activeTransaction().cancel();
2253
2064
  }
2254
-
2255
2065
  if (!(container && getPaymentRequestContainer(container))) {
2256
2066
  handleError('A container is required to mount the payment request button');
2257
2067
  }
2258
-
2259
2068
  inlineInstance.paymentRequestContainer = getPaymentRequestContainer(container);
2260
2069
  var resumableTransaction = findResumableTransaction(inlineInstance.transactions, transactionParams);
2261
2070
  var transaction = resumableTransaction || new InlineTransaction(transactionParams);
@@ -2277,9 +2086,7 @@ var PaystackPop = (function () {
2277
2086
  } else {
2278
2087
  inlineInstance.transactions.push(transaction);
2279
2088
  }
2280
-
2281
2089
  inlineInstance.registerPaymentRequestEventListeners();
2282
-
2283
2090
  if (loadPaystackCheckoutButton) {
2284
2091
  var loadPopup = inlineInstance.preloadTransaction({
2285
2092
  inlineTransaction: transaction,
@@ -2287,7 +2094,6 @@ var PaystackPop = (function () {
2287
2094
  });
2288
2095
  loadPaystackCheckoutButton.onclick = loadPopup;
2289
2096
  }
2290
-
2291
2097
  resolve(transaction);
2292
2098
  });
2293
2099
  }).catch(function (error) {
@@ -2303,9 +2109,7 @@ var PaystackPop = (function () {
2303
2109
  key: "registerApplePayEventListener",
2304
2110
  value: function registerApplePayEventListener() {
2305
2111
  var _this4 = this;
2306
-
2307
2112
  var applePayButton = getApplePayButton(this.paymentRequestContainer);
2308
-
2309
2113
  if (applePayButton) {
2310
2114
  applePayButton.onclick = function () {
2311
2115
  return _this4.startApplePay();
@@ -2317,7 +2121,6 @@ var PaystackPop = (function () {
2317
2121
  value: function registerPaymentRequestEventListeners() {
2318
2122
  var transaction = this.activeTransaction();
2319
2123
  var applePayButton = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
2320
-
2321
2124
  if (transaction && applePayButton) {
2322
2125
  this.registerApplePayEventListener();
2323
2126
  } else if (this.paymentRequestContainer) {
@@ -2328,10 +2131,8 @@ var PaystackPop = (function () {
2328
2131
  key: "startApplePay",
2329
2132
  value: function startApplePay() {
2330
2133
  var _this5 = this;
2331
-
2332
2134
  var paymentMethod = 'apple pay';
2333
2135
  var transaction = this.activeTransaction();
2334
-
2335
2136
  if (transaction) {
2336
2137
  var paymentAttemptAnalyticsPayload = {
2337
2138
  channel: 'apple_pay',
@@ -2346,7 +2147,6 @@ var PaystackPop = (function () {
2346
2147
  timeSpent: transaction.getTimeSpent()
2347
2148
  };
2348
2149
  var pendingPreCheckoutModalStatus = null;
2349
-
2350
2150
  try {
2351
2151
  transaction.logAttempt(paymentMethod);
2352
2152
  this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, paymentAttemptAnalyticsPayload);
@@ -2357,11 +2157,9 @@ var PaystackPop = (function () {
2357
2157
  interval: transaction.response.plan_details && transaction.response.plan_details.interval
2358
2158
  });
2359
2159
  var applePaySession = new window.ApplePaySession(config.applePayVersion, applePayPaymentRequest);
2360
-
2361
2160
  if (inlineInstance.preCheckoutModal) {
2362
2161
  hidePreCheckoutModal(inlineInstance.preCheckoutModal);
2363
2162
  }
2364
-
2365
2163
  applePaySession.onvalidatemerchant = function (_ref3) {
2366
2164
  var validationURL = _ref3.validationURL;
2367
2165
  var validateSession = validateApplePaySession({
@@ -2376,14 +2174,12 @@ var PaystackPop = (function () {
2376
2174
  } else {
2377
2175
  applePaySession.completeMerchantValidation(response.data);
2378
2176
  }
2379
-
2380
2177
  transaction.logValidationResponse(response.message);
2381
2178
  }).catch(function (error) {
2382
2179
  transaction.onSetupError(error);
2383
2180
  pendingPreCheckoutModalStatus = 'failed';
2384
2181
  });
2385
2182
  };
2386
-
2387
2183
  applePaySession.oncancel = function () {
2388
2184
  if (inlineInstance.preCheckoutModal) {
2389
2185
  if (pendingPreCheckoutModalStatus) {
@@ -2396,7 +2192,6 @@ var PaystackPop = (function () {
2396
2192
  transaction.onCancel();
2397
2193
  }
2398
2194
  };
2399
-
2400
2195
  applePaySession.onpaymentauthorized = function (_ref4) {
2401
2196
  var payment = _ref4.payment;
2402
2197
  var charge = chargeApplePay({
@@ -2405,23 +2200,19 @@ var PaystackPop = (function () {
2405
2200
  });
2406
2201
  charge.then(function (response) {
2407
2202
  transaction.logAPIResponse(response, paymentMethod);
2408
-
2409
2203
  if (response.status === 'success') {
2410
2204
  applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
2411
2205
  transaction.onSuccess(response);
2412
-
2413
2206
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, paymentCompleteAnalyticsPayload);
2414
2207
  } else {
2415
2208
  applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2416
2209
  transaction.onSetupError(response);
2417
2210
  pendingPreCheckoutModalStatus = 'failed';
2418
-
2419
2211
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2420
2212
  channel: 'apple_pay',
2421
2213
  message: response && response.message || 'Transaction attempt failed'
2422
2214
  });
2423
2215
  }
2424
-
2425
2216
  if (response.status === 'success') {
2426
2217
  inlineInstance.closePreCheckoutModal(response.status);
2427
2218
  }
@@ -2429,14 +2220,12 @@ var PaystackPop = (function () {
2429
2220
  applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2430
2221
  transaction.onSetupError(error);
2431
2222
  pendingPreCheckoutModalStatus = 'failed';
2432
-
2433
2223
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2434
2224
  channel: 'apple_pay',
2435
2225
  message: error && error.message || 'Error occurred'
2436
2226
  });
2437
2227
  });
2438
2228
  };
2439
-
2440
2229
  applePaySession.begin();
2441
2230
  } catch (error) {
2442
2231
  transaction.onSetupError(error);
@@ -2451,9 +2240,9 @@ var PaystackPop = (function () {
2451
2240
  value: function resumeTransaction(accessCode) {
2452
2241
  var callbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2453
2242
  var onSuccess = callbacks.onSuccess,
2454
- onCancel = callbacks.onCancel,
2455
- onLoad = callbacks.onLoad,
2456
- onError = callbacks.onError;
2243
+ onCancel = callbacks.onCancel,
2244
+ onLoad = callbacks.onLoad,
2245
+ onError = callbacks.onError;
2457
2246
  return this.newTransaction({
2458
2247
  accessCode: accessCode,
2459
2248
  onSuccess: onSuccess,
@@ -2477,7 +2266,6 @@ var PaystackPop = (function () {
2477
2266
  var transaction = this.transactions.find(function (t) {
2478
2267
  return t.id === id;
2479
2268
  }) || this.activeTransaction();
2480
-
2481
2269
  if (transaction) {
2482
2270
  transaction.cancel();
2483
2271
  this.close();
@@ -2489,23 +2277,20 @@ var PaystackPop = (function () {
2489
2277
  if (!event) {
2490
2278
  return;
2491
2279
  }
2492
-
2493
2280
  var activeTransaction = this.activeTransaction();
2494
-
2495
2281
  try {
2496
2282
  var actualEvent = event.data || event.message;
2497
2283
  var eventType = actualEvent.event,
2498
- eventData = actualEvent.data;
2499
-
2284
+ eventData = actualEvent.data;
2500
2285
  if (eventType) {
2501
2286
  switch (eventType) {
2502
2287
  case 'loaded:checkout':
2503
2288
  this.isLoaded = true;
2504
-
2505
2289
  if (activeTransaction) {
2506
2290
  var checkoutIframe = this.checkoutIframe;
2507
2291
  var urlParameters = activeTransaction.urlParameters,
2508
- response = activeTransaction.response; // TODO: reintroduce this when we resolve checkout caching issues
2292
+ response = activeTransaction.response;
2293
+ // TODO: reintroduce this when we resolve checkout caching issues
2509
2294
  // const params = response
2510
2295
  // ? { transactionData: response }
2511
2296
  // : urlParameters;
@@ -2519,77 +2304,60 @@ var PaystackPop = (function () {
2519
2304
  urlParameters: params
2520
2305
  });
2521
2306
  }
2522
-
2523
2307
  break;
2524
-
2525
2308
  case 'loaded:transaction':
2526
2309
  hideLoader(this.backgroundIframe);
2527
-
2528
2310
  if (this.preCheckoutModal) {
2529
2311
  this.openPreCheckoutModal();
2530
2312
  }
2531
-
2532
2313
  activeTransaction.onLoad(eventData);
2533
2314
  break;
2534
-
2535
2315
  case 'error':
2536
2316
  {
2537
2317
  var error = eventData;
2538
-
2539
2318
  if (error.type === 'setup') {
2540
2319
  activeTransaction.onSetupError(eventData);
2541
2320
  } else {
2542
2321
  activeTransaction.logError(eventData);
2543
2322
  }
2544
-
2545
2323
  break;
2546
2324
  }
2547
-
2548
2325
  case 'cancel':
2549
2326
  case 'close':
2550
2327
  {
2551
2328
  this.close();
2552
2329
  var status = eventData && eventData.status;
2553
-
2554
2330
  if (status) {
2555
2331
  activeTransaction.setStatus(status);
2556
2332
  }
2557
-
2558
2333
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
2559
2334
  var shouldSetCurrentTransactionAsInactive = !(hasPaymentRequestButtons && !this.preCheckoutModal);
2560
-
2561
2335
  if (shouldSetCurrentTransactionAsInactive) {
2562
2336
  activeTransaction.isActive = false;
2563
2337
  }
2564
-
2565
2338
  activeTransaction.onCancel();
2566
2339
  break;
2567
2340
  }
2568
-
2569
2341
  case 'transfer:pending':
2570
2342
  {
2571
2343
  this.close();
2572
-
2573
2344
  var _status = eventData && eventData.status;
2574
-
2575
2345
  if (_status) {
2576
2346
  activeTransaction.setStatus(_status);
2577
2347
  }
2578
-
2579
2348
  activeTransaction.onBankTransferConfirmationPending();
2580
2349
  break;
2581
2350
  }
2582
-
2583
2351
  case 'success':
2584
2352
  this.close();
2585
2353
  activeTransaction.onSuccess(eventData);
2586
2354
  break;
2587
-
2588
2355
  default:
2589
2356
  break;
2590
2357
  }
2591
2358
  }
2592
- } catch (error) {// do nothing
2359
+ } catch (error) {
2360
+ // do nothing
2593
2361
  }
2594
2362
  }
2595
2363
  }, {
@@ -2597,19 +2365,15 @@ var PaystackPop = (function () {
2597
2365
  value: function respondToEmbedEvents(event) {
2598
2366
  var activeTransaction = this.activeTransaction();
2599
2367
  var eventData = event.data || event.message;
2600
-
2601
2368
  if (eventData && (typeof eventData === 'string' || eventData instanceof String)) {
2602
2369
  var response = parseResponse(eventData);
2603
2370
  var oldCheckoutCloseResponse = response && response.action === 'PaystackClose';
2604
-
2605
2371
  if (oldCheckoutCloseResponse) {
2606
2372
  var chargeResponse = response.data;
2607
-
2608
2373
  if (chargeResponse) {
2609
2374
  activeTransaction.onSuccess(eventData);
2610
2375
  }
2611
2376
  }
2612
-
2613
2377
  if (response.action === 'PaystackTLSClose') {
2614
2378
  activeTransaction.cancel();
2615
2379
  }
@@ -2619,18 +2383,15 @@ var PaystackPop = (function () {
2619
2383
  key: "animateCheckoutIn",
2620
2384
  value: function animateCheckoutIn$1() {
2621
2385
  var _this6 = this;
2622
-
2623
2386
  if (!this.isOpen) {
2624
2387
  var checkoutIframe = this.checkoutIframe,
2625
- backgroundIframe = this.backgroundIframe;
2626
-
2388
+ backgroundIframe = this.backgroundIframe;
2627
2389
  animateCheckoutIn({
2628
2390
  checkoutIframe: checkoutIframe,
2629
2391
  backgroundIframe: backgroundIframe
2630
2392
  }).then(function () {
2631
2393
  _this6.checkoutIframe.contentWindow.postMessage('render', '*');
2632
2394
  });
2633
-
2634
2395
  this.isOpen = true;
2635
2396
  }
2636
2397
  }
@@ -2640,13 +2401,11 @@ var PaystackPop = (function () {
2640
2401
  if (!urlParameters) {
2641
2402
  return;
2642
2403
  }
2643
-
2644
2404
  var checkoutIframe = this.checkoutIframe;
2645
2405
  notifyIframeToUpdateURL({
2646
2406
  checkoutIframe: checkoutIframe,
2647
2407
  urlParameters: urlParameters
2648
2408
  });
2649
-
2650
2409
  if (!preload) {
2651
2410
  this.animateCheckoutIn();
2652
2411
  }
@@ -2655,13 +2414,11 @@ var PaystackPop = (function () {
2655
2414
  key: "close",
2656
2415
  value: function close() {
2657
2416
  var _this7 = this;
2658
-
2659
2417
  if (!this.isOpen) {
2660
2418
  return;
2661
2419
  }
2662
-
2663
2420
  var checkoutIframe = this.checkoutIframe,
2664
- backgroundIframe = this.backgroundIframe;
2421
+ backgroundIframe = this.backgroundIframe;
2665
2422
  animateCheckoutOut({
2666
2423
  checkoutIframe: checkoutIframe,
2667
2424
  backgroundIframe: backgroundIframe
@@ -2680,23 +2437,19 @@ var PaystackPop = (function () {
2680
2437
  value: function setup(parameters) {
2681
2438
  var isDeprecatedApi = true;
2682
2439
  var isEmbed = parameters && parameters.container;
2683
-
2684
2440
  if (!inlineInstance) {
2685
2441
  inlineInstance = new Inline({
2686
2442
  isDeprecatedApi: isDeprecatedApi,
2687
2443
  isEmbed: isEmbed
2688
2444
  });
2689
2445
  }
2690
-
2691
2446
  printDeprecationNotice('PaystackPop.setup()', 'new PaystackPop()', 'Please consult our documentation at https://developers.paystack.co/docs/paystack-inline');
2692
2447
  var transaction = inlineInstance.newTransaction(parameters, 'deprecated');
2693
2448
  var urlParameters = transaction.urlParameters;
2694
-
2695
2449
  if (isEmbed) {
2696
2450
  var inlineUrl = "".concat(config.siteUrl, "/assets/payment/production/inline.html?").concat(serialize(urlParameters));
2697
2451
  var iframe = mountEmbedCheckoutIframe(inlineInstance.id, inlineUrl);
2698
2452
  appendIframeToContainer(parameters.container, iframe);
2699
-
2700
2453
  iframe.onload = function onLoad() {
2701
2454
  iframe.contentWindow.postMessage("PaystackOpen ".concat(inlineInstance.id), '*');
2702
2455
  animateEmbedCheckoutIn(iframe);
@@ -2708,22 +2461,16 @@ var PaystackPop = (function () {
2708
2461
  inlineInstance.open(urlParameters);
2709
2462
  };
2710
2463
  }
2711
-
2712
2464
  return transaction;
2713
2465
  }
2714
2466
  }]);
2715
-
2716
- return Inline;
2717
2467
  }();
2718
-
2719
2468
  if (scriptCanUseDataAttributes()) {
2720
2469
  var parameters = getDataAttributesAsParameters();
2721
2470
  var parentForm = getSourceScript().parentElement;
2722
-
2723
2471
  if (!inlineInstance) {
2724
2472
  inlineInstance = new Inline();
2725
2473
  }
2726
-
2727
2474
  var transaction;
2728
2475
  var inlineButton = mountLazyInlineButton({
2729
2476
  inlineId: inlineInstance.id,
@@ -2737,7 +2484,6 @@ var PaystackPop = (function () {
2737
2484
  });
2738
2485
  inlineButton.addEventListener('click', function (e) {
2739
2486
  e.preventDefault();
2740
-
2741
2487
  if (!transaction) {
2742
2488
  transaction = inlineInstance.newTransaction(_objectSpread2(_objectSpread2({}, parameters), {}, {
2743
2489
  onSuccess: function onSuccess(response) {