@paystack/inline-js 2.20.0-dev.5 → 2.20.1-dev.1

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
@@ -805,7 +805,7 @@ var PaystackPop = (function () {
805
805
  });
806
806
  }
807
807
  function removeAllChildNodes(parent) {
808
- while (parent !== null && parent !== void 0 && parent.firstChild) {
808
+ while (parent.firstChild) {
809
809
  parent.removeChild(parent.firstChild);
810
810
  }
811
811
  }
@@ -2040,30 +2040,31 @@ var PaystackPop = (function () {
2040
2040
  this.activeTransaction().cancel();
2041
2041
  }
2042
2042
 
2043
- var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2044
-
2045
- if (resumableTransaction) {
2046
- resumableTransaction.isActive = true;
2043
+ if (inlineTransaction && transactionData) {
2044
+ this.transactions.push(inlineTransaction);
2047
2045
 
2048
2046
  if (!this.isDeprecatedApi) {
2049
2047
  this.open({
2050
- accessCode: resumableTransaction.accessCode
2048
+ transactionData: transactionData
2051
2049
  }, preload);
2052
2050
  }
2053
2051
 
2054
- return resumableTransaction;
2052
+ return inlineTransaction;
2055
2053
  }
2056
2054
 
2057
- if (inlineTransaction && transactionData) {
2058
- this.transactions.push(inlineTransaction);
2055
+ var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2056
+
2057
+ if (resumableTransaction) {
2058
+ resumableTransaction.isActive = true;
2059
2059
 
2060
2060
  if (!this.isDeprecatedApi) {
2061
+ // We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
2061
2062
  this.open({
2062
- transactionData: transactionData
2063
+ accessCode: resumableTransaction.accessCode
2063
2064
  }, preload);
2064
2065
  }
2065
2066
 
2066
- return inlineTransaction;
2067
+ return resumableTransaction;
2067
2068
  }
2068
2069
 
2069
2070
  var transaction = inlineTransaction || new InlineTransaction(options);
@@ -2356,10 +2357,14 @@ var PaystackPop = (function () {
2356
2357
 
2357
2358
  if (activeTransaction) {
2358
2359
  var checkoutIframe = this.checkoutIframe;
2359
- var urlParameters = activeTransaction.urlParameters;
2360
+ var urlParameters = activeTransaction.urlParameters,
2361
+ response = activeTransaction.response;
2362
+ var params = response ? {
2363
+ transactionData: response
2364
+ } : urlParameters;
2360
2365
  notifyIframeToUpdateURL({
2361
2366
  checkoutIframe: checkoutIframe,
2362
- urlParameters: urlParameters
2367
+ urlParameters: params
2363
2368
  });
2364
2369
  }
2365
2370
 
package/es/inline.js CHANGED
@@ -802,7 +802,7 @@ function mountPaymentRequestButtons(container, _ref3, merchantId) {
802
802
  });
803
803
  }
804
804
  function removeAllChildNodes(parent) {
805
- while (parent !== null && parent !== void 0 && parent.firstChild) {
805
+ while (parent.firstChild) {
806
806
  parent.removeChild(parent.firstChild);
807
807
  }
808
808
  }
@@ -2037,30 +2037,31 @@ var Inline = /*#__PURE__*/function () {
2037
2037
  this.activeTransaction().cancel();
2038
2038
  }
2039
2039
 
2040
- var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2041
-
2042
- if (resumableTransaction) {
2043
- resumableTransaction.isActive = true;
2040
+ if (inlineTransaction && transactionData) {
2041
+ this.transactions.push(inlineTransaction);
2044
2042
 
2045
2043
  if (!this.isDeprecatedApi) {
2046
2044
  this.open({
2047
- accessCode: resumableTransaction.accessCode
2045
+ transactionData: transactionData
2048
2046
  }, preload);
2049
2047
  }
2050
2048
 
2051
- return resumableTransaction;
2049
+ return inlineTransaction;
2052
2050
  }
2053
2051
 
2054
- if (inlineTransaction && transactionData) {
2055
- this.transactions.push(inlineTransaction);
2052
+ var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2053
+
2054
+ if (resumableTransaction) {
2055
+ resumableTransaction.isActive = true;
2056
2056
 
2057
2057
  if (!this.isDeprecatedApi) {
2058
+ // We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
2058
2059
  this.open({
2059
- transactionData: transactionData
2060
+ accessCode: resumableTransaction.accessCode
2060
2061
  }, preload);
2061
2062
  }
2062
2063
 
2063
- return inlineTransaction;
2064
+ return resumableTransaction;
2064
2065
  }
2065
2066
 
2066
2067
  var transaction = inlineTransaction || new InlineTransaction(options);
@@ -2353,10 +2354,14 @@ var Inline = /*#__PURE__*/function () {
2353
2354
 
2354
2355
  if (activeTransaction) {
2355
2356
  var checkoutIframe = this.checkoutIframe;
2356
- var urlParameters = activeTransaction.urlParameters;
2357
+ var urlParameters = activeTransaction.urlParameters,
2358
+ response = activeTransaction.response;
2359
+ var params = response ? {
2360
+ transactionData: response
2361
+ } : urlParameters;
2357
2362
  notifyIframeToUpdateURL({
2358
2363
  checkoutIframe: checkoutIframe,
2359
- urlParameters: urlParameters
2364
+ urlParameters: params
2360
2365
  });
2361
2366
  }
2362
2367
 
package/lib/inline.js CHANGED
@@ -804,7 +804,7 @@ function mountPaymentRequestButtons(container, _ref3, merchantId) {
804
804
  });
805
805
  }
806
806
  function removeAllChildNodes(parent) {
807
- while (parent !== null && parent !== void 0 && parent.firstChild) {
807
+ while (parent.firstChild) {
808
808
  parent.removeChild(parent.firstChild);
809
809
  }
810
810
  }
@@ -2039,30 +2039,31 @@ var Inline = /*#__PURE__*/function () {
2039
2039
  this.activeTransaction().cancel();
2040
2040
  }
2041
2041
 
2042
- var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2043
-
2044
- if (resumableTransaction) {
2045
- resumableTransaction.isActive = true;
2042
+ if (inlineTransaction && transactionData) {
2043
+ this.transactions.push(inlineTransaction);
2046
2044
 
2047
2045
  if (!this.isDeprecatedApi) {
2048
2046
  this.open({
2049
- accessCode: resumableTransaction.accessCode
2047
+ transactionData: transactionData
2050
2048
  }, preload);
2051
2049
  }
2052
2050
 
2053
- return resumableTransaction;
2051
+ return inlineTransaction;
2054
2052
  }
2055
2053
 
2056
- if (inlineTransaction && transactionData) {
2057
- this.transactions.push(inlineTransaction);
2054
+ var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2055
+
2056
+ if (resumableTransaction) {
2057
+ resumableTransaction.isActive = true;
2058
2058
 
2059
2059
  if (!this.isDeprecatedApi) {
2060
+ // We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
2060
2061
  this.open({
2061
- transactionData: transactionData
2062
+ accessCode: resumableTransaction.accessCode
2062
2063
  }, preload);
2063
2064
  }
2064
2065
 
2065
- return inlineTransaction;
2066
+ return resumableTransaction;
2066
2067
  }
2067
2068
 
2068
2069
  var transaction = inlineTransaction || new InlineTransaction(options);
@@ -2355,10 +2356,14 @@ var Inline = /*#__PURE__*/function () {
2355
2356
 
2356
2357
  if (activeTransaction) {
2357
2358
  var checkoutIframe = this.checkoutIframe;
2358
- var urlParameters = activeTransaction.urlParameters;
2359
+ var urlParameters = activeTransaction.urlParameters,
2360
+ response = activeTransaction.response;
2361
+ var params = response ? {
2362
+ transactionData: response
2363
+ } : urlParameters;
2359
2364
  notifyIframeToUpdateURL({
2360
2365
  checkoutIframe: checkoutIframe,
2361
- urlParameters: urlParameters
2366
+ urlParameters: params
2362
2367
  });
2363
2368
  }
2364
2369
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.20.0-dev.5",
3
+ "version": "2.20.1-dev.1",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "main": "lib/inline.js",
6
6
  "module": "es/inline.js",
@@ -27,9 +27,6 @@
27
27
  "url": "https://github.com/PaystackHQ/inline-js/issues"
28
28
  },
29
29
  "homepage": "https://github.com/PaystackHQ/inline-js#readme",
30
- "dependencies": {
31
- "@babel/polyfill": "^7.11.5"
32
- },
33
30
  "devDependencies": {
34
31
  "@babel/core": "^7.17.5",
35
32
  "@babel/preset-env": "^7.16.11",