@gen3/frontend 0.12.63 → 0.12.64

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 (96) hide show
  1. package/dist/dts/components/Content/Form.d.ts +5 -5
  2. package/dist/dts/components/Content/Form.d.ts.map +1 -1
  3. package/dist/dts/components/Content/Form.js +9 -1
  4. package/dist/dts/components/Content/Form.js.map +1 -1
  5. package/dist/dts/components/Content/FormContent.d.ts +16 -5
  6. package/dist/dts/components/Content/FormContent.d.ts.map +1 -1
  7. package/dist/dts/components/Content/FormContent.js +26 -4
  8. package/dist/dts/components/Content/FormContent.js.map +1 -1
  9. package/dist/dts/components/Content/formValidators.d.ts +7 -0
  10. package/dist/dts/components/Content/formValidators.d.ts.map +1 -0
  11. package/dist/dts/components/Content/formValidators.js +52 -0
  12. package/dist/dts/components/Content/formValidators.js.map +1 -0
  13. package/dist/dts/components/Providers/Gen3Provider.d.ts +7 -7
  14. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +22 -22
  15. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  16. package/dist/dts/features/CohortSimilarity/cohortSimilarityApi.d.ts +4 -4
  17. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.d.ts +16 -0
  18. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.d.ts.map +1 -0
  19. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.js +18 -0
  20. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.js.map +1 -0
  21. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.stories.d.ts +30 -0
  22. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.stories.d.ts.map +1 -0
  23. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.stories.js +367 -0
  24. package/dist/dts/features/DiscoveryForms/StudyRegistration/FormContentViews.stories.js.map +1 -0
  25. package/dist/dts/features/DiscoveryForms/StudyRegistration/StudyRegistrationAccessRequestOutcome.d.ts +7 -0
  26. package/dist/dts/features/DiscoveryForms/StudyRegistration/StudyRegistrationAccessRequestOutcome.d.ts.map +1 -0
  27. package/dist/dts/features/DiscoveryForms/StudyRegistration/StudyRegistrationAccessRequestOutcome.js +14 -0
  28. package/dist/dts/features/DiscoveryForms/StudyRegistration/StudyRegistrationAccessRequestOutcome.js.map +1 -0
  29. package/dist/dts/features/DiscoveryForms/StudyRegistration/index.d.ts +8 -0
  30. package/dist/dts/features/DiscoveryForms/StudyRegistration/index.d.ts.map +1 -0
  31. package/dist/dts/features/DiscoveryForms/StudyRegistration/index.js +11 -0
  32. package/dist/dts/features/DiscoveryForms/StudyRegistration/index.js.map +1 -0
  33. package/dist/dts/features/DiscoveryForms/StudyRegistration/types.d.ts +55 -0
  34. package/dist/dts/features/DiscoveryForms/StudyRegistration/types.d.ts.map +1 -0
  35. package/dist/dts/features/DiscoveryForms/StudyRegistration/types.js +8 -0
  36. package/dist/dts/features/DiscoveryForms/StudyRegistration/types.js.map +1 -0
  37. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/getClinicalTrialMetadata.d.ts +2 -0
  38. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/getClinicalTrialMetadata.d.ts.map +1 -0
  39. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/getClinicalTrialMetadata.js +17 -0
  40. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/getClinicalTrialMetadata.js.map +1 -0
  41. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/preprocessStudyRegistrationMetadata.d.ts +10 -0
  42. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/preprocessStudyRegistrationMetadata.d.ts.map +1 -0
  43. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/preprocessStudyRegistrationMetadata.js +77 -0
  44. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/preprocessStudyRegistrationMetadata.js.map +1 -0
  45. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.d.ts +12 -0
  46. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.d.ts.map +1 -0
  47. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.js +160 -0
  48. package/dist/dts/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.js.map +1 -0
  49. package/dist/dts/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.d.ts +6 -0
  50. package/dist/dts/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.d.ts.map +1 -0
  51. package/dist/dts/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.js +10 -0
  52. package/dist/dts/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.js.map +1 -0
  53. package/dist/dts/features/Navigation/FixedNavPageLayout.js +1 -1
  54. package/dist/dts/features/Navigation/FixedNavPageLayout.js.map +1 -1
  55. package/dist/dts/features/Study/StudyDetails/StudyDetailsHeaderButtons.d.ts.map +1 -1
  56. package/dist/dts/features/Study/StudyDetails/StudyDetailsHeaderButtons.js +26 -8
  57. package/dist/dts/features/Study/StudyDetails/StudyDetailsHeaderButtons.js.map +1 -1
  58. package/dist/dts/pages/StudyForms/StudyRegistration/data.d.ts +4 -0
  59. package/dist/dts/pages/StudyForms/StudyRegistration/data.d.ts.map +1 -0
  60. package/dist/dts/pages/StudyForms/StudyRegistration/data.js +32 -0
  61. package/dist/dts/pages/StudyForms/StudyRegistration/data.js.map +1 -0
  62. package/dist/dts/pages/StudyForms/StudyRegistration/index.d.ts +10 -0
  63. package/dist/dts/pages/StudyForms/StudyRegistration/index.d.ts.map +1 -0
  64. package/dist/dts/pages/StudyForms/StudyRegistration/index.js +12 -0
  65. package/dist/dts/pages/StudyForms/StudyRegistration/index.js.map +1 -0
  66. package/dist/dts/pages/StudyForms/StudyRegistration/types.d.ts +28 -0
  67. package/dist/dts/pages/StudyForms/StudyRegistration/types.d.ts.map +1 -0
  68. package/dist/dts/pages/StudyForms/StudyRegistration/types.js +2 -0
  69. package/dist/dts/pages/StudyForms/StudyRegistration/types.js.map +1 -0
  70. package/dist/index/cjs/QueryPanel-DNGXxrpC.js +43 -0
  71. package/dist/index/cjs/QueryPanel-DNGXxrpC.js.map +1 -0
  72. package/dist/index/cjs/index-7sUtTikC.js +42117 -0
  73. package/dist/index/cjs/index-7sUtTikC.js.map +1 -0
  74. package/dist/index/cjs/index.js +1 -1
  75. package/dist/index/esm/QueryPanel-C3JVntIb.js +37 -0
  76. package/dist/index/esm/QueryPanel-C3JVntIb.js.map +1 -0
  77. package/dist/index/esm/index-B_0ks9Pi.js +41830 -0
  78. package/dist/index/esm/index-B_0ks9Pi.js.map +1 -0
  79. package/dist/index/esm/index.js +1 -1
  80. package/dist/index.d.ts +22 -12
  81. package/dist/pages/cjs/CohortBuilder-DircXqXL.js +576 -0
  82. package/dist/pages/cjs/CohortBuilder-DircXqXL.js.map +1 -0
  83. package/dist/pages/cjs/QueryPanel-qYWbo2Cb.js +43 -0
  84. package/dist/pages/cjs/QueryPanel-qYWbo2Cb.js.map +1 -0
  85. package/dist/pages/cjs/index-BQzYPjdE.js +32499 -0
  86. package/dist/pages/cjs/index-BQzYPjdE.js.map +1 -0
  87. package/dist/pages/cjs/index.js +1 -1
  88. package/dist/pages/esm/CohortBuilder-CI9PAFLd.js +573 -0
  89. package/dist/pages/esm/CohortBuilder-CI9PAFLd.js.map +1 -0
  90. package/dist/pages/esm/QueryPanel-BEqldpr5.js +37 -0
  91. package/dist/pages/esm/QueryPanel-BEqldpr5.js.map +1 -0
  92. package/dist/pages/esm/index-BoZwM5wd.js +32389 -0
  93. package/dist/pages/esm/index-BoZwM5wd.js.map +1 -0
  94. package/dist/pages/esm/index.js +1 -1
  95. package/dist/pages.d.ts +15 -5
  96. package/package.json +2 -2
