@paystack/inline-js 2.20.0-dev.4 → 2.20.0-dev.5

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
@@ -1749,7 +1749,7 @@ var PaystackPop = (function () {
1749
1749
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
1750
1750
  }
1751
1751
 
1752
- var _excluded = ["preload", "inlineTransaction"],
1752
+ var _excluded = ["preload", "inlineTransaction", "transactionData"],
1753
1753
  _excluded2 = ["container", "styles", "onElementsMount"];
1754
1754
  var inlineInstance;
1755
1755
 
@@ -1865,12 +1865,14 @@ var PaystackPop = (function () {
1865
1865
 
1866
1866
  if (!shouldLoadPreCheckoutModal) {
1867
1867
  inlineInstance.newTransaction({
1868
- inlineTransaction: transaction
1868
+ inlineTransaction: transaction,
1869
+ transactionData: response
1869
1870
  });
1870
1871
  resolve(transaction);
1871
1872
  } else {
1872
1873
  inlineInstance.preloadTransaction({
1873
- inlineTransaction: transaction
1874
+ inlineTransaction: transaction,
1875
+ transactionData: response
1874
1876
  });
1875
1877
  inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, {
1876
1878
  canPayWithVault: canPayWithVault,
@@ -2029,6 +2031,7 @@ var PaystackPop = (function () {
2029
2031
  value: function newTransaction(_ref) {
2030
2032
  var preload = _ref.preload,
2031
2033
  inlineTransaction = _ref.inlineTransaction,
2034
+ transactionData = _ref.transactionData,
2032
2035
  options = _objectWithoutProperties(_ref, _excluded);
2033
2036
 
2034
2037
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2037,29 +2040,40 @@ var PaystackPop = (function () {
2037
2040
  this.activeTransaction().cancel();
2038
2041
  }
2039
2042
 
2040
- var urlParameters;
2041
2043
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2042
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2043
2044
 
2044
2045
  if (resumableTransaction) {
2045
- transaction.isActive = true;
2046
- urlParameters = {
2047
- accessCode: transaction.accessCode
2048
- };
2049
- } else {
2050
- if (transaction.accessCode) {
2051
- urlParameters = {
2052
- accessCode: transaction.accessCode
2053
- };
2054
- } else {
2055
- urlParameters = transaction.urlParameters;
2046
+ resumableTransaction.isActive = true;
2047
+
2048
+ if (!this.isDeprecatedApi) {
2049
+ this.open({
2050
+ accessCode: resumableTransaction.accessCode
2051
+ }, preload);
2056
2052
  }
2057
2053
 
2058
- this.transactions.push(transaction);
2054
+ return resumableTransaction;
2059
2055
  }
2060
2056
 
2057
+ if (inlineTransaction && transactionData) {
2058
+ this.transactions.push(inlineTransaction);
2059
+
2060
+ if (!this.isDeprecatedApi) {
2061
+ this.open({
2062
+ transactionData: transactionData
2063
+ }, preload);
2064
+ }
2065
+
2066
+ return inlineTransaction;
2067
+ }
2068
+
2069
+ var transaction = inlineTransaction || new InlineTransaction(options);
2070
+ var params = transaction.accessCode ? {
2071
+ accessCode: transaction.accessCode
2072
+ } : transaction.urlParameters;
2073
+ this.transactions.push(transaction);
2074
+
2061
2075
  if (!this.isDeprecatedApi) {
2062
- this.open(urlParameters, preload);
2076
+ this.open(params, preload);
2063
2077
  }
2064
2078
 
2065
2079
  return transaction;
@@ -2144,7 +2158,8 @@ var PaystackPop = (function () {
2144
2158
 
2145
2159
  if (loadPaystackCheckoutButton) {
2146
2160
  var _loadPopup = inlineInstance.preloadTransaction({
2147
- inlineTransaction: transaction
2161
+ inlineTransaction: transaction,
2162
+ transactionData: response
2148
2163
  });
2149
2164
 
2150
2165
  loadPaystackCheckoutButton.onclick = _loadPopup;
package/es/inline.js CHANGED
@@ -1746,7 +1746,7 @@ function printDeprecationNotice(oldName, newName, extraMessage) {
1746
1746
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
1747
1747
  }
1748
1748
 
1749
- var _excluded = ["preload", "inlineTransaction"],
1749
+ var _excluded = ["preload", "inlineTransaction", "transactionData"],
1750
1750
  _excluded2 = ["container", "styles", "onElementsMount"];
1751
1751
  var inlineInstance;
1752
1752
 
@@ -1862,12 +1862,14 @@ var Inline = /*#__PURE__*/function () {
1862
1862
 
1863
1863
  if (!shouldLoadPreCheckoutModal) {
1864
1864
  inlineInstance.newTransaction({
1865
- inlineTransaction: transaction
1865
+ inlineTransaction: transaction,
1866
+ transactionData: response
1866
1867
  });
1867
1868
  resolve(transaction);
1868
1869
  } else {
1869
1870
  inlineInstance.preloadTransaction({
1870
- inlineTransaction: transaction
1871
+ inlineTransaction: transaction,
1872
+ transactionData: response
1871
1873
  });
1872
1874
  inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, {
1873
1875
  canPayWithVault: canPayWithVault,
@@ -2026,6 +2028,7 @@ var Inline = /*#__PURE__*/function () {
2026
2028
  value: function newTransaction(_ref) {
2027
2029
  var preload = _ref.preload,
2028
2030
  inlineTransaction = _ref.inlineTransaction,
2031
+ transactionData = _ref.transactionData,
2029
2032
  options = _objectWithoutProperties(_ref, _excluded);
2030
2033
 
2031
2034
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2034,29 +2037,40 @@ var Inline = /*#__PURE__*/function () {
2034
2037
  this.activeTransaction().cancel();
2035
2038
  }
2036
2039
 
2037
- var urlParameters;
2038
2040
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2039
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2040
2041
 
2041
2042
  if (resumableTransaction) {
2042
- transaction.isActive = true;
2043
- urlParameters = {
2044
- accessCode: transaction.accessCode
2045
- };
2046
- } else {
2047
- if (transaction.accessCode) {
2048
- urlParameters = {
2049
- accessCode: transaction.accessCode
2050
- };
2051
- } else {
2052
- urlParameters = transaction.urlParameters;
2043
+ resumableTransaction.isActive = true;
2044
+
2045
+ if (!this.isDeprecatedApi) {
2046
+ this.open({
2047
+ accessCode: resumableTransaction.accessCode
2048
+ }, preload);
2053
2049
  }
2054
2050
 
2055
- this.transactions.push(transaction);
2051
+ return resumableTransaction;
2056
2052
  }
2057
2053
 
2054
+ if (inlineTransaction && transactionData) {
2055
+ this.transactions.push(inlineTransaction);
2056
+
2057
+ if (!this.isDeprecatedApi) {
2058
+ this.open({
2059
+ transactionData: transactionData
2060
+ }, preload);
2061
+ }
2062
+
2063
+ return inlineTransaction;
2064
+ }
2065
+
2066
+ var transaction = inlineTransaction || new InlineTransaction(options);
2067
+ var params = transaction.accessCode ? {
2068
+ accessCode: transaction.accessCode
2069
+ } : transaction.urlParameters;
2070
+ this.transactions.push(transaction);
2071
+
2058
2072
  if (!this.isDeprecatedApi) {
2059
- this.open(urlParameters, preload);
2073
+ this.open(params, preload);
2060
2074
  }
2061
2075
 
2062
2076
  return transaction;
@@ -2141,7 +2155,8 @@ var Inline = /*#__PURE__*/function () {
2141
2155
 
2142
2156
  if (loadPaystackCheckoutButton) {
2143
2157
  var _loadPopup = inlineInstance.preloadTransaction({
2144
- inlineTransaction: transaction
2158
+ inlineTransaction: transaction,
2159
+ transactionData: response
2145
2160
  });
2146
2161
 
2147
2162
  loadPaystackCheckoutButton.onclick = _loadPopup;
package/lib/inline.js CHANGED
@@ -1748,7 +1748,7 @@ function printDeprecationNotice(oldName, newName, extraMessage) {
1748
1748
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
1749
1749
  }
1750
1750
 
1751
- var _excluded = ["preload", "inlineTransaction"],
1751
+ var _excluded = ["preload", "inlineTransaction", "transactionData"],
1752
1752
  _excluded2 = ["container", "styles", "onElementsMount"];
1753
1753
  var inlineInstance;
1754
1754
 
@@ -1864,12 +1864,14 @@ var Inline = /*#__PURE__*/function () {
1864
1864
 
1865
1865
  if (!shouldLoadPreCheckoutModal) {
1866
1866
  inlineInstance.newTransaction({
1867
- inlineTransaction: transaction
1867
+ inlineTransaction: transaction,
1868
+ transactionData: response
1868
1869
  });
1869
1870
  resolve(transaction);
1870
1871
  } else {
1871
1872
  inlineInstance.preloadTransaction({
1872
- inlineTransaction: transaction
1873
+ inlineTransaction: transaction,
1874
+ transactionData: response
1873
1875
  });
1874
1876
  inlineInstance.preCheckoutModal = mountPreCheckoutModal(inlineInstance.id, response, {
1875
1877
  canPayWithVault: canPayWithVault,
@@ -2028,6 +2030,7 @@ var Inline = /*#__PURE__*/function () {
2028
2030
  value: function newTransaction(_ref) {
2029
2031
  var preload = _ref.preload,
2030
2032
  inlineTransaction = _ref.inlineTransaction,
2033
+ transactionData = _ref.transactionData,
2031
2034
  options = _objectWithoutProperties(_ref, _excluded);
2032
2035
 
2033
2036
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2036,29 +2039,40 @@ var Inline = /*#__PURE__*/function () {
2036
2039
  this.activeTransaction().cancel();
2037
2040
  }
2038
2041
 
2039
- var urlParameters;
2040
2042
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2041
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2042
2043
 
2043
2044
  if (resumableTransaction) {
2044
- transaction.isActive = true;
2045
- urlParameters = {
2046
- accessCode: transaction.accessCode
2047
- };
2048
- } else {
2049
- if (transaction.accessCode) {
2050
- urlParameters = {
2051
- accessCode: transaction.accessCode
2052
- };
2053
- } else {
2054
- urlParameters = transaction.urlParameters;
2045
+ resumableTransaction.isActive = true;
2046
+
2047
+ if (!this.isDeprecatedApi) {
2048
+ this.open({
2049
+ accessCode: resumableTransaction.accessCode
2050
+ }, preload);
2055
2051
  }
2056
2052
 
2057
- this.transactions.push(transaction);
2053
+ return resumableTransaction;
2058
2054
  }
2059
2055
 
2056
+ if (inlineTransaction && transactionData) {
2057
+ this.transactions.push(inlineTransaction);
2058
+
2059
+ if (!this.isDeprecatedApi) {
2060
+ this.open({
2061
+ transactionData: transactionData
2062
+ }, preload);
2063
+ }
2064
+
2065
+ return inlineTransaction;
2066
+ }
2067
+
2068
+ var transaction = inlineTransaction || new InlineTransaction(options);
2069
+ var params = transaction.accessCode ? {
2070
+ accessCode: transaction.accessCode
2071
+ } : transaction.urlParameters;
2072
+ this.transactions.push(transaction);
2073
+
2060
2074
  if (!this.isDeprecatedApi) {
2061
- this.open(urlParameters, preload);
2075
+ this.open(params, preload);
2062
2076
  }
2063
2077
 
2064
2078
  return transaction;
@@ -2143,7 +2157,8 @@ var Inline = /*#__PURE__*/function () {
2143
2157
 
2144
2158
  if (loadPaystackCheckoutButton) {
2145
2159
  var _loadPopup = inlineInstance.preloadTransaction({
2146
- inlineTransaction: transaction
2160
+ inlineTransaction: transaction,
2161
+ transactionData: response
2147
2162
  });
2148
2163
 
2149
2164
  loadPaystackCheckoutButton.onclick = _loadPopup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.20.0-dev.4",
3
+ "version": "2.20.0-dev.5",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "main": "lib/inline.js",
6
6
  "module": "es/inline.js",