@bigbinary/neeto-payments-frontend 1.4.15 → 1.4.16

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.js CHANGED
@@ -6,28 +6,45 @@ import { useQueryParams, withTitle, useMutationWithInvalidation, withT, useState
6
6
  import { buildFiltersFromURL, Bar } from '@bigbinary/neeto-filters-frontend';
7
7
  import Header from '@bigbinary/neeto-molecules/Header';
8
8
  import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
9
- import { Toastr, Modal, Typography, Button, Tooltip, Tag, NoData, Table, Tab, Pane, Spinner, Alert, Label, Radio } from '@bigbinary/neetoui';
9
+ import Tab from '@bigbinary/neetoui/Tab';
10
+ import Typography from '@bigbinary/neetoui/Typography';
10
11
  import { useTranslation, Trans } from 'react-i18next';
11
12
  import { QueryClient, QueryCache, QueryClientProvider, useMutation, useQuery } from 'react-query';
12
13
  import { ReactQueryDevtools } from 'react-query/devtools';
13
14
  import { DEFAULT_STALE_TIME, DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
15
+ import Toastr from '@bigbinary/neetoui/Toastr';
14
16
  import { Download, Down, Right } from '@bigbinary/neeto-icons';
17
+ import Button from '@bigbinary/neetoui/Button';
18
+ import Modal from '@bigbinary/neetoui/Modal';
15
19
  import axios from 'axios';
16
20
  import { createSubscription, getQueryParams, buildUrl, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
17
21
  import { isEmpty, assoc, modify, concat, curry, pipe, split, map, join, mergeLeft, equals, sortBy, prop, evolve, insert, mergeDeepLeft, pluck } from 'ramda';
18
22
  import { useHistory } from 'react-router-dom';
19
23
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
24
+ import Tag from '@bigbinary/neetoui/Tag';
25
+ import Tooltip from '@bigbinary/neetoui/Tooltip';
20
26
  import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
21
27
  import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
22
28
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
23
29
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
30
+ import Table from '@bigbinary/neetoui/Table';
31
+ import NoData from '@bigbinary/neetoui/NoData';
24
32
  import require$$0 from 'util';
33
+ import Pane from '@bigbinary/neetoui/Pane';
25
34
  import { useParams } from 'react-router-dom/cjs/react-router-dom';
26
35
  import classNames from 'classnames';
36
+ import Spinner from '@bigbinary/neetoui/Spinner';
37
+ import Alert from '@bigbinary/neetoui/Alert';
27
38
  import { Finish as Finish$1, Modal as Modal$1, Demo } from 'neetointegrations';
28
- import { Form, Select, Input, Button as Button$1 } from '@bigbinary/neetoui/formik';
39
+ import Label from '@bigbinary/neetoui/Label';
40
+ import Select from '@bigbinary/neetoui/formik/Select';
41
+ import Form from '@bigbinary/neetoui/formik/Form';
42
+ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
29
43
  import * as yup from 'yup';
44
+ import Radio from '@bigbinary/neetoui/Radio';
45
+ import Input from '@bigbinary/neetoui/formik/Input';
30
46
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
47
+ import QRCodeImage from 'qrcode.react';
31
48
  import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
32
49
 
33
50
  function _arrayWithHoles(arr) {
@@ -7183,6 +7200,7 @@ var AccountForm = function AccountForm(_ref) {
7183
7200
  returnUrl = _ref.returnUrl;
7184
7201
  var _useTranslation = useTranslation(),
7185
7202
  t = _useTranslation.t;
7203
+ var history = useHistory();
7186
7204
  var _useState = useState(false),
7187
7205
  _useState2 = _slicedToArray(_useState, 2),
7188
7206
  isPolling = _useState2[0],
@@ -7246,11 +7264,16 @@ var AccountForm = function AccountForm(_ref) {
7246
7264
  name: "country",
7247
7265
  options: buildCountryOptions(countries),
7248
7266
  placeholder: t("neetoPayments.integrationModal.form.placeholder")
7249
- }), /*#__PURE__*/React__default.createElement(Button, {
7250
- disabled: isCreating || isPolling,
7251
- label: submitButtonLabel,
7252
- loading: isCreating || isPolling,
7253
- type: "submit"
7267
+ }), /*#__PURE__*/React__default.createElement(ActionBlock, {
7268
+ cancelButtonProps: {
7269
+ onClick: function onClick() {
7270
+ return history.goBack();
7271
+ }
7272
+ },
7273
+ isSubmitting: isCreating || isPolling,
7274
+ submitButtonProps: {
7275
+ label: submitButtonLabel
7276
+ }
7254
7277
  })));
7255
7278
  };
7256
7279
 
@@ -9138,12 +9161,14 @@ var StripeConnect = function StripeConnect(_ref) {
9138
9161
  };
9139
9162
 
9140
9163
  var VALIDATION_SCHEMA$1 = yup.object({
9141
- upiId: yup.string().matches(/^[a-zA-Z0-9.-]{2,256}@[a-zA-Z0-9][a-zA-Z0-9-]{1,63}$/, t$1("neetoPayments.upi.form.validation.invalidUpi")).required(t$1("neetoPayments.upi.form.validation.required"))
9164
+ upiId: yup.string().matches(/^[a-zA-Z0-9.-]{2,256}@[a-zA-Z][a-zA-Z]{2,64}$/, t$1("neetoPayments.upi.form.validation.invalidUpi")).required(t$1("neetoPayments.upi.form.validation.required"))
9142
9165
  });
9143
9166
 
9144
- var Add = withT(function (_ref) {
9145
- var t = _ref.t,
9146
- handleCreateUpiId = _ref.handleCreateUpiId;
9167
+ var Add = function Add(_ref) {
9168
+ var handleCreateUpiId = _ref.handleCreateUpiId;
9169
+ var _useTranslation = useTranslation(),
9170
+ t = _useTranslation.t;
9171
+ var history = useHistory();
9147
9172
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Form, {
9148
9173
  formikProps: {
9149
9174
  initialValues: {
@@ -9156,13 +9181,20 @@ var Add = withT(function (_ref) {
9156
9181
  className: "space-y-3"
9157
9182
  }, /*#__PURE__*/React__default.createElement(Input, {
9158
9183
  className: "w-64",
9159
- label: t("neetoPayments.common.upiId"),
9160
- name: "upiId"
9161
- }), /*#__PURE__*/React__default.createElement(Button$1, {
9162
- label: t("neetoPayments.upi.form.add"),
9163
- type: "submit"
9184
+ label: t("neetoPayments.upi.form.enterUpi"),
9185
+ name: "upiId",
9186
+ placeholder: t("neetoPayments.upi.form.enterUpi")
9187
+ }), /*#__PURE__*/React__default.createElement(ActionBlock, {
9188
+ cancelButtonProps: {
9189
+ onClick: function onClick() {
9190
+ return history.goBack();
9191
+ }
9192
+ },
9193
+ submitButtonProps: {
9194
+ label: t("neetoPayments.upi.form.add")
9195
+ }
9164
9196
  }))));
9165
- });
9197
+ };
9166
9198
 
9167
9199
  var getColumnData = function getColumnData(handleDeleteClick) {
9168
9200
  return [{
@@ -9256,14 +9288,10 @@ var UpiConnect = function UpiConnect(_ref) {
9256
9288
  handleDeleteUpiId = _ref$handleDeleteUpiI === void 0 ? noop : _ref$handleDeleteUpiI,
9257
9289
  _ref$handleCreateUpiI = _ref.handleCreateUpiId,
9258
9290
  handleCreateUpiId = _ref$handleCreateUpiI === void 0 ? noop : _ref$handleCreateUpiI;
9259
- var _useTranslation = useTranslation(),
9260
- t = _useTranslation.t;
9261
9291
  if (isLoading) return /*#__PURE__*/React__default.createElement(Spinner, null);
9262
9292
  return /*#__PURE__*/React__default.createElement("div", {
9263
9293
  className: "flex w-full max-w-3xl flex-col items-start space-y-6"
9264
- }, /*#__PURE__*/React__default.createElement(Typography, {
9265
- style: "h2"
9266
- }, t("neetoPayments.common.upiIds")), /*#__PURE__*/React__default.createElement(Add, {
9294
+ }, /*#__PURE__*/React__default.createElement(Add, {
9267
9295
  handleCreateUpiId: handleCreateUpiId
9268
9296
  }), /*#__PURE__*/React__default.createElement(List$1, {
9269
9297
  handleDeleteUpiId: handleDeleteUpiId,
@@ -9326,11 +9354,15 @@ var VALIDATION_SCHEMA = yup.object({
9326
9354
  transactionId: yup.string().required(t$1("neetoPayments.upi.payment.transaction.required")).min(6, t$1("neetoPayments.upi.payment.transaction.sixCharacters")).max(6, t$1("neetoPayments.upi.payment.transaction.sixCharacters"))
9327
9355
  });
9328
9356
 
9357
+ var vpaIdToQrCodeValue = function vpaIdToQrCodeValue(vpaId) {
9358
+ return "upi://pay?pa=".concat(vpaId);
9359
+ };
9360
+
9329
9361
  function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9330
9362
  function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9331
9363
  var UpiPayment = function UpiPayment(_ref) {
9332
- var _ref$vpas = _ref.vpas,
9333
- vpas = _ref$vpas === void 0 ? [] : _ref$vpas,
9364
+ var _ref$fee = _ref.fee,
9365
+ fee = _ref$fee === void 0 ? {} : _ref$fee,
9334
9366
  _ref$onSubmit = _ref.onSubmit,
9335
9367
  onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
9336
9368
  _ref$onBackClick = _ref.onBackClick,
@@ -9338,7 +9370,7 @@ var UpiPayment = function UpiPayment(_ref) {
9338
9370
  payableId = _ref.payableId;
9339
9371
  var _useTranslation = useTranslation(),
9340
9372
  t = _useTranslation.t;
9341
- var vpaIds = pluck("address", vpas).join(" ");
9373
+ var vpaIds = pluck("address", fee === null || fee === void 0 ? void 0 : fee.vpas);
9342
9374
  var _useCreateUpiPayment = useCreateUpiPayment({}),
9343
9375
  createPayment = _useCreateUpiPayment.mutate;
9344
9376
  var handleSubmit = function handleSubmit(values) {
@@ -9357,29 +9389,41 @@ var UpiPayment = function UpiPayment(_ref) {
9357
9389
  },
9358
9390
  validationSchema: VALIDATION_SCHEMA
9359
9391
  }
9360
- }, /*#__PURE__*/React__default.createElement(Typography, null, /*#__PURE__*/React__default.createElement(Trans, {
9361
- components: {
9362
- b: /*#__PURE__*/React__default.createElement("strong", null)
9363
- },
9364
- values: {
9365
- vpaIds: vpaIds
9366
- },
9367
- i18nKey: vpas.length > 1 ? "neetoPayments.upi.payment.vpasText" : "neetoPayments.upi.payment.vpaText"
9392
+ }, /*#__PURE__*/React__default.createElement(Typography, {
9393
+ style: "body1"
9394
+ }, t("neetoPayments.upi.payment.vpaText", {
9395
+ count: vpaIds.length
9396
+ })), isPresent(vpaIds) && /*#__PURE__*/React__default.createElement("div", {
9397
+ className: "grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2"
9398
+ }, vpaIds.map(function (vpaId) {
9399
+ return /*#__PURE__*/React__default.createElement("div", {
9400
+ className: "flex flex-col items-center justify-center",
9401
+ key: vpaId
9402
+ }, /*#__PURE__*/React__default.createElement(QRCodeImage, {
9403
+ size: 256,
9404
+ style: {
9405
+ width: 80,
9406
+ height: 80
9407
+ },
9408
+ value: vpaIdToQrCodeValue(vpaId)
9409
+ }), /*#__PURE__*/React__default.createElement(Typography, {
9410
+ className: "mt-2 w-full break-words text-center",
9411
+ style: "body2"
9412
+ }, vpaId));
9368
9413
  })), /*#__PURE__*/React__default.createElement(Input, {
9369
9414
  required: true,
9370
9415
  label: t("neetoPayments.upi.payment.transaction.label"),
9371
9416
  name: "transactionId",
9372
9417
  placeholder: t("neetoPayments.upi.payment.transaction.placeholder")
9373
- }), /*#__PURE__*/React__default.createElement("div", {
9374
- className: "flex space-x-4"
9375
- }, /*#__PURE__*/React__default.createElement(Button$1, {
9376
- label: t("neetoPayments.upi.payment.buttons.submit"),
9377
- type: "submit"
9378
- }), /*#__PURE__*/React__default.createElement(Button$1, {
9379
- label: t("neetoPayments.upi.payment.buttons.back"),
9380
- style: "secondary",
9381
- onClick: onBackClick
9382
- }))));
9418
+ }), /*#__PURE__*/React__default.createElement(ActionBlock, {
9419
+ cancelButtonProps: {
9420
+ label: t("neetoPayments.upi.payment.buttons.back"),
9421
+ onClick: onBackClick
9422
+ },
9423
+ submitButtonProps: {
9424
+ label: t("neetoPayments.upi.payment.buttons.submit")
9425
+ }
9426
+ })));
9383
9427
  };
9384
9428
 
9385
9429
  var TAB = {