@silexpert/core 1.0.111 → 1.0.113
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/es/api/resources/Commercial.d.ts +1 -0
- package/es/api/resources/Commercial.d.ts.map +1 -1
- package/es/api/resources/Commercial.js +3 -0
- package/es/api/resources/Commercial.js.map +1 -1
- package/es/api/resources/Mail.d.ts +1 -0
- package/es/api/resources/Mail.d.ts.map +1 -1
- package/es/api/resources/Mail.js +9 -3
- package/es/api/resources/Mail.js.map +1 -1
- package/es/api/resources/TextMessage.d.ts +14 -0
- package/es/api/resources/TextMessage.d.ts.map +1 -0
- package/es/api/resources/TextMessage.js +19 -0
- package/es/api/resources/TextMessage.js.map +1 -0
- package/es/api/resources.d.ts +2 -0
- package/es/api/resources.d.ts.map +1 -1
- package/es/api/resources.js +2 -0
- package/es/api/resources.js.map +1 -1
- package/es/types/Enum/BalanceSheet.d.ts +22 -15
- package/es/types/Enum/BalanceSheet.d.ts.map +1 -1
- package/es/types/Enum/BalanceSheet.js +22 -14
- package/es/types/Enum/BalanceSheet.js.map +1 -1
- package/es/types/Enum/RoleDetail.d.ts +8 -0
- package/es/types/Enum/RoleDetail.d.ts.map +1 -1
- package/es/types/Enum/RoleDetail.js +8 -0
- package/es/types/Enum/RoleDetail.js.map +1 -1
- package/es/types/Enum/TextMessageType.d.ts +34 -0
- package/es/types/Enum/TextMessageType.d.ts.map +1 -0
- package/es/types/Enum/TextMessageType.js +37 -0
- package/es/types/Enum/TextMessageType.js.map +1 -0
- package/es/types/Interface/api/gedFile/createFileAndGed.d.ts +1 -0
- package/es/types/Interface/api/gedFile/createFileAndGed.d.ts.map +1 -1
- package/es/types/Interface/api/gedFile/createFileAndGed.js +6 -0
- package/es/types/Interface/api/gedFile/createFileAndGed.js.map +1 -1
- package/es/types/Interface/api/mail/QueryCountUnprocessedMail.d.ts +8 -0
- package/es/types/Interface/api/mail/QueryCountUnprocessedMail.d.ts.map +1 -0
- package/es/types/Interface/api/mail/{QueryCountUnprocessedByUserMail.js → QueryCountUnprocessedMail.js} +15 -8
- package/es/types/Interface/api/mail/QueryCountUnprocessedMail.js.map +1 -0
- package/es/types/Interface/api/textMessage/Create.d.ts +9 -0
- package/es/types/Interface/api/textMessage/Create.d.ts.map +1 -0
- package/es/types/Interface/api/textMessage/Create.js +40 -0
- package/es/types/Interface/api/textMessage/Create.js.map +1 -0
- package/es/types/Interface/api/textMessage/Query.d.ts +17 -0
- package/es/types/Interface/api/textMessage/Query.d.ts.map +1 -0
- package/es/types/Interface/api/textMessage/Query.js +65 -0
- package/es/types/Interface/api/textMessage/Query.js.map +1 -0
- package/es/types/Interface/api/textMessage/Read.d.ts +9 -0
- package/es/types/Interface/api/textMessage/Read.d.ts.map +1 -0
- package/es/types/Interface/api/textMessage/Read.js +2 -0
- package/es/types/Interface/api/textMessage/Read.js.map +1 -0
- package/es/types/Interface/api/textMessage/Update.d.ts +37 -0
- package/es/types/Interface/api/textMessage/Update.d.ts.map +1 -0
- package/es/types/Interface/api/textMessage/Update.js +22 -0
- package/es/types/Interface/api/textMessage/Update.js.map +1 -0
- package/es/types/Interface/models/ISms.d.ts +7 -5
- package/es/types/Interface/models/ISms.d.ts.map +1 -1
- package/es/types/Interface/models/ISms.js.map +1 -1
- package/es/types/Interface/models/IUser.d.ts +1 -0
- package/es/types/Interface/models/IUser.d.ts.map +1 -1
- package/es/types/Interface/models/IUser.js.map +1 -1
- package/es/types/index.d.ts +6 -1
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +6 -1
- package/es/types/index.js.map +1 -1
- package/es/utils/phone.d.ts +5 -0
- package/es/utils/phone.d.ts.map +1 -0
- package/es/utils/phone.js +57 -0
- package/es/utils/phone.js.map +1 -0
- package/js/api/resources/Commercial.js +4 -0
- package/js/api/resources/Commercial.js.map +1 -1
- package/js/api/resources/Mail.js +14 -3
- package/js/api/resources/Mail.js.map +1 -1
- package/js/api/resources/TextMessage.js +46 -0
- package/js/api/resources/TextMessage.js.map +1 -0
- package/js/api/resources.js +3 -0
- package/js/api/resources.js.map +1 -1
- package/js/types/Enum/BalanceSheet.js +21 -14
- package/js/types/Enum/BalanceSheet.js.map +1 -1
- package/js/types/Enum/RoleDetail.js +16 -8
- package/js/types/Enum/RoleDetail.js.map +1 -1
- package/js/types/Enum/TextMessageType.js +47 -0
- package/js/types/Enum/TextMessageType.js.map +1 -0
- package/js/types/Interface/api/gedFile/createFileAndGed.js +2 -0
- package/js/types/Interface/api/gedFile/createFileAndGed.js.map +1 -1
- package/js/types/Interface/api/mail/{QueryCountUnprocessedByUserMail.js → QueryCountUnprocessedMail.js} +10 -8
- package/js/types/Interface/api/mail/QueryCountUnprocessedMail.js.map +1 -0
- package/js/types/Interface/api/textMessage/Create.js +39 -0
- package/js/types/Interface/api/textMessage/Create.js.map +1 -0
- package/js/types/Interface/api/textMessage/Query.js +55 -0
- package/js/types/Interface/api/textMessage/Query.js.map +1 -0
- package/js/types/Interface/api/textMessage/Read.js +6 -0
- package/js/types/Interface/api/textMessage/Read.js.map +1 -0
- package/js/types/Interface/api/textMessage/Update.js +31 -0
- package/js/types/Interface/api/textMessage/Update.js.map +1 -0
- package/js/types/index.js +102 -42
- package/js/types/index.js.map +1 -1
- package/js/utils/phone.js +84 -0
- package/js/utils/phone.js.map +1 -0
- package/package.json +2 -1
- package/ts/api/resources/Commercial.ts +3 -0
- package/ts/api/resources/Mail.ts +14 -3
- package/ts/api/resources/TextMessage.ts +33 -0
- package/ts/api/resources.ts +2 -0
- package/ts/types/Enum/BalanceSheet.ts +22 -14
- package/ts/types/Enum/RoleDetail.ts +8 -0
- package/ts/types/Enum/TextMessageType.ts +35 -0
- package/ts/types/Interface/api/gedFile/createFileAndGed.ts +5 -0
- package/ts/types/Interface/api/mail/{QueryCountUnprocessedByUserMail.ts → QueryCountUnprocessedMail.ts} +10 -4
- package/ts/types/Interface/api/textMessage/Create.ts +25 -0
- package/ts/types/Interface/api/textMessage/Query.ts +51 -0
- package/ts/types/Interface/api/textMessage/Read.ts +5 -0
- package/ts/types/Interface/api/textMessage/Update.ts +46 -0
- package/ts/types/Interface/models/ISms.ts +7 -5
- package/ts/types/Interface/models/IUser.ts +1 -0
- package/ts/types/index.ts +6 -1
- package/ts/utils/phone.ts +65 -0
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.d.ts +0 -7
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.d.ts.map +0 -1
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js.map +0 -1
- package/js/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.js","mappings":"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","names":["formatPhoneNumberToE164","getPhoneNumberWithoutPrefix","countSegmentsFromMessage","getPhoneNumberFromRoles","phoneNumber","prefix","charAt","numberInt","replace","length","substring","number","Object","keys","PhonePrefix","map","index","forEach","message","SegmentedMessage","segmentsCount","roles","some","role","Role","FRONT_OFFICE","EXPERT_ACCOUNTANT","includes","RoleDetail","FRONT_OFFICE_EXPRESS","COMMERCIAL","FACTURATION","CUSTOMER_SUCCESS","JURIDIC","JURIDICAL_SUPPORT","SOCIAL"],"sourceRoot":"","sources":["../../ts/utils/phone.ts"],"sourcesContent":["import { SegmentedMessage } from 'sms-segments-calculator';\nimport { PhonePrefix } from '../types/Enum/Phone';\nimport { Role } from '../types/Enum/Role';\nimport { RoleDetail } from '../types/Enum/RoleDetail';\n\nexport function formatPhoneNumberToE164(phoneNumber: string | null, prefix = '+33'): string | null {\n if (!phoneNumber) return null;\n if (phoneNumber.charAt(0) !== '+' && phoneNumber.charAt(0) === '0') {\n const numberInt = phoneNumber.replace(/\\D/g, '');\n if (prefix) {\n if (numberInt.length === 10 && numberInt.charAt(0) === '0') {\n return `${prefix}${numberInt.substring(1)}`;\n }\n return `${prefix}${numberInt}`;\n }\n if (numberInt.charAt(0) === '0' && numberInt.length === 10) return `+33${numberInt.substring(1)}`;\n return numberInt;\n }\n return phoneNumber;\n}\n\nexport function getPhoneNumberWithoutPrefix(phoneNumber: string): string {\n let number = phoneNumber;\n // @ts-ignore\n Object.keys(PhonePrefix).map((index) => PhonePrefix[index].prefix).forEach((prefix) => {\n number = number.replace(prefix, '');\n });\n return number;\n}\n\nexport function countSegmentsFromMessage(message: string): number {\n return new SegmentedMessage(message, 'GSM-7').segmentsCount;\n}\n\nexport function getPhoneNumberFromRoles(roles: number[]): string | null {\n if (roles.some((role) => [Role.FRONT_OFFICE, Role.EXPERT_ACCOUNTANT].includes(role))) {\n return RoleDetail.FRONT_OFFICE.phoneNumber;\n }\n\n if (roles.some((role) => [Role.FRONT_OFFICE_EXPRESS].includes(role))) {\n return RoleDetail.FRONT_OFFICE_EXPRESS.phoneNumber;\n }\n\n if (roles.some((role) => [Role.COMMERCIAL].includes(role))) {\n return RoleDetail.COMMERCIAL.phoneNumber;\n }\n\n if (roles.some((role) => [Role.FACTURATION].includes(role))) {\n return RoleDetail.FACTURATION.phoneNumber;\n }\n\n if (roles.some((role) => [Role.CUSTOMER_SUCCESS].includes(role))) {\n return RoleDetail.CUSTOMER_SUCCESS.phoneNumber;\n }\n\n if (roles.some((role) => [Role.JURIDIC, Role.JURIDICAL_SUPPORT].includes(role))) {\n return RoleDetail.JURIDIC.phoneNumber;\n }\n\n if (roles.some((role) => [Role.SOCIAL].includes(role))) {\n return RoleDetail.SOCIAL.phoneNumber;\n }\n\n return null;\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.113",
|
|
4
4
|
"description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
|
|
5
5
|
"homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
|
|
6
6
|
"main": "js/index.js",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"mailparser": "^3.4.0",
|
|
82
82
|
"readme-md-generator": "^1.0.0",
|
|
83
83
|
"rxjs": "^7.0.1",
|
|
84
|
+
"sms-segments-calculator": "^1.2.0",
|
|
84
85
|
"ts-enum-util": "^4.0.2",
|
|
85
86
|
"winston": "^3.3.3"
|
|
86
87
|
}
|
|
@@ -24,4 +24,7 @@ export class Commercial extends Resource {
|
|
|
24
24
|
checkDocsAndInfosOk(idSociety: number, listIdPrestationList: number[]): Promise<Promise<{ missingDocs: ReadInvalidFieldState[], missingInfos: GedFileType[] }>> {
|
|
25
25
|
return this.axios.$get(`/commercial/${idSociety}/checkDocsAndInfosOk`, { params: { listIdPrestationList } });
|
|
26
26
|
}
|
|
27
|
+
getRequiredListDocs(idLegalForm: number): Promise<GedFileType[]> {
|
|
28
|
+
return this.axios.$get(`/commercial/${idLegalForm}/required-docs`);
|
|
29
|
+
}
|
|
27
30
|
}
|
package/ts/api/resources/Mail.ts
CHANGED
|
@@ -144,7 +144,7 @@ export class Mail extends Resource {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
public countInboxByUser(idUser: number, cancelToken?: CancelToken): Promise<number> {
|
|
147
|
-
return this.axios.$get('/mails/count-unprocessed
|
|
147
|
+
return this.axios.$get('/mails/count-unprocessed', {
|
|
148
148
|
...(cancelToken ? { cancelToken } : {}),
|
|
149
149
|
params: {
|
|
150
150
|
idUser,
|
|
@@ -152,8 +152,19 @@ export class Mail extends Resource {
|
|
|
152
152
|
},
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
public countInboxBySociety(idSociety: number, cancelToken?: CancelToken): Promise<number> {
|
|
157
|
+
return this.axios.$get('/mails/count-unprocessed', {
|
|
158
|
+
...(cancelToken ? { cancelToken } : {}),
|
|
159
|
+
params: {
|
|
160
|
+
idSociety,
|
|
161
|
+
isSent: false,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
public countToBeClassifiedByUser(idUser: number, to?: string, cancelToken?: CancelToken): Promise<number> {
|
|
156
|
-
return this.axios.$get('/mails/count-unprocessed
|
|
167
|
+
return this.axios.$get('/mails/count-unprocessed', {
|
|
157
168
|
...(cancelToken ? { cancelToken } : {}),
|
|
158
169
|
params: {
|
|
159
170
|
to,
|
|
@@ -163,7 +174,7 @@ export class Mail extends Resource {
|
|
|
163
174
|
});
|
|
164
175
|
}
|
|
165
176
|
public countUnprocessedByManager(idUser: number, cancelToken?: CancelToken): Promise<number> {
|
|
166
|
-
return this.axios.$get('/mails/count-unprocessed
|
|
177
|
+
return this.axios.$get('/mails/count-unprocessed', {
|
|
167
178
|
...(cancelToken ? { cancelToken } : {}),
|
|
168
179
|
params: {
|
|
169
180
|
idUser,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CancelToken } from 'axios';
|
|
2
|
+
import { Resource } from '../Resource';
|
|
3
|
+
import {
|
|
4
|
+
ISms,
|
|
5
|
+
OptionalQueryPaginate,
|
|
6
|
+
QueryTextMessage,
|
|
7
|
+
QueryTextMessageGrouped,
|
|
8
|
+
SendTextMessage,
|
|
9
|
+
UpdateTextMessage,
|
|
10
|
+
} from '../../types';
|
|
11
|
+
import { ReadPaginatedTextMessage, ReadPaginatedTextMessageGrouped } from '../../types/Interface/api/textMessage/Read';
|
|
12
|
+
|
|
13
|
+
export class TextMessage extends Resource {
|
|
14
|
+
getPaginated(payload: QueryTextMessage & OptionalQueryPaginate, cancelToken?: CancelToken): Promise<ReadPaginatedTextMessage> {
|
|
15
|
+
return this.axios.$get('/text-messages', { ...(cancelToken ? { cancelToken } : {}), params: payload });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getPaginatedConversations(payload: QueryTextMessageGrouped & OptionalQueryPaginate, cancelToken?: CancelToken): Promise<ReadPaginatedTextMessageGrouped> {
|
|
19
|
+
return this.axios.$get('/text-messages/conversations', { ...(cancelToken ? { cancelToken } : {}), params: payload });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getAllBySocietyId(idSociety: number, query: QueryTextMessage, cancelToken?: CancelToken): Promise<ISms[]> {
|
|
23
|
+
return this.axios.$get(`/societies/${idSociety}/text-messages`, { ...(cancelToken ? { cancelToken } : {}), params: query });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
send(payload: SendTextMessage): Promise<ISms> {
|
|
27
|
+
return this.axios.$post('/text-messages', payload);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update(id: number, payload: UpdateTextMessage): Promise<{ data: ISms }> {
|
|
31
|
+
return this.axios.patch(`/text-messages/${id}`, payload);
|
|
32
|
+
}
|
|
33
|
+
}
|
package/ts/api/resources.ts
CHANGED
|
@@ -111,6 +111,7 @@ import { Commercial } from './resources/Commercial';
|
|
|
111
111
|
import { Facturation } from './resources/Facturation';
|
|
112
112
|
import { Inpi } from './resources/Inpi';
|
|
113
113
|
import { Prestation } from './resources/prestation';
|
|
114
|
+
import { TextMessage } from './resources/TextMessage';
|
|
114
115
|
import { SocietyConfigBalanceSheet } from './resources/SocietyConfigBalanceSheet';
|
|
115
116
|
import { SignFile } from './resources/SignFile';
|
|
116
117
|
import { Rule } from './resources/Rule';
|
|
@@ -231,6 +232,7 @@ export const resources = {
|
|
|
231
232
|
prestation: Prestation,
|
|
232
233
|
vatRegimeHistory: VatRegimeHistory,
|
|
233
234
|
sources: Sources,
|
|
235
|
+
textMessage: TextMessage,
|
|
234
236
|
societyConfigBalanceSheet: SocietyConfigBalanceSheet,
|
|
235
237
|
signFile: SignFile,
|
|
236
238
|
rule: Rule,
|
|
@@ -20,6 +20,7 @@ export enum BalanceSheetState {
|
|
|
20
20
|
INVOICING_ACCEPTED = 15,
|
|
21
21
|
INVOICING_IN_PROGRESS = 16,
|
|
22
22
|
INVOICING_REFUSED = 17,
|
|
23
|
+
REFUSED_BY_CLIENT = 18,
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const BalanceSheetDetails = [
|
|
@@ -28,7 +29,7 @@ export const BalanceSheetDetails = [
|
|
|
28
29
|
text: 'À faire',
|
|
29
30
|
color: 'grey',
|
|
30
31
|
textColor: 'grey--text',
|
|
31
|
-
forRoles: [['front_office', 'front_office_express'], ['expert'], ['customer_success']],
|
|
32
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert'], ['customer_success']],
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
text: 'En cours de prod.',
|
|
@@ -36,7 +37,7 @@ export const BalanceSheetDetails = [
|
|
|
36
37
|
alias: 'ENC',
|
|
37
38
|
color: 'grey',
|
|
38
39
|
textColor: 'grey--text ',
|
|
39
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
40
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
text: 'Att. retour client',
|
|
@@ -44,14 +45,14 @@ export const BalanceSheetDetails = [
|
|
|
44
45
|
alias: 'ARC',
|
|
45
46
|
color: 'cyan',
|
|
46
47
|
textColor: 'cyan--text',
|
|
47
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
48
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
text: 'À réviser',
|
|
51
52
|
value: BalanceSheetState.TO_REVISE,
|
|
52
53
|
color: 'purple lighten-2',
|
|
53
54
|
textColor: 'purple--text',
|
|
54
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
55
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
text: 'À revoir',
|
|
@@ -59,14 +60,14 @@ export const BalanceSheetDetails = [
|
|
|
59
60
|
icon: 'close',
|
|
60
61
|
color: 'red lighten-2',
|
|
61
62
|
textColor: 'red--text red--lighten-3',
|
|
62
|
-
forRoles: [['front_office', 'manager'], ['expert']],
|
|
63
|
+
forRoles: [['front_office', 'manager'], ['front_office_express', 'manager'], ['expert']],
|
|
63
64
|
},
|
|
64
65
|
{
|
|
65
66
|
text: 'À superviser',
|
|
66
67
|
value: BalanceSheetState.TO_SUPERVISE,
|
|
67
68
|
color: 'teal',
|
|
68
69
|
textColor: 'teal--text',
|
|
69
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
70
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
text: 'À envoyer',
|
|
@@ -80,43 +81,50 @@ export const BalanceSheetDetails = [
|
|
|
80
81
|
value: BalanceSheetState.SENDED_TO_CLIENT,
|
|
81
82
|
color: 'blue',
|
|
82
83
|
textColor: 'blue--text',
|
|
83
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
84
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
84
85
|
},
|
|
85
86
|
{
|
|
86
|
-
text: 'Accepté par client',
|
|
87
|
+
text: 'Accepté par le client',
|
|
87
88
|
value: BalanceSheetState.ACCEPTED_BY_CLIENT,
|
|
88
89
|
color: 'blue darken-2',
|
|
89
90
|
textColor: 'blue--text ',
|
|
90
91
|
alias: 'APC',
|
|
91
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
92
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
text: 'Refusé par le client',
|
|
96
|
+
value: BalanceSheetState.REFUSED_BY_CLIENT,
|
|
97
|
+
color: 'red darken-3',
|
|
98
|
+
textColor: 'white--text',
|
|
99
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
92
100
|
},
|
|
93
101
|
{
|
|
94
102
|
text: 'Envoyé au SIE',
|
|
95
103
|
value: BalanceSheetState.SENDED_TO_SIE,
|
|
96
104
|
color: 'blue darken-4',
|
|
97
105
|
textColor: 'blue--text',
|
|
98
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
106
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
99
107
|
},
|
|
100
108
|
{
|
|
101
109
|
value: BalanceSheetState.ACCEPTED_BY_SIE,
|
|
102
110
|
text: 'Accepté au SIE',
|
|
103
111
|
color: 'grey darken-1',
|
|
104
112
|
textColor: 'green--text',
|
|
105
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
113
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
106
114
|
},
|
|
107
115
|
{
|
|
108
116
|
text: 'Refus SIE',
|
|
109
117
|
value: BalanceSheetState.REFUSED_BY_SIE,
|
|
110
118
|
color: 'red darken-3',
|
|
111
119
|
textColor: 'green--text ',
|
|
112
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
120
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
113
121
|
},
|
|
114
122
|
{
|
|
115
123
|
text: 'Envoi provisoire SIE',
|
|
116
124
|
value: BalanceSheetState.SENDED_PROVISIONALLY_TO_SIE,
|
|
117
125
|
color: 'green darken-4',
|
|
118
126
|
textColor: 'green--text ',
|
|
119
|
-
forRoles: [['front_office', 'front_office_express'], ['expert']],
|
|
127
|
+
forRoles: [['front_office'], ['front_office_express'], ['expert']],
|
|
120
128
|
},
|
|
121
129
|
{
|
|
122
130
|
value: BalanceSheetState.NOT_SUBJECT_TO,
|
|
@@ -131,7 +139,7 @@ export const BalanceSheetDetails = [
|
|
|
131
139
|
color: 'error darken-2',
|
|
132
140
|
colorText: 'error--text text--darken-2',
|
|
133
141
|
key: 'unpaid',
|
|
134
|
-
forRoles: [['front_office', 'manager'], ['customer_success'], ['facturation']],
|
|
142
|
+
forRoles: [['front_office', 'manager'], ['front_office_express', 'manager'], ['customer_success'], ['facturation']],
|
|
135
143
|
},
|
|
136
144
|
{
|
|
137
145
|
text: 'Facturation validée',
|
|
@@ -19,6 +19,7 @@ export const RoleDetail = {
|
|
|
19
19
|
colorPrimary: '#8765D0',
|
|
20
20
|
colorSecondary: '#DED7F6',
|
|
21
21
|
subRole: false,
|
|
22
|
+
phoneNumber: '+33755537510',
|
|
22
23
|
},
|
|
23
24
|
COMMERCIAL: {
|
|
24
25
|
id: 9,
|
|
@@ -26,6 +27,7 @@ export const RoleDetail = {
|
|
|
26
27
|
colorPrimary: '#8765D0',
|
|
27
28
|
colorSecondary: '#DED7F6',
|
|
28
29
|
subRole: false,
|
|
30
|
+
phoneNumber: '+33COMMERCIAL',
|
|
29
31
|
},
|
|
30
32
|
CUSTOMER_SUCCESS: {
|
|
31
33
|
id: 10,
|
|
@@ -34,6 +36,7 @@ export const RoleDetail = {
|
|
|
34
36
|
colorSecondary: '#DAEEFC',
|
|
35
37
|
subRole: false,
|
|
36
38
|
handledInUserSocietyPermissionTable: false,
|
|
39
|
+
phoneNumber: '',
|
|
37
40
|
},
|
|
38
41
|
SOCIAL: {
|
|
39
42
|
id: 11,
|
|
@@ -41,6 +44,7 @@ export const RoleDetail = {
|
|
|
41
44
|
colorPrimary: '#8765D0',
|
|
42
45
|
colorSecondary: '#DED7F6',
|
|
43
46
|
subRole: false,
|
|
47
|
+
phoneNumber: '',
|
|
44
48
|
},
|
|
45
49
|
JURIDIC: {
|
|
46
50
|
id: 12,
|
|
@@ -48,6 +52,7 @@ export const RoleDetail = {
|
|
|
48
52
|
colorPrimary: '#8765D0',
|
|
49
53
|
colorSecondary: '#DED7F6',
|
|
50
54
|
subRole: false,
|
|
55
|
+
phoneNumber: '',
|
|
51
56
|
},
|
|
52
57
|
// CHIEF_ACCOUNTANT: {
|
|
53
58
|
// id: 13,
|
|
@@ -69,6 +74,7 @@ export const RoleDetail = {
|
|
|
69
74
|
colorPrimary: '#8765D0',
|
|
70
75
|
colorSecondary: '#DED7F6',
|
|
71
76
|
subRole: false,
|
|
77
|
+
phoneNumber: '',
|
|
72
78
|
},
|
|
73
79
|
SUPER_ADMIN: {
|
|
74
80
|
id: 16,
|
|
@@ -133,6 +139,7 @@ export const RoleDetail = {
|
|
|
133
139
|
colorPrimary: '#8765D0',
|
|
134
140
|
colorSecondary: '#DED7F6',
|
|
135
141
|
subRole: false,
|
|
142
|
+
phoneNumber: '',
|
|
136
143
|
},
|
|
137
144
|
API: {
|
|
138
145
|
id: 26,
|
|
@@ -191,6 +198,7 @@ export const RoleDetail = {
|
|
|
191
198
|
colorPrimary: '#8765D0',
|
|
192
199
|
colorSecondary: '#DED7F6',
|
|
193
200
|
subRole: false,
|
|
201
|
+
phoneNumber: '',
|
|
194
202
|
},
|
|
195
203
|
HUMAN_RESSOURCES: {
|
|
196
204
|
id: 35,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export enum TextMessageType {
|
|
2
|
+
UNPAID = 1,
|
|
3
|
+
ACCOUNTANCY_DATE = 2,
|
|
4
|
+
COMMERCIAL = 3,
|
|
5
|
+
CHECKUP = 5,
|
|
6
|
+
REMIND_CHECKUP = 6,
|
|
7
|
+
MISSION_LETTER = 7,
|
|
8
|
+
PROMOTIONAL_ESTIMATE = 8,
|
|
9
|
+
EXPIRED_ESTIMATE = 9,
|
|
10
|
+
COMPTALIB_SYNCHRONIZED_BANK = 10,
|
|
11
|
+
COMPTALIB_BEFORE_TRIAL_PERIOD = 11,
|
|
12
|
+
COMPTALIB_AFTER_TRIAL_PERIOD = 12,
|
|
13
|
+
RECEIVED = 13,
|
|
14
|
+
SEND = 14,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum TextMessageStatus {
|
|
18
|
+
ACCEPTED = 'accepted',
|
|
19
|
+
SCHEDULED = 'scheduled',
|
|
20
|
+
CANCELED = 'canceled',
|
|
21
|
+
QUEUED = 'queued',
|
|
22
|
+
SENDING = 'sending',
|
|
23
|
+
SENT = 'sent',
|
|
24
|
+
FAILED = 'failed',
|
|
25
|
+
DELIVERED = 'delivered',
|
|
26
|
+
UNDELIVERED = 'undelivered',
|
|
27
|
+
RECEIVING = 'receiving',
|
|
28
|
+
RECEIVED = 'received',
|
|
29
|
+
READ = 'read', // (WHATSAPP ONLY)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum TextMessageHookEvent {
|
|
33
|
+
DELIVERABILITY = 'deliverability',
|
|
34
|
+
RECEPTION = 'reception',
|
|
35
|
+
}
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
IsOptional,
|
|
5
5
|
IsString,
|
|
6
6
|
} from 'class-validator';
|
|
7
|
-
import {
|
|
7
|
+
import { ApiPropertyOptional } from '../../../../utils';
|
|
8
8
|
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
9
9
|
|
|
10
|
-
export class
|
|
11
|
-
@
|
|
10
|
+
export class QueryCountUnprocessedMail {
|
|
11
|
+
@ApiPropertyOptional()
|
|
12
|
+
@IsOptional()
|
|
12
13
|
@IsInt()
|
|
13
|
-
idUser
|
|
14
|
+
idUser?: number;
|
|
14
15
|
|
|
15
16
|
@ApiPropertyOptional()
|
|
16
17
|
@IsOptional()
|
|
@@ -28,4 +29,9 @@ export class QueryCountUnprocessedByUserMail {
|
|
|
28
29
|
@IsOptional()
|
|
29
30
|
@IsString({ each: true })
|
|
30
31
|
to?: string;
|
|
32
|
+
|
|
33
|
+
@ApiPropertyOptional()
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsInt()
|
|
36
|
+
idSociety?: number;
|
|
31
37
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IsEnum, IsNumber, IsString } from 'class-validator';
|
|
2
|
+
import { ApiProperty } from '../../../../utils';
|
|
3
|
+
import { TextMessageType } from '../../../Enum/TextMessageType';
|
|
4
|
+
|
|
5
|
+
export class SendTextMessage {
|
|
6
|
+
@ApiProperty()
|
|
7
|
+
@IsString()
|
|
8
|
+
from: string;
|
|
9
|
+
|
|
10
|
+
@ApiProperty()
|
|
11
|
+
@IsNumber()
|
|
12
|
+
toUserId: number;
|
|
13
|
+
|
|
14
|
+
@ApiProperty()
|
|
15
|
+
@IsString()
|
|
16
|
+
content: string;
|
|
17
|
+
|
|
18
|
+
@ApiProperty()
|
|
19
|
+
@IsNumber()
|
|
20
|
+
idSociety: number;
|
|
21
|
+
|
|
22
|
+
@ApiProperty()
|
|
23
|
+
@IsEnum(TextMessageType)
|
|
24
|
+
idTextMessageType: TextMessageType;
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsArray,
|
|
3
|
+
IsBoolean, IsNumber, IsOptional, IsString,
|
|
4
|
+
} from 'class-validator';
|
|
5
|
+
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
6
|
+
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
7
|
+
import { Role } from '../../../Enum/Role';
|
|
8
|
+
import { TextMessageHookEvent, TextMessageType } from '../../../Enum/TextMessageType';
|
|
9
|
+
|
|
10
|
+
export class QueryTwilioHook {
|
|
11
|
+
@ApiProperty()
|
|
12
|
+
@IsString()
|
|
13
|
+
event: TextMessageHookEvent;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class QueryTextMessage {
|
|
17
|
+
@ApiPropertyOptional()
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@IsNumber()
|
|
20
|
+
idSociety?: number;
|
|
21
|
+
|
|
22
|
+
@ApiPropertyOptional()
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsNumber()
|
|
25
|
+
idUser?: number;
|
|
26
|
+
|
|
27
|
+
@ApiPropertyOptional()
|
|
28
|
+
@IsOptional()
|
|
29
|
+
idRoles?: Role[];
|
|
30
|
+
|
|
31
|
+
@ApiProperty()
|
|
32
|
+
@IsOptional()
|
|
33
|
+
search?: string;
|
|
34
|
+
|
|
35
|
+
@ApiProperty()
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsBoolean()
|
|
38
|
+
@ToBoolean()
|
|
39
|
+
isRead?: boolean;
|
|
40
|
+
|
|
41
|
+
@ApiPropertyOptional()
|
|
42
|
+
@IsOptional()
|
|
43
|
+
phoneNumber?: string;
|
|
44
|
+
|
|
45
|
+
@ApiPropertyOptional()
|
|
46
|
+
@IsOptional()
|
|
47
|
+
@IsArray()
|
|
48
|
+
idTextMessageType?: TextMessageType[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class QueryTextMessageGrouped extends QueryTextMessage {}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ISms } from '../../models/ISms';
|
|
2
|
+
import { BasePaginate } from '../BasePaginate';
|
|
3
|
+
|
|
4
|
+
export type ReadPaginatedTextMessage = BasePaginate<ISms>;
|
|
5
|
+
export type ReadPaginatedTextMessageGrouped = BasePaginate<{ preview: ISms, conversation: ISms[]; unread: number; }>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IsBoolean, IsOptional } from 'class-validator';
|
|
2
|
+
import { ApiPropertyOptional } from '../../../../utils';
|
|
3
|
+
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
4
|
+
import { TextMessageStatus } from '../../../Enum/TextMessageType';
|
|
5
|
+
|
|
6
|
+
export interface BodyTextMessageStatus {
|
|
7
|
+
SmsSid: string;
|
|
8
|
+
SmsStatus: TextMessageStatus,
|
|
9
|
+
MessageStatus: TextMessageStatus,
|
|
10
|
+
To: string,
|
|
11
|
+
MessageSid: string,
|
|
12
|
+
AccountSid: string,
|
|
13
|
+
From: string,
|
|
14
|
+
ApiVersion: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BodyTextMessageReception {
|
|
18
|
+
ToCountry: string,
|
|
19
|
+
ToState: string,
|
|
20
|
+
SmsMessageSid: string,
|
|
21
|
+
NumMedia: string,
|
|
22
|
+
ToCity: string,
|
|
23
|
+
FromZip: string,
|
|
24
|
+
SmsSid: string,
|
|
25
|
+
FromState: string,
|
|
26
|
+
SmsStatus: string,
|
|
27
|
+
FromCity: string,
|
|
28
|
+
Body: string,
|
|
29
|
+
FromCountry: string,
|
|
30
|
+
To: string,
|
|
31
|
+
MessagingServiceSid:string,
|
|
32
|
+
ToZip: string,
|
|
33
|
+
NumSegments: string,
|
|
34
|
+
MessageSid: string,
|
|
35
|
+
AccountSid: string,
|
|
36
|
+
From: string,
|
|
37
|
+
ApiVersion: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class UpdateTextMessage {
|
|
41
|
+
@ApiPropertyOptional()
|
|
42
|
+
@IsBoolean()
|
|
43
|
+
@ToBoolean()
|
|
44
|
+
@IsOptional()
|
|
45
|
+
isRead?: boolean;
|
|
46
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ISmsType } from './ISmsType';
|
|
2
2
|
import { IUser } from './IUser';
|
|
3
3
|
import { ISociety } from './ISociety';
|
|
4
|
+
import { TextMessageType } from '../../Enum/TextMessageType';
|
|
4
5
|
|
|
5
6
|
// SMS
|
|
6
7
|
export interface ISms {
|
|
@@ -9,16 +10,17 @@ export interface ISms {
|
|
|
9
10
|
sid?: string | null;
|
|
10
11
|
status: string | null;
|
|
11
12
|
errorCode: number | null;
|
|
13
|
+
isRead: boolean;
|
|
12
14
|
idRecipient: number;
|
|
13
15
|
idCollaborater: number;
|
|
14
16
|
idSociety: number;
|
|
15
|
-
idTypeSMS:
|
|
17
|
+
idTypeSMS: TextMessageType;
|
|
16
18
|
createdAt?: Date | null;
|
|
17
19
|
updatedAt?: Date | null;
|
|
18
20
|
|
|
19
21
|
// Associations
|
|
20
|
-
typeSms
|
|
21
|
-
recipient
|
|
22
|
-
user
|
|
23
|
-
society
|
|
22
|
+
typeSms?: ISmsType;
|
|
23
|
+
recipient?: IUser;
|
|
24
|
+
user?: IUser;
|
|
25
|
+
society?: ISociety;
|
|
24
26
|
}
|
package/ts/types/index.ts
CHANGED
|
@@ -467,6 +467,7 @@ export * from './Enum/BankCollectingState';
|
|
|
467
467
|
export * from './Enum/Phone';
|
|
468
468
|
export * from './Enum/GeneralThirdParty';
|
|
469
469
|
export * from './Enum/MailDomainType';
|
|
470
|
+
export * from './Enum/TextMessageType';
|
|
470
471
|
|
|
471
472
|
// Interfaces API
|
|
472
473
|
export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
|
|
@@ -523,7 +524,7 @@ export * from './Interface/api/mail/QueryAllMail';
|
|
|
523
524
|
export * from './Interface/api/mail/QueryPaginatedMail';
|
|
524
525
|
export * from './Interface/api/mail/QueryCountProcessedByUser';
|
|
525
526
|
export * from './Interface/api/mail/QueryGetAnsweringTimeByUser';
|
|
526
|
-
export * from './Interface/api/mail/
|
|
527
|
+
export * from './Interface/api/mail/QueryCountUnprocessedMail';
|
|
527
528
|
export * from './Interface/api/mail/UpdateMail';
|
|
528
529
|
export * from './Interface/api/mail/CreateMailParams';
|
|
529
530
|
export * from './Interface/api/mail/UpdateMailParams';
|
|
@@ -629,6 +630,9 @@ export * from './Interface/api/inpiBalance/inpiBalanceStatistic';
|
|
|
629
630
|
export * from './Interface/api/inpiPayment/QueryInpiPaymentStatistic';
|
|
630
631
|
export * from './Interface/api/inpiPayment/QueryInpiPaymentPaginated';
|
|
631
632
|
export * from './Interface/api/vatRegimeHistory/QueryVatRegimeHistory';
|
|
633
|
+
export * from './Interface/api/textMessage/Create';
|
|
634
|
+
export * from './Interface/api/textMessage/Update';
|
|
635
|
+
export * from './Interface/api/textMessage/Query';
|
|
632
636
|
|
|
633
637
|
// export * from './Interface/api/survey/QuerySurvey';
|
|
634
638
|
export * from './Interface/api/survey/ReadSurvey';
|
|
@@ -869,6 +873,7 @@ export * from './Interface/enum/Util';
|
|
|
869
873
|
export * from './Interface/enum/Date';
|
|
870
874
|
|
|
871
875
|
export * from '../utils/cerfa';
|
|
876
|
+
export * from '../utils/phone';
|
|
872
877
|
export * from '../utils/checklist';
|
|
873
878
|
export * from '../utils/date';
|
|
874
879
|
export * from './Interface/api/affectedPatrimony/CreateAffectedPatrimony';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SegmentedMessage } from 'sms-segments-calculator';
|
|
2
|
+
import { PhonePrefix } from '../types/Enum/Phone';
|
|
3
|
+
import { Role } from '../types/Enum/Role';
|
|
4
|
+
import { RoleDetail } from '../types/Enum/RoleDetail';
|
|
5
|
+
|
|
6
|
+
export function formatPhoneNumberToE164(phoneNumber: string | null, prefix = '+33'): string | null {
|
|
7
|
+
if (!phoneNumber) return null;
|
|
8
|
+
if (phoneNumber.charAt(0) !== '+' && phoneNumber.charAt(0) === '0') {
|
|
9
|
+
const numberInt = phoneNumber.replace(/\D/g, '');
|
|
10
|
+
if (prefix) {
|
|
11
|
+
if (numberInt.length === 10 && numberInt.charAt(0) === '0') {
|
|
12
|
+
return `${prefix}${numberInt.substring(1)}`;
|
|
13
|
+
}
|
|
14
|
+
return `${prefix}${numberInt}`;
|
|
15
|
+
}
|
|
16
|
+
if (numberInt.charAt(0) === '0' && numberInt.length === 10) return `+33${numberInt.substring(1)}`;
|
|
17
|
+
return numberInt;
|
|
18
|
+
}
|
|
19
|
+
return phoneNumber;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getPhoneNumberWithoutPrefix(phoneNumber: string): string {
|
|
23
|
+
let number = phoneNumber;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
Object.keys(PhonePrefix).map((index) => PhonePrefix[index].prefix).forEach((prefix) => {
|
|
26
|
+
number = number.replace(prefix, '');
|
|
27
|
+
});
|
|
28
|
+
return number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function countSegmentsFromMessage(message: string): number {
|
|
32
|
+
return new SegmentedMessage(message, 'GSM-7').segmentsCount;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getPhoneNumberFromRoles(roles: number[]): string | null {
|
|
36
|
+
if (roles.some((role) => [Role.FRONT_OFFICE, Role.EXPERT_ACCOUNTANT].includes(role))) {
|
|
37
|
+
return RoleDetail.FRONT_OFFICE.phoneNumber;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (roles.some((role) => [Role.FRONT_OFFICE_EXPRESS].includes(role))) {
|
|
41
|
+
return RoleDetail.FRONT_OFFICE_EXPRESS.phoneNumber;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (roles.some((role) => [Role.COMMERCIAL].includes(role))) {
|
|
45
|
+
return RoleDetail.COMMERCIAL.phoneNumber;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (roles.some((role) => [Role.FACTURATION].includes(role))) {
|
|
49
|
+
return RoleDetail.FACTURATION.phoneNumber;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (roles.some((role) => [Role.CUSTOMER_SUCCESS].includes(role))) {
|
|
53
|
+
return RoleDetail.CUSTOMER_SUCCESS.phoneNumber;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (roles.some((role) => [Role.JURIDIC, Role.JURIDICAL_SUPPORT].includes(role))) {
|
|
57
|
+
return RoleDetail.JURIDIC.phoneNumber;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (roles.some((role) => [Role.SOCIAL].includes(role))) {
|
|
61
|
+
return RoleDetail.SOCIAL.phoneNumber;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return null;
|
|
65
|
+
}
|