@dev-crew-berlin/enter-js-utils 0.60.5 → 0.70.1
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/generated/api-schema.d.ts +85 -18
- package/dist/models/attendee.d.ts +2 -1
- package/dist/models/attendee.js +9 -4
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/rsvp.d.ts +12 -0
- package/dist/models/rsvp.js +34 -0
- package/dist/ui/companion-info.stories.js +6 -1
- package/dist/ui/guest-card.stories.js +18 -3
- package/package.json +1 -1
|
@@ -211,7 +211,7 @@ export declare type components = {
|
|
|
211
211
|
attendeeId: string;
|
|
212
212
|
/** Rsvp */
|
|
213
213
|
rsvp: {
|
|
214
|
-
[key: string]:
|
|
214
|
+
[key: string]: components["schemas"]["RSVP-Input"] | null;
|
|
215
215
|
};
|
|
216
216
|
/**
|
|
217
217
|
* Responsetime
|
|
@@ -233,16 +233,11 @@ export declare type components = {
|
|
|
233
233
|
deletedTags?: string[];
|
|
234
234
|
/** Language */
|
|
235
235
|
language?: string;
|
|
236
|
-
/**
|
|
237
|
-
* Time
|
|
238
|
-
* Format: date-time
|
|
239
|
-
*/
|
|
240
|
-
time?: string;
|
|
241
236
|
/** Rsvp */
|
|
242
237
|
rsvp?: {
|
|
243
|
-
[key: string]:
|
|
238
|
+
[key: string]: components["schemas"]["RSVP-Input"] | null;
|
|
244
239
|
};
|
|
245
|
-
companions?: components["schemas"]["
|
|
240
|
+
companions?: components["schemas"]["RootModel_Union_Companion__MainGuest__-Input"];
|
|
246
241
|
payment?: components["schemas"]["Payment"] | null;
|
|
247
242
|
};
|
|
248
243
|
/**
|
|
@@ -271,6 +266,11 @@ export declare type components = {
|
|
|
271
266
|
/** Attendeeid */
|
|
272
267
|
attendeeId: string;
|
|
273
268
|
updates: components["schemas"]["AttendeeUpdate"];
|
|
269
|
+
/**
|
|
270
|
+
* Time
|
|
271
|
+
* Format: date-time
|
|
272
|
+
*/
|
|
273
|
+
time?: string;
|
|
274
274
|
};
|
|
275
275
|
/** AuthCode */
|
|
276
276
|
AuthCode: {
|
|
@@ -1735,6 +1735,27 @@ export declare type components = {
|
|
|
1735
1735
|
*/
|
|
1736
1736
|
max: number;
|
|
1737
1737
|
};
|
|
1738
|
+
/** MailgunConfig */
|
|
1739
|
+
MailgunConfig: {
|
|
1740
|
+
/**
|
|
1741
|
+
* Provider
|
|
1742
|
+
* @default mailgun
|
|
1743
|
+
* @constant
|
|
1744
|
+
* @enum {string}
|
|
1745
|
+
*/
|
|
1746
|
+
provider?: "mailgun";
|
|
1747
|
+
domain: components["schemas"]["Domain"];
|
|
1748
|
+
/**
|
|
1749
|
+
* Manage Dns
|
|
1750
|
+
* @default true
|
|
1751
|
+
*/
|
|
1752
|
+
manage_dns?: boolean;
|
|
1753
|
+
/**
|
|
1754
|
+
* Sender Username
|
|
1755
|
+
* @default email
|
|
1756
|
+
*/
|
|
1757
|
+
sender_username?: string;
|
|
1758
|
+
};
|
|
1738
1759
|
/** MainGuest */
|
|
1739
1760
|
"MainGuest-Input": {
|
|
1740
1761
|
/**
|
|
@@ -1922,7 +1943,7 @@ export declare type components = {
|
|
|
1922
1943
|
/** Instancename */
|
|
1923
1944
|
instanceName: string;
|
|
1924
1945
|
};
|
|
1925
|
-
Preconditions: [components["schemas"]["Filter"], [string, components["schemas"]["EmailConfig"]][],
|
|
1946
|
+
Preconditions: [components["schemas"]["Filter"], [string, components["schemas"]["EmailConfig"]][], components["schemas"]["MailgunConfig"] | components["schemas"]["SmtpConfig"], components["schemas"]["FrontendConfig"]];
|
|
1926
1947
|
/** PublicAttendee */
|
|
1927
1948
|
"PublicAttendee-Input": {
|
|
1928
1949
|
/** Id */
|
|
@@ -1951,7 +1972,7 @@ export declare type components = {
|
|
|
1951
1972
|
* @default {}
|
|
1952
1973
|
*/
|
|
1953
1974
|
rsvp?: {
|
|
1954
|
-
[key: string]:
|
|
1975
|
+
[key: string]: components["schemas"]["RSVP-Input"] | null;
|
|
1955
1976
|
};
|
|
1956
1977
|
/**
|
|
1957
1978
|
* Checkin
|
|
@@ -1965,7 +1986,7 @@ export declare type components = {
|
|
|
1965
1986
|
* "isCompanion": false
|
|
1966
1987
|
* }
|
|
1967
1988
|
*/
|
|
1968
|
-
companions?: components["schemas"]["
|
|
1989
|
+
companions?: components["schemas"]["RootModel_Union_Companion__MainGuest__-Input"];
|
|
1969
1990
|
payment?: components["schemas"]["Payment"] | null;
|
|
1970
1991
|
/**
|
|
1971
1992
|
* Deleted
|
|
@@ -2001,7 +2022,7 @@ export declare type components = {
|
|
|
2001
2022
|
* @default {}
|
|
2002
2023
|
*/
|
|
2003
2024
|
rsvp: {
|
|
2004
|
-
[key: string]:
|
|
2025
|
+
[key: string]: components["schemas"]["RSVP-Output"] | null;
|
|
2005
2026
|
};
|
|
2006
2027
|
/**
|
|
2007
2028
|
* Checkin
|
|
@@ -2015,7 +2036,7 @@ export declare type components = {
|
|
|
2015
2036
|
* "isCompanion": false
|
|
2016
2037
|
* }
|
|
2017
2038
|
*/
|
|
2018
|
-
companions: components["schemas"]["
|
|
2039
|
+
companions: components["schemas"]["RootModel_Union_Companion__MainGuest__-Output"];
|
|
2019
2040
|
payment: components["schemas"]["Payment"] | null;
|
|
2020
2041
|
/**
|
|
2021
2042
|
* Deleted
|
|
@@ -2092,7 +2113,7 @@ export declare type components = {
|
|
|
2092
2113
|
userdata: Record<string, unknown>;
|
|
2093
2114
|
/** Permissions */
|
|
2094
2115
|
permissions: {
|
|
2095
|
-
[key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-scripts:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write" | "eventlog:read")[];
|
|
2116
|
+
[key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "branches:read" | "branches:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-scripts:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write" | "eventlog:read")[];
|
|
2096
2117
|
};
|
|
2097
2118
|
};
|
|
2098
2119
|
/** QuestionFields */
|
|
@@ -2107,6 +2128,32 @@ export declare type components = {
|
|
|
2107
2128
|
/** Answer */
|
|
2108
2129
|
answer: string;
|
|
2109
2130
|
};
|
|
2131
|
+
/** RSVP */
|
|
2132
|
+
"RSVP-Input": {
|
|
2133
|
+
/**
|
|
2134
|
+
* Tiebreaker
|
|
2135
|
+
* Format: uuid
|
|
2136
|
+
*/
|
|
2137
|
+
tieBreaker?: string;
|
|
2138
|
+
/** Personcount */
|
|
2139
|
+
personCount: number;
|
|
2140
|
+
/** Time */
|
|
2141
|
+
time: string | null;
|
|
2142
|
+
};
|
|
2143
|
+
/** RSVP */
|
|
2144
|
+
"RSVP-Output": {
|
|
2145
|
+
/**
|
|
2146
|
+
* Tiebreaker
|
|
2147
|
+
* Format: uuid
|
|
2148
|
+
*/
|
|
2149
|
+
tieBreaker: string;
|
|
2150
|
+
/** Personcount */
|
|
2151
|
+
personCount: number;
|
|
2152
|
+
/** Time */
|
|
2153
|
+
time: string | null;
|
|
2154
|
+
/** Confirmed */
|
|
2155
|
+
confirmed: boolean;
|
|
2156
|
+
};
|
|
2110
2157
|
/** RadioButtonGroupField */
|
|
2111
2158
|
"RadioButtonGroupField-Input": {
|
|
2112
2159
|
/**
|
|
@@ -2238,10 +2285,10 @@ export declare type components = {
|
|
|
2238
2285
|
allowRegistrationWithAuthCode?: boolean;
|
|
2239
2286
|
auth_code_generator?: components["schemas"]["AuthCodeGenerator"];
|
|
2240
2287
|
};
|
|
2241
|
-
/** RootModel[Union[
|
|
2242
|
-
"
|
|
2243
|
-
/** RootModel[Union[
|
|
2244
|
-
"
|
|
2288
|
+
/** RootModel[Union[Companion, MainGuest]] */
|
|
2289
|
+
"RootModel_Union_Companion__MainGuest__-Input": components["schemas"]["Companion-Input"] | components["schemas"]["MainGuest-Input"];
|
|
2290
|
+
/** RootModel[Union[Companion, MainGuest]] */
|
|
2291
|
+
"RootModel_Union_Companion__MainGuest__-Output": components["schemas"]["Companion-Output"] | components["schemas"]["MainGuest-Output"];
|
|
2245
2292
|
/** RootModel[list[Annotated[Union[AttendeeCreatedEvent, AttendeeUpdatedEvent, AttendeeRespondedEvent, AttendeeAuthCodeRequested, EmailUnsubscribedEvent, AttendeeDeletedEvent, CheckinCreatedEvent, CheckinDeletedEvent, PaymentPaidEvent], FieldInfo(annotation=NoneType, required=True, discriminator='event')]]] */
|
|
2246
2293
|
RootModel_list_Annotated_Union_AttendeeCreatedEvent__AttendeeUpdatedEvent__AttendeeRespondedEvent__AttendeeAuthCodeRequested__EmailUnsubscribedEvent__AttendeeDeletedEvent__CheckinCreatedEvent__CheckinDeletedEvent__PaymentPaidEvent___FieldInfo_annotation_NoneType__required_True__discriminator__event_____: (components["schemas"]["AttendeeCreatedEvent"] | components["schemas"]["AttendeeUpdatedEvent"] | components["schemas"]["AttendeeRespondedEvent"] | components["schemas"]["AttendeeAuthCodeRequested"] | components["schemas"]["EmailUnsubscribedEvent"] | components["schemas"]["AttendeeDeletedEvent"] | components["schemas"]["CheckinCreatedEvent"] | components["schemas"]["CheckinDeletedEvent"] | components["schemas"]["PaymentPaidEvent"])[];
|
|
2247
2294
|
/** SecurityQuestion */
|
|
@@ -2252,6 +2299,26 @@ export declare type components = {
|
|
|
2252
2299
|
/** Flags */
|
|
2253
2300
|
flags?: Record<string, unknown> | null;
|
|
2254
2301
|
};
|
|
2302
|
+
/** SmtpConfig */
|
|
2303
|
+
SmtpConfig: {
|
|
2304
|
+
/**
|
|
2305
|
+
* Provider
|
|
2306
|
+
* @default smtp
|
|
2307
|
+
* @constant
|
|
2308
|
+
* @enum {string}
|
|
2309
|
+
*/
|
|
2310
|
+
provider?: "smtp";
|
|
2311
|
+
/** Server */
|
|
2312
|
+
server: string;
|
|
2313
|
+
/** Port */
|
|
2314
|
+
port: number;
|
|
2315
|
+
/** Username */
|
|
2316
|
+
username: string;
|
|
2317
|
+
/** Password */
|
|
2318
|
+
password: string;
|
|
2319
|
+
/** Sender Address */
|
|
2320
|
+
sender_address: string;
|
|
2321
|
+
};
|
|
2255
2322
|
/** StaticField */
|
|
2256
2323
|
"StaticField-Input": {
|
|
2257
2324
|
/**
|
|
@@ -2,6 +2,7 @@ import { components } from '../generated/api-schema';
|
|
|
2
2
|
import { Checkin } from './checkin';
|
|
3
3
|
import { Checkins } from './checkins';
|
|
4
4
|
import { FieldValue } from './field-value';
|
|
5
|
+
import { Rsvp } from './rsvp';
|
|
5
6
|
export declare type AttendeeJSON = components['schemas']['PublicAttendee-Output'];
|
|
6
7
|
export declare class Attendee {
|
|
7
8
|
id: string;
|
|
@@ -9,7 +10,7 @@ export declare class Attendee {
|
|
|
9
10
|
tags: string[];
|
|
10
11
|
language: string | null;
|
|
11
12
|
time: Date;
|
|
12
|
-
rsvp: Record<string,
|
|
13
|
+
rsvp: Record<string, Rsvp | null>;
|
|
13
14
|
checkin: Record<string, Checkins>;
|
|
14
15
|
companions: {
|
|
15
16
|
isCompanion: false;
|
package/dist/models/attendee.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import { Checkins } from './checkins';
|
|
3
|
+
import { Rsvp } from './rsvp';
|
|
3
4
|
export class Attendee {
|
|
4
5
|
userdata = {};
|
|
5
6
|
tags = [];
|
|
@@ -23,7 +24,7 @@ export class Attendee {
|
|
|
23
24
|
this.tags = json.tags;
|
|
24
25
|
this.language = json.language;
|
|
25
26
|
this.time = new Date(json.time);
|
|
26
|
-
this.rsvp = json.rsvp;
|
|
27
|
+
this.rsvp = Object.fromEntries(new Map(Object.entries(json.rsvp).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? new Rsvp(rsvp) : null])));
|
|
27
28
|
this.checkin = Object.fromEntries(new Map(Object.entries(json.checkin).map(([checkinTag, checkin]) => [checkinTag, new Checkins(checkin)])));
|
|
28
29
|
this.companions = json.companions;
|
|
29
30
|
this.payment = json.payment;
|
|
@@ -50,21 +51,25 @@ export class Attendee {
|
|
|
50
51
|
|
|
51
52
|
// convert each checkin to its json representation
|
|
52
53
|
const checkin = Object.fromEntries(new Map(Object.entries(this.checkin).map(([checkinTag, checkin]) => [checkinTag, checkin.toJSON()])));
|
|
54
|
+
|
|
55
|
+
// convert each rsvp to its json representation
|
|
56
|
+
const rsvp = Object.fromEntries(new Map(Object.entries(this.rsvp).map(([checkinTag, rsvp]) => [checkinTag, rsvp ? rsvp.toJSON() : null])));
|
|
53
57
|
return {
|
|
54
58
|
...this,
|
|
55
59
|
time: this.time?.toISOString(),
|
|
56
|
-
checkin
|
|
60
|
+
checkin,
|
|
61
|
+
rsvp
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
getRsvpCountForTag(checkinTag) {
|
|
60
65
|
const rsvp = this.rsvp[checkinTag];
|
|
61
66
|
if (!rsvp) return 0;
|
|
62
|
-
return rsvp;
|
|
67
|
+
return rsvp.personCount;
|
|
63
68
|
}
|
|
64
69
|
getResponseForTag(checkinTag) {
|
|
65
70
|
const rsvp = this.rsvp[checkinTag] ?? null;
|
|
66
71
|
if (rsvp === null) return 'no-response';
|
|
67
|
-
return rsvp
|
|
72
|
+
return rsvp.confirmed ? 'positive-response' : 'negative-response';
|
|
68
73
|
}
|
|
69
74
|
getCheckinsForTag(checkinTag) {
|
|
70
75
|
return this.checkin[checkinTag] ?? new Checkins({
|
package/dist/models/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { Attendee } from './attendee';
|
|
|
2
2
|
export type { AttendeeJSON } from './attendee';
|
|
3
3
|
export type { CheckinCounts } from './checkin-counts';
|
|
4
4
|
export { Checkin } from './checkin';
|
|
5
|
+
export { Rsvp } from './rsvp';
|
|
5
6
|
export type { CheckinJSON } from './checkin';
|
|
6
7
|
export { Checkins } from './checkins';
|
|
7
8
|
export type { CheckinsJSON } from './checkins';
|
package/dist/models/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { components } from '../generated/api-schema';
|
|
2
|
+
export declare type RsvpJSON = components['schemas']['RSVP-Output'];
|
|
3
|
+
export declare class Rsvp {
|
|
4
|
+
tieBreaker: string;
|
|
5
|
+
time: Date | null;
|
|
6
|
+
personCount: number;
|
|
7
|
+
constructor(args: RsvpJSON | number);
|
|
8
|
+
static confirm(personCount?: number): Rsvp;
|
|
9
|
+
static decline(): Rsvp;
|
|
10
|
+
get confirmed(): boolean;
|
|
11
|
+
toJSON(): RsvpJSON;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
export class Rsvp {
|
|
3
|
+
constructor(args) {
|
|
4
|
+
if (typeof args == 'number') {
|
|
5
|
+
this.tieBreaker = uuidv4();
|
|
6
|
+
this.time = new Date();
|
|
7
|
+
this.personCount = args;
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
this.tieBreaker = args.tieBreaker;
|
|
11
|
+
this.time = args.time ? new Date(args.time) : null;
|
|
12
|
+
this.personCount = args.personCount;
|
|
13
|
+
}
|
|
14
|
+
static confirm(personCount = 1) {
|
|
15
|
+
if (personCount < 1) {
|
|
16
|
+
throw new Error('negative person count is not a positive response');
|
|
17
|
+
}
|
|
18
|
+
return new Rsvp(personCount);
|
|
19
|
+
}
|
|
20
|
+
static decline() {
|
|
21
|
+
return new Rsvp(0);
|
|
22
|
+
}
|
|
23
|
+
get confirmed() {
|
|
24
|
+
return this.personCount > 0;
|
|
25
|
+
}
|
|
26
|
+
toJSON() {
|
|
27
|
+
return {
|
|
28
|
+
tieBreaker: this.tieBreaker,
|
|
29
|
+
time: this.time ? this.time.toISOString() : null,
|
|
30
|
+
personCount: this.personCount,
|
|
31
|
+
confirmed: this.confirmed
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -16,7 +16,12 @@ const mainGuest = new Attendee({
|
|
|
16
16
|
tags: ['VIP', 'Import-200-02-10'],
|
|
17
17
|
time: new Date('2022-01-01').toISOString(),
|
|
18
18
|
rsvp: {
|
|
19
|
-
default:
|
|
19
|
+
default: {
|
|
20
|
+
confirmed: true,
|
|
21
|
+
personCount: 1,
|
|
22
|
+
time: new Date('2022-01-01').toISOString(),
|
|
23
|
+
tieBreaker: '1'
|
|
24
|
+
}
|
|
20
25
|
},
|
|
21
26
|
checkin: {},
|
|
22
27
|
companions: {
|
|
@@ -17,7 +17,12 @@ const attendee = new Attendee({
|
|
|
17
17
|
tags: ['VIP', 'Import-200-02-10'],
|
|
18
18
|
time: new Date('2022-01-01').toISOString(),
|
|
19
19
|
rsvp: {
|
|
20
|
-
default:
|
|
20
|
+
default: {
|
|
21
|
+
confirmed: true,
|
|
22
|
+
personCount: 1,
|
|
23
|
+
time: new Date('2022-01-01').toISOString(),
|
|
24
|
+
tieBreaker: '1'
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
27
|
checkin: {},
|
|
23
28
|
companions: {
|
|
@@ -35,7 +40,12 @@ const attendeeWithMultipleTags = new Attendee({
|
|
|
35
40
|
tags: ['VIP', 'tester', 'Import-200-02-10'],
|
|
36
41
|
time: new Date('2022-01-01').toISOString(),
|
|
37
42
|
rsvp: {
|
|
38
|
-
default:
|
|
43
|
+
default: {
|
|
44
|
+
confirmed: true,
|
|
45
|
+
personCount: 1,
|
|
46
|
+
time: new Date('2022-01-01').toISOString(),
|
|
47
|
+
tieBreaker: '1'
|
|
48
|
+
}
|
|
39
49
|
},
|
|
40
50
|
checkin: {},
|
|
41
51
|
companions: {
|
|
@@ -53,7 +63,12 @@ const companion = new Attendee({
|
|
|
53
63
|
tags: ['VIP'],
|
|
54
64
|
time: new Date('2022-01-01').toISOString(),
|
|
55
65
|
rsvp: {
|
|
56
|
-
default:
|
|
66
|
+
default: {
|
|
67
|
+
confirmed: true,
|
|
68
|
+
personCount: 1,
|
|
69
|
+
time: new Date('2022-01-01').toISOString(),
|
|
70
|
+
tieBreaker: '1'
|
|
71
|
+
}
|
|
57
72
|
},
|
|
58
73
|
checkin: {},
|
|
59
74
|
companions: {
|