@verii/components-organizations-registrar 1.0.0-pre.1756100765 → 1.0.0-pre.1756238035

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 (131) hide show
  1. package/dist/chunks/{ConsentProvider.DIG3atk-.js → ConsentProvider.6M2ucqXH.js} +3 -3
  2. package/dist/chunks/ConsentProvider.6M2ucqXH.js.map +1 -0
  3. package/dist/chunks/{ConsentProvider.DTG51XMy.js → ConsentProvider.Bbc0preP.js} +2 -2
  4. package/dist/chunks/ConsentProvider.Bbc0preP.js.map +1 -0
  5. package/dist/chunks/{CreateOrganization.utils.C5C_r3Zp.js → CreateOrganizationUtils.C5C_r3Zp.js} +1 -1
  6. package/dist/chunks/CreateOrganizationUtils.C5C_r3Zp.js.map +1 -0
  7. package/dist/chunks/{CreateOrganization.utils.8cSBFSYF.js → CreateOrganizationUtils.Xq78HHkP.js} +7 -7
  8. package/dist/chunks/CreateOrganizationUtils.Xq78HHkP.js.map +1 -0
  9. package/dist/chunks/{CustomAppBar.DuFQqld7.js → CustomAppBar.BOlNFosS.js} +5 -7
  10. package/dist/chunks/CustomAppBar.BOlNFosS.js.map +1 -0
  11. package/dist/chunks/{CustomAppBar.BfQvuTHz.js → CustomAppBar.DaXLAwPh.js} +4 -6
  12. package/dist/chunks/CustomAppBar.DaXLAwPh.js.map +1 -0
  13. package/dist/chunks/{LinkedInRegistrationInput.C-qzrR-S.js → LinkedInRegistrationInput.CmYmSJoq.js} +8 -5
  14. package/dist/chunks/LinkedInRegistrationInput.CmYmSJoq.js.map +1 -0
  15. package/dist/chunks/{LinkedInRegistrationInput.DKRMHYRh.js → LinkedInRegistrationInput.gnYgP1Hf.js} +11 -8
  16. package/dist/chunks/LinkedInRegistrationInput.gnYgP1Hf.js.map +1 -0
  17. package/dist/chunks/{Loading.UJl_3_cf.js → Loading.Bcm3xNJU.js} +2 -3
  18. package/dist/chunks/Loading.Bcm3xNJU.js.map +1 -0
  19. package/dist/chunks/{Loading.DYBk0Ktb.js → Loading.cGHE59CV.js} +2 -3
  20. package/dist/chunks/Loading.cGHE59CV.js.map +1 -0
  21. package/dist/chunks/{MainLayout.CWFkijrE.js → MainLayout.BzfaZs8j.js} +2 -2
  22. package/dist/chunks/{MainLayout.CWFkijrE.js.map → MainLayout.BzfaZs8j.js.map} +1 -1
  23. package/dist/chunks/{MainLayout.6Hq5XQ-L.js → MainLayout.V-ymVxxR.js} +3 -3
  24. package/dist/chunks/{MainLayout.6Hq5XQ-L.js.map → MainLayout.V-ymVxxR.js.map} +1 -1
  25. package/dist/chunks/{OrganizationAvatar.BEwRZ9tC.js → OrganizationAvatar.BXW4diDT.js} +2 -2
  26. package/dist/chunks/{OrganizationAvatar.BEwRZ9tC.js.map → OrganizationAvatar.BXW4diDT.js.map} +1 -1
  27. package/dist/chunks/{OrganizationAvatar.lWcXtbM6.js → OrganizationAvatar.Dgg5VSPI.js} +2 -2
  28. package/dist/chunks/{OrganizationAvatar.lWcXtbM6.js.map → OrganizationAvatar.Dgg5VSPI.js.map} +1 -1
  29. package/dist/chunks/{ServicesEdit.BUAbbXgV.js → ServicesEdit.BnnqC203.js} +3 -3
  30. package/dist/chunks/ServicesEdit.BnnqC203.js.map +1 -0
  31. package/dist/chunks/{ServicesEdit.CrtEcP_7.js → ServicesEdit.DDgjS5kU.js} +2 -2
  32. package/dist/chunks/ServicesEdit.DDgjS5kU.js.map +1 -0
  33. package/dist/chunks/{SetInvitationService.BUZqAilX.js → SetInvitationService.PxAGwk-I.js} +11 -11
  34. package/dist/chunks/SetInvitationService.PxAGwk-I.js.map +1 -0
  35. package/dist/chunks/{SetInvitationService.B0ezxTzf.js → SetInvitationService.ZT5lP003.js} +5 -5
  36. package/dist/chunks/SetInvitationService.ZT5lP003.js.map +1 -0
  37. package/dist/chunks/TermsAndConditionsPdf.Ba8-5Hcm.js.map +1 -1
  38. package/dist/chunks/TermsAndConditionsPdf.ewC7N9Vy.js.map +1 -1
  39. package/dist/chunks/{CreateOrganization.C2Kf44eJ.js → ValidateTextInput.D5kgjulG.js} +328 -14
  40. package/dist/chunks/ValidateTextInput.D5kgjulG.js.map +1 -0
  41. package/dist/chunks/{CreateOrganization.A11-a_8R.js → ValidateTextInput.DEBaVB1L.js} +356 -42
  42. package/dist/chunks/ValidateTextInput.DEBaVB1L.js.map +1 -0
  43. package/dist/chunks/{index.DZOVpocw.js → index.CYCWawJT.js} +6 -6
  44. package/dist/chunks/index.CYCWawJT.js.map +1 -0
  45. package/dist/chunks/{index.DmM8ShwP.js → index.Cmn4FlUL.js} +5 -5
  46. package/dist/chunks/index.Cmn4FlUL.js.map +1 -0
  47. package/dist/chunks/{index.DlFajFTS.js → index.DIizFYFZ.js} +3 -3
  48. package/dist/chunks/index.DIizFYFZ.js.map +1 -0
  49. package/dist/chunks/{index.ZAmuSdK1.js → index.DIur8MCO.js} +4 -4
  50. package/dist/chunks/index.DIur8MCO.js.map +1 -0
  51. package/dist/chunks/{index.Ch4ynES2.js → index.DMWKdmxs.js} +4 -5
  52. package/dist/chunks/index.DMWKdmxs.js.map +1 -0
  53. package/dist/chunks/{index.Dir1xwV4.js → index.DND10PiY.js} +5 -6
  54. package/dist/chunks/index.DND10PiY.js.map +1 -0
  55. package/dist/chunks/{index.Cpod3Il3.js → index.YjnxLFjk.js} +3 -3
  56. package/dist/chunks/index.YjnxLFjk.js.map +1 -0
  57. package/dist/chunks/index.iexmV4Mr.js.map +1 -1
  58. package/dist/chunks/remoteDataProvider.BCiFSYnk.js.map +1 -1
  59. package/dist/chunks/remoteDataProvider.gtTXA1-g.js.map +1 -1
  60. package/dist/chunks/useIsIssuingInspection.C76mY_wb.js.map +1 -1
  61. package/dist/chunks/useIsIssuingInspection.DavhBs5B.js.map +1 -1
  62. package/dist/components/AppBar.cjs +1 -1
  63. package/dist/components/AppBar.js +1 -1
  64. package/dist/components/common.cjs +3 -3
  65. package/dist/components/common.js +3 -3
  66. package/dist/components/invitations.cjs +1 -1
  67. package/dist/components/invitations.js +1 -1
  68. package/dist/components/organizations.cjs +12 -301
  69. package/dist/components/organizations.cjs.map +1 -1
  70. package/dist/components/organizations.js +10 -299
  71. package/dist/components/organizations.js.map +1 -1
  72. package/dist/components/services.cjs +1 -1
  73. package/dist/components/services.js +1 -1
  74. package/dist/components.cjs +2 -2
  75. package/dist/components.js +2 -2
  76. package/dist/index.cjs +3 -3
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.js +3 -3
  79. package/dist/index.js.map +1 -1
  80. package/dist/layouts.cjs +1 -1
  81. package/dist/layouts.js +1 -1
  82. package/dist/pages/individuals.cjs +4 -4
  83. package/dist/pages/individuals.cjs.map +1 -1
  84. package/dist/pages/individuals.js +5 -5
  85. package/dist/pages/individuals.js.map +1 -1
  86. package/dist/pages/invitations.cjs +11 -12
  87. package/dist/pages/invitations.cjs.map +1 -1
  88. package/dist/pages/invitations.js +9 -10
  89. package/dist/pages/invitations.js.map +1 -1
  90. package/dist/pages/organizations.cjs +74 -75
  91. package/dist/pages/organizations.cjs.map +1 -1
  92. package/dist/pages/organizations.js +10 -11
  93. package/dist/pages/organizations.js.map +1 -1
  94. package/dist/pages/services.cjs +6 -6
  95. package/dist/pages/services.cjs.map +1 -1
  96. package/dist/pages/services.js +5 -5
  97. package/dist/pages/services.js.map +1 -1
  98. package/dist/pages.cjs +1 -1
  99. package/dist/pages.cjs.map +1 -1
  100. package/dist/pages.js +1 -1
  101. package/dist/pages.js.map +1 -1
  102. package/package.json +12 -9
  103. package/setup-tests.js +31 -0
  104. package/dist/chunks/ConsentProvider.DIG3atk-.js.map +0 -1
  105. package/dist/chunks/ConsentProvider.DTG51XMy.js.map +0 -1
  106. package/dist/chunks/CreateOrganization.A11-a_8R.js.map +0 -1
  107. package/dist/chunks/CreateOrganization.C2Kf44eJ.js.map +0 -1
  108. package/dist/chunks/CreateOrganization.utils.8cSBFSYF.js.map +0 -1
  109. package/dist/chunks/CreateOrganization.utils.C5C_r3Zp.js.map +0 -1
  110. package/dist/chunks/CustomAppBar.BfQvuTHz.js.map +0 -1
  111. package/dist/chunks/CustomAppBar.DuFQqld7.js.map +0 -1
  112. package/dist/chunks/LinkedInRegistrationInput.C-qzrR-S.js.map +0 -1
  113. package/dist/chunks/LinkedInRegistrationInput.DKRMHYRh.js.map +0 -1
  114. package/dist/chunks/Loading.DYBk0Ktb.js.map +0 -1
  115. package/dist/chunks/Loading.UJl_3_cf.js.map +0 -1
  116. package/dist/chunks/OrganisationSubmitButton.D32qynh9.js +0 -40
  117. package/dist/chunks/OrganisationSubmitButton.D32qynh9.js.map +0 -1
  118. package/dist/chunks/OrganisationSubmitButton.D3w1nG1X.js +0 -41
  119. package/dist/chunks/OrganisationSubmitButton.D3w1nG1X.js.map +0 -1
  120. package/dist/chunks/ServicesEdit.BUAbbXgV.js.map +0 -1
  121. package/dist/chunks/ServicesEdit.CrtEcP_7.js.map +0 -1
  122. package/dist/chunks/SetInvitationService.B0ezxTzf.js.map +0 -1
  123. package/dist/chunks/SetInvitationService.BUZqAilX.js.map +0 -1
  124. package/dist/chunks/index.Ch4ynES2.js.map +0 -1
  125. package/dist/chunks/index.Cpod3Il3.js.map +0 -1
  126. package/dist/chunks/index.DZOVpocw.js.map +0 -1
  127. package/dist/chunks/index.Dir1xwV4.js.map +0 -1
  128. package/dist/chunks/index.DlFajFTS.js.map +0 -1
  129. package/dist/chunks/index.DmM8ShwP.js.map +0 -1
  130. package/dist/chunks/index.ZAmuSdK1.js.map +0 -1
  131. package/jest.config.cjs +0 -29
