@paystack/inline-js 2.20.0-dev.3 → 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,
@@ -1896,7 +1898,6 @@ var PaystackPop = (function () {
1896
1898
  }
1897
1899
  }, response.merchant_id).then(function () {
1898
1900
  inlineInstance.registerPaymentRequestEventListeners();
1899
- inlineInstance.openPreCheckoutModal();
1900
1901
  }).catch(function () {
1901
1902
  /**
1902
1903
  * If an error occurs when mounting the apple pay button,
@@ -1906,7 +1907,6 @@ var PaystackPop = (function () {
1906
1907
  */
1907
1908
  if (canPayWithVault) {
1908
1909
  removePreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
1909
- inlineInstance.openPreCheckoutModal();
1910
1910
  } else {
1911
1911
  inlineInstance.closePreCheckoutModal();
1912
1912
  inlineInstance.animateCheckoutIn();
@@ -1915,7 +1915,6 @@ var PaystackPop = (function () {
1915
1915
  resolve(transaction);
1916
1916
  });
1917
1917
  } else {
1918
- inlineInstance.openPreCheckoutModal();
1919
1918
  resolve(transaction);
1920
1919
  }
1921
1920
  }
@@ -2032,6 +2031,7 @@ var PaystackPop = (function () {
2032
2031
  value: function newTransaction(_ref) {
2033
2032
  var preload = _ref.preload,
2034
2033
  inlineTransaction = _ref.inlineTransaction,
2034
+ transactionData = _ref.transactionData,
2035
2035
  options = _objectWithoutProperties(_ref, _excluded);
2036
2036
 
2037
2037
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2040,29 +2040,40 @@ var PaystackPop = (function () {
2040
2040
  this.activeTransaction().cancel();
2041
2041
  }
2042
2042
 
2043
- var urlParameters;
2044
2043
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2045
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2046
2044
 
2047
2045
  if (resumableTransaction) {
2048
- transaction.isActive = true;
2049
- urlParameters = {
2050
- accessCode: transaction.accessCode
2051
- };
2052
- } else {
2053
- if (transaction.accessCode) {
2054
- urlParameters = {
2055
- accessCode: transaction.accessCode
2056
- };
2057
- } else {
2058
- urlParameters = transaction.urlParameters;
2046
+ resumableTransaction.isActive = true;
2047
+
2048
+ if (!this.isDeprecatedApi) {
2049
+ this.open({
2050
+ accessCode: resumableTransaction.accessCode
2051
+ }, preload);
2052
+ }
2053
+
2054
+ return resumableTransaction;
2055
+ }
2056
+
2057
+ if (inlineTransaction && transactionData) {
2058
+ this.transactions.push(inlineTransaction);
2059
+
2060
+ if (!this.isDeprecatedApi) {
2061
+ this.open({
2062
+ transactionData: transactionData
2063
+ }, preload);
2059
2064
  }
2060
2065
 
2061
- this.transactions.push(transaction);
2066
+ return inlineTransaction;
2062
2067
  }
2063
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
+
2064
2075
  if (!this.isDeprecatedApi) {
2065
- this.open(urlParameters, preload);
2076
+ this.open(params, preload);
2066
2077
  }
2067
2078
 
2068
2079
  return transaction;
@@ -2147,7 +2158,8 @@ var PaystackPop = (function () {
2147
2158
 
2148
2159
  if (loadPaystackCheckoutButton) {
2149
2160
  var _loadPopup = inlineInstance.preloadTransaction({
2150
- inlineTransaction: transaction
2161
+ inlineTransaction: transaction,
2162
+ transactionData: response
2151
2163
  });
2152
2164
 
2153
2165
  loadPaystackCheckoutButton.onclick = _loadPopup;
@@ -2355,6 +2367,11 @@ var PaystackPop = (function () {
2355
2367
 
2356
2368
  case 'loaded:transaction':
2357
2369
  hideLoader(this.backgroundIframe);
2370
+
2371
+ if (this.preCheckoutModal) {
2372
+ this.openPreCheckoutModal();
2373
+ }
2374
+
2358
2375
  activeTransaction.onLoad(eventData);
2359
2376
  break;
2360
2377
 
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,
@@ -1893,7 +1895,6 @@ var Inline = /*#__PURE__*/function () {
1893
1895
  }
1894
1896
  }, response.merchant_id).then(function () {
1895
1897
  inlineInstance.registerPaymentRequestEventListeners();
1896
- inlineInstance.openPreCheckoutModal();
1897
1898
  }).catch(function () {
1898
1899
  /**
1899
1900
  * If an error occurs when mounting the apple pay button,
@@ -1903,7 +1904,6 @@ var Inline = /*#__PURE__*/function () {
1903
1904
  */
1904
1905
  if (canPayWithVault) {
1905
1906
  removePreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
1906
- inlineInstance.openPreCheckoutModal();
1907
1907
  } else {
1908
1908
  inlineInstance.closePreCheckoutModal();
1909
1909
  inlineInstance.animateCheckoutIn();
@@ -1912,7 +1912,6 @@ var Inline = /*#__PURE__*/function () {
1912
1912
  resolve(transaction);
1913
1913
  });
1914
1914
  } else {
1915
- inlineInstance.openPreCheckoutModal();
1916
1915
  resolve(transaction);
1917
1916
  }
1918
1917
  }
@@ -2029,6 +2028,7 @@ var Inline = /*#__PURE__*/function () {
2029
2028
  value: function newTransaction(_ref) {
2030
2029
  var preload = _ref.preload,
2031
2030
  inlineTransaction = _ref.inlineTransaction,
2031
+ transactionData = _ref.transactionData,
2032
2032
  options = _objectWithoutProperties(_ref, _excluded);
2033
2033
 
2034
2034
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2037,29 +2037,40 @@ var Inline = /*#__PURE__*/function () {
2037
2037
  this.activeTransaction().cancel();
2038
2038
  }
2039
2039
 
2040
- var urlParameters;
2041
2040
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2042
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2043
2041
 
2044
2042
  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;
2043
+ resumableTransaction.isActive = true;
2044
+
2045
+ if (!this.isDeprecatedApi) {
2046
+ this.open({
2047
+ accessCode: resumableTransaction.accessCode
2048
+ }, preload);
2049
+ }
2050
+
2051
+ return resumableTransaction;
2052
+ }
2053
+
2054
+ if (inlineTransaction && transactionData) {
2055
+ this.transactions.push(inlineTransaction);
2056
+
2057
+ if (!this.isDeprecatedApi) {
2058
+ this.open({
2059
+ transactionData: transactionData
2060
+ }, preload);
2056
2061
  }
2057
2062
 
2058
- this.transactions.push(transaction);
2063
+ return inlineTransaction;
2059
2064
  }
2060
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
+
2061
2072
  if (!this.isDeprecatedApi) {
2062
- this.open(urlParameters, preload);
2073
+ this.open(params, preload);
2063
2074
  }
2064
2075
 
2065
2076
  return transaction;
@@ -2144,7 +2155,8 @@ var Inline = /*#__PURE__*/function () {
2144
2155
 
2145
2156
  if (loadPaystackCheckoutButton) {
2146
2157
  var _loadPopup = inlineInstance.preloadTransaction({
2147
- inlineTransaction: transaction
2158
+ inlineTransaction: transaction,
2159
+ transactionData: response
2148
2160
  });
2149
2161
 
2150
2162
  loadPaystackCheckoutButton.onclick = _loadPopup;
@@ -2352,6 +2364,11 @@ var Inline = /*#__PURE__*/function () {
2352
2364
 
2353
2365
  case 'loaded:transaction':
2354
2366
  hideLoader(this.backgroundIframe);
2367
+
2368
+ if (this.preCheckoutModal) {
2369
+ this.openPreCheckoutModal();
2370
+ }
2371
+
2355
2372
  activeTransaction.onLoad(eventData);
2356
2373
  break;
2357
2374
 
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,
@@ -1895,7 +1897,6 @@ var Inline = /*#__PURE__*/function () {
1895
1897
  }
1896
1898
  }, response.merchant_id).then(function () {
1897
1899
  inlineInstance.registerPaymentRequestEventListeners();
1898
- inlineInstance.openPreCheckoutModal();
1899
1900
  }).catch(function () {
1900
1901
  /**
1901
1902
  * If an error occurs when mounting the apple pay button,
@@ -1905,7 +1906,6 @@ var Inline = /*#__PURE__*/function () {
1905
1906
  */
1906
1907
  if (canPayWithVault) {
1907
1908
  removePreCheckoutModalPaymentRequestContainer(inlineInstance.preCheckoutModal);
1908
- inlineInstance.openPreCheckoutModal();
1909
1909
  } else {
1910
1910
  inlineInstance.closePreCheckoutModal();
1911
1911
  inlineInstance.animateCheckoutIn();
@@ -1914,7 +1914,6 @@ var Inline = /*#__PURE__*/function () {
1914
1914
  resolve(transaction);
1915
1915
  });
1916
1916
  } else {
1917
- inlineInstance.openPreCheckoutModal();
1918
1917
  resolve(transaction);
1919
1918
  }
1920
1919
  }
@@ -2031,6 +2030,7 @@ var Inline = /*#__PURE__*/function () {
2031
2030
  value: function newTransaction(_ref) {
2032
2031
  var preload = _ref.preload,
2033
2032
  inlineTransaction = _ref.inlineTransaction,
2033
+ transactionData = _ref.transactionData,
2034
2034
  options = _objectWithoutProperties(_ref, _excluded);
2035
2035
 
2036
2036
  var hasPaymentRequestButtons = this.paymentRequestContainer && getApplePayButton(this.paymentRequestContainer);
@@ -2039,29 +2039,40 @@ var Inline = /*#__PURE__*/function () {
2039
2039
  this.activeTransaction().cancel();
2040
2040
  }
2041
2041
 
2042
- var urlParameters;
2043
2042
  var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
2044
- var transaction = resumableTransaction || inlineTransaction || new InlineTransaction(options);
2045
2043
 
2046
2044
  if (resumableTransaction) {
2047
- transaction.isActive = true;
2048
- urlParameters = {
2049
- accessCode: transaction.accessCode
2050
- };
2051
- } else {
2052
- if (transaction.accessCode) {
2053
- urlParameters = {
2054
- accessCode: transaction.accessCode
2055
- };
2056
- } else {
2057
- urlParameters = transaction.urlParameters;
2045
+ resumableTransaction.isActive = true;
2046
+
2047
+ if (!this.isDeprecatedApi) {
2048
+ this.open({
2049
+ accessCode: resumableTransaction.accessCode
2050
+ }, preload);
2051
+ }
2052
+
2053
+ return resumableTransaction;
2054
+ }
2055
+
2056
+ if (inlineTransaction && transactionData) {
2057
+ this.transactions.push(inlineTransaction);
2058
+
2059
+ if (!this.isDeprecatedApi) {
2060
+ this.open({
2061
+ transactionData: transactionData
2062
+ }, preload);
2058
2063
  }
2059
2064
 
2060
- this.transactions.push(transaction);
2065
+ return inlineTransaction;
2061
2066
  }
2062
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
+
2063
2074
  if (!this.isDeprecatedApi) {
2064
- this.open(urlParameters, preload);
2075
+ this.open(params, preload);
2065
2076
  }
2066
2077
 
2067
2078
  return transaction;
@@ -2146,7 +2157,8 @@ var Inline = /*#__PURE__*/function () {
2146
2157
 
2147
2158
  if (loadPaystackCheckoutButton) {
2148
2159
  var _loadPopup = inlineInstance.preloadTransaction({
2149
- inlineTransaction: transaction
2160
+ inlineTransaction: transaction,
2161
+ transactionData: response
2150
2162
  });
2151
2163
 
2152
2164
  loadPaystackCheckoutButton.onclick = _loadPopup;
@@ -2354,6 +2366,11 @@ var Inline = /*#__PURE__*/function () {
2354
2366
 
2355
2367
  case 'loaded:transaction':
2356
2368
  hideLoader(this.backgroundIframe);
2369
+
2370
+ if (this.preCheckoutModal) {
2371
+ this.openPreCheckoutModal();
2372
+ }
2373
+
2357
2374
  activeTransaction.onLoad(eventData);
2358
2375
  break;
2359
2376
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.20.0-dev.3",
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",