@hed-hog/contact 0.0.279 → 0.0.286
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/README.md +2 -0
- package/dist/contact.service.d.ts +2 -148
- package/dist/contact.service.d.ts.map +1 -1
- package/dist/person/dto/create-followup.dto.d.ts +5 -0
- package/dist/person/dto/create-followup.dto.d.ts.map +1 -0
- package/dist/person/dto/create-followup.dto.js +31 -0
- package/dist/person/dto/create-followup.dto.js.map +1 -0
- package/dist/person/dto/create-interaction.dto.d.ts +12 -0
- package/dist/person/dto/create-interaction.dto.d.ts.map +1 -0
- package/dist/person/dto/create-interaction.dto.js +39 -0
- package/dist/person/dto/create-interaction.dto.js.map +1 -0
- package/dist/person/dto/create.dto.d.ts +24 -0
- package/dist/person/dto/create.dto.d.ts.map +1 -1
- package/dist/person/dto/create.dto.js +56 -1
- package/dist/person/dto/create.dto.js.map +1 -1
- package/dist/person/dto/duplicates-query.dto.d.ts +8 -0
- package/dist/person/dto/duplicates-query.dto.d.ts.map +1 -0
- package/dist/person/dto/duplicates-query.dto.js +45 -0
- package/dist/person/dto/duplicates-query.dto.js.map +1 -0
- package/dist/person/dto/merge.dto.d.ts +6 -0
- package/dist/person/dto/merge.dto.d.ts.map +1 -0
- package/dist/person/dto/merge.dto.js +35 -0
- package/dist/person/dto/merge.dto.js.map +1 -0
- package/dist/person/dto/update-lifecycle-stage.dto.d.ts +13 -0
- package/dist/person/dto/update-lifecycle-stage.dto.d.ts.map +1 -0
- package/dist/person/dto/update-lifecycle-stage.dto.js +34 -0
- package/dist/person/dto/update-lifecycle-stage.dto.js.map +1 -0
- package/dist/person/dto/update.dto.d.ts +8 -1
- package/dist/person/dto/update.dto.d.ts.map +1 -1
- package/dist/person/dto/update.dto.js +36 -0
- package/dist/person/dto/update.dto.js.map +1 -1
- package/dist/person/person.controller.d.ts +57 -1
- package/dist/person/person.controller.d.ts.map +1 -1
- package/dist/person/person.controller.js +85 -3
- package/dist/person/person.controller.js.map +1 -1
- package/dist/person/person.service.d.ts +79 -0
- package/dist/person/person.service.d.ts.map +1 -1
- package/dist/person/person.service.js +730 -9
- package/dist/person/person.service.js.map +1 -1
- package/hedhog/data/route.yaml +18 -0
- package/hedhog/frontend/app/_components/crm-coming-soon.tsx.ejs +110 -110
- package/hedhog/frontend/app/_components/crm-nav.tsx.ejs +73 -73
- package/hedhog/frontend/app/_lib/crm-mocks.ts.ejs +498 -256
- package/hedhog/frontend/app/_lib/crm-sections.tsx.ejs +81 -81
- package/hedhog/frontend/app/accounts/_components/account-form-sheet.tsx.ejs +477 -0
- package/hedhog/frontend/app/accounts/_components/account-types.ts.ejs +62 -0
- package/hedhog/frontend/app/accounts/page.tsx.ejs +892 -15
- package/hedhog/frontend/app/activities/page.tsx.ejs +812 -15
- package/hedhog/frontend/app/contact-type/page.tsx.ejs +105 -91
- package/hedhog/frontend/app/dashboard/page.tsx.ejs +491 -573
- package/hedhog/frontend/app/document-type/page.tsx.ejs +105 -91
- package/hedhog/frontend/app/follow-ups/page.tsx.ejs +696 -15
- package/hedhog/frontend/app/page.tsx.ejs +5 -5
- package/hedhog/frontend/app/person/_components/person-form-sheet.tsx.ejs +1440 -1103
- package/hedhog/frontend/app/person/_components/person-interaction-dialog.tsx.ejs +4 -3
- package/hedhog/frontend/app/person/_components/person-types.ts.ejs +14 -0
- package/hedhog/frontend/app/person/page.tsx.ejs +112 -190
- package/hedhog/frontend/app/pipeline/_components/lead-detail-sheet.tsx.ejs +599 -0
- package/hedhog/frontend/app/pipeline/page.tsx.ejs +1048 -299
- package/hedhog/frontend/app/reports/page.tsx.ejs +15 -15
- package/hedhog/frontend/messages/en.json +268 -0
- package/hedhog/frontend/messages/pt.json +233 -0
- package/package.json +6 -6
- package/src/contact.service.ts +2 -2
- package/src/person/dto/create-followup.dto.ts +15 -0
- package/src/person/dto/create-interaction.dto.ts +23 -0
- package/src/person/dto/create.dto.ts +50 -0
- package/src/person/dto/duplicates-query.dto.ts +34 -0
- package/src/person/dto/merge.dto.ts +15 -0
- package/src/person/dto/update-lifecycle-stage.dto.ts +19 -0
- package/src/person/dto/update.dto.ts +31 -1
- package/src/person/person.controller.ts +63 -2
- package/src/person/person.service.ts +1096 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
+
import { IsDateString, IsOptional, IsString } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class CreateFollowupDTO {
|
|
5
|
+
@IsDateString({}, {
|
|
6
|
+
message: (args) => getLocaleText('validation.dateMustBeString', args.value),
|
|
7
|
+
})
|
|
8
|
+
next_action_at: string;
|
|
9
|
+
|
|
10
|
+
@IsOptional()
|
|
11
|
+
@IsString({
|
|
12
|
+
message: (args) => getLocaleText('validation.notesMustBeString', args.value),
|
|
13
|
+
})
|
|
14
|
+
notes?: string | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
+
import { IsEnum, IsOptional, IsString } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export enum PersonInteractionTypeDTO {
|
|
5
|
+
CALL = 'call',
|
|
6
|
+
EMAIL = 'email',
|
|
7
|
+
WHATSAPP = 'whatsapp',
|
|
8
|
+
MEETING = 'meeting',
|
|
9
|
+
NOTE = 'note',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class CreateInteractionDTO {
|
|
13
|
+
@IsEnum(PersonInteractionTypeDTO, {
|
|
14
|
+
message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
|
|
15
|
+
})
|
|
16
|
+
type: PersonInteractionTypeDTO;
|
|
17
|
+
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@IsString({
|
|
20
|
+
message: (args) => getLocaleText('validation.notesMustBeString', args.value),
|
|
21
|
+
})
|
|
22
|
+
notes?: string | null;
|
|
23
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
2
|
import {
|
|
3
|
+
IsArray,
|
|
3
4
|
IsDateString,
|
|
4
5
|
IsEnum,
|
|
5
6
|
IsInt,
|
|
6
7
|
IsOptional,
|
|
8
|
+
IsNumber,
|
|
7
9
|
IsString,
|
|
8
10
|
} from 'class-validator';
|
|
9
11
|
|
|
@@ -23,6 +25,25 @@ export enum PersonGender {
|
|
|
23
25
|
OTHER = 'other'
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
export enum PersonSource {
|
|
29
|
+
REFERRAL = 'referral',
|
|
30
|
+
WEBSITE = 'website',
|
|
31
|
+
SOCIAL = 'social',
|
|
32
|
+
INBOUND = 'inbound',
|
|
33
|
+
OUTBOUND = 'outbound',
|
|
34
|
+
OTHER = 'other',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum PersonLifecycleStage {
|
|
38
|
+
NEW = 'new',
|
|
39
|
+
CONTACTED = 'contacted',
|
|
40
|
+
QUALIFIED = 'qualified',
|
|
41
|
+
PROPOSAL = 'proposal',
|
|
42
|
+
NEGOTIATION = 'negotiation',
|
|
43
|
+
CUSTOMER = 'customer',
|
|
44
|
+
LOST = 'lost',
|
|
45
|
+
}
|
|
46
|
+
|
|
26
47
|
export class CreateDTO {
|
|
27
48
|
@IsString({ message: (args) => getLocaleText('validation.nameMustBeString', args.value) })
|
|
28
49
|
name: string;
|
|
@@ -68,4 +89,33 @@ export class CreateDTO {
|
|
|
68
89
|
@IsOptional()
|
|
69
90
|
@IsInt({ message: (args) => getLocaleText('validation.idMustBeInteger', args.value) })
|
|
70
91
|
employer_company_id?: number | null;
|
|
92
|
+
|
|
93
|
+
@IsOptional()
|
|
94
|
+
@IsInt({ message: (args) => getLocaleText('validation.idMustBeInteger', args.value) })
|
|
95
|
+
owner_user_id?: number | null;
|
|
96
|
+
|
|
97
|
+
@IsOptional()
|
|
98
|
+
@IsEnum(PersonSource, { message: (args) => getLocaleText('validation.typeMustBeEnum', args.value) })
|
|
99
|
+
source?: PersonSource | null;
|
|
100
|
+
|
|
101
|
+
@IsOptional()
|
|
102
|
+
@IsEnum(PersonLifecycleStage, { message: (args) => getLocaleText('validation.typeMustBeEnum', args.value) })
|
|
103
|
+
lifecycle_stage?: PersonLifecycleStage | null;
|
|
104
|
+
|
|
105
|
+
@IsOptional()
|
|
106
|
+
@IsDateString({}, { message: (args) => getLocaleText('validation.dateMustBeString', args.value) })
|
|
107
|
+
next_action_at?: string | null;
|
|
108
|
+
|
|
109
|
+
@IsOptional()
|
|
110
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberMustBeNumber', args.value) })
|
|
111
|
+
score?: number | null;
|
|
112
|
+
|
|
113
|
+
@IsOptional()
|
|
114
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberMustBeNumber', args.value) })
|
|
115
|
+
deal_value?: number | null;
|
|
116
|
+
|
|
117
|
+
@IsOptional()
|
|
118
|
+
@IsArray({ message: (args) => getLocaleText('validation.tagsMustBeArray', args.value) })
|
|
119
|
+
@IsString({ each: true, message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
120
|
+
tags?: string[] | null;
|
|
71
121
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsEmail,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsOptional,
|
|
6
|
+
IsString,
|
|
7
|
+
ValidateIf,
|
|
8
|
+
} from 'class-validator';
|
|
9
|
+
|
|
10
|
+
export class CheckPersonDuplicatesQueryDTO {
|
|
11
|
+
@IsOptional()
|
|
12
|
+
@Type(() => Number)
|
|
13
|
+
@IsInt()
|
|
14
|
+
person_id?: number;
|
|
15
|
+
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsEmail()
|
|
18
|
+
email?: string;
|
|
19
|
+
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsString()
|
|
22
|
+
phone?: string;
|
|
23
|
+
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@IsString()
|
|
26
|
+
document_value?: string;
|
|
27
|
+
|
|
28
|
+
@ValidateIf((value: CheckPersonDuplicatesQueryDTO) =>
|
|
29
|
+
Boolean(value.document_value),
|
|
30
|
+
)
|
|
31
|
+
@Type(() => Number)
|
|
32
|
+
@IsInt()
|
|
33
|
+
document_type_id?: number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import { IsIn, IsInt } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class MergePersonDTO {
|
|
5
|
+
@Type(() => Number)
|
|
6
|
+
@IsInt()
|
|
7
|
+
source_person_id: number;
|
|
8
|
+
|
|
9
|
+
@Type(() => Number)
|
|
10
|
+
@IsInt()
|
|
11
|
+
target_person_id: number;
|
|
12
|
+
|
|
13
|
+
@IsIn(['contact_only'])
|
|
14
|
+
strategy: 'contact_only' = 'contact_only';
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
+
import { IsEnum } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export enum PersonLifecycleStageDTO {
|
|
5
|
+
NEW = 'new',
|
|
6
|
+
CONTACTED = 'contacted',
|
|
7
|
+
QUALIFIED = 'qualified',
|
|
8
|
+
PROPOSAL = 'proposal',
|
|
9
|
+
NEGOTIATION = 'negotiation',
|
|
10
|
+
CUSTOMER = 'customer',
|
|
11
|
+
LOST = 'lost',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class UpdateLifecycleStageDTO {
|
|
15
|
+
@IsEnum(PersonLifecycleStageDTO, {
|
|
16
|
+
message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
|
|
17
|
+
})
|
|
18
|
+
lifecycle_stage: PersonLifecycleStageDTO;
|
|
19
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AddressTypeEnum } from '../../address-type.enum';
|
|
2
|
-
import { PersonGender } from './create.dto';
|
|
2
|
+
import { PersonGender, PersonLifecycleStage, PersonSource } from './create.dto';
|
|
3
3
|
import { getLocaleText } from '@hed-hog/api-locale';
|
|
4
4
|
import { Type } from 'class-transformer';
|
|
5
5
|
import {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
IsDateString,
|
|
9
9
|
IsEnum,
|
|
10
10
|
IsInt,
|
|
11
|
+
IsNumber,
|
|
11
12
|
IsOptional,
|
|
12
13
|
IsString,
|
|
13
14
|
ValidateNested,
|
|
@@ -121,6 +122,35 @@ export class UpdateAllPersonDTO {
|
|
|
121
122
|
@IsInt({ message: (args) => getLocaleText('validation.idMustBeInteger', args.value) })
|
|
122
123
|
employer_company_id?: number | null;
|
|
123
124
|
|
|
125
|
+
@IsOptional()
|
|
126
|
+
@IsInt({ message: (args) => getLocaleText('validation.idMustBeInteger', args.value) })
|
|
127
|
+
owner_user_id?: number | null;
|
|
128
|
+
|
|
129
|
+
@IsOptional()
|
|
130
|
+
@IsEnum(PersonSource, { message: (args) => getLocaleText('validation.typeMustBeEnum', args.value) })
|
|
131
|
+
source?: PersonSource | null;
|
|
132
|
+
|
|
133
|
+
@IsOptional()
|
|
134
|
+
@IsEnum(PersonLifecycleStage, { message: (args) => getLocaleText('validation.typeMustBeEnum', args.value) })
|
|
135
|
+
lifecycle_stage?: PersonLifecycleStage | null;
|
|
136
|
+
|
|
137
|
+
@IsOptional()
|
|
138
|
+
@IsDateString({}, { message: (args) => getLocaleText('validation.dateMustBeString', args.value) })
|
|
139
|
+
next_action_at?: string | null;
|
|
140
|
+
|
|
141
|
+
@IsOptional()
|
|
142
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberMustBeNumber', args.value) })
|
|
143
|
+
score?: number | null;
|
|
144
|
+
|
|
145
|
+
@IsOptional()
|
|
146
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberMustBeNumber', args.value) })
|
|
147
|
+
deal_value?: number | null;
|
|
148
|
+
|
|
149
|
+
@IsOptional()
|
|
150
|
+
@IsArray({ message: (args) => getLocaleText('validation.tagsMustBeArray', args.value) })
|
|
151
|
+
@IsString({ each: true, message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
152
|
+
tags?: string[] | null;
|
|
153
|
+
|
|
124
154
|
@IsOptional()
|
|
125
155
|
@IsInt({ message: (args) => getLocaleText('validation.idMustBeInteger', args.value) })
|
|
126
156
|
headquarter_id?: number | null;
|
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
forwardRef
|
|
17
17
|
} from '@nestjs/common';
|
|
18
18
|
import { Response } from 'express';
|
|
19
|
+
import { CreateFollowupDTO } from './dto/create-followup.dto';
|
|
20
|
+
import { CreateInteractionDTO } from './dto/create-interaction.dto';
|
|
19
21
|
import { CreateDTO } from './dto/create.dto';
|
|
22
|
+
import { CheckPersonDuplicatesQueryDTO } from './dto/duplicates-query.dto';
|
|
23
|
+
import { MergePersonDTO } from './dto/merge.dto';
|
|
24
|
+
import { UpdateLifecycleStageDTO } from './dto/update-lifecycle-stage.dto';
|
|
20
25
|
import { UpdateAllPersonDTO } from './dto/update.dto';
|
|
21
26
|
import { PersonService } from './person.service';
|
|
22
27
|
|
|
@@ -38,9 +43,17 @@ export class PersonController {
|
|
|
38
43
|
return this.personService.getOwnerOptions(Number(user?.id || 0));
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
@Get('duplicates')
|
|
47
|
+
async checkDuplicates(@Query() query: CheckPersonDuplicatesQueryDTO) {
|
|
48
|
+
return this.personService.checkDuplicates(query);
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
@Get()
|
|
42
|
-
async list(@Pagination() paginationParams, @Query() filters) {
|
|
43
|
-
return this.personService.list(
|
|
52
|
+
async list(@Pagination() paginationParams, @Query() filters, @User() user) {
|
|
53
|
+
return this.personService.list(
|
|
54
|
+
{ ...paginationParams, ...filters },
|
|
55
|
+
Number(user?.id || 0),
|
|
56
|
+
);
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
@Public()
|
|
@@ -63,6 +76,54 @@ export class PersonController {
|
|
|
63
76
|
return this.personService.create(data, locale);
|
|
64
77
|
}
|
|
65
78
|
|
|
79
|
+
@Post('merge')
|
|
80
|
+
async merge(@Body() data: MergePersonDTO, @Locale() locale: string) {
|
|
81
|
+
return this.personService.merge(data, locale);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Get(':id/interaction')
|
|
85
|
+
async listInteractions(
|
|
86
|
+
@Param('id', ParseIntPipe) id: number,
|
|
87
|
+
@Locale() locale: string,
|
|
88
|
+
) {
|
|
89
|
+
return this.personService.listInteractions(id, locale);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@Post(':id/interaction')
|
|
93
|
+
async createInteraction(
|
|
94
|
+
@Param('id', ParseIntPipe) id: number,
|
|
95
|
+
@Body() data: CreateInteractionDTO,
|
|
96
|
+
@Locale() locale: string,
|
|
97
|
+
@User() user,
|
|
98
|
+
) {
|
|
99
|
+
return this.personService.createInteraction(id, data, locale, {
|
|
100
|
+
id: Number(user?.id || 0),
|
|
101
|
+
name: user?.name,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Post(':id/followup')
|
|
106
|
+
async createFollowup(
|
|
107
|
+
@Param('id', ParseIntPipe) id: number,
|
|
108
|
+
@Body() data: CreateFollowupDTO,
|
|
109
|
+
@Locale() locale: string,
|
|
110
|
+
@User() user,
|
|
111
|
+
) {
|
|
112
|
+
return this.personService.scheduleFollowup(id, data, locale, {
|
|
113
|
+
id: Number(user?.id || 0),
|
|
114
|
+
name: user?.name,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@Post(':id/lifecycle-stage')
|
|
119
|
+
async updateLifecycleStage(
|
|
120
|
+
@Param('id', ParseIntPipe) id: number,
|
|
121
|
+
@Body() data: UpdateLifecycleStageDTO,
|
|
122
|
+
@Locale() locale: string,
|
|
123
|
+
) {
|
|
124
|
+
return this.personService.updateLifecycleStage(id, data, locale);
|
|
125
|
+
}
|
|
126
|
+
|
|
66
127
|
@Patch(':id')
|
|
67
128
|
async update(
|
|
68
129
|
@Param('id', ParseIntPipe) id: number,
|