@@ -1,21 +1,274 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
+ const React = require("react");
3
4
  const material = require("@mui/material");
4
5
  const reactAdmin = require("react-admin");
5
- const React = require("react");
6
+ const reactHookForm = require("react-hook-form");
7
+ const parse = require("autosuggest-highlight/parse/index.js");
8
+ const match = require("autosuggest-highlight/match/index.js");
9
+ const iconsMaterial = require("@mui/icons-material");
6
10
  const PropTypes = require("prop-types");
11
+ const remoteDataProvider = require("./remoteDataProvider.BCiFSYnk.js");
7
12
  const KeyboardArrowRightIcon = require("@mui/icons-material/KeyboardArrowRight");
8
13
  const InfoIcon = require("@mui/icons-material/Info");
9
14
  const index$1 = require("./index.iexmV4Mr.js");
10
- const CreateOrganization_utils = require("./CreateOrganization.utils.C5C_r3Zp.js");
11
- const OrganisationSubmitButton = require("./OrganisationSubmitButton.D32qynh9.js");
12
- const index = require("./index.DlFajFTS.js");
13
- const LinkedInRegistrationInput = require("./LinkedInRegistrationInput.DKRMHYRh.js");
14
- const remoteDataProvider = require("./remoteDataProvider.BCiFSYnk.js");
15
- const Grid = require("@mui/material/Grid2");
15
+ const CreateOrganizationUtils = require("./CreateOrganizationUtils.C5C_r3Zp.js");
16
+ const index = require("./index.DIizFYFZ.js");
17
+ const LinkedInRegistrationInput = require("./LinkedInRegistrationInput.gnYgP1Hf.js");
16
18
  const reactRouter = require("react-router");
