@sneat/contactus-core 0.1.3 → 0.1.4
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/fesm2022/sneat-contactus-core.mjs +180 -0
- package/fesm2022/sneat-contactus-core.mjs.map +1 -0
- package/package.json +13 -2
- package/types/sneat-contactus-core.d.ts +418 -0
- package/eslint.config.js +0 -7
- package/ng-package.json +0 -7
- package/project.json +0 -38
- package/src/index.ts +0 -3
- package/src/lib/apidto/index.ts +0 -3
- package/src/lib/apidto/requests.ts +0 -131
- package/src/lib/apidto/responses.ts +0 -21
- package/src/lib/contexts/contact-context.ts +0 -22
- package/src/lib/contexts/index.ts +0 -2
- package/src/lib/contexts/member-group.ts +0 -35
- package/src/lib/contexts/person-context.ts +0 -41
- package/src/lib/dto/address.ts +0 -26
- package/src/lib/dto/contact-base.ts +0 -47
- package/src/lib/dto/contact-group-brief.ts +0 -8
- package/src/lib/dto/contact-group.ts +0 -19
- package/src/lib/dto/contact-roles.ts +0 -99
- package/src/lib/dto/contact-types.ts +0 -41
- package/src/lib/dto/contact.ts +0 -85
- package/src/lib/dto/contact2item.ts +0 -23
- package/src/lib/dto/contactus-space.ts +0 -8
- package/src/lib/dto/index.ts +0 -14
- package/src/lib/dto/member-types.ts +0 -29
- package/src/lib/dto/member.ts +0 -87
- package/src/lib/dto/person.ts +0 -92
- package/src/lib/dto/pet-kind.ts +0 -16
- package/src/lib/dto/requests.ts +0 -1
- package/src/lib/dto/term.ts +0 -28
- package/src/lib/sanity.spec.ts +0 -5
- package/src/test-setup.ts +0 -3
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -19
- package/tsconfig.lib.prod.json +0 -7
- package/tsconfig.spec.json +0 -31
- package/vite.config.mts +0 -10
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { IFormField, Gender, AgeGroupID, IIdAndBrief, ISpaceRef, IIdAndBriefAndOptionalDbo, IIdAndBriefAndDbo, ISpaceItemBriefWithSpace, IIdAndOptionalDbo, EnumAsUnionOfKeys, IIdAndDboWithSpaceRef, ISpaceItemWithBriefAndDbo } from '@sneat/core';
|
|
2
|
+
import { IWithRelatedOnly, IWithIdAndTitle, IWithSpaceIDs, IWithRelatedAndRelatedIDs, ITitledRecord, IPrice, IVerification, ITotalsHolder, ITitledRecordInfo } from '@sneat/dto';
|
|
3
|
+
import { SpaceMemberType, IPersonNames, IAvatar } from '@sneat/auth-models';
|
|
4
|
+
import { ISpaceItemNavContext, Totals, ISpaceRequest, SpaceMemberStatus, IInviteSpace } from '@sneat/space-models';
|
|
5
|
+
|
|
6
|
+
interface IAddress {
|
|
7
|
+
readonly countryID: string;
|
|
8
|
+
readonly zipCode?: string;
|
|
9
|
+
readonly state?: string;
|
|
10
|
+
readonly city?: string;
|
|
11
|
+
readonly lines?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function validateAddress(address?: IAddress, requires?: {
|
|
14
|
+
city?: boolean;
|
|
15
|
+
lines?: boolean;
|
|
16
|
+
}): IAddress;
|
|
17
|
+
|
|
18
|
+
declare const ContactTypePerson = "person";
|
|
19
|
+
declare const ContactTypeCompany = "company";
|
|
20
|
+
declare const ContactTypeLocation = "location";
|
|
21
|
+
declare const ContactTypeAnimal = "animal";
|
|
22
|
+
declare const ContactTypeVehicle = "vehicle";
|
|
23
|
+
type ContactType = SpaceMemberType | typeof ContactTypePerson | typeof ContactTypeCompany | typeof ContactTypeLocation | typeof ContactTypeAnimal | typeof ContactTypeVehicle | 'landlord' | 'tenant';
|
|
24
|
+
type MemberContactType = typeof ContactTypePerson | typeof ContactTypeAnimal;
|
|
25
|
+
interface IEmail {
|
|
26
|
+
readonly type: 'work' | 'personal';
|
|
27
|
+
readonly address: string;
|
|
28
|
+
}
|
|
29
|
+
interface IPhone {
|
|
30
|
+
readonly type: 'work' | 'mobile' | 'personal' | 'fax';
|
|
31
|
+
readonly number: string;
|
|
32
|
+
}
|
|
33
|
+
interface IPersonRequirements {
|
|
34
|
+
readonly lastName?: IFormField;
|
|
35
|
+
readonly ageGroup?: IFormField;
|
|
36
|
+
readonly gender?: IFormField;
|
|
37
|
+
readonly phone?: IFormField;
|
|
38
|
+
readonly email?: IFormField;
|
|
39
|
+
readonly relatedAs?: IFormField;
|
|
40
|
+
readonly roles?: IFormField;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare enum PetKinds {
|
|
44
|
+
dog = "dog",
|
|
45
|
+
cat = "cat",
|
|
46
|
+
hamster = "hamster",
|
|
47
|
+
rabbit = "rabbit",
|
|
48
|
+
bird = "bird",
|
|
49
|
+
fish = "fish",
|
|
50
|
+
turtle = "turtle",
|
|
51
|
+
snake = "snake",
|
|
52
|
+
lizard = "lizard",
|
|
53
|
+
horse = "horse",
|
|
54
|
+
pig = "pig",
|
|
55
|
+
cow = "cow"
|
|
56
|
+
}
|
|
57
|
+
type PetKind = keyof typeof PetKinds;
|
|
58
|
+
|
|
59
|
+
type ContactCommChannelType = 'email' | 'phone';
|
|
60
|
+
interface IContactCommChannelProps {
|
|
61
|
+
type: 'work' | 'personal';
|
|
62
|
+
isPrimary?: boolean;
|
|
63
|
+
isVerified?: boolean;
|
|
64
|
+
original?: string;
|
|
65
|
+
}
|
|
66
|
+
interface IContactChannels {
|
|
67
|
+
readonly email?: string;
|
|
68
|
+
readonly emails?: Readonly<Record<string, IContactCommChannelProps>>;
|
|
69
|
+
readonly phone?: string;
|
|
70
|
+
readonly phones?: Readonly<Record<string, IContactCommChannelProps>>;
|
|
71
|
+
}
|
|
72
|
+
interface IContactBase extends IWithRelatedOnly, IContactChannels {
|
|
73
|
+
readonly type: ContactType;
|
|
74
|
+
readonly title?: string;
|
|
75
|
+
readonly shortTitle?: string;
|
|
76
|
+
readonly names?: IPersonNames;
|
|
77
|
+
readonly countryID?: string;
|
|
78
|
+
readonly userID?: string;
|
|
79
|
+
readonly gender?: Gender;
|
|
80
|
+
readonly ageGroup?: AgeGroupID;
|
|
81
|
+
readonly petKind?: PetKind;
|
|
82
|
+
readonly petBreed?: string;
|
|
83
|
+
readonly address?: IAddress;
|
|
84
|
+
readonly avatar?: IAvatar;
|
|
85
|
+
readonly roles?: readonly string[];
|
|
86
|
+
readonly groupIDs?: readonly string[];
|
|
87
|
+
readonly invitesCount?: string;
|
|
88
|
+
readonly dob?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type MembersVisibility = 'private' | 'protected' | 'public';
|
|
92
|
+
declare const RoleSpaceMember = "member";
|
|
93
|
+
declare const MemberRoleContributor = "contributor";
|
|
94
|
+
declare const MemberRoleSpectator = "spectator";
|
|
95
|
+
declare const MemberRoleParish = "pastor";
|
|
96
|
+
type MemberRoleEducation = 'administrator' | 'principal' | 'pupil' | 'teacher';
|
|
97
|
+
type MemberRoleRealtor = 'administrator' | 'agent';
|
|
98
|
+
type MemberRole = typeof MemberRoleContributor | typeof MemberRoleSpectator | MemberRoleEducation | MemberRoleRealtor | typeof MemberRoleParish;
|
|
99
|
+
declare enum FamilyMemberRelation {
|
|
100
|
+
child = "child",
|
|
101
|
+
cousin = "cousin",
|
|
102
|
+
grandparent = "grandparent",
|
|
103
|
+
grandparentInLaw = "grandparent_in_law",
|
|
104
|
+
parent = "parent",
|
|
105
|
+
parentInLaw = "parent_in_law",
|
|
106
|
+
partner = "partner",
|
|
107
|
+
sibling = "sibling",
|
|
108
|
+
spouse = "spouse"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare const ContactRoleEmployee = "employee";
|
|
112
|
+
declare const ContactRoleInsurer = "insurer";
|
|
113
|
+
declare const ContactRolePet = "pet";
|
|
114
|
+
declare const ContactRoleFriend = "friend";
|
|
115
|
+
declare const ContactRoleRelative = "relative";
|
|
116
|
+
declare const ContactRoleParentOfFriend = "parent_of_friend";
|
|
117
|
+
declare const ContactRoleDriver = "driver";
|
|
118
|
+
declare const ContactRoleLocation = "location";
|
|
119
|
+
type ContactRoleDwellingRelated = typeof ContactRoleInsurer | 'cleaner' | 'gardener' | 'plumber' | 'handyman' | 'gp' | 'landlord' | 'tenant' | 'realtor';
|
|
120
|
+
type ContactRoleVehicle = typeof ContactRoleInsurer | 'mechanic' | 'electrician' | 'handyman' | typeof ContactRoleDriver;
|
|
121
|
+
type ContactRoleMedRelated = 'GP' | 'med_specialist';
|
|
122
|
+
type ContactRoleFamilyRelated = typeof RoleSpaceMember | typeof ContactRolePet | typeof ContactRoleFriend | typeof ContactRoleRelative;
|
|
123
|
+
type ContactRoleWorkRelated = typeof ContactRoleEmployee | 'client' | 'supplier';
|
|
124
|
+
type ContactRoleKidRelated = typeof ContactRoleFriend | typeof ContactRoleParentOfFriend | 'teacher' | 'babysitter';
|
|
125
|
+
declare const ContactRoleShip = "ship";
|
|
126
|
+
type ContactRoleLogistSubContact = typeof ContactRoleShip | typeof ContactRoleLocation;
|
|
127
|
+
type ContactRoleLogistParentContact = 'shipper' | 'dispatcher';
|
|
128
|
+
|
|
129
|
+
type LogistOrderContactRole = ContactRoleLogistParentContact | ContactRoleLogistSubContact | 'consignee' | 'dispatch_point' | 'receive_point' | 'dispatch_agent' | 'receive_agent' | 'buyer' | 'courier' | 'freight_agent' | 'notify_party' | 'port' | 'port_from' | 'port_from_location' | 'port_to' | 'port_to_location' | 'shipping_line' | 'truck' | 'trucker' | 'warehouse';
|
|
130
|
+
type ContactRole = MemberRole | typeof RoleSpaceMember | ContactRoleFamilyRelated | ContactRoleWorkRelated | ContactRoleKidRelated | ContactRoleMedRelated | ContactRoleDwellingRelated | ContactRoleVehicle | LogistOrderContactRole | 'applicant';
|
|
131
|
+
interface IContactRoleBrief {
|
|
132
|
+
readonly title: string;
|
|
133
|
+
readonly titlePlural?: string;
|
|
134
|
+
readonly emoji?: string;
|
|
135
|
+
readonly finder?: string;
|
|
136
|
+
}
|
|
137
|
+
interface IContactRoleWithIdAndBrief {
|
|
138
|
+
readonly id: ContactRole;
|
|
139
|
+
readonly brief: IContactRoleBrief;
|
|
140
|
+
readonly hideInNewContactForm?: boolean;
|
|
141
|
+
}
|
|
142
|
+
interface IContactRoleWithIdAndOptionalBrief {
|
|
143
|
+
readonly id: ContactRole;
|
|
144
|
+
readonly brief?: IContactRoleBrief;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
type ContactToContactRelation = 'undefined' | 'parent' | 'mother' | 'father' | 'sibling' | 'childminder' | 'friend' | 'child';
|
|
148
|
+
type ContactToAssetRelation = string;
|
|
149
|
+
interface IContact2ContactInRequest {
|
|
150
|
+
relation: ContactToContactRelation;
|
|
151
|
+
}
|
|
152
|
+
interface IContact2Asset extends IWithIdAndTitle {
|
|
153
|
+
relation: ContactToAssetRelation;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
type IPersonBrief = IContactBase;
|
|
157
|
+
type IPerson = IContactBase;
|
|
158
|
+
interface ISpaceMemberInfo extends IPerson {
|
|
159
|
+
readonly id?: string;
|
|
160
|
+
readonly userID?: string;
|
|
161
|
+
readonly title?: string;
|
|
162
|
+
readonly groupIDs?: readonly string[];
|
|
163
|
+
readonly roles?: readonly MemberRole[];
|
|
164
|
+
}
|
|
165
|
+
interface IRelatedPerson extends IPerson, IWithRelatedOnly {
|
|
166
|
+
}
|
|
167
|
+
interface IMemberPerson extends IRelatedPerson {
|
|
168
|
+
type: MemberContactType;
|
|
169
|
+
}
|
|
170
|
+
declare function relatedPersonToPerson(v: IRelatedPerson): IPerson;
|
|
171
|
+
interface IRelatedPersonContact extends IRelatedPerson {
|
|
172
|
+
readonly type: 'person';
|
|
173
|
+
}
|
|
174
|
+
interface ICreatePeronRequest extends IRelatedPersonContact {
|
|
175
|
+
readonly status: 'active' | 'draft';
|
|
176
|
+
}
|
|
177
|
+
declare function isPersonNotReady(p: IPerson, requires: IPersonRequirements): boolean;
|
|
178
|
+
declare function isPersonReady(p: IPerson, requires: IPersonRequirements): boolean;
|
|
179
|
+
declare function isRelatedPersonNotReady(p: IRelatedPerson, requires: IPersonRequirements): boolean;
|
|
180
|
+
declare function isRelatedPersonReady(p: IPerson, requires: IPersonRequirements): boolean;
|
|
181
|
+
interface IPersonRecord extends IWithSpaceIDs, IPerson {
|
|
182
|
+
}
|
|
183
|
+
declare const emptyContactBase: IContactBase;
|
|
184
|
+
declare const emptyMemberPerson: IMemberPerson;
|
|
185
|
+
|
|
186
|
+
type RequirementOption = 'required' | 'optional' | 'excluded';
|
|
187
|
+
interface IContactBrief extends IContactBase {
|
|
188
|
+
readonly parentID?: string;
|
|
189
|
+
}
|
|
190
|
+
type IContactWithBrief = IIdAndBrief<IContactBrief>;
|
|
191
|
+
declare function filterContactsByTextAndRole(// TODO(help-wanted): add test
|
|
192
|
+
contacts: readonly IContactWithCheck[] | undefined, text: string, role?: ContactRole): readonly IContactWithCheck[] | undefined;
|
|
193
|
+
declare function isContactPassFilter(c: IContactWithBrief, text: string, role?: ContactRole): boolean;
|
|
194
|
+
interface IContactWithBriefAndSpace extends IContactWithBrief {
|
|
195
|
+
readonly space: ISpaceRef;
|
|
196
|
+
}
|
|
197
|
+
declare function addSpace<IBrief>(space: ISpaceRef): (item: IIdAndBrief<IBrief>) => ISpaceItemBriefWithSpace<IBrief>;
|
|
198
|
+
interface IContactDbo extends IContactBase, IPersonRecord, IWithRelatedAndRelatedIDs {
|
|
199
|
+
readonly assets?: IContact2Asset[];
|
|
200
|
+
}
|
|
201
|
+
type IContactWithDbo = IIdAndBriefAndDbo<IContactBrief, IContactDbo>;
|
|
202
|
+
type IContactWithOptionalDbo = IIdAndBriefAndOptionalDbo<IContactBrief, IContactDbo>;
|
|
203
|
+
interface IContactWithDboAndSpace extends IContactWithDbo, IContactWithBriefAndSpace {
|
|
204
|
+
}
|
|
205
|
+
interface IContactWithOptionalDboAndSpace extends IContactWithOptionalDbo, IContactWithBriefAndSpace {
|
|
206
|
+
}
|
|
207
|
+
interface IContactWithCheck extends IContactWithOptionalDboAndSpace {
|
|
208
|
+
readonly isChecked?: boolean;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface IContactGroupBrief {
|
|
212
|
+
readonly emoji?: string;
|
|
213
|
+
readonly title: string;
|
|
214
|
+
}
|
|
215
|
+
type ContactGroupWithIdAndBrief = IIdAndBrief<IContactGroupBrief>;
|
|
216
|
+
|
|
217
|
+
interface DtoTerm extends IWithSpaceIDs, ITitledRecord {
|
|
218
|
+
status: 'active' | 'archived';
|
|
219
|
+
startsOn: string;
|
|
220
|
+
endsOn: string;
|
|
221
|
+
weeks?: number;
|
|
222
|
+
classesTotal?: number;
|
|
223
|
+
classesPerWeek?: number;
|
|
224
|
+
prices?: ITermPrice[];
|
|
225
|
+
}
|
|
226
|
+
interface DtoGroupTerms {
|
|
227
|
+
current?: DtoTerm;
|
|
228
|
+
next?: DtoTerm;
|
|
229
|
+
prev?: DtoTerm;
|
|
230
|
+
}
|
|
231
|
+
interface ITermPrice extends IPrice {
|
|
232
|
+
title: string;
|
|
233
|
+
description?: string;
|
|
234
|
+
numberOfClasses?: number;
|
|
235
|
+
}
|
|
236
|
+
interface ITermCustomer {
|
|
237
|
+
memberId: string;
|
|
238
|
+
paid: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
interface IContactGroupDtoCounts {
|
|
242
|
+
members?: number;
|
|
243
|
+
}
|
|
244
|
+
interface IContactGroupDbo extends IContactGroupBrief {
|
|
245
|
+
readonly desc?: string;
|
|
246
|
+
readonly timetable?: string;
|
|
247
|
+
readonly membersVisibility?: MembersVisibility;
|
|
248
|
+
readonly numberOf?: IContactGroupDtoCounts;
|
|
249
|
+
readonly terms?: DtoGroupTerms;
|
|
250
|
+
readonly roles?: readonly IContactRoleWithIdAndBrief[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface IContactusSpaceDbo {
|
|
254
|
+
contacts: Readonly<Record<string, IContactBrief>>;
|
|
255
|
+
}
|
|
256
|
+
type IContactusSpaceDboAndID = IIdAndOptionalDbo<IContactusSpaceDbo>;
|
|
257
|
+
|
|
258
|
+
declare function relationshipTitle(id: string): string;
|
|
259
|
+
type FamilyMemberRelations = EnumAsUnionOfKeys<typeof FamilyMemberRelation>;
|
|
260
|
+
declare const MemberRelationshipOther = "other";
|
|
261
|
+
declare const MemberRelationshipUndisclosed = "undisclosed";
|
|
262
|
+
type MemberRelationship = FamilyMemberRelations | typeof MemberRelationshipOther | typeof MemberRelationshipUndisclosed;
|
|
263
|
+
interface IMemberBase extends IPersonRecord, IVerification, ITotalsHolder {
|
|
264
|
+
readonly type: SpaceMemberType;
|
|
265
|
+
readonly title?: string;
|
|
266
|
+
readonly userID?: string;
|
|
267
|
+
readonly roles?: readonly MemberRole[];
|
|
268
|
+
readonly avatar?: IAvatar;
|
|
269
|
+
}
|
|
270
|
+
type IMemberBrief = IContactBrief;
|
|
271
|
+
interface IMemberDbo extends IMemberBase {
|
|
272
|
+
position?: string;
|
|
273
|
+
groups?: IContactGroupBrief[];
|
|
274
|
+
}
|
|
275
|
+
interface IWithContactGroups {
|
|
276
|
+
groupIDs?: readonly string[];
|
|
277
|
+
groups: Record<string, IContactGroupBrief>;
|
|
278
|
+
}
|
|
279
|
+
declare function memberDtoFromMemberInfo(memberInfo: ISpaceMemberInfo, spaceID: string, title: string): IMemberDbo;
|
|
280
|
+
interface ICommuneDtoMemberGroupInfo extends ITitledRecordInfo {
|
|
281
|
+
members: number;
|
|
282
|
+
}
|
|
283
|
+
declare const MemberGroupTypeAdults = "adults";
|
|
284
|
+
declare const MemberGroupTypeKids = "kids";
|
|
285
|
+
declare const MemberGroupTypePets = "pets";
|
|
286
|
+
declare const MemberGroupTypeOther = "other";
|
|
287
|
+
type MemberGroupType = typeof MemberGroupTypeAdults | typeof MemberGroupTypeKids | typeof MemberGroupTypePets | typeof MemberGroupTypeOther;
|
|
288
|
+
|
|
289
|
+
interface IContactContext extends ISpaceItemNavContext<IContactBrief, IContactDbo> {
|
|
290
|
+
parentContact?: IContactContext;
|
|
291
|
+
}
|
|
292
|
+
type ContactDboWithSpaceRef = {
|
|
293
|
+
readonly dbo: IContactDbo;
|
|
294
|
+
readonly space: ISpaceRef;
|
|
295
|
+
};
|
|
296
|
+
type ContactIdAndDboWithSpaceRef = IIdAndDboWithSpaceRef<IContactDbo>;
|
|
297
|
+
type NewContactBaseDboAndSpaceRef = {
|
|
298
|
+
readonly dbo: IContactBase;
|
|
299
|
+
readonly space: ISpaceRef;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
type IMemberContext = ISpaceItemNavContext<IMemberBrief, IMemberDbo>;
|
|
303
|
+
type IPersonContext = ISpaceItemWithBriefAndDbo<IPersonBrief, IPerson>;
|
|
304
|
+
type IMemberGroupContext = ISpaceItemNavContext<IContactGroupBrief, IContactGroupDbo>;
|
|
305
|
+
declare class Member {
|
|
306
|
+
member: IMemberContext;
|
|
307
|
+
isChecked: boolean;
|
|
308
|
+
readonly totals: Totals;
|
|
309
|
+
constructor(member: IMemberContext, isChecked?: boolean);
|
|
310
|
+
get id(): string;
|
|
311
|
+
get title(): string;
|
|
312
|
+
get emoji(): string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
interface ICreateSpaceMemberRequest extends ISpaceRequest, IRelatedPerson {
|
|
316
|
+
readonly type: MemberContactType;
|
|
317
|
+
readonly status: SpaceMemberStatus;
|
|
318
|
+
readonly countryID: string;
|
|
319
|
+
readonly roles: readonly string[];
|
|
320
|
+
readonly message?: string;
|
|
321
|
+
}
|
|
322
|
+
declare function validateCreateSpaceMemberRequest(request: ICreateSpaceMemberRequest): void;
|
|
323
|
+
interface ICreateContactBaseRequest extends ISpaceRequest {
|
|
324
|
+
readonly status: 'active' | 'draft';
|
|
325
|
+
readonly type: ContactType;
|
|
326
|
+
readonly parentContactID?: string;
|
|
327
|
+
readonly roles?: readonly string[];
|
|
328
|
+
readonly relatedToAssets?: readonly IContact2Asset[];
|
|
329
|
+
readonly relatedToContacts?: Readonly<Record<string, IContact2ContactInRequest>>;
|
|
330
|
+
}
|
|
331
|
+
interface ICreateContactPersonRequest extends ICreateContactBaseRequest {
|
|
332
|
+
readonly type: 'person';
|
|
333
|
+
readonly person?: ICreatePeronRequest;
|
|
334
|
+
}
|
|
335
|
+
interface ICreateContactLocationRequest extends ICreateContactBaseRequest {
|
|
336
|
+
readonly type: 'location';
|
|
337
|
+
readonly location?: ICreateLocationRequest;
|
|
338
|
+
}
|
|
339
|
+
interface IBasicContactRequest {
|
|
340
|
+
readonly title: string;
|
|
341
|
+
}
|
|
342
|
+
interface ICreateContactBasicRequest extends ICreateContactBaseRequest {
|
|
343
|
+
readonly basic: IBasicContactRequest;
|
|
344
|
+
}
|
|
345
|
+
interface ICreateLocationBaseRequest {
|
|
346
|
+
readonly title: string;
|
|
347
|
+
readonly address: IAddress;
|
|
348
|
+
}
|
|
349
|
+
type ICreateLocationRequest = ICreateLocationBaseRequest;
|
|
350
|
+
type ICreateCompanyRequest = ICreateLocationBaseRequest;
|
|
351
|
+
interface ICreateContactCompanyRequest extends ICreateContactBaseRequest {
|
|
352
|
+
company?: ICreateCompanyRequest;
|
|
353
|
+
}
|
|
354
|
+
type ICreateContactRequest = ICreateContactPersonRequest | ICreateContactCompanyRequest | ICreateContactLocationRequest | ICreateContactBasicRequest;
|
|
355
|
+
interface IBy {
|
|
356
|
+
readonly memberID?: string;
|
|
357
|
+
readonly userID?: string;
|
|
358
|
+
readonly title: string;
|
|
359
|
+
}
|
|
360
|
+
interface IInvite {
|
|
361
|
+
readonly message?: string;
|
|
362
|
+
}
|
|
363
|
+
interface IInviteFromContact {
|
|
364
|
+
readonly memberID: string;
|
|
365
|
+
readonly userID?: string;
|
|
366
|
+
readonly title?: string;
|
|
367
|
+
}
|
|
368
|
+
type InviteChannel = 'email' | 'sms' | 'link';
|
|
369
|
+
interface IInviteToContact {
|
|
370
|
+
readonly channel: InviteChannel;
|
|
371
|
+
readonly address?: string;
|
|
372
|
+
readonly memberID?: string;
|
|
373
|
+
readonly title?: string;
|
|
374
|
+
}
|
|
375
|
+
interface IPersonalInvite extends IInvite {
|
|
376
|
+
readonly space: {
|
|
377
|
+
readonly id: string;
|
|
378
|
+
readonly title: string;
|
|
379
|
+
};
|
|
380
|
+
readonly memberID: string;
|
|
381
|
+
readonly from: IInviteFromContact;
|
|
382
|
+
readonly to: IInviteToContact;
|
|
383
|
+
}
|
|
384
|
+
interface IAddSpaceMemberResponse {
|
|
385
|
+
readonly member: IMemberContext;
|
|
386
|
+
}
|
|
387
|
+
interface IAcceptPersonalInviteRequest extends ISpaceRequest {
|
|
388
|
+
readonly inviteID: string;
|
|
389
|
+
readonly pin: string;
|
|
390
|
+
readonly member?: IMemberBrief;
|
|
391
|
+
}
|
|
392
|
+
interface ICreatePersonalInviteRequest extends ISpaceRequest {
|
|
393
|
+
readonly to: IInviteToContact;
|
|
394
|
+
readonly message: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface IJoinSpaceInfoResponse {
|
|
398
|
+
space: IInviteSpace;
|
|
399
|
+
invite: {
|
|
400
|
+
id: string;
|
|
401
|
+
pin: string;
|
|
402
|
+
status: string;
|
|
403
|
+
created: string;
|
|
404
|
+
from: IInviteFromContact;
|
|
405
|
+
to: IInviteToContact;
|
|
406
|
+
message?: string;
|
|
407
|
+
};
|
|
408
|
+
member: IMemberBrief;
|
|
409
|
+
}
|
|
410
|
+
interface ICreatePersonalInviteResponse {
|
|
411
|
+
invite: {
|
|
412
|
+
id: string;
|
|
413
|
+
pin?: string;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export { ContactRoleDriver, ContactRoleEmployee, ContactRoleFriend, ContactRoleInsurer, ContactRoleLocation, ContactRoleParentOfFriend, ContactRolePet, ContactRoleRelative, ContactRoleShip, ContactTypeAnimal, ContactTypeCompany, ContactTypeLocation, ContactTypePerson, ContactTypeVehicle, FamilyMemberRelation, Member, MemberGroupTypeAdults, MemberGroupTypeKids, MemberGroupTypeOther, MemberGroupTypePets, MemberRelationshipOther, MemberRelationshipUndisclosed, MemberRoleContributor, MemberRoleParish, MemberRoleSpectator, PetKinds, RoleSpaceMember, addSpace, emptyContactBase, emptyMemberPerson, filterContactsByTextAndRole, isContactPassFilter, isPersonNotReady, isPersonReady, isRelatedPersonNotReady, isRelatedPersonReady, memberDtoFromMemberInfo, relatedPersonToPerson, relationshipTitle, validateAddress, validateCreateSpaceMemberRequest };
|
|
418
|
+
export type { ContactCommChannelType, ContactDboWithSpaceRef, ContactGroupWithIdAndBrief, ContactIdAndDboWithSpaceRef, ContactRole, ContactRoleDwellingRelated, ContactRoleFamilyRelated, ContactRoleKidRelated, ContactRoleLogistParentContact, ContactRoleLogistSubContact, ContactRoleMedRelated, ContactRoleVehicle, ContactRoleWorkRelated, ContactToAssetRelation, ContactToContactRelation, ContactType, DtoGroupTerms, DtoTerm, FamilyMemberRelations, IAcceptPersonalInviteRequest, IAddSpaceMemberResponse, IAddress, IBasicContactRequest, IBy, ICommuneDtoMemberGroupInfo, IContact2Asset, IContact2ContactInRequest, IContactBase, IContactBrief, IContactChannels, IContactCommChannelProps, IContactContext, IContactDbo, IContactGroupBrief, IContactGroupDbo, IContactGroupDtoCounts, IContactRoleBrief, IContactRoleWithIdAndBrief, IContactRoleWithIdAndOptionalBrief, IContactWithBrief, IContactWithBriefAndSpace, IContactWithCheck, IContactWithDbo, IContactWithDboAndSpace, IContactWithOptionalDbo, IContactWithOptionalDboAndSpace, IContactusSpaceDbo, IContactusSpaceDboAndID, ICreateCompanyRequest, ICreateContactBaseRequest, ICreateContactBasicRequest, ICreateContactCompanyRequest, ICreateContactLocationRequest, ICreateContactPersonRequest, ICreateContactRequest, ICreateLocationBaseRequest, ICreateLocationRequest, ICreatePeronRequest, ICreatePersonalInviteRequest, ICreatePersonalInviteResponse, ICreateSpaceMemberRequest, IEmail, IInviteFromContact, IInviteToContact, IJoinSpaceInfoResponse, IMemberBase, IMemberBrief, IMemberContext, IMemberDbo, IMemberGroupContext, IMemberPerson, IPerson, IPersonBrief, IPersonContext, IPersonRecord, IPersonRequirements, IPersonalInvite, IPhone, IRelatedPerson, IRelatedPersonContact, ISpaceMemberInfo, ITermCustomer, ITermPrice, IWithContactGroups, InviteChannel, LogistOrderContactRole, MemberContactType, MemberGroupType, MemberRelationship, MemberRole, MemberRoleEducation, MemberRoleRealtor, MembersVisibility, NewContactBaseDboAndSpaceRef, PetKind, RequirementOption };
|
package/eslint.config.js
DELETED
package/ng-package.json
DELETED
package/project.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "contactus-core",
|
|
3
|
-
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"projectType": "library",
|
|
5
|
-
"sourceRoot": "libs/contactus/core/src",
|
|
6
|
-
"prefix": "sneat",
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/angular:package",
|
|
10
|
-
"outputs": [
|
|
11
|
-
"{workspaceRoot}/dist/libs/contactus/core"
|
|
12
|
-
],
|
|
13
|
-
"options": {
|
|
14
|
-
"project": "libs/contactus/core/ng-package.json",
|
|
15
|
-
"tsConfig": "libs/contactus/core/tsconfig.lib.json"
|
|
16
|
-
},
|
|
17
|
-
"configurations": {
|
|
18
|
-
"production": {
|
|
19
|
-
"tsConfig": "libs/contactus/core/tsconfig.lib.prod.json"
|
|
20
|
-
},
|
|
21
|
-
"development": {}
|
|
22
|
-
},
|
|
23
|
-
"defaultConfiguration": "production"
|
|
24
|
-
},
|
|
25
|
-
"test": {
|
|
26
|
-
"executor": "@nx/vitest:test",
|
|
27
|
-
"outputs": [
|
|
28
|
-
"{workspaceRoot}/coverage/libs/contactus/core"
|
|
29
|
-
],
|
|
30
|
-
"options": {
|
|
31
|
-
"tsConfig": "libs/contactus/core/tsconfig.spec.json"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"lint": {
|
|
35
|
-
"executor": "@nx/eslint:lint"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/index.ts
DELETED
package/src/lib/apidto/index.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { mustHaveAtLeastOneName } from '@sneat/auth-models';
|
|
2
|
-
import { validateRelated } from '@sneat/dto';
|
|
3
|
-
import {
|
|
4
|
-
ContactType,
|
|
5
|
-
IAddress,
|
|
6
|
-
IContact2Asset,
|
|
7
|
-
IContact2ContactInRequest,
|
|
8
|
-
ICreatePeronRequest,
|
|
9
|
-
IMemberBrief,
|
|
10
|
-
IRelatedPerson,
|
|
11
|
-
MemberContactType,
|
|
12
|
-
} from '../dto';
|
|
13
|
-
import { IMemberContext } from '../contexts';
|
|
14
|
-
import { ISpaceRequest, SpaceMemberStatus } from '@sneat/space-models';
|
|
15
|
-
|
|
16
|
-
export interface ICreateSpaceMemberRequest
|
|
17
|
-
extends ISpaceRequest, IRelatedPerson {
|
|
18
|
-
readonly type: MemberContactType;
|
|
19
|
-
readonly status: SpaceMemberStatus;
|
|
20
|
-
readonly countryID: string;
|
|
21
|
-
readonly roles: readonly string[];
|
|
22
|
-
readonly message?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function validateCreateSpaceMemberRequest(
|
|
26
|
-
request: ICreateSpaceMemberRequest,
|
|
27
|
-
): void {
|
|
28
|
-
mustHaveAtLeastOneName(request.names);
|
|
29
|
-
validateRelated(request.related);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ICreateContactBaseRequest extends ISpaceRequest {
|
|
33
|
-
readonly status: 'active' | 'draft';
|
|
34
|
-
readonly type: ContactType;
|
|
35
|
-
// countryID: string;
|
|
36
|
-
readonly parentContactID?: string;
|
|
37
|
-
readonly roles?: readonly string[];
|
|
38
|
-
readonly relatedToAssets?: readonly IContact2Asset[];
|
|
39
|
-
readonly relatedToContacts?: Readonly<
|
|
40
|
-
Record<string, IContact2ContactInRequest>
|
|
41
|
-
>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface ICreateContactPersonRequest extends ICreateContactBaseRequest {
|
|
45
|
-
readonly type: 'person';
|
|
46
|
-
readonly person?: ICreatePeronRequest;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ICreateContactLocationRequest extends ICreateContactBaseRequest {
|
|
50
|
-
readonly type: 'location';
|
|
51
|
-
readonly location?: ICreateLocationRequest;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IBasicContactRequest {
|
|
55
|
-
// type: ContactType;
|
|
56
|
-
// relationship?: string;
|
|
57
|
-
// message?: string;
|
|
58
|
-
readonly title: string;
|
|
59
|
-
// parentContactID?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface ICreateContactBasicRequest extends ICreateContactBaseRequest {
|
|
63
|
-
readonly basic: IBasicContactRequest;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface ICreateLocationBaseRequest {
|
|
67
|
-
readonly title: string;
|
|
68
|
-
readonly address: IAddress;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type ICreateLocationRequest = ICreateLocationBaseRequest;
|
|
72
|
-
export type ICreateCompanyRequest = ICreateLocationBaseRequest;
|
|
73
|
-
|
|
74
|
-
export interface ICreateContactCompanyRequest extends ICreateContactBaseRequest {
|
|
75
|
-
company?: ICreateCompanyRequest;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type ICreateContactRequest =
|
|
79
|
-
| ICreateContactPersonRequest
|
|
80
|
-
| ICreateContactCompanyRequest
|
|
81
|
-
| ICreateContactLocationRequest
|
|
82
|
-
| ICreateContactBasicRequest;
|
|
83
|
-
|
|
84
|
-
export interface IBy {
|
|
85
|
-
readonly memberID?: string;
|
|
86
|
-
readonly userID?: string;
|
|
87
|
-
readonly title: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface IInvite {
|
|
91
|
-
readonly message?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface IInviteFromContact {
|
|
95
|
-
readonly memberID: string;
|
|
96
|
-
readonly userID?: string;
|
|
97
|
-
readonly title?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type InviteChannel = 'email' | 'sms' | 'link';
|
|
101
|
-
|
|
102
|
-
export interface IInviteToContact {
|
|
103
|
-
readonly channel: InviteChannel;
|
|
104
|
-
readonly address?: string;
|
|
105
|
-
readonly memberID?: string;
|
|
106
|
-
readonly title?: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface IPersonalInvite extends IInvite {
|
|
110
|
-
readonly space: { readonly id: string; readonly title: string };
|
|
111
|
-
readonly memberID: string;
|
|
112
|
-
readonly from: IInviteFromContact;
|
|
113
|
-
readonly to: IInviteToContact;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface IAddSpaceMemberResponse {
|
|
117
|
-
readonly member: IMemberContext;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface IAcceptPersonalInviteRequest extends ISpaceRequest {
|
|
121
|
-
readonly inviteID: string;
|
|
122
|
-
readonly pin: string; // Do not make number as we can lose leading 0's
|
|
123
|
-
readonly member?: IMemberBrief;
|
|
124
|
-
// fullName?: string;
|
|
125
|
-
// email?: string;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface ICreatePersonalInviteRequest extends ISpaceRequest {
|
|
129
|
-
readonly to: IInviteToContact;
|
|
130
|
-
readonly message: string;
|
|
131
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IInviteSpace } from '@sneat/space-models';
|
|
2
|
-
import { IMemberBrief } from '../dto';
|
|
3
|
-
import { IInviteFromContact, IInviteToContact } from './requests';
|
|
4
|
-
|
|
5
|
-
export interface IJoinSpaceInfoResponse {
|
|
6
|
-
space: IInviteSpace;
|
|
7
|
-
invite: {
|
|
8
|
-
id: string;
|
|
9
|
-
pin: string;
|
|
10
|
-
status: string;
|
|
11
|
-
created: string;
|
|
12
|
-
from: IInviteFromContact;
|
|
13
|
-
to: IInviteToContact;
|
|
14
|
-
message?: string;
|
|
15
|
-
};
|
|
16
|
-
member: IMemberBrief;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ICreatePersonalInviteResponse {
|
|
20
|
-
invite: { id: string; pin?: string };
|
|
21
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IIdAndDboWithSpaceRef, ISpaceRef } from '@sneat/core';
|
|
2
|
-
import { IContactBase, IContactBrief, IContactDbo } from '../dto';
|
|
3
|
-
import { ISpaceItemNavContext } from '@sneat/space-models';
|
|
4
|
-
|
|
5
|
-
export interface IContactContext extends ISpaceItemNavContext<
|
|
6
|
-
IContactBrief,
|
|
7
|
-
IContactDbo
|
|
8
|
-
> {
|
|
9
|
-
parentContact?: IContactContext;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type ContactDboWithSpaceRef = {
|
|
13
|
-
readonly dbo: IContactDbo;
|
|
14
|
-
readonly space: ISpaceRef;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type ContactIdAndDboWithSpaceRef = IIdAndDboWithSpaceRef<IContactDbo>;
|
|
18
|
-
|
|
19
|
-
export type NewContactBaseDboAndSpaceRef = {
|
|
20
|
-
readonly dbo: IContactBase;
|
|
21
|
-
readonly space: ISpaceRef;
|
|
22
|
-
};
|