@bigbinary/neeto-payments-frontend 6.3.5 → 6.3.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.
Files changed (59) hide show
  1. package/app/javascript/src/translations/ar.json +3 -3
  2. package/app/javascript/src/translations/bg.json +3 -3
  3. package/app/javascript/src/translations/ca.json +3 -3
  4. package/app/javascript/src/translations/cs.json +3 -3
  5. package/app/javascript/src/translations/da.json +3 -3
  6. package/app/javascript/src/translations/de.json +3 -3
  7. package/app/javascript/src/translations/en.json +3 -3
  8. package/app/javascript/src/translations/es-MX.json +3 -3
  9. package/app/javascript/src/translations/es.json +3 -3
  10. package/app/javascript/src/translations/et.json +3 -3
  11. package/app/javascript/src/translations/fi.json +3 -3
  12. package/app/javascript/src/translations/fil.json +3 -3
  13. package/app/javascript/src/translations/fr.json +3 -3
  14. package/app/javascript/src/translations/he.json +3 -3
  15. package/app/javascript/src/translations/hi.json +3 -3
  16. package/app/javascript/src/translations/hr.json +3 -3
  17. package/app/javascript/src/translations/hu.json +3 -3
  18. package/app/javascript/src/translations/id.json +3 -3
  19. package/app/javascript/src/translations/it.json +3 -3
  20. package/app/javascript/src/translations/ja.json +3 -3
  21. package/app/javascript/src/translations/ko.json +3 -3
  22. package/app/javascript/src/translations/nl.json +3 -3
  23. package/app/javascript/src/translations/pl.json +3 -3
  24. package/app/javascript/src/translations/pt-BR.json +3 -3
  25. package/app/javascript/src/translations/pt.json +3 -3
  26. package/app/javascript/src/translations/ro.json +3 -3
  27. package/app/javascript/src/translations/ru.json +3 -3
  28. package/app/javascript/src/translations/sk.json +3 -3
  29. package/app/javascript/src/translations/sl.json +3 -3
  30. package/app/javascript/src/translations/sv.json +3 -3
  31. package/app/javascript/src/translations/th.json +3 -3
  32. package/app/javascript/src/translations/tr.json +3 -3
  33. package/app/javascript/src/translations/uk.json +3 -3
  34. package/app/javascript/src/translations/vi.json +3 -3
  35. package/app/javascript/src/translations/zh-CN.json +3 -3
  36. package/app/javascript/src/translations/zh-TW.json +3 -3
  37. package/dist/ManualUpiPayment.js +96 -21
  38. package/dist/ManualUpiPayment.js.map +1 -1
  39. package/dist/ManualUpiPaymentConfirmButton.js +1 -1
  40. package/dist/ManualUpiPaymentRejectButton.js +1 -1
  41. package/dist/cjs/ManualUpiPayment.js +96 -21
  42. package/dist/cjs/ManualUpiPayment.js.map +1 -1
  43. package/dist/cjs/index.js +1 -0
  44. package/dist/cjs/index.js.map +1 -1
  45. package/dist/cjs/v2/ManualUpiPayment.js +88 -14
  46. package/dist/cjs/v2/ManualUpiPayment.js.map +1 -1
  47. package/dist/cjs/v2/index.js +1 -0
  48. package/dist/cjs/v2/index.js.map +1 -1
  49. package/dist/index.js +2 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/{usePaymentApi-C8fRdHmK.js → usePaymentApi-CjtkL3IU.js} +2 -2
  52. package/dist/{usePaymentApi-C8fRdHmK.js.map → usePaymentApi-CjtkL3IU.js.map} +1 -1
  53. package/dist/v2/ManualUpiPayment.js +88 -14
  54. package/dist/v2/ManualUpiPayment.js.map +1 -1
  55. package/dist/v2/ManualUpiPaymentConfirmButton.js +1 -1
  56. package/dist/v2/ManualUpiPaymentRejectButton.js +1 -1
  57. package/dist/v2/index.js +2 -1
  58. package/dist/v2/index.js.map +1 -1
  59. package/package.json +5 -5
@@ -4,15 +4,16 @@ var react = require('react');
4
4
  var activestorage = require('@rails/activestorage');
5
5
  var neetocist = require('neetocist');
6
6
  var neetoIcons = require('@bigbinary/neeto-icons');
7
- var neetoui = require('@bigbinary/neetoui');
8
- var formik = require('@bigbinary/neetoui/formik');
9
7
  var QRCodeImage = require('qrcode.react');
10
8
  var ramda = require('ramda');
11
9
  var reactI18next = require('react-i18next');
12
10
  var usePaymentApi = require('./usePaymentApi-CuL13mny.js');
11
+ var neetoui = require('@bigbinary/neetoui');
12
+ var formik$1 = require('@bigbinary/neetoui/formik');
13
13
  var constants = require('./index-CpEnC-Gq.js');
14
14
  var i18next = require('i18next');
15
15
  var yup = require('yup');
16
+ var formik = require('formik');
16
17
  var jsxRuntime = require('react/jsx-runtime');
17
18
  require('@tanstack/react-query');
18
19
  require('neetocommons/react-utils');
@@ -47,6 +48,7 @@ const DIRECT_UPLOAD_URL = "/rails/active_storage/direct_uploads";
47
48
  const INITIAL_VALUES = {
48
49
  identifier: ""
49
50
  };