17
19
  const theme = require("./theme.CDQ6GHCD.js");
20
+ const Loading = require("./Loading.cGHE59CV.js");
18
21
  const AuthContext = require("./AuthContext.DCNVg-VT.js");
22
+ const OrganizationSubmitButton = ({ title, isLoading, endIcon, styles: styles2, handleState, enabled }) => {
23
+ const form = reactHookForm.useFormContext();
24
+ React.useEffect(() => {
25
+ if (handleState) {
26
+ handleState(form.formState.isValid);
27
+ }
28
+ }, [form.formState.isValid, handleState]);
29
+ return /* @__PURE__ */ jsxRuntime.jsx(
30
+ reactAdmin.Button,
31
+ {
32
+ disabled: !form.formState.isValid && !enabled,
33
+ variant: "outlined",
34
+ color: "primary",
35
+ type: "submit",
36
+ size: "large",
37
+ label: isLoading ? "" : title,
38
+ endIcon,
39
+ sx: styles2,
40
+ children: isLoading && /* @__PURE__ */ jsxRuntime.jsx(Loading.Loading, { color: "error", sx: { pl: "10px" }, size: 26 })
41
+ }
42
+ );
43
+ };
44
+ OrganizationSubmitButton.propTypes = {
45
+ title: PropTypes.string.isRequired,
46
+ isLoading: PropTypes.bool,
47
+ endIcon: PropTypes.element,
48
+ // eslint-disable-next-line react/forbid-prop-types
49
+ styles: PropTypes.object,
50
+ handleState: PropTypes.func,
51
+ enabled: PropTypes.bool
52
+ };
53
+ const useDebounce = (value, delay) => {
54
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
55
+ React.useEffect(() => {
56
+ const timer = setTimeout(() => setDebouncedValue(value), delay);
57
+ return () => {
58
+ clearTimeout(timer);
59
+ };
60
+ }, [value, delay]);
61
+ return debouncedValue;
62
+ };
63
+ const DID_START = "did:";
64
+ const ERRORS = {
65
+ DID_NOT_FOUND: "DID not found",
66
+ REQUIRED: "Required"
67
+ };
68
+ const AutoCompleteOrganizationName = ({ defaultValue }) => {
69
+ const form = reactHookForm.useFormContext();
70
+ const [value, setValue] = React.useState(defaultValue);
71
+ const [text, setText] = React.useState(defaultValue?.name || "");
72
+ const [options, setOptions] = React.useState([]);
73
+ const [isOpen, setIsOpen] = React.useState(false);
74
+ const [loading, setLoading] = React.useState(false);
75
+ const [error, setError] = React.useState("");
76
+ const dataProvider = reactAdmin.useDataProvider();
77
+ const debouncedText = useDebounce(text, 500);
78
+ const theme2 = material.useTheme();
79
+ const [stopSearch, setStopSearch] = React.useState(false);
80
+ form.register("org.name", { required: true });
81
+ React.useEffect(() => {
82
+ form.setValue("org", value, { shouldValidate: true });
83
+ }, [form, value]);
84
+ React.useEffect(() => {
85
+ const searchProfiles = async () => {
86
+ if (stopSearch) {
87
+ return;
88
+ }
89
+ setLoading(true);
90
+ try {
91
+ if (debouncedText.includes(DID_START)) {
92
+ const result2 = await dataProvider.getOne(remoteDataProvider.dataResources.VERIFIED_PROFILE, {
93
+ id: debouncedText
94
+ });
95
+ setError("");
96
+ setText(result2.data.credentialSubject.name);
97
+ setValue(result2.data.credentialSubject);
98
+ setIsOpen(false);
99
+ return;
100
+ }
101
+ if (!debouncedText) {
102
+ setOptions([]);
103
+ return;
104
+ }
105
+ const result = await dataProvider.getList(remoteDataProvider.dataResources.SEARCH_PROFILES, {
106
+ search: debouncedText
107
+ });
108
+ setOptions(result.data.slice(0, 5));
109
+ } catch {
110
+ setOptions([]);
111
+ if (debouncedText.includes(DID_START)) {
112
+ setError(ERRORS.DID_NOT_FOUND);
113
+ }
114
+ } finally {
115
+ setLoading(false);
116
+ }
117
+ };
118
+ if (debouncedText) {
119
+ searchProfiles();
120
+ }
121
+ }, [dataProvider, debouncedText, stopSearch]);
122
+ React.useEffect(() => {
123
+ if (!isOpen) {
124
+ setOptions([]);
125
+ }
126
+ }, [isOpen]);
127
+ const handleChangeText = React.useCallback((event) => {
128
+ setText(event?.target?.value);
129
+ setValue({ name: event?.target?.value });
130
+ }, []);
131
+ const handleBlur = React.useCallback(() => {
132
+ if (!text) {
133
+ setValue(null);
134
+ setError(ERRORS.REQUIRED);
135
+ }
136
+ if (text && !options.length) {
137
+ setValue({ name: text });
138
+ }
139
+ }, [options, text]);
140
+ const handleFocus = React.useCallback(() => {
141
+ setError("");
142
+ }, []);
143
+ const handleStopSearch = React.useCallback(() => {
144
+ setStopSearch(true);
145
+ setOptions([]);
146
+ setTimeout(() => {
147
+ setStopSearch(false);
148
+ }, 1e4);
149
+ }, []);
150
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { marginBottom: 5, children: [
151
+ /* @__PURE__ */ jsxRuntime.jsx(
152
+ material.Autocomplete,
153
+ {
154
+ fullWidth: true,
155
+ options: text?.length && !loading ? options : [],
156
+ inputValue: text || "",
157
+ open: isOpen,
158
+ onOpen: () => setIsOpen(true),
159
+ onClose: () => setIsOpen(false),
160
+ onInputChange: handleChangeText,
161
+ getOptionLabel: (params) => params?.name?.toString(),
162
+ getOptionKey: (params) => params.id,
163
+ loading,
164
+ freeSolo: true,
165
+ disableClearable: true,
166
+ blurOnSelect: true,
167
+ value,
168
+ filterOptions: (x) => x,
169
+ onChange: (_event, newValue) => {
170
+ if (typeof newValue === "string") {
171
+ setText(text);
172
+ setValue({ name: text });
173
+ setOptions([]);
174
+ return;
175
+ }
176
+ setValue(newValue);
177
+ setText(newValue.name);
178
+ },
179
+ renderOption: (props, option, { inputValue }) => {
180
+ const matches = match(option.name, inputValue, { insideWords: true });
181
+ const parts = parse(option.name, matches);
182
+ const isLastItem = props["data-option-index"] === options.length - 1;
183
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
184
+ /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, style: isLastItem ? styles.lastItem : styles.item, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
185
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: parts.map((part, index2) => /* @__PURE__ */ jsxRuntime.jsx(
186
+ material.Typography,
187
+ {
188
+ style: { fontWeight: part.highlight ? 700 : 400 },
189
+ variant: "pl",
190
+ children: part.text
191
+ },
192
+ index2
193
+ )) }),
194
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "ps", color: theme2.palette.secondary.light, children: option.id })
195
+ ] }) }),
196
+ isLastItem ? /* @__PURE__ */ jsxRuntime.jsxs(
197
+ material.Button,
198
+ {
199
+ variant: "outlined",
200
+ color: "secondary",
201
+ onClick: handleStopSearch,
202
+ sx: styles.inviteButton,
203
+ children: [
204
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { sx: styles.plus }),
205
+ "Invite New Organization"
206
+ ]
207
+ }
208
+ ) : null
209
+ ] });
210
+ },
211
+ renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { style: styles.inputBox, children: [
212
+ /* @__PURE__ */ jsxRuntime.jsx(
213
+ material.TextField,
214
+ {
215
+ label: "Legal Name",
216
+ ...params,
217
+ value: params.inputProps.value.name,
218
+ onBlur: handleBlur,
219
+ onFocus: handleFocus,
220
+ error
221
+ }
222
+ ),
223
+ value?.id ? /* @__PURE__ */ jsxRuntime.jsx(
224
+ material.Typography,
225
+ {
226
+ style: styles.did,
227
+ variant: "ps",
228
+ color: theme2.palette.secondary.light,
229
+ sx: styles.inviteButton,
230
+ children: value.id
231
+ }
232
+ ) : null
233
+ ] })
234
+ }
235
+ ),
236
+ error ? /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "ps", color: theme2.palette.error.light, children: error }) : null
237
+ ] });
238
+ };
239
+ AutoCompleteOrganizationName.propTypes = {
240
+ // eslint-disable-next-line react/forbid-prop-types
241
+ defaultValue: PropTypes.object
242
+ };
243
+ const styles = {
244
+ inputBox: { position: "relative" },
245
+ item: {
246
+ padding: "8px 12px",
247
+ borderBottomWidth: "1px",
248
+ borderBottomStyle: "solid",
249
+ borderBottomColor: "#D1D4D8"
250
+ },
251
+ lastItem: {
252
+ padding: "8px 12px"
253
+ },
254
+ did: {
255
+ position: "absolute",
256
+ left: "0px",
257
+ bottom: "-12px"
258
+ },
259
+ inviteButton: {
260
+ color: (theme2) => theme2.customColors.grey2,
261
+ marginBottom: "16px",
262
+ marginLeft: "12px",
263
+ marginTop: "16px",
264
+ fontSize: "12px"
265
+ },
266
+ plus: {
267
+ width: "16px",
268
+ height: "16px",
269
+ marginRight: "6px"
270
+ }
271
+ };
19
272
  const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, defaultValues }) => {
20
273
  const dataProvider = reactAdmin.useDataProvider();
21
274
  const timeout = React.useRef(null);
@@ -41,7 +294,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
41
294
  }, 500);
