@abyss-project/form 1.0.4 → 1.0.6
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/api/form-submission.api.d.ts +2 -1
- package/dist/api/form-submission.api.js +7 -1
- package/dist/index.js +4 -1
- package/dist/types/interface/api/requests/form-submission.request.d.ts +7 -0
- package/dist/types/interface/api/requests/form-webhook-history.admin.request.d.ts +1 -2
- package/dist/types/interface/api/requests/form-webhook-history.request.d.ts +2 -3
- package/dist/types/interface/api/responses/form-submission.response.d.ts +5 -0
- package/dist/types/interface/dto/form.dto.d.ts +2 -0
- package/dist/types/interface/models/form-submission.model.d.ts +1 -0
- package/dist/utils/form.utils.js +4 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IArchiveFormSubmissionParams, IArchiveFormSubmissionResponse, IGetFormSubmissionParams, IGetFormSubmissionResponse, IPaginateFormSubmissionParams, IPaginateFormSubmissionQuery, IPaginateFormSubmissionResponse, IUpdateFormSubmissionBody, IUpdateFormSubmissionParams, IUpdateFormSubmissionResponse } from '..';
|
|
1
|
+
import { IArchiveFormSubmissionParams, IArchiveFormSubmissionResponse, IGetFormSubmissionParams, IGetFormSubmissionResponse, IGetNextToReviewFormSubmissionParams, IGetNextToReviewFormSubmissionQuery, IGetNextToReviewFormSubmissionResponse, IPaginateFormSubmissionParams, IPaginateFormSubmissionQuery, IPaginateFormSubmissionResponse, IUpdateFormSubmissionBody, IUpdateFormSubmissionParams, IUpdateFormSubmissionResponse } from '..';
|
|
2
2
|
export declare const getFormSubmission: (params: IGetFormSubmissionParams) => Promise<IGetFormSubmissionResponse>;
|
|
3
|
+
export declare const getNextToReviewFormSubmission: (params: IGetNextToReviewFormSubmissionParams, query: IGetNextToReviewFormSubmissionQuery) => Promise<IGetNextToReviewFormSubmissionResponse>;
|
|
3
4
|
export declare const updateFormSubmission: (params: IUpdateFormSubmissionParams, body: IUpdateFormSubmissionBody) => Promise<IUpdateFormSubmissionResponse>;
|
|
4
5
|
export declare const archiveFormSubmission: (params: IArchiveFormSubmissionParams) => Promise<IArchiveFormSubmissionResponse>;
|
|
5
6
|
export declare const paginateFormSubmission: (params: IPaginateFormSubmissionParams, query: IPaginateFormSubmissionQuery) => Promise<IPaginateFormSubmissionResponse>;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.paginateFormSubmission = exports.archiveFormSubmission = exports.updateFormSubmission = exports.getFormSubmission = void 0;
|
|
3
|
+
exports.paginateFormSubmission = exports.archiveFormSubmission = exports.updateFormSubmission = exports.getNextToReviewFormSubmission = exports.getFormSubmission = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
const getFormSubmission = async (params) => {
|
|
6
6
|
return (await __1.AbyssFormCore.axios.get(`form-submission/${params.formId}/submission/${params.formSubmissionId}`)).data;
|
|
7
7
|
};
|
|
8
8
|
exports.getFormSubmission = getFormSubmission;
|
|
9
|
+
const getNextToReviewFormSubmission = async (params, query) => {
|
|
10
|
+
return (await __1.AbyssFormCore.axios.get(`form-submission/${params.formId}/submission/next-to-review`, {
|
|
11
|
+
params: query,
|
|
12
|
+
})).data;
|
|
13
|
+
};
|
|
14
|
+
exports.getNextToReviewFormSubmission = getNextToReviewFormSubmission;
|
|
9
15
|
const updateFormSubmission = async (params, body) => {
|
|
10
16
|
return (await __1.AbyssFormCore.axios.put(`form-submission/${params.formId}/submission/${params.formSubmissionId}`, body)).data;
|
|
11
17
|
};
|
package/dist/index.js
CHANGED
|
@@ -90,4 +90,7 @@ AbyssFormCore.config = {
|
|
|
90
90
|
adminToken: '',
|
|
91
91
|
baseURL: DEFAULT_BASE_URL,
|
|
92
92
|
};
|
|
93
|
-
AbyssFormCore.axios = axios_1.default.create({
|
|
93
|
+
AbyssFormCore.axios = axios_1.default.create({
|
|
94
|
+
baseURL: _a.config.baseURL,
|
|
95
|
+
withCredentials: true,
|
|
96
|
+
});
|
|
@@ -9,6 +9,7 @@ export interface IUpdateFormSubmissionParams {
|
|
|
9
9
|
}
|
|
10
10
|
export interface IUpdateFormSubmissionBody {
|
|
11
11
|
comment?: string;
|
|
12
|
+
reviewed?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export interface IGetFormSubmissionParams {
|
|
14
15
|
formId: string;
|
|
@@ -18,3 +19,9 @@ export interface IPaginateFormSubmissionParams {
|
|
|
18
19
|
formId: string;
|
|
19
20
|
}
|
|
20
21
|
export type IPaginateFormSubmissionQuery = QueryPaginate;
|
|
22
|
+
export interface IGetNextToReviewFormSubmissionParams {
|
|
23
|
+
formId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IGetNextToReviewFormSubmissionQuery {
|
|
26
|
+
excludeFormSubmissionId?: string;
|
|
27
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as core from 'express-serve-static-core';
|
|
2
1
|
import { FormWebhookType } from '../../../enum';
|
|
3
2
|
import { QueryPaginate } from '..';
|
|
4
|
-
export interface IGetFormWebhookHistoryAdminParams
|
|
3
|
+
export interface IGetFormWebhookHistoryAdminParams {
|
|
5
4
|
formWebhookHistoryId: string;
|
|
6
5
|
}
|
|
7
6
|
export type IPaginateFormWebhookHistoryAdminQuery = {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import * as core from 'express-serve-static-core';
|
|
2
1
|
import { FormWebhookType } from '../../../enum';
|
|
3
2
|
import { QueryPaginate } from '..';
|
|
4
|
-
export interface IGetFormWebhookHistoryParams
|
|
3
|
+
export interface IGetFormWebhookHistoryParams {
|
|
5
4
|
formId: string;
|
|
6
5
|
formWebhookHistoryId: string;
|
|
7
6
|
}
|
|
8
|
-
export interface IPaginateFormWebhookHistoryParams
|
|
7
|
+
export interface IPaginateFormWebhookHistoryParams {
|
|
9
8
|
formId: string;
|
|
10
9
|
}
|
|
11
10
|
export type IPaginateFormWebhookHistoryQuery = {
|
|
@@ -12,3 +12,8 @@ export interface IArchiveFormSubmissionData {
|
|
|
12
12
|
formSubmission: IFormSubmission;
|
|
13
13
|
}
|
|
14
14
|
export type IArchiveFormSubmissionResponse = IResponse<IArchiveFormSubmissionData>;
|
|
15
|
+
export interface IGetNextToReviewFormSubmissionData {
|
|
16
|
+
formSubmission: IFormSubmission | null;
|
|
17
|
+
remainingCount: number;
|
|
18
|
+
}
|
|
19
|
+
export type IGetNextToReviewFormSubmissionResponse = IResponse<IGetNextToReviewFormSubmissionData>;
|
|
@@ -65,6 +65,7 @@ export type FormContentQuestionBaseOptionsDTO = {
|
|
|
65
65
|
formCodeBlockIds: string[];
|
|
66
66
|
description: string | null;
|
|
67
67
|
displayCondition?: FormContentQuestionDisplayConditionDTO;
|
|
68
|
+
archivedAt?: Date | null;
|
|
68
69
|
};
|
|
69
70
|
export type FormContentQuestionDateOptionsDTO = FormContentQuestionBaseOptionsDTO & {
|
|
70
71
|
type: FormContentQuestionType.DATE;
|
|
@@ -136,6 +137,7 @@ export type FormResponseQuestionDTO = {
|
|
|
136
137
|
language: string;
|
|
137
138
|
content: string;
|
|
138
139
|
} | null;
|
|
140
|
+
userQuestionRate?: boolean | null;
|
|
139
141
|
};
|
|
140
142
|
export type FormResponseDTO = {
|
|
141
143
|
questions: Record<string, FormResponseQuestionDTO>;
|
package/dist/utils/form.utils.js
CHANGED
|
@@ -120,7 +120,7 @@ const mapQuestionByType = (question, allQuestions) => {
|
|
|
120
120
|
return {
|
|
121
121
|
...(0, exports.formContentQuestionMapper)(question, allQuestions),
|
|
122
122
|
type: question.type,
|
|
123
|
-
display: question.display,
|
|
123
|
+
display: question.display || 'star',
|
|
124
124
|
answers: question.answers.map((answer) => ({
|
|
125
125
|
id: answer.id,
|
|
126
126
|
content: answer.content,
|
|
@@ -172,6 +172,9 @@ const mapQuestionByType = (question, allQuestions) => {
|
|
|
172
172
|
};
|
|
173
173
|
exports.mapQuestionByType = mapQuestionByType;
|
|
174
174
|
const shouldDisplayQuestion = (question, content, response) => {
|
|
175
|
+
if (question.archivedAt) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
175
178
|
if (!question.displayCondition || !question.displayCondition.conditions.length) {
|
|
176
179
|
return true;
|
|
177
180
|
}
|