@reqquest/ui 1.0.0 → 1.1.0

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 (47) hide show
  1. package/README.md +8 -0
  2. package/dist/api.js +656 -111
  3. package/dist/components/AppRequestCard.svelte +172 -0
  4. package/dist/components/ApplicantProgramList.svelte +184 -0
  5. package/dist/components/ApplicantProgramListTooltip.svelte +22 -0
  6. package/dist/components/ApplicantPromptPage.svelte +88 -0
  7. package/dist/components/ApplicationDetailsView.svelte +307 -0
  8. package/dist/components/ButtonLoadingIcon.svelte +2 -1
  9. package/dist/components/FieldCardCheckbox.svelte +328 -0
  10. package/dist/components/FieldCardRadio.svelte +320 -0
  11. package/dist/components/IntroPanel.svelte +41 -0
  12. package/dist/components/PeriodPanel.svelte +100 -0
  13. package/dist/components/QuestionnairePrompt.svelte +36 -0
  14. package/dist/components/RenderDisplayComponent.svelte +38 -0
  15. package/dist/components/ReviewerList.svelte +93 -0
  16. package/dist/components/StatusMessageList.svelte +35 -0
  17. package/dist/components/WarningIconYellow.svelte +20 -0
  18. package/dist/components/index.js +11 -0
  19. package/dist/components/types.js +1 -0
  20. package/dist/csv.js +21 -0
  21. package/dist/index.js +2 -0
  22. package/dist/status-utils.js +343 -0
  23. package/dist/stores/IStateStore.js +0 -1
  24. package/dist/typed-client/schema.graphql +564 -124
  25. package/dist/typed-client/schema.js +87 -23
  26. package/dist/typed-client/types.js +919 -454
  27. package/dist/util.js +12 -1
  28. package/package.json +39 -40
  29. package/dist/api.d.ts +0 -595
  30. package/dist/components/ButtonLoadingIcon.svelte.d.ts +0 -18
  31. package/dist/components/index.d.ts +0 -1
  32. package/dist/index.d.ts +0 -4
  33. package/dist/registry.d.ts +0 -138
  34. package/dist/stores/IStateStore.d.ts +0 -5
  35. package/dist/typed-client/index.d.ts +0 -25
  36. package/dist/typed-client/runtime/batcher.d.ts +0 -105
  37. package/dist/typed-client/runtime/createClient.d.ts +0 -17
  38. package/dist/typed-client/runtime/error.d.ts +0 -18
  39. package/dist/typed-client/runtime/fetcher.d.ts +0 -10
  40. package/dist/typed-client/runtime/generateGraphqlOperation.d.ts +0 -30
  41. package/dist/typed-client/runtime/index.d.ts +0 -11
  42. package/dist/typed-client/runtime/linkTypeMap.d.ts +0 -9
  43. package/dist/typed-client/runtime/typeSelection.d.ts +0 -28
  44. package/dist/typed-client/runtime/types.d.ts +0 -55
  45. package/dist/typed-client/schema.d.ts +0 -1483
  46. package/dist/typed-client/types.d.ts +0 -540
  47. package/dist/util.d.ts +0 -2
@@ -1 +1,12 @@
1
+ export { default as ApplicantProgramList } from './ApplicantProgramList.svelte';
2
+ export { default as ApplicantPromptPage } from './ApplicantPromptPage.svelte';
3
+ export { default as ApplicationDetailsView } from './ApplicationDetailsView.svelte';
4
+ export { default as AppRequestCard } from './AppRequestCard.svelte';
1
5
  export { default as ButtonLoadingIcon } from './ButtonLoadingIcon.svelte';
6
+ export { default as IntroPanel } from './IntroPanel.svelte';
7
+ export { default as PeriodPanel } from './PeriodPanel.svelte';
8
+ export { default as QuestionnairePrompt } from './QuestionnairePrompt.svelte';
9
+ export { default as RenderDisplayComponent } from './RenderDisplayComponent.svelte';
10
+ export { default as FieldCardRadio } from './FieldCardRadio.svelte';
11
+ export { default as FieldCardCheckbox } from './FieldCardCheckbox.svelte';
12
+ export * from './types.js';
@@ -0,0 +1 @@
1
+ export const phaseChangeMutations = ['submitAppRequest', 'returnToApplicant', 'completeReview', 'returnToReview', 'acceptOffer', 'returnToOffer', 'completeRequest', 'returnToNonBlocking'];
package/dist/csv.js ADDED
@@ -0,0 +1,21 @@
1
+ function convertJsonToCsv(jsonData) {
2
+ const headers = Object.keys(jsonData[0]);
3
+ let csvContent = headers.join(',') + '\n';
4
+ jsonData.forEach(item => {
5
+ const values = Object.values(item);
6
+ csvContent += values.join(',') + '\n';
7
+ });
8
+ return csvContent;
9
+ }
10
+ export function downloadCsv(data, title = 'App_Requests') {
11
+ const csvString = convertJsonToCsv(data);
12
+ const blob = new Blob([csvString], { type: 'text/csv;charset=utf-8,' });
13
+ const url = URL.createObjectURL(blob);
14
+ const link = document.createElement('a');
15
+ link.setAttribute('href', url);
16
+ link.setAttribute('download', title + '.csv');
17
+ document.body.appendChild(link);
18
+ link.click();
19
+ document.body.removeChild(link);
20
+ URL.revokeObjectURL(url);
21
+ }
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ export * from './registry.js';
1
2
  export * from './api.js';
