valtech-components 2.0.938 → 2.0.939
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/esm2022/lib/components/molecules/content-reaction/content-reaction.component.mjs +3 -3
- package/esm2022/lib/services/requests/request-form-builder.service.mjs +115 -0
- package/esm2022/lib/services/requests/request.service.mjs +83 -0
- package/esm2022/lib/services/requests/types.mjs +9 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/valtech-components.mjs +201 -4
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/requests/request-form-builder.service.d.ts +12 -0
- package/lib/services/requests/request.service.d.ts +35 -0
- package/lib/services/requests/types.d.ts +110 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentState, FormMetadata } from '../../components/types';
|
|
2
|
+
import { FieldSchemaDef } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class RequestFormBuilderService {
|
|
5
|
+
private i18n;
|
|
6
|
+
buildForm(schema: FieldSchemaDef[], i18nNamespace: string, formName: string, submitLabelKey?: string, state?: ComponentState): FormMetadata;
|
|
7
|
+
private buildField;
|
|
8
|
+
private parseValidators;
|
|
9
|
+
private parseInputType;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RequestFormBuilderService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RequestFormBuilderService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ValtechAuthConfig } from '../auth/types';
|
|
4
|
+
import { AppRequest, RequestComment, RequestTypeConfig, RequestStatus, CreateRequestPayload, UpdateRequestPayload, TransitionPayload, AddCommentPayload, ListRequestsParams, ListRequestsResponse, ListCommentsResponse, ListRequestTypesResponse, CreateRequestTypePayload } from './types';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class RequestService {
|
|
7
|
+
private config;
|
|
8
|
+
private http;
|
|
9
|
+
constructor(config: ValtechAuthConfig, http: HttpClient);
|
|
10
|
+
private get baseUrl();
|
|
11
|
+
private get typesUrl();
|
|
12
|
+
createRequest(payload: CreateRequestPayload): Observable<{
|
|
13
|
+
requestId: string;
|
|
14
|
+
request: AppRequest;
|
|
15
|
+
}>;
|
|
16
|
+
createAnonymousRequest(payload: CreateRequestPayload): Observable<{
|
|
17
|
+
requestId: string;
|
|
18
|
+
request: AppRequest;
|
|
19
|
+
}>;
|
|
20
|
+
listRequests(params?: ListRequestsParams): Observable<ListRequestsResponse>;
|
|
21
|
+
listMyRequests(params?: ListRequestsParams): Observable<ListRequestsResponse>;
|
|
22
|
+
getRequest(id: string): Observable<AppRequest>;
|
|
23
|
+
updateRequest(id: string, payload: UpdateRequestPayload): Observable<AppRequest>;
|
|
24
|
+
transition(id: string, payload: TransitionPayload): Observable<{
|
|
25
|
+
status: RequestStatus;
|
|
26
|
+
}>;
|
|
27
|
+
addComment(requestId: string, payload: AddCommentPayload): Observable<RequestComment>;
|
|
28
|
+
listComments(requestId: string): Observable<ListCommentsResponse>;
|
|
29
|
+
listRequestTypes(): Observable<ListRequestTypesResponse>;
|
|
30
|
+
getRequestType(typeId: string): Observable<RequestTypeConfig>;
|
|
31
|
+
createRequestType(payload: CreateRequestTypePayload): Observable<RequestTypeConfig>;
|
|
32
|
+
private buildQueryString;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RequestService, never>;
|
|
34
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RequestService>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type RequestStatus = 'pending' | 'in_review' | 'approved' | 'rejected' | 'cancelled' | 'closed';
|
|
2
|
+
export declare const REQUEST_STATUSES: RequestStatus[];
|
|
3
|
+
export interface RequestActor {
|
|
4
|
+
userId?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AppRequest {
|
|
10
|
+
id: string;
|
|
11
|
+
appId: string;
|
|
12
|
+
orgId: string;
|
|
13
|
+
type: string;
|
|
14
|
+
status: RequestStatus;
|
|
15
|
+
title: string;
|
|
16
|
+
fields: Record<string, unknown>;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
priority?: string;
|
|
20
|
+
submitter: RequestActor;
|
|
21
|
+
assignee?: RequestActor;
|
|
22
|
+
dueAt?: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
closedAt?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface RequestComment {
|
|
28
|
+
commentId: string;
|
|
29
|
+
requestId: string;
|
|
30
|
+
author: RequestActor;
|
|
31
|
+
body: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FieldOption {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
order: number;
|
|
38
|
+
}
|
|
39
|
+
export interface FieldSchemaDef {
|
|
40
|
+
/** InputType enum name as string: 'TEXT', 'TEXTAREA', 'SELECT', etc. */
|
|
41
|
+
type: string;
|
|
42
|
+
name: string;
|
|
43
|
+
labelKey: string;
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
required: boolean;
|
|
46
|
+
/** e.g. 'required', 'email', 'maxLength:500', 'minLength:3' */
|
|
47
|
+
validators?: string[];
|
|
48
|
+
options?: FieldOption[];
|
|
49
|
+
order: number;
|
|
50
|
+
}
|
|
51
|
+
export interface RequestTypeConfig {
|
|
52
|
+
typeId: string;
|
|
53
|
+
appId: string;
|
|
54
|
+
orgId: string;
|
|
55
|
+
labelEs: string;
|
|
56
|
+
labelEn: string;
|
|
57
|
+
fieldSchema: FieldSchemaDef[];
|
|
58
|
+
allowAnonymous: boolean;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
updatedAt: string;
|
|
61
|
+
}
|
|
62
|
+
export interface CreateRequestPayload {
|
|
63
|
+
type: string;
|
|
64
|
+
title: string;
|
|
65
|
+
fields?: Record<string, unknown>;
|
|
66
|
+
tags?: string[];
|
|
67
|
+
priority?: string;
|
|
68
|
+
/** Para solicitudes anónimas */
|
|
69
|
+
submitter?: RequestActor;
|
|
70
|
+
dueAt?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface UpdateRequestPayload {
|
|
73
|
+
title?: string;
|
|
74
|
+
fields?: Record<string, unknown>;
|
|
75
|
+
tags?: string[];
|
|
76
|
+
priority?: string;
|
|
77
|
+
assignee?: RequestActor;
|
|
78
|
+
dueAt?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface TransitionPayload {
|
|
81
|
+
status: RequestStatus;
|
|
82
|
+
}
|
|
83
|
+
export interface AddCommentPayload {
|
|
84
|
+
body: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ListRequestsParams {
|
|
87
|
+
type?: string;
|
|
88
|
+
status?: string;
|
|
89
|
+
limit?: number;
|
|
90
|
+
nextToken?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ListRequestsResponse {
|
|
93
|
+
requests: AppRequest[];
|
|
94
|
+
nextToken?: string;
|
|
95
|
+
count: number;
|
|
96
|
+
}
|
|
97
|
+
export interface ListCommentsResponse {
|
|
98
|
+
comments: RequestComment[];
|
|
99
|
+
count: number;
|
|
100
|
+
}
|
|
101
|
+
export interface ListRequestTypesResponse {
|
|
102
|
+
types: RequestTypeConfig[];
|
|
103
|
+
}
|
|
104
|
+
export interface CreateRequestTypePayload {
|
|
105
|
+
typeId: string;
|
|
106
|
+
labelEs: string;
|
|
107
|
+
labelEn: string;
|
|
108
|
+
fieldSchema: FieldSchemaDef[];
|
|
109
|
+
allowAnonymous: boolean;
|
|
110
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -345,3 +345,6 @@ export * from './lib/shared/utils/styles';
|
|
|
345
345
|
export * from './lib/shared/utils/text';
|
|
346
346
|
export * from './lib/config';
|
|
347
347
|
export { ValtechErrorService, VALTECH_NETWORK_ERROR_KEY, } from './lib/services/errors/valtech-error.service';
|
|
348
|
+
export * from './lib/services/requests/types';
|
|
349
|
+
export * from './lib/services/requests/request.service';
|
|
350
|
+
export * from './lib/services/requests/request-form-builder.service';
|