@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.
Files changed (190) hide show
  1. package/app/javascript/src/translations/en.json +11 -2
  2. package/dist/AccountsDashboard.js +368 -302
  3. package/dist/AccountsDashboard.js.map +1 -1
  4. package/dist/CopyButtonWrapper-54c5e270.js +27 -0
  5. package/dist/CopyButtonWrapper-54c5e270.js.map +1 -0
  6. package/dist/Dashboard.js +532 -440
  7. package/dist/Dashboard.js.map +1 -1
  8. package/dist/ExportModal-e95e0af1.js +694 -0
  9. package/dist/ExportModal-e95e0af1.js.map +1 -0
  10. package/dist/IdentifierButton-350fcc55.js +19 -0
  11. package/dist/IdentifierButton-350fcc55.js.map +1 -0
  12. package/dist/PaymentKindRestrictionAlert.js +18 -12
  13. package/dist/PaymentKindRestrictionAlert.js.map +1 -1
  14. package/dist/PaymentsDashboard.js +474 -0
  15. package/dist/PaymentsDashboard.js.map +1 -0
  16. package/dist/PayoutsDashboard.js +373 -315
  17. package/dist/PayoutsDashboard.js.map +1 -1
  18. package/dist/PayoutsPage.js +136 -112
  19. package/dist/PayoutsPage.js.map +1 -1
  20. package/dist/RazorpayDashboard.js +184 -172
  21. package/dist/RazorpayDashboard.js.map +1 -1
  22. package/dist/RazorpayPaymentButton.js +92 -66
  23. package/dist/RazorpayPaymentButton.js.map +1 -1
  24. package/dist/StripeConnect.js +359 -318
  25. package/dist/StripeConnect.js.map +1 -1
  26. package/dist/UpiConnect.js +128 -106
  27. package/dist/UpiConnect.js.map +1 -1
  28. package/dist/UpiMarkAsPaidButton.js +22 -21
  29. package/dist/UpiMarkAsPaidButton.js.map +1 -1
  30. package/dist/UpiPayment.js +75 -63
  31. package/dist/UpiPayment.js.map +1 -1
  32. package/dist/V2PaymentsDashboard.js +185 -176
  33. package/dist/V2PaymentsDashboard.js.map +1 -1
  34. package/dist/_commonjsHelpers-ae89b920.js +6 -0
  35. package/dist/_commonjsHelpers-ae89b920.js.map +1 -0
  36. package/dist/buildStripeTransactionLink.js +2 -2
  37. package/dist/cjs/AccountsDashboard.js +369 -303
  38. package/dist/cjs/AccountsDashboard.js.map +1 -1
  39. package/dist/cjs/CopyButtonWrapper-57331e1c.js +34 -0
  40. package/dist/cjs/CopyButtonWrapper-57331e1c.js.map +1 -0
  41. package/dist/cjs/Dashboard.js +533 -441
  42. package/dist/cjs/Dashboard.js.map +1 -1
  43. package/dist/cjs/ExportModal-730a91b8.js +718 -0
  44. package/dist/cjs/ExportModal-730a91b8.js.map +1 -0
  45. package/dist/cjs/IdentifierButton-3162ff10.js +25 -0
  46. package/dist/cjs/IdentifierButton-3162ff10.js.map +1 -0
  47. package/dist/cjs/PaymentKindRestrictionAlert.js +18 -12
  48. package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -1
  49. package/dist/cjs/PaymentsDashboard.js +492 -0
  50. package/dist/cjs/PaymentsDashboard.js.map +1 -0
  51. package/dist/cjs/PayoutsDashboard.js +374 -316
  52. package/dist/cjs/PayoutsDashboard.js.map +1 -1
  53. package/dist/cjs/PayoutsPage.js +136 -112
  54. package/dist/cjs/PayoutsPage.js.map +1 -1
  55. package/dist/cjs/RazorpayDashboard.js +185 -173
  56. package/dist/cjs/RazorpayDashboard.js.map +1 -1
  57. package/dist/cjs/RazorpayPaymentButton.js +92 -66
  58. package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
  59. package/dist/cjs/StripeConnect.js +356 -315
  60. package/dist/cjs/StripeConnect.js.map +1 -1
  61. package/dist/cjs/UpiConnect.js +129 -107
  62. package/dist/cjs/UpiConnect.js.map +1 -1
  63. package/dist/cjs/UpiMarkAsPaidButton.js +22 -21
  64. package/dist/cjs/UpiMarkAsPaidButton.js.map +1 -1
  65. package/dist/cjs/UpiPayment.js +75 -63
  66. package/dist/cjs/UpiPayment.js.map +1 -1
  67. package/dist/cjs/V2PaymentsDashboard.js +186 -177
  68. package/dist/cjs/V2PaymentsDashboard.js.map +1 -1
  69. package/dist/cjs/_commonjsHelpers-755157d3.js +8 -0
  70. package/dist/cjs/_commonjsHelpers-755157d3.js.map +1 -0
  71. package/dist/cjs/buildStripeTransactionLink.js +1 -1
  72. package/dist/cjs/constants.js +12 -12
  73. package/dist/cjs/constants.js.map +1 -1
  74. package/dist/cjs/defineProperty-f3094d6c.js +45 -0
  75. package/dist/cjs/defineProperty-f3094d6c.js.map +1 -0
  76. package/dist/cjs/exportChannel-2d528a51.js +45 -0
  77. package/dist/cjs/{exportChannel-1c3103ef.js.map → exportChannel-2d528a51.js.map} +1 -1
  78. package/dist/cjs/{index-b7badf96.js → index-1ce7ebb8.js} +8 -8
  79. package/dist/cjs/{index-b7badf96.js.map → index-1ce7ebb8.js.map} +1 -1
  80. package/dist/cjs/index-6f9eb83b.js +387 -0
  81. package/dist/cjs/index-6f9eb83b.js.map +1 -0
  82. package/dist/cjs/index-8a575dd1.js +47 -0
  83. package/dist/cjs/index-8a575dd1.js.map +1 -0
  84. package/dist/cjs/index.js +31 -22
  85. package/dist/cjs/index.js.map +1 -1
  86. package/dist/cjs/objectWithoutProperties-2fed2d7d.js +33 -0
  87. package/dist/cjs/objectWithoutProperties-2fed2d7d.js.map +1 -0
  88. package/dist/cjs/{queryConstants-45f84f3e.js → queryConstants-cb79f600.js} +4 -3
  89. package/dist/cjs/queryConstants-cb79f600.js.map +1 -0
  90. package/dist/cjs/renderFunctions-0284d0cb.js +159 -0
  91. package/dist/cjs/renderFunctions-0284d0cb.js.map +1 -0
  92. package/dist/cjs/slicedToArray-f320d9e7.js +61 -0
  93. package/dist/cjs/slicedToArray-f320d9e7.js.map +1 -0
  94. package/dist/cjs/toConsumableArray-9abb3858.js +22 -0
  95. package/dist/cjs/toConsumableArray-9abb3858.js.map +1 -0
  96. package/dist/cjs/{useConnectApi-a80cbf88.js → useConnectApi-67c912ae.js} +106 -85
  97. package/dist/cjs/useConnectApi-67c912ae.js.map +1 -0
  98. package/dist/cjs/useFiltersAndPagination-cd8bd491.js +316 -0
  99. package/dist/cjs/useFiltersAndPagination-cd8bd491.js.map +1 -0
  100. package/dist/cjs/usePaymentApi-7c41a34a.js +57 -0
  101. package/dist/cjs/usePaymentApi-7c41a34a.js.map +1 -0
  102. package/dist/cjs/usePaymentsApi-f53c5543.js +45 -0
  103. package/dist/cjs/usePaymentsApi-f53c5543.js.map +1 -0
  104. package/dist/cjs/usePlatformApi-365cf2dc.js +149 -0
  105. package/dist/cjs/usePlatformApi-365cf2dc.js.map +1 -0
  106. package/dist/cjs/useRazorpayPayment.js +70 -48
  107. package/dist/cjs/useRazorpayPayment.js.map +1 -1
  108. package/dist/cjs/useStripePromise.js +41 -16
  109. package/dist/cjs/useStripePromise.js.map +1 -1
  110. package/dist/constants.js +12 -12
  111. package/dist/constants.js.map +1 -1
  112. package/dist/defineProperty-e90a259c.js +43 -0
  113. package/dist/defineProperty-e90a259c.js.map +1 -0
  114. package/dist/exportChannel-e33c4c66.js +38 -0
  115. package/dist/{exportChannel-23e4628c.js.map → exportChannel-e33c4c66.js.map} +1 -1
  116. package/dist/index-1fdfa272.js +384 -0
  117. package/dist/index-1fdfa272.js.map +1 -0
  118. package/dist/{index-1aedc364.js → index-adf12baa.js} +8 -8
  119. package/dist/{index-1aedc364.js.map → index-adf12baa.js.map} +1 -1
  120. package/dist/index-f03e9537.js +38 -0
  121. package/dist/index-f03e9537.js.map +1 -0
  122. package/dist/index.js +29 -21
  123. package/dist/index.js.map +1 -1
  124. package/dist/objectWithoutProperties-a0edb288.js +31 -0
  125. package/dist/objectWithoutProperties-a0edb288.js.map +1 -0
  126. package/dist/{queryConstants-7d91832f.js → queryConstants-fada3549.js} +4 -3
  127. package/dist/queryConstants-fada3549.js.map +1 -0
  128. package/dist/renderFunctions-3640a4cf.js +143 -0
  129. package/dist/renderFunctions-3640a4cf.js.map +1 -0
  130. package/dist/slicedToArray-b4278ecd.js +57 -0
  131. package/dist/slicedToArray-b4278ecd.js.map +1 -0
  132. package/dist/toConsumableArray-1cc38429.js +20 -0
  133. package/dist/toConsumableArray-1cc38429.js.map +1 -0
  134. package/dist/{useConnectApi-36a92bd8.js → useConnectApi-b4fc32db.js} +107 -86
  135. package/dist/useConnectApi-b4fc32db.js.map +1 -0
  136. package/dist/useFiltersAndPagination-d14df27d.js +302 -0
  137. package/dist/useFiltersAndPagination-d14df27d.js.map +1 -0
  138. package/dist/usePaymentApi-433482f2.js +50 -0
  139. package/dist/usePaymentApi-433482f2.js.map +1 -0
  140. package/dist/usePaymentsApi-e95b2517.js +38 -0
  141. package/dist/usePaymentsApi-e95b2517.js.map +1 -0
  142. package/dist/usePlatformApi-9711698e.js +137 -0
  143. package/dist/usePlatformApi-9711698e.js.map +1 -0
  144. package/dist/useRazorpayPayment.js +70 -48
  145. package/dist/useRazorpayPayment.js.map +1 -1
  146. package/dist/useStripePromise.js +41 -16
  147. package/dist/useStripePromise.js.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/ExportModal-23f4fa34.js +0 -645
  150. package/dist/ExportModal-23f4fa34.js.map +0 -1
  151. package/dist/IdentifierButton-81450a91.js +0 -20
  152. package/dist/IdentifierButton-81450a91.js.map +0 -1
  153. package/dist/cjs/ExportModal-b94a33bf.js +0 -669
  154. package/dist/cjs/ExportModal-b94a33bf.js.map +0 -1
  155. package/dist/cjs/IdentifierButton-c5f8ded9.js +0 -26
  156. package/dist/cjs/IdentifierButton-c5f8ded9.js.map +0 -1
  157. package/dist/cjs/exportChannel-1c3103ef.js +0 -39
  158. package/dist/cjs/extends-1b35a664.js +0 -19
  159. package/dist/cjs/extends-1b35a664.js.map +0 -1
  160. package/dist/cjs/index-e317e851.js +0 -41
  161. package/dist/cjs/index-e317e851.js.map +0 -1
  162. package/dist/cjs/queryConstants-45f84f3e.js.map +0 -1
  163. package/dist/cjs/renderFunctions-621282bb.js +0 -165
  164. package/dist/cjs/renderFunctions-621282bb.js.map +0 -1
  165. package/dist/cjs/useConnectApi-a80cbf88.js.map +0 -1
  166. package/dist/cjs/useFiltersAndPagination-98eb45d6.js +0 -276
  167. package/dist/cjs/useFiltersAndPagination-98eb45d6.js.map +0 -1
  168. package/dist/cjs/usePaymentApi-77803596.js +0 -48
  169. package/dist/cjs/usePaymentApi-77803596.js.map +0 -1
  170. package/dist/cjs/usePaymentsApi-239e8d8a.js +0 -36
  171. package/dist/cjs/usePaymentsApi-239e8d8a.js.map +0 -1
  172. package/dist/cjs/usePlatformApi-6740cf80.js +0 -117
  173. package/dist/cjs/usePlatformApi-6740cf80.js.map +0 -1
  174. package/dist/exportChannel-23e4628c.js +0 -32
  175. package/dist/extends-093996c9.js +0 -17
  176. package/dist/extends-093996c9.js.map +0 -1
  177. package/dist/index-385083ef.js +0 -32
  178. package/dist/index-385083ef.js.map +0 -1
  179. package/dist/queryConstants-7d91832f.js.map +0 -1
  180. package/dist/renderFunctions-ac5ef9d0.js +0 -146
  181. package/dist/renderFunctions-ac5ef9d0.js.map +0 -1
  182. package/dist/useConnectApi-36a92bd8.js.map +0 -1
  183. package/dist/useFiltersAndPagination-8813cdb2.js +0 -262
  184. package/dist/useFiltersAndPagination-8813cdb2.js.map +0 -1
  185. package/dist/usePaymentApi-edc45d99.js +0 -41
  186. package/dist/usePaymentApi-edc45d99.js.map +0 -1
  187. package/dist/usePaymentsApi-663c4058.js +0 -29
  188. package/dist/usePaymentsApi-663c4058.js.map +0 -1
  189. package/dist/usePlatformApi-3faabc82.js +0 -105
  190. package/dist/usePlatformApi-3faabc82.js.map +0 -1