42
295
  });
43
296
  };
44
- const orgNamevalidation = [...CreateOrganization_utils.validateName, debouncedValidation];
297
+ const orgNamevalidation = [...CreateOrganizationUtils.validateName, debouncedValidation];
45
298
  const handleSubmit = React.useCallback(
46
299
  (data) => {
47
300
  onSubmit(data);
@@ -76,7 +329,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
76
329
  ) }),
77
330
  /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.TextInput, { fullWidth: true, multiline: true, label: "Short Description", source: "description" }),
78
331
  /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
79
- /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.TextInput, { fullWidth: true, label: "Website", source: "website", validate: CreateOrganization_utils.validateWebsite }),
332
+ /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.TextInput, { fullWidth: true, label: "Website", source: "website", validate: CreateOrganizationUtils.validateWebsite }),
80
333
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.WEBSITE_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
81
334
  ] }),
82
335
  /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.TextInput, { fullWidth: true, label: "Address", source: "physicalAddress.line1" }),
@@ -94,7 +347,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
94
347
  fullWidth: true,
95
348
  label: "LinkedIn Page",
96
349
  source: "linkedInProfile",
97
- validate: CreateOrganization_utils.validateWebsiteStrict
350
+ validate: CreateOrganizationUtils.validateWebsiteStrict
98
351
  }
