@bigbinary/neeto-payments-frontend 4.0.7 → 4.0.9

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 (115) hide show
  1. package/app/javascript/src/translations/en.json +15 -1
  2. package/dist/AccountsDashboard.js +13 -34
  3. package/dist/AccountsDashboard.js.map +1 -1
  4. package/dist/AdminCancelRecurringPaymentButton.js +1 -1
  5. package/dist/CashPaymentButton.js +2 -2
  6. package/dist/ConfirmCashPaymentButton.js +2 -2
  7. package/dist/CustomerCancelRecurringPaymentForm.js +2 -2
  8. package/dist/{ExportModal-B4zqaXJ1.js → ExportModal-UegCpavy.js} +2 -2
  9. package/dist/{ExportModal-B4zqaXJ1.js.map → ExportModal-UegCpavy.js.map} +1 -1
  10. package/dist/ManualUpiConnect.js +7 -3
  11. package/dist/ManualUpiConnect.js.map +1 -1
  12. package/dist/ManualUpiPayment.js +2 -2
  13. package/dist/ManualUpiPaymentConfirmButton.js +3 -2
  14. package/dist/ManualUpiPaymentConfirmButton.js.map +1 -1
  15. package/dist/ManualUpiPaymentRejectButton.js +2 -2
  16. package/dist/PaymentsDashboard.js +3 -3
  17. package/dist/PayoutsDashboard.js +5 -5
  18. package/dist/PayoutsPage.js +4 -4
  19. package/dist/RazorpayPaymentButton.js +2 -2
  20. package/dist/RecurringPaymentSettings.js +2 -2
  21. package/dist/RefundsDashboard.js +3 -3
  22. package/dist/SplitTransfersDashboard.js +3 -3
  23. package/dist/StripeConnect.js +377 -0
  24. package/dist/StripeConnect.js.map +1 -0
  25. package/dist/TaxesDashboard.js +2 -2
  26. package/dist/buildStripeTransactionLink.js +1 -1
  27. package/dist/cjs/AccountsDashboard.js +14 -35
  28. package/dist/cjs/AccountsDashboard.js.map +1 -1
  29. package/dist/cjs/AdminCancelRecurringPaymentButton.js +1 -1
  30. package/dist/cjs/CashPaymentButton.js +2 -2
  31. package/dist/cjs/ConfirmCashPaymentButton.js +2 -2
  32. package/dist/cjs/CustomerCancelRecurringPaymentForm.js +2 -2
  33. package/dist/cjs/{ExportModal-GI2FElh3.js → ExportModal-DxApGBel.js} +2 -2
  34. package/dist/cjs/{ExportModal-GI2FElh3.js.map → ExportModal-DxApGBel.js.map} +1 -1
  35. package/dist/cjs/ManualUpiConnect.js +7 -3
  36. package/dist/cjs/ManualUpiConnect.js.map +1 -1
  37. package/dist/cjs/ManualUpiPayment.js +2 -2
  38. package/dist/cjs/ManualUpiPaymentConfirmButton.js +3 -2
  39. package/dist/cjs/ManualUpiPaymentConfirmButton.js.map +1 -1
  40. package/dist/cjs/ManualUpiPaymentRejectButton.js +2 -2
  41. package/dist/cjs/PaymentsDashboard.js +3 -3
  42. package/dist/cjs/PayoutsDashboard.js +5 -5
  43. package/dist/cjs/PayoutsPage.js +4 -4
  44. package/dist/cjs/RazorpayPaymentButton.js +2 -2
  45. package/dist/cjs/RecurringPaymentSettings.js +2 -2
  46. package/dist/cjs/RefundsDashboard.js +3 -3
  47. package/dist/cjs/SplitTransfersDashboard.js +3 -3
  48. package/dist/cjs/StripeConnect.js +398 -0
  49. package/dist/cjs/StripeConnect.js.map +1 -0
  50. package/dist/cjs/TaxesDashboard.js +2 -2
  51. package/dist/cjs/buildStripeTransactionLink.js +1 -1
  52. package/dist/cjs/constants.js +2 -1
  53. package/dist/cjs/constants.js.map +1 -1
  54. package/dist/cjs/{dashboard-DDW7FD1Q.js → dashboard-BS8RsSUN.js} +2 -2
  55. package/dist/cjs/{dashboard-DDW7FD1Q.js.map → dashboard-BS8RsSUN.js.map} +1 -1
  56. package/dist/cjs/getAmountInSmallestCurrencyUnit.js +1 -1
  57. package/dist/cjs/getAmountWithAppliedTax.js +1 -1
  58. package/dist/cjs/getFormattedAmount.js +1 -1
  59. package/dist/cjs/getFormattedTaxAmount.js +1 -1
  60. package/dist/cjs/getFormattedTipAmount.js +1 -1
  61. package/dist/cjs/getQrCodeValue.js +1 -1
  62. package/dist/cjs/getTaxAmount.js +1 -1
  63. package/dist/cjs/getTipAmount.js +1 -1
  64. package/dist/cjs/{index-RKMq21yy.js → index-D0lrwfeJ.js} +3 -1
  65. package/dist/cjs/{index-RKMq21yy.js.map → index-D0lrwfeJ.js.map} +1 -1
  66. package/dist/cjs/index.js +16 -9
  67. package/dist/cjs/index.js.map +1 -1
  68. package/dist/cjs/{queryConstants-D2ARfy8-.js → queryConstants-Bnud13rz.js} +4 -2
  69. package/dist/cjs/queryConstants-Bnud13rz.js.map +1 -0
  70. package/dist/cjs/{renderFunctions-9xNgMpUY.js → renderFunctions-pCev76XN.js} +2 -2
  71. package/dist/cjs/{renderFunctions-9xNgMpUY.js.map → renderFunctions-pCev76XN.js.map} +1 -1
  72. package/dist/cjs/useAccountsApi-JFImy9Nr.js +62 -0
  73. package/dist/cjs/useAccountsApi-JFImy9Nr.js.map +1 -0
  74. package/dist/cjs/{usePaymentApi-CMOLq2VR.js → usePaymentApi-CHAcirnx.js} +2 -2
  75. package/dist/cjs/{usePaymentApi-CMOLq2VR.js.map → usePaymentApi-CHAcirnx.js.map} +1 -1
  76. package/dist/cjs/{usePaymentApi-D9rbv9km.js → usePaymentApi-DoMBeLfx.js} +2 -2
  77. package/dist/cjs/{usePaymentApi-D9rbv9km.js.map → usePaymentApi-DoMBeLfx.js.map} +1 -1
  78. package/dist/cjs/{usePaymentApi-DU3yYSX5.js → usePaymentApi-qdh5LN7u.js} +2 -2
  79. package/dist/cjs/{usePaymentApi-DU3yYSX5.js.map → usePaymentApi-qdh5LN7u.js.map} +1 -1
  80. package/dist/cjs/{usePlatformApi-CmetBzFR.js → usePlatformApi-CAYOstUm.js} +3 -3
  81. package/dist/cjs/{usePlatformApi-CmetBzFR.js.map → usePlatformApi-CAYOstUm.js.map} +1 -1
  82. package/dist/cjs/useRazorpayPayment.js +2 -2
  83. package/dist/constants.js +1 -1
  84. package/dist/{dashboard-W7nZb7Nt.js → dashboard-BmgAk7ZF.js} +2 -2
  85. package/dist/{dashboard-W7nZb7Nt.js.map → dashboard-BmgAk7ZF.js.map} +1 -1
  86. package/dist/getAmountInSmallestCurrencyUnit.js +1 -1
  87. package/dist/getAmountWithAppliedTax.js +1 -1
  88. package/dist/getFormattedAmount.js +1 -1
  89. package/dist/getFormattedTaxAmount.js +1 -1
  90. package/dist/getFormattedTipAmount.js +1 -1
  91. package/dist/getQrCodeValue.js +1 -1
  92. package/dist/getTaxAmount.js +1 -1
  93. package/dist/getTipAmount.js +1 -1
  94. package/dist/{index-DrwJCsVB.js → index-P40XHLrP.js} +3 -2
  95. package/dist/{index-DrwJCsVB.js.map → index-P40XHLrP.js.map} +1 -1
  96. package/dist/index.js +15 -9
  97. package/dist/index.js.map +1 -1
  98. package/dist/{queryConstants-jobxv6K1.js → queryConstants-BkIldboJ.js} +4 -2
  99. package/dist/queryConstants-BkIldboJ.js.map +1 -0
  100. package/dist/{renderFunctions-CwG8PO6s.js → renderFunctions-ByiZ0trU.js} +2 -2
  101. package/dist/{renderFunctions-CwG8PO6s.js.map → renderFunctions-ByiZ0trU.js.map} +1 -1
  102. package/dist/useAccountsApi-UO-GFSyi.js +58 -0
  103. package/dist/useAccountsApi-UO-GFSyi.js.map +1 -0
  104. package/dist/{usePaymentApi--FTQFayz.js → usePaymentApi-BEsw6xFl.js} +2 -2
  105. package/dist/{usePaymentApi--FTQFayz.js.map → usePaymentApi-BEsw6xFl.js.map} +1 -1
  106. package/dist/{usePaymentApi-D57hcC0x.js → usePaymentApi-CnjUFTLo.js} +2 -2
  107. package/dist/{usePaymentApi-D57hcC0x.js.map → usePaymentApi-CnjUFTLo.js.map} +1 -1
  108. package/dist/{usePaymentApi-CnXIy7y7.js → usePaymentApi-DTQ8wxiL.js} +2 -2
  109. package/dist/{usePaymentApi-CnXIy7y7.js.map → usePaymentApi-DTQ8wxiL.js.map} +1 -1
  110. package/dist/{usePlatformApi-CG6LhSj3.js → usePlatformApi-CqsxCyY-.js} +3 -3
  111. package/dist/{usePlatformApi-CG6LhSj3.js.map → usePlatformApi-CqsxCyY-.js.map} +1 -1
  112. package/dist/useRazorpayPayment.js +2 -2
  113. package/package.json +10 -10
  114. package/dist/cjs/queryConstants-D2ARfy8-.js.map +0 -1
  115. package/dist/queryConstants-jobxv6K1.js.map +0 -1
