@bigbinary/neeto-payments-frontend 1.4.6 → 1.4.7
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/index.cjs.js +92 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +92 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7014,6 +7014,97 @@ var useSquareCard = function useSquareCard() {
|
|
|
7014
7014
|
};
|
|
7015
7015
|
};
|
|
7016
7016
|
|
|
7017
|
+
var loadScript$1 = function loadScript(src) {
|
|
7018
|
+
return new Promise(function (resolve) {
|
|
7019
|
+
var script = document.createElement("script");
|
|
7020
|
+
script.src = src;
|
|
7021
|
+
script.onload = function () {
|
|
7022
|
+
resolve(true);
|
|
7023
|
+
};
|
|
7024
|
+
script.onerror = function () {
|
|
7025
|
+
resolve(false);
|
|
7026
|
+
};
|
|
7027
|
+
document.body.appendChild(script);
|
|
7028
|
+
});
|
|
7029
|
+
};
|
|
7030
|
+
var useRazorpayPayment = function useRazorpayPayment(_ref) {
|
|
7031
|
+
var payableId = _ref.payableId,
|
|
7032
|
+
_ref$onBeforePayment = _ref.onBeforePayment,
|
|
7033
|
+
onBeforePayment = _ref$onBeforePayment === void 0 ? noop : _ref$onBeforePayment,
|
|
7034
|
+
_ref$onSuccessfulPaym = _ref.onSuccessfulPayment,
|
|
7035
|
+
onSuccessfulPayment = _ref$onSuccessfulPaym === void 0 ? noop : _ref$onSuccessfulPaym,
|
|
7036
|
+
_ref$onFailedPayment = _ref.onFailedPayment,
|
|
7037
|
+
onFailedPayment = _ref$onFailedPayment === void 0 ? noop : _ref$onFailedPayment;
|
|
7038
|
+
var _useTranslation = useTranslation(),
|
|
7039
|
+
t = _useTranslation.t;
|
|
7040
|
+
var openRazorpayCheckout = /*#__PURE__*/function () {
|
|
7041
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
7042
|
+
var script, checkout;
|
|
7043
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
7044
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7045
|
+
case 0:
|
|
7046
|
+
_context.next = 2;
|
|
7047
|
+
return loadScript$1("https://checkout.razorpay.com/v1/checkout.js");
|
|
7048
|
+
case 2:
|
|
7049
|
+
script = _context.sent;
|
|
7050
|
+
if (script) {
|
|
7051
|
+
_context.next = 6;
|
|
7052
|
+
break;
|
|
7053
|
+
}
|
|
7054
|
+
logger.error(t("neetoPayments.razorpay.loadError"));
|
|
7055
|
+
return _context.abrupt("return");
|
|
7056
|
+
case 6:
|
|
7057
|
+
checkout = new window.Razorpay(options);
|
|
7058
|
+
checkout.open();
|
|
7059
|
+
case 8:
|
|
7060
|
+
case "end":
|
|
7061
|
+
return _context.stop();
|
|
7062
|
+
}
|
|
7063
|
+
}, _callee);
|
|
7064
|
+
}));
|
|
7065
|
+
return function openRazorpayCheckout(_x) {
|
|
7066
|
+
return _ref2.apply(this, arguments);
|
|
7067
|
+
};
|
|
7068
|
+
}();
|
|
7069
|
+
var handlePayment = function handlePayment(response) {
|
|
7070
|
+
if (isNotPresent(response === null || response === void 0 ? void 0 : response.razorpay_signature)) {
|
|
7071
|
+
onFailedPayment();
|
|
7072
|
+
return;
|
|
7073
|
+
}
|
|
7074
|
+
onSuccessfulPayment();
|
|
7075
|
+
};
|
|
7076
|
+
var handleSuccess = function handleSuccess(_ref3) {
|
|
7077
|
+
var payment = _ref3.payment;
|
|
7078
|
+
if ((payment === null || payment === void 0 ? void 0 : payment.status) === "successful") {
|
|
7079
|
+
return onSuccessfulPayment();
|
|
7080
|
+
}
|
|
7081
|
+
var options = {
|
|
7082
|
+
key: payment.publicKey,
|
|
7083
|
+
order_id: payment.orderIdentifier,
|
|
7084
|
+
customer_id: payment.customerIdentifier,
|
|
7085
|
+
modal: {
|
|
7086
|
+
confirm_close: true,
|
|
7087
|
+
ondismiss: onFailedPayment
|
|
7088
|
+
},
|
|
7089
|
+
handler: handlePayment
|
|
7090
|
+
};
|
|
7091
|
+
return openRazorpayCheckout(mergeDeepLeft(RAZORPAY_PAYMENT_BUTTON_OPTIONS, options));
|
|
7092
|
+
};
|
|
7093
|
+
var _useCreateRazorpayPay = useCreateRazorpayPayment({
|
|
7094
|
+
onSuccess: handleSuccess
|
|
7095
|
+
}),
|
|
7096
|
+
createRazorpayOrder = _useCreateRazorpayPay.mutate;
|
|
7097
|
+
var makePayment = function makePayment() {
|
|
7098
|
+
onBeforePayment();
|
|
7099
|
+
createRazorpayOrder({
|
|
7100
|
+
payableId: payableId
|
|
7101
|
+
});
|
|
7102
|
+
};
|
|
7103
|
+
return {
|
|
7104
|
+
makePayment: makePayment
|
|
7105
|
+
};
|
|
7106
|
+
};
|
|
7107
|
+
|
|
7017
7108
|
var useStripePromise = function useStripePromise(stripeAccountIdentifier) {
|
|
7018
7109
|
var stripePromise = useMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
7019
7110
|
var stripeJs, _yield$stripeJs, loadStripe;
|
|
@@ -9219,5 +9310,5 @@ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r
|
|
|
9219
9310
|
var css = ".ant-table-cell-row-hover .identifier-copy-button{visibility:visible!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19jb3B5LWJ1dHRvbi5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL21haW4uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDRSxrREFDRSw0QkNBSiIsInNvdXJjZXNDb250ZW50IjpbIi5hbnQtdGFibGUtY2VsbC1yb3ctaG92ZXIge1xuICAuaWRlbnRpZmllci1jb3B5LWJ1dHRvbiB7XG4gICAgdmlzaWJpbGl0eTogdmlzaWJsZSAhaW1wb3J0YW50O1xuICB9XG59XG4iLCIuYW50LXRhYmxlLWNlbGwtcm93LWhvdmVyIC5pZGVudGlmaWVyLWNvcHktYnV0dG9uIHtcbiAgdmlzaWJpbGl0eTogdmlzaWJsZSAhaW1wb3J0YW50O1xufSJdfQ== */";
|
|
9220
9311
|
n(css,{});
|
|
9221
9312
|
|
|
9222
|
-
export { index$3 as AccountsDashboard, CURRENCY_OPTIONS, Dashboard$1 as Dashboard, PaymentKindRestrictionAlert, index$2 as PayoutsDashboard, PayoutsPage, index as RazorpayDashboard, RazorpayPaymentButton, SquareCard, index$1 as SquareDashboard, StripeConnect, buildStripeTransactionLink, useSquareCard, useStripePromise };
|
|
9313
|
+
export { index$3 as AccountsDashboard, CURRENCY_OPTIONS, Dashboard$1 as Dashboard, PaymentKindRestrictionAlert, index$2 as PayoutsDashboard, PayoutsPage, index as RazorpayDashboard, RazorpayPaymentButton, SquareCard, index$1 as SquareDashboard, StripeConnect, buildStripeTransactionLink, useRazorpayPayment, useSquareCard, useStripePromise };
|
|
9223
9314
|
//# sourceMappingURL=index.js.map
|