99
352
  ),
100
353
  /* @__PURE__ */ jsxRuntime.jsx(LinkedInRegistrationInput.LinkedInRegistrationInput, { formData, source: "registrationNumbers" }),
@@ -105,7 +358,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
105
358
  fullWidth: true,
106
359
  label: "Support Email",
107
360
  source: "contactEmail",
108
- validate: CreateOrganization_utils.validateEmail
361
+ validate: CreateOrganizationUtils.validateEmail
109
362
  }
110
363
  ),
111
364
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.SUPPORT_EMAIL_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
@@ -117,7 +370,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
117
370
  fullWidth: true,
118
371
  label: "Technical Contact Email",
119
372
  source: "technicalEmail",
120
- validate: CreateOrganization_utils.validateEmail
373
+ validate: CreateOrganizationUtils.validateEmail
121
374
  }
122
375
  ),
123
376
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.TECHNICAL_EMAIL_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
@@ -135,7 +388,7 @@ const CreateInvitationForOrganization = ({ onSubmit, countryCodes, onCancel, def
135
388
  }
136
389
  ),
137
390
  /* @__PURE__ */ jsxRuntime.jsx(
138
- OrganisationSubmitButton.OrganizationSubmitButton,
391
+ OrganizationSubmitButton,
139
392
  {
140
393
  styles: sxStyles$1.button,
141
394
  title: "Next",
@@ -182,30 +435,30 @@ const CreateOrganization = ({
182
435
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h1", mb: 2, children: title }),
183
436
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "pl", mb: 6.5, textAlign: "center", children: subTitle }),
184
437
  /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.Form, { defaultValues, onSubmit: handleSubmit, noValidate: true, mode: "all", children: /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.FormDataConsumer, { children: ({ formData }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
185
- /* @__PURE__ */ jsxRuntime.jsxs(Grid, { container: true, spacing: 4, rowSpacing: 1, children: [
186
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { container: true, flex: 1, flexDirection: "column", children: [
187
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
438
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 4, rowSpacing: 1, children: [
439
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { container: true, flex: 1, flexDirection: "column", children: [
440
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
188
441
  reactAdmin.TextInput,
189
442
  {
190
443
  fullWidth: true,
191
444
  label: "Legal Name",
192
445
  source: "name",
193
- validate: CreateOrganization_utils.validateName
446
+ validate: CreateOrganizationUtils.validateName
194
447
  }
195
448
  ) }),
196
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
449
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
197
450
  /* @__PURE__ */ jsxRuntime.jsx(
198
451
  reactAdmin.TextInput,
199
452
  {
200
453
  fullWidth: true,
201
454
  label: "Website",
202
455
  source: "website",
203
- validate: [reactAdmin.required(), ...CreateOrganization_utils.validateWebsiteStrict]
456
+ validate: [reactAdmin.required(), ...CreateOrganizationUtils.validateWebsiteStrict]
204
457
  }
205
458
  ),
206
459
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.WEBSITE_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
207
460
  ] }) }),
208
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
461
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
209
462
  reactAdmin.TextInput,
210
463
  {
211
464
  fullWidth: true,
@@ -214,7 +467,7 @@ const CreateOrganization = ({
214
467
  validate: [reactAdmin.required(), reactAdmin.maxLength(1024)]
215
468
  }
216
469
  ) }),
217
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
470
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
218
471
  reactAdmin.AutocompleteInput,
219
472
  {
220
473
  label: "Country",
@@ -224,7 +477,7 @@ const CreateOrganization = ({
224
477
  }
225
478
  ) })
226
479
  ] }) }),