@@ -10,7 +10,7 @@ import Select from '@bigbinary/neetoui/formik/Select';
10
10
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
11
11
  import { mergeLeft } from 'ramda';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { a as useUpdateUpiPayment } from './usePaymentApi-D57hcC0x.js';
13
+ import { a as useUpdateUpiPayment } from './usePaymentApi-CnjUFTLo.js';
14
14
  import { t } from 'i18next';
15
15
  import * as yup from 'yup';
16
16
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -19,7 +19,7 @@ import '@babel/runtime/helpers/defineProperty';
19
19
  import '@tanstack/react-query';
20
20
  import '@bigbinary/neeto-commons-frontend/react-utils';
21
21
  import 'axios';
22
- import './index-DrwJCsVB.js';
22
+ import './index-P40XHLrP.js';
23
23
  import '@bigbinary/neeto-commons-frontend/constants';
24
24
  import 'decimal.js';
25
25
  import '@bigbinary/neeto-commons-frontend/utils';
@@ -85,6 +85,7 @@ var ManualUpiPaymentConfirmButton = function ManualUpiPaymentConfirmButton(_ref)
85
85
  };
86
86
  return /*#__PURE__*/jsxs(Fragment, {
87
87
  children: [/*#__PURE__*/jsx(Button, {
88
+ "data-cy": "confirm-payment-btn",
88
89
  label: t("neetoPayments.upi.payment.buttons.confirmPayment"),
89
90
  loading: isPending,
90
91
  size: "small",
@@ -1 +1 @@
1
- {"version":3,"file":"ManualUpiPaymentConfirmButton.js","sources":["../app/javascript/src/components/ManualUpiPaymentConfirmButton/constants.js","../app/javascript/src/components/ManualUpiPaymentConfirmButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { mergeLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ManualUpiPaymentConfirmButton = ({\n vpas,\n identifier,\n paymentId,\n manualUpiId,\n payableId,\n onSuccess = noop,\n keysToInvalidate = [],\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const onSuccessfulUpdate = () => {\n setIsModalOpen(false);\n onSuccess();\n };\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment({\n id: paymentId,\n manualUpiId,\n keysToInvalidate,\n options: { onSuccess: onSuccessfulUpdate },\n });\n\n const initialValues =\n vpas.length === 1\n ? mergeLeft({ vpaId: vpas[0].id }, INITIAL_VALUE)\n : INITIAL_VALUE;\n\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n initialValues,\n enableReinitialize: true,\n onSubmit: handleSubmit,\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ setFieldValue, dirty, isSubmitting }) => (\n <>\n <Modal.Body>\n <div className=\"flex flex-col space-y-4\">\n <Typography lineHeight=\"normal\" style=\"body2\">\n {t(\"neetoPayments.upi.confirmModal.upiTransactionId\", {\n identifier,\n })}\n </Typography>\n <Select\n label={t(\"neetoPayments.upi.confirmModal.accountIdLabel\")}\n name=\"vpaId\"\n options={vpas?.map(({ address, id }) => ({\n label: address,\n value: id,\n }))}\n onChange={({ value }) => setFieldValue(\"vpaId\", value)}\n />\n <Textarea\n data-cy=\"confirm-booking-modal-input-textfield\"\n label={t(\"neetoPayments.upi.confirmModal.notes\")}\n name=\"notes\"\n placeholder={t(\n \"neetoPayments.upi.confirmModal.notesPlaceholder\"\n )}\n />\n </div>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <ActionBlock\n isSubmitting={isPending}\n position=\"right\"\n cancelButtonProps={{\n onClick: onClose,\n style: \"tertiary\",\n }}\n submitButtonProps={{\n disabled:\n isSubmitting ||\n isPending ||\n (vpas.length !== 1 && !dirty),\n label: t(\"neetoPayments.common.confirm\"),\n }}\n />\n </Modal.Footer>\n </>\n )}\n </Form>\n </Modal>\n </>\n );\n};\n\nexport default ManualUpiPaymentConfirmButton;\n"],"names":["INITIAL_VALUE","vpaId","notes","VALIDATION_SCHEMA","yup","object","string","required","t","ManualUpiPaymentConfirmButton","_ref","vpas","identifier","paymentId","manualUpiId","payableId","_ref$onSuccess","onSuccess","noop","_ref$keysToInvalidate","keysToInvalidate","_useState","useState","_useState2","_slicedToArray","isModalOpen","setIsModalOpen","_useTranslation","useTranslation","onSuccessfulUpdate","_useUpdateUpiPayment","useUpdateUpiPayment","id","options","updateUpiPayment","mutate","isPending","initialValues","length","mergeLeft","onClose","handleSubmit","_ref2","vpa","findBy","payload","upiId","status","_jsxs","_Fragment","children","_jsx","Button","label","loading","size","onClick","Modal","isOpen","Header","Typography","style","Form","formikProps","enableReinitialize","onSubmit","validationSchema","_ref3","setFieldValue","dirty","isSubmitting","Body","className","lineHeight","Select","name","map","_ref4","address","value","onChange","_ref5","Textarea","placeholder","Footer","ActionBlock","position","cancelButtonProps","submitButtonProps","disabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAa,GAAG;AAAEC,EAAAA,KAAK,EAAE,EAAE;AAAEC,EAAAA,KAAK,EAAE;AAAG,CAAC;AAE9C,IAAMC,iBAAiB,GAAGC,GAAG,CAACC,MAAM,CAAC;AAC1CJ,EAAAA,KAAK,EAAEG,GAAG,CACPE,MAAM,EAAE,CACRC,QAAQ,CAACC,CAAC,CAAC,+CAA+C,CAAC;AAChE,CAAC,CAAC;;ACGF,IAAMC,6BAA6B,GAAG,SAAhCA,6BAA6BA,CAAAC,IAAA,EAQ7B;AAAA,EAAA,IAPJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IACVC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAAC,cAAA,GAAAN,IAAA,CACTO,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAGE,KAAAA,CAAAA,GAAAA,IAAI,GAAAF,cAAA;IAAAG,qBAAA,GAAAT,IAAA,CAChBU,gBAAgB;AAAhBA,IAAAA,gBAAgB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,qBAAA;AAErB,EAAA,IAAAE,SAAA,GAAsCC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA9CI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA;AAElC,EAAA,IAAAI,eAAA,GAAcC,cAAc,EAAE;IAAtBpB,CAAC,GAAAmB,eAAA,CAADnB,CAAC;AAET,EAAA,IAAMqB,kBAAkB,G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EAAA;AACVf,gBAAAA,YAAY,EAAElC,SAAU;AACxBkD,gBAAAA,QAAQ,EAAC,OAAO;AAChBC,gBAAAA,iBAAiB,EAAE;AACjB/B,kBAAAA,OAAO,EAAEhB,OAAO;AAChBqB,kBAAAA,KAAK,EAAE;iBACP;AACF2B,gBAAAA,iBAAiB,EAAE;AACjBC,kBAAAA,QAAQ,EACNnB,YAAY,IACZlC,SAAS,IACRzB,IAAI,CAAC2B,MAAM,KAAK,CAAC,IAAI,CAAC+B,KAAM;kBAC/BhB,KAAK,EAAE7C,CAAC,CAAC,8BAA8B;AACzC;eACD;AAAC,aACU,CAAC;AAAA,WACf,CAAC;AAAA;AACJ,OACG,CAAC;AAAA,KACF,CAAC;AAAA,GACR,CAAC;AAEP;;;;"}
1
+ {"version":3,"file":"ManualUpiPaymentConfirmButton.js","sources":["../app/javascript/src/components/ManualUpiPaymentConfirmButton/constants.js","../app/javascript/src/components/ManualUpiPaymentConfirmButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { mergeLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/manualUpi/usePaymentApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ManualUpiPaymentConfirmButton = ({\n vpas,\n identifier,\n paymentId,\n manualUpiId,\n payableId,\n onSuccess = noop,\n keysToInvalidate = [],\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const onSuccessfulUpdate = () => {\n setIsModalOpen(false);\n onSuccess();\n };\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment({\n id: paymentId,\n manualUpiId,\n keysToInvalidate,\n options: { onSuccess: onSuccessfulUpdate },\n });\n\n const initialValues =\n vpas.length === 1\n ? mergeLeft({ vpaId: vpas[0].id }, INITIAL_VALUE)\n : INITIAL_VALUE;\n\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n data-cy=\"confirm-payment-btn\"\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n initialValues,\n enableReinitialize: true,\n onSubmit: handleSubmit,\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ setFieldValue, dirty, isSubmitting }) => (\n <>\n <Modal.Body>\n <div className=\"flex flex-col space-y-4\">\n <Typography lineHeight=\"normal\" style=\"body2\">\n {t(\"neetoPayments.upi.confirmModal.upiTransactionId\", {\n identifier,\n })}\n </Typography>\n <Select\n label={t(\"neetoPayments.upi.confirmModal.accountIdLabel\")}\n name=\"vpaId\"\n options={vpas?.map(({ address, id }) => ({\n label: address,\n value: id,\n }))}\n onChange={({ value }) => setFieldValue(\"vpaId\", value)}\n />\n <Textarea\n data-cy=\"confirm-booking-modal-input-textfield\"\n label={t(\"neetoPayments.upi.confirmModal.notes\")}\n name=\"notes\"\n placeholder={t(\n \"neetoPayments.upi.confirmModal.notesPlaceholder\"\n )}\n />\n </div>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <ActionBlock\n isSubmitting={isPending}\n position=\"right\"\n cancelButtonProps={{\n onClick: onClose,\n style: \"tertiary\",\n }}\n submitButtonProps={{\n disabled:\n isSubmitting ||\n isPending ||\n (vpas.length !== 1 && !dirty),\n label: t(\"neetoPayments.common.confirm\"),\n }}\n />\n </Modal.Footer>\n </>\n )}\n </Form>\n </Modal>\n </>\n );\n};\n\nexport default ManualUpiPaymentConfirmButton;\n"],"names":["INITIAL_VALUE","vpaId","notes","VALIDATION_SCHEMA","yup","object","string","required","t","ManualUpiPaymentConfirmButton","_ref","vpas","identifier","paymentId","manualUpiId","payableId","_ref$onSuccess","onSuccess","noop","_ref$keysToInvalidate","keysToInvalidate","_useState","useState","_useState2","_slicedToArray","isModalOpen","setIsModalOpen","_useTranslation","useTranslation","onSuccessfulUpdate","_useUpdateUpiPayment","useUpdateUpiPayment","id","options","updateUpiPayment","mutate","isPending","initialValues","length","mergeLeft","onClose","handleSubmit","_ref2","vpa","findBy","payload","upiId","status","_jsxs","_Fragment","children","_jsx","Button","label","loading","size","onClick","Modal","isOpen","Header","Typography","style","Form","formikProps","enableReinitialize","onSubmit","validationSchema","_ref3","setFieldValue","dirty","isSubmitting","Body","className","lineHeight","Select","name","map","_ref4","address","value","onChange","_ref5","Textarea","placeholder","Footer","ActionBlock","position","cancelButtonProps","submitButtonProps","disabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAa,GAAG;AAAEC,EAAAA,KAAK,EAAE,EAAE;AAAEC,EAAAA,KAAK,EAAE;AAAG,CAAC;AAE9C,IAAMC,iBAAiB,GAAGC,GAAG,CAACC,MAAM,CAAC;AAC1CJ,EAAAA,KAAK,EAAEG,GAAG,CACPE,MAAM,EAAE,CACRC,QAAQ,CAACC,CAAC,CAAC,+CAA+C,CAAC;AAChE,CAAC,CAAC;;ACGF,IAAMC,6BAA6B,GAAG,SAAhCA,6BAA6BA,CAAAC,IAAA,EAQ7B;AAAA,EAAA,IA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,CAAC;AAAA,KACF,CAAC;AAAA,GACR,CAAC;AAEP;;;;"}
@@ -8,14 +8,14 @@ import Form from '@bigbinary/neetoui/formik/Form';
8
8
  import Textarea from '@bigbinary/neetoui/formik/Textarea';
9
9
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
10
10
  import { useTranslation } from 'react-i18next';
11
- import { a as useUpdateUpiPayment } from './usePaymentApi-D57hcC0x.js';
11
+ import { a as useUpdateUpiPayment } from './usePaymentApi-CnjUFTLo.js';
12
12
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
13
13
  import '@babel/runtime/helpers/toConsumableArray';
14
14
  import '@babel/runtime/helpers/defineProperty';
15
15
  import '@tanstack/react-query';
16
16
  import '@bigbinary/neeto-commons-frontend/react-utils';
17
17
  import 'axios';
18
- import './index-DrwJCsVB.js';
18
+ import './index-P40XHLrP.js';
19
19
  import 'i18next';
20
20
  import '@bigbinary/neeto-commons-frontend/constants';
21
21
  import 'decimal.js';
@@ -8,11 +8,11 @@ import { buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend/utils';
8
8
  import Spinner from '@bigbinary/neetoui/Spinner';
9
9
  import { map, curry, concat, mergeDeepWith, mergeLeft, reject, isNil, prop, isEmpty, modify } from 'ramda';
10
10
  import { useHistory } from 'react-router-dom';
11
- import { E as ExportModal } from './ExportModal-B4zqaXJ1.js';
11
+ import { E as ExportModal } from './ExportModal-UegCpavy.js';
12
12
  import { useQuery } from '@tanstack/react-query';
13
13
  import axios from 'axios';
14
- import { B as BASE_URL, P as PAYMENT_PROVIDERS, D as DEFAULT_TAG_STYLE, l as formatAmount, m as formatCurrency, n as getUniquePaymentProviders, o as buildDefaultTableColumns, S as SORT_DIRECTIONS, p as processDataIndex, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, q as DASHBOARD_KIND } from './index-DrwJCsVB.js';
15
- import { Q as QUERY_KEYS } from './queryConstants-jobxv6K1.js';
14
+ import { B as BASE_URL, P as PAYMENT_PROVIDERS, D as DEFAULT_TAG_STYLE, n as formatAmount, o as formatCurrency, p as getUniquePaymentProviders, q as buildDefaultTableColumns, S as SORT_DIRECTIONS, r as processDataIndex, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, t as DASHBOARD_KIND } from './index-P40XHLrP.js';
15
+ import { Q as QUERY_KEYS } from './queryConstants-BkIldboJ.js';
16
16
  import { t } from 'i18next';
17
17
  import { toLabelAndValue, isNotPresent, snakeToCamelCase, humanize, isPresent, camelToSnakeCase } from '@bigbinary/neeto-cist';
18
18
  import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
@@ -8,13 +8,13 @@ import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
8
8
  import Tab from '@bigbinary/neetoui/Tab';
9
9
  import Typography from '@bigbinary/neetoui/Typography';
10
10
  import { useTranslation } from 'react-i18next';
11
- import { u as useExportData, b as buildDefaultPageProperties, a as buildPayload, c as buildRowData, w as withReactQuery } from './dashboard-W7nZb7Nt.js';
11
+ import { u as useExportData, b as buildDefaultPageProperties, a as buildPayload, c as buildRowData, w as withReactQuery } from './dashboard-BmgAk7ZF.js';
12
12
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
13
13
  import Download from '@bigbinary/neeto-icons/Download';
14
14
  import Button from '@bigbinary/neetoui/Button';
15
15
  import Modal from '@bigbinary/neetoui/Modal';
16
16
  import { e as exportChannel } from './exportChannel-CViICC6x.js';
17
- import { u as uuidV4, r as DEFAULT_SORT_PROPERTIES$1, S as SORT_DIRECTIONS } from './index-DrwJCsVB.js';
17
+ import { u as uuidV4, m as DEFAULT_SORT_PROPERTIES$1, S as SORT_DIRECTIONS } from './index-P40XHLrP.js';
18
18
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
19
19
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
20
20
  import { camelToSnakeCase, removeBy, snakeToCamelCase, isPresent } from '@bigbinary/neeto-cist';
@@ -22,7 +22,7 @@ import { buildUrl, getQueryParams } from '@bigbinary/neeto-commons-frontend/util
22
22
  import { buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend/utils';
23
23
  import { curry, assoc, insert, mergeLeft } from 'ramda';
24
24
  import { useHistory } from 'react-router-dom';
25
- import { r as renderStatus, a as renderDate } from './renderFunctions-CwG8PO6s.js';
25
+ import { r as renderStatus, a as renderDate } from './renderFunctions-ByiZ0trU.js';
26
26
  import { C as CopyButtonWrapper } from './CopyButtonWrapper-B79WRogM.js';
27
27
  import { DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX } from '@bigbinary/neeto-commons-frontend/constants';
28
28
  import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
@@ -30,7 +30,7 @@ import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
30
30
  import Table from '@bigbinary/neetoui/Table';
31
31
  import NoData from '@bigbinary/neetoui/NoData';
32
32
  import Spinner from '@bigbinary/neetoui/Spinner';
33
- import { b as useFetchStripePayouts, c as useFetchStripePlatformPayouts } from './usePlatformApi-CG6LhSj3.js';
33
+ import { b as useFetchStripePayouts, c as useFetchStripePlatformPayouts } from './usePlatformApi-CqsxCyY-.js';
34
34
  import '@tanstack/react-query';
35
35
  import '@tanstack/react-query-devtools';
36
36
  import 'axios';
@@ -40,7 +40,7 @@ import '@bigbinary/neetoui/Tag';
40
40
  import '@bigbinary/neetoui/Tooltip';
41
41
  import '@bigbinary/neeto-molecules/CopyToClipboardButton';
42
42
  import 'qs';
43
- import './queryConstants-jobxv6K1.js';
43
+ import './queryConstants-BkIldboJ.js';
44
44
 
45
45
  var TAB = {
46
46
  all: "all",
@@ -4,11 +4,11 @@ import Spinner from '@bigbinary/neetoui/Spinner';
4
4
  import Typography from '@bigbinary/neetoui/Typography';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { useParams } from 'react-router-dom/cjs/react-router-dom';
7
- import { r as renderStatus, a as renderDate } from './renderFunctions-CwG8PO6s.js';
8
- import { u as useShowStripePayout, a as useShowStripePlatformPayout } from './usePlatformApi-CG6LhSj3.js';
7
+ import { r as renderStatus, a as renderDate } from './renderFunctions-ByiZ0trU.js';
8
+ import { u as useShowStripePayout, a as useShowStripePlatformPayout } from './usePlatformApi-CqsxCyY-.js';
9
9
  import Button from '@bigbinary/neetoui/Button';
10
10
  import { C as CopyButtonWrapper } from './CopyButtonWrapper-B79WRogM.js';
11
- import { j as buildStripePayoutLink } from './index-DrwJCsVB.js';
11
+ import { j as buildStripePayoutLink } from './index-P40XHLrP.js';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
13
  import 'i18next';
14
14
  import '@bigbinary/neeto-molecules/DateFormat';
@@ -21,7 +21,7 @@ import '@tanstack/react-query';
21
21
  import '@bigbinary/neeto-commons-frontend/react-utils';
22
22
  import 'axios';
23
23
  import 'qs';
24
- import './queryConstants-jobxv6K1.js';
24
+ import './queryConstants-BkIldboJ.js';
25
25
  import '@bigbinary/neeto-commons-frontend/constants';
26
26
  import 'decimal.js';
27
27
  import '@bigbinary/neeto-commons-frontend/utils';
@@ -4,8 +4,8 @@ import { noop, findBy, isNotPresent } from '@bigbinary/neeto-cist';
4
4
  import Button from '@bigbinary/neetoui/Button';
5
5
  import { mergeDeepLeft } from 'ramda';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { u as useCreateRazorpayPayment } from './usePaymentApi-CnXIy7y7.js';
8
- import { R as RAZORPAY_PAYMENT_BUTTON_OPTIONS } from './index-DrwJCsVB.js';
7
+ import { u as useCreateRazorpayPayment } from './usePaymentApi-DTQ8wxiL.js';
8
+ import { R as RAZORPAY_PAYMENT_BUTTON_OPTIONS } from './index-P40XHLrP.js';
9
9
  import { jsx } from 'react/jsx-runtime';
10
10
  import '@babel/runtime/helpers/defineProperty';
11
11
  import '@tanstack/react-query';
@@ -14,8 +14,8 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
14
14
  import { useQuery } from '@tanstack/react-query';
15
15
  import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
16
16
  import axios from 'axios';
17
- import { B as BASE_URL } from './index-DrwJCsVB.js';
18
- import { Q as QUERY_KEYS } from './queryConstants-jobxv6K1.js';
17
+ import { B as BASE_URL } from './index-P40XHLrP.js';
18
+ import { Q as QUERY_KEYS } from './queryConstants-BkIldboJ.js';
19
19
  import { t } from 'i18next';
20
20
  import * as yup from 'yup';
21
21
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -8,11 +8,11 @@ import { buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend/utils';
8
8
  import Spinner from '@bigbinary/neetoui/Spinner';
9
9
  import { map, curry, mergeDeepWith, concat, mergeLeft, reject, isNil, prop, isEmpty, modify } from 'ramda';
10
10
  import { useHistory } from 'react-router-dom';
11
- import { E as ExportModal } from './ExportModal-B4zqaXJ1.js';
11
+ import { E as ExportModal } from './ExportModal-UegCpavy.js';
12
12
  import { useQuery } from '@tanstack/react-query';
13
13
  import axios from 'axios';
14
- import { B as BASE_URL, P as PAYMENT_PROVIDERS, D as DEFAULT_TAG_STYLE, l as formatAmount, m as formatCurrency, o as buildDefaultTableColumns, S as SORT_DIRECTIONS, p as processDataIndex, A as ASSOCIATED_TABLE_COLUMNS, r as DEFAULT_SORT_PROPERTIES, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, q as DASHBOARD_KIND } from './index-DrwJCsVB.js';
15
- import { Q as QUERY_KEYS } from './queryConstants-jobxv6K1.js';
14
+ import { B as BASE_URL, P as PAYMENT_PROVIDERS, D as DEFAULT_TAG_STYLE, n as formatAmount, o as formatCurrency, q as buildDefaultTableColumns, S as SORT_DIRECTIONS, r as processDataIndex, A as ASSOCIATED_TABLE_COLUMNS, m as DEFAULT_SORT_PROPERTIES, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, t as DASHBOARD_KIND } from './index-P40XHLrP.js';
15
+ import { Q as QUERY_KEYS } from './queryConstants-BkIldboJ.js';
16
16
  import { t } from 'i18next';
17
17
  import { toLabelAndValue, snakeToCamelCase, humanize, isPresent, isNotPresent, camelToSnakeCase } from '@bigbinary/neeto-cist';
18
18
  import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
@@ -8,12 +8,12 @@ import { buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend/utils';
8
8
  import Spinner from '@bigbinary/neetoui/Spinner';
9
9
  import { mergeLeft, curry, mergeDeepWith, concat, reject, isNil, map, prop, sortBy, isEmpty, modify, pluck } from 'ramda';
10
10
  import { useHistory } from 'react-router-dom';
11
- import { E as ExportModal } from './ExportModal-B4zqaXJ1.js';
11
+ import { E as ExportModal } from './ExportModal-UegCpavy.js';
12
12
  import { useQuery } from '@tanstack/react-query';
13
13
  import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
14
14
  import axios from 'axios';
15
- import { B as BASE_URL, v as preProcessStatus, w as getTagStyle, l as formatAmount, m as formatCurrency, x as PAYMENT_KIND, p as processDataIndex, S as SORT_DIRECTIONS, r as DEFAULT_SORT_PROPERTIES, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, q as DASHBOARD_KIND } from './index-DrwJCsVB.js';
16
- import { Q as QUERY_KEYS } from './queryConstants-jobxv6K1.js';
15
+ import { B as BASE_URL, w as preProcessStatus, x as getTagStyle, n as formatAmount, o as formatCurrency, y as PAYMENT_KIND, r as processDataIndex, S as SORT_DIRECTIONS, m as DEFAULT_SORT_PROPERTIES, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, k as DEFAULT_PAGE_VALUES, t as DASHBOARD_KIND } from './index-P40XHLrP.js';
16
+ import { Q as QUERY_KEYS } from './queryConstants-BkIldboJ.js';
17
17
  import Modal from '@bigbinary/neetoui/Modal';
18
18
  import Typography from '@bigbinary/neetoui/Typography';
19
19
  import Form from '@bigbinary/neetoui/formik/Form';
@@ -0,0 +1,377 @@
1
+ import { humanize, isPresent, isNotPresent, _humanize, noop } from '@bigbinary/neeto-cist';
2
+ import Container from '@bigbinary/neeto-molecules/Container';
3
+ import Header from '@bigbinary/neeto-molecules/Header';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { useHistory, Switch, Route } from 'react-router-dom';
6
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
+ import { useState, useEffect } from 'react';
8
+ import DOMPurify from 'dompurify';
9
+ import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
10
+ import Stripe from '@bigbinary/neeto-icons/misc/Stripe';
11
+ import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
12
+ import Radio from '@bigbinary/neetoui/Radio';
13
+ import Button from '@bigbinary/neetoui/Button';
14
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
15
+ import { useQuery } from '@tanstack/react-query';
16
+ import axios from 'axios';
17
+ import { B as BASE_URL, v as STRIPE_CONNECT_ENDPOINT } from './index-P40XHLrP.js';
18
+ import { Q as QUERY_KEYS } from './queryConstants-BkIldboJ.js';
19
+ import { t } from 'i18next';
20
+ import * as yup from 'yup';
21
+ import { jsx, jsxs } from 'react/jsx-runtime';
22
+ import Spinner from '@bigbinary/neetoui/Spinner';
23
+ import Select from '@bigbinary/neetoui/formik/Select';
24
+ import Form from '@bigbinary/neetoui/formik/Form';
25
+ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
26
+ import { a as useCreateStripeAccount, b as usePollingStripeAccountCreationStatus } from './useAccountsApi-UO-GFSyi.js';
27
+ import { useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
28
+ import Typography from '@bigbinary/neetoui/Typography';
29
+ import Callout from '@bigbinary/neetoui/Callout';
30
+ import '@bigbinary/neeto-commons-frontend/constants';
31
+ import 'decimal.js';
32
+ import 'ramda';
33
+
34
+ var list = function list() {
35
+ return axios.get("".concat(BASE_URL, "/api/v1/integrations"));
36
+ };
37
+ var integrationsApi = {
38
+ list: list
39
+ };
40
+
41
+ function ownKeys(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; }
42
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
43
+ var useFetchPaymentIntegrations = function useFetchPaymentIntegrations(options) {
44
+ return useQuery(_objectSpread({
45
+ queryKey: [QUERY_KEYS.PAYMENT_INTEGRATION_LIST],
46
+ queryFn: integrationsApi.list
47
+ }, options));
48
+ };
49
+
50
+ var INTEGRATION_METHOD = {
51
+ useExistingAccount: "use_existing_account",
52
+ createNewAccount: "create_new_account"
53
+ };
54
+ var POLLING_INTERVAL = 5000;
55
+ var MAX_POLLING_TIME = 30000;
56
+ var INITIAL_VALUES = {
57
+ country: "",
58
+ return_url: ""
59
+ };
60
+ var VALIDATION_SCHEMA = yup.object().shape({
61
+ country: yup.object().required(t("neetoPayments.validations.countryRequired"))
62
+ });
63
+
64
+ var sanitize = DOMPurify.sanitize;
65
+ var Account = function Account(_ref) {
66
+ var processingPageRoute = _ref.processingPageRoute,
67
+ countryPageRoute = _ref.countryPageRoute,
68
+ productNameLabel = _ref.productNameLabel,
69
+ getStripeAccount = _ref.getStripeAccount,
70
+ manageRoute = _ref.manageRoute;
71
+ var _useTranslation = useTranslation(),
72
+ t = _useTranslation.t;
73
+ var _useState = useState(INTEGRATION_METHOD.createNewAccount),
74
+ _useState2 = _slicedToArray(_useState, 2),
75
+ selectedOption = _useState2[0],
76
+ setSelectedOption = _useState2[1];
77
+ var history = useHistory();
78
+ var _useFetchPaymentInteg = useFetchPaymentIntegrations(),
79
+ _useFetchPaymentInteg2 = _useFetchPaymentInteg.data,
80
+ _useFetchPaymentInteg3 = _useFetchPaymentInteg2 === void 0 ? {} : _useFetchPaymentInteg2,
81
+ stripeStandardAccounts = _useFetchPaymentInteg3.stripeStandardAccounts;
82
+ var stripeAccount = getStripeAccount(stripeStandardAccounts);
83
+ var stripeConnectUrl = buildUrl(STRIPE_CONNECT_ENDPOINT, {
84
+ return_url: "".concat(window.location.origin).concat(processingPageRoute)
85
+ });
86
+ var handleSubmit = function handleSubmit() {
87
+ if (selectedOption !== INTEGRATION_METHOD.useExistingAccount) {
88
+ return history.push(countryPageRoute);
89
+ }
90
+ return window.location.href = sanitize(stripeConnectUrl);
91
+ };
92
+ useEffect(function () {
93
+ if (stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) {
94
+ history.push(manageRoute);
95
+ }
96
+ }, [stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.isConnected]);
97
+ return /*#__PURE__*/jsx(CardLayout, {
98
+ icon: /*#__PURE__*/jsx(Stripe, {
99
+ size: 48
100
+ }),
101
+ title: t("neetoPayments.stripeConnect.title"),
102
+ actionBlock: /*#__PURE__*/jsx(Button, {
103
+ label: t("neetoPayments.common.continue"),
104
+ onClick: handleSubmit
105
+ }),
106
+ description: t("neetoPayments.stripeConnect.unlinkedDescription", {
107
+ productNameLabel: productNameLabel
108
+ }),
109
+ children: /*#__PURE__*/jsxs(Radio, {
110
+ value: selectedOption,
111
+ onChange: function onChange(_ref2) {
112
+ var value = _ref2.target.value;
113
+ return setSelectedOption(value);
114
+ },
115
+ children: [/*#__PURE__*/jsx(Radio.Item, {
116
+ label: t("neetoPayments.stripeConnect.createNewAccount"),
117
+ name: "accountMethod",
118
+ value: INTEGRATION_METHOD.createNewAccount
119
+ }), /*#__PURE__*/jsx(Radio.Item, {
120
+ label: t("neetoPayments.stripeConnect.useExistingAccount"),
121
+ name: "accountMethod",
122
+ value: INTEGRATION_METHOD.useExistingAccount
123
+ })]
124
+ })
125
+ });
126
+ };
127
+
128
+ var fetchCountries = function fetchCountries() {
129
+ return axios.get("".concat(BASE_URL, "/api/v1/stripe/countries"));
130
+ };
131
+ var countriesApi = {
132
+ fetchCountries: fetchCountries
133
+ };
134
+
135
+ var useFetchStripeCountries = function useFetchStripeCountries() {
136
+ return useQuery({
137
+ queryKey: [QUERY_KEYS.STRIPE_COUNTRIES],
138
+ queryFn: countriesApi.fetchCountries
139
+ });
140
+ };
141
+
142
+ var buildRefreshUrl = function buildRefreshUrl(accountId, returnUrl) {
143
+ return "/payments/api/v1/stripe/callbacks/".concat(accountId, "/refresh?return_url=").concat(returnUrl);
144
+ };
145
+ var buildCountryOptions = function buildCountryOptions(countries) {
146
+ var _Object$entries;
147
+ return (_Object$entries = Object.entries(countries)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (country) {
148
+ return {
149
+ label: humanize(country[0]),
150
+ value: country[1]
151
+ };
152
+ });
153
+ };
154
+
155
+ var Country = function Country(_ref) {
156
+ var processingPageRoute = _ref.processingPageRoute,
157
+ productNameLabel = _ref.productNameLabel;
158
+ var _useState = useState(false),
159
+ _useState2 = _slicedToArray(_useState, 2),
160
+ isPolling = _useState2[0],
161
+ setIsPolling = _useState2[1];
162
+ var _useTranslation = useTranslation(),
163
+ t = _useTranslation.t;
164
+ var history = useHistory();
165
+ var refetchInterval = function refetchInterval(query) {
166
+ var _ref2 = query.state.data || {},
167
+ jobStatus = _ref2.jobStatus,
168
+ onboarding = _ref2.onboarding;
169
+ if (jobStatus === "complete") {
170
+ window.open(onboarding === null || onboarding === void 0 ? void 0 : onboarding.url, "_self");
171
+ return false;
172
+ }
173
+ return POLLING_INTERVAL;
174
+ };
175
+ var _useCreateStripeAccou = useCreateStripeAccount({
176
+ onSuccess: function onSuccess() {
177
+ return setIsPolling(true);
178
+ }
179
+ }),
180
+ isCreating = _useCreateStripeAccou.isPending,
181
+ _useCreateStripeAccou2 = _useCreateStripeAccou.data,
182
+ _useCreateStripeAccou3 = _useCreateStripeAccou2 === void 0 ? {} : _useCreateStripeAccou2,
183
+ jobId = _useCreateStripeAccou3.jobId,
184
+ createStripeAccount = _useCreateStripeAccou.mutate;
185
+ var _useFetchStripeCountr = useFetchStripeCountries(),
186
+ isLoading = _useFetchStripeCountr.isLoading,
187
+ _useFetchStripeCountr2 = _useFetchStripeCountr.data,
188
+ _useFetchStripeCountr3 = _useFetchStripeCountr2 === void 0 ? {} : _useFetchStripeCountr2,
189
+ _useFetchStripeCountr4 = _useFetchStripeCountr3.countries,
190
+ countries = _useFetchStripeCountr4 === void 0 ? {} : _useFetchStripeCountr4;
191
+ usePollingStripeAccountCreationStatus(jobId, {
192
+ refetchInterval: refetchInterval,
193
+ enabled: isPresent(jobId)
194
+ });
195
+ var handleSubmit = function handleSubmit(values) {
196
+ var payload = {
197
+ returnUrl: "".concat(window.location.origin).concat(processingPageRoute),
198
+ country: values.country.value
199
+ };
200
+ createStripeAccount(payload);
201
+ };
202
+ if (isLoading) {
203
+ return /*#__PURE__*/jsx("div", {
204
+ className: "flex items-center justify-center flex-grow w-full",
205
+ children: /*#__PURE__*/jsx(Spinner, {})
206
+ });
207
+ }
208
+ return /*#__PURE__*/jsx(Form, {
209
+ className: "w-full",
210
+ formikProps: {
211
+ enableReinitialize: true,
212
+ initialValues: INITIAL_VALUES,
213
+ validationSchema: VALIDATION_SCHEMA,
214
+ onSubmit: handleSubmit
215
+ },
216
+ children: /*#__PURE__*/jsx(CardLayout, {
217
+ icon: /*#__PURE__*/jsx(Stripe, {
218
+ size: 48
219
+ }),
220
+ title: t("neetoPayments.stripeConnect.title"),
221
+ actionBlock: /*#__PURE__*/jsx(ActionBlock, {
222
+ cancelButtonProps: {
223
+ onClick: function onClick() {
224
+ return history.goBack();
225
+ }
226
+ },
227
+ isSubmitting: isCreating || isPolling,
228
+ submitButtonProps: {
229
+ label: t("neetoPayments.common.connect")
230
+ }
231
+ }),
232
+ description: t("neetoPayments.stripeConnect.unlinkedDescription", {
233
+ productNameLabel: productNameLabel
234
+ }),
235
+ children: /*#__PURE__*/jsx(Select, {
236
+ required: true,
237
+ helpText: t("neetoPayments.stripeConnect.countryHelpText"),
238
+ label: t("neetoPayments.common.country"),
239
+ name: "country",
240
+ options: buildCountryOptions(countries),
241
+ placeholder: t("neetoPayments.stripeConnect.countryPlaceholder")
242
+ })
243
+ })
244
+ });
245
+ };
246
+
247
+ var Processing = function Processing(_ref) {
248
+ var getStripeAccount = _ref.getStripeAccount,
249
+ productNameLabel = _ref.productNameLabel,
250
+ manageRoute = _ref.manageRoute;
251
+ var _useState = useState(false),
252
+ _useState2 = _slicedToArray(_useState, 2),
253
+ isPolling = _useState2[0],
254
+ setIsPolling = _useState2[1];
255
+ var _useTranslation = useTranslation(),
256
+ t = _useTranslation.t;
257
+ var history = useHistory();
258
+ var _useQueryParams = useQueryParams(),
259
+ error = _useQueryParams.error,
260
+ errorDescription = _useQueryParams.errorDescription;
261
+ var refetchInterval = function refetchInterval(query) {
262
+ var _ref2 = query.state.data || {},
263
+ stripeStandardAccounts = _ref2.stripeStandardAccounts;
264
+ var stripeAccount = getStripeAccount(stripeStandardAccounts);
265
+ if (!(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) && isPolling) {
266
+ return POLLING_INTERVAL;
267
+ }
268
+ if (stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) {
269
+ setIsPolling(false);
270
+ history.push(manageRoute);
271
+ }
272
+ return false;
273
+ };
274
+ var _useFetchPaymentInteg = useFetchPaymentIntegrations({
275
+ refetchInterval: refetchInterval,
276
+ enabled: isNotPresent(error)
277
+ }),
278
+ _useFetchPaymentInteg2 = _useFetchPaymentInteg.data,
279
+ _useFetchPaymentInteg3 = _useFetchPaymentInteg2 === void 0 ? {} : _useFetchPaymentInteg2,
280
+ stripeStandardAccounts = _useFetchPaymentInteg3.stripeStandardAccounts;
281
+ var stripeAccount = getStripeAccount(stripeStandardAccounts);
282
+ var isAccountProcessingFailed = isPresent(error) && isPresent(errorDescription) || !isPolling && !(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected);
283
+ useEffect(function () {
284
+ if (stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) {
285
+ history.push(manageRoute);
286
+ }
287
+ if (isNotPresent(error)) {
288
+ setIsPolling(true);
289
+ }
290
+ setInterval(function () {
291
+ setIsPolling(false);
292
+ }, MAX_POLLING_TIME);
293
+ }, []);
294
+ return /*#__PURE__*/jsxs(CardLayout, {
295
+ icon: /*#__PURE__*/jsx(Stripe, {
296
+ size: 48
297
+ }),
298
+ title: t("neetoPayments.stripeConnect.title"),
299
+ actionBlock: isAccountProcessingFailed && /*#__PURE__*/jsx(Button, {
300
+ href: buildRefreshUrl(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id),
301
+ label: t("neetoPayments.common.tryAgain")
302
+ }),
303
+ description: t("neetoPayments.stripeConnect.linkedDescription", {
304
+ productNameLabel: productNameLabel
305
+ }),
306
+ children: [isPolling && /*#__PURE__*/jsx(Callout, {
307
+ children: /*#__PURE__*/jsxs("div", {
308
+ className: "flex space-x-4",
309
+ children: [/*#__PURE__*/jsx(Spinner, {}), /*#__PURE__*/jsx(Typography, {
310
+ style: "body1",
311
+ children: t("neetoPayments.stripeConnect.verifyingMessage")
312
+ })]
313
+ })
314
+ }), isAccountProcessingFailed && /*#__PURE__*/jsx(Callout, {
315
+ style: "danger",
316
+ children: /*#__PURE__*/jsx(Typography, {
317
+ style: "body1",
318
+ children: isPresent(errorDescription) ? _humanize(errorDescription) : t("neetoPayments.stripeConnect.failedProcessing")
319
+ })
320
+ })]
321
+ });
322
+ };
323
+
324
+ var StripeConnect = function StripeConnect(_ref) {
325
+ var baseRoute = _ref.baseRoute,
326
+ manageRoute = _ref.manageRoute,
327
+ breadcrumbs = _ref.breadcrumbs,
328
+ productNameLabel = _ref.productNameLabel,
329
+ _ref$getStripeAccount = _ref.getStripeAccount,
330
+ getStripeAccount = _ref$getStripeAccount === void 0 ? noop : _ref$getStripeAccount;
331
+ var _useTranslation = useTranslation(),
332
+ t = _useTranslation.t;
333
+ var countryPageRoute = "".concat(baseRoute, "/countries");
334
+ var processingPageRoute = "".concat(baseRoute, "/processing");
335
+ return /*#__PURE__*/jsxs(Container, {
336
+ children: [/*#__PURE__*/jsx(Header, {
337
+ breadcrumbs: breadcrumbs,
338
+ title: t("neetoPayments.common.connect")
339
+ }), /*#__PURE__*/jsxs(Switch, {
340
+ children: [/*#__PURE__*/jsx(Route, {
341
+ exact: true,
342
+ path: baseRoute,
343
+ render: function render() {
344
+ return /*#__PURE__*/jsx(Account, {
345
+ countryPageRoute: countryPageRoute,
346
+ getStripeAccount: getStripeAccount,
347
+ manageRoute: manageRoute,
348
+ processingPageRoute: processingPageRoute,
349
+ productNameLabel: productNameLabel
350
+ });
351
+ }
352
+ }), /*#__PURE__*/jsx(Route, {
353
+ exact: true,
354
+ path: countryPageRoute,
355
+ component: function component() {
356
+ return /*#__PURE__*/jsx(Country, {
357
+ processingPageRoute: processingPageRoute,
358
+ productNameLabel: productNameLabel
359
+ });
360
+ }
361
+ }), /*#__PURE__*/jsx(Route, {
362
+ exact: true,
363
+ path: processingPageRoute,
364
+ component: function component() {
365
+ return /*#__PURE__*/jsx(Processing, {
366
+ getStripeAccount: getStripeAccount,
367
+ manageRoute: manageRoute,
368
+ productNameLabel: productNameLabel
369
+ });
370
+ }
371
+ })]
372
+ })]
373
+ });
374
+ };
375
+
376
+ export { StripeConnect as default };
377
+ //# sourceMappingURL=StripeConnect.js.map