udp-stencil-component-library 25.18.2-beta.7 → 25.18.2-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil-library.cjs.js +1 -1
- package/dist/cjs/udp-forms-renderer.cjs.entry.js +591 -603
- package/dist/cjs/udp-forms-renderer.entry.cjs.js.map +1 -1
- package/dist/cjs/udp-forms-ui.cjs.entry.js +1 -4
- package/dist/cjs/udp-forms-ui.entry.cjs.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.js +1 -4
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-ui/udp-forms-ui.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.js +153 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.js +104 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/{udp-forms-renderer-utils.js → udp-forms-renderer-utils/utils.js} +48 -2
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/utils.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.js +187 -310
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.js +13 -13
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.js +142 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.js.map +1 -0
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.js +3 -10
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/IFormSubmissionHandler.js.map +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/types.js.map +1 -1
- package/dist/components/udp-forms-renderer.js +593 -608
- package/dist/components/udp-forms-renderer.js.map +1 -1
- package/dist/components/udp-forms-ui2.js +1 -4
- package/dist/components/udp-forms-ui2.js.map +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil-library.js +1 -1
- package/dist/esm/udp-forms-renderer.entry.js +592 -604
- package/dist/esm/udp-forms-renderer.entry.js.map +1 -1
- package/dist/esm/udp-forms-ui.entry.js +1 -4
- package/dist/esm/udp-forms-ui.entry.js.map +1 -1
- package/dist/stencil-library/stencil-library.esm.js +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.esm.js.map +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.js +1 -1
- package/dist/stencil-library/udp-forms-renderer.entry.js.map +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.esm.js.map +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.js +1 -1
- package/dist/stencil-library/udp-forms-ui.entry.js.map +1 -1
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/comments-crud-utils.d.ts +31 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils/repeated-section-utils.d.ts +17 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/{udp-forms-renderer-utils.d.ts → udp-forms-renderer-utils/utils.d.ts} +4 -0
- package/dist/types/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer.d.ts +6 -10
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.d.ts +5 -6
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandler.d.ts +42 -0
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/FormSubmissionHandlerFactory.d.ts +1 -1
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/IFormSubmissionHandler.d.ts +44 -5
- package/dist/types/components/forms/udp-forms/udp-forms-utils/types.d.ts +16 -0
- package/package.json +1 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils.js.map +0 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.js +0 -264
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.js.map +0 -1
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.js +0 -63
- package/dist/collection/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.js.map +0 -1
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PrivateFormSubmissionHandler.d.ts +0 -131
- package/dist/types/components/forms/udp-forms/udp-forms-utils/form-submission-handler/PublicFormSubmissionHandler.d.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInstance","createEvent","h","getElement","UdpFormsSubmissionStatusEnum","UdpFormsFieldTypeEnum","fontOverrideMapping","overrideFont","getIconFromName","udpFormsUiCss","UdpFormsUi","constructor","hostRef","this","formDirtyChange","currentValues","submitSuccessful","isLoading","isSaving","saveErrorMessage","showAutoSaveStatus","disabled","readonly","clientUserInfo","id","displayName","email","isSubmitted","isShowManualSaveIcon","showSavedMessage","isDialogOpen","dialogMessage","titleId","descriptionId","componentDidLoad","overrideStyles","componentDidUpdate","disconnectedCallback","savedMessageTimeoutId","clearTimeout","watchIsSaving","newValue","oldValue","
|
|
1
|
+
{"version":3,"names":["registerInstance","createEvent","h","getElement","UdpFormsSubmissionStatusEnum","UdpFormsFieldTypeEnum","fontOverrideMapping","overrideFont","getIconFromName","udpFormsUiCss","UdpFormsUi","constructor","hostRef","this","formDirtyChange","currentValues","submitSuccessful","isLoading","isSaving","saveErrorMessage","showAutoSaveStatus","disabled","readonly","clientUserInfo","id","displayName","email","isSubmitted","isShowManualSaveIcon","showSavedMessage","isDialogOpen","dialogMessage","titleId","descriptionId","componentDidLoad","overrideStyles","componentDidUpdate","disconnectedCallback","savedMessageTimeoutId","clearTimeout","watchIsSaving","newValue","oldValue","setTimeout","_a","shadowRoot","el","querySelectorAll","forEach","element","_b","_c","_d","styleOverride","udpForm","styleOverrides","titleText","paragraphText","fontFamily","variant","setAttribute","isSectionContainsFollowUpFormLink","sectionKey","sectionObject","udpFormSubmission","data","submissionResponseData","_key","questionObject","Object","entries","metadata","followUpFormSubmissionId","render","_e","_f","_g","_h","_j","_k","_l","_m","_o","_p","_q","_r","class","questionNumber","sectionSet","Set","formQuestions","fq","add","section","hiddenQuestionTypes","Hidden","Paragraph","backgroundOverrides","background","backgroundImage","backgroundColor","style","maxWidth","handleSubmit","initialValues","handleChange","onDirtyChange","event","emit","detail","open","message","labelOne","labelTwo","actionOne","dialogAction","actionTwo","assign","headerBackgroundColor","color","name","isVisible","handleSave","description","dynamicSections","map","sIndex","title","sectionPositionSuffix","sectionProperties","isRepeatable","filter","s","length","icon","tooltip","onClick","duplicateRepeatableSection","isOriginalSection","async","deleteRepeatableSection","performBackgroundSaveAndUpdateLocalSubmissionState","sectionText","question","isHidden","includes","fieldTypeId","num","helperText","questionText","value","key","questionIdentifierKey","status","Submitted","type","watchers"],"sources":["0"],"mappings":"YAAcA,OAAuBC,OAAaC,OAAQC,MAAkB,kCAC9DC,OAAmCC,MAA6B,kCAChEC,OAA0BC,MAAoB,kCAC9CC,MAAuB,gCAC9B,kCACA,gCACA,gCACA,qCACA,wCACA,+CACA,uCACA,sCACA,gCACA,kCACA,kCACA,kCACA,0CACA,2CACA,sCACA,sCACA,sCACA,0CACA,2CACA,0CACA,4CACA,qCACA,0CACA,iDACA,0CACA,4CACA,4CACA,sCACA,iCACA,mCACA,iCACA,wCACA,wCACA,iCACA,oDACA,oDACA,mCACA,iCACA,qCACA,qCACA,0CACA,6CACA,sCACA,iCACA,iCACA,oCACA,oCACA,yCACA,yCACA,oCACA,sCACA,sCACA,wCACA,yCACA,wCACA,iCACA,iCACA,uCACA,yCACA,6CACA,kCACA,mCACA,2CACA,sDACA,mCACA,6CACA,uCACA,iDACA,oDACA,8CACA,kDACA,4CACA,sCACA,iCACA,qCACA,0CACA,2CACA,0CACA,mCACA,kCACA,qCACA,iCACA,kCACA,+CACA,yCACA,sDACA,qCACA,gCACA,kCACA,gCACA,0BAEP,MAAMC,EAAgB,q4EAEtB,MAAMC,EAAa,MACf,WAAAC,CAAYC,GACRZ,EAAiBa,KAAMD,GACvBC,KAAKC,gBAAkBb,EAAYY,KAAM,mBACzCA,KAAKE,cAAgB,CAAC,EACtBF,KAAKG,iBAAmB,MACxBH,KAAKI,UAAY,MACjBJ,KAAKK,SAAW,MAChBL,KAAKM,iBAAmB,KACxBN,KAAKO,mBAAqB,MAC1BP,KAAKQ,SAAW,MAChBR,KAAKS,SAAW,MAChBT,KAAKU,eAAiB,CAClBC,GAAI,KACJC,YAAa,KACbC,MAAO,MAEXb,KAAKc,YAAc,MACnBd,KAAKe,qBAAuB,MAC5Bf,KAAKgB,iBAAmB,MACxBhB,KAAKiB,aAAe,MACpBjB,KAAKkB,cAAgB,qIACrBlB,KAAKmB,QAAU,kBACfnB,KAAKoB,cAAgB,uBACzB,CACA,gBAAAC,GACIrB,KAAKsB,gBACT,CACA,kBAAAC,GACIvB,KAAKsB,gBACT,CACA,oBAAAE,GAEI,GAAIxB,KAAKyB,sBAAuB,CAC5BC,aAAa1B,KAAKyB,sBACtB,CACJ,CACA,aAAAE,CAAcC,EAAU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UT,KAAKS,SAAUiI,IAAKR,EAASS,sBAAuBzI,cAAeF,KAAKE,cAAeQ,eAAgBV,KAAKU,eAAgByC,kBAAmBnD,KAAKmD,oBAAsB,YAEnfqB,EAAKxE,KAAKmD,qBAAuB,MAAQqB,SAAY,OAAS,EAAIA,EAAGoE,SAAWrJ,EAA6BsJ,WAAcxJ,EAAE,MAAO,CAAEoF,MAAO,UAAYpF,EAAE,QAAS,CAAEmB,SAAUR,KAAKI,WAAaJ,KAAKQ,UAAYR,KAAKS,SAAUqI,KAAM,SAAUL,MAAO,SAAUhE,MAAO,SAAU9D,GAAI,sCAAuCgH,QAAS,YAK9UtI,EAAE,MAAO,CAAEoF,MAAO,cAAgBpF,EAAE,mBAAoB,KAAMA,EAAE,MAAO,CAAEoF,MAAO,eAAiBpF,EAAE,mBAAoB,KAAM,uCACjI,CACA,MAAI4C,GAAO,OAAO3C,EAAWU,KAAO,CACpC,mBAAW+I,GAAa,MAAO,CAC3B1I,SAAY,CAAC,iBACd,GAEPR,EAAW2F,MAAQ5F,SAEVC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type QuestionCommentActionType = 'add' | 'save' | 'edit' | 'delete' | 'editClose';
|
|
2
|
+
export type QuestionIdentifierKey = string;
|
|
3
|
+
export interface CommentUserInfo {
|
|
4
|
+
id: string | null;
|
|
5
|
+
displayName: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface ApplyCommentCrudParams {
|
|
8
|
+
actionType: QuestionCommentActionType;
|
|
9
|
+
questionIdentifierKey: QuestionIdentifierKey;
|
|
10
|
+
commentId: string;
|
|
11
|
+
currentSubmissionResponseData: Record<string, any>;
|
|
12
|
+
clientUserInfo: CommentUserInfo;
|
|
13
|
+
}
|
|
14
|
+
export interface ApplyCommentCrudResult {
|
|
15
|
+
sectionKey: string;
|
|
16
|
+
questionKey: string;
|
|
17
|
+
nextSubmissionResponseData: Record<string, any>;
|
|
18
|
+
didMutate: boolean;
|
|
19
|
+
shouldPersist: boolean;
|
|
20
|
+
persistIntent: 'public-add' | 'private-update' | 'none';
|
|
21
|
+
commentId: string;
|
|
22
|
+
valueToPersist?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Pure comment CRUD logic.
|
|
26
|
+
*
|
|
27
|
+
* - Updates submissionResponseData structure for comments/draftComments.
|
|
28
|
+
* - Does NOT perform any network calls.
|
|
29
|
+
* - Returns persistence intent for caller.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyQuestionCommentCrud(params: ApplyCommentCrudParams): ApplyCommentCrudResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DynamicSection, SubmissionResponseData } from '../../udp-forms-utils/types';
|
|
2
|
+
export declare const computeDuplicateRepeatableSection: (params: {
|
|
3
|
+
dynamicSections: DynamicSection[];
|
|
4
|
+
values: SubmissionResponseData;
|
|
5
|
+
index: number;
|
|
6
|
+
}) => {
|
|
7
|
+
nextDynamicSections: DynamicSection[];
|
|
8
|
+
nextValues: SubmissionResponseData;
|
|
9
|
+
};
|
|
10
|
+
export declare const computeDeleteRepeatableSection: (params: {
|
|
11
|
+
dynamicSections: DynamicSection[];
|
|
12
|
+
values: SubmissionResponseData;
|
|
13
|
+
index: number;
|
|
14
|
+
}) => {
|
|
15
|
+
nextDynamicSections: DynamicSection[];
|
|
16
|
+
nextValues: SubmissionResponseData;
|
|
17
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Guid } from '../../udp-forms-utils/types';
|
|
1
2
|
export declare const findRepeatGroupKeys: (sectionName: string, values: Object) => number[];
|
|
2
3
|
export declare const initializeDynamicSections: (udpForm: any, currentValues: any) => any[];
|
|
3
4
|
export declare const getMaxRepeatSuffixBySectionFromUrlContext: (urlContext: Record<string, any> | undefined | null) => Record<string, number>;
|
|
@@ -10,3 +11,6 @@ export declare const applyUrlSeedValuesForAll: (dynamicSections: any, urlContext
|
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
};
|
|
14
|
+
export declare const replaceUrlWithSubmissionId: (submissionId: Guid, history: any) => void;
|
|
15
|
+
export declare const enqueueSnackbarSuccess: (message: string, enqueueSnackbar: Function) => void;
|
|
16
|
+
export declare const enqueueSnackbarError: (message: string, enqueueSnackbar: Function) => void;
|
|
@@ -16,19 +16,14 @@ export declare class UdpFormsRenderer {
|
|
|
16
16
|
currentValues: {
|
|
17
17
|
[name: string]: any;
|
|
18
18
|
};
|
|
19
|
-
formInputSeedValues: {
|
|
20
|
-
[name: string]: any;
|
|
21
|
-
};
|
|
22
19
|
submitSuccessful: boolean;
|
|
23
20
|
isLoading: boolean;
|
|
24
21
|
isSaving: boolean;
|
|
25
22
|
isSubmitted: boolean;
|
|
26
|
-
saveErrorMessage: string | null;
|
|
27
23
|
dynamicSections: any[];
|
|
28
24
|
isUpdatingSections: boolean;
|
|
29
25
|
reRenderKey: number;
|
|
30
|
-
|
|
31
|
-
isUserUpdatedSections: boolean;
|
|
26
|
+
hasUnsavedChanges: boolean;
|
|
32
27
|
sideSheetFollowUpFormsList: any[];
|
|
33
28
|
followUpSideSheetTotalItems: number;
|
|
34
29
|
isFollowUpFormsSideSheetOpen: boolean;
|
|
@@ -44,6 +39,7 @@ export declare class UdpFormsRenderer {
|
|
|
44
39
|
private formSubmissionHandler;
|
|
45
40
|
private followUpParentSectionKey;
|
|
46
41
|
private followUpParentQuestionKey;
|
|
42
|
+
private readonly publicFeatures;
|
|
47
43
|
componentDidLoad(): void;
|
|
48
44
|
private handleLaunchFollowUpFormSideSheet;
|
|
49
45
|
componentWillLoad(): Promise<void>;
|
|
@@ -60,13 +56,13 @@ export declare class UdpFormsRenderer {
|
|
|
60
56
|
* Auto save (background save)
|
|
61
57
|
*/
|
|
62
58
|
private performBackgroundSaveAndUpdateLocalSubmissionState;
|
|
63
|
-
private
|
|
59
|
+
private performBackgroundSaveAndUpdateLocalSubmissionStateInternal;
|
|
60
|
+
private refreshSubmissionAndSyncState;
|
|
64
61
|
/**
|
|
65
|
-
* Handle the user saving or deleting a comment
|
|
62
|
+
* Handle the user saving or deleting a comment (pre-submit, private forms only)
|
|
66
63
|
*/
|
|
67
|
-
private handleCommmentUpdate;
|
|
68
64
|
/**
|
|
69
|
-
* Manual save function - debounced to 5 seconds
|
|
65
|
+
* Manual save function - debounced to 5 seconds (private forms only)
|
|
70
66
|
*/
|
|
71
67
|
private handleManualSave;
|
|
72
68
|
private handleQuestionCommentLiveCRUD;
|
package/dist/types/components/forms/udp-forms/udp-forms-utils/form-handler/UdpFormHandler.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Guid } from '../types';
|
|
2
2
|
import { UdpForm } from '../classes/UdpForm';
|
|
3
|
-
/**
|
|
4
|
-
* UDP Form handler (new UdpFormSubmission endpoint)
|
|
5
|
-
*/
|
|
6
3
|
export declare class UdpFormHandler {
|
|
7
4
|
tenantId?: Guid;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
isPublic: boolean;
|
|
6
|
+
constructor(tenantId?: Guid, isPublic?: boolean);
|
|
7
|
+
private buildDescribeUrl;
|
|
8
|
+
getFormByFormIdAndFormVersion(formId: Guid, formVersion: number): Promise<UdpForm>;
|
|
11
9
|
}
|
|
10
|
+
export declare const createUdpFormHandler: (isPublic?: boolean, tenantId?: Guid) => UdpFormHandler;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { UdpFormSubmission } from '../classes/UdpFormSubmission';
|
|
2
|
+
import { IFormSubmissionHandler } from './IFormSubmissionHandler';
|
|
3
|
+
export type UdpFormSubmissionAccessMode = 'public' | 'private';
|
|
4
|
+
/**
|
|
5
|
+
* Single handler for UdpFormSubmission operations.
|
|
6
|
+
*
|
|
7
|
+
* Behavior changes by access mode:
|
|
8
|
+
* - private: supports draft save and follow-ups; comments are saved via standard draft-save until submitted,
|
|
9
|
+
* and via dedicated comment endpoints when submitted or viewed by a non-owner.
|
|
10
|
+
* - public : no draft save, no follow-ups; submit uses the `/UdpFormSubmission/public` endpoint;
|
|
11
|
+
* comments use dedicated comment endpoints once a submission exists.
|
|
12
|
+
*/
|
|
13
|
+
export declare class FormSubmissionHandler implements IFormSubmissionHandler {
|
|
14
|
+
private readonly accessMode;
|
|
15
|
+
constructor(accessMode: UdpFormSubmissionAccessMode);
|
|
16
|
+
addComment(udpFormSubmission: UdpFormSubmission, comment: {
|
|
17
|
+
sectionKey: string;
|
|
18
|
+
questionKey: string;
|
|
19
|
+
value: string;
|
|
20
|
+
commentId?: string;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
updateComment(udpFormSubmission: UdpFormSubmission, args: {
|
|
23
|
+
sectionKey: string;
|
|
24
|
+
questionKey: string;
|
|
25
|
+
commentId: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
deleteComment(udpFormSubmission: UdpFormSubmission, args: {
|
|
29
|
+
sectionKey: string;
|
|
30
|
+
questionKey: string;
|
|
31
|
+
commentId: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
34
|
+
createNewLinkedFollowUpFormSubmission(udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
35
|
+
saveCurrentFormSubmissionState(values: Record<string, any>, udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
36
|
+
finalizeFormSubmissionState(values: Record<string, any>, udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
37
|
+
private saveFormDataWithoutValues;
|
|
38
|
+
private getApiRequestInfo;
|
|
39
|
+
private saveSubmissionToDB;
|
|
40
|
+
private getFormSubmissionById;
|
|
41
|
+
private getFormSubmissionByIdAndUser;
|
|
42
|
+
}
|
|
@@ -4,5 +4,5 @@ import { Guid } from '../types';
|
|
|
4
4
|
* Factory for creating form submission handlers.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FormSubmissionHandlerFactory {
|
|
7
|
-
static create(isPublic: boolean, userId?: Guid | null
|
|
7
|
+
static create(isPublic: boolean, userId?: Guid | null): IFormSubmissionHandler;
|
|
8
8
|
}
|
|
@@ -3,13 +3,52 @@ import { UdpFormSubmission } from '../classes/UdpFormSubmission';
|
|
|
3
3
|
* Interface for form submission handlers (public/private).
|
|
4
4
|
*/
|
|
5
5
|
export interface IFormSubmissionHandler {
|
|
6
|
+
/**
|
|
7
|
+
* Given a partially-populated `UdpFormSubmission` (must include `id`), fetch the latest submission from the server
|
|
8
|
+
* and return a hydrated `UdpFormSubmission`.
|
|
9
|
+
*/
|
|
6
10
|
fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Submit/finalize the form.
|
|
13
|
+
* - private: POST/PUT to `/UdpFormSubmission/private`
|
|
14
|
+
* - public : POST to `/UdpFormSubmission/public`
|
|
15
|
+
* Returns the saved submission (callers should use the return value or rely on handler mutating the passed instance).
|
|
16
|
+
*/
|
|
8
17
|
finalizeFormSubmissionState(values: Record<string, any>, udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
9
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Save draft/in-progress state.
|
|
20
|
+
* - private: POST/PUT to `/UdpFormSubmission/private`
|
|
21
|
+
* - public : no-op (public draft saves are disabled)
|
|
22
|
+
* Returns the saved submission (callers should use the return value or rely on handler mutating the passed instance).
|
|
23
|
+
*/
|
|
10
24
|
saveCurrentFormSubmissionState(values: Record<string, any>, udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Create a new follow-up submission and link it to a parent submission.
|
|
27
|
+
* private only.
|
|
28
|
+
*/
|
|
14
29
|
createNewLinkedFollowUpFormSubmission(udpFormSubmission: UdpFormSubmission): Promise<UdpFormSubmission>;
|
|
30
|
+
/**
|
|
31
|
+
* Append a single question comment to an existing submission.
|
|
32
|
+
* Intended for submitted forms to avoid PUT-ing the entire submission.
|
|
33
|
+
* Used by both public and private forms, but only for adding new comments. Does not mutate any form data values.
|
|
34
|
+
*/
|
|
35
|
+
addComment(udpFormSubmission: UdpFormSubmission, comment: {
|
|
36
|
+
sectionKey: string;
|
|
37
|
+
questionKey: string;
|
|
38
|
+
value: string;
|
|
39
|
+
commentId?: string;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
/** Update a previously-saved comment's value. */
|
|
42
|
+
updateComment(udpFormSubmission: UdpFormSubmission, args: {
|
|
43
|
+
sectionKey: string;
|
|
44
|
+
questionKey: string;
|
|
45
|
+
commentId: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
/** Soft-delete a previously-saved comment. */
|
|
49
|
+
deleteComment(udpFormSubmission: UdpFormSubmission, args: {
|
|
50
|
+
sectionKey: string;
|
|
51
|
+
questionKey: string;
|
|
52
|
+
commentId: string;
|
|
53
|
+
}): Promise<void>;
|
|
15
54
|
}
|
|
@@ -75,3 +75,19 @@ export interface UdpFormMetadata {
|
|
|
75
75
|
styleOverrides: object;
|
|
76
76
|
id: Guid;
|
|
77
77
|
}
|
|
78
|
+
export type SubmissionResponseData = Record<string, Record<string, {
|
|
79
|
+
value: any;
|
|
80
|
+
comments?: any[];
|
|
81
|
+
metadata?: Record<string, any>;
|
|
82
|
+
}>>;
|
|
83
|
+
export type DynamicSection = {
|
|
84
|
+
name: string;
|
|
85
|
+
isOriginalSection: boolean;
|
|
86
|
+
sectionPositionSuffix?: number;
|
|
87
|
+
formQuestions: Array<{
|
|
88
|
+
name: string;
|
|
89
|
+
fieldTypeId?: number;
|
|
90
|
+
fieldProperties?: any;
|
|
91
|
+
questionIdentifierKey?: string;
|
|
92
|
+
}>;
|
|
93
|
+
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"udp-forms-renderer-utils.js","sourceRoot":"","sources":["../../../../../src/components/forms/udp-forms/udp-forms-renderer/udp-forms-renderer-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAE,MAAc,EAAY,EAAE;IACnF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IAEzC,uBAAuB;IACvB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,WAAW,SAAS,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACjB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACtB,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC;AAGF,kDAAkD;AAClD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE;;IAClE,MAAM,eAAe,GAAU,EAAE,CAAC;IAClC,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,IAAI,CACxE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAC5B,CAAC;IAEF,KAAK,MAAM,O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AAC;gBACvE,IAAI,SAAS,EAAE,CAAC;oBACd,IAAI,UAAU,GAAQ,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,eAAe,CAAC;oBACzC,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;wBACnC,IAAI,CAAC;4BACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC;wBAC9C,CAAC;wBAAC,WAAM,CAAC;4BACP,UAAU,GAAG,EAAE,CAAC;wBAClB,CAAC;oBACH,CAAC;oBACD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG;wBAC3B,KAAK,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,mCAAI,EAAE;wBACtC,QAAQ,EAAE,EAAE;qBACb,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { UdpFormsFieldTypeEnum } from '../udp-forms-utils/enums';\n\n// utility to find repeat group keys from current values\nexport const findRepeatGroupKeys = (sectionName: string, values: Object): number[] => {\n const keys = Object.keys(values);\n const repeatGroupSet = new Set<number>();\n\n // Match: sectionName_2\n const regex = new RegExp(`^${sectionName}_(\\\\d+)`);\n\n keys.forEach(key => {\n const match = key.match(regex);\n if (match && match[1]) {\n repeatGroupSet.add(Number(match[1]));\n }\n });\n\n return Array.from(repeatGroupSet).sort((a, b) => a - b);\n};\n\n\n// build dynamic sections based on the master form\nexport const initializeDynamicSections = (udpForm, currentValues) => {\n const dynamicSections: any[] = [];\n const sortedSections = structuredClone(udpForm.udpFormUdpFormSection).sort(\n (a, b) => a.order - b.order,\n );\n\n for (const section of sortedSections) {\n section.sectionProperties = JSON.parse(section.sectionProperties || {});\n const repeatGroupKeys = findRepeatGroupKeys(section.name, currentValues);\n section.isOriginalSection = true;\n section.sectionPositionSuffix = 1; // default position\n\n // always add the original section into dynamic sections\n dynamicSections.push({\n ...structuredClone(section),\n // dynamicSectionName: section.name,\n formQuestions: structuredClone(udpForm.formQuestions)\n .filter(q => q.formSectionId === section.id)\n .sort((a, b) => a.questionOrder - b.questionOrder)\n .map(q => ({\n ...q,\n questionIdentifierKey: `${section.name}.${q.name}`,\n isShowCommentInput: true,\n })),\n });\n\n // create then add additional sections if there are repeated sections\n if (section.sectionProperties?.isRepeatable && repeatGroupKeys.length > 0) {\n const maxRepeatedSectionSuffix = Math.max(...repeatGroupKeys); // create a new section for the max value of repeat group keys, even if there are no saved answers\n\n // for (const repeatKey of repeatGroupKeys) { // create a section only for the suffix saved\n for (let repeatKey = 2; repeatKey <= maxRepeatedSectionSuffix; repeatKey++) {\n const clonedSection = {\n ...structuredClone(section),\n formQuestions: structuredClone(udpForm.formQuestions)\n .filter(q => q.formSectionId === section.id)\n .sort((a, b) => a.questionOrder - b.questionOrder)\n .map(q => ({\n ...q,\n questionIdentifierKey: `${section.name}_${repeatKey}.${q.name}`,\n isShowCommentInput: true,\n })),\n isOriginalSection: false,\n sectionPositionSuffix: repeatKey,\n };\n dynamicSections.push(clonedSection);\n }\n }\n }\n\n return dynamicSections;\n};\n\n// urlContext is derived from query params that start with `udpf_` (see useUdpFormParameters).\n// Keys are stored without the prefix, e.g. `udpf_section1_3.question1=val` -> urlContext['section1_3.question1'] = 'val'\n// This helper finds the maximum repeat suffix requested by urlContext for a given section base name.\n// Example: { 'sectionA_3.q1': 'x', 'sectionA_2.q2': 'y' } -> { sectionA: 3 }\nexport const getMaxRepeatSuffixBySectionFromUrlContext = (urlContext: Record<string, any> | undefined | null) => {\n const context = (urlContext && typeof urlContext === 'object') ? urlContext : {};\n const maxBySection: Record<string, number> = {};\n\n Object.keys(context).forEach(key => {\n // Expect keys like: sectionName_3.questionName\n // Only treat it as a repeat hint if it has a dot after the suffix.\n const match = key.match(/^([^._?&#]+)_(\\d+)\\./);\n if (!match) return;\n const baseSectionName = match[1];\n const suffix = Number(match[2]);\n if (!Number.isFinite(suffix) || suffix < 2) return;\n\n const existing = maxBySection[baseSectionName] ?? 1;\n if (suffix > existing) maxBySection[baseSectionName] = suffix;\n });\n\n return maxBySection;\n};\n\n// build dynamic sections based on the master form plus optional repeat hints from URL context\nexport const initializeDynamicSectionsWithUrlContext = (udpForm, currentValues, urlContext) => {\n const maxRepeatFromUrl = getMaxRepeatSuffixBySectionFromUrlContext(urlContext);\n\n const dynamicSections: any[] = [];\n const sortedSections = structuredClone(udpForm.udpFormUdpFormSection).sort(\n (a, b) => a.order - b.order,\n );\n\n for (const section of sortedSections) {\n section.sectionProperties = JSON.parse(section.sectionProperties || {});\n\n const repeatGroupKeys = findRepeatGroupKeys(section.name, currentValues);\n const maxRepeatedFromValues = repeatGroupKeys.length > 0 ? Math.max(...repeatGroupKeys) : 1;\n const maxRepeatedFromUrl = maxRepeatFromUrl?.[section.name] ?? 1;\n const maxRepeatedSectionSuffix = Math.max(maxRepeatedFromValues, maxRepeatedFromUrl);\n\n section.isOriginalSection = true;\n section.sectionPositionSuffix = 1; // default position\n\n // always add the original section into dynamic sections\n dynamicSections.push({\n ...structuredClone(section),\n formQuestions: structuredClone(udpForm.formQuestions)\n .filter(q => q.formSectionId === section.id)\n .sort((a, b) => a.questionOrder - b.questionOrder)\n .map(q => ({\n ...q,\n questionIdentifierKey: `${section.name}.${q.name}`,\n isShowCommentInput: true,\n })),\n });\n\n // create then add additional sections if repeatable and suffix requested by saved values or url\n if (section.sectionProperties?.isRepeatable && maxRepeatedSectionSuffix >= 2) {\n for (let repeatKey = 2; repeatKey <= maxRepeatedSectionSuffix; repeatKey++) {\n const clonedSection = {\n ...structuredClone(section),\n formQuestions: structuredClone(udpForm.formQuestions)\n .filter(q => q.formSectionId === section.id)\n .sort((a, b) => a.questionOrder - b.questionOrder)\n .map(q => ({\n ...q,\n questionIdentifierKey: `${section.name}_${repeatKey}.${q.name}`,\n isShowCommentInput: true,\n })),\n isOriginalSection: false,\n sectionPositionSuffix: repeatKey,\n };\n dynamicSections.push(clonedSection);\n }\n }\n }\n\n return dynamicSections;\n};\n\n\nexport const applyUrlSeedValuesForAll = (dynamicSections, urlContext) => {\n if (!Array.isArray(dynamicSections)) return;\n\n // urlContext is derived from query params that start with `udpf_` (see useUdpFormParameters).\n // Keys are stored without the prefix, e.g. `udpf_section1.question1=val` -> urlContext['section1.question1'] = 'val'\n const context = (urlContext && typeof urlContext === 'object') ? urlContext : {};\n // Build a case-insensitive view of urlContext so callers can use udpf_ keys without worrying about case.\n // If duplicate keys exist with different casing, the last one encountered wins.\n const contextCI: Record<string, any> = {};\n Object.keys(context).forEach(k => {\n contextCI[String(k).toLowerCase()] = (context as any)[k];\n });\n\n // 1) Collect URL values into nested structure: { [sectionKey]: { [questionName]: { value, comments: [] } } }\n const urlValuesNested: {\n [sectionKey: string]: { [qName: string]: { value: any; comments: any[] } };\n } = {};\n dynamicSections.forEach(section => {\n const sectionKey = section.isOriginalSection\n ? section.name\n : `${section.name}_${section.sectionPositionSuffix}`;\n (section.formQuestions || []).forEach(q => {\n if (!q) return;\n const candidates = [q.processedSubmissionName, q.questionIdentifierKey, q.name].filter(\n Boolean,\n ) as string[];\n let urlVal: any = undefined;\n for (const c of candidates) {\n const key = String(c).toLowerCase();\n if (Object.prototype.hasOwnProperty.call(contextCI, key)) {\n urlVal = contextCI[key];\n break;\n }\n }\n if (urlVal !== undefined && urlVal !== null) {\n if (!urlValuesNested[sectionKey]) urlValuesNested[sectionKey] = {};\n urlValuesNested[sectionKey][q.name] = { value: urlVal, comments: [] };\n }\n });\n });\n\n // Caller is responsible for merging with saved submissionResponseData.\n // Here we only return the url-derived seed values + paragraph defaults.\n const merged: { [sectionKey: string]: { [qName: string]: { value: any; comments: any[] } } } = {};\n Object.entries(urlValuesNested).forEach(([sectionKey, qMap]) => {\n if (!merged[sectionKey]) merged[sectionKey] = {} as any;\n Object.entries(qMap).forEach(([qName, valObj]) => {\n const existing = merged[sectionKey][qName];\n // Only set from URL if no saved value exists (null/undefined/empty-string)\n const isMissing =\n existing == null ||\n existing.value == null ||\n (typeof existing.value === 'string' && existing.value.trim() === '');\n if (isMissing) {\n merged[sectionKey][qName] = valObj;\n }\n });\n });\n\n // 3) Paragraph defaults: if still undefined/null, use fieldProperties.paragraphText\n dynamicSections.forEach(section => {\n const sectionKey = section.isOriginalSection\n ? section.name\n : `${section.name}_${section.sectionPositionSuffix}`;\n if (!merged[sectionKey]) merged[sectionKey] = {} as any;\n (section.formQuestions || []).forEach(q => {\n if (!q) return;\n if (q.fieldTypeId === UdpFormsFieldTypeEnum.Paragraph) {\n const existing = merged[sectionKey][q.name];\n const isMissing =\n existing == null ||\n existing.value == null ||\n (typeof existing.value === 'string' && existing.value.trim() === '');\n if (isMissing) {\n let fieldProps: any = q?.fieldProperties;\n if (typeof fieldProps === 'string') {\n try {\n fieldProps = JSON.parse(fieldProps || '{}');\n } catch {\n fieldProps = {};\n }\n }\n merged[sectionKey][q.name] = {\n value: fieldProps?.paragraphText ?? '',\n comments: [],\n };\n }\n }\n });\n });\n\n return merged;\n};\n"]}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { makeApiCall } from "../../../../../udp-utilities/api/makeApiCall/makeApiCall";
|
|
2
|
-
import { SearchBuilder, SearchOperators } from "../../../../../udp-utilities/search";
|
|
3
|
-
import { ConfigService } from "../../../../../udp-utilities/api-config/index";
|
|
4
|
-
import { UdpFormSubmission } from "../classes/UdpFormSubmission";
|
|
5
|
-
import { UdpFormsSubmissionStatusEnum } from "../enums";
|
|
6
|
-
/**
|
|
7
|
-
* Handles CRUD and submission operations for private UdpFormSubmission records.
|
|
8
|
-
*/
|
|
9
|
-
export class PrivateFormSubmissionHandler {
|
|
10
|
-
// =============================
|
|
11
|
-
// Fetch Methods
|
|
12
|
-
// =============================
|
|
13
|
-
/**
|
|
14
|
-
* Fetch and refresh an existing UdpFormSubmission instance.
|
|
15
|
-
*
|
|
16
|
-
* Attempts to load the latest server representation of the provided
|
|
17
|
-
* udpFormSubmission. Uses generic fields (generic1/2/3) when present to
|
|
18
|
-
* disambiguate records, otherwise falls back to a simple id lookup.
|
|
19
|
-
*
|
|
20
|
-
* @param udpFormSubmission - local UdpFormSubmission object to refresh
|
|
21
|
-
* @returns a new UdpFormSubmission merged with server data, or the original on failure
|
|
22
|
-
* @throws network or unexpected errors
|
|
23
|
-
*/
|
|
24
|
-
async fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission) {
|
|
25
|
-
if (!(udpFormSubmission === null || udpFormSubmission === void 0 ? void 0 : udpFormSubmission.id)) {
|
|
26
|
-
console.warn('Cannot fetch form submission without an ID.');
|
|
27
|
-
return udpFormSubmission;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const { id, generic1, generic2, generic3 } = udpFormSubmission;
|
|
31
|
-
let response = null;
|
|
32
|
-
// Prefer the generics-aware lookup if any generic values are present
|
|
33
|
-
if (generic1 || generic2 || generic3) {
|
|
34
|
-
response = await this.getFormSubmissionByIdAndGenerics(id, generic1 || undefined, generic2 || undefined, generic3 || undefined);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
response = await this.getFormSubmissionById(id);
|
|
38
|
-
}
|
|
39
|
-
if (!response) {
|
|
40
|
-
console.warn('No form submission found for the provided object.');
|
|
41
|
-
return udpFormSubmission;
|
|
42
|
-
}
|
|
43
|
-
return new UdpFormSubmission(Object.assign(Object.assign({}, udpFormSubmission), response));
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error('Error fetching form submission:', error);
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Internal helper — lookup a form submission by its unique id.
|
|
52
|
-
*
|
|
53
|
-
* Performs a minimal search (page size 1) for the given id and returns
|
|
54
|
-
* the first match or null if not found. Logs and returns null on errors.
|
|
55
|
-
*
|
|
56
|
-
* @param id - submission id to query
|
|
57
|
-
* @returns UdpFormSubmission or null
|
|
58
|
-
*/
|
|
59
|
-
async getFormSubmissionById(id) {
|
|
60
|
-
var _a;
|
|
61
|
-
try {
|
|
62
|
-
const search = new SearchBuilder(1, 1)
|
|
63
|
-
.addFilter('id', id, SearchOperators.EQUALS);
|
|
64
|
-
const response = await search.execute('UdpFormSubmission');
|
|
65
|
-
return ((_a = response === null || response === void 0 ? void 0 : response.pageList) === null || _a === void 0 ? void 0 : _a[0]) || null;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
console.error('Error fetching form submission by ID:', error);
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Internal helper — lookup a form submission by id and generic fields.
|
|
74
|
-
*
|
|
75
|
-
* Adds optional equality filters for generic1/generic2/generic3 when provided,
|
|
76
|
-
* then executes a minimal search and returns the first match or null.
|
|
77
|
-
*
|
|
78
|
-
* @param id - submission id to query
|
|
79
|
-
* @param generic1 - optional generic1 value to filter by
|
|
80
|
-
* @param generic2 - optional generic2 value to filter by
|
|
81
|
-
* @param generic3 - optional generic3 value to filter by
|
|
82
|
-
* @returns UdpFormSubmission or null
|
|
83
|
-
*/
|
|
84
|
-
async getFormSubmissionByIdAndGenerics(id, generic1, generic2, generic3) {
|
|
85
|
-
var _a;
|
|
86
|
-
try {
|
|
87
|
-
const search = new SearchBuilder(1, 1)
|
|
88
|
-
.addFilter('id', id, SearchOperators.EQUALS);
|
|
89
|
-
if (generic1) {
|
|
90
|
-
search.addFilter('generic1', generic1, SearchOperators.EQUALS);
|
|
91
|
-
}
|
|
92
|
-
if (generic2) {
|
|
93
|
-
search.addFilter('generic2', generic2, SearchOperators.EQUALS);
|
|
94
|
-
}
|
|
95
|
-
if (generic3) {
|
|
96
|
-
search.addFilter('generic3', generic3, SearchOperators.EQUALS);
|
|
97
|
-
}
|
|
98
|
-
const response = await search.execute('UdpFormSubmission');
|
|
99
|
-
return ((_a = response === null || response === void 0 ? void 0 : response.pageList) === null || _a === void 0 ? void 0 : _a[0]) || null;
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
console.error('Error fetching form submission by ID:', error);
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// =============================
|
|
107
|
-
// Save & Submit Methods
|
|
108
|
-
// =============================
|
|
109
|
-
/**
|
|
110
|
-
* Create a new follow-up form submission that is linked to an existing submission.
|
|
111
|
-
*
|
|
112
|
-
* Saves a new UdpFormSubmission in 'in-progress' state without populating field values
|
|
113
|
-
* (only metadata/links), and returns the created submission object.
|
|
114
|
-
*
|
|
115
|
-
* @param udpFormSubmission - template/parent submission to base the new follow-up on
|
|
116
|
-
* @returns newly created UdpFormSubmission
|
|
117
|
-
*/
|
|
118
|
-
async createNewLinkedFollowUpFormSubmission(udpFormSubmission) {
|
|
119
|
-
const formData = await this.saveFormDataWithoutValues(udpFormSubmission, UdpFormsSubmissionStatusEnum.InProgress);
|
|
120
|
-
return formData;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Persist submission metadata (without full field values).
|
|
124
|
-
*
|
|
125
|
-
* Converts provided udpFormSubmission into formData excluding field values,
|
|
126
|
-
* determines whether to POST or PUT based on presence of id, and merges the
|
|
127
|
-
* server response into a new UdpFormSubmission instance.
|
|
128
|
-
*
|
|
129
|
-
* @param udpFormSubmission - the submission to save
|
|
130
|
-
* @param status - desired status to save (e.g., 'in-progress' or 'submitted')
|
|
131
|
-
* @returns saved UdpFormSubmission (refetches if server returns empty PUT response)
|
|
132
|
-
*/
|
|
133
|
-
async saveFormDataWithoutValues(udpFormSubmission, status) {
|
|
134
|
-
try {
|
|
135
|
-
const formData = udpFormSubmission.processSubmissionIntoFormDataWithoutValues(status);
|
|
136
|
-
const { method, url } = this.getApiRequestInfo(udpFormSubmission);
|
|
137
|
-
const response = await makeApiCall(method, url, formData, true);
|
|
138
|
-
// PUT returns an empty string; refetch to refresh local data
|
|
139
|
-
if (response === '') {
|
|
140
|
-
return await this.fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission);
|
|
141
|
-
}
|
|
142
|
-
return new UdpFormSubmission(Object.assign(Object.assign({}, udpFormSubmission), response));
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
console.error('Failed to save form udpFormSubmission:', error);
|
|
146
|
-
throw error;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Save only comment-related fields for a submission.
|
|
151
|
-
*
|
|
152
|
-
* Delegates to the lower-level saveCommentsToDB helper to persist comment changes
|
|
153
|
-
* while preserving existing submission state and metadata.
|
|
154
|
-
*
|
|
155
|
-
* @param values - comment values to persist
|
|
156
|
-
* @param udpFormSubmission - target submission object
|
|
157
|
-
* @returns updated UdpFormSubmission
|
|
158
|
-
*/
|
|
159
|
-
async saveFormSubmissionComments(values, udpFormSubmission) {
|
|
160
|
-
return this.saveCommentsToDB(values, udpFormSubmission);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Save the current state of the form's data as a draft ('in-progress').
|
|
164
|
-
*
|
|
165
|
-
* Converts the provided values into the required form payload and persists them.
|
|
166
|
-
* Determines POST vs PUT automatically and refreshes local object on empty PUT responses.
|
|
167
|
-
*
|
|
168
|
-
* @param values - field data to save
|
|
169
|
-
* @param udpFormSubmission - submission being updated
|
|
170
|
-
* @returns updated UdpFormSubmission
|
|
171
|
-
*/
|
|
172
|
-
async saveCurrentFormSubmissionState(values, udpFormSubmission) {
|
|
173
|
-
return this.saveSubmissionToDB(values, udpFormSubmission, UdpFormsSubmissionStatusEnum.InProgress);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Finalize and submit the form (set state to 'submitted').
|
|
177
|
-
*
|
|
178
|
-
* Persists the provided values and marks the submission as 'submitted'.
|
|
179
|
-
*
|
|
180
|
-
* @param values - final form values to submit
|
|
181
|
-
* @param udpFormSubmission - submission being finalized
|
|
182
|
-
* @returns updated UdpFormSubmission
|
|
183
|
-
*/
|
|
184
|
-
async finalizeFormSubmissionState(values, udpFormSubmission) {
|
|
185
|
-
return this.saveSubmissionToDB(values, udpFormSubmission, UdpFormsSubmissionStatusEnum.Submitted);
|
|
186
|
-
}
|
|
187
|
-
// =============================
|
|
188
|
-
// Helpers
|
|
189
|
-
// =============================
|
|
190
|
-
/**
|
|
191
|
-
* Determine correct HTTP verb and target URL for saving a UdpFormSubmission.
|
|
192
|
-
*
|
|
193
|
-
* Uses productV1ApiUrl from ConfigService and returns POST for new submissions
|
|
194
|
-
* (no id) or PUT with the resource id for existing submissions.
|
|
195
|
-
*
|
|
196
|
-
* @param udpFormSubmission - submission to be saved
|
|
197
|
-
* @returns object with method ('POST'|'PUT') and full url
|
|
198
|
-
*/
|
|
199
|
-
getApiRequestInfo(udpFormSubmission) {
|
|
200
|
-
const baseUrl = `${ConfigService.productV1ApiUrl}/UdpFormSubmission`;
|
|
201
|
-
return udpFormSubmission.id
|
|
202
|
-
? { method: 'PUT', url: `${baseUrl}/${udpFormSubmission.id}` }
|
|
203
|
-
: { method: 'POST', url: baseUrl };
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Persist form values and metadata to the backend.
|
|
207
|
-
*
|
|
208
|
-
* Builds the form payload using udpFormSubmission.processSubmissionIntoFormData,
|
|
209
|
-
* resolves POST vs PUT using getApiRequestInfo, and returns a merged UdpFormSubmission.
|
|
210
|
-
* If the server returns an empty string for PUT, the method refetches the record.
|
|
211
|
-
*
|
|
212
|
-
* @param values - field values to be saved
|
|
213
|
-
* @param udpFormSubmission - submission being updated
|
|
214
|
-
* @param status - status to persist (e.g., 'in-progress' | 'submitted')
|
|
215
|
-
* @returns updated UdpFormSubmission
|
|
216
|
-
*/
|
|
217
|
-
async saveSubmissionToDB(values, udpFormSubmission, status) {
|
|
218
|
-
try {
|
|
219
|
-
const formData = udpFormSubmission.processSubmissionIntoFormData(values, status);
|
|
220
|
-
const { method, url } = this.getApiRequestInfo(udpFormSubmission);
|
|
221
|
-
const response = await makeApiCall(method, url, formData, true);
|
|
222
|
-
// PUT returns an empty string; refetch to refresh local data
|
|
223
|
-
if (response === '') {
|
|
224
|
-
return await this.fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission);
|
|
225
|
-
}
|
|
226
|
-
return new UdpFormSubmission(Object.assign(Object.assign({}, udpFormSubmission), response));
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
console.error('Failed to save form udpFormSubmission:', error);
|
|
230
|
-
throw error;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Persist only comment changes for an existing submission via PUT.
|
|
235
|
-
*
|
|
236
|
-
* Forces a PUT to the specific submission id, builds a form payload containing
|
|
237
|
-
* the provided comment values, and returns the updated submission. If the API
|
|
238
|
-
* returns an empty string (PUT shorthand), the method refetches the record.
|
|
239
|
-
*
|
|
240
|
-
* @param values - comment fields to persist
|
|
241
|
-
* @param udpFormSubmission - target submission (must have id)
|
|
242
|
-
* @returns updated UdpFormSubmission
|
|
243
|
-
*/
|
|
244
|
-
async saveCommentsToDB(values, udpFormSubmission) {
|
|
245
|
-
var _a;
|
|
246
|
-
try {
|
|
247
|
-
const method = 'PUT';
|
|
248
|
-
const status = (_a = udpFormSubmission.status) !== null && _a !== void 0 ? _a : UdpFormsSubmissionStatusEnum.Submitted;
|
|
249
|
-
const url = `${ConfigService.productV1ApiUrl}/UdpFormSubmission/${udpFormSubmission.id}`;
|
|
250
|
-
const formData = udpFormSubmission.processSubmissionIntoFormData(values, status);
|
|
251
|
-
const response = await makeApiCall(method, url, formData, true);
|
|
252
|
-
// PUT returns an empty string; refetch to refresh local data
|
|
253
|
-
if (response === '') {
|
|
254
|
-
return await this.fetchAndPopulateUdpFormSubmissionObj(udpFormSubmission);
|
|
255
|
-
}
|
|
256
|
-
return new UdpFormSubmission(Object.assign(Object.assign({}, udpFormSubmission), response));
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
console.error('Failed to save form udpFormSubmission:', error);
|
|
260
|
-
throw error;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=PrivateFormSubmissionHandler.js.map
|