227
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, pb: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
480
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, pb: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
228
481
  index.CustomImageInput,
229
482
  {
230
483
  label: false,
@@ -233,36 +486,36 @@ const CreateOrganization = ({
233
486
  imgSrc: defaultValues?.logo
234
487
  }
235
488
  ) }),
236
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
489
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
237
490
  reactAdmin.TextInput,
238
491
  {
239
492
  fullWidth: true,
240
493
  label: "LinkedIn Page",
241
494
  source: "linkedInProfile",
242
- validate: [...CreateOrganization_utils.validateWebsite, reactAdmin.required()]
495
+ validate: [...CreateOrganizationUtils.validateWebsite, reactAdmin.required()]
243
496
  }
244
497
  ) }) }),
245
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(LinkedInRegistrationInput.LinkedInRegistrationInput, { formData: { ...formData, ...defaultValues } }) }),
246
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
498
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(LinkedInRegistrationInput.LinkedInRegistrationInput, { formData: { ...formData, ...defaultValues } }) }),
499
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
247
500
  /* @__PURE__ */ jsxRuntime.jsx(
248
501
  reactAdmin.TextInput,
249
502
  {
250
503
  fullWidth: true,
251
504
  label: "Support Email",
252
505
  source: "contactEmail",
253
- validate: [reactAdmin.required(), ...CreateOrganization_utils.validateEmail]
506
+ validate: [reactAdmin.required(), ...CreateOrganizationUtils.validateEmail]
254
507
  }
255
508
  ),
