svelte-reflector 1.0.8 → 1.0.11
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/generate-doc.js +3 -0
- package/dist/helpers/helpers.d.ts +3 -0
- package/dist/helpers/helpers.js +34 -2
- package/dist/main.js +12 -6
- package/dist/method.d.ts +8 -3
- package/dist/method.js +86 -65
- package/dist/module.d.ts +8 -1
- package/dist/module.js +91 -25
- package/dist/property.d.ts +6 -1
- package/dist/property.js +31 -18
- package/dist/reflector/controllers/admin/account/admin-account.module.svelte.d.ts +7 -0
- package/dist/reflector/controllers/admin/account/admin-account.module.svelte.js +28 -0
- package/dist/reflector/controllers/admin/account/owner/account-owner.module.svelte.d.ts +15 -0
- package/dist/reflector/controllers/admin/account/owner/account-owner.module.svelte.js +79 -0
- package/dist/reflector/controllers/admin/kyc/config/kyc-config.module.svelte.d.ts +49 -0
- package/dist/reflector/controllers/admin/kyc/config/kyc-config.module.svelte.js +303 -0
- package/dist/reflector/controllers/admin/policy/system/policy-system.module.svelte.d.ts +9 -0
- package/dist/reflector/controllers/admin/policy/system/policy-system.module.svelte.js +36 -0
- package/dist/reflector/controllers/admin/smtp/config/smtp-config.module.svelte.d.ts +19 -0
- package/dist/reflector/controllers/admin/smtp/config/smtp-config.module.svelte.js +82 -0
- package/dist/reflector/controllers/customer/kyc/file-upload/kyc-file-upload.module.svelte.d.ts +37 -0
- package/dist/reflector/controllers/customer/kyc/file-upload/kyc-file-upload.module.svelte.js +228 -0
- package/dist/reflector/controllers/member/account/member-account.module.svelte.d.ts +11 -0
- package/dist/reflector/controllers/member/account/member-account.module.svelte.js +54 -0
- package/dist/reflector/controllers/owner/account/owner-account.module.svelte.d.ts +11 -0
- package/dist/reflector/controllers/owner/account/owner-account.module.svelte.js +54 -0
- package/dist/reflector/controllers/owner/kyc/config/kyc-config.module.svelte.d.ts +49 -0
- package/dist/reflector/controllers/owner/kyc/config/kyc-config.module.svelte.js +303 -0
- package/dist/reflector/controllers/owner/kyc/self/create-or-update/self-create-or-update.module.svelte.d.ts +33 -0
- package/dist/reflector/controllers/owner/kyc/self/create-or-update/self-create-or-update.module.svelte.js +197 -0
- package/dist/reflector/controllers/owner/policy/owner-policy.module.svelte.d.ts +9 -0
- package/dist/reflector/controllers/owner/policy/owner-policy.module.svelte.js +36 -0
- package/dist/reflector/controllers/owner/smtp/config/smtp-config.module.svelte.d.ts +19 -0
- package/dist/reflector/controllers/owner/smtp/config/smtp-config.module.svelte.js +82 -0
- package/dist/reflector/controllers/public/auth/sign-in-firebase/auth-sign-in-firebase.module.svelte.d.ts +29 -0
- package/dist/reflector/controllers/public/auth/sign-in-firebase/auth-sign-in-firebase.module.svelte.js +223 -0
- package/dist/reflector/controllers/public/reset-password/tenant/send-recovery-email/tenant-send-recovery-email.module.svelte.d.ts +13 -0
- package/dist/reflector/controllers/public/reset-password/tenant/send-recovery-email/tenant-send-recovery-email.module.svelte.js +49 -0
- package/dist/reflector/controllers/restricted/account/avatar-file-upload/account-avatar-file-upload.module.svelte.d.ts +19 -0
- package/dist/reflector/controllers/restricted/account/avatar-file-upload/account-avatar-file-upload.module.svelte.js +114 -0
- package/dist/reflector/controllers/restricted/bank/restricted-bank.module.svelte.d.ts +15 -0
- package/dist/reflector/controllers/restricted/bank/restricted-bank.module.svelte.js +78 -0
- package/dist/reflector/controllers/restricted/files/presigned-url/files-presigned-url.module.svelte.d.ts +11 -0
- package/dist/reflector/controllers/restricted/files/presigned-url/files-presigned-url.module.svelte.js +56 -0
- package/dist/reflector/controllers/restricted/notification/restricted-notification.module.svelte.d.ts +9 -0
- package/dist/reflector/controllers/restricted/notification/restricted-notification.module.svelte.js +36 -0
- package/dist/reflector/controllers/restricted/two-factor-auth/status/two-factor-auth-status.module.svelte.d.ts +15 -0
- package/dist/reflector/controllers/restricted/two-factor-auth/status/two-factor-auth-status.module.svelte.js +68 -0
- package/dist/reflector/reflector.types.d.ts +4 -0
- package/dist/reflector/reflector.types.js +4 -0
- package/dist/reflector/schemas.d.ts +357 -0
- package/dist/reflector/schemas.js +1709 -0
- package/dist/request.d.ts +2 -0
- package/dist/request.js +8 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +9 -5
- package/package.json +1 -1
package/dist/property.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SchemaObject } from "./types/open-api-spec.interface.js";
|
|
1
|
+
import { type ParameterLocation, type SchemaObject } from "./types/open-api-spec.interface.js";
|
|
2
2
|
import { type Example, type ReflectorParamType } from "./types/types.js";
|
|
3
3
|
export declare class ZodProperty {
|
|
4
4
|
name: string;
|
|
@@ -7,6 +7,7 @@ export declare class ZodProperty {
|
|
|
7
7
|
buildedProp: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
required: boolean;
|
|
10
|
+
inParam: ParameterLocation;
|
|
10
11
|
constructor(params: {
|
|
11
12
|
name: string;
|
|
12
13
|
schemaObject: SchemaObject;
|
|
@@ -14,10 +15,14 @@ export declare class ZodProperty {
|
|
|
14
15
|
example: Example | undefined;
|
|
15
16
|
required: boolean;
|
|
16
17
|
description?: string;
|
|
18
|
+
isEmpty: boolean;
|
|
19
|
+
inParam: ParameterLocation;
|
|
17
20
|
});
|
|
18
21
|
private getDtoName;
|
|
22
|
+
private getEmptyExample;
|
|
19
23
|
private getExample;
|
|
20
24
|
private deepValidator;
|
|
21
25
|
private isNullable;
|
|
26
|
+
private treatName;
|
|
22
27
|
private build;
|
|
23
28
|
}
|
package/dist/property.js
CHANGED
|
@@ -10,13 +10,19 @@ export class ZodProperty {
|
|
|
10
10
|
buildedProp;
|
|
11
11
|
description;
|
|
12
12
|
required;
|
|
13
|
+
inParam;
|
|
13
14
|
constructor(params) {
|
|
14
|
-
const { name, schemaObject, type, example, required, description } = params;
|
|
15
|
-
|
|
15
|
+
const { name, schemaObject, type, example, required, description, isEmpty, inParam } = params;
|
|
16
|
+
this.inParam = inParam;
|
|
17
|
+
if (name.split("-").length > 1) {
|
|
18
|
+
this.name = `['${name}']`;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.name = name;
|
|
22
|
+
}
|
|
16
23
|
this.required = required;
|
|
17
|
-
this.name = name;
|
|
18
24
|
this.type = type;
|
|
19
|
-
this.example = this.getExample(
|
|
25
|
+
this.example = isEmpty ? this.getEmptyExample() : this.getExample(example);
|
|
20
26
|
this.buildedProp = this.build(schemaObject);
|
|
21
27
|
if (description)
|
|
22
28
|
this.description = description;
|
|
@@ -26,20 +32,23 @@ export class ZodProperty {
|
|
|
26
32
|
const dto = cavalos[cavalos.length - 1];
|
|
27
33
|
return dto;
|
|
28
34
|
}
|
|
29
|
-
|
|
30
|
-
if (example)
|
|
31
|
-
return example;
|
|
35
|
+
getEmptyExample() {
|
|
32
36
|
switch (this.type) {
|
|
33
37
|
case "number":
|
|
34
|
-
return
|
|
38
|
+
return 0;
|
|
35
39
|
case "boolean":
|
|
36
|
-
return
|
|
40
|
+
return false;
|
|
37
41
|
case "string":
|
|
38
|
-
return "
|
|
42
|
+
return "";
|
|
39
43
|
default:
|
|
40
|
-
return "
|
|
44
|
+
return "";
|
|
41
45
|
}
|
|
42
46
|
}
|
|
47
|
+
getExample(example) {
|
|
48
|
+
if (example)
|
|
49
|
+
return example;
|
|
50
|
+
return this.getEmptyExample();
|
|
51
|
+
}
|
|
43
52
|
deepValidator() {
|
|
44
53
|
if (this.name === "email") {
|
|
45
54
|
return `z.email().default('${this.example}')`;
|
|
@@ -54,30 +63,34 @@ export class ZodProperty {
|
|
|
54
63
|
isNullable() {
|
|
55
64
|
return this.required ? "" : ".nullable()";
|
|
56
65
|
}
|
|
66
|
+
treatName(name) {
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
57
69
|
build(value) {
|
|
58
|
-
const
|
|
70
|
+
const name = this.treatName(this.name);
|
|
71
|
+
const x = `${name}: z.${this.type}()${this.isNullable()}`;
|
|
59
72
|
switch (this.type) {
|
|
60
73
|
case "string": {
|
|
61
74
|
const deepValidation = this.deepValidator();
|
|
62
|
-
return deepValidation ? `${
|
|
75
|
+
return deepValidation ? `${name}: ${deepValidation}` : `${x}.default('${this.example}')`;
|
|
63
76
|
}
|
|
64
77
|
case "boolean":
|
|
65
78
|
return `${x}.default(${this.example})`;
|
|
66
79
|
case "number": {
|
|
67
|
-
const number = JSON.stringify(this.example) ??
|
|
80
|
+
const number = JSON.stringify(this.example) ?? 0;
|
|
68
81
|
return `${x}.default(${sanitizeNumber(number)})`;
|
|
69
82
|
}
|
|
70
83
|
case "array": {
|
|
71
84
|
if (!value.items || !("$ref" in value.items)) {
|
|
72
|
-
return `${
|
|
85
|
+
return `${name}: z.${this.type}(z.${value.items?.type || "string"}())${this.isNullable()}.default([])`;
|
|
73
86
|
}
|
|
74
87
|
const dto = this.getDtoName(value.items.$ref);
|
|
75
|
-
return `${
|
|
88
|
+
return `${name}: z.array(${dto}Schema).default(new Array(10).fill(${dto}Schema.parse({})))`;
|
|
76
89
|
}
|
|
77
90
|
case "object":
|
|
78
|
-
return `${
|
|
91
|
+
return `${name}: z.any()`;
|
|
79
92
|
default:
|
|
80
|
-
return `${
|
|
93
|
+
return `${name}: z.any()`;
|
|
81
94
|
}
|
|
82
95
|
}
|
|
83
96
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// AUTO GERADO. QUEM ALTERAR GOSTA DE RAPAZES!
|
|
2
|
+
import repo from "$repository/main";
|
|
3
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
4
|
+
import { PUBLIC_ENVIRONMENT } from "$env/static/public";
|
|
5
|
+
import { AdminChangeUserStatusDtoSchema, EmptyAdminChangeUserStatusDtoSchema, AdminChangeUserStatusResponseSchema, } from "$reflector/schemas";
|
|
6
|
+
export class AccountAdminModule {
|
|
7
|
+
loading = $state(false);
|
|
8
|
+
/** Mudar status de um usuário */
|
|
9
|
+
async inactivate(behavior = new Behavior()) {
|
|
10
|
+
const { onError, onSuccess } = behavior;
|
|
11
|
+
const endpoint = "admin/account";
|
|
12
|
+
try {
|
|
13
|
+
const response = await repo.api.delete({
|
|
14
|
+
endpoint,
|
|
15
|
+
queryData: {},
|
|
16
|
+
});
|
|
17
|
+
onSuccess?.();
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
onError?.(e);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
this.loading = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
reset() { }
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
2
|
+
export declare class OwnerAdminModule {
|
|
3
|
+
loading: any;
|
|
4
|
+
parameters: any;
|
|
5
|
+
list: any;
|
|
6
|
+
ownerEntity: any;
|
|
7
|
+
/** Lista os owners */
|
|
8
|
+
findAll(behavior?: Behavior): Promise<any>;
|
|
9
|
+
/** Pegar dados de um owner */
|
|
10
|
+
findOne(behavior?: Behavior): Promise<any>;
|
|
11
|
+
clearParameters(): void;
|
|
12
|
+
clearList(): void;
|
|
13
|
+
clearownerEntity(): void;
|
|
14
|
+
reset(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// AUTO GERADO. QUEM ALTERAR GOSTA DE RAPAZES!
|
|
2
|
+
import repo from "$repository/main";
|
|
3
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
4
|
+
import { PUBLIC_ENVIRONMENT } from "$env/static/public";
|
|
5
|
+
import z from "zod";
|
|
6
|
+
import {} from "$reflector/schemas";
|
|
7
|
+
const ParametersSchema = z.object({
|
|
8
|
+
page: z.number().default(1),
|
|
9
|
+
limit: z.number().default(10),
|
|
10
|
+
name: z.string().default(""),
|
|
11
|
+
status: z.string().default(""),
|
|
12
|
+
userId: z.string().default(""),
|
|
13
|
+
});
|
|
14
|
+
export class OwnerAdminModule {
|
|
15
|
+
loading = $state(false);
|
|
16
|
+
parameters = $state(repo.newForm(ParametersSchema));
|
|
17
|
+
list = $state([]);
|
|
18
|
+
ownerEntity = $state();
|
|
19
|
+
/** Lista os owners */
|
|
20
|
+
async findAll(behavior = new Behavior()) {
|
|
21
|
+
const { onError, onSuccess } = behavior;
|
|
22
|
+
const endpoint = "admin/account/owner";
|
|
23
|
+
try {
|
|
24
|
+
const bundle = repo.intercept.bundle(this.parameters);
|
|
25
|
+
const { page, limit, name, status } = bundle;
|
|
26
|
+
const response = await repo.api.get({
|
|
27
|
+
endpoint,
|
|
28
|
+
queryData: { page, limit, name, status },
|
|
29
|
+
});
|
|
30
|
+
const { data: { data }, ...params } = response;
|
|
31
|
+
this.list = data;
|
|
32
|
+
repo.intercept.rebuild(this.parameters, params);
|
|
33
|
+
onSuccess?.();
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
onError?.(e);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
this.loading = false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Pegar dados de um owner */
|
|
44
|
+
async findOne(behavior = new Behavior()) {
|
|
45
|
+
const { onError, onSuccess } = behavior;
|
|
46
|
+
const endpoint = "admin/account/owner";
|
|
47
|
+
try {
|
|
48
|
+
const bundle = repo.intercept.bundle(this.parameters);
|
|
49
|
+
const { userId } = bundle;
|
|
50
|
+
const response = await repo.api.get({
|
|
51
|
+
endpoint,
|
|
52
|
+
queryData: { userId },
|
|
53
|
+
});
|
|
54
|
+
this.ownerEntity = response;
|
|
55
|
+
onSuccess?.();
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
onError?.(e);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
this.loading = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
clearParameters() {
|
|
66
|
+
this.parameters = repo.newForm(ParametersSchema);
|
|
67
|
+
}
|
|
68
|
+
clearList() {
|
|
69
|
+
this.list = [];
|
|
70
|
+
}
|
|
71
|
+
clearownerEntity() {
|
|
72
|
+
this.ownerEntity = undefined;
|
|
73
|
+
}
|
|
74
|
+
reset() {
|
|
75
|
+
this.clearParameters();
|
|
76
|
+
this.clearList();
|
|
77
|
+
this.clearownerEntity();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
2
|
+
export declare class KycAdminModule {
|
|
3
|
+
loading: any;
|
|
4
|
+
parameters: any;
|
|
5
|
+
configEntity: any;
|
|
6
|
+
list: any;
|
|
7
|
+
attemptEntity: any;
|
|
8
|
+
forms: any;
|
|
9
|
+
constructor(params?: {
|
|
10
|
+
empty: boolean;
|
|
11
|
+
});
|
|
12
|
+
private buildForms;
|
|
13
|
+
/** Configuração global para gerenciamento de KYC dos Tenant Owners */
|
|
14
|
+
createOrUpdateConfig(behavior?: Behavior): Promise<any>;
|
|
15
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
16
|
+
createOrUpdateConfigAndClear(behavior?: Behavior): Promise<any>;
|
|
17
|
+
/** Obtém configuração de KYC global */
|
|
18
|
+
getConfig(behavior?: Behavior): Promise<any>;
|
|
19
|
+
/** Lista tentativas de KYC dos Tenant Owners */
|
|
20
|
+
listKycAttempts(behavior?: Behavior): Promise<any>;
|
|
21
|
+
/** Obtém tentativa de KYC de um Tenant Owner */
|
|
22
|
+
getKycAttemptById(behavior?: Behavior): Promise<any>;
|
|
23
|
+
/** Ao aprovar uma tentativa de KYC, todos os documentos são aprovados automaticamente. */
|
|
24
|
+
approveKycAttemptById(behavior?: Behavior): Promise<any>;
|
|
25
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
26
|
+
approveKycAttemptByIdAndClear(behavior?: Behavior): Promise<any>;
|
|
27
|
+
/** Rejeita definitivamente a tentativa de KYC. Use "request-correction" se o usuário puder corrigir. */
|
|
28
|
+
rejectKycAttemptById(behavior?: Behavior): Promise<any>;
|
|
29
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
30
|
+
rejectKycAttemptByIdAndClear(behavior?: Behavior): Promise<any>;
|
|
31
|
+
/** Solicita correção ao usuário, permitindo que ele edite os dados e documentos e reenvie a tentativa. */
|
|
32
|
+
requestKycCorrection(behavior?: Behavior): Promise<any>;
|
|
33
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
34
|
+
requestKycCorrectionAndClear(behavior?: Behavior): Promise<any>;
|
|
35
|
+
/** Aprova um documento específico de uma tentativa de KYC em análise. */
|
|
36
|
+
approveKycDocument(behavior?: Behavior): Promise<any>;
|
|
37
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
38
|
+
approveKycDocumentAndClear(behavior?: Behavior): Promise<any>;
|
|
39
|
+
/** Rejeita um documento específico de uma tentativa de KYC em análise. */
|
|
40
|
+
rejectKycDocument(behavior?: Behavior): Promise<any>;
|
|
41
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
42
|
+
rejectKycDocumentAndClear(behavior?: Behavior): Promise<any>;
|
|
43
|
+
clearParameters(): void;
|
|
44
|
+
clearconfigEntity(): void;
|
|
45
|
+
clearList(): void;
|
|
46
|
+
clearattemptEntity(): void;
|
|
47
|
+
clearForms(): void;
|
|
48
|
+
reset(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// AUTO GERADO. QUEM ALTERAR GOSTA DE RAPAZES!
|
|
2
|
+
import repo from "$repository/main";
|
|
3
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
4
|
+
import { PUBLIC_ENVIRONMENT } from "$env/static/public";
|
|
5
|
+
import z from "zod";
|
|
6
|
+
import { KycConfigCreateAdminDtoSchema, EmptyKycConfigCreateAdminDtoSchema, KycAttemptApproveAdminDtoSchema, EmptyKycAttemptApproveAdminDtoSchema, KycAttemptRejectAdminDtoSchema, EmptyKycAttemptRejectAdminDtoSchema, KycDocumentRejectAdminDtoSchema, EmptyKycDocumentRejectAdminDtoSchema, } from "$reflector/schemas";
|
|
7
|
+
const ParametersSchema = z.object({
|
|
8
|
+
page: z.number().default(1),
|
|
9
|
+
limit: z.number().default(10),
|
|
10
|
+
status: z.string().default(""),
|
|
11
|
+
accountId: z.string().default(""),
|
|
12
|
+
id: z.string().default(""),
|
|
13
|
+
documentId: z.string().default(""),
|
|
14
|
+
});
|
|
15
|
+
export class KycAdminModule {
|
|
16
|
+
loading = $state(false);
|
|
17
|
+
parameters = $state(repo.newForm(ParametersSchema));
|
|
18
|
+
configEntity = $state();
|
|
19
|
+
list = $state([]);
|
|
20
|
+
attemptEntity = $state();
|
|
21
|
+
forms = $state({
|
|
22
|
+
createOrUpdateConfig: repo.newForm(EmptyKycConfigCreateAdminDtoSchema),
|
|
23
|
+
approveKycAttemptById: repo.newForm(EmptyKycAttemptApproveAdminDtoSchema),
|
|
24
|
+
rejectKycAttemptById: repo.newForm(EmptyKycAttemptRejectAdminDtoSchema),
|
|
25
|
+
requestKycCorrection: repo.newForm(EmptyKycAttemptRejectAdminDtoSchema),
|
|
26
|
+
rejectKycDocument: repo.newForm(EmptyKycDocumentRejectAdminDtoSchema),
|
|
27
|
+
});
|
|
28
|
+
constructor(params) {
|
|
29
|
+
const isEmpty = params?.empty || PUBLIC_ENVIRONMENT != "DEV";
|
|
30
|
+
this.forms = this.buildForms(isEmpty);
|
|
31
|
+
}
|
|
32
|
+
buildForms(isEmpty) {
|
|
33
|
+
if (isEmpty)
|
|
34
|
+
return this.forms;
|
|
35
|
+
return {
|
|
36
|
+
createOrUpdateConfig: repo.newForm(KycConfigCreateAdminDtoSchema),
|
|
37
|
+
approveKycAttemptById: repo.newForm(KycAttemptApproveAdminDtoSchema),
|
|
38
|
+
rejectKycAttemptById: repo.newForm(KycAttemptRejectAdminDtoSchema),
|
|
39
|
+
requestKycCorrection: repo.newForm(KycAttemptRejectAdminDtoSchema),
|
|
40
|
+
rejectKycDocument: repo.newForm(KycDocumentRejectAdminDtoSchema),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Configuração global para gerenciamento de KYC dos Tenant Owners */
|
|
44
|
+
async createOrUpdateConfig(behavior = new Behavior()) {
|
|
45
|
+
const { onError, onSuccess } = behavior;
|
|
46
|
+
const endpoint = "admin/kyc/config";
|
|
47
|
+
this.loading = true;
|
|
48
|
+
const data = repo.intercept.bundle(this.forms.createOrUpdateConfig);
|
|
49
|
+
try {
|
|
50
|
+
const response = await repo.api.put({
|
|
51
|
+
endpoint,
|
|
52
|
+
data,
|
|
53
|
+
});
|
|
54
|
+
onSuccess?.();
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
onError?.(e);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
this.loading = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
65
|
+
async createOrUpdateConfigAndClear(behavior = new Behavior()) {
|
|
66
|
+
const data = await this.createOrUpdateConfig(behavior);
|
|
67
|
+
if (data) {
|
|
68
|
+
this.clearForms();
|
|
69
|
+
}
|
|
70
|
+
return data;
|
|
71
|
+
}
|
|
72
|
+
/** Obtém configuração de KYC global */
|
|
73
|
+
async getConfig(behavior = new Behavior()) {
|
|
74
|
+
const { onError, onSuccess } = behavior;
|
|
75
|
+
const endpoint = "admin/kyc/config";
|
|
76
|
+
try {
|
|
77
|
+
const response = await repo.api.get({
|
|
78
|
+
endpoint,
|
|
79
|
+
queryData: {},
|
|
80
|
+
});
|
|
81
|
+
this.configEntity = response;
|
|
82
|
+
onSuccess?.();
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
onError?.(e);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
this.loading = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Lista tentativas de KYC dos Tenant Owners */
|
|
93
|
+
async listKycAttempts(behavior = new Behavior()) {
|
|
94
|
+
const { onError, onSuccess } = behavior;
|
|
95
|
+
const endpoint = "admin/kyc/attempts";
|
|
96
|
+
try {
|
|
97
|
+
const bundle = repo.intercept.bundle(this.parameters);
|
|
98
|
+
const { page, limit, status, accountId } = bundle;
|
|
99
|
+
const response = await repo.api.get({
|
|
100
|
+
endpoint,
|
|
101
|
+
queryData: { page, limit, status, accountId },
|
|
102
|
+
});
|
|
103
|
+
const { data: { data }, ...params } = response;
|
|
104
|
+
this.list = data;
|
|
105
|
+
repo.intercept.rebuild(this.parameters, params);
|
|
106
|
+
onSuccess?.();
|
|
107
|
+
return response;
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
onError?.(e);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
this.loading = false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Obtém tentativa de KYC de um Tenant Owner */
|
|
117
|
+
async getKycAttemptById(behavior = new Behavior()) {
|
|
118
|
+
const { onError, onSuccess } = behavior;
|
|
119
|
+
const endpoint = "admin/kyc/attempts";
|
|
120
|
+
try {
|
|
121
|
+
const bundle = repo.intercept.bundle(this.parameters);
|
|
122
|
+
const { id } = bundle;
|
|
123
|
+
const response = await repo.api.get({
|
|
124
|
+
endpoint,
|
|
125
|
+
queryData: { id },
|
|
126
|
+
});
|
|
127
|
+
this.attemptEntity = response;
|
|
128
|
+
onSuccess?.();
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
onError?.(e);
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
this.loading = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** Ao aprovar uma tentativa de KYC, todos os documentos são aprovados automaticamente. */
|
|
139
|
+
async approveKycAttemptById(behavior = new Behavior()) {
|
|
140
|
+
const { onError, onSuccess } = behavior;
|
|
141
|
+
const endpoint = "admin/kyc/attempts/approve";
|
|
142
|
+
this.loading = true;
|
|
143
|
+
const data = repo.intercept.bundle(this.forms.approveKycAttemptById);
|
|
144
|
+
try {
|
|
145
|
+
const response = await repo.api.put({
|
|
146
|
+
endpoint,
|
|
147
|
+
data,
|
|
148
|
+
});
|
|
149
|
+
onSuccess?.();
|
|
150
|
+
return response;
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
onError?.(e);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
this.loading = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
160
|
+
async approveKycAttemptByIdAndClear(behavior = new Behavior()) {
|
|
161
|
+
const data = await this.approveKycAttemptById(behavior);
|
|
162
|
+
if (data) {
|
|
163
|
+
this.clearForms();
|
|
164
|
+
}
|
|
165
|
+
return data;
|
|
166
|
+
}
|
|
167
|
+
/** Rejeita definitivamente a tentativa de KYC. Use "request-correction" se o usuário puder corrigir. */
|
|
168
|
+
async rejectKycAttemptById(behavior = new Behavior()) {
|
|
169
|
+
const { onError, onSuccess } = behavior;
|
|
170
|
+
const endpoint = "admin/kyc/attempts/reject";
|
|
171
|
+
this.loading = true;
|
|
172
|
+
const data = repo.intercept.bundle(this.forms.rejectKycAttemptById);
|
|
173
|
+
try {
|
|
174
|
+
const response = await repo.api.post({
|
|
175
|
+
endpoint,
|
|
176
|
+
data,
|
|
177
|
+
});
|
|
178
|
+
onSuccess?.();
|
|
179
|
+
return response;
|
|
180
|
+
}
|
|
181
|
+
catch (e) {
|
|
182
|
+
onError?.(e);
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
this.loading = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
189
|
+
async rejectKycAttemptByIdAndClear(behavior = new Behavior()) {
|
|
190
|
+
const data = await this.rejectKycAttemptById(behavior);
|
|
191
|
+
if (data) {
|
|
192
|
+
this.clearForms();
|
|
193
|
+
}
|
|
194
|
+
return data;
|
|
195
|
+
}
|
|
196
|
+
/** Solicita correção ao usuário, permitindo que ele edite os dados e documentos e reenvie a tentativa. */
|
|
197
|
+
async requestKycCorrection(behavior = new Behavior()) {
|
|
198
|
+
const { onError, onSuccess } = behavior;
|
|
199
|
+
const endpoint = "admin/kyc/attempts/request-correction";
|
|
200
|
+
this.loading = true;
|
|
201
|
+
const data = repo.intercept.bundle(this.forms.requestKycCorrection);
|
|
202
|
+
try {
|
|
203
|
+
const response = await repo.api.post({
|
|
204
|
+
endpoint,
|
|
205
|
+
data,
|
|
206
|
+
});
|
|
207
|
+
onSuccess?.();
|
|
208
|
+
return response;
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
onError?.(e);
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
this.loading = false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
218
|
+
async requestKycCorrectionAndClear(behavior = new Behavior()) {
|
|
219
|
+
const data = await this.requestKycCorrection(behavior);
|
|
220
|
+
if (data) {
|
|
221
|
+
this.clearForms();
|
|
222
|
+
}
|
|
223
|
+
return data;
|
|
224
|
+
}
|
|
225
|
+
/** Aprova um documento específico de uma tentativa de KYC em análise. */
|
|
226
|
+
async approveKycDocument(behavior = new Behavior()) {
|
|
227
|
+
const { onError, onSuccess } = behavior;
|
|
228
|
+
const endpoint = "admin/kyc/documents/approve";
|
|
229
|
+
this.loading = true;
|
|
230
|
+
try {
|
|
231
|
+
const response = await repo.api.put({
|
|
232
|
+
endpoint,
|
|
233
|
+
});
|
|
234
|
+
onSuccess?.();
|
|
235
|
+
return response;
|
|
236
|
+
}
|
|
237
|
+
catch (e) {
|
|
238
|
+
onError?.(e);
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
this.loading = false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
245
|
+
async approveKycDocumentAndClear(behavior = new Behavior()) {
|
|
246
|
+
const data = await this.approveKycDocument(behavior);
|
|
247
|
+
if (data) {
|
|
248
|
+
this.clearForms();
|
|
249
|
+
}
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
252
|
+
/** Rejeita um documento específico de uma tentativa de KYC em análise. */
|
|
253
|
+
async rejectKycDocument(behavior = new Behavior()) {
|
|
254
|
+
const { onError, onSuccess } = behavior;
|
|
255
|
+
const endpoint = "admin/kyc/documents/reject";
|
|
256
|
+
this.loading = true;
|
|
257
|
+
const data = repo.intercept.bundle(this.forms.rejectKycDocument);
|
|
258
|
+
try {
|
|
259
|
+
const response = await repo.api.post({
|
|
260
|
+
endpoint,
|
|
261
|
+
data,
|
|
262
|
+
});
|
|
263
|
+
onSuccess?.();
|
|
264
|
+
return response;
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
onError?.(e);
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
this.loading = false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
274
|
+
async rejectKycDocumentAndClear(behavior = new Behavior()) {
|
|
275
|
+
const data = await this.rejectKycDocument(behavior);
|
|
276
|
+
if (data) {
|
|
277
|
+
this.clearForms();
|
|
278
|
+
}
|
|
279
|
+
return data;
|
|
280
|
+
}
|
|
281
|
+
clearParameters() {
|
|
282
|
+
this.parameters = repo.newForm(ParametersSchema);
|
|
283
|
+
}
|
|
284
|
+
clearconfigEntity() {
|
|
285
|
+
this.configEntity = undefined;
|
|
286
|
+
}
|
|
287
|
+
clearList() {
|
|
288
|
+
this.list = [];
|
|
289
|
+
}
|
|
290
|
+
clearattemptEntity() {
|
|
291
|
+
this.attemptEntity = undefined;
|
|
292
|
+
}
|
|
293
|
+
clearForms() {
|
|
294
|
+
this.forms = this.buildForms(true);
|
|
295
|
+
}
|
|
296
|
+
reset() {
|
|
297
|
+
this.clearParameters();
|
|
298
|
+
this.clearconfigEntity();
|
|
299
|
+
this.clearList();
|
|
300
|
+
this.clearattemptEntity();
|
|
301
|
+
this.clearForms();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
2
|
+
export declare class PolicyAdminModule {
|
|
3
|
+
loading: any;
|
|
4
|
+
parameters: any;
|
|
5
|
+
/** Remove uma política de sistema */
|
|
6
|
+
removeSystemPolicy(behavior?: Behavior): Promise<any>;
|
|
7
|
+
clearParameters(): void;
|
|
8
|
+
reset(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// AUTO GERADO. QUEM ALTERAR GOSTA DE RAPAZES!
|
|
2
|
+
import repo from "$repository/main";
|
|
3
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
4
|
+
import { PUBLIC_ENVIRONMENT } from "$env/static/public";
|
|
5
|
+
import z from "zod";
|
|
6
|
+
const ParametersSchema = z.object({ policyId: z.string().default("") });
|
|
7
|
+
export class PolicyAdminModule {
|
|
8
|
+
loading = $state(false);
|
|
9
|
+
parameters = $state(repo.newForm(ParametersSchema));
|
|
10
|
+
/** Remove uma política de sistema */
|
|
11
|
+
async removeSystemPolicy(behavior = new Behavior()) {
|
|
12
|
+
const { onError, onSuccess } = behavior;
|
|
13
|
+
const endpoint = "admin/policy/system";
|
|
14
|
+
try {
|
|
15
|
+
const { policyId } = this.parameters;
|
|
16
|
+
const response = await repo.api.delete({
|
|
17
|
+
endpoint,
|
|
18
|
+
queryData: { policyId },
|
|
19
|
+
});
|
|
20
|
+
onSuccess?.();
|
|
21
|
+
return response;
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
onError?.(e);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
this.loading = false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
clearParameters() {
|
|
31
|
+
this.parameters = repo.newForm(ParametersSchema);
|
|
32
|
+
}
|
|
33
|
+
reset() {
|
|
34
|
+
this.clearParameters();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Behavior } from "$reflector/reflector.types";
|
|
2
|
+
export declare class SmtpAdminModule {
|
|
3
|
+
loading: any;
|
|
4
|
+
smtpConfig: any;
|
|
5
|
+
forms: any;
|
|
6
|
+
constructor(params?: {
|
|
7
|
+
empty: boolean;
|
|
8
|
+
});
|
|
9
|
+
private buildForms;
|
|
10
|
+
/** Obtém configuração de Email */
|
|
11
|
+
getConfig(behavior?: Behavior): Promise<any>;
|
|
12
|
+
/** Atualiza as configurações de Email */
|
|
13
|
+
saveConfig(behavior?: Behavior): Promise<any>;
|
|
14
|
+
/** Limpa o form depois do back retornar uma resposta de sucesso */
|
|
15
|
+
saveConfigAndClear(behavior?: Behavior): Promise<any>;
|
|
16
|
+
clearsmtpConfig(): void;
|
|
17
|
+
clearForms(): void;
|
|
18
|
+
reset(): void;
|
|
19
|
+
}
|