2
3
  export * from './components/index.js';
3
4
  export * from './typed-client/index.js';
4
5
  export * from './util.js';
6
+ export * from './status-utils.js';
@@ -0,0 +1,343 @@
1
+ import { enumAppRequestStatus, enumRequirementType } from './typed-client/schema.js';
2
+ import { longNumericTime } from './util.js';
3
+ // ========================================
4
+ // === AppRequest Status ===
5
+ // ========================================
6
+ export const APP_REQUEST_STATUS_CONFIG = {
7
+ STARTED: {
8
+ label: 'In progress',
9
+ description: 'Application is in progress and has not been submitted.',
10
+ color: 'green',
11
+ waitingOn: 'Applicant',
12
+ buttonText: 'Edit Application',
13
+ actionType: 'navigate',
14
+ category: 'current',
15
+ navigation: {
16
+ label: 'Continue application',
17
+ href: (requestId) => `/requests/${requestId}/apply`
18
+ }
19
+ },
20
+ READY_TO_SUBMIT: {
21
+ label: 'In progress',
22
+ description: 'Application is complete and ready to submit.',
23
+ color: 'green',
24
+ waitingOn: 'Applicant',
25
+ buttonText: 'Edit Application',
26
+ actionType: 'navigate',
27
+ category: 'current',
28
+ navigation: {
29
+ label: 'Continue application',
30
+ href: (requestId) => `/requests/${requestId}/apply`
31
+ }
32
+ },
33
+ PREAPPROVAL: {
34
+ label: 'Review pending',
35
+ description: 'Application submitted and waiting for pre-approval requirements.',
36
+ color: 'blue',
37
+ waitingOn: 'System',
38
+ buttonText: 'Export Application',
39
+ actionType: 'export',
40
+ category: 'current'
41
+ },
42
+ APPROVAL: {
43
+ label: 'In review',
44
+ description: 'Application is being reviewed.',
45
+ color: 'blue',
46
+ waitingOn: 'Reviewer',
47
+ buttonText: 'Export Application',
48
+ actionType: 'export',
49
+ category: 'current'
50
+ },
51
+ ACCEPTANCE: {
52
+ label: 'Offer pending',
53
+ description: 'Waiting for you to respond to the offer.',
54
+ color: 'teal',
55
+ waitingOn: 'Applicant',
56
+ buttonText: 'Review Offer',
57
+ actionType: 'navigate',
58
+ category: 'current',
59
+ navigation: {
60
+ label: 'Review Offer',
61
+ href: (requestId) => `/requests/${requestId}/accept`
62
+ }
63
+ },
64
+ ACCEPTED: {
65
+ label: 'Offer accepted',
66
+ description: 'You have accepted an offer.',
67
+ color: 'green',
68
+ waitingOn: 'No one, complete',
69
+ buttonText: 'Download Offer',
70
+ actionType: 'download',
71
+ category: 'past'
72
+ },
73
+ READY_TO_ACCEPT: {
74
+ label: 'Offer pending',
75
+ description: 'You have been offered and can now accept.',
76
+ color: 'teal',
77
+ waitingOn: 'Applicant',
78
+ buttonText: 'Review Offer',
79
+ actionType: 'navigate',
80
+ category: 'current',
81
+ navigation: {
82
+ label: 'Review Offer',
83
+ href: (requestId) => `/requests/${requestId}/accept`
84
+ }
85
+ },
86
+ REVIEW_COMPLETE: {
87
+ label: 'In review',
88
+ description: 'Your application is being reviewed.',
89
+ color: 'blue',
90
+ waitingOn: 'Reviewer',
91
+ buttonText: 'Export Application',
92
+ actionType: 'export',
93
+ category: 'current'
94
+ },
95
+ APPROVED: {
96
+ label: 'Approved',
97
+ description: 'Your application has been approved.',
98
+ color: 'green',
99
+ waitingOn: 'No one, complete',
100
+ buttonText: '',
101
+ actionType: 'none',
102
+ category: 'past'
103
+ },
104
+ NOT_APPROVED: {
105
+ label: 'Ineligible',
106
+ description: 'Your application was not approved.',
107
+ color: 'red',
108
+ waitingOn: 'No one, complete',
109
+ buttonText: '',
110
+ actionType: 'none',
111
+ category: 'past'
112
+ },
113
+ NOT_ACCEPTED: {
114
+ label: 'Offer declined',
115
+ description: 'The offer was not accepted.',
116
+ color: 'gray',
117
+ waitingOn: 'No one, complete',
118
+ buttonText: '',
119
+ actionType: 'none',
120
+ category: 'past'
121
+ },
122
+ CANCELLED: {
123
+ label: 'Cancelled',
124
+ description: 'Application was cancelled before submission.',
125
+ color: 'gray',
126
+ waitingOn: 'No one, complete',
127
+ buttonText: '',
128
+ actionType: 'none',
129
+ category: 'past'
130
+ },
131
+ WITHDRAWN: {
132
+ label: 'Withdrawn',
133
+ description: 'Application was withdrawn after submission.',
134
+ color: 'gray',
135
+ waitingOn: 'No one, complete',
136
+ buttonText: '',
137
+ actionType: 'none',
138
+ category: 'past'
139
+ },
140
+ DISQUALIFIED: {
141
+ label: 'Ineligible',
142
+ description: 'All applications have been disqualified.',
143
+ color: 'red',
144
+ waitingOn: 'Applicant',
145
+ buttonText: '',
146
+ actionType: 'none',
147
+ category: 'past'
148
+ }
149
+ };
150
+ export const REVIEWER_STATUS_CONFIG = {
151
+ STARTED: {
152
+ label: 'In progress',
153
+ description: 'Application is in progress and has not been submitted.',
154
+ color: 'green'
155
+ },
156
+ READY_TO_SUBMIT: {
157
+ label: 'In progress',
158
+ description: 'Application is complete and ready to submit.',
159
+ color: 'green'
160
+ },
161
+ PREAPPROVAL: {
162
+ label: 'Review pending',
163
+ description: 'Application submitted and waiting for pre-approval requirements.',
164
+ color: 'blue'
165
+ },
166
+ APPROVAL: {
167
+ label: 'In review',
168
+ description: 'Application is being reviewed.',
169
+ color: 'blue'
170
+ },
171
+ ACCEPTANCE: {
172
+ label: 'Offer pending',
173
+ description: 'Waiting for you to respond to the offer.',
174
+ color: 'teal'
175
+ },
176
+ ACCEPTED: {
177
+ label: 'Offer accepted',
178
+ description: 'You have accepted an offer.',
179
+ color: 'green'
180
+ },
181
+ READY_TO_ACCEPT: {
182
+ label: 'Offer pending',
183
+ description: 'You have been offered and can now accept.',
184
+ color: 'teal'
185
+ },
186
+ REVIEW_COMPLETE: {
187
+ label: 'Ready to release',
188
+ description: 'Review is ready to be released to the applicant.',
189
+ color: 'blue'
190
+ },
191
+ APPROVED: {
192
+ label: 'Approved',
193
+ description: 'Your application has been approved.',
194
+ color: 'green'
195
+ },
196
+ NOT_APPROVED: {
197
+ label: 'Ineligible',
198
+ description: 'Your application was not approved.',
199
+ color: 'red'
200
+ },
201
+ NOT_ACCEPTED: {
202
+ label: 'Offer declined',
203
+ description: 'The offer was not accepted.',
204
+ color: 'gray'
205
+ },
206
+ CANCELLED: {
207
+ label: 'Cancelled',
208
+ description: 'Application was cancelled before submission.',
209
+ color: 'gray'
210
+ },
211
+ WITHDRAWN: {
212
+ label: 'Withdrawn',
213
+ description: 'Application was withdrawn after submission.',
214
+ color: 'gray'
215
+ },
216
+ DISQUALIFIED: {
217
+ label: 'Ineligible',
218
+ description: 'All applications have been disqualified.',
219
+ color: 'red'
220
+ }
221
+ };
222
+ // Get complete AppRequest status information
223
+ export function getAppRequestStatusInfo(status) {
224
+ return APP_REQUEST_STATUS_CONFIG[status] ?? {
225
+ label: status,
226
+ description: 'Status pending.',
227
+ color: 'gray',
228
+ waitingOn: 'No one, complete',
229
+ buttonText: '',
230
+ actionType: 'none',
231
+ category: 'past'
232
+ };
233
+ }
234
+ // Extract status categories
235
+ export function getCurrentStatuses() {
236
+ return Object.keys(APP_REQUEST_STATUS_CONFIG).filter(status => APP_REQUEST_STATUS_CONFIG[status].category === 'current');
237
+ }
238
+ export function getPastStatuses() {
239
+ return Object.keys(APP_REQUEST_STATUS_CONFIG).filter(status => APP_REQUEST_STATUS_CONFIG[status].category === 'past');
240
+ }
241
+ // Helper for navigation buttons
242
+ export function getNavigationButton(status, requestId) {
243
+ const navigation = APP_REQUEST_STATUS_CONFIG[status]?.navigation;
244
+ if (!navigation)
245
+ return null;
246
+ return {
247
+ label: navigation.label,
248
+ href: navigation.href(requestId)
249
+ };
250
+ }
251
+ // Helper functions for status actions
252
+ export function getSubmitButtonText(status) {
253
+ return APP_REQUEST_STATUS_CONFIG[status].buttonText;
254
+ }
255
+ export function getStatusActionType(status) {
256
+ return APP_REQUEST_STATUS_CONFIG[status].actionType;
257
+ }
258
+ // ========================================
259
+ // === Application Status ===
260
+ // ========================================
261
+ // Map ApplicationStatus enum to display info
262
+ export function getApplicationStatusInfo(status) {
263
+ const statusMap = {
264
+ ACCEPTED: {
265
+ label: 'Offer accepted',
266
+ description: 'Offer accepted and all requirements met.',
267
+ color: 'green'
268
+ },
269
+ ELIGIBLE: {
270
+ label: 'Eligible',
271
+ description: 'All requirements met, acceptance pending.',
272
+ color: 'green'
273
+ },
274
+ INELIGIBLE: {
275
+ label: 'Ineligible',
276
+ description: 'One or more requirements not met.',
277
+ color: 'red'
278
+ },
279
+ PENDING: {
280
+ label: 'In progress',
281
+ description: 'Awaiting further information.',
282
+ color: 'purple'
283
+ },
284
+ REJECTED: {
285
+ label: 'Offer declined',
286
+ description: 'Offer rejected or requirements not met.',
287
+ color: 'gray'
288
+ }
289
+ };
290
+ return statusMap[status] ?? { label: status, description: 'Unknown status.', color: 'gray' };
291
+ }
292
+ export const applicantStatuses = new Set([
293
+ enumAppRequestStatus.STARTED,
294
+ enumAppRequestStatus.READY_TO_SUBMIT
295
+ ]);
296
+ export const submissionRequirementTypes = new Set([
297
+ enumRequirementType.PREQUAL,
298
+ enumRequirementType.QUALIFICATION,
299
+ enumRequirementType.POSTQUAL
300
+ ]);
301
+ export const applicantRequirementTypes = new Set([
302
+ enumRequirementType.PREQUAL,
303
+ enumRequirementType.POSTQUAL,
304
+ enumRequirementType.QUALIFICATION,
305
+ enumRequirementType.ACCEPTANCE
306
+ ]);
307
+ export const reviewRequirementTypes = new Set([
308
+ enumRequirementType.APPROVAL,
309
+ enumRequirementType.PREAPPROVAL
310
+ ]);
311
+ export const reviewerRequirementTypes = new Set([
312
+ enumRequirementType.APPROVAL,
313
+ enumRequirementType.PREAPPROVAL,
314
+ enumRequirementType.WORKFLOW
315
+ ]);
316
+ // ========================================
317
+ // === Periods ===
318
+ // ========================================
319
+ const noClosePeriodDate = '9999-12-031T23:59:59.000-06:00';
320
+ export function getPeriodStatus(period) {
321
+ if (!period.openDate)
322
+ return 'unknown';
323
+ const now = new Date();
324
+ const openDate = new Date(period.openDate);
325
+ const closeDate = (!period.closeDate) ? new Date(noClosePeriodDate) : new Date(period.closeDate);
326
+ if (now < openDate)
327
+ return 'upcoming';
328
+ if (now > closeDate)
329
+ return 'closed';
330
+ return 'open';
331
+ }
332
+ export function getPeriodDisplayInfo(period) {
333
+ const status = getPeriodStatus(period);
334
+ return {
335
+ status,
336
+ openLabel: status === 'closed' ? 'TBD' : longNumericTime(period.openDate),
337
+ openDateMachineFormat: period.openDate,
338
+ closeLabel: status === 'closed' ? 'Application closed' : 'Application closes',
339
+ closeDate: (!period.closeDate) ? longNumericTime(noClosePeriodDate) : longNumericTime(period.closeDate),
340
+ closeDateMachineFormat: period.closeDate ?? new Date(noClosePeriodDate),
341
+ canStartNew: status === 'open' && period.reviewed === true
342
+ };
343
+ }
@@ -1 +0,0 @@
1
- "use strict";