256
509
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.SUPPORT_EMAIL_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
257
510
  ] }) }),
258
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
511
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
259
512
  /* @__PURE__ */ jsxRuntime.jsx(
260
513
  reactAdmin.TextInput,
261
514
  {
262
515
  fullWidth: true,
263
516
  label: "Technical Contact Email",
264
517
  source: "technicalEmail",
265
- validate: [reactAdmin.required(), ...CreateOrganization_utils.validateEmail]
518
+ validate: [reactAdmin.required(), ...CreateOrganizationUtils.validateEmail]
266
519
  }
267
520
  ),
268
521
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.TECHNICAL_EMAIL_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
@@ -274,7 +527,7 @@ const CreateOrganization = ({
274
527
  orientation: "horizontal"
275
528
  }
276
529
  ),
277
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
530
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
278
531
  reactAdmin.TextInput,
279
532
  {
280
533
  fullWidth: true,
@@ -285,15 +538,15 @@ const CreateOrganization = ({
285
538
  validate: reactAdmin.required()
286
539
  }
287
540
  ) }),
288
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
541
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
289
542
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h4", my: 2, children: "Administrator’s Details" }),
290
543
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2.25, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.ADMINISTRATOR_DETAILS_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
291
544
  ] }) }),
292
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
545
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
293
546
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h4", my: 2, children: "Signatory Authority’s Details" }),
294
547
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2.25, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.SIGNATORY_DETAILS_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
295
548
  ] }) }),
296
- /* @__PURE__ */ jsxRuntime.jsxs(Grid, { size: { xs: 6 }, children: [
549
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { size: { xs: 6 }, children: [
297
550
  /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
298
551
  reactAdmin.TextInput,
299
552
  {
@@ -315,7 +568,7 @@ const CreateOrganization = ({
315
568
  }
316
569
  ) })
317
570
  ] }),
318
- /* @__PURE__ */ jsxRuntime.jsxs(Grid, { size: { xs: 6 }, children: [
571
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { size: { xs: 6 }, children: [
319
572
  /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
320
573
  reactAdmin.TextInput,
321
574
  {
@@ -335,7 +588,7 @@ const CreateOrganization = ({
335
588
  }
336
589
  ) })
337
590
  ] }),
338
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
591
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
339
592
  reactAdmin.TextInput,
340
593
  {
341
594
  fullWidth: true,
@@ -344,7 +597,7 @@ const CreateOrganization = ({
344
597
  validate: [reactAdmin.maxLength(1024), reactAdmin.required()]
345
598
  }
346
599
  ) }) }),
347
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
600
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
348
601
  reactAdmin.TextInput,
349
602
  {
350
603
  fullWidth: true,
@@ -353,24 +606,24 @@ const CreateOrganization = ({
353
606
  validate: [reactAdmin.maxLength(1024), reactAdmin.required()]
354
607
  }
355
608
  ) }) }),
