@bigbinary/neeto-payments-frontend 6.1.12 → 6.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccountsDashboard.js +308 -333
- package/dist/AccountsDashboard.js.map +1 -1
- package/dist/AdminCancelRecurringPaymentButton.js +43 -54
- package/dist/AdminCancelRecurringPaymentButton.js.map +1 -1
- package/dist/CashPaymentButton.js +32 -34
- package/dist/CashPaymentButton.js.map +1 -1
- package/dist/ConfirmCashPaymentButton.js +77 -71
- package/dist/ConfirmCashPaymentButton.js.map +1 -1
- package/dist/{CopyButtonWrapper-rv-OaINx.js → CopyButtonWrapper-Bp5IVO76.js} +16 -14
- package/dist/CopyButtonWrapper-Bp5IVO76.js.map +1 -0
- package/dist/CustomerCancelRecurringPaymentForm.js +76 -75
- package/dist/CustomerCancelRecurringPaymentForm.js.map +1 -1
- package/dist/ExportModal-CoRuQVas.js +120 -0
- package/dist/ExportModal-CoRuQVas.js.map +1 -0
- package/dist/ManualUpiConnect.js +159 -178
- package/dist/ManualUpiConnect.js.map +1 -1
- package/dist/ManualUpiPayment.js +85 -89
- package/dist/ManualUpiPayment.js.map +1 -1
- package/dist/ManualUpiPaymentConfirmButton.js +119 -115
- package/dist/ManualUpiPaymentConfirmButton.js.map +1 -1
- package/dist/ManualUpiPaymentRejectButton.js +98 -92
- package/dist/ManualUpiPaymentRejectButton.js.map +1 -1
- package/dist/PaymentKindRestrictionAlert.js +14 -19
- package/dist/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/PaymentsDashboard.js +318 -349
- package/dist/PaymentsDashboard.js.map +1 -1
- package/dist/PayoutsDashboard.js +327 -350
- package/dist/PayoutsDashboard.js.map +1 -1
- package/dist/PayoutsPage.js +114 -92
- package/dist/PayoutsPage.js.map +1 -1
- package/dist/RazorpayConnect.js +71 -62
- package/dist/RazorpayConnect.js.map +1 -1
- package/dist/RazorpayLinkedAccountForm.js +145 -156
- package/dist/RazorpayLinkedAccountForm.js.map +1 -1
- package/dist/RazorpayPaymentButton.js +72 -100
- package/dist/RazorpayPaymentButton.js.map +1 -1
- package/dist/RecurringPaymentSettings.js +85 -85
- package/dist/RecurringPaymentSettings.js.map +1 -1
- package/dist/RefundsDashboard.js +363 -386
- package/dist/RefundsDashboard.js.map +1 -1
- package/dist/SplitTransfersDashboard.js +868 -829
- package/dist/SplitTransfersDashboard.js.map +1 -1
- package/dist/StripeCheckoutSetting.js +63 -75
- package/dist/StripeCheckoutSetting.js.map +1 -1
- package/dist/StripeConnect.js +257 -259
- package/dist/StripeConnect.js.map +1 -1
- package/dist/StripeManage.js +28 -25
- package/dist/StripeManage.js.map +1 -1
- package/dist/TaxesDashboard.js +284 -292
- package/dist/TaxesDashboard.js.map +1 -1
- package/dist/buildStripeTransactionLink.js +1 -1
- package/dist/cjs/AccountsDashboard.js +308 -333
- package/dist/cjs/AccountsDashboard.js.map +1 -1
- package/dist/cjs/AdminCancelRecurringPaymentButton.js +43 -54
- package/dist/cjs/AdminCancelRecurringPaymentButton.js.map +1 -1
- package/dist/cjs/CashPaymentButton.js +32 -34
- package/dist/cjs/CashPaymentButton.js.map +1 -1
- package/dist/cjs/ConfirmCashPaymentButton.js +77 -71
- package/dist/cjs/ConfirmCashPaymentButton.js.map +1 -1
- package/dist/cjs/{CopyButtonWrapper-BkpN0Wmd.js → CopyButtonWrapper-I-kdKiiB.js} +16 -14
- package/dist/cjs/CopyButtonWrapper-I-kdKiiB.js.map +1 -0
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js +76 -75
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js.map +1 -1
- package/dist/cjs/ExportModal-ClKqp-oy.js +122 -0
- package/dist/cjs/ExportModal-ClKqp-oy.js.map +1 -0
- package/dist/cjs/ManualUpiConnect.js +159 -178
- package/dist/cjs/ManualUpiConnect.js.map +1 -1
- package/dist/cjs/ManualUpiPayment.js +85 -89
- package/dist/cjs/ManualUpiPayment.js.map +1 -1
- package/dist/cjs/ManualUpiPaymentConfirmButton.js +118 -114
- package/dist/cjs/ManualUpiPaymentConfirmButton.js.map +1 -1
- package/dist/cjs/ManualUpiPaymentRejectButton.js +98 -92
- package/dist/cjs/ManualUpiPaymentRejectButton.js.map +1 -1
- package/dist/cjs/PaymentKindRestrictionAlert.js +14 -19
- package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/cjs/PaymentsDashboard.js +318 -349
- package/dist/cjs/PaymentsDashboard.js.map +1 -1
- package/dist/cjs/PayoutsDashboard.js +327 -350
- package/dist/cjs/PayoutsDashboard.js.map +1 -1
- package/dist/cjs/PayoutsPage.js +114 -92
- package/dist/cjs/PayoutsPage.js.map +1 -1
- package/dist/cjs/RazorpayConnect.js +71 -62
- package/dist/cjs/RazorpayConnect.js.map +1 -1
- package/dist/cjs/RazorpayLinkedAccountForm.js +145 -156
- package/dist/cjs/RazorpayLinkedAccountForm.js.map +1 -1
- package/dist/cjs/RazorpayPaymentButton.js +72 -100
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
- package/dist/cjs/RecurringPaymentSettings.js +85 -85
- package/dist/cjs/RecurringPaymentSettings.js.map +1 -1
- package/dist/cjs/RefundsDashboard.js +363 -386
- package/dist/cjs/RefundsDashboard.js.map +1 -1
- package/dist/cjs/SplitTransfersDashboard.js +867 -828
- package/dist/cjs/SplitTransfersDashboard.js.map +1 -1
- package/dist/cjs/StripeCheckoutSetting.js +63 -75
- package/dist/cjs/StripeCheckoutSetting.js.map +1 -1
- package/dist/cjs/StripeConnect.js +257 -259
- package/dist/cjs/StripeConnect.js.map +1 -1
- package/dist/cjs/StripeManage.js +28 -25
- package/dist/cjs/StripeManage.js.map +1 -1
- package/dist/cjs/TaxesDashboard.js +284 -292
- package/dist/cjs/TaxesDashboard.js.map +1 -1
- package/dist/cjs/buildStripeTransactionLink.js +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/dashboard-B1R6fLcS.js +96 -0
- package/dist/cjs/dashboard-B1R6fLcS.js.map +1 -0
- package/dist/cjs/{exportChannel-D1Wls92m.js → exportChannel-BL2RGGhP.js} +16 -18
- package/dist/cjs/{exportChannel-D1Wls92m.js.map → exportChannel-BL2RGGhP.js.map} +1 -1
- package/dist/cjs/getAddressElementOptions.js +1 -1
- package/dist/cjs/getAmountInLargestCurrencyUnit.js +1 -1
- package/dist/cjs/getAmountInSmallestCurrencyUnit.js +1 -1
- package/dist/cjs/getAmountWithAppliedTax.js +1 -1
- package/dist/cjs/getFormattedAmount.js +1 -1
- package/dist/cjs/getFormattedDiscountedAmount.js +1 -1
- package/dist/cjs/getFormattedDiscountedPercentage.js +1 -1
- package/dist/cjs/getFormattedTaxAmount.js +1 -1
- package/dist/cjs/getFormattedTipAmount.js +1 -1
- package/dist/cjs/getQrCodeValue.js +1 -1
- package/dist/cjs/getTaxAmount.js +1 -1
- package/dist/cjs/getTipAmount.js +1 -1
- package/dist/cjs/hasAmountToPay.js +1 -1
- package/dist/cjs/index-C3LUTqjR.js +855 -0
- package/dist/cjs/{index-CZ_VFGNj.js.map → index-C3LUTqjR.js.map} +1 -1
- package/dist/cjs/index.js +14 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{queryConstants-Cka1X6GX.js → queryConstants-Dc6wh21D.js} +2 -2
- package/dist/cjs/{queryConstants-Cka1X6GX.js.map → queryConstants-Dc6wh21D.js.map} +1 -1
- package/dist/cjs/renderFunctions-ghFUoYiM.js +48 -0
- package/dist/cjs/renderFunctions-ghFUoYiM.js.map +1 -0
- package/dist/cjs/useAccountsApi-Dw9yNiOj.js +42 -0
- package/dist/cjs/useAccountsApi-Dw9yNiOj.js.map +1 -0
- package/dist/cjs/useIntegrationsApi-B8JBENJ0.js +20 -0
- package/dist/cjs/{useIntegrationsApi-BO9PhVVO.js.map → useIntegrationsApi-B8JBENJ0.js.map} +1 -1
- package/dist/cjs/usePaymentApi-C034qyn4.js +29 -0
- package/dist/cjs/usePaymentApi-C034qyn4.js.map +1 -0
- package/dist/cjs/usePaymentApi-Dvv-jkNC.js +44 -0
- package/dist/cjs/usePaymentApi-Dvv-jkNC.js.map +1 -0
- package/dist/cjs/usePaymentApi-HlugiqX9.js +29 -0
- package/dist/cjs/{usePaymentApi-BE8xfY-U.js.map → usePaymentApi-HlugiqX9.js.map} +1 -1
- package/dist/cjs/usePlatformApi-DpOqBsBn.js +55 -0
- package/dist/cjs/{usePlatformApi-C7lXP6ev.js.map → usePlatformApi-DpOqBsBn.js.map} +1 -1
- package/dist/cjs/useRazorpayPayment.js +48 -73
- package/dist/cjs/useRazorpayPayment.js.map +1 -1
- package/dist/cjs/useStripePromise.js +22 -48
- package/dist/cjs/useStripePromise.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/dashboard-CKB3Vyop.js +90 -0
- package/dist/dashboard-CKB3Vyop.js.map +1 -0
- package/dist/{exportChannel-DAxJ44QB.js → exportChannel-Db0U5gc1.js} +16 -18
- package/dist/{exportChannel-DAxJ44QB.js.map → exportChannel-Db0U5gc1.js.map} +1 -1
- package/dist/getAddressElementOptions.js +1 -1
- package/dist/getAmountInLargestCurrencyUnit.js +1 -1
- package/dist/getAmountInSmallestCurrencyUnit.js +1 -1
- package/dist/getAmountWithAppliedTax.js +1 -1
- package/dist/getFormattedAmount.js +1 -1
- package/dist/getFormattedDiscountedAmount.js +1 -1
- package/dist/getFormattedDiscountedPercentage.js +1 -1
- package/dist/getFormattedTaxAmount.js +1 -1
- package/dist/getFormattedTipAmount.js +1 -1
- package/dist/getQrCodeValue.js +1 -1
- package/dist/getTaxAmount.js +1 -1
- package/dist/getTipAmount.js +1 -1
- package/dist/hasAmountToPay.js +1 -1
- package/dist/index-BTVToZp9.js +804 -0
- package/dist/{index-C7irWceQ.js.map → index-BTVToZp9.js.map} +1 -1
- package/dist/index.js +14 -20
- package/dist/index.js.map +1 -1
- package/dist/{queryConstants-DFKKEEo0.js → queryConstants-C7AqdemO.js} +2 -2
- package/dist/{queryConstants-DFKKEEo0.js.map → queryConstants-C7AqdemO.js.map} +1 -1
- package/dist/renderFunctions-BB3hiqhN.js +44 -0
- package/dist/renderFunctions-BB3hiqhN.js.map +1 -0
- package/dist/useAccountsApi-C4KOwjWh.js +38 -0
- package/dist/useAccountsApi-C4KOwjWh.js.map +1 -0
- package/dist/useIntegrationsApi-CDqBFq32.js +18 -0
- package/dist/{useIntegrationsApi-D1bkKtoy.js.map → useIntegrationsApi-CDqBFq32.js.map} +1 -1
- package/dist/usePaymentApi-B3dzQqWN.js +26 -0
- package/dist/usePaymentApi-B3dzQqWN.js.map +1 -0
- package/dist/usePaymentApi-DG2ApS6s.js +41 -0
- package/dist/usePaymentApi-DG2ApS6s.js.map +1 -0
- package/dist/usePaymentApi-_dPcALic.js +27 -0
- package/dist/{usePaymentApi-DcMNbOMk.js.map → usePaymentApi-_dPcALic.js.map} +1 -1
- package/dist/usePlatformApi-DBLpH3rH.js +50 -0
- package/dist/{usePlatformApi-Di7Dg-Gn.js.map → usePlatformApi-DBLpH3rH.js.map} +1 -1
- package/dist/useRazorpayPayment.js +48 -73
- package/dist/useRazorpayPayment.js.map +1 -1
- package/dist/useStripePromise.js +22 -48
- package/dist/useStripePromise.js.map +1 -1
- package/package.json +12 -11
- package/dist/CopyButtonWrapper-rv-OaINx.js.map +0 -1
- package/dist/ExportModal-CxKyrlwf.js +0 -120
- package/dist/ExportModal-CxKyrlwf.js.map +0 -1
- package/dist/cjs/CopyButtonWrapper-BkpN0Wmd.js.map +0 -1
- package/dist/cjs/ExportModal-DxCzPCh0.js +0 -122
- package/dist/cjs/ExportModal-DxCzPCh0.js.map +0 -1
- package/dist/cjs/dashboard-DKHencVn.js +0 -110
- package/dist/cjs/dashboard-DKHencVn.js.map +0 -1
- package/dist/cjs/index-CZ_VFGNj.js +0 -899
- package/dist/cjs/renderFunctions-CX_K4qf8.js +0 -51
- package/dist/cjs/renderFunctions-CX_K4qf8.js.map +0 -1
- package/dist/cjs/useAccountsApi-DC617yB4.js +0 -62
- package/dist/cjs/useAccountsApi-DC617yB4.js.map +0 -1
- package/dist/cjs/useIntegrationsApi-BO9PhVVO.js +0 -26
- package/dist/cjs/usePaymentApi-BE8xfY-U.js +0 -39
- package/dist/cjs/usePaymentApi-C9aQhuda.js +0 -56
- package/dist/cjs/usePaymentApi-C9aQhuda.js.map +0 -1
- package/dist/cjs/usePaymentApi-CrKom4eT.js +0 -41
- package/dist/cjs/usePaymentApi-CrKom4eT.js.map +0 -1
- package/dist/cjs/usePlatformApi-C7lXP6ev.js +0 -84
- package/dist/dashboard-ClEN2ygs.js +0 -104
- package/dist/dashboard-ClEN2ygs.js.map +0 -1
- package/dist/index-C7irWceQ.js +0 -848
- package/dist/renderFunctions-D9sAy3V_.js +0 -47
- package/dist/renderFunctions-D9sAy3V_.js.map +0 -1
- package/dist/useAccountsApi-DPem_UA-.js +0 -58
- package/dist/useAccountsApi-DPem_UA-.js.map +0 -1
- package/dist/useIntegrationsApi-D1bkKtoy.js +0 -24
- package/dist/usePaymentApi-BV0jXF-6.js +0 -38
- package/dist/usePaymentApi-BV0jXF-6.js.map +0 -1
- package/dist/usePaymentApi-DHARy-kC.js +0 -53
- package/dist/usePaymentApi-DHARy-kC.js.map +0 -1
- package/dist/usePaymentApi-DcMNbOMk.js +0 -37
- package/dist/usePlatformApi-Di7Dg-Gn.js +0 -79
package/dist/StripeConnect.js
CHANGED
|
@@ -3,190 +3,180 @@ import Container from '@bigbinary/neeto-molecules/Container';
|
|
|
3
3
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useHistory, Switch, Route } from 'react-router-dom';
|
|
6
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
6
|
import { useState, useEffect } from 'react';
|
|
8
7
|
import DOMPurify from 'dompurify';
|
|
9
8
|
import { buildUrl } from 'neetocommons/utils';
|
|
10
9
|
import { Stripe } from '@bigbinary/neeto-icons/misc';
|
|
11
10
|
import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
|
|
12
11
|
import { Button, Radio, Spinner, Callout, Typography } from '@bigbinary/neetoui';
|
|
13
|
-
import { u as useFetchPaymentIntegrations } from './useIntegrationsApi-
|
|
14
|
-
import { y as STRIPE_CONNECT_ENDPOINT, B as BASE_URL, t as POLLING_INTERVAL, E as ERROR_TYPE, M as MAX_POLLING_TIME } from './index-
|
|
12
|
+
import { u as useFetchPaymentIntegrations } from './useIntegrationsApi-CDqBFq32.js';
|
|
13
|
+
import { y as STRIPE_CONNECT_ENDPOINT, B as BASE_URL, t as POLLING_INTERVAL, E as ERROR_TYPE, M as MAX_POLLING_TIME } from './index-BTVToZp9.js';
|
|
15
14
|
import { t } from 'i18next';
|
|
16
15
|
import * as yup from 'yup';
|
|
16
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
17
|
import { Form, ActionBlock, Select } from '@bigbinary/neetoui/formik';
|
|
18
|
-
import { a as useCreateStripeAccount, b as usePollingStripeAccountCreationStatus } from './useAccountsApi-
|
|
18
|
+
import { a as useCreateStripeAccount, b as usePollingStripeAccountCreationStatus } from './useAccountsApi-C4KOwjWh.js';
|
|
19
19
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
20
20
|
import axios from 'axios';
|
|
21
|
-
import { Q as QUERY_KEYS } from './queryConstants-
|
|
21
|
+
import { Q as QUERY_KEYS } from './queryConstants-C7AqdemO.js';
|
|
22
22
|
import { useQueryParams } from 'neetocommons/react-utils';
|
|
23
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
24
23
|
import 'neetocommons/constants';
|
|
25
24
|
import 'decimal.js';
|
|
26
25
|
import 'ramda';
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
const INTEGRATION_METHOD = {
|
|
29
28
|
useExistingAccount: "use_existing_account",
|
|
30
29
|
createNewAccount: "create_new_account"
|
|
31
30
|
};
|
|
32
|
-
|
|
31
|
+
const INITIAL_VALUES = {
|
|
33
32
|
country: "",
|
|
34
33
|
return_url: ""
|
|
35
34
|
};
|
|
36
|
-
|
|
35
|
+
const VALIDATION_SCHEMA = yup.object().shape({
|
|
37
36
|
country: yup.object().required(t("neetoPayments.validations.countryRequired"))
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
const sanitize = DOMPurify.sanitize;
|
|
40
|
+
const Account = ({
|
|
41
|
+
processingPageRoute,
|
|
42
|
+
countryPageRoute,
|
|
43
|
+
holdableId,
|
|
44
|
+
productNameLabel,
|
|
45
|
+
getStripeAccount,
|
|
46
|
+
manageRoute
|
|
47
|
+
}) => {
|
|
48
|
+
const {
|
|
49
|
+
t
|
|
50
|
+
} = useTranslation();
|
|
51
|
+
const [selectedOption, setSelectedOption] = useState(INTEGRATION_METHOD.createNewAccount);
|
|
52
|
+
const history = useHistory();
|
|
53
|
+
const {
|
|
54
|
+
data: {
|
|
55
|
+
stripeStandardAccounts,
|
|
56
|
+
stripeStandardAccount
|
|
57
|
+
} = {}
|
|
58
|
+
} = useFetchPaymentIntegrations();
|
|
59
|
+
const stripeAccount = getStripeAccount(stripeStandardAccounts) || stripeStandardAccount;
|
|
60
|
+
const handleSubmit = () => {
|
|
62
61
|
if (selectedOption !== INTEGRATION_METHOD.useExistingAccount) {
|
|
63
62
|
return history.push(countryPageRoute);
|
|
64
63
|
}
|
|
65
|
-
|
|
66
|
-
return_url:
|
|
64
|
+
const params = {
|
|
65
|
+
return_url: `${window.location.origin}${processingPageRoute}`
|
|
67
66
|
};
|
|
68
67
|
if (holdableId) {
|
|
69
68
|
params.holdable_id = holdableId;
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
const stripeConnectUrl = buildUrl(STRIPE_CONNECT_ENDPOINT, params);
|
|
72
71
|
return window.location.href = sanitize(stripeConnectUrl);
|
|
73
72
|
};
|
|
74
|
-
useEffect(
|
|
75
|
-
if (stripeAccount
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (stripeAccount?.isConnected) {
|
|
76
75
|
history.push(manageRoute);
|
|
77
76
|
}
|
|
78
|
-
}, [stripeAccount
|
|
79
|
-
return /*#__PURE__*/
|
|
80
|
-
icon: /*#__PURE__*/
|
|
77
|
+
}, [stripeAccount?.isConnected]);
|
|
78
|
+
return /*#__PURE__*/jsx(CardLayout, {
|
|
79
|
+
icon: /*#__PURE__*/jsx(Stripe, {
|
|
81
80
|
size: 48
|
|
82
81
|
}),
|
|
83
82
|
title: t("neetoPayments.stripeConnect.title"),
|
|
84
|
-
actionBlock: /*#__PURE__*/
|
|
83
|
+
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
85
84
|
label: t("neetoPayments.common.continue"),
|
|
86
85
|
onClick: handleSubmit
|
|
87
86
|
}),
|
|
88
87
|
description: t("neetoPayments.stripeConnect.unlinkedDescription", {
|
|
89
|
-
productNameLabel
|
|
88
|
+
productNameLabel
|
|
89
|
+
}),
|
|
90
|
+
children: /*#__PURE__*/jsxs(Radio, {
|
|
91
|
+
value: selectedOption,
|
|
92
|
+
onChange: ({
|
|
93
|
+
target: {
|
|
94
|
+
value
|
|
95
|
+
}
|
|
96
|
+
}) => setSelectedOption(value),
|
|
97
|
+
children: [/*#__PURE__*/jsx(Radio.Item, {
|
|
98
|
+
label: t("neetoPayments.stripeConnect.createNewAccount"),
|
|
99
|
+
name: "accountMethod",
|
|
100
|
+
value: INTEGRATION_METHOD.createNewAccount
|
|
101
|
+
}), /*#__PURE__*/jsx(Radio.Item, {
|
|
102
|
+
label: t("neetoPayments.stripeConnect.useExistingAccount"),
|
|
103
|
+
name: "accountMethod",
|
|
104
|
+
value: INTEGRATION_METHOD.useExistingAccount
|
|
105
|
+
})]
|
|
90
106
|
})
|
|
91
|
-
}
|
|
92
|
-
value: selectedOption,
|
|
93
|
-
onChange: function onChange(_ref2) {
|
|
94
|
-
var value = _ref2.target.value;
|
|
95
|
-
return setSelectedOption(value);
|
|
96
|
-
}
|
|
97
|
-
}, /*#__PURE__*/React.createElement(Radio.Item, {
|
|
98
|
-
label: t("neetoPayments.stripeConnect.createNewAccount"),
|
|
99
|
-
name: "accountMethod",
|
|
100
|
-
value: INTEGRATION_METHOD.createNewAccount
|
|
101
|
-
}), /*#__PURE__*/React.createElement(Radio.Item, {
|
|
102
|
-
label: t("neetoPayments.stripeConnect.useExistingAccount"),
|
|
103
|
-
name: "accountMethod",
|
|
104
|
-
value: INTEGRATION_METHOD.useExistingAccount
|
|
105
|
-
})));
|
|
107
|
+
});
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var countriesApi = {
|
|
112
|
-
fetchCountries: fetchCountries
|
|
110
|
+
const fetchCountries = () => axios.get(`${BASE_URL}/api/v1/stripe/countries`);
|
|
111
|
+
const countriesApi = {
|
|
112
|
+
fetchCountries
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
};
|
|
115
|
+
const useFetchStripeCountries = () => useQuery({
|
|
116
|
+
queryKey: [QUERY_KEYS.STRIPE_COUNTRIES],
|
|
117
|
+
queryFn: countriesApi.fetchCountries
|
|
118
|
+
});
|
|
121
119
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return (_Object$entries = Object.entries(countries)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (country) {
|
|
128
|
-
return {
|
|
129
|
-
label: humanize(country[0]),
|
|
130
|
-
value: country[1]
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
};
|
|
120
|
+
const buildRefreshUrl = (accountId, returnUrl) => `${window.location.origin}/payments/api/v1/stripe/callbacks/${accountId}/refresh?return_url=${returnUrl}`;
|
|
121
|
+
const buildCountryOptions = countries => Object.entries(countries)?.map(country => ({
|
|
122
|
+
label: humanize(country[0]),
|
|
123
|
+
value: country[1]
|
|
124
|
+
}));
|
|
134
125
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onboarding = _ref2.onboarding;
|
|
126
|
+
const Country = ({
|
|
127
|
+
processingPageRoute,
|
|
128
|
+
productNameLabel,
|
|
129
|
+
getStripeAccount,
|
|
130
|
+
holdableId = ""
|
|
131
|
+
}) => {
|
|
132
|
+
const [isPolling, setIsPolling] = useState(false);
|
|
133
|
+
const {
|
|
134
|
+
t
|
|
135
|
+
} = useTranslation();
|
|
136
|
+
const history = useHistory();
|
|
137
|
+
const refetchInterval = query => {
|
|
138
|
+
const {
|
|
139
|
+
jobStatus,
|
|
140
|
+
onboarding
|
|
141
|
+
} = query.state.data || {};
|
|
152
142
|
if (jobStatus === "complete") {
|
|
153
|
-
window.open(onboarding
|
|
143
|
+
window.open(onboarding?.url, "_self");
|
|
154
144
|
return false;
|
|
155
145
|
}
|
|
156
146
|
return POLLING_INTERVAL;
|
|
157
147
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
isLoading
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
148
|
+
const {
|
|
149
|
+
isPending: isCreating,
|
|
150
|
+
data: {
|
|
151
|
+
jobId
|
|
152
|
+
} = {},
|
|
153
|
+
mutate: createStripeAccount
|
|
154
|
+
} = useCreateStripeAccount({
|
|
155
|
+
onSuccess: () => setIsPolling(true)
|
|
156
|
+
});
|
|
157
|
+
const {
|
|
158
|
+
data: {
|
|
159
|
+
stripeStandardAccounts,
|
|
160
|
+
stripeStandardAccount
|
|
161
|
+
} = {}
|
|
162
|
+
} = useFetchPaymentIntegrations();
|
|
163
|
+
const stripeAccount = getStripeAccount(stripeStandardAccounts) || stripeStandardAccount;
|
|
164
|
+
const {
|
|
165
|
+
isLoading,
|
|
166
|
+
data: {
|
|
167
|
+
countries = {}
|
|
168
|
+
} = {}
|
|
169
|
+
} = useFetchStripeCountries();
|
|
180
170
|
usePollingStripeAccountCreationStatus(jobId, {
|
|
181
|
-
refetchInterval
|
|
171
|
+
refetchInterval,
|
|
182
172
|
enabled: isPresent(jobId)
|
|
183
173
|
});
|
|
184
|
-
|
|
174
|
+
const handleSubmit = values => {
|
|
185
175
|
if (isPresent(stripeAccount)) {
|
|
186
|
-
return window.location.href = buildRefreshUrl(stripeAccount
|
|
176
|
+
return window.location.href = buildRefreshUrl(stripeAccount?.id, `${window.location.origin}${processingPageRoute}`);
|
|
187
177
|
}
|
|
188
|
-
|
|
189
|
-
returnUrl:
|
|
178
|
+
const payload = {
|
|
179
|
+
returnUrl: `${window.location.origin}${processingPageRoute}`,
|
|
190
180
|
country: values.country.value
|
|
191
181
|
};
|
|
192
182
|
if (holdableId) {
|
|
@@ -195,183 +185,191 @@ var Country = function Country(_ref) {
|
|
|
195
185
|
return createStripeAccount(payload);
|
|
196
186
|
};
|
|
197
187
|
if (isLoading) {
|
|
198
|
-
return /*#__PURE__*/
|
|
199
|
-
className: "flex items-center justify-center grow w-full"
|
|
200
|
-
|
|
188
|
+
return /*#__PURE__*/jsx("div", {
|
|
189
|
+
className: "flex items-center justify-center grow w-full",
|
|
190
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
191
|
+
});
|
|
201
192
|
}
|
|
202
|
-
return /*#__PURE__*/
|
|
193
|
+
return /*#__PURE__*/jsx(Form, {
|
|
203
194
|
className: "w-full",
|
|
204
195
|
formikProps: {
|
|
205
196
|
enableReinitialize: true,
|
|
206
197
|
initialValues: INITIAL_VALUES,
|
|
207
198
|
validationSchema: VALIDATION_SCHEMA,
|
|
208
199
|
onSubmit: handleSubmit
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
200
|
+
},
|
|
201
|
+
children: /*#__PURE__*/jsx(CardLayout, {
|
|
202
|
+
icon: /*#__PURE__*/jsx(Stripe, {
|
|
203
|
+
size: 48
|
|
204
|
+
}),
|
|
205
|
+
title: t("neetoPayments.stripeConnect.title"),
|
|
206
|
+
actionBlock: /*#__PURE__*/jsx(ActionBlock, {
|
|
207
|
+
cancelButtonProps: {
|
|
208
|
+
onClick: () => history.goBack()
|
|
209
|
+
},
|
|
210
|
+
isSubmitting: isCreating || isPolling,
|
|
211
|
+
submitButtonProps: {
|
|
212
|
+
label: t("neetoPayments.common.connect")
|
|
219
213
|
}
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
214
|
+
}),
|
|
215
|
+
description: t("neetoPayments.stripeConnect.unlinkedDescription", {
|
|
216
|
+
productNameLabel
|
|
217
|
+
}),
|
|
218
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
219
|
+
required: true,
|
|
220
|
+
helpText: t("neetoPayments.stripeConnect.countryHelpText"),
|
|
221
|
+
label: t("neetoPayments.common.country"),
|
|
222
|
+
name: "country",
|
|
223
|
+
options: buildCountryOptions(countries),
|
|
224
|
+
placeholder: t("neetoPayments.stripeConnect.countryPlaceholder")
|
|
225
|
+
})
|
|
228
226
|
})
|
|
229
|
-
}
|
|
230
|
-
required: true,
|
|
231
|
-
helpText: t("neetoPayments.stripeConnect.countryHelpText"),
|
|
232
|
-
label: t("neetoPayments.common.country"),
|
|
233
|
-
name: "country",
|
|
234
|
-
options: buildCountryOptions(countries),
|
|
235
|
-
placeholder: t("neetoPayments.stripeConnect.countryPlaceholder")
|
|
236
|
-
})));
|
|
227
|
+
});
|
|
237
228
|
};
|
|
238
229
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (!
|
|
230
|
+
const Processing = ({
|
|
231
|
+
baseRoute,
|
|
232
|
+
getStripeAccount,
|
|
233
|
+
productNameLabel,
|
|
234
|
+
manageRoute
|
|
235
|
+
}) => {
|
|
236
|
+
const queryClient = useQueryClient();
|
|
237
|
+
const [isPolling, setIsPolling] = useState(false);
|
|
238
|
+
const {
|
|
239
|
+
t
|
|
240
|
+
} = useTranslation();
|
|
241
|
+
const history = useHistory();
|
|
242
|
+
const {
|
|
243
|
+
error,
|
|
244
|
+
errorDescription = ""
|
|
245
|
+
} = useQueryParams();
|
|
246
|
+
const refetchInterval = query => {
|
|
247
|
+
const {
|
|
248
|
+
stripeStandardAccounts,
|
|
249
|
+
stripeStandardAccount
|
|
250
|
+
} = query.state.data || {};
|
|
251
|
+
const stripeAccount = getStripeAccount(stripeStandardAccounts) || stripeStandardAccount;
|
|
252
|
+
if (!stripeAccount?.isConnected && isPolling) {
|
|
262
253
|
return POLLING_INTERVAL;
|
|
263
254
|
}
|
|
264
|
-
if (stripeAccount
|
|
255
|
+
if (stripeAccount?.isConnected) {
|
|
265
256
|
setIsPolling(false);
|
|
266
257
|
history.push(manageRoute);
|
|
267
258
|
}
|
|
268
259
|
return false;
|
|
269
260
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
261
|
+
const {
|
|
262
|
+
data: {
|
|
263
|
+
stripeStandardAccounts,
|
|
264
|
+
stripeStandardAccount
|
|
265
|
+
} = {}
|
|
266
|
+
} = useFetchPaymentIntegrations({
|
|
267
|
+
refetchInterval,
|
|
268
|
+
enabled: isNotPresent(error)
|
|
269
|
+
});
|
|
270
|
+
const errorMessage = error === ERROR_TYPE.processing_error ? errorDescription : humanize(errorDescription);
|
|
271
|
+
const stripeAccount = getStripeAccount(stripeStandardAccounts) || stripeStandardAccount;
|
|
272
|
+
const isAccountProcessingFailed = isPresent(error) && isPresent(errorDescription) || !isPolling && !stripeAccount?.isConnected;
|
|
273
|
+
const handleRetry = () => {
|
|
282
274
|
queryClient.invalidateQueries({
|
|
283
275
|
queryKey: [QUERY_KEYS.PAYMENT_INTEGRATION_LIST]
|
|
284
276
|
});
|
|
285
277
|
history.push(baseRoute);
|
|
286
278
|
};
|
|
287
|
-
useEffect(
|
|
288
|
-
if (stripeAccount
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
if (stripeAccount?.isConnected) {
|
|
289
281
|
history.push(manageRoute);
|
|
290
282
|
}
|
|
291
283
|
if (isNotPresent(error)) {
|
|
292
284
|
setIsPolling(true);
|
|
293
285
|
}
|
|
294
|
-
|
|
286
|
+
const pollingTimeoutId = setTimeout(() => {
|
|
295
287
|
setIsPolling(false);
|
|
296
288
|
}, MAX_POLLING_TIME);
|
|
297
|
-
return
|
|
289
|
+
return () => {
|
|
298
290
|
clearTimeout(pollingTimeoutId);
|
|
299
291
|
};
|
|
300
292
|
}, []);
|
|
301
|
-
return /*#__PURE__*/
|
|
302
|
-
icon: /*#__PURE__*/
|
|
293
|
+
return /*#__PURE__*/jsxs(CardLayout, {
|
|
294
|
+
icon: /*#__PURE__*/jsx(Stripe, {
|
|
303
295
|
size: 48
|
|
304
296
|
}),
|
|
305
297
|
title: t("neetoPayments.stripeConnect.title"),
|
|
306
|
-
actionBlock: isAccountProcessingFailed && /*#__PURE__*/
|
|
298
|
+
actionBlock: isAccountProcessingFailed && /*#__PURE__*/jsx(Button, {
|
|
307
299
|
label: t("neetoPayments.common.tryAgain"),
|
|
308
300
|
onClick: handleRetry
|
|
309
301
|
}),
|
|
310
302
|
description: isAccountProcessingFailed ? t("neetoPayments.common.processingFailed") : t("neetoPayments.stripeConnect.linkedDescription", {
|
|
311
|
-
productNameLabel
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
303
|
+
productNameLabel
|
|
304
|
+
}),
|
|
305
|
+
children: [isPolling && /*#__PURE__*/jsx(Callout, {
|
|
306
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
307
|
+
className: "flex space-x-4",
|
|
308
|
+
children: [/*#__PURE__*/jsx(Spinner, {}), /*#__PURE__*/jsx(Typography, {
|
|
309
|
+
style: "body1",
|
|
310
|
+
children: t("neetoPayments.stripeConnect.verifyingMessage")
|
|
311
|
+
})]
|
|
312
|
+
})
|
|
313
|
+
}), isAccountProcessingFailed && /*#__PURE__*/jsx(Callout, {
|
|
314
|
+
style: "danger",
|
|
315
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
316
|
+
style: "body1",
|
|
317
|
+
children: isPresent(errorDescription) ? errorMessage : t("neetoPayments.stripeConnect.failedProcessing")
|
|
318
|
+
})
|
|
319
|
+
})]
|
|
320
|
+
});
|
|
322
321
|
};
|
|
323
322
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
t
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
})));
|
|
323
|
+
const StripeConnect = ({
|
|
324
|
+
baseRoute,
|
|
325
|
+
manageRoute,
|
|
326
|
+
breadcrumbs,
|
|
327
|
+
holdableId,
|
|
328
|
+
productNameLabel,
|
|
329
|
+
getStripeAccount = noop
|
|
330
|
+
}) => {
|
|
331
|
+
const {
|
|
332
|
+
t
|
|
333
|
+
} = useTranslation();
|
|
334
|
+
const countryPageRoute = `${baseRoute}/countries`;
|
|
335
|
+
const processingPageRoute = `${baseRoute}/processing`;
|
|
336
|
+
return /*#__PURE__*/jsxs(Container, {
|
|
337
|
+
children: [/*#__PURE__*/jsx(Header, {
|
|
338
|
+
breadcrumbs,
|
|
339
|
+
title: t("neetoPayments.common.connect")
|
|
340
|
+
}), /*#__PURE__*/jsxs(Switch, {
|
|
341
|
+
children: [/*#__PURE__*/jsx(Route, {
|
|
342
|
+
exact: true,
|
|
343
|
+
path: baseRoute,
|
|
344
|
+
render: () => /*#__PURE__*/jsx(Account, {
|
|
345
|
+
countryPageRoute,
|
|
346
|
+
getStripeAccount,
|
|
347
|
+
holdableId,
|
|
348
|
+
manageRoute,
|
|
349
|
+
processingPageRoute,
|
|
350
|
+
productNameLabel
|
|
351
|
+
})
|
|
352
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
353
|
+
exact: true,
|
|
354
|
+
path: countryPageRoute,
|
|
355
|
+
component: () => /*#__PURE__*/jsx(Country, {
|
|
356
|
+
getStripeAccount,
|
|
357
|
+
holdableId,
|
|
358
|
+
processingPageRoute,
|
|
359
|
+
productNameLabel
|
|
360
|
+
})
|
|
361
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
362
|
+
exact: true,
|
|
363
|
+
path: processingPageRoute,
|
|
364
|
+
component: () => /*#__PURE__*/jsx(Processing, {
|
|
365
|
+
baseRoute,
|
|
366
|
+
getStripeAccount,
|
|
367
|
+
manageRoute,
|
|
368
|
+
productNameLabel
|
|
369
|
+
})
|
|
370
|
+
})]
|
|
371
|
+
})]
|
|
372
|
+
});
|
|
375
373
|
};
|
|
376
374
|
|
|
377
375
|
export { StripeConnect as default };
|