@@ -1,9 +1,11 @@
1
- import * as React$1 from 'react';
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-36a92bd8.js';
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-7d91832f.js';
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$1.createElement("svg", _extends({
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$1.createElement("path", {
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$1.createElement("path", {
44
+ })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
41
45
  d: "M74.38 7.035h4.87V24.04h-4.87z"
42
- })), _path3 || (_path3 = /*#__PURE__*/React$1.createElement("path", {
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
- const fetchCountries = () => axios.get(`${BASE_URL}/api/v1/stripe/countries`);
48
- const countriesApi = {
49
- fetchCountries
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
- const useFetchStripeCountries = () => useQuery({
53
- queryKey: [QUERY_KEYS.STRIPE_COUNTRIES],
54
- queryFn: countriesApi.fetchCountries
55
- });
58
+ var useFetchStripeCountries = function useFetchStripeCountries() {
59
+ return useQuery({
60
+ queryKey: [QUERY_KEYS.STRIPE_COUNTRIES],
61
+ queryFn: countriesApi.fetchCountries
62
+ });
63
+ };
56
64
 
57
- const POLLING_INTERVAL = 5000;
58
- const MAX_POLLING_TIME = 30000;
59
- const INITIAL_VALUES = {
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
- const VALIDATION_SCHEMA = yup.object().shape({
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
- const STEPS = {
76
+ var STEPS = {
69
77
  connect: "connect",
70
78
  configure: "configure",
71
79
  finish: "finish",
72
80
  demo: "demo"
73
81
  };
74
- const INTEGRATION_STEPS = [{
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
- const INTEGRATION_METHOD = {
101
+ var INTEGRATION_METHOD = {
94
102
  useExistingAccount: "use_existing_account",
95
103
  createNewAccount: "create_new_account"
96
104
  };
97
- const STRIPE_CONNECT_URL = `/${BASE_URL}/api/v1/integrations/connect/stripe`;
105
+ var STRIPE_CONNECT_URL = "/".concat(BASE_URL, "/api/v1/integrations/connect/stripe");
98
106
 
99
- const buildRefreshUrl = (accountId, returnUrl) => `/payments/api/v1/stripe/callbacks/${accountId}/refresh?return_url=${returnUrl}`;
100
- const buildCountryOptions = countries => Object.entries(countries)?.map(country => ({
101
- label: humanize(country[0]),
102
- value: country[1]
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
- const AccountForm = _ref => {
106
- let {
107
- holdableId,
108
- returnUrl
109
- } = _ref;
110
- const {
111
- t
112
- } = useTranslation();
113
- const history = useHistory();
114
- const [isPolling, setIsPolling] = useState(false);
115
- const submitButtonLabel = isPolling ? t("neetoPayments.integrationModal.creating") : t("neetoPayments.common.connect");
116
- const refetchInterval = function () {
117
- let {
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?.url, "_self");
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
- const {
128
- isPending: isCreating,
129
- data: {
130
- jobId
131
- } = {},
132
- mutate: createStripeAccount
133
- } = useCreateStripeAccount({
134
- onSuccess: () => setIsPolling(true)
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
- const {
141
- isLoading,
142
- data: {
143
- countries = {}
144
- } = {}
145
- } = useFetchStripeCountries();
146
- const handleSubmit = _ref2 => {
147
- let {
148
- country
149
- } = _ref2;
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__*/React.createElement(PageLoader, null);
171
+ return /*#__PURE__*/jsx(PageLoader, {});
159
172
  }
160
- return /*#__PURE__*/React.createElement(Form, {
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
- isSubmitting: isCreating || isPolling,
181
- submitButtonProps: {
182
- label: submitButtonLabel
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
- const AccountDetails = _ref => {
188
- let {
189
- holdableId
190
- } = _ref;
191
- const {
192
- data: {
193
- account: stripeAccount
194
- } = {}
195
- } = useFetchConnectedStripeAccount(holdableId);
196
- const {
197
- t
198
- } = useTranslation();
199
- return /*#__PURE__*/React.createElement("div", {
200
- className: "mb-6 space-y-3"
201
- }, /*#__PURE__*/React.createElement(Typography, {
202
- style: "h5",
203
- weight: "medium"
204
- }, t("neetoPayments.integrationModal.account.title")), /*#__PURE__*/React.createElement("div", {
205
- className: "grid grid-cols-4 gap-y-3"
206
- }, /*#__PURE__*/React.createElement(Label, {
207
- className: "neeto-ui-text-gray-800"
208
- }, t("neetoPayments.common.id")), /*#__PURE__*/React.createElement(Label, {
209
- className: "neeto-ui-text-gray-800 col-span-3"
210
- }, stripeAccount?.identifier), /*#__PURE__*/React.createElement(Label, {
211
- className: "neeto-ui-text-gray-800"
212
- }, t("neetoPayments.common.email")), /*#__PURE__*/React.createElement(Label, {
213
- className: "neeto-ui-text-gray-800 col-span-3"
214
- }, stripeAccount?.email), /*#__PURE__*/React.createElement(Label, {
215
- className: "neeto-ui-text-gray-800"
216
- }, t("neetoPayments.common.country")), /*#__PURE__*/React.createElement(Label, {
217
- className: "neeto-ui-text-gray-800 col-span-3"
218
- }, stripeAccount?.country)));
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
- const AccountProcessing = _ref => {
222
- let {
223
- holdableId,
224
- returnUrl
225
- } = _ref;
226
- const {
227
- app
228
- } = useQueryParams();
229
- const [isAlertOpen, setIsAlertOpen] = useState(false);
230
- const [isPolling, setIsPolling] = useState(false);
231
- const {
232
- t
233
- } = useTranslation();
234
- const isStripeCallback = app === "stripe";
235
- useEffect(() => {
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
- const {
243
- data: {
244
- account: stripeAccount
245
- } = {}
246
- } = useFetchConnectedStripeAccount(holdableId);
247
- const {
248
- isPending: isStripeAccountDestroying,
249
- mutate: destroyStripeAccount
250
- } = useDestroyStripeAccount({
251
- onSuccess: () => setIsAlertOpen(false),
252
- holdableId
253
- });
254
- const refetchInterval = function () {
255
- let {
256
- account
257
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
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?.isConnected) {
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
- const isAccountProcessingFailed = isStripeCallback && !isPolling && !stripeAccount?.isConnected;
270
- const buttonLabel = () => {
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
- const handleUseAnotherStripeAccount = () => {
280
- destroyStripeAccount(stripeAccount?.id);
302
+ var handleUseAnotherStripeAccount = function handleUseAnotherStripeAccount() {
303
+ destroyStripeAccount(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id);
281
304
  };
282
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AccountDetails, null), /*#__PURE__*/React.createElement("div", {
283
- className: "flex flex-col items-start space-y-2"
284
- }, /*#__PURE__*/React.createElement(Button, {
285
- disabled: isPolling,
286
- href: buildRefreshUrl(stripeAccount?.id, returnUrl),
287
- label: buttonLabel(),
288
- loading: isPolling,
289
- size: "small"
290
- }), !isPolling && !isAccountProcessingFailed && /*#__PURE__*/React.createElement(Button, {
291
- disabled: isStripeAccountDestroying || isPolling,
292
- label: t("neetoPayments.integrationModal.anotherAccount"),
293
- size: "small",
294
- style: "link",
295
- onClick: () => setIsAlertOpen(true)
296
- })), /*#__PURE__*/React.createElement(Alert, {
297
- isOpen: isAlertOpen,
298
- title: t("neetoPayments.integrationModal.alert.changeTitle"),
299
- message: /*#__PURE__*/React.createElement(Trans, {
300
- i18nKey: "neetoPayments.integrationModal.alert.changeMessage",
301
- values: {
302
- account: stripeAccount?.email
303
- }
304
- }),
305
- onClose: () => setIsAlertOpen(false),
306
- onSubmit: handleUseAnotherStripeAccount
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
- const Configure = _ref => {
311
- let {
312
- holdableId,
313
- returnUrl
314
- } = _ref;
315
- const {
316
- t
317
- } = useTranslation();
318
- const {
319
- data: {
320
- account: stripeAccount
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
- const connectDescription = isPresent(stripeAccount) ? t("neetoPayments.integrationModal.linkedDescription") : t("neetoPayments.integrationModal.subtitle");
330
- return /*#__PURE__*/React.createElement("div", {
331
- className: "mx-auto w-full max-w-lg space-y-8"
332
- }, /*#__PURE__*/React.createElement("div", {
333
- className: "space-y-2"
334
- }, /*#__PURE__*/React.createElement(SvgStripe, null), /*#__PURE__*/React.createElement(Typography, {
335
- "data-cy": "configure-payment-title",
336
- style: "h2",
337
- weight: "semibold"
338
- }, t("neetoPayments.integrationModal.title")), /*#__PURE__*/React.createElement(Label, {
339
- className: "leading-snug"
340
- }, connectDescription)), isPresent(stripeAccount) ? /*#__PURE__*/React.createElement(AccountProcessing, {
341
- onAccountCreated: handleStripeAccountCreated,
342
- holdableId,
343
- returnUrl
344
- }) : /*#__PURE__*/React.createElement(AccountForm, {
345
- holdableId,
346
- returnUrl,
347
- onAccountCreated: handleStripeAccountCreated
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
- const getInitialTab = stripeAccount => {
1945
- if (stripeAccount?.isConnected) {
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
- const buildStripeConnectUrl = (holdableId, returnUrl) => buildUrl(STRIPE_CONNECT_URL, {
1954
- holdable_id: holdableId,
1955
- return_url: returnUrl
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
- const Connect = _ref => {
1959
- let {
1960
- setActiveTab,
1961
- holdableId,
1962
- returnUrl
1963
- } = _ref;
1964
- const {
1965
- t
1966
- } = useTranslation();
1967
- const [selectedOption, setSelectedOption] = useState(INTEGRATION_METHOD.createNewAccount);
1968
- const stripeConnectUrl = buildStripeConnectUrl(holdableId, returnUrl);
1969
- const handleSubmit = () => {
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__*/React.createElement("div", {
1977
- className: "mx-auto w-full max-w-lg space-y-8"
1978
- }, /*#__PURE__*/React.createElement("div", {
1979
- className: "space-y-2"
1980
- }, /*#__PURE__*/React.createElement(SvgStripe, null), /*#__PURE__*/React.createElement(Typography, {
1981
- "data-cy": "configure-payment-title",
1982
- style: "h2",
1983
- weight: "semibold"
1984
- }, t("neetoPayments.integrationModal.title")), /*#__PURE__*/React.createElement(Label, {
1985
- className: "leading-snug"
1986
- }, t("neetoPayments.integrationModal.subtitle"))), /*#__PURE__*/React.createElement(Radio, {
1987
- stacked: true,
1988
- value: selectedOption,
1989
- onChange: event => setSelectedOption(event.target.value)
1990
- }, /*#__PURE__*/React.createElement(Radio.Item, {
1991
- className: "neeto-ui-border-black w-96 py-2",
1992
- label: t("neetoPayments.integrationModal.createAccount"),
1993
- name: "accountMethod",
1994
- value: INTEGRATION_METHOD.createNewAccount
1995
- }), /*#__PURE__*/React.createElement(Radio.Item, {
1996
- className: "neeto-ui-border-black w-96 py-2",
1997
- label: t("neetoPayments.integrationModal.connectAccount"),
1998
- name: "accountMethod",
1999
- value: INTEGRATION_METHOD.useExistingAccount
2000
- })), /*#__PURE__*/React.createElement(Button, {
2001
- label: t("neetoPayments.common.continue"),
2002
- onClick: handleSubmit
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
- const Finish = withT(_ref => {
2007
- let {
2008
- t,
2009
- onSuccess
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
- }, /*#__PURE__*/React.createElement(AccountDetails, null));
2048
+ onClick: onSuccess,
2049
+ children: /*#__PURE__*/jsx(AccountDetails, {})
2050
+ });
2015
2051
  });
2016
2052
 
2017
- const StripeConnect = _ref => {
2018
- let {
2019
- holdableId = null,
2020
- isOpen,
2021
- onClose,
2022
- isPlatform = false,
2023
- returnUrl
2024
- } = _ref;
2025
- const {
2026
- data: {
2027
- account: stripeAccount
2028
- } = {}
2029
- } = useFetchConnectedStripeAccount(holdableId);
2030
- const [activeTab, setActiveTab] = useStateWithDependency(getInitialTab(stripeAccount), [stripeAccount]);
2031
- const steps = useMemo(() => {
2032
- const [connect, configure, finish, demo] = INTEGRATION_STEPS;
2033
- return [{
2034
- ...connect,
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?.isConnected
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__*/React.createElement(Modal, {
2052
- isOpen,
2053
- onClose,
2054
- steps
2055
- }, activeTab === STEPS.connect && /*#__PURE__*/React.createElement(Connect, {
2056
- holdableId,
2057
- returnUrl,
2058
- setActiveTab
2059
- }), activeTab === STEPS.configure && /*#__PURE__*/React.createElement(Configure, {
2060
- holdableId,
2061
- returnUrl
2062
- }), activeTab === STEPS.finish && /*#__PURE__*/React.createElement(Finish, {
2063
- onSuccess: onClose
2064
- }), activeTab === STEPS.demo && /*#__PURE__*/React.createElement(Demo, {
2065
- onClose
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 };