356
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
609
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { flexDirection: "row", gap: 1.75, children: /* @__PURE__ */ jsxRuntime.jsx(
357
610
  reactAdmin.TextInput,
358
611
  {
359
612
  fullWidth: true,
360
613
  label: "Email",
361
614
  source: "adminEmail",
362
- validate: [...CreateOrganization_utils.validateEmail, reactAdmin.required()],
615
+ validate: [...CreateOrganizationUtils.validateEmail, reactAdmin.required()],
363
616
  defaultValue: userData ? userData.email : ""
364
617
  }
365
618
  ) }) }),
366
- /* @__PURE__ */ jsxRuntime.jsx(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
619
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { flexDirection: "row", gap: 1.75, children: [
367
620
  /* @__PURE__ */ jsxRuntime.jsx(
368
621
  reactAdmin.TextInput,
369
622
  {
370
623
  fullWidth: true,
371
624
  label: "Email",
372
625
  source: "signatoryEmail",
373
- validate: [...CreateOrganization_utils.validateEmail, reactAdmin.required()]
626
+ validate: [...CreateOrganizationUtils.validateEmail, reactAdmin.required()]
374
627
  }
375
628
  ),
376
629
  /* @__PURE__ */ jsxRuntime.jsx(material.Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: index$1.SIGNATORY_EMAIL_HINT, children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { color: "info", fontSize: "small", cursor: "pointer" }) }) })
@@ -390,7 +643,7 @@ const CreateOrganization = ({
390
643
  }
391
644
  ),
392
645
  /* @__PURE__ */ jsxRuntime.jsx(
393
- OrganisationSubmitButton.OrganizationSubmitButton,
646
+ OrganizationSubmitButton,
394
647
  {
395
648
  title: buttonTitle,
396
649
  isLoading,
@@ -438,6 +691,67 @@ const sxStyles = {
438
691
  mr: 2
439
692
  }
440
693
  };
694
+ const ValidateTextInput = ({ source, resource, ...props }) => {
695
+ const { debounce: debounceTime = 250, ...rest } = props;
696
+ const errorobj = { message: " " };
697
+ const dataProvider = reactAdmin.useDataProvider();
698
+ const [isError, setIsError] = React.useState(false);
699
+ const timeout = React.useRef(null);
700
+ const validateSecureUrl = [
701
+ reactAdmin.regex(index$1.secureUrlRegexp, (res) => {
702
+ setIsError(false);
703
+ return res ? "Secure webhook should be a HTTPS URL" : void 0;
704
+ }),
705
+ reactAdmin.maxLength(1024)
706
+ ];
707
+ const debouncedValidation = async (value) => {
708
+ clearTimeout(timeout.current);
709
+ if (!value) {
710
+ setIsError(false);
711
+ return void 0;
712
+ }
713
+ return new Promise((resolve) => {
714
+ timeout.current = setTimeout(async () => {
715
+ const { data } = await dataProvider.create(resource, { data: { secureWebhookUrl: value } });
716
+ if (data && data.status === 400) {
717
+ setIsError(true);
718
+ resolve(errorobj);
719
+ } else {
720
+ resolve(void 0);
721
+ setIsError(false);
722
+ }
723
+ }, debounceTime);
724
+ });
725
+ };
726
+ const validate = [...validateSecureUrl, debouncedValidation];
727
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: sx.constainer, children: [
728
+ /* @__PURE__ */ jsxRuntime.jsx(reactAdmin.TextInput, { source, validate, ...rest }),
729
+ isError && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", component: "div", sx: sx.errorMessage, children: index$1.ERRORS.secureWebHook })
730
+ ] });
731
+ };
732
+ const sx = {
733
+ constainer: {
734
+ width: "100%",
735
+ position: "relative"
736
+ },
737
+ errorMessage: {
738
+ color: "primary.main",
739
+ mt: 0,
740
+ mb: 0.5,
741
+ ml: 1.5
742
+ }
743
+ };
744
+ ValidateTextInput.propTypes = {
745
+ source: PropTypes.string,
746
+ resource: PropTypes.string,
747
+ errortext: PropTypes.string,
748
+ // eslint-disable-next-line react/forbid-prop-types
749
+ validate: PropTypes.array,
750
+ debounce: PropTypes.number
751
+ };
752
+ exports.AutoCompleteOrganizationName = AutoCompleteOrganizationName;
441
753
  exports.CreateInvitationForOrganization = CreateInvitationForOrganization;
442
754
  exports.CreateOrganization = CreateOrganization;
443
- //# sourceMappingURL=CreateOrganization.A11-a_8R.js.map
755
+ exports.OrganizationSubmitButton = OrganizationSubmitButton;
756
+ exports.ValidateTextInput = ValidateTextInput;
757
+ //# sourceMappingURL=ValidateTextInput.DEBaVB1L.js.map