@@ -0,0 +1,12 @@
1
+ import { FormOutcome } from '../types';
2
+ import type { FormOnSubmitReturnProps, FormPropsBody } from '../../../../components/Content/Form';
3
+ import type { StudyRegistrationFormConfig } from '../../../../pages/StudyForms/StudyRegistration/types';
4
+ export declare const useStudyRegistration: (config: StudyRegistrationFormConfig) => {
5
+ formError: string | undefined;
6
+ formOutcome: FormOutcome;
7
+ studyUID: string | null;
8
+ formBody: FormPropsBody[];
9
+ formOnSubmit: (formValues: FormOnSubmitReturnProps) => Promise<void>;
10
+ isLoading: boolean;
11
+ };
12
+ //# sourceMappingURL=useStudyRegistration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStudyRegistration.d.ts","sourceRoot":"","sources":["../../../../../../src/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWvC,OAAO,KAAK,EACV,uBAAuB,EACvB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAExG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,2BAA2B,KAClC;IACD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,YAAY,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,SAAS,EAAE,OAAO,CAAC;CAgMpB,CAAC"}
@@ -0,0 +1,160 @@
1
+ import { useEffect, useState, useMemo, useCallback } from 'react';
2
+ import { useRouter } from 'next/router';
3
+ import { toString } from 'lodash';
4
+ import { selectUserDetails, useCoreSelector, useUpdateStudyInMDSMutation, } from '@gen3/core';
5
+ import { FormOutcome } from '../types';
6
+ import { userCanRegisterStudy } from '../userCanRegisterStudy';
7
+ import { getClinicalTrialMetadata } from './getClinicalTrialMetadata';
8
+ import { preprocessStudyRegistrationMetadata } from './preprocessStudyRegistrationMetadata';
9
+ import { createCEDARInstance, cedarApi, updateStudyInMDS } from '@gen3/core';
10
+ export const useStudyRegistration = (config) => {
11
+ const [createCedarQuery] = cedarApi.useCreateCedarInstanceMutation();
12
+ const [updateMdsQuery] = useUpdateStudyInMDSMutation();
13
+ const [formError, setFormError] = useState();
14
+ const [formOutcome, setFormOutcome] = useState(FormOutcome.pending);
15
+ // const [studyUID, setStudyUID] = useState<string | null>(null);
16
+ const router = useRouter();
17
+ const studyUID = typeof router.query.studyUID === 'string' ? router.query.studyUID : '';
18
+ const [studies, setStudies] = useState([]);
19
+ const userInfo = useCoreSelector((state) => selectUserDetails(state));
20
+ const [isLoading, setIsLoading] = useState(true);
21
+ // Fetch all unregistered studies from MDS
22
+ useEffect(() => {
23
+ const fetchData = async () => {
24
+ try {
25
+ setIsLoading(true);
26
+ const response = await fetch(config.mdsURL +
27
+ '/metadata?data=True&_guid_type=unregistered_discovery_metadata&limit=2000&offset=0');
28
+ if (!response.ok) {
29
+ setFormOutcome(FormOutcome.error);
30
+ setFormError(`HTTP error! status: ${response.status}`);
31
+ throw new Error(`HTTP error! status: ${response.status}`);
32
+ }
33
+ const json = await response.json();
34
+ const rawStudies = Object.values(json).map((entry) => {
35
+ return entry.gen3_discovery || {};
36
+ });
37
+ setStudies(rawStudies);
38
+ }
39
+ catch (err) {
40
+ if (err instanceof Error && err.name !== 'AbortError') {
41
+ setFormError(`HTTP error! status: ${err}`);
42
+ throw new Error(`HTTP error! status: ${err}`);
43
+ }
44
+ }
45
+ finally {
46
+ setIsLoading(false);
47
+ }
48
+ };
49
+ void fetchData();
50
+ }, [config.mdsURL]);
51
+ // Helper func for setting study from router query as the first one shown
52
+ const moveStudyToFront = useCallback((studies, studyUID) => {
53
+ const targetIndex = studies.findIndex((item) => item._hdp_uid === studyUID);
54
+ if (targetIndex > 0) {
55
+ const [targetItem] = studies.splice(targetIndex, 1);
56
+ studies.unshift(targetItem);
57
+ }
58
+ return studies;
59
+ }, []);
60
+ const formBody = useMemo(() => {
61
+ if (!studies.length) {
62
+ return config.form.map((item) => ({
63
+ ...item,
64
+ type: item.type,
65
+ initialValue: toString(item.initialValue),
66
+ }));
67
+ }
68
+ // Filter based on active user permissions
69
+ const registerableStudies = studies.filter((study) => userCanRegisterStudy(userInfo, study.registration_authz));
70
+ // Set pre-selected study as the first item in array
71
+ const organizedRegistrableStudies = moveStudyToFront(registerableStudies, toString(studyUID));
72
+ const registerableStudyData = organizedRegistrableStudies.map((study) => {
73
+ const metadata = study.study_metadata;
74
+ return {
75
+ label: `${study.project_number || 'N/A'} : ${metadata?.minimal_info?.study_name || 'N/A'} : ${metadata?.metadata_location?.nih_application_id || 'N/A'}`,
76
+ value: study._hdp_uid,
77
+ };
78
+ });
79
+ // Autofill values for form:
80
+ return config.form.map((item) => item.variable === 'study_id'
81
+ ? {
82
+ ...item,
83
+ dropdownData: registerableStudyData,
84
+ initialValue: registerableStudyData[0]?.value,
85
+ type: item.type,
86
+ }
87
+ : {
88
+ ...item,
89
+ dropdownData: item.dropdownData
90
+ ? item.dropdownData
91
+ : [],
92
+ initialValue: toString(item.initialValue),
93
+ type: item.type,
94
+ });
95
+ }, [moveStudyToFront, studies, userInfo, config.form, studyUID]);
96
+ const formOnSubmit = async (formValues) => {
97
+ setIsLoading(true);
98
+ setFormError(undefined); // Reset previous errors
99
+ const cedarUserUUID = formValues.cedar_uuid;
100
+ const studyID = formValues.study_id;
101
+ const ctgovID = formValues.clinical_trials_id;
102
+ try {
103
+ const valuesToUpdate = {
104
+ repository: formValues.repository || '',
105
+ repository_study_ids: !formValues.repository_study_ids ||
106
+ (formValues.repository_study_ids.length === 1 &&
107
+ formValues.repository_study_ids[0] === '')
108
+ ? []
109
+ : formValues.repository_study_ids,
110
+ clinical_trials_id: ctgovID || '',
111
+ clinicaltrials_gov: ctgovID
112
+ ? await getClinicalTrialMetadata(config.clinicalTrialFields, ctgovID)
113
+ : undefined,
114
+ };
115
+ // 1. Preprocess metadata
116
+ const preprocessedMetadata = await preprocessStudyRegistrationMetadata(config, userInfo.username, studyID, valuesToUpdate);
117
+ // 2. Create CEDAR Instance
118
+ const cedarResponse = (await createCEDARInstance(config.cedarWrapperURL, cedarUserUUID, preprocessedMetadata, createCedarQuery));
119
+ // Check the returned result object
120
+ if (cedarResponse.error) {
121
+ setFormOutcome(FormOutcome.error);
122
+ setFormError(cedarResponse.error);
123
+ setIsLoading(false);
124
+ return;
125
+ }
126
+ // 3. Update Study in MDS
127
+ const mdsResponse = (await updateStudyInMDS(config.mdsURL, studyID, cedarResponse, updateMdsQuery));
128
+ if (mdsResponse.error) {
129
+ setFormOutcome(FormOutcome.error);
130
+ setFormError(mdsResponse.error);
131
+ setIsLoading(false);
132
+ return;
133
+ }
134
+ else {
135
+ // Everything was successful!
136
+ setIsLoading(false);
137
+ setFormOutcome(FormOutcome.success);
138
+ }
139
+ }
140
+ catch (err) {
141
+ console.error('Study registration pipeline failed:', err);
142
+ // Extract readable error string
143
+ const message = (err instanceof Error && err.message) || String(err);
144
+ setFormOutcome(FormOutcome.error);
145
+ setFormError(message);
146
+ }
147
+ finally {
148
+ setIsLoading(false);
149
+ }
150
+ };
151
+ return {
152
+ formError,
153
+ formOutcome,
154
+ studyUID,
155
+ formBody,
156
+ formOnSubmit,
157
+ isLoading,
158
+ };
159
+ };
160
+ //# sourceMappingURL=useStudyRegistration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStudyRegistration.js","sourceRoot":"","sources":["../../../../../../src/features/DiscoveryForms/StudyRegistration/useStudyRegistration/useStudyRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,M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AA6B;gBAC7B,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;YAC1D,gCAAgC;YAChC,MAAM,OAAO,GAAG,CAAC,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YACrE,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAClC,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,WAAW;QACX,QAAQ;QACR,QAAQ;QACR,YAAY;QACZ,SAAS;KACV,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { UserProfile } from '@gen3/core';
2
+ export type ActiveUser = Partial<UserProfile> & {
3
+ active: boolean;
4
+ };
5
+ export declare const userCanRegisterStudy: (userInfo: ActiveUser | undefined, studyRegistrationAuthZ: string | undefined) => boolean;
6
+ //# sourceMappingURL=userCanRegisterStudy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCanRegisterStudy.d.ts","sourceRoot":"","sources":["../../../../../src/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,oBAAoB,GAC/B,UAAU,UAAU,GAAG,SAAS,EAChC,wBAAwB,MAAM,GAAG,SAAS,YAe3C,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const userCanRegisterStudy = (userInfo, studyRegistrationAuthZ) => {
2
+ const actions = userInfo?.authz && studyRegistrationAuthZ
3
+ ? userInfo.authz[studyRegistrationAuthZ]
4
+ : undefined;
5
+ const method = 'access';
6
+ const service = 'study_registration';
7
+ return (actions?.some((x) => (x.service === service || x.service === '*') &&
8
+ (x.method === method || x.method === '*')) ?? false);
9
+ };
10
+ //# sourceMappingURL=userCanRegisterStudy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCanRegisterStudy.js","sourceRoot":"","sources":["../../../../../src/features/DiscoveryForms/StudyRegistration/userCanRegisterStudy.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAAgC,EAChC,sBAA0C,EAC1C,EAAE;IACF,MAAM,OAAO,GACX,QAAQ,EAAE,KAAK,IAAI,sBAAsB;QACvC,CAAC,CAAE,QAAQ,CAAC,KAAsB,CAAC,sBAAsB,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,MAAM,GAAG,QAAQ,CAAC;IACxB,MAAM,OAAO,GAAG,oBAAoB,CAAC;IACrC,OAAO,CACL,OAAO,EAAE,IAAI,CACX,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,GAAG,CAAC;QAC5C,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAC5C,IAAI,KAAK,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -7,7 +7,7 @@ import LeftSidePanel from './Vertical/LeftSidePanel';
7
7
  const FixedNavPageLayout = ({ headerProps, footerProps, mainProps, headerMetadata, CustomHeaderComponent, CustomFooterComponent, children, }) => {
8
8
  const mainContentStyle = mainProps?.fixed
9
9
  ? 'flex-1 flex overflow-hidden relative'
10
- : 'flex grow relative';
10
+ : 'flex grow relative overflow-auto';
11
11
  const [headerRef, headerRect] = useResizeObserver();
12
12
  const [footerRef, footerRect] = useResizeObserver();
13
13
  return (_jsxs("div", { className: "flex flex-col justify-between h-full min-h-dvh", children: [_jsxs(Head, { children: [_jsx("title", { children: headerMetadata.title }), _jsx("meta", { property: "og:title", content: headerMetadata.content }, headerMetadata.key)] }), CustomHeaderComponent ? (_jsx(CustomHeaderComponent, { ...headerProps })) : (_jsx(Header, { ...headerProps, ref: headerRef })), headerProps.type === 'vertical' ? (_jsxs("div", { className: "flex grow", children: [_jsx(LeftSidePanel, { items: headerProps.navigation.items, classNames: headerProps.navigation.classNames }), _jsx("main", { className: mainContentStyle, children: children })] })) : (_jsx("main", { className: mainContentStyle, style: {
@@ -1 +1 @@
1
- {"version":3,"file":"FixedNavPageLayout.js","sourceRoot":"","sources":["../../../../src/features/Navigation/FixedNavPageLayout.tsx"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,kBAAkB,GAAG,CAAC,EAC1B,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,GAC8B,EAAE,EAAE;IAC1C,MAAM,gBAAgB,GAAG,SAAS,EAAE,KAAK;QACvC,CAAC,CAAC,sCAAsC;QACxC,CAAC,CAAC,oBAAoB,CAAC;IAEzB,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,iBAAiB,EAAkB,CAAC;IACpE,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,iBAAiB,EAAE,CAAC;IAEpD,OAAO,CACL,eAAK,SAAS,EAAC,gDAAgD,aAC7D,MAAC,IAAI,eACH,0BAAQ,cAAc,CAAC,KAAK,GAAS,EACrC,eACE,QAAQ,EAAC,UAAU,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,IAC1B,cAAc,CAAC,GAAG,CACvB,IACG,EACN,qBAAqB,CAAC,CAAC,CAAC,CACvB,KAAC,qBAAqB,OAAK,WAAW,GAAI,CAC3C,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,OAAK,WAAW,EAAE,GAAG,EAAE,SAAS,GAAI,CAC5C,EACA,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CACjC,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,aAAa,IACZ,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,EACnC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,UAAU,GAC7C,EACF,eAAM,SAAS,EAAE,gBAAgB,YAAG,QAAQ,GAAQ,IAChD,CACP,CAAC,CAAC,CAAC,CACF,eACE,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE;oBACL,MAAM,EAAE,gBAAgB,UAAU,EAAE,MAAM,IAAI,CAAC,QAAQ,UAAU,EAAE,MAAM,IAAI,CAAC,KAAK;iBACpF,YAEA,QAAQ,GACJ,CACR,EACA,qBAAqB,CAAC,CAAC,CAAC,CACvB,KAAC,qBAAqB,OAAK,WAAW,GAAI,CAC3C,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,OAAK,WAAW,EAAE,GAAG,EAAE,SAAS,GAAI,CAC5C,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"FixedNavPageLayout.js","sourceRoot":"","sources":["../../../../src/features/Navigation/FixedNavPageLayout.tsx"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,MAAM,MAAM,iBAA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AAU,EAAE,MAAM,IAAI,CAAC,KAAK;iBACpF,YAEA,QAAQ,GACJ,CACR,EACA,qBAAqB,CAAC,CAAC,CAAC,CACvB,KAAC,qBAAqB,OAAK,WAAW,GAAI,CAC3C,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,OAAK,WAAW,EAAE,GAAG,EAAE,SAAS,GAAI,CAC5C,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"StudyDetailsHeaderButtons.d.ts","sourceRoot":"","sources":["../../../../../src/features/Study/StudyDetails/StudyDetailsHeaderButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAevC,UAAU,8BAA8B;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAuEvE,CAAC;AACF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"StudyDetailsHeaderButtons.d.ts","sourceRoot":"","sources":["../../../../../src/features/Study/StudyDetails/StudyDetailsHeaderButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,UAAU,8BAA8B;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CA2FvE,CAAC;AACF,eAAe,yBAAyB,CAAC"}
@@ -3,27 +3,40 @@ import { useMemo } from 'react';
3
3
  import { Button, CopyButton } from '@mantine/core';
4
4
  import { MdKeyboardDoubleArrowLeft as BackIcon } from 'react-icons/md';
5
5
  import { FiLogIn as LoginIcon } from 'react-icons/fi';
6
- import { selectUserDetails, useCoreSelector, } from '@gen3/core';
6
+ import { selectUserDetails, useCoreSelector } from '@gen3/core';
7
7
  import { useDiscoveryContext } from '../../Discovery/DiscoveryProvider';
8
8
  import { useRouter } from 'next/router';
9
9
  import { useStudyContext } from '../StudyProvider';
10
10
  import { toString } from 'lodash';
11
+ import { userCanRegisterStudy } from '../../DiscoveryForms/StudyRegistration/userCanRegisterStudy';
11
12
  const StudyDetailsHeaderButtons = ({ onClose, permalink, }) => {
12
13
  const userInfo = useCoreSelector((state) => selectUserDetails(state));
13
14
  const requiresLogin = !userInfo.active;
14
15
  const { discoveryConfig: config } = useDiscoveryContext();
15
- const index = config?.minimalFieldMapping?.uid ?? 'unknown';
16
- const { studyDetails, setStudyDetails } = useStudyContext();
16
+ const index = config.minimalFieldMapping.uid;
17
+ const { studyDetails } = useStudyContext();
17
18
  const studyUID = toString(studyDetails[index]);
18
- const studyName = studyDetails?.study_metadata?.minimal_info?.study_name;
19
+ const studyName = studyDetails.study_metadata?.minimal_info?.study_name;
19
20
  const studyRegistrationAuthZ = studyDetails.registration_authz;
20
- const studyProjectNumber = studyDetails?.project_number;
21
- const showSubmitButton = config.detailView?.showSubmitButton;
21
+ const studyProjectNumber = studyDetails.project_number;
22
+ const showSubmitButton = config.detailView.showSubmitButton;
22
23
  const router = useRouter();
24
+ const isStudyRegisterable = userCanRegisterStudy(userInfo, studyRegistrationAuthZ);
23
25
  const handleRegisterButtonClick = () => {
24
26
  if (requiresLogin) {
25
27
  void router.push('/Login');
26
28
  }
29
+ else if (isStudyRegisterable) {
30
+ void router.push({
31
+ pathname: '/study-reg',
32
+ query: {
33
+ studyUID: studyUID,
34
+ studyName: studyName,
35
+ studyRegistrationAuthZ: studyRegistrationAuthZ,
36
+ studyProjectNumber: studyProjectNumber,
37
+ },
38
+ }, '/study-reg');
39
+ }
27
40
  else {
28
41
  void router.push({
29
42
  pathname: '/study-reg/request-access',
@@ -40,8 +53,13 @@ const StudyDetailsHeaderButtons = ({ onClose, permalink, }) => {
40
53
  if (requiresLogin) {
41
54
  return 'Login to Register This Study';
42
55
  }
43
- return `Request Access to Register this Study`;
44
- }, [requiresLogin, studyUID]);
56
+ else if (isStudyRegisterable) {
57
+ return 'Register Study';
58
+ }
59
+ else {
60
+ return `Request Access to Register this Study`;
61
+ }
62
+ }, [requiresLogin, isStudyRegisterable]);
45
63
  return (_jsxs(_Fragment, { children: [_jsx(Button, { leftSection: _jsx(BackIcon, {}), onClick: onClose, variant: "outline", children: "Back" }), showSubmitButton && (_jsx(Button, { leftSection: _jsx(LoginIcon, { size: 14 }), variant: "subtle", color: "black", size: "xs", onClick: handleRegisterButtonClick, children: submitButtonText })), _jsx(CopyButton, { value: permalink, children: ({ copied, copy }) => (_jsx(Button, { color: copied ? 'primary' : 'secondary', onClick: copy, children: copied ? 'Copied Permalink' : 'Permalink' })) })] }));
46
64
  };
47
65
  export default StudyDetailsHeaderButtons;
@@ -1 +1 @@
1
- {"version":3,"file":"StudyDetailsHeaderButtons.js","sourceRoot":"","sources":["../../../../../src/features/Study/StudyDetails/StudyDetailsHeaderButtons.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,yBAAyB,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAEL,iBAAiB,EACjB,eAAe,GAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAMlC,MAAM,yBAAyB,GAA6C,CAAC,EAC3E,OAAO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pC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,8BAA8B,CAAC;QACxC,CAAC;QACD,OAAO,uCAAuC,CAAC;IACjD,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,8BACE,KAAC,MAAM,IAAC,WAAW,EAAE,KAAC,QAAQ,KAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,qBAE7D,EACR,gBAAgB,IAAI,CACnB,KAAC,MAAM,IACL,WAAW,EAAE,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,GAAI,EACpC,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,yBAAyB,YAEjC,gBAAgB,GACV,CACV,EACD,KAAC,UAAU,IAAC,KAAK,EAAE,SAAS,YACzB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,MAAM,IAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,YAC3D,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,GACnC,CACV,GACU,IACZ,CACJ,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"StudyDetailsHeaderButtons.js","sourceRoot":"","sources":["../../../../../src/features/Study/StudyDetails/StudyDetailsHeaderButtons.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,yBAAyB,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBA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BAAyB,YAEjC,gBAAgB,GACV,CACV,EACD,KAAC,UAAU,IAAC,KAAK,EAAE,SAAS,YACzB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,MAAM,IAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,YAC3D,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,GACnC,CACV,GACU,IACZ,CACJ,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { GetServerSideProps } from 'next';
2
+ import type { NavPageLayoutProps } from '../../../features/Navigation';
3
+ export declare const RequestAccessFormPageGetServerSideProps: GetServerSideProps<NavPageLayoutProps>;
4
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAOvE,eAAO,MAAM,uCAAuC,EAAE,kBAAkB,CACtE,kBAAkB,CA+BnB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import ContentSource from '../../../lib/content';
2
+ import { getNavPageLayoutPropsFromConfig } from '../../../lib/common/staticProps';
3
+ import { GEN3_COMMONS_NAME } from '@gen3/core';
4
+ export const RequestAccessFormPageGetServerSideProps = async () => {
5
+ try {
6
+ const configStudyRegistrationForm = await ContentSource.getContentDatabase().get(`${GEN3_COMMONS_NAME}/studyRegistrationForm.json`);
7
+ return {
8
+ props: {
9
+ ...(await getNavPageLayoutPropsFromConfig()),
10
+ configStudyRegistrationForm,
11
+ },
12
+ };
13
+ }
14
+ catch (err) {
15
+ console.error(err);
16
+ return {
17
+ props: {
18
+ ...(await getNavPageLayoutPropsFromConfig()),
19
+ configStudyRegistrationForm: {
20
+ content: [
21
+ {
22
+ type: 'markdown',
23
+ text: '# Study Registration: Not Authorized \n You are not authorized to access this page. If you believe this is an error, contact your administrator or support.',
24
+ className: 'text-center',
25
+ },
26
+ ],
27
+ },
28
+ },
29
+ };
30
+ }
31
+ };
32
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/data.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,uCAAuC,GAEhD,KAAK,IAAI,EAAE;IACb,IAAI,CAAC;QACH,MAAM,2BAA2B,GAC/B,MAAM,aAAa,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAC1C,GAAG,iBAAiB,6BAA6B,CAClD,CAAC;QAEJ,OAAO;YACL,KAAK,EAAE;gBACL,GAAG,CAAC,MAAM,+BAA+B,EAAE,CAAC;gBAC5C,2BAA2B;aAC5B;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO;YACL,KAAK,EAAE;gBACL,GAAG,CAAC,MAAM,+BAA+B,EAAE,CAAC;gBAC5C,2BAA2B,EAAE;oBAC3B,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,UAAU;4BAChB,IAAI,EAAE,6JAA6J;4BACnK,SAAS,EAAE,aAAa;yBACzB;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { StudyRegistrationFormConfig } from './types';
3
+ import type { NavPageLayoutProps } from '../../../features/Navigation';
4
+ interface StudyRegistrationFormPageProps extends NavPageLayoutProps {
5
+ configStudyRegistrationForm: StudyRegistrationFormConfig;
6
+ studyName: string;
7
+ }
8
+ declare const StudyRegistrationPage: ({ headerProps, footerProps, configStudyRegistrationForm, }: StudyRegistrationFormPageProps) => React.JSX.Element;
9
+ export default StudyRegistrationPage;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,UAAU,8BAA+B,SAAQ,kBAAkB;IACjE,2BAA2B,EAAE,2BAA2B,CAAC;IACzD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,qBAAqB,GAAI,4DAI5B,8BAA8B,sBAehC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { NavPageLayout } from '../../../features/Navigation';
3
+ import StudyRegistrationForm from '../../../features/DiscoveryForms/StudyRegistration';
4
+ const StudyRegistrationPage = ({ headerProps, footerProps, configStudyRegistrationForm, }) => {
5
+ return (_jsx(NavPageLayout, { headerProps, footerProps, headerMetadata: {
6
+ title: 'Gen3 Theme Page',
7
+ content: 'Theme page',
8
+ key: 'gen3-theme-page',
9
+ }, children: _jsx(StudyRegistrationForm, { configStudyRegistrationForm: configStudyRegistrationForm }) }));
10
+ };
11
+ export default StudyRegistrationPage;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,qBAAqB,MAAM,oDAAoD,CAAC;AASvF,MAAM,qBAAqB,GAAG,CAAC,EAC7B,WAAW,EACX,WAAW,EACX,2BAA2B,GACI,EAAE,EAAE;IACnC,OAAO,CACL,KAAC,aAAa,IACN,WAAW,EAAE,WAAW,EAC9B,cAAc,EAAE;YACd,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,iBAAiB;SACvB,YAED,KAAC,qBAAqB,IACpB,2BAA2B,EAAE,2BAA2B,GACxD,GACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { SelectOptionItem } from '../../../components/Content/FormContent';
2
+ export interface StudyRegistrationFormItem {
3
+ type?: string;
4
+ variable?: string;
5
+ label?: string;
6
+ text?: string | string[];
7
+ required?: boolean;
8
+ initialValue?: unknown;
9
+ placeholder?: string;
10
+ className?: string;
11
+ dropdownData?: SelectOptionItem[];
12
+ [key: string]: unknown;
13
+ }
14
+ export interface StudyRegistrationStatusConfig {
15
+ content?: StudyRegistrationFormItem[];
16
+ button?: Record<string, unknown>;
17
+ [key: string]: unknown;
18
+ }
19
+ export interface StudyRegistrationFormConfig {
20
+ mdsURL: string;
21
+ cedarWrapperURL: string;
22
+ clinicalTrialFields: string[];
23
+ form: StudyRegistrationFormItem[];
24
+ success: StudyRegistrationStatusConfig;
25
+ error: StudyRegistrationStatusConfig;
26
+ [key: string]: unknown;
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,yBAAyB,EAAE,CAAC;IAClC,OAAO,EAAE,6BAA6B,CAAC;IACvC,KAAK,EAAE,6BAA6B,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/pages/StudyForms/StudyRegistration/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var dynamic = require('next/dynamic');
5
+ require('react');
6
+ var core = require('@mantine/core');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
11
+
12
+ // Wrapper function for displaying loading element before GqlQueryEditor renders
13
+ const GqlQueryEditor = dynamic__default.default(()=>Promise.resolve().then(function () { return require('./index-7sUtTikC.js'); }).then(function (n) { return n.GqlQueryEditor$1; }), {
14
+ loading: ()=>/*#__PURE__*/ jsxRuntime.jsx(core.LoadingOverlay, {
15
+ visible: true
16
+ }),
17
+ ssr: false
18
+ });
19
+ /**
20
+ * Represents the QueryPanel component responsible for rendering a GraphQL query editor.
21
+ *
22
+ * @param {QueryPanelConfiguration} config - The configuration object for the QueryPanel.
23
+ * @param {Array<{ url: string, label: string }>} [config.graphQLEndpoints=[{ url: 'guppy/graphql', label: 'Flat' }]]
24
+ * An array of GraphQL endpoint objects. Each endpoint object contains the following:
25
+ * - `url` (string): The URL of the GraphQL endpoint. Note this should only be the Gen3 service path (e.g., 'guppy/graphql').
26
+ * - `label` (string): A label for the GraphQL endpoint.
27
+ *
28
+ * @returns {React.Element} The rendered GraphQL query editor.
29
+ */ const QueryPanel = ({ graphQLEndpoints = [
30
+ {
31
+ url: 'guppy/graphql',
32
+ label: 'Flat'
33
+ }
34
+ ] })=>{
35
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
36
+ // @ts-ignore
37
+ return /*#__PURE__*/ jsxRuntime.jsx(GqlQueryEditor, {
38
+ graphQLEndpoints: graphQLEndpoints
39
+ });
40
+ };
41
+
42
+ exports.default = QueryPanel;
43
+ //# sourceMappingURL=QueryPanel-DNGXxrpC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryPanel-DNGXxrpC.js","sources":["../../../src/features/Query/QueryPanel.tsx"],"sourcesContent":["import dynamic from 'next/dynamic';\nimport React from 'react';\nimport { LoadingOverlay } from '@mantine/core';\nimport type { QueryPanelConfiguration } from './types';\n\n// Wrapper function for displaying loading element before GqlQueryEditor renders\nconst GqlQueryEditor = dynamic(() => import('./GqlQueryEditor'), {\n loading: () => <LoadingOverlay visible={true} />,\n ssr: false,\n});\n\n/**\n * Represents the QueryPanel component responsible for rendering a GraphQL query editor.\n *\n * @param {QueryPanelConfiguration} config - The configuration object for the QueryPanel.\n * @param {Array<{ url: string, label: string }>} [config.graphQLEndpoints=[{ url: 'guppy/graphql', label: 'Flat' }]]\n * An array of GraphQL endpoint objects. Each endpoint object contains the following:\n * - `url` (string): The URL of the GraphQL endpoint. Note this should only be the Gen3 service path (e.g., 'guppy/graphql').\n * - `label` (string): A label for the GraphQL endpoint.\n *\n * @returns {React.Element} The rendered GraphQL query editor.\n */\n\nconst QueryPanel = ({\n graphQLEndpoints = [{ url: 'guppy/graphql', label: 'Flat' }],\n}: QueryPanelConfiguration) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return <GqlQueryEditor graphQLEndpoints={graphQLEndpoints} />;\n};\n\nexport default QueryPanel;\n"],"names":["GqlQueryEditor","dynamic","loading","_jsx","LoadingOverlay","visible","ssr","QueryPanel","graphQLEndpoints","url","label"],"mappings":";;;;;;;;;;;AAKA;AACA,MAAMA,cAAAA,GAAiBC,wBAAAA,CAAQ,IAAM,oDAAO,qBAAA,uDAAA,EAAqB;AAC/DC,IAAAA,OAAAA,EAAS,kBAAMC,cAAA,CAACC,mBAAAA,EAAAA;YAAeC,OAAAA,EAAS;;IACxCC,GAAAA,EAAK;AACP,CAAA,CAAA;AAEA;;;;;;;;;;AAUC,IAED,MAAMC,UAAAA,GAAa,CAAC,EAClBC,gBAAAA,GAAmB;AAAC,IAAA;QAAEC,GAAAA,EAAK,eAAA;QAAiBC,KAAAA,EAAO;AAAO;CAAE,EACpC,GAAA;;;AAGxB,IAAA,qBAAOP,cAAA,CAACH,cAAAA,EAAAA;QAAeQ,gBAAAA,EAAkBA;;AAC3C;;;;"}