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

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