@bigbinary/neeto-payments-frontend 2.2.0 → 2.2.2
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/app/javascript/src/translations/en.json +11 -2
- package/dist/AccountsDashboard.js +368 -302
- package/dist/AccountsDashboard.js.map +1 -1
- package/dist/CopyButtonWrapper-54c5e270.js +27 -0
- package/dist/CopyButtonWrapper-54c5e270.js.map +1 -0
- package/dist/Dashboard.js +532 -440
- package/dist/Dashboard.js.map +1 -1
- package/dist/ExportModal-e95e0af1.js +694 -0
- package/dist/ExportModal-e95e0af1.js.map +1 -0
- package/dist/IdentifierButton-350fcc55.js +19 -0
- package/dist/IdentifierButton-350fcc55.js.map +1 -0
- package/dist/PaymentKindRestrictionAlert.js +18 -12
- package/dist/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/PaymentsDashboard.js +474 -0
- package/dist/PaymentsDashboard.js.map +1 -0
- package/dist/PayoutsDashboard.js +373 -315
- package/dist/PayoutsDashboard.js.map +1 -1
- package/dist/PayoutsPage.js +136 -112
- package/dist/PayoutsPage.js.map +1 -1
- package/dist/RazorpayDashboard.js +184 -172
- package/dist/RazorpayDashboard.js.map +1 -1
- package/dist/RazorpayPaymentButton.js +92 -66
- package/dist/RazorpayPaymentButton.js.map +1 -1
- package/dist/StripeConnect.js +359 -318
- package/dist/StripeConnect.js.map +1 -1
- package/dist/UpiConnect.js +128 -106
- package/dist/UpiConnect.js.map +1 -1
- package/dist/UpiMarkAsPaidButton.js +22 -21
- package/dist/UpiMarkAsPaidButton.js.map +1 -1
- package/dist/UpiPayment.js +75 -63
- package/dist/UpiPayment.js.map +1 -1
- package/dist/V2PaymentsDashboard.js +185 -176
- package/dist/V2PaymentsDashboard.js.map +1 -1
- package/dist/_commonjsHelpers-ae89b920.js +6 -0
- package/dist/_commonjsHelpers-ae89b920.js.map +1 -0
- package/dist/buildStripeTransactionLink.js +2 -2
- package/dist/cjs/AccountsDashboard.js +369 -303
- package/dist/cjs/AccountsDashboard.js.map +1 -1
- package/dist/cjs/CopyButtonWrapper-57331e1c.js +34 -0
- package/dist/cjs/CopyButtonWrapper-57331e1c.js.map +1 -0
- package/dist/cjs/Dashboard.js +533 -441
- package/dist/cjs/Dashboard.js.map +1 -1
- package/dist/cjs/ExportModal-730a91b8.js +718 -0
- package/dist/cjs/ExportModal-730a91b8.js.map +1 -0
- package/dist/cjs/IdentifierButton-3162ff10.js +25 -0
- package/dist/cjs/IdentifierButton-3162ff10.js.map +1 -0
- package/dist/cjs/PaymentKindRestrictionAlert.js +18 -12
- package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/cjs/PaymentsDashboard.js +492 -0
- package/dist/cjs/PaymentsDashboard.js.map +1 -0
- package/dist/cjs/PayoutsDashboard.js +374 -316
- package/dist/cjs/PayoutsDashboard.js.map +1 -1
- package/dist/cjs/PayoutsPage.js +136 -112
- package/dist/cjs/PayoutsPage.js.map +1 -1
- package/dist/cjs/RazorpayDashboard.js +185 -173
- package/dist/cjs/RazorpayDashboard.js.map +1 -1
- package/dist/cjs/RazorpayPaymentButton.js +92 -66
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
- package/dist/cjs/StripeConnect.js +356 -315
- package/dist/cjs/StripeConnect.js.map +1 -1
- package/dist/cjs/UpiConnect.js +129 -107
- package/dist/cjs/UpiConnect.js.map +1 -1
- package/dist/cjs/UpiMarkAsPaidButton.js +22 -21
- package/dist/cjs/UpiMarkAsPaidButton.js.map +1 -1
- package/dist/cjs/UpiPayment.js +75 -63
- package/dist/cjs/UpiPayment.js.map +1 -1
- package/dist/cjs/V2PaymentsDashboard.js +186 -177
- package/dist/cjs/V2PaymentsDashboard.js.map +1 -1
- package/dist/cjs/_commonjsHelpers-755157d3.js +8 -0
- package/dist/cjs/_commonjsHelpers-755157d3.js.map +1 -0
- package/dist/cjs/buildStripeTransactionLink.js +1 -1
- package/dist/cjs/constants.js +12 -12
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/defineProperty-f3094d6c.js +45 -0
- package/dist/cjs/defineProperty-f3094d6c.js.map +1 -0
- package/dist/cjs/exportChannel-2d528a51.js +45 -0
- package/dist/cjs/{exportChannel-1c3103ef.js.map → exportChannel-2d528a51.js.map} +1 -1
- package/dist/cjs/{index-b7badf96.js → index-1ce7ebb8.js} +8 -8
- package/dist/cjs/{index-b7badf96.js.map → index-1ce7ebb8.js.map} +1 -1
- package/dist/cjs/index-6f9eb83b.js +387 -0
- package/dist/cjs/index-6f9eb83b.js.map +1 -0
- package/dist/cjs/index-8a575dd1.js +47 -0
- package/dist/cjs/index-8a575dd1.js.map +1 -0
- package/dist/cjs/index.js +31 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/objectWithoutProperties-2fed2d7d.js +33 -0
- package/dist/cjs/objectWithoutProperties-2fed2d7d.js.map +1 -0
- package/dist/cjs/{queryConstants-45f84f3e.js → queryConstants-cb79f600.js} +4 -3
- package/dist/cjs/queryConstants-cb79f600.js.map +1 -0
- package/dist/cjs/renderFunctions-0284d0cb.js +159 -0
- package/dist/cjs/renderFunctions-0284d0cb.js.map +1 -0
- package/dist/cjs/slicedToArray-f320d9e7.js +61 -0
- package/dist/cjs/slicedToArray-f320d9e7.js.map +1 -0
- package/dist/cjs/toConsumableArray-9abb3858.js +22 -0
- package/dist/cjs/toConsumableArray-9abb3858.js.map +1 -0
- package/dist/cjs/{useConnectApi-a80cbf88.js → useConnectApi-67c912ae.js} +106 -85
- package/dist/cjs/useConnectApi-67c912ae.js.map +1 -0
- package/dist/cjs/useFiltersAndPagination-cd8bd491.js +316 -0
- package/dist/cjs/useFiltersAndPagination-cd8bd491.js.map +1 -0
- package/dist/cjs/usePaymentApi-7c41a34a.js +57 -0
- package/dist/cjs/usePaymentApi-7c41a34a.js.map +1 -0
- package/dist/cjs/usePaymentsApi-f53c5543.js +45 -0
- package/dist/cjs/usePaymentsApi-f53c5543.js.map +1 -0
- package/dist/cjs/usePlatformApi-365cf2dc.js +149 -0
- package/dist/cjs/usePlatformApi-365cf2dc.js.map +1 -0
- package/dist/cjs/useRazorpayPayment.js +70 -48
- package/dist/cjs/useRazorpayPayment.js.map +1 -1
- package/dist/cjs/useStripePromise.js +41 -16
- package/dist/cjs/useStripePromise.js.map +1 -1
- package/dist/constants.js +12 -12
- package/dist/constants.js.map +1 -1
- package/dist/defineProperty-e90a259c.js +43 -0
- package/dist/defineProperty-e90a259c.js.map +1 -0
- package/dist/exportChannel-e33c4c66.js +38 -0
- package/dist/{exportChannel-23e4628c.js.map → exportChannel-e33c4c66.js.map} +1 -1
- package/dist/index-1fdfa272.js +384 -0
- package/dist/index-1fdfa272.js.map +1 -0
- package/dist/{index-1aedc364.js → index-adf12baa.js} +8 -8
- package/dist/{index-1aedc364.js.map → index-adf12baa.js.map} +1 -1
- package/dist/index-f03e9537.js +38 -0
- package/dist/index-f03e9537.js.map +1 -0
- package/dist/index.js +29 -21
- package/dist/index.js.map +1 -1
- package/dist/objectWithoutProperties-a0edb288.js +31 -0
- package/dist/objectWithoutProperties-a0edb288.js.map +1 -0
- package/dist/{queryConstants-7d91832f.js → queryConstants-fada3549.js} +4 -3
- package/dist/queryConstants-fada3549.js.map +1 -0
- package/dist/renderFunctions-3640a4cf.js +143 -0
- package/dist/renderFunctions-3640a4cf.js.map +1 -0
- package/dist/slicedToArray-b4278ecd.js +57 -0
- package/dist/slicedToArray-b4278ecd.js.map +1 -0
- package/dist/toConsumableArray-1cc38429.js +20 -0
- package/dist/toConsumableArray-1cc38429.js.map +1 -0
- package/dist/{useConnectApi-36a92bd8.js → useConnectApi-b4fc32db.js} +107 -86
- package/dist/useConnectApi-b4fc32db.js.map +1 -0
- package/dist/useFiltersAndPagination-d14df27d.js +302 -0
- package/dist/useFiltersAndPagination-d14df27d.js.map +1 -0
- package/dist/usePaymentApi-433482f2.js +50 -0
- package/dist/usePaymentApi-433482f2.js.map +1 -0
- package/dist/usePaymentsApi-e95b2517.js +38 -0
- package/dist/usePaymentsApi-e95b2517.js.map +1 -0
- package/dist/usePlatformApi-9711698e.js +137 -0
- package/dist/usePlatformApi-9711698e.js.map +1 -0
- package/dist/useRazorpayPayment.js +70 -48
- package/dist/useRazorpayPayment.js.map +1 -1
- package/dist/useStripePromise.js +41 -16
- package/dist/useStripePromise.js.map +1 -1
- package/package.json +1 -1
- package/dist/ExportModal-23f4fa34.js +0 -645
- package/dist/ExportModal-23f4fa34.js.map +0 -1
- package/dist/IdentifierButton-81450a91.js +0 -20
- package/dist/IdentifierButton-81450a91.js.map +0 -1
- package/dist/cjs/ExportModal-b94a33bf.js +0 -669
- package/dist/cjs/ExportModal-b94a33bf.js.map +0 -1
- package/dist/cjs/IdentifierButton-c5f8ded9.js +0 -26
- package/dist/cjs/IdentifierButton-c5f8ded9.js.map +0 -1
- package/dist/cjs/exportChannel-1c3103ef.js +0 -39
- package/dist/cjs/extends-1b35a664.js +0 -19
- package/dist/cjs/extends-1b35a664.js.map +0 -1
- package/dist/cjs/index-e317e851.js +0 -41
- package/dist/cjs/index-e317e851.js.map +0 -1
- package/dist/cjs/queryConstants-45f84f3e.js.map +0 -1
- package/dist/cjs/renderFunctions-621282bb.js +0 -165
- package/dist/cjs/renderFunctions-621282bb.js.map +0 -1
- package/dist/cjs/useConnectApi-a80cbf88.js.map +0 -1
- package/dist/cjs/useFiltersAndPagination-98eb45d6.js +0 -276
- package/dist/cjs/useFiltersAndPagination-98eb45d6.js.map +0 -1
- package/dist/cjs/usePaymentApi-77803596.js +0 -48
- package/dist/cjs/usePaymentApi-77803596.js.map +0 -1
- package/dist/cjs/usePaymentsApi-239e8d8a.js +0 -36
- package/dist/cjs/usePaymentsApi-239e8d8a.js.map +0 -1
- package/dist/cjs/usePlatformApi-6740cf80.js +0 -117
- package/dist/cjs/usePlatformApi-6740cf80.js.map +0 -1
- package/dist/exportChannel-23e4628c.js +0 -32
- package/dist/extends-093996c9.js +0 -17
- package/dist/extends-093996c9.js.map +0 -1
- package/dist/index-385083ef.js +0 -32
- package/dist/index-385083ef.js.map +0 -1
- package/dist/queryConstants-7d91832f.js.map +0 -1
- package/dist/renderFunctions-ac5ef9d0.js +0 -146
- package/dist/renderFunctions-ac5ef9d0.js.map +0 -1
- package/dist/useConnectApi-36a92bd8.js.map +0 -1
- package/dist/useFiltersAndPagination-8813cdb2.js +0 -262
- package/dist/useFiltersAndPagination-8813cdb2.js.map +0 -1
- package/dist/usePaymentApi-edc45d99.js +0 -41
- package/dist/usePaymentApi-edc45d99.js.map +0 -1
- package/dist/usePaymentsApi-663c4058.js +0 -29
- package/dist/usePaymentsApi-663c4058.js.map +0 -1
- package/dist/usePlatformApi-3faabc82.js +0 -105
- package/dist/usePlatformApi-3faabc82.js.map +0 -1
package/dist/StripeConnect.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { _ as _defineProperty } from './defineProperty-e90a259c.js';
|
|
2
|
+
import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
|
|
3
|
+
import * as React from 'react';
|
|
2
4
|
import { useState, useEffect, useMemo } from 'react';
|
|
3
5
|
import { humanize, isPresent } from '@bigbinary/neeto-cist';
|
|
4
6
|
import { useQueryParams, withT, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
7
|
import { Finish as Finish$1, Modal, Demo } from 'neetointegrations';
|
|
6
|
-
import { d as useCreateStripeAccount, e as usePollingStripeAccountCreationStatus, a as useFetchConnectedStripeAccount, f as useDestroyStripeAccount, g as usePollingStripeAccount } from './useConnectApi-
|
|
8
|
+
import { d as useCreateStripeAccount, e as usePollingStripeAccountCreationStatus, a as useFetchConnectedStripeAccount, f as useDestroyStripeAccount, g as usePollingStripeAccount } from './useConnectApi-b4fc32db.js';
|
|
7
9
|
import Label from '@bigbinary/neetoui/Label';
|
|
8
10
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
9
11
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -15,63 +17,69 @@ import { useHistory } from 'react-router-dom';
|
|
|
15
17
|
import { useQuery } from '@tanstack/react-query';
|
|
16
18
|
import axios from 'axios';
|
|
17
19
|
import { BASE_URL } from './constants.js';
|
|
18
|
-
import { Q as QUERY_KEYS } from './queryConstants-
|
|
20
|
+
import { Q as QUERY_KEYS } from './queryConstants-fada3549.js';
|
|
19
21
|
import { t } from 'i18next';
|
|
20
22
|
import * as yup from 'yup';
|
|
21
23
|
import 'ramda';
|
|
24
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
22
25
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
23
26
|
import Button from '@bigbinary/neetoui/Button';
|
|
24
27
|
import Radio from '@bigbinary/neetoui/Radio';
|
|
25
28
|
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
29
|
+
import './_commonjsHelpers-ae89b920.js';
|
|
26
30
|
import 'util';
|
|
27
31
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
28
32
|
|
|
29
33
|
var _path, _path2, _path3;
|
|
30
34
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
|
-
const SvgStripe = props => /*#__PURE__*/React
|
|
35
|
+
const SvgStripe = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
32
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
33
37
|
width: 54,
|
|
34
38
|
height: 54,
|
|
35
39
|
fill: "#6772e5",
|
|
36
40
|
viewBox: "0 0 32 32"
|
|
37
|
-
}, props), _path || (_path = /*#__PURE__*/React
|
|
41
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
38
42
|
fillRule: "evenodd",
|
|
39
43
|
d: "M111.328 15.602c0-4.97-2.415-8.9-7.013-8.9s-7.423 3.924-7.423 8.863c0 5.85 3.32 8.8 8.036 8.8 2.318 0 4.06-.528 5.377-1.26V19.22a10.246 10.246 0 0 1-4.764 1.075c-1.9 0-3.556-.67-3.774-2.943h9.497a39.64 39.64 0 0 0 .063-1.748zm-9.606-1.835c0-2.186 1.35-3.1 2.56-3.1s2.454.906 2.454 3.1zM89.4 6.712a5.434 5.434 0 0 0-3.801 1.509l-.254-1.208h-4.27v22.64l4.85-1.032v-5.488a5.434 5.434 0 0 0 3.444 1.265c3.472 0 6.64-2.792 6.64-8.957.003-5.66-3.206-8.73-6.614-8.73zM88.23 20.1a2.898 2.898 0 0 1-2.288-.906l-.03-7.2a2.928 2.928 0 0 1 2.315-.96c1.775 0 2.998 2 2.998 4.528.003 2.593-1.198 4.546-2.995 4.546zM79.25.57l-4.87 1.035v3.95l4.87-1.032z"
|
|
40
|
-
})), _path2 || (_path2 = /*#__PURE__*/React
|
|
44
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
41
45
|
d: "M74.38 7.035h4.87V24.04h-4.87z"
|
|
42
|
-
})), _path3 || (_path3 = /*#__PURE__*/React
|
|
46
|
+
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
43
47
|
fillRule: "evenodd",
|
|
44
48
|
d: "m69.164 8.47-.302-1.434h-4.196V24.04h4.848V12.5c1.147-1.5 3.082-1.208 3.698-1.017V7.038c-.646-.232-2.913-.658-4.048 1.43zm-9.73-5.646L54.698 3.83l-.02 15.562c0 2.87 2.158 4.993 5.038 4.993 1.585 0 2.756-.302 3.405-.643v-3.95c-.622.248-3.683 1.138-3.683-1.72v-6.9h3.683V7.035h-3.683zM46.3 11.97c0-.758.63-1.05 1.648-1.05a10.868 10.868 0 0 1 4.83 1.25V7.6a12.815 12.815 0 0 0-4.83-.888c-3.924 0-6.557 2.056-6.557 5.488 0 5.37 7.375 4.498 7.375 6.813 0 .906-.78 1.186-1.863 1.186-1.606 0-3.68-.664-5.307-1.55v4.63a13.461 13.461 0 0 0 5.307 1.117c4.033 0 6.813-1.992 6.813-5.485 0-5.796-7.417-4.76-7.417-6.943zM13.88 9.515c0-1.37 1.14-1.9 2.982-1.9A19.661 19.661 0 0 1 25.6 9.876v-8.27A23.184 23.184 0 0 0 16.862.001C9.762.001 5 3.72 5 9.93c0 9.716 13.342 8.138 13.342 12.326 0 1.638-1.4 2.146-3.37 2.146-2.905 0-6.657-1.202-9.6-2.802v8.378A24.353 24.353 0 0 0 14.973 32C22.27 32 27.3 28.395 27.3 22.077c0-10.486-13.42-8.613-13.42-12.56z"
|
|
45
49
|
})));
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
var fetchCountries = function fetchCountries() {
|
|
52
|
+
return axios.get("".concat(BASE_URL, "/api/v1/stripe/countries"));
|
|
53
|
+
};
|
|
54
|
+
var countriesApi = {
|
|
55
|
+
fetchCountries: fetchCountries
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
var useFetchStripeCountries = function useFetchStripeCountries() {
|
|
59
|
+
return useQuery({
|
|
60
|
+
queryKey: [QUERY_KEYS.STRIPE_COUNTRIES],
|
|
61
|
+
queryFn: countriesApi.fetchCountries
|
|
62
|
+
});
|
|
63
|
+
};
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
var POLLING_INTERVAL = 5000;
|
|
66
|
+
var MAX_POLLING_TIME = 30000;
|
|
67
|
+
var INITIAL_VALUES = {
|
|
60
68
|
country: "",
|
|
61
69
|
return_url: ""
|
|
62
70
|
};
|
|
63
|
-
|
|
71
|
+
var VALIDATION_SCHEMA = yup.object().shape({
|
|
64
72
|
country: yup.object().required(t("neetoPayments.validations.countryRequired")),
|
|
65
73
|
returnUrl: yup.string().url(t("neetoPayments.validations.invalidUrl"))
|
|
66
74
|
});
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
var STEPS = {
|
|
69
77
|
connect: "connect",
|
|
70
78
|
configure: "configure",
|
|
71
79
|
finish: "finish",
|
|
72
80
|
demo: "demo"
|
|
73
81
|
};
|
|
74
|
-
|
|
82
|
+
var INTEGRATION_STEPS = [{
|
|
75
83
|
step: "1",
|
|
76
84
|
label: t("neetoPayments.common.connect"),
|
|
77
85
|
isActive: false,
|
|
@@ -90,184 +98,199 @@ const INTEGRATION_STEPS = [{
|
|
|
90
98
|
// { step: "4", label: "demo", isActive: false, isCompleted: false },
|
|
91
99
|
];
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
var INTEGRATION_METHOD = {
|
|
94
102
|
useExistingAccount: "use_existing_account",
|
|
95
103
|
createNewAccount: "create_new_account"
|
|
96
104
|
};
|
|
97
|
-
|
|
105
|
+
var STRIPE_CONNECT_URL = "/".concat(BASE_URL, "/api/v1/integrations/connect/stripe");
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
var buildRefreshUrl = function buildRefreshUrl(accountId, returnUrl) {
|
|
108
|
+
return "/payments/api/v1/stripe/callbacks/".concat(accountId, "/refresh?return_url=").concat(returnUrl);
|
|
109
|
+
};
|
|
110
|
+
var buildCountryOptions = function buildCountryOptions(countries) {
|
|
111
|
+
var _Object$entries;
|
|
112
|
+
return (_Object$entries = Object.entries(countries)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (country) {
|
|
113
|
+
return {
|
|
114
|
+
label: humanize(country[0]),
|
|
115
|
+
value: country[1]
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
};
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
jobStatus,
|
|
119
|
-
onboarding
|
|
120
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
120
|
+
var AccountForm = function AccountForm(_ref) {
|
|
121
|
+
var holdableId = _ref.holdableId,
|
|
122
|
+
returnUrl = _ref.returnUrl;
|
|
123
|
+
var _useTranslation = useTranslation(),
|
|
124
|
+
t = _useTranslation.t;
|
|
125
|
+
var history = useHistory();
|
|
126
|
+
var _useState = useState(false),
|
|
127
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
128
|
+
isPolling = _useState2[0],
|
|
129
|
+
setIsPolling = _useState2[1];
|
|
130
|
+
var submitButtonLabel = isPolling ? t("neetoPayments.integrationModal.creating") : t("neetoPayments.common.connect");
|
|
131
|
+
var refetchInterval = function refetchInterval() {
|
|
132
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
133
|
+
jobStatus = _ref2.jobStatus,
|
|
134
|
+
onboarding = _ref2.onboarding;
|
|
121
135
|
if (jobStatus === "complete") {
|
|
122
|
-
window.open(onboarding
|
|
136
|
+
window.open(onboarding === null || onboarding === void 0 ? void 0 : onboarding.url, "_self");
|
|
123
137
|
return false;
|
|
124
138
|
}
|
|
125
139
|
return POLLING_INTERVAL;
|
|
126
140
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
var _useCreateStripeAccou = useCreateStripeAccount({
|
|
142
|
+
onSuccess: function onSuccess() {
|
|
143
|
+
return setIsPolling(true);
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
isCreating = _useCreateStripeAccou.isPending,
|
|
147
|
+
_useCreateStripeAccou2 = _useCreateStripeAccou.data,
|
|
148
|
+
_useCreateStripeAccou3 = _useCreateStripeAccou2 === void 0 ? {} : _useCreateStripeAccou2,
|
|
149
|
+
jobId = _useCreateStripeAccou3.jobId,
|
|
150
|
+
createStripeAccount = _useCreateStripeAccou.mutate;
|
|
136
151
|
usePollingStripeAccountCreationStatus(jobId, {
|
|
137
|
-
refetchInterval,
|
|
152
|
+
refetchInterval: refetchInterval,
|
|
138
153
|
enabled: isPresent(jobId)
|
|
139
154
|
});
|
|
140
|
-
|
|
141
|
-
isLoading,
|
|
142
|
-
data
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const payload = {
|
|
151
|
-
returnUrl,
|
|
155
|
+
var _useFetchStripeCountr = useFetchStripeCountries(),
|
|
156
|
+
isLoading = _useFetchStripeCountr.isLoading,
|
|
157
|
+
_useFetchStripeCountr2 = _useFetchStripeCountr.data,
|
|
158
|
+
_useFetchStripeCountr3 = _useFetchStripeCountr2 === void 0 ? {} : _useFetchStripeCountr2,
|
|
159
|
+
_useFetchStripeCountr4 = _useFetchStripeCountr3.countries,
|
|
160
|
+
countries = _useFetchStripeCountr4 === void 0 ? {} : _useFetchStripeCountr4;
|
|
161
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
162
|
+
var country = _ref3.country;
|
|
163
|
+
var payload = {
|
|
164
|
+
returnUrl: returnUrl,
|
|
152
165
|
country: country.value,
|
|
153
|
-
holdableId
|
|
166
|
+
holdableId: holdableId
|
|
154
167
|
};
|
|
155
168
|
createStripeAccount(payload);
|
|
156
169
|
};
|
|
157
170
|
if (isLoading) {
|
|
158
|
-
return /*#__PURE__*/
|
|
171
|
+
return /*#__PURE__*/jsx(PageLoader, {});
|
|
159
172
|
}
|
|
160
|
-
return /*#__PURE__*/
|
|
173
|
+
return /*#__PURE__*/jsx(Form, {
|
|
161
174
|
formikProps: {
|
|
162
175
|
enableReinitialize: true,
|
|
163
176
|
initialValues: INITIAL_VALUES,
|
|
164
177
|
validationSchema: VALIDATION_SCHEMA,
|
|
165
178
|
onSubmit: handleSubmit
|
|
166
|
-
}
|
|
167
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
168
|
-
className: "space-y-3"
|
|
169
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
170
|
-
required: true,
|
|
171
|
-
helpText: t("neetoPayments.integrationModal.form.helpText"),
|
|
172
|
-
label: t("neetoPayments.integrationModal.form.label"),
|
|
173
|
-
name: "country",
|
|
174
|
-
options: buildCountryOptions(countries),
|
|
175
|
-
placeholder: t("neetoPayments.integrationModal.form.placeholder")
|
|
176
|
-
}), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
177
|
-
cancelButtonProps: {
|
|
178
|
-
onClick: () => history.goBack()
|
|
179
179
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
181
|
+
className: "space-y-3",
|
|
182
|
+
children: [/*#__PURE__*/jsx(Select, {
|
|
183
|
+
required: true,
|
|
184
|
+
helpText: t("neetoPayments.integrationModal.form.helpText"),
|
|
185
|
+
label: t("neetoPayments.integrationModal.form.label"),
|
|
186
|
+
name: "country",
|
|
187
|
+
options: buildCountryOptions(countries),
|
|
188
|
+
placeholder: t("neetoPayments.integrationModal.form.placeholder")
|
|
189
|
+
}), /*#__PURE__*/jsx(ActionBlock, {
|
|
190
|
+
cancelButtonProps: {
|
|
191
|
+
onClick: function onClick() {
|
|
192
|
+
return history.goBack();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
isSubmitting: isCreating || isPolling,
|
|
196
|
+
submitButtonProps: {
|
|
197
|
+
label: submitButtonLabel
|
|
198
|
+
}
|
|
199
|
+
})]
|
|
200
|
+
})
|
|
201
|
+
});
|
|
185
202
|
};
|
|
186
203
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
var AccountDetails = function AccountDetails(_ref) {
|
|
205
|
+
var holdableId = _ref.holdableId;
|
|
206
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
207
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
208
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
209
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
210
|
+
var _useTranslation = useTranslation(),
|
|
211
|
+
t = _useTranslation.t;
|
|
212
|
+
return /*#__PURE__*/jsxs("div", {
|
|
213
|
+
className: "mb-6 space-y-3",
|
|
214
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
215
|
+
style: "h5",
|
|
216
|
+
weight: "medium",
|
|
217
|
+
children: t("neetoPayments.integrationModal.account.title")
|
|
218
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
219
|
+
className: "grid grid-cols-4 gap-y-3",
|
|
220
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
221
|
+
className: "neeto-ui-text-gray-800",
|
|
222
|
+
children: t("neetoPayments.common.id")
|
|
223
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
224
|
+
className: "neeto-ui-text-gray-800 col-span-3",
|
|
225
|
+
children: stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.identifier
|
|
226
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
227
|
+
className: "neeto-ui-text-gray-800",
|
|
228
|
+
children: t("neetoPayments.common.email")
|
|
229
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
230
|
+
className: "neeto-ui-text-gray-800 col-span-3",
|
|
231
|
+
children: stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.email
|
|
232
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
233
|
+
className: "neeto-ui-text-gray-800",
|
|
234
|
+
children: t("neetoPayments.common.country")
|
|
235
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
236
|
+
className: "neeto-ui-text-gray-800 col-span-3",
|
|
237
|
+
children: stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.country
|
|
238
|
+
})]
|
|
239
|
+
})]
|
|
240
|
+
});
|
|
219
241
|
};
|
|
220
242
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
243
|
+
var AccountProcessing = function AccountProcessing(_ref) {
|
|
244
|
+
var holdableId = _ref.holdableId,
|
|
245
|
+
returnUrl = _ref.returnUrl;
|
|
246
|
+
var _useQueryParams = useQueryParams(),
|
|
247
|
+
app = _useQueryParams.app;
|
|
248
|
+
var _useState = useState(false),
|
|
249
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
250
|
+
isAlertOpen = _useState2[0],
|
|
251
|
+
setIsAlertOpen = _useState2[1];
|
|
252
|
+
var _useState3 = useState(false),
|
|
253
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
254
|
+
isPolling = _useState4[0],
|
|
255
|
+
setIsPolling = _useState4[1];
|
|
256
|
+
var _useTranslation = useTranslation(),
|
|
257
|
+
t = _useTranslation.t;
|
|
258
|
+
var isStripeCallback = app === "stripe";
|
|
259
|
+
useEffect(function () {
|
|
236
260
|
if (!isStripeCallback) return;
|
|
237
261
|
setIsPolling(true);
|
|
238
|
-
setInterval(()
|
|
262
|
+
setInterval(function () {
|
|
239
263
|
setIsPolling(false);
|
|
240
264
|
}, MAX_POLLING_TIME);
|
|
241
265
|
}, [isStripeCallback]);
|
|
242
|
-
|
|
243
|
-
data
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
account
|
|
257
|
-
|
|
258
|
-
if (isStripeCallback && !account?.isConnected && isPolling) {
|
|
266
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
267
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
268
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
269
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
270
|
+
var _useDestroyStripeAcco = useDestroyStripeAccount({
|
|
271
|
+
onSuccess: function onSuccess() {
|
|
272
|
+
return setIsAlertOpen(false);
|
|
273
|
+
},
|
|
274
|
+
holdableId: holdableId
|
|
275
|
+
}),
|
|
276
|
+
isStripeAccountDestroying = _useDestroyStripeAcco.isPending,
|
|
277
|
+
destroyStripeAccount = _useDestroyStripeAcco.mutate;
|
|
278
|
+
var refetchInterval = function refetchInterval() {
|
|
279
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
280
|
+
account = _ref2.account;
|
|
281
|
+
if (isStripeCallback && !(account !== null && account !== void 0 && account.isConnected) && isPolling) {
|
|
259
282
|
return POLLING_INTERVAL;
|
|
260
283
|
}
|
|
261
|
-
if (account
|
|
284
|
+
if (account !== null && account !== void 0 && account.isConnected) {
|
|
262
285
|
setIsPolling(false);
|
|
263
286
|
}
|
|
264
287
|
return false;
|
|
265
288
|
};
|
|
266
289
|
usePollingStripeAccount(holdableId, {
|
|
267
|
-
refetchInterval
|
|
290
|
+
refetchInterval: refetchInterval
|
|
268
291
|
});
|
|
269
|
-
|
|
270
|
-
|
|
292
|
+
var isAccountProcessingFailed = isStripeCallback && !isPolling && !(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected);
|
|
293
|
+
var buttonLabel = function buttonLabel() {
|
|
271
294
|
if (isPolling) {
|
|
272
295
|
return t("neetoPayments.integrationModal.creating");
|
|
273
296
|
}
|
|
@@ -276,76 +299,81 @@ const AccountProcessing = _ref => {
|
|
|
276
299
|
}
|
|
277
300
|
return t("neetoPayments.common.continue");
|
|
278
301
|
};
|
|
279
|
-
|
|
280
|
-
destroyStripeAccount(stripeAccount
|
|
302
|
+
var handleUseAnotherStripeAccount = function handleUseAnotherStripeAccount() {
|
|
303
|
+
destroyStripeAccount(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id);
|
|
281
304
|
};
|
|
282
|
-
return /*#__PURE__*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
306
|
+
children: [/*#__PURE__*/jsx(AccountDetails, {}), /*#__PURE__*/jsxs("div", {
|
|
307
|
+
className: "flex flex-col items-start space-y-2",
|
|
308
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
309
|
+
disabled: isPolling,
|
|
310
|
+
href: buildRefreshUrl(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id, returnUrl),
|
|
311
|
+
label: buttonLabel(),
|
|
312
|
+
loading: isPolling,
|
|
313
|
+
size: "small"
|
|
314
|
+
}), !isPolling && !isAccountProcessingFailed && /*#__PURE__*/jsx(Button, {
|
|
315
|
+
disabled: isStripeAccountDestroying || isPolling,
|
|
316
|
+
label: t("neetoPayments.integrationModal.anotherAccount"),
|
|
317
|
+
size: "small",
|
|
318
|
+
style: "link",
|
|
319
|
+
onClick: function onClick() {
|
|
320
|
+
return setIsAlertOpen(true);
|
|
321
|
+
}
|
|
322
|
+
})]
|
|
323
|
+
}), /*#__PURE__*/jsx(Alert, {
|
|
324
|
+
isOpen: isAlertOpen,
|
|
325
|
+
title: t("neetoPayments.integrationModal.alert.changeTitle"),
|
|
326
|
+
message: /*#__PURE__*/jsx(Trans, {
|
|
327
|
+
i18nKey: "neetoPayments.integrationModal.alert.changeMessage",
|
|
328
|
+
values: {
|
|
329
|
+
account: stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.email
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
onClose: function onClose() {
|
|
333
|
+
return setIsAlertOpen(false);
|
|
334
|
+
},
|
|
335
|
+
onSubmit: handleUseAnotherStripeAccount
|
|
336
|
+
})]
|
|
337
|
+
});
|
|
308
338
|
};
|
|
309
339
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
} = useFetchConnectedStripeAccount(holdableId);
|
|
323
|
-
const handleStripeAccountCreated = _ref2 => {
|
|
324
|
-
let {
|
|
325
|
-
onboarding
|
|
326
|
-
} = _ref2;
|
|
327
|
-
window.open(onboarding?.url, "_self");
|
|
340
|
+
var Configure = function Configure(_ref) {
|
|
341
|
+
var holdableId = _ref.holdableId,
|
|
342
|
+
returnUrl = _ref.returnUrl;
|
|
343
|
+
var _useTranslation = useTranslation(),
|
|
344
|
+
t = _useTranslation.t;
|
|
345
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
346
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
347
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
348
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
349
|
+
var handleStripeAccountCreated = function handleStripeAccountCreated(_ref2) {
|
|
350
|
+
var onboarding = _ref2.onboarding;
|
|
351
|
+
window.open(onboarding === null || onboarding === void 0 ? void 0 : onboarding.url, "_self");
|
|
328
352
|
};
|
|
329
|
-
|
|
330
|
-
return /*#__PURE__*/
|
|
331
|
-
className: "mx-auto w-full max-w-lg space-y-8"
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
var connectDescription = isPresent(stripeAccount) ? t("neetoPayments.integrationModal.linkedDescription") : t("neetoPayments.integrationModal.subtitle");
|
|
354
|
+
return /*#__PURE__*/jsxs("div", {
|
|
355
|
+
className: "mx-auto w-full max-w-lg space-y-8",
|
|
356
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
357
|
+
className: "space-y-2",
|
|
358
|
+
children: [/*#__PURE__*/jsx(SvgStripe, {}), /*#__PURE__*/jsx(Typography, {
|
|
359
|
+
"data-cy": "configure-payment-title",
|
|
360
|
+
style: "h2",
|
|
361
|
+
weight: "semibold",
|
|
362
|
+
children: t("neetoPayments.integrationModal.title")
|
|
363
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
364
|
+
className: "leading-snug",
|
|
365
|
+
children: connectDescription
|
|
366
|
+
})]
|
|
367
|
+
}), isPresent(stripeAccount) ? /*#__PURE__*/jsx(AccountProcessing, {
|
|
368
|
+
onAccountCreated: handleStripeAccountCreated,
|
|
369
|
+
holdableId: holdableId,
|
|
370
|
+
returnUrl: returnUrl
|
|
371
|
+
}) : /*#__PURE__*/jsx(AccountForm, {
|
|
372
|
+
holdableId: holdableId,
|
|
373
|
+
returnUrl: returnUrl,
|
|
374
|
+
onAccountCreated: handleStripeAccountCreated
|
|
375
|
+
})]
|
|
376
|
+
});
|
|
349
377
|
};
|
|
350
378
|
|
|
351
379
|
/*! @license DOMPurify 3.0.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.2/LICENSE */
|
|
@@ -1941,8 +1969,8 @@ function createDOMPurify() {
|
|
|
1941
1969
|
|
|
1942
1970
|
var purify = createDOMPurify();
|
|
1943
1971
|
|
|
1944
|
-
|
|
1945
|
-
if (stripeAccount
|
|
1972
|
+
var getInitialTab = function getInitialTab(stripeAccount) {
|
|
1973
|
+
if (stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) {
|
|
1946
1974
|
return STEPS.finish;
|
|
1947
1975
|
}
|
|
1948
1976
|
if (isPresent(stripeAccount)) {
|
|
@@ -1950,120 +1978,133 @@ const getInitialTab = stripeAccount => {
|
|
|
1950
1978
|
}
|
|
1951
1979
|
return STEPS.connect;
|
|
1952
1980
|
};
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1981
|
+
var buildStripeConnectUrl = function buildStripeConnectUrl(holdableId, returnUrl) {
|
|
1982
|
+
return buildUrl(STRIPE_CONNECT_URL, {
|
|
1983
|
+
holdable_id: holdableId,
|
|
1984
|
+
return_url: returnUrl
|
|
1985
|
+
});
|
|
1986
|
+
};
|
|
1957
1987
|
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1988
|
+
var Connect = function Connect(_ref) {
|
|
1989
|
+
var setActiveTab = _ref.setActiveTab,
|
|
1990
|
+
holdableId = _ref.holdableId,
|
|
1991
|
+
returnUrl = _ref.returnUrl;
|
|
1992
|
+
var _useTranslation = useTranslation(),
|
|
1993
|
+
t = _useTranslation.t;
|
|
1994
|
+
var _useState = useState(INTEGRATION_METHOD.createNewAccount),
|
|
1995
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1996
|
+
selectedOption = _useState2[0],
|
|
1997
|
+
setSelectedOption = _useState2[1];
|
|
1998
|
+
var stripeConnectUrl = buildStripeConnectUrl(holdableId, returnUrl);
|
|
1999
|
+
var handleSubmit = function handleSubmit() {
|
|
1970
2000
|
if (selectedOption !== INTEGRATION_METHOD.useExistingAccount) {
|
|
1971
2001
|
setActiveTab(STEPS.configure);
|
|
1972
2002
|
return;
|
|
1973
2003
|
}
|
|
1974
2004
|
window.location.href = purify.sanitize(stripeConnectUrl);
|
|
1975
2005
|
};
|
|
1976
|
-
return /*#__PURE__*/
|
|
1977
|
-
className: "mx-auto w-full max-w-lg space-y-8"
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2006
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2007
|
+
className: "mx-auto w-full max-w-lg space-y-8",
|
|
2008
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
2009
|
+
className: "space-y-2",
|
|
2010
|
+
children: [/*#__PURE__*/jsx(SvgStripe, {}), /*#__PURE__*/jsx(Typography, {
|
|
2011
|
+
"data-cy": "configure-payment-title",
|
|
2012
|
+
style: "h2",
|
|
2013
|
+
weight: "semibold",
|
|
2014
|
+
children: t("neetoPayments.integrationModal.title")
|
|
2015
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
2016
|
+
className: "leading-snug",
|
|
2017
|
+
children: t("neetoPayments.integrationModal.subtitle")
|
|
2018
|
+
})]
|
|
2019
|
+
}), /*#__PURE__*/jsxs(Radio, {
|
|
2020
|
+
stacked: true,
|
|
2021
|
+
value: selectedOption,
|
|
2022
|
+
onChange: function onChange(event) {
|
|
2023
|
+
return setSelectedOption(event.target.value);
|
|
2024
|
+
},
|
|
2025
|
+
children: [/*#__PURE__*/jsx(Radio.Item, {
|
|
2026
|
+
className: "neeto-ui-border-black w-96 py-2",
|
|
2027
|
+
label: t("neetoPayments.integrationModal.createAccount"),
|
|
2028
|
+
name: "accountMethod",
|
|
2029
|
+
value: INTEGRATION_METHOD.createNewAccount
|
|
2030
|
+
}), /*#__PURE__*/jsx(Radio.Item, {
|
|
2031
|
+
className: "neeto-ui-border-black w-96 py-2",
|
|
2032
|
+
label: t("neetoPayments.integrationModal.connectAccount"),
|
|
2033
|
+
name: "accountMethod",
|
|
2034
|
+
value: INTEGRATION_METHOD.useExistingAccount
|
|
2035
|
+
})]
|
|
2036
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
2037
|
+
label: t("neetoPayments.common.continue"),
|
|
2038
|
+
onClick: handleSubmit
|
|
2039
|
+
})]
|
|
2040
|
+
});
|
|
2004
2041
|
};
|
|
2005
2042
|
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
} = _ref;
|
|
2011
|
-
return /*#__PURE__*/React.createElement(Finish$1, {
|
|
2043
|
+
var Finish = withT(function (_ref) {
|
|
2044
|
+
var t = _ref.t,
|
|
2045
|
+
onSuccess = _ref.onSuccess;
|
|
2046
|
+
return /*#__PURE__*/jsx(Finish$1, {
|
|
2012
2047
|
title: t("v2.payment.finishTitle"),
|
|
2013
|
-
onClick: onSuccess
|
|
2014
|
-
|
|
2048
|
+
onClick: onSuccess,
|
|
2049
|
+
children: /*#__PURE__*/jsx(AccountDetails, {})
|
|
2050
|
+
});
|
|
2015
2051
|
});
|
|
2016
2052
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2053
|
+
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; }
|
|
2054
|
+
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; }
|
|
2055
|
+
var StripeConnect = function StripeConnect(_ref) {
|
|
2056
|
+
var _ref$holdableId = _ref.holdableId,
|
|
2057
|
+
holdableId = _ref$holdableId === void 0 ? null : _ref$holdableId,
|
|
2058
|
+
isOpen = _ref.isOpen,
|
|
2059
|
+
onClose = _ref.onClose,
|
|
2060
|
+
_ref$isPlatform = _ref.isPlatform,
|
|
2061
|
+
isPlatform = _ref$isPlatform === void 0 ? false : _ref$isPlatform,
|
|
2062
|
+
returnUrl = _ref.returnUrl;
|
|
2063
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
2064
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
2065
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
2066
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
2067
|
+
var _useStateWithDependen = useStateWithDependency(getInitialTab(stripeAccount), [stripeAccount]),
|
|
2068
|
+
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
2069
|
+
activeTab = _useStateWithDependen2[0],
|
|
2070
|
+
setActiveTab = _useStateWithDependen2[1];
|
|
2071
|
+
var steps = useMemo(function () {
|
|
2072
|
+
var _INTEGRATION_STEPS = _slicedToArray(INTEGRATION_STEPS, 4),
|
|
2073
|
+
connect = _INTEGRATION_STEPS[0],
|
|
2074
|
+
configure = _INTEGRATION_STEPS[1],
|
|
2075
|
+
finish = _INTEGRATION_STEPS[2],
|
|
2076
|
+
demo = _INTEGRATION_STEPS[3];
|
|
2077
|
+
return [_objectSpread(_objectSpread({}, connect), {}, {
|
|
2035
2078
|
isActive: activeTab === STEPS.connect,
|
|
2036
2079
|
isCompleted: isPresent(stripeAccount) || activeTab === STEPS.configure || isPlatform
|
|
2037
|
-
}, {
|
|
2038
|
-
...configure,
|
|
2080
|
+
}), _objectSpread(_objectSpread({}, configure), {}, {
|
|
2039
2081
|
isActive: activeTab === STEPS.configure,
|
|
2040
|
-
isCompleted: !!stripeAccount
|
|
2041
|
-
}, {
|
|
2042
|
-
...finish,
|
|
2082
|
+
isCompleted: !!(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected)
|
|
2083
|
+
}), _objectSpread(_objectSpread({}, finish), {}, {
|
|
2043
2084
|
isActive: activeTab === STEPS.finish,
|
|
2044
2085
|
isCompleted: activeTab === STEPS.finish || activeTab === STEPS.demo
|
|
2045
|
-
}, {
|
|
2046
|
-
...demo,
|
|
2086
|
+
}), _objectSpread(_objectSpread({}, demo), {}, {
|
|
2047
2087
|
isActive: activeTab === STEPS.demo,
|
|
2048
2088
|
isCompleted: activeTab === STEPS.demo
|
|
2049
|
-
}];
|
|
2089
|
+
})];
|
|
2050
2090
|
}, [activeTab, stripeAccount]);
|
|
2051
|
-
return /*#__PURE__*/
|
|
2052
|
-
isOpen,
|
|
2053
|
-
onClose,
|
|
2054
|
-
steps
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2091
|
+
return /*#__PURE__*/jsxs(Modal, {
|
|
2092
|
+
isOpen: isOpen,
|
|
2093
|
+
onClose: onClose,
|
|
2094
|
+
steps: steps,
|
|
2095
|
+
children: [activeTab === STEPS.connect && /*#__PURE__*/jsx(Connect, {
|
|
2096
|
+
holdableId: holdableId,
|
|
2097
|
+
returnUrl: returnUrl,
|
|
2098
|
+
setActiveTab: setActiveTab
|
|
2099
|
+
}), activeTab === STEPS.configure && /*#__PURE__*/jsx(Configure, {
|
|
2100
|
+
holdableId: holdableId,
|
|
2101
|
+
returnUrl: returnUrl
|
|
2102
|
+
}), activeTab === STEPS.finish && /*#__PURE__*/jsx(Finish, {
|
|
2103
|
+
onSuccess: onClose
|
|
2104
|
+
}), activeTab === STEPS.demo && /*#__PURE__*/jsx(Demo, {
|
|
2105
|
+
onClose: onClose
|
|
2106
|
+
})]
|
|
2107
|
+
});
|
|
2067
2108
|
};
|
|
2068
2109
|
|
|
2069
2110
|
export { StripeConnect as default };
|