51
+ const UPI_TRANSACTION_ID_LENGTH = 12;
50
52
  const buildValidationSchema = screenshotFile => yup__namespace.object({
51
53
  identifier: yup__namespace.number().typeError(i18next.t("neetoPayments.validations.invalidField", {
52
54
  entity: i18next.t("neetoPayments.common.transactionId")
@@ -57,6 +59,79 @@ const buildValidationSchema = screenshotFile => yup__namespace.object({
57
59
  }), value => neetocist.isNotPresent(value) || value?.toString().length === 12)
58
60
  });
59
61
 
62
+ const toSlots = value => Array.from({
63
+ length: UPI_TRANSACTION_ID_LENGTH
64
+ }, (_, index) => value[index] ?? "");
65
+ const UpiTransactionIdInput = ({
66
+ name = "identifier"
67
+ }) => {
68
+ const {
69
+ t
70
+ } = reactI18next.useTranslation();
71
+ const [, meta, helpers] = formik.useField(name);
72
+ const inputsRef = react.useRef([]);
73
+ const [slots, setSlots] = react.useState(() => toSlots((meta.initialValue ?? "").toString()));
74
+ const sync = nextSlots => {
75
+ setSlots(nextSlots);
76
+ helpers.setValue(nextSlots.join(""));
77
+ };
78
+ const setDigit = (index, digit) => sync(slots.map((slot, i) => i === index ? digit : slot));
79
+ const focusBox = index => inputsRef.current[index]?.focus();
80
+ const handleChange = (index, event) => {
81
+ const sanitized = event.target.value.replace(/\D/g, "");
82
+ setDigit(index, sanitized ? sanitized[sanitized.length - 1] : "");
83
+ if (sanitized && index < UPI_TRANSACTION_ID_LENGTH - 1) focusBox(index + 1);
84
+ };
85
+ const handleKeyDown = (index, event) => {
86
+ if (event.key === "Backspace" && !slots[index] && index > 0) {
87
+ event.preventDefault();
88
+ setDigit(index - 1, "");
89
+ focusBox(index - 1);
90
+ } else if (event.key === "ArrowLeft" && index > 0) {
91
+ focusBox(index - 1);
92
+ } else if (event.key === "ArrowRight" && index < UPI_TRANSACTION_ID_LENGTH - 1) {
93
+ focusBox(index + 1);
94
+ }
95
+ };
96
+ const handlePaste = event => {
97
+ event.preventDefault();
98
+ const pasted = event.clipboardData.getData("text").replace(/\D/g, "").slice(0, UPI_TRANSACTION_ID_LENGTH);
99
+ if (!pasted) return;
100
+ sync(toSlots(pasted));
101
+ focusBox(Math.min(pasted.length, UPI_TRANSACTION_ID_LENGTH - 1));
102
+ };
103
+ const showError = meta.touched && meta.error;
104
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
105
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
106
+ className: "mb-2",
107
+ style: "body2",
108
+ weight: "medium",
109
+ children: t("neetoPayments.upi.payment.transaction.label")
110
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
111
+ className: "flex flex-wrap gap-2",
112
+ onPaste: handlePaste,
113
+ children: slots.map((slot, index) => /*#__PURE__*/jsxRuntime.jsx("input", {
114
+ autoComplete: "off",
115
+ className: "h-10 w-8 neeto-ui-rounded border neeto-ui-border-gray-300 text-center text-base focus:neeto-ui-border-gray-500 focus:outline-none",
116
+ "data-testid": `upi-transaction-id-box-${index}`,
117
+ inputMode: "numeric",
118
+ maxLength: 1,
119
+ ref: element => inputsRef.current[index] = element,
120
+ type: "text",
121
+ value: slot,
122
+ onBlur: () => helpers.setTouched(true),
123
+ onChange: event => handleChange(index, event),
124
+ onFocus: event => event.target.select(),
125
+ onKeyDown: event => handleKeyDown(index, event)
126
+ }, index))
127
+ }), showError && /*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
128
+ className: "neeto-ui-text-error-500 mt-1",
129
+ style: "body3",
130
+ children: meta.error
131
+ })]
132
+ });
133
+ };
134
+
60
135
  const ManualUpiPayment = ({
61
136
  fee,
62
137
  payableId,
@@ -135,7 +210,7 @@ const ManualUpiPayment = ({
135
210
  paymentScreenshot
136
211
  });
137
212
  };
138
- return /*#__PURE__*/jsxRuntime.jsx(formik.Form, {
213
+ return /*#__PURE__*/jsxRuntime.jsx(formik$1.Form, {
139
214
  className: "space-y-4",
140
215
  formikProps: {
141
216
  onSubmit: handleSubmit,
@@ -146,42 +221,41 @@ const ManualUpiPayment = ({
146
221
  dirty
147
222
  }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
148
223
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
149
- style: "body1",
224
+ className: "neeto-ui-text-gray-600",
225
+ style: "body2",
150
226
  children: t("neetoPayments.upi.payment.vpaText", {
151
227
  count: vpaIds.length
152
228
  })
153
229
  }), neetocist.isPresent(vpaIds) && /*#__PURE__*/jsxRuntime.jsx("div", {
154
- className: "grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2",
230
+ className: "flex flex-wrap gap-8",
155
231
  children: vpaIds.map(vpaId => /*#__PURE__*/jsxRuntime.jsxs("div", {
156
232
  className: "flex flex-col items-center justify-center",
157
233
  children: [/*#__PURE__*/jsxRuntime.jsx(QRCodeImage, {
158
234
  size: 256,
159
235
  style: {
160
- width: 80,
161
- height: 80
236
+ width: 120,
237
+ height: 120
162
238
  },
163
239
  value: constants.getQrCodeValue(vpaId, amountToUpi)
164
240
  }), /*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
165
241
  className: "w-full mt-2 text-center wrap-break-word",
166
242
  style: "body2",
243
+ weight: "medium",
167
244
  children: vpaId
168
245
  })]
169
246
  }, vpaId))
170
- }), /*#__PURE__*/jsxRuntime.jsx(formik.Input, {
171
- label: t("neetoPayments.upi.payment.transaction.label"),
172
- name: "identifier",
173
- placeholder: t("neetoPayments.upi.payment.transaction.placeholder"),
174
- type: "number"
247
+ }), /*#__PURE__*/jsxRuntime.jsx(UpiTransactionIdInput, {
248
+ name: "identifier"
175
249
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
176
250
  className: "flex items-center gap-3",
177
251
  children: [/*#__PURE__*/jsxRuntime.jsx("hr", {
178
- className: "flex-1 border-gray-300"
252
+ className: "flex-1 neeto-ui-border-gray-300"
179
253
  }), /*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
180
- className: "text-gray-500 uppercase",
254
+ className: "neeto-ui-text-gray-500 uppercase",
181
255
  style: "body2",
182
256
  children: t("neetoPayments.common.or")
183
257
  }), /*#__PURE__*/jsxRuntime.jsx("hr", {
184
- className: "flex-1 border-gray-300"
258
+ className: "flex-1 neeto-ui-border-gray-300"
185
259
  })]
186
260
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
187
261
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
@@ -193,7 +267,7 @@ const ManualUpiPayment = ({
193
267
  className: "relative inline-block",
194
268
  children: [/*#__PURE__*/jsxRuntime.jsx("img", {
195
269
  alt: t("neetoPayments.upi.payment.screenshot.alt"),
196
- className: "max-h-40 rounded border border-gray-200",
270
+ className: "max-h-40 neeto-ui-rounded border neeto-ui-border-gray-200",
197
271
  src: screenshotPreview
198
272
  }), /*#__PURE__*/jsxRuntime.jsx(neetoui.Button, {
199
273
  className: "absolute -right-2 -top-2 neeto-ui-rounded-full neeto-ui-bg-white neeto-ui-shadow-sm",
@@ -203,7 +277,7 @@ const ManualUpiPayment = ({
203
277
  onClick: handleRemoveScreenshot
204
278
  })]
205
279
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
206
- className: "flex cursor-pointer flex-col items-center justify-center rounded border-2 border-dashed border-gray-300 p-6 transition-colors hover:border-gray-400",
280
+ className: "flex cursor-pointer flex-col items-center justify-center neeto-ui-rounded border-2 border-dashed neeto-ui-border-gray-300 p-6 transition-colors hover:neeto-ui-border-gray-400",
207
281
  role: "button",
208
282
  tabIndex: 0,
209
283
  onClick: () => fileInputRef.current?.click(),
@@ -213,13 +287,14 @@ const ManualUpiPayment = ({
213
287
  }
214
288
  },
215
289
  children: [/*#__PURE__*/jsxRuntime.jsx("i", {
216
- className: "ri-upload-2-line text-2xl text-gray-400"
290
+ className: "ri-upload-2-line text-2xl neeto-ui-text-gray-400"
217
291
  }), /*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
218
- className: "mt-1 text-gray-500",
292
+ className: "mt-1 text-blue-600 hover:underline",
219
293
  style: "body3",
294
+ weight: "medium",
220
295
  children: t("neetoPayments.upi.payment.screenshot.uploadText")
221
296
  }), /*#__PURE__*/jsxRuntime.jsx(neetoui.Typography, {
222
- className: "text-gray-400",
297
+ className: "neeto-ui-text-gray-400",
223
298
  style: "nano",
224
299
  children: t("neetoPayments.upi.payment.screenshot.formatHint", {
225
300
  maxSize: MAX_SCREENSHOT_SIZE_MB
@@ -233,7 +308,7 @@ const ManualUpiPayment = ({
233
308
  type: "file",
234
309
  onChange: handleScreenshotSelect
235
310
  })]
236
- }), /*#__PURE__*/jsxRuntime.jsx(formik.ActionBlock, {
311
+ }), /*#__PURE__*/jsxRuntime.jsx(formik$1.ActionBlock, {
237
312
  cancelButtonProps: {
238
313
  label: t("neetoPayments.upi.payment.buttons.back"),
239
314
  onClick: handleCancel,
@@ -1 +1 @@
1
- {"version":3,"file":"ManualUpiPayment.js","sources":["../../app/javascript/src/components/ManualUpiPayment/constants.js","../../app/javascript/src/components/ManualUpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isPresent, isNotPresent } from \"neetocist\";\nimport * as yup from \"yup\";\n\nexport const ACCEPTED_SCREENSHOT_FORMATS = \"image/png,image/jpeg,image/jpg\";\n\nexport const MAX_SCREENSHOT_SIZE_MB = 5;\n\nexport const DIRECT_UPLOAD_URL = \"/rails/active_storage/direct_uploads\";\n\nexport const INITIAL_VALUES = { identifier: \"\" };\n\nexport const buildValidationSchema = screenshotFile =>\n yup.object({\n identifier: yup\n .number()\n .typeError(\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n })\n )\n .nullable()\n .transform((value, originalValue) =>\n originalValue === \"\" ? null : value\n )\n .test(\n \"identifier-or-screenshot\",\n t(\"neetoPayments.upi.payment.transaction.identifierOrScreenshot\"),\n value => isPresent(value) || isPresent(screenshotFile)\n )\n .test(\n \"is-integer\",\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n }),\n value => isNotPresent(value) || Number.isInteger(value)\n )\n .test(\n \"len\",\n t(\"neetoPayments.validations.length\", { length: 12 }),\n value => isNotPresent(value) || value?.toString().length === 12\n ),\n });\n","import { useRef, useState, useMemo, useEffect } from \"react\";\n\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { noop, isPresent } from \"neetocist\";\nimport { Close } from \"neetoicons\";\nimport { Button, Toastr, Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\nimport { getQrCodeValue } from \"utils\";\n\nimport {\n buildValidationSchema,\n ACCEPTED_SCREENSHOT_FORMATS,\n MAX_SCREENSHOT_SIZE_MB,\n DIRECT_UPLOAD_URL,\n INITIAL_VALUES,\n} from \"./constants\";\n\nconst ManualUpiPayment = ({\n fee,\n payableId,\n tip,\n amount,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n const fileInputRef = useRef(null);\n const [screenshotFile, setScreenshotFile] = useState(null);\n const [isUploading, setIsUploading] = useState(false);\n\n const screenshotPreview = useMemo(\n () => (screenshotFile ? URL.createObjectURL(screenshotFile) : null),\n [screenshotFile]\n );\n\n useEffect(\n () => () => {\n if (screenshotPreview) URL.revokeObjectURL(screenshotPreview);\n },\n [screenshotPreview]\n );\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n const amountToUpi = customAmount || amount;\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const validationSchema = useMemo(\n () => buildValidationSchema(screenshotFile),\n [screenshotFile]\n );\n\n const handleScreenshotSelect = event => {\n const file = event.target.files[0];\n if (!file) return;\n\n if (file.size > MAX_SCREENSHOT_SIZE_MB * 1024 * 1024) {\n Toastr.error(\n t(\"neetoPayments.upi.payment.screenshot.tooLarge\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })\n );\n\n return;\n }\n\n setScreenshotFile(file);\n };\n\n const handleRemoveScreenshot = () => {\n setScreenshotFile(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const uploadScreenshot = file =>\n new Promise((resolve, reject) => {\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL);\n upload.create((error, blob) => {\n if (error) reject(error);\n else resolve(blob.signed_id);\n });\n });\n\n const handleSubmit = async values => {\n onBeforePayment();\n\n let paymentScreenshot = null;\n if (screenshotFile) {\n try {\n setIsUploading(true);\n paymentScreenshot = await uploadScreenshot(screenshotFile);\n } catch {\n onFailedPayment();\n\n return;\n } finally {\n setIsUploading(false);\n }\n }\n\n createPayment({\n ...values,\n payableId,\n customAmount,\n payableType,\n discountCode,\n tipAttributes: tip,\n paymentScreenshot,\n });\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: INITIAL_VALUES,\n validationSchema,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={getQrCodeValue(vpaId, amountToUpi)}\n />\n <Typography\n className=\"w-full mt-2 text-center wrap-break-word\"\n style=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\"neetoPayments.upi.payment.transaction.placeholder\")}\n type=\"number\"\n />\n <div className=\"flex items-center gap-3\">\n <hr className=\"flex-1 border-gray-300\" />\n <Typography className=\"text-gray-500 uppercase\" style=\"body2\">\n {t(\"neetoPayments.common.or\")}\n </Typography>\n <hr className=\"flex-1 border-gray-300\" />\n </div>\n <div>\n <Typography className=\"mb-2\" style=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.screenshot.label\")}\n </Typography>\n {screenshotPreview ? (\n <div className=\"relative inline-block\">\n <img\n alt={t(\"neetoPayments.upi.payment.screenshot.alt\")}\n className=\"max-h-40 rounded border border-gray-200\"\n src={screenshotPreview}\n />\n <Button\n className=\"absolute -right-2 -top-2 neeto-ui-rounded-full neeto-ui-bg-white neeto-ui-shadow-sm\"\n icon={Close}\n size=\"small\"\n style=\"text\"\n onClick={handleRemoveScreenshot}\n />\n </div>\n ) : (\n <div\n className=\"flex cursor-pointer flex-col items-center justify-center rounded border-2 border-dashed border-gray-300 p-6 transition-colors hover:border-gray-400\"\n role=\"button\"\n tabIndex={0}\n onClick={() => fileInputRef.current?.click()}\n onKeyDown={e => {\n if (e.key === \"Enter\" || e.key === \" \") {\n fileInputRef.current?.click();\n }\n }}\n >\n <i className=\"ri-upload-2-line text-2xl text-gray-400\" />\n <Typography className=\"mt-1 text-gray-500\" style=\"body3\">\n {t(\"neetoPayments.upi.payment.screenshot.uploadText\")}\n </Typography>\n <Typography className=\"text-gray-400\" style=\"nano\">\n {t(\"neetoPayments.upi.payment.screenshot.formatHint\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })}\n </Typography>\n </div>\n )}\n <input\n accept={ACCEPTED_SCREENSHOT_FORMATS}\n className=\"hidden\"\n data-testid=\"manual-upi-screenshot-upload-input-field\"\n ref={fileInputRef}\n type=\"file\"\n onChange={handleScreenshotSelect}\n />\n </div>\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: (!dirty && !screenshotFile) || isPending || isUploading,\n loading: isPending || isUploading,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default ManualUpiPayment;\n"],"names":["ACCEPTED_SCREENSHOT_FORMATS","MAX_SCREENSHOT_SIZE_MB","DIRECT_UPLOAD_URL","INITIAL_VALUES","identifier","buildValidationSchema","screenshotFile","yup","object","number","typeError","t","entity","nullable","transform","value","originalValue","test","isPresent","isNotPresent","Number","isInteger","length","toString","ManualUpiPayment","fee","payableId","tip","amount","discountCode","customAmount","handleCancel","payableType","onBeforePayment","noop","onFailedPayment","onSuccessfulPayment","useTranslation","fileInputRef","useRef","setScreenshotFile","useState","isUploading","setIsUploading","screenshotPreview","useMemo","URL","createObjectURL","useEffect","revokeObjectURL","vpaIds","pluck","vpas","amountToUpi","isPending","mutate","createPayment","useCreateUpiPayment","onSuccess","onError","validationSchema","handleScreenshotSelect","event","file","target","files","size","Toastr","error","maxSize","handleRemoveScreenshot","current","uploadScreenshot","Promise","resolve","reject","upload","DirectUpload","create","blob","signed_id","handleSubmit","values","paymentScreenshot","tipAttributes","_jsx","Form","className","formikProps","onSubmit","initialValues","children","dirty","_jsxs","_Fragment","Typography","style","count","map","vpaId","QRCodeImage","width","height","getQrCodeValue","Input","label","name","placeholder","type","weight","alt","src","Button","icon","Close","onClick","role","tabIndex","click","onKeyDown","e","key","accept","ref","onChange","ActionBlock","cancelButtonProps","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,2BAA2B,GAAG,gCAAgC;AAEpE,MAAMC,sBAAsB,GAAG,CAAC;AAEhC,MAAMC,iBAAiB,GAAG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I,EAAC,MAAM;AACXgB,UAAAA,QAAQ,EAAE/D;AAAuB,SAClC,CAAC;AAAA,OACC,CAAC,eACNwB,cAAA,CAACwC,kBAAW,EAAA;AACVC,QAAAA,iBAAiB,EAAE;AACjBrB,UAAAA,KAAK,EAAE9F,CAAC,CAAC,wCAAwC,CAAC;AAClDwG,UAAAA,OAAO,EAAEpF,YAAY;AACrBgG,UAAAA,QAAQ,EAAEzE;SACV;AACF0E,QAAAA,iBAAiB,EAAE;AACjBvB,UAAAA,KAAK,EAAE9F,CAAC,CAAC,0CAA0C,CAAC;UACpDoH,QAAQ,EAAG,CAACnC,KAAK,IAAI,CAACtF,cAAc,IAAKgD,SAAS,IAAIZ,WAAW;UACjEuF,OAAO,EAAE3E,SAAS,IAAIZ;AACxB;AAAE,OACH,CAAC;KACF;AACH,GACG,CAAC;AAEX;;;;"}
1
+ {"version":3,"file":"ManualUpiPayment.js","sources":["../../app/javascript/src/components/ManualUpiPayment/constants.js","../../app/javascript/src/components/ManualUpiPayment/UpiTransactionIdInput.jsx","../../app/javascript/src/components/ManualUpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isPresent, isNotPresent } from \"neetocist\";\nimport * as yup from \"yup\";\n\nexport const ACCEPTED_SCREENSHOT_FORMATS = \"image/png,image/jpeg,image/jpg\";\n\nexport const MAX_SCREENSHOT_SIZE_MB = 5;\n\nexport const DIRECT_UPLOAD_URL = \"/rails/active_storage/direct_uploads\";\n\nexport const INITIAL_VALUES = { identifier: \"\" };\n\nexport const UPI_TRANSACTION_ID_LENGTH = 12;\n\nexport const buildValidationSchema = screenshotFile =>\n yup.object({\n identifier: yup\n .number()\n .typeError(\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n })\n )\n .nullable()\n .transform((value, originalValue) =>\n originalValue === \"\" ? null : value\n )\n .test(\n \"identifier-or-screenshot\",\n t(\"neetoPayments.upi.payment.transaction.identifierOrScreenshot\"),\n value => isPresent(value) || isPresent(screenshotFile)\n )\n .test(\n \"is-integer\",\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n }),\n value => isNotPresent(value) || Number.isInteger(value)\n )\n .test(\n \"len\",\n t(\"neetoPayments.validations.length\", { length: 12 }),\n value => isNotPresent(value) || value?.toString().length === 12\n ),\n });\n","import { useRef, useState } from \"react\";\n\nimport { useField } from \"formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Typography } from \"neetoui\";\n\nimport { UPI_TRANSACTION_ID_LENGTH as LENGTH } from \"./constants\";\n\nconst toSlots = value =>\n Array.from({ length: LENGTH }, (_, index) => value[index] ?? \"\");\n\nconst UpiTransactionIdInput = ({ name = \"identifier\" }) => {\n const { t } = useTranslation();\n const [, meta, helpers] = useField(name);\n const inputsRef = useRef([]);\n const [slots, setSlots] = useState(() =>\n toSlots((meta.initialValue ?? \"\").toString())\n );\n\n const sync = nextSlots => {\n setSlots(nextSlots);\n helpers.setValue(nextSlots.join(\"\"));\n };\n\n const setDigit = (index, digit) =>\n sync(slots.map((slot, i) => (i === index ? digit : slot)));\n\n const focusBox = index => inputsRef.current[index]?.focus();\n\n const handleChange = (index, event) => {\n const sanitized = event.target.value.replace(/\\D/g, \"\");\n setDigit(index, sanitized ? sanitized[sanitized.length - 1] : \"\");\n if (sanitized && index < LENGTH - 1) focusBox(index + 1);\n };\n\n const handleKeyDown = (index, event) => {\n if (event.key === \"Backspace\" && !slots[index] && index > 0) {\n event.preventDefault();\n setDigit(index - 1, \"\");\n focusBox(index - 1);\n } else if (event.key === \"ArrowLeft\" && index > 0) {\n focusBox(index - 1);\n } else if (event.key === \"ArrowRight\" && index < LENGTH - 1) {\n focusBox(index + 1);\n }\n };\n\n const handlePaste = event => {\n event.preventDefault();\n const pasted = event.clipboardData\n .getData(\"text\")\n .replace(/\\D/g, \"\")\n .slice(0, LENGTH);\n if (!pasted) return;\n\n sync(toSlots(pasted));\n focusBox(Math.min(pasted.length, LENGTH - 1));\n };\n\n const showError = meta.touched && meta.error;\n\n return (\n <div>\n <Typography className=\"mb-2\" style=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.transaction.label\")}\n </Typography>\n <div className=\"flex flex-wrap gap-2\" onPaste={handlePaste}>\n {slots.map((slot, index) => (\n <input\n autoComplete=\"off\"\n className=\"h-10 w-8 neeto-ui-rounded border neeto-ui-border-gray-300 text-center text-base focus:neeto-ui-border-gray-500 focus:outline-none\"\n data-testid={`upi-transaction-id-box-${index}`}\n inputMode=\"numeric\"\n key={index}\n maxLength={1}\n ref={element => (inputsRef.current[index] = element)}\n type=\"text\"\n value={slot}\n onBlur={() => helpers.setTouched(true)}\n onChange={event => handleChange(index, event)}\n onFocus={event => event.target.select()}\n onKeyDown={event => handleKeyDown(index, event)}\n />\n ))}\n </div>\n {showError && (\n <Typography className=\"neeto-ui-text-error-500 mt-1\" style=\"body3\">\n {meta.error}\n </Typography>\n )}\n </div>\n );\n};\n\nexport default UpiTransactionIdInput;\n","import { useRef, useState, useMemo, useEffect } from \"react\";\n\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { noop, isPresent } from \"neetocist\";\nimport { Close } from \"neetoicons\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\nimport { Button, Toastr, Typography } from \"neetoui\";\nimport { ActionBlock, Form } from \"neetoui/formik\";\nimport { getQrCodeValue } from \"utils\";\n\nimport {\n buildValidationSchema,\n ACCEPTED_SCREENSHOT_FORMATS,\n MAX_SCREENSHOT_SIZE_MB,\n DIRECT_UPLOAD_URL,\n INITIAL_VALUES,\n} from \"./constants\";\nimport UpiTransactionIdInput from \"./UpiTransactionIdInput\";\n\nconst ManualUpiPayment = ({\n fee,\n payableId,\n tip,\n amount,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n const fileInputRef = useRef(null);\n const [screenshotFile, setScreenshotFile] = useState(null);\n const [isUploading, setIsUploading] = useState(false);\n\n const screenshotPreview = useMemo(\n () => (screenshotFile ? URL.createObjectURL(screenshotFile) : null),\n [screenshotFile]\n );\n\n useEffect(\n () => () => {\n if (screenshotPreview) URL.revokeObjectURL(screenshotPreview);\n },\n [screenshotPreview]\n );\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n const amountToUpi = customAmount || amount;\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const validationSchema = useMemo(\n () => buildValidationSchema(screenshotFile),\n [screenshotFile]\n );\n\n const handleScreenshotSelect = event => {\n const file = event.target.files[0];\n if (!file) return;\n\n if (file.size > MAX_SCREENSHOT_SIZE_MB * 1024 * 1024) {\n Toastr.error(\n t(\"neetoPayments.upi.payment.screenshot.tooLarge\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })\n );\n\n return;\n }\n\n setScreenshotFile(file);\n };\n\n const handleRemoveScreenshot = () => {\n setScreenshotFile(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const uploadScreenshot = file =>\n new Promise((resolve, reject) => {\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL);\n upload.create((error, blob) => {\n if (error) reject(error);\n else resolve(blob.signed_id);\n });\n });\n\n const handleSubmit = async values => {\n onBeforePayment();\n\n let paymentScreenshot = null;\n if (screenshotFile) {\n try {\n setIsUploading(true);\n paymentScreenshot = await uploadScreenshot(screenshotFile);\n } catch {\n onFailedPayment();\n\n return;\n } finally {\n setIsUploading(false);\n }\n }\n\n createPayment({\n ...values,\n payableId,\n customAmount,\n payableType,\n discountCode,\n tipAttributes: tip,\n paymentScreenshot,\n });\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: INITIAL_VALUES,\n validationSchema,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography className=\"neeto-ui-text-gray-600\" style=\"body2\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"flex flex-wrap gap-8\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 120, height: 120 }}\n value={getQrCodeValue(vpaId, amountToUpi)}\n />\n <Typography\n className=\"w-full mt-2 text-center wrap-break-word\"\n style=\"body2\"\n weight=\"medium\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <UpiTransactionIdInput name=\"identifier\" />\n <div className=\"flex items-center gap-3\">\n <hr className=\"flex-1 neeto-ui-border-gray-300\" />\n <Typography\n className=\"neeto-ui-text-gray-500 uppercase\"\n style=\"body2\"\n >\n {t(\"neetoPayments.common.or\")}\n </Typography>\n <hr className=\"flex-1 neeto-ui-border-gray-300\" />\n </div>\n <div>\n <Typography className=\"mb-2\" style=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.screenshot.label\")}\n </Typography>\n {screenshotPreview ? (\n <div className=\"relative inline-block\">\n <img\n alt={t(\"neetoPayments.upi.payment.screenshot.alt\")}\n className=\"max-h-40 neeto-ui-rounded border neeto-ui-border-gray-200\"\n src={screenshotPreview}\n />\n <Button\n className=\"absolute -right-2 -top-2 neeto-ui-rounded-full neeto-ui-bg-white neeto-ui-shadow-sm\"\n icon={Close}\n size=\"small\"\n style=\"text\"\n onClick={handleRemoveScreenshot}\n />\n </div>\n ) : (\n <div\n className=\"flex cursor-pointer flex-col items-center justify-center neeto-ui-rounded border-2 border-dashed neeto-ui-border-gray-300 p-6 transition-colors hover:neeto-ui-border-gray-400\"\n role=\"button\"\n tabIndex={0}\n onClick={() => fileInputRef.current?.click()}\n onKeyDown={e => {\n if (e.key === \"Enter\" || e.key === \" \") {\n fileInputRef.current?.click();\n }\n }}\n >\n <i className=\"ri-upload-2-line text-2xl neeto-ui-text-gray-400\" />\n <Typography\n className=\"mt-1 text-blue-600 hover:underline\"\n style=\"body3\"\n weight=\"medium\"\n >\n {t(\"neetoPayments.upi.payment.screenshot.uploadText\")}\n </Typography>\n <Typography className=\"neeto-ui-text-gray-400\" style=\"nano\">\n {t(\"neetoPayments.upi.payment.screenshot.formatHint\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })}\n </Typography>\n </div>\n )}\n <input\n accept={ACCEPTED_SCREENSHOT_FORMATS}\n className=\"hidden\"\n data-testid=\"manual-upi-screenshot-upload-input-field\"\n ref={fileInputRef}\n type=\"file\"\n onChange={handleScreenshotSelect}\n />\n </div>\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: (!dirty && !screenshotFile) || isPending || isUploading,\n loading: isPending || isUploading,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default ManualUpiPayment;\n"],"names":["ACCEPTED_SCREENSHOT_FORMATS","MAX_SCREENSHOT_SIZE_MB","DIRECT_UPLOAD_URL","INITIAL_VALUES","identifier","UPI_TRANSACTION_ID_LENGTH","buildValidationSchema","screenshotFile","yup","object","number","typeError","t","entity","nullable","transform","value","originalValue","test","isPresent","isNotPresent","Number","isInteger","length","toString","toSlots","Array","from","LENGTH","_","index","UpiTransactionIdInput","name","useTranslation","meta","helpers","useField","inputsRef","useRef","slots","setSlots","useState","initialValue","sync","nextSlots","setValue","join","setDigit","digit","map","slot","i","focusBox","current","focus","handleChange","event","sanitized","target","replace","handleKeyDown","key","preventDefault","handlePaste","pasted","clipboardData","getData","slice","Math","min","showError","touched","error","_jsxs","children","_jsx","Typography","className","style","weight","onPaste","autoComplete","inputMode","maxLength","ref","element","type","onBlur","setTouched","onChange","onFocus","select","onKeyDown","ManualUpiPayment","fee","payableId","tip","amount","discountCode","customAmount","handleCancel","payableType","onBeforePayment","noop","onFailedPayment","onSuccessfulPayment","fileInputRef","setScreenshotFile","isUploading","setIsUploading","screenshotPreview","useMemo","URL","createObjectURL","useEffect","revokeObjectURL","vpaIds","pluck","vpas","amountToUpi","isPending","mutate","createPayment","useCreateUpiPayment","onSuccess","onError","validationSchema","handleScreenshotSelect","file","files","size","Toastr","maxSize","handleRemoveScreenshot","uploadScreenshot","Promise","resolve","reject","upload","DirectUpload","create","blob","signed_id","handleSubmit","values","paymentScreenshot","tipAttributes","Form","formikProps","onSubmit","initialValues","dirty","_Fragment","count","vpaId","QRCodeImage","width","height","getQrCodeValue","alt","src","Button","icon","Close","onClick","role","tabIndex","click","e","accept","ActionBlock","cancelButtonProps","label","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,2BAA2B,GAAG,gCAAgC;AAEpE,MAAMC,sBAAsB,GAAG,CAAC;AAEhC,MAAMC,iBAAiB,GAAG,sCAAsC;AAEhE,MAAMC,cAAc,GAAG;AAAEC,EAAAA,UAAU,EAAE;AAAG,CAAC;AAEzC,MAAMC,yBAAyB,GAAG,EAAE;AAEpC,MAAMC,qBAAqB,GAAGC,cAAc,IACjDC,cAAG,CAACC,MAAM,CAAC;AACTL,EAAAA,UAAU,EAAEI,cAAG,CACZE,MAAM,EAAE,CACRC,SAAS,CACRC,SAAC,CAAC,wCAAwC,EAAE;IAC1CC,MAAM,EAAED,SAAC,CAAC,oCAAoC;GAC/C,CACH,CAAC,CACAE,QAAQ,EAAE,CACVC,SAAS,CAAC,CAACC,KAAK,EAAEC,aAAa,KAC9BA,aAAa,KAAK,EAAE,GAAG,IAAI,GAAGD,KAChC,CAAC,CACAE,IAAI,CACH,0BAA0B,EAC1BN,SAAC,CAAC,8DAA8D,CAAC,EACjEI,KAAK,IAAIG,mBAAS,CAACH,KAAK,CAAC,IAA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CAAC,wCAAwC,CAAC;AAClDwJ,UAAAA,OAAO,EAAEhE,YAAY;AACrByE,UAAAA,QAAQ,EAAErD;SACV;AACFsD,QAAAA,iBAAiB,EAAE;AACjBF,UAAAA,KAAK,EAAEhK,CAAC,CAAC,0CAA0C,CAAC;UACpDiK,QAAQ,EAAG,CAACtB,KAAK,IAAI,CAAChJ,cAAc,IAAKiH,SAAS,IAAIZ,WAAW;UACjEmE,OAAO,EAAEvD,SAAS,IAAIZ;AACxB;AAAE,OACH,CAAC;KACF;AACH,GACG,CAAC;AAEX;;;;"}
package/dist/cjs/index.js CHANGED
@@ -69,6 +69,7 @@ require('@bigbinary/neeto-molecules/MoreDropdown');
69
69
  require('@rails/activestorage');
70
70
  require('qrcode.react');
71
71
  require('./usePaymentApi-CuL13mny.js');
72
+ require('formik');
72
73
  require('./ExportModal-DwLOAhIs.js');
73
74
  require('./useExportsApi-rYuPpXWl.js');
74
75
  require('./usePaymentsApi-ZomyqUIJ.js');
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var react = require('react');
4
4
  var neetoAtoms = require('@bigbinary/neeto-atoms');
5
- var formik = require('@bigbinary/neeto-atoms/formik');
5
+ var formik$1 = require('@bigbinary/neeto-atoms/formik');
6
6
  var activestorage = require('@rails/activestorage');
7
7
  var lucideReact = require('lucide-react');
8
8
  var neetocist = require('neetocist');
@@ -13,6 +13,7 @@ var usePaymentApi = require('../usePaymentApi-CuL13mny.js');
13
13
  var constants = require('../index-CpEnC-Gq.js');
14
14
  var i18next = require('i18next');
15
15
  var yup = require('yup');
16
+ var formik = require('formik');
16
17
  var jsxRuntime = require('react/jsx-runtime');
17
18
  require('@tanstack/react-query');
18
19
  require('neetocommons/react-utils');
@@ -47,6 +48,7 @@ const DIRECT_UPLOAD_URL = "/rails/active_storage/direct_uploads";
47
48
  const INITIAL_VALUES = {
48
49
  identifier: ""
49
50
  };
51
+ const UPI_TRANSACTION_ID_LENGTH = 12;
50
52
  const buildValidationSchema = screenshotFile => yup__namespace.object({
51
53
  identifier: yup__namespace.number().typeError(i18next.t("neetoPayments.validations.invalidField", {
52
54
  entity: i18next.t("neetoPayments.common.transactionId")
@@ -57,6 +59,79 @@ const buildValidationSchema = screenshotFile => yup__namespace.object({
57
59
  }), value => neetocist.isNotPresent(value) || value?.toString().length === 12)
58
60
  });
59
61
 
62
+ const toSlots = value => Array.from({
63
+ length: UPI_TRANSACTION_ID_LENGTH
64
+ }, (_, index) => value[index] ?? "");
65
+ const UpiTransactionIdInput = ({
66
+ name = "identifier"
67
+ }) => {
68
+ const {
69
+ t
70
+ } = reactI18next.useTranslation();
71
+ const [, meta, helpers] = formik.useField(name);
72
+ const inputsRef = react.useRef([]);
73
+ const [slots, setSlots] = react.useState(() => toSlots((meta.initialValue ?? "").toString()));
74
+ const sync = nextSlots => {
75
+ setSlots(nextSlots);
76
+ helpers.setValue(nextSlots.join(""));
77
+ };
78
+ const setDigit = (index, digit) => sync(slots.map((slot, i) => i === index ? digit : slot));
79
+ const focusBox = index => inputsRef.current[index]?.focus();
80
+ const handleChange = (index, event) => {
81
+ const sanitized = event.target.value.replace(/\D/g, "");
82
+ setDigit(index, sanitized ? sanitized[sanitized.length - 1] : "");
83
+ if (sanitized && index < UPI_TRANSACTION_ID_LENGTH - 1) focusBox(index + 1);
84
+ };
85
+ const handleKeyDown = (index, event) => {
86
+ if (event.key === "Backspace" && !slots[index] && index > 0) {
87
+ event.preventDefault();
88
+ setDigit(index - 1, "");
89
+ focusBox(index - 1);
90
+ } else if (event.key === "ArrowLeft" && index > 0) {
91
+ focusBox(index - 1);
92
+ } else if (event.key === "ArrowRight" && index < UPI_TRANSACTION_ID_LENGTH - 1) {
93
+ focusBox(index + 1);
94
+ }
95
+ };
96
+ const handlePaste = event => {
97
+ event.preventDefault();
98
+ const pasted = event.clipboardData.getData("text").replace(/\D/g, "").slice(0, UPI_TRANSACTION_ID_LENGTH);
99
+ if (!pasted) return;
100
+ sync(toSlots(pasted));
101
+ focusBox(Math.min(pasted.length, UPI_TRANSACTION_ID_LENGTH - 1));
102
+ };
103
+ const showError = meta.touched && meta.error;
104
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
105
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
106
+ className: "mb-2",
107
+ variant: "body2",
108
+ weight: "medium",
109
+ children: t("neetoPayments.upi.payment.transaction.label")
110
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
111
+ className: "flex flex-wrap gap-2",
112
+ onPaste: handlePaste,
113
+ children: slots.map((slot, index) => /*#__PURE__*/jsxRuntime.jsx("input", {
114
+ autoComplete: "off",
115
+ className: "h-10 w-8 neeto-ui-rounded border neeto-ui-border-gray-300 text-center text-base focus:neeto-ui-border-gray-500 focus:outline-none",
116
+ "data-testid": `upi-transaction-id-box-${index}`,
117
+ inputMode: "numeric",
118
+ maxLength: 1,
119
+ ref: element => inputsRef.current[index] = element,
120
+ type: "text",
121
+ value: slot,
122
+ onBlur: () => helpers.setTouched(true),
123
+ onChange: event => handleChange(index, event),
124
+ onFocus: event => event.target.select(),
125
+ onKeyDown: event => handleKeyDown(index, event)
126
+ }, index))
127
+ }), showError && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
128
+ className: "neeto-ui-text-error-500 mt-1",
129
+ variant: "body3",
130
+ children: meta.error
131
+ })]
132
+ });
133
+ };
134
+
60
135
  const ManualUpiPayment = ({
61
136
  fee,
62
137
  payableId,
@@ -135,7 +210,7 @@ const ManualUpiPayment = ({
135
210
  paymentScreenshot
136
211
  });
137
212
  };
138
- return /*#__PURE__*/jsxRuntime.jsx(formik.Form, {
213
+ return /*#__PURE__*/jsxRuntime.jsx(formik$1.Form, {
139
214
  className: "space-y-4",
140
215
  formikProps: {
141
216
  onSubmit: handleSubmit,
@@ -146,32 +221,31 @@ const ManualUpiPayment = ({
146
221
  dirty
147
222
  }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
148
223
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
149
- variant: "body1",
224
+ className: "neeto-ui-text-gray-600",
225
+ variant: "body2",
150
226
  children: t("neetoPayments.upi.payment.vpaText", {
151
227
  count: vpaIds.length
152
228
  })
153
229
  }), neetocist.isPresent(vpaIds) && /*#__PURE__*/jsxRuntime.jsx("div", {
154
- className: "grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2",
230
+ className: "flex flex-wrap gap-8",
155
231
  children: vpaIds.map(vpaId => /*#__PURE__*/jsxRuntime.jsxs("div", {
156
232
  className: "flex flex-col items-center justify-center",
157
233
  children: [/*#__PURE__*/jsxRuntime.jsx(QRCodeImage, {
158
234
  size: 256,
159
235
  style: {
160
- width: 80,
161
- height: 80
236
+ width: 120,
237
+ height: 120
162
238
  },
163
239
  value: constants.getQrCodeValue(vpaId, amountToUpi)
164
240
  }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
165
241
  className: "w-full mt-2 text-center wrap-break-word",
166
242
  variant: "body2",
243
+ weight: "medium",
167
244
  children: vpaId
168
245
  })]
169
246
  }, vpaId))
170
- }), /*#__PURE__*/jsxRuntime.jsx(formik.Input, {
171
- label: t("neetoPayments.upi.payment.transaction.label"),
172
- name: "identifier",
173
- placeholder: t("neetoPayments.upi.payment.transaction.placeholder"),
174
- type: "number"
247
+ }), /*#__PURE__*/jsxRuntime.jsx(UpiTransactionIdInput, {
248
+ name: "identifier"
175
249
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
176
250
  className: "flex items-center gap-3",
177
251
  children: [/*#__PURE__*/jsxRuntime.jsx("hr", {
@@ -216,9 +290,9 @@ const ManualUpiPayment = ({
216
290
  children: [/*#__PURE__*/jsxRuntime.jsx("i", {
217
291
  className: "ri-upload-2-line text-2xl text-muted-foreground"
218
292
  }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
219
- className: "mt-1",
220
- color: "muted",
293
+ className: "mt-1 text-blue-600 hover:underline",
221
294
  variant: "caption",
295
+ weight: "medium",
222
296
  children: t("neetoPayments.upi.payment.screenshot.uploadText")
223
297
  }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
224
298
  color: "muted",
@@ -235,7 +309,7 @@ const ManualUpiPayment = ({
235
309
  type: "file",
236
310
  onChange: handleScreenshotSelect
237
311
  })]
238
- }), /*#__PURE__*/jsxRuntime.jsx(formik.ActionBlock, {
312
+ }), /*#__PURE__*/jsxRuntime.jsx(formik$1.ActionBlock, {
239
313
  cancelButtonProps: {
240
314
  label: t("neetoPayments.upi.payment.buttons.back"),
241
315
  onClick: handleCancel,
@@ -1 +1 @@
1
- {"version":3,"file":"ManualUpiPayment.js","sources":["../../../app/javascript/src/v2/components/ManualUpiPayment/constants.js","../../../app/javascript/src/v2/components/ManualUpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isPresent, isNotPresent } from \"neetocist\";\nimport * as yup from \"yup\";\n\nexport const ACCEPTED_SCREENSHOT_FORMATS = \"image/png,image/jpeg,image/jpg\";\n\nexport const MAX_SCREENSHOT_SIZE_MB = 5;\n\nexport const DIRECT_UPLOAD_URL = \"/rails/active_storage/direct_uploads\";\n\nexport const INITIAL_VALUES = { identifier: \"\" };\n\nexport const buildValidationSchema = screenshotFile =>\n yup.object({\n identifier: yup\n .number()\n .typeError(\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n })\n )\n .nullable()\n .transform((value, originalValue) =>\n originalValue === \"\" ? null : value\n )\n .test(\n \"identifier-or-screenshot\",\n t(\"neetoPayments.upi.payment.transaction.identifierOrScreenshot\"),\n value => isPresent(value) || isPresent(screenshotFile)\n )\n .test(\n \"is-integer\",\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n }),\n value => isNotPresent(value) || Number.isInteger(value)\n )\n .test(\n \"len\",\n t(\"neetoPayments.validations.length\", { length: 12 }),\n value => isNotPresent(value) || value?.toString().length === 12\n ),\n });\n","import { useRef, useState, useMemo, useEffect } from \"react\";\n\nimport { Button, Toastr, Typography } from \"@bigbinary/neeto-atoms\";\nimport { ActionBlock, Form, Input } from \"@bigbinary/neeto-atoms/formik\";\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { X } from \"lucide-react\";\nimport { noop, isPresent } from \"neetocist\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\nimport { getQrCodeValue } from \"utils\";\n\nimport {\n buildValidationSchema,\n ACCEPTED_SCREENSHOT_FORMATS,\n MAX_SCREENSHOT_SIZE_MB,\n DIRECT_UPLOAD_URL,\n INITIAL_VALUES,\n} from \"./constants\";\n\nconst ManualUpiPayment = ({\n fee,\n payableId,\n tip,\n amount,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n const fileInputRef = useRef(null);\n const [screenshotFile, setScreenshotFile] = useState(null);\n const [isUploading, setIsUploading] = useState(false);\n\n const screenshotPreview = useMemo(\n () => (screenshotFile ? URL.createObjectURL(screenshotFile) : null),\n [screenshotFile]\n );\n\n useEffect(\n () => () => {\n if (screenshotPreview) URL.revokeObjectURL(screenshotPreview);\n },\n [screenshotPreview]\n );\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n const amountToUpi = customAmount || amount;\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const validationSchema = useMemo(\n () => buildValidationSchema(screenshotFile),\n [screenshotFile]\n );\n\n const handleScreenshotSelect = event => {\n const file = event.target.files[0];\n if (!file) return;\n\n if (file.size > MAX_SCREENSHOT_SIZE_MB * 1024 * 1024) {\n Toastr.error(\n t(\"neetoPayments.upi.payment.screenshot.tooLarge\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })\n );\n\n return;\n }\n\n setScreenshotFile(file);\n };\n\n const handleRemoveScreenshot = () => {\n setScreenshotFile(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const uploadScreenshot = file =>\n new Promise((resolve, reject) => {\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL);\n upload.create((error, blob) => {\n if (error) reject(error);\n else resolve(blob.signed_id);\n });\n });\n\n const handleSubmit = async values => {\n onBeforePayment();\n\n let paymentScreenshot = null;\n if (screenshotFile) {\n try {\n setIsUploading(true);\n paymentScreenshot = await uploadScreenshot(screenshotFile);\n } catch {\n onFailedPayment();\n\n return;\n } finally {\n setIsUploading(false);\n }\n }\n\n createPayment({\n ...values,\n payableId,\n customAmount,\n payableType,\n discountCode,\n tipAttributes: tip,\n paymentScreenshot,\n });\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: INITIAL_VALUES,\n validationSchema,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography variant=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={getQrCodeValue(vpaId, amountToUpi)}\n />\n <Typography\n className=\"w-full mt-2 text-center wrap-break-word\"\n variant=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\"neetoPayments.upi.payment.transaction.placeholder\")}\n type=\"number\"\n />\n <div className=\"flex items-center gap-3\">\n <hr className=\"flex-1 border-border\" />\n <Typography className=\"uppercase\" color=\"muted\" variant=\"body2\">\n {t(\"neetoPayments.common.or\")}\n </Typography>\n <hr className=\"flex-1 border-border\" />\n </div>\n <div>\n <Typography className=\"mb-2\" variant=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.screenshot.label\")}\n </Typography>\n {screenshotPreview ? (\n <div className=\"relative inline-block\">\n <img\n alt={t(\"neetoPayments.upi.payment.screenshot.alt\")}\n className=\"max-h-40 rounded border border-border\"\n src={screenshotPreview}\n />\n <Button\n className=\"absolute -end-2 -top-2 rounded-full bg-background shadow-sm\"\n icon={X}\n size=\"sm\"\n variant=\"ghost\"\n onClick={handleRemoveScreenshot}\n />\n </div>\n ) : (\n <div\n className=\"flex cursor-pointer flex-col items-center justify-center rounded border-2 border-dashed border-border p-6 transition-colors hover:border-ring\"\n role=\"button\"\n tabIndex={0}\n onClick={() => fileInputRef.current?.click()}\n onKeyDown={e => {\n if (e.key === \"Enter\" || e.key === \" \") {\n fileInputRef.current?.click();\n }\n }}\n >\n <i className=\"ri-upload-2-line text-2xl text-muted-foreground\" />\n <Typography className=\"mt-1\" color=\"muted\" variant=\"caption\">\n {t(\"neetoPayments.upi.payment.screenshot.uploadText\")}\n </Typography>\n <Typography color=\"muted\" variant=\"nano\">\n {t(\"neetoPayments.upi.payment.screenshot.formatHint\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })}\n </Typography>\n </div>\n )}\n <input\n accept={ACCEPTED_SCREENSHOT_FORMATS}\n className=\"hidden\"\n data-testid=\"manual-upi-screenshot-upload-input-field\"\n ref={fileInputRef}\n type=\"file\"\n onChange={handleScreenshotSelect}\n />\n </div>\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: (!dirty && !screenshotFile) || isPending || isUploading,\n loading: isPending || isUploading,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default ManualUpiPayment;\n"],"names":["ACCEPTED_SCREENSHOT_FORMATS","MAX_SCREENSHOT_SIZE_MB","DIRECT_UPLOAD_URL","INITIAL_VALUES","identifier","buildValidationSchema","screenshotFile","yup","object","number","typeError","t","entity","nullable","transform","value","originalValue","test","isPresent","isNotPresent","Number","isInteger","length","toString","ManualUpiPayment","fee","payableId","tip","amount","discountCode","customAmount","handleCancel","payableType","onBeforePayment","noop","onFailedPayment","onSuccessfulPayment","useTranslation","fileInputRef","useRef","setScreenshotFile","useState","isUploading","setIsUploading","screenshotPreview","useMemo","URL","createObjectURL","useEffect","revokeObjectURL","vpaIds","pluck","vpas","amountToUpi","isPending","mutate","createPayment","useCreateUpiPayment","onSuccess","onError","validationSchema","handleScreenshotSelect","event","file","target","files","size","Toastr","error","maxSize","handleRemoveScreenshot","current","uploadScreenshot","Promise","resolve","reject","upload","DirectUpload","create","blob","signed_id","handleSubmit","values","paymentScreenshot","tipAttributes","_jsx","Form","className","formikProps","onSubmit","initialValues","children","dirty","_jsxs","_Fragment","Typography","variant","count","map","vpaId","QRCodeImage","style","width","height","getQrCodeValue","Input","label","name","placeholder","type","color","weight","alt","src","Button","icon","X","onClick","role","tabIndex","click","onKeyDown","e","key","accept","ref","onChange","ActionBlock","cancelButtonProps","disabled","submitButtonProps","loading"],"mapp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AAC;SACV,CACN,eACDoF,cAAA,CAAA,OAAA,EAAA;AACEuC,UAAAA,MAAM,EAAE5H,2BAA4B;AACpCuF,UAAAA,SAAS,EAAC,QAAQ;AAClB,UAAA,aAAA,EAAY,0CAA0C;AACtDsC,UAAAA,GAAG,EAAEvF,YAAa;AAClBuE,UAAAA,IAAI,EAAC,MAAM;AACXiB,UAAAA,QAAQ,EAAEjE;AAAuB,SAClC,CAAC;AAAA,OACC,CAAC,eACNwB,cAAA,CAAC0C,kBAAW,EAAA;AACVC,QAAAA,iBAAiB,EAAE;AACjBtB,UAAAA,KAAK,EAAE/F,CAAC,CAAC,wCAAwC,CAAC;AAClD0G,UAAAA,OAAO,EAAEtF,YAAY;AACrBkG,UAAAA,QAAQ,EAAE3E;SACV;AACF4E,QAAAA,iBAAiB,EAAE;AACjBxB,UAAAA,KAAK,EAAE/F,CAAC,CAAC,0CAA0C,CAAC;UACpDsH,QAAQ,EAAG,CAACrC,KAAK,IAAI,CAACtF,cAAc,IAAKgD,SAAS,IAAIZ,WAAW;UACjEyF,OAAO,EAAE7E,SAAS,IAAIZ;AACxB;AAAE,OACH,CAAC;KACF;AACH,GACG,CAAC;AAEX;;;;"}
1
+ {"version":3,"file":"ManualUpiPayment.js","sources":["../../../app/javascript/src/v2/components/ManualUpiPayment/constants.js","../../../app/javascript/src/v2/components/ManualUpiPayment/UpiTransactionIdInput.jsx","../../../app/javascript/src/v2/components/ManualUpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { isPresent, isNotPresent } from \"neetocist\";\nimport * as yup from \"yup\";\n\nexport const ACCEPTED_SCREENSHOT_FORMATS = \"image/png,image/jpeg,image/jpg\";\n\nexport const MAX_SCREENSHOT_SIZE_MB = 5;\n\nexport const DIRECT_UPLOAD_URL = \"/rails/active_storage/direct_uploads\";\n\nexport const INITIAL_VALUES = { identifier: \"\" };\n\nexport const UPI_TRANSACTION_ID_LENGTH = 12;\n\nexport const buildValidationSchema = screenshotFile =>\n yup.object({\n identifier: yup\n .number()\n .typeError(\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n })\n )\n .nullable()\n .transform((value, originalValue) =>\n originalValue === \"\" ? null : value\n )\n .test(\n \"identifier-or-screenshot\",\n t(\"neetoPayments.upi.payment.transaction.identifierOrScreenshot\"),\n value => isPresent(value) || isPresent(screenshotFile)\n )\n .test(\n \"is-integer\",\n t(\"neetoPayments.validations.invalidField\", {\n entity: t(\"neetoPayments.common.transactionId\"),\n }),\n value => isNotPresent(value) || Number.isInteger(value)\n )\n .test(\n \"len\",\n t(\"neetoPayments.validations.length\", { length: 12 }),\n value => isNotPresent(value) || value?.toString().length === 12\n ),\n });\n","import { useRef, useState } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport { useField } from \"formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { UPI_TRANSACTION_ID_LENGTH as LENGTH } from \"./constants\";\n\nconst toSlots = value =>\n Array.from({ length: LENGTH }, (_, index) => value[index] ?? \"\");\n\nconst UpiTransactionIdInput = ({ name = \"identifier\" }) => {\n const { t } = useTranslation();\n const [, meta, helpers] = useField(name);\n const inputsRef = useRef([]);\n const [slots, setSlots] = useState(() =>\n toSlots((meta.initialValue ?? \"\").toString())\n );\n\n const sync = nextSlots => {\n setSlots(nextSlots);\n helpers.setValue(nextSlots.join(\"\"));\n };\n\n const setDigit = (index, digit) =>\n sync(slots.map((slot, i) => (i === index ? digit : slot)));\n\n const focusBox = index => inputsRef.current[index]?.focus();\n\n const handleChange = (index, event) => {\n const sanitized = event.target.value.replace(/\\D/g, \"\");\n setDigit(index, sanitized ? sanitized[sanitized.length - 1] : \"\");\n if (sanitized && index < LENGTH - 1) focusBox(index + 1);\n };\n\n const handleKeyDown = (index, event) => {\n if (event.key === \"Backspace\" && !slots[index] && index > 0) {\n event.preventDefault();\n setDigit(index - 1, \"\");\n focusBox(index - 1);\n } else if (event.key === \"ArrowLeft\" && index > 0) {\n focusBox(index - 1);\n } else if (event.key === \"ArrowRight\" && index < LENGTH - 1) {\n focusBox(index + 1);\n }\n };\n\n const handlePaste = event => {\n event.preventDefault();\n const pasted = event.clipboardData\n .getData(\"text\")\n .replace(/\\D/g, \"\")\n .slice(0, LENGTH);\n if (!pasted) return;\n\n sync(toSlots(pasted));\n focusBox(Math.min(pasted.length, LENGTH - 1));\n };\n\n const showError = meta.touched && meta.error;\n\n return (\n <div>\n <Typography className=\"mb-2\" variant=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.transaction.label\")}\n </Typography>\n <div className=\"flex flex-wrap gap-2\" onPaste={handlePaste}>\n {slots.map((slot, index) => (\n <input\n autoComplete=\"off\"\n className=\"h-10 w-8 neeto-ui-rounded border neeto-ui-border-gray-300 text-center text-base focus:neeto-ui-border-gray-500 focus:outline-none\"\n data-testid={`upi-transaction-id-box-${index}`}\n inputMode=\"numeric\"\n key={index}\n maxLength={1}\n ref={element => (inputsRef.current[index] = element)}\n type=\"text\"\n value={slot}\n onBlur={() => helpers.setTouched(true)}\n onChange={event => handleChange(index, event)}\n onFocus={event => event.target.select()}\n onKeyDown={event => handleKeyDown(index, event)}\n />\n ))}\n </div>\n {showError && (\n <Typography className=\"neeto-ui-text-error-500 mt-1\" variant=\"body3\">\n {meta.error}\n </Typography>\n )}\n </div>\n );\n};\n\nexport default UpiTransactionIdInput;\n","import { useRef, useState, useMemo, useEffect } from \"react\";\n\nimport { Button, Toastr, Typography } from \"@bigbinary/neeto-atoms\";\nimport { ActionBlock, Form } from \"@bigbinary/neeto-atoms/formik\";\nimport { DirectUpload } from \"@rails/activestorage\";\nimport { X } from \"lucide-react\";\nimport { noop, isPresent } from \"neetocist\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\nimport { getQrCodeValue } from \"utils\";\n\nimport {\n buildValidationSchema,\n ACCEPTED_SCREENSHOT_FORMATS,\n MAX_SCREENSHOT_SIZE_MB,\n DIRECT_UPLOAD_URL,\n INITIAL_VALUES,\n} from \"./constants\";\nimport UpiTransactionIdInput from \"./UpiTransactionIdInput\";\n\nconst ManualUpiPayment = ({\n fee,\n payableId,\n tip,\n amount,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n const fileInputRef = useRef(null);\n const [screenshotFile, setScreenshotFile] = useState(null);\n const [isUploading, setIsUploading] = useState(false);\n\n const screenshotPreview = useMemo(\n () => (screenshotFile ? URL.createObjectURL(screenshotFile) : null),\n [screenshotFile]\n );\n\n useEffect(\n () => () => {\n if (screenshotPreview) URL.revokeObjectURL(screenshotPreview);\n },\n [screenshotPreview]\n );\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n const amountToUpi = customAmount || amount;\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const validationSchema = useMemo(\n () => buildValidationSchema(screenshotFile),\n [screenshotFile]\n );\n\n const handleScreenshotSelect = event => {\n const file = event.target.files[0];\n if (!file) return;\n\n if (file.size > MAX_SCREENSHOT_SIZE_MB * 1024 * 1024) {\n Toastr.error(\n t(\"neetoPayments.upi.payment.screenshot.tooLarge\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })\n );\n\n return;\n }\n\n setScreenshotFile(file);\n };\n\n const handleRemoveScreenshot = () => {\n setScreenshotFile(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const uploadScreenshot = file =>\n new Promise((resolve, reject) => {\n const upload = new DirectUpload(file, DIRECT_UPLOAD_URL);\n upload.create((error, blob) => {\n if (error) reject(error);\n else resolve(blob.signed_id);\n });\n });\n\n const handleSubmit = async values => {\n onBeforePayment();\n\n let paymentScreenshot = null;\n if (screenshotFile) {\n try {\n setIsUploading(true);\n paymentScreenshot = await uploadScreenshot(screenshotFile);\n } catch {\n onFailedPayment();\n\n return;\n } finally {\n setIsUploading(false);\n }\n }\n\n createPayment({\n ...values,\n payableId,\n customAmount,\n payableType,\n discountCode,\n tipAttributes: tip,\n paymentScreenshot,\n });\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: INITIAL_VALUES,\n validationSchema,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography className=\"neeto-ui-text-gray-600\" variant=\"body2\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"flex flex-wrap gap-8\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 120, height: 120 }}\n value={getQrCodeValue(vpaId, amountToUpi)}\n />\n <Typography\n className=\"w-full mt-2 text-center wrap-break-word\"\n variant=\"body2\"\n weight=\"medium\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <UpiTransactionIdInput name=\"identifier\" />\n <div className=\"flex items-center gap-3\">\n <hr className=\"flex-1 border-border\" />\n <Typography className=\"uppercase\" color=\"muted\" variant=\"body2\">\n {t(\"neetoPayments.common.or\")}\n </Typography>\n <hr className=\"flex-1 border-border\" />\n </div>\n <div>\n <Typography className=\"mb-2\" variant=\"body2\" weight=\"medium\">\n {t(\"neetoPayments.upi.payment.screenshot.label\")}\n </Typography>\n {screenshotPreview ? (\n <div className=\"relative inline-block\">\n <img\n alt={t(\"neetoPayments.upi.payment.screenshot.alt\")}\n className=\"max-h-40 rounded border border-border\"\n src={screenshotPreview}\n />\n <Button\n className=\"absolute -end-2 -top-2 rounded-full bg-background shadow-sm\"\n icon={X}\n size=\"sm\"\n variant=\"ghost\"\n onClick={handleRemoveScreenshot}\n />\n </div>\n ) : (\n <div\n className=\"flex cursor-pointer flex-col items-center justify-center rounded border-2 border-dashed border-border p-6 transition-colors hover:border-ring\"\n role=\"button\"\n tabIndex={0}\n onClick={() => fileInputRef.current?.click()}\n onKeyDown={e => {\n if (e.key === \"Enter\" || e.key === \" \") {\n fileInputRef.current?.click();\n }\n }}\n >\n <i className=\"ri-upload-2-line text-2xl text-muted-foreground\" />\n <Typography\n className=\"mt-1 text-blue-600 hover:underline\"\n variant=\"caption\"\n weight=\"medium\"\n >\n {t(\"neetoPayments.upi.payment.screenshot.uploadText\")}\n </Typography>\n <Typography color=\"muted\" variant=\"nano\">\n {t(\"neetoPayments.upi.payment.screenshot.formatHint\", {\n maxSize: MAX_SCREENSHOT_SIZE_MB,\n })}\n </Typography>\n </div>\n )}\n <input\n accept={ACCEPTED_SCREENSHOT_FORMATS}\n className=\"hidden\"\n data-testid=\"manual-upi-screenshot-upload-input-field\"\n ref={fileInputRef}\n type=\"file\"\n onChange={handleScreenshotSelect}\n />\n </div>\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: (!dirty && !screenshotFile) || isPending || isUploading,\n loading: isPending || isUploading,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default ManualUpiPayment;\n"],"names":["ACCEPTED_SCREENSHOT_FORMATS","MAX_SCREENSHOT_SIZE_MB","DIRECT_UPLOAD_URL","INITIAL_VALUES","identifier","UPI_TRANSACTION_ID_LENGTH","buildValidationSchema","screenshotFile","yup","object","number","typeError","t","entity","nullable","transform","value","originalValue","test","isPresent","isNotPresent","Number","isInteger","length","toString","toSlots","Array","from","LENGTH","_","index","UpiTransactionIdInput","name","useTranslation","meta","helpers","useField","inputsRef","useRef","slots","setSlots","useState","initialValue","sync","nextSlots","setValue","join","setDigit","digit","map","slot","i","focusBox","current","focus","handleChange","event","sanitized","target","replace","handleKeyDown","key","preventDefault","handlePaste","pasted","clipboardData","getData","slice","Math","min","showError","touched","error","_jsxs","children","_jsx","Typography","className","variant","weight","onPaste","autoComplete","inputMode","maxLength","ref","element","type","onBlur","setTouched","onChange","onFocus","select","onKeyDown","ManualUpiPayment","fee","payableId","tip","amount","discountCode","customAmount","handleCancel","payableType","onBeforePayment","noop","onFailedPayment","onSuccessfulPayment","fileInputRef","setScreenshotFile","isUploading","setIsUploading","screenshotPreview","useMemo","URL","createObjectURL","useEffect","revokeObjectURL","vpaIds","pluck","vpas","amountToUpi","isPending","mutate","createPayment","useCreateUpiPayment","onSuccess","onError","validationSchema","handleScreenshotSelect","file","files","size","Toastr","maxSize","handleRemoveScreenshot","uploadScreenshot","Promise","resolve","reject","upload","DirectUpload","create","blob","signed_id","handleSubmit","values","paymentScreenshot","tipAttributes","Form","formikProps","onSubmit","initialValues","dirty","_Fragment","count","vpaId","QRCodeImage","style","width","height","getQrCodeValue","color","alt","src","Button","icon","X","onClick","role","tabIndex","click","e","accept","ActionBlock","cancelButtonProps","label","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,2BAA2B,GAAG,gCAAgC;AAEpE,MAAMC,sBAAsB,GAAG,CAAC;AAEhC,MAAMC,iBAAiB,GAAG,sCAAsC;AAEhE,MAAMC,cAAc,GAAG;AAAEC,EAAAA,UAAU,EAAE;AAAG,CAAC;AAEzC,MAAMC,yBAAyB,GAAG,EAAE;AAEpC,MAAMC,qBAAqB,GAAGC,cAAc,IACjDC,cAAG,CAACC,MAAM,CAAC;AACTL,EAAAA,UAAU,EAAEI,cAAG,CACZE,MAAM,EAAE,CACRC,SAAS,CACRC,SAAC,CAAC,wCAAwC,EAAE;IAC1CC,MAAM,EAAED,SAAC,CAAC,oCAAoC;GAC/C,CACH,CAAC,CACAE,QAAQ,EAAE,CACVC,SAAS,CAAC,CAACC,KAAK,EAAEC,aAAa,KAC9BA,aAAa,KAAK,EAAE,GAAG,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