@envoy/envoy-integrations-sdk 2.3.1 → 2.3.2
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 +24 -16
- package/dist/base/EnvoyAPI.d.ts.map +1 -1
- package/dist/base/EnvoyAPI.js +23 -23
- package/dist/factories/entryEventBodyFactory.d.ts.map +1 -1
- package/dist/factories/entryEventBodyFactory.js +38 -30
- package/dist/factories/eventBodyFactory.d.ts.map +1 -1
- package/dist/factories/inviteEventBodyFactory.d.ts.map +1 -1
- package/dist/factories/inviteEventBodyFactory.js +11 -10
- package/dist/factories/routeBodyFactory.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/EnvoyEntryEvent.d.ts.map +1 -1
- package/dist/internal/EnvoyInviteEvent.d.ts.map +1 -1
- package/dist/internal/EnvoyStorageCommand.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginJobMock.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginStoragePipelineMock.d.ts.map +1 -1
- package/dist/mocks/EnvoyPluginStoragePipelineMock.js +1 -1
- package/dist/payloads/EntryPayload.d.ts.map +1 -1
- package/dist/payloads/InvitePayload.d.ts.map +1 -1
- package/dist/payloads/NotificationPayload.d.ts.map +1 -1
- package/dist/resources/FlowResource.d.ts +2 -1
- package/dist/resources/FlowResource.d.ts.map +1 -1
- package/dist/resources/ReservationResource.d.ts +5 -5
- package/dist/resources/ReservationResource.d.ts.map +1 -1
- package/dist/resources/SignInFieldPageResource.d.ts.map +1 -1
- package/dist/sdk/EnvoyMeta.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginAPI.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginJobAttachment.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginSDK.js +1 -1
- package/dist/sdk/EnvoyPluginStorage.d.ts.map +1 -1
- package/dist/sdk/EnvoyPluginStorage.js +6 -2
- package/dist/sdk/EnvoyRequest.d.ts.map +1 -1
- package/dist/sdk/EnvoyUserAPI.d.ts +1 -1
- package/dist/sdk/EnvoyUserAPI.d.ts.map +1 -1
- package/dist/sdk/EnvoyUserAPI.js +8 -8
- package/dist/sdk/filters.d.ts.map +1 -1
- package/dist/sdk/handlers.d.ts.map +1 -1
- package/dist/sdk/handlers.js +3 -1
- package/dist/sdk/loggers.js +2 -5
- package/dist/sdk/middleware.d.ts.map +1 -1
- package/dist/sdk/middleware.js +1 -1
- package/dist/util/EnvoySignatureVerifier.d.ts.map +1 -1
- package/dist/util/json-api/JSONAPIPaginationParams.d.ts.map +1 -1
- package/dist/util/json-api/JSONAPIResponse.d.ts.map +1 -1
- package/package.json +14 -6
- package/src/base/EnvoyAPI.ts +23 -25
- package/src/factories/entryEventBodyFactory.ts +59 -48
- package/src/factories/eventBodyFactory.ts +8 -10
- package/src/factories/inviteEventBodyFactory.ts +26 -24
- package/src/factories/metaFactory.ts +1 -1
- package/src/factories/routeBodyFactory.ts +9 -11
- package/src/index.ts +2 -0
- package/src/internal/EnvoyEntryEvent.ts +7 -7
- package/src/internal/EnvoyInviteEvent.ts +10 -10
- package/src/internal/EnvoyOption.ts +3 -3
- package/src/internal/EnvoyOptionsRouteParams.ts +3 -3
- package/src/internal/EnvoyPluginJobUpdate.ts +4 -4
- package/src/internal/EnvoyRemoteValueRouteResponseBody.ts +1 -1
- package/src/internal/EnvoySelectedValuesRouteParams.ts +1 -1
- package/src/internal/EnvoyStorageCommand.ts +21 -20
- package/src/mocks/EnvoyPluginJobMock.ts +2 -4
- package/src/mocks/EnvoyPluginStoragePipelineMock.ts +12 -4
- package/src/payloads/EntryPayload.ts +56 -60
- package/src/payloads/InvitePayload.ts +50 -50
- package/src/payloads/NotificationPayload.ts +38 -38
- package/src/resources/FlowResource.ts +2 -1
- package/src/resources/ReservationResource.ts +27 -21
- package/src/resources/SignInFieldPageResource.ts +6 -5
- package/src/resources/SignInFieldResource.ts +3 -3
- package/src/sdk/EnvoyMeta.ts +57 -57
- package/src/sdk/EnvoyPluginAPI.ts +5 -1
- package/src/sdk/EnvoyPluginJobAttachment.ts +14 -13
- package/src/sdk/EnvoyPluginSDK.ts +3 -3
- package/src/sdk/EnvoyPluginStorage.ts +8 -4
- package/src/sdk/EnvoyRequest.ts +61 -27
- package/src/sdk/EnvoyStorageItem.ts +2 -2
- package/src/sdk/EnvoyUserAPI.ts +51 -50
- package/src/sdk/filters.ts +5 -14
- package/src/sdk/handlers.ts +84 -76
- package/src/sdk/loggers.ts +15 -15
- package/src/sdk/middleware.ts +12 -10
- package/src/util/EnvoySignatureVerifier.ts +6 -14
- package/src/util/json-api/JSONAPIPaginationParams.ts +1 -2
- package/src/util/json-api/JSONAPIResponse.ts +3 -3
|
@@ -8,23 +8,21 @@ export const routeBodyFactoryDefaultIds = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type RouteBodyFactoryOptions<Config, Params, Payload> = {
|
|
11
|
-
config: Partial<Config
|
|
12
|
-
params: Params
|
|
13
|
-
payload: Payload
|
|
14
|
-
scope?: Array<EnvoyUserAPIScope
|
|
15
|
-
locationId?: string
|
|
16
|
-
companyId?: string
|
|
17
|
-
zoneId?: string
|
|
18
|
-
route?: string
|
|
11
|
+
config: Partial<Config>;
|
|
12
|
+
params: Params;
|
|
13
|
+
payload: Payload;
|
|
14
|
+
scope?: Array<EnvoyUserAPIScope>;
|
|
15
|
+
locationId?: string;
|
|
16
|
+
companyId?: string;
|
|
17
|
+
zoneId?: string;
|
|
18
|
+
route?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export default function routeBodyFactory<
|
|
22
22
|
Config extends Record<string, unknown> = Record<string, never>,
|
|
23
23
|
Params extends Record<string, unknown> = Record<string, never>,
|
|
24
24
|
Payload extends Record<string, unknown> = Record<string, never>,
|
|
25
|
-
|
|
26
|
-
options: RouteBodyFactoryOptions<Config, Params, Payload>,
|
|
27
|
-
) {
|
|
25
|
+
>(options: RouteBodyFactoryOptions<Config, Params, Payload>) {
|
|
28
26
|
return {
|
|
29
27
|
meta: routeMetaFactory<Config, Params>(
|
|
30
28
|
options.route || '',
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import EnvoyValidationRouteResponseBody from './sdk/EnvoyValidationRouteResponse
|
|
|
29
29
|
import EnvoyJWT from './util/EnvoyJWT';
|
|
30
30
|
import EnvoySignatureVerifier from './util/EnvoySignatureVerifier';
|
|
31
31
|
import JSONAPIData from './util/json-api/JSONAPIData';
|
|
32
|
+
import JSONAPIResponse from './util/json-api/JSONAPIResponse';
|
|
32
33
|
|
|
33
34
|
export * from './factories/entryEventBodyFactory';
|
|
34
35
|
export * from './factories/eventBodyFactory';
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
EnvoyUserAPI,
|
|
81
82
|
EnvoyValidationRouteResponseBody,
|
|
82
83
|
JSONAPIData,
|
|
84
|
+
JSONAPIResponse,
|
|
83
85
|
HttpStatus,
|
|
84
86
|
entryEventBodyFactory,
|
|
85
87
|
eventBodyFactory,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
type EnvoyEntryEvent =
|
|
2
|
-
'entry_sign_in'
|
|
3
|
-
'entry_sign_out'
|
|
4
|
-
'entry_blacklist_review'
|
|
5
|
-
'entry_blacklist_deny'
|
|
6
|
-
'employee_entry_sign_in'
|
|
7
|
-
'employee_entry_sign_out'
|
|
8
|
-
string;
|
|
2
|
+
| 'entry_sign_in'
|
|
3
|
+
| 'entry_sign_out'
|
|
4
|
+
| 'entry_blacklist_review'
|
|
5
|
+
| 'entry_blacklist_deny'
|
|
6
|
+
| 'employee_entry_sign_in'
|
|
7
|
+
| 'employee_entry_sign_out'
|
|
8
|
+
| string;
|
|
9
9
|
|
|
10
10
|
export default EnvoyEntryEvent;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
type EnvoyInviteEvent =
|
|
2
|
-
'invite_created'
|
|
3
|
-
'invite_updated'
|
|
4
|
-
'invite_removed'
|
|
5
|
-
'upcoming_visit'
|
|
6
|
-
'qr_code_sent'
|
|
7
|
-
'employee_invite_created'
|
|
8
|
-
'employee_invite_updated'
|
|
9
|
-
'employee_invite_removed'
|
|
10
|
-
'employee_upcoming_visit'
|
|
11
|
-
string;
|
|
2
|
+
| 'invite_created'
|
|
3
|
+
| 'invite_updated'
|
|
4
|
+
| 'invite_removed'
|
|
5
|
+
| 'upcoming_visit'
|
|
6
|
+
| 'qr_code_sent'
|
|
7
|
+
| 'employee_invite_created'
|
|
8
|
+
| 'employee_invite_updated'
|
|
9
|
+
| 'employee_invite_removed'
|
|
10
|
+
| 'employee_upcoming_visit'
|
|
11
|
+
| string;
|
|
12
12
|
|
|
13
13
|
export default EnvoyInviteEvent;
|
|
@@ -4,8 +4,8 @@ import EnvoyPluginJobAttachment from '../sdk/EnvoyPluginJobAttachment';
|
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export default interface EnvoyPluginJobUpdate {
|
|
7
|
-
status?: string
|
|
8
|
-
status_message?: string
|
|
9
|
-
failure_reason?: string
|
|
10
|
-
attachments: Array<EnvoyPluginJobAttachment
|
|
7
|
+
status?: string;
|
|
8
|
+
status_message?: string;
|
|
9
|
+
failure_reason?: string;
|
|
10
|
+
attachments: Array<EnvoyPluginJobAttachment>;
|
|
11
11
|
}
|
|
@@ -7,54 +7,55 @@ export const UNIQUE_NUM_OPTIONS_DEFAULT_MIN = 0;
|
|
|
7
7
|
export const UNIQUE_NUM_OPTIONS_DEFAULT_MAX = 9_007_199_254_740_991;
|
|
8
8
|
|
|
9
9
|
export interface EnvoyStorageSetUniqueOptions {
|
|
10
|
-
chars?: string
|
|
11
|
-
size?: number
|
|
10
|
+
chars?: string;
|
|
11
|
+
size?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface EnvoyStorageSetUniqueNumOptions {
|
|
15
|
-
min?: number
|
|
16
|
-
max?: number
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface EnvoyBaseStorageCommand {
|
|
20
|
-
action: 'get' | 'set' | 'set_unique' | 'set_unique_num' | 'unset'
|
|
21
|
-
key: string
|
|
20
|
+
action: 'get' | 'set' | 'set_unique' | 'set_unique_num' | 'unset';
|
|
21
|
+
key: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface EnvoyGetStorageCommand extends EnvoyBaseStorageCommand {
|
|
25
|
-
action: 'get'
|
|
25
|
+
action: 'get';
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface EnvoySetStorageCommand extends EnvoyBaseStorageCommand {
|
|
29
|
-
action: 'set'
|
|
30
|
-
value: unknown
|
|
29
|
+
action: 'set';
|
|
30
|
+
value: unknown;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface EnvoySetUniqueStorageCommand extends EnvoyBaseStorageCommand, EnvoyStorageSetUniqueOptions {
|
|
34
|
-
action: 'set_unique'
|
|
34
|
+
action: 'set_unique';
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface EnvoySetUniqueNumStorageCommand extends EnvoyBaseStorageCommand, EnvoyStorageSetUniqueNumOptions {
|
|
38
|
-
action: 'set_unique_num'
|
|
38
|
+
action: 'set_unique_num';
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface EnvoyUnsetStorageCommand extends EnvoyBaseStorageCommand {
|
|
42
|
-
action: 'unset'
|
|
42
|
+
action: 'unset';
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface EnvoyListStorageCommand {
|
|
46
|
-
action: 'list'
|
|
47
|
-
page: number
|
|
46
|
+
action: 'list';
|
|
47
|
+
page: number;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @internal
|
|
52
52
|
*/
|
|
53
|
-
type EnvoyStorageCommand =
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
53
|
+
type EnvoyStorageCommand =
|
|
54
|
+
| EnvoyGetStorageCommand
|
|
55
|
+
| EnvoySetStorageCommand
|
|
56
|
+
| EnvoySetUniqueStorageCommand
|
|
57
|
+
| EnvoySetUniqueNumStorageCommand
|
|
58
|
+
| EnvoyUnsetStorageCommand
|
|
59
|
+
| EnvoyListStorageCommand;
|
|
59
60
|
|
|
60
61
|
export default EnvoyStorageCommand;
|
|
@@ -16,10 +16,8 @@ export default class EnvoyPluginJobMock extends EnvoyPluginJob {
|
|
|
16
16
|
private static updates: Array<EnvoyPluginJobUpdate> = [];
|
|
17
17
|
|
|
18
18
|
static attachmentLike(partialAttachment: Partial<EnvoyPluginJobAttachment>) {
|
|
19
|
-
return EnvoyPluginJobMock.updates.find(
|
|
20
|
-
(
|
|
21
|
-
(attachment) => isMatch(attachment, partialAttachment),
|
|
22
|
-
),
|
|
19
|
+
return EnvoyPluginJobMock.updates.find(({ attachments }) =>
|
|
20
|
+
attachments.find((attachment) => isMatch(attachment, partialAttachment)),
|
|
23
21
|
);
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -39,14 +39,22 @@ export default class EnvoyPluginStoragePipelineMock extends EnvoyPluginStoragePi
|
|
|
39
39
|
}
|
|
40
40
|
case 'set_unique':
|
|
41
41
|
try {
|
|
42
|
-
const value = EnvoyPluginStoragePipelineMock.setUnique(
|
|
42
|
+
const value = EnvoyPluginStoragePipelineMock.setUnique(
|
|
43
|
+
command.key,
|
|
44
|
+
command as EnvoyStorageSetUniqueOptions,
|
|
45
|
+
isGlobal,
|
|
46
|
+
);
|
|
43
47
|
return EnvoyPluginStoragePipelineMock.itemFromKeyValue(command.key, value);
|
|
44
48
|
} catch (err) {
|
|
45
49
|
return null;
|
|
46
50
|
}
|
|
47
51
|
case 'set_unique_num': {
|
|
48
52
|
try {
|
|
49
|
-
const value = EnvoyPluginStoragePipelineMock.setUniqueNum(
|
|
53
|
+
const value = EnvoyPluginStoragePipelineMock.setUniqueNum(
|
|
54
|
+
command.key,
|
|
55
|
+
command as EnvoyStorageSetUniqueNumOptions,
|
|
56
|
+
isGlobal,
|
|
57
|
+
);
|
|
50
58
|
return EnvoyPluginStoragePipelineMock.itemFromKeyValue(command.key, value);
|
|
51
59
|
} catch (err) {
|
|
52
60
|
return null;
|
|
@@ -101,9 +109,9 @@ export default class EnvoyPluginStoragePipelineMock extends EnvoyPluginStoragePi
|
|
|
101
109
|
return value;
|
|
102
110
|
}
|
|
103
111
|
|
|
104
|
-
static setUnique(key:string, options = DEFAULT_UNIQUE_OPTIONS, isGlobal = false) {
|
|
112
|
+
static setUnique(key: string, options = DEFAULT_UNIQUE_OPTIONS, isGlobal = false) {
|
|
105
113
|
key = EnvoyPluginStoragePipelineMock.normalizeKey(key, isGlobal);
|
|
106
|
-
const chars =
|
|
114
|
+
const chars = options.chars && options.chars.length ? options.chars : UNIQUE_OPTIONS_DEFAULT_CHARS;
|
|
107
115
|
const size = options.size || UNIQUE_OPTIONS_DEFAULT_SIZE;
|
|
108
116
|
if (!chars || !size) {
|
|
109
117
|
throw new Error('Invalid "chars" or "size" arguments');
|
|
@@ -5,85 +5,81 @@ import JSONAPIData from '../util/json-api/JSONAPIData';
|
|
|
5
5
|
* @category Event
|
|
6
6
|
*/
|
|
7
7
|
type EntryPayload = {
|
|
8
|
-
id: string
|
|
9
|
-
type: 'entries'
|
|
8
|
+
id: string;
|
|
9
|
+
type: 'entries';
|
|
10
10
|
attributes: {
|
|
11
|
-
'full-name': string
|
|
12
|
-
'phone-number'?: string
|
|
13
|
-
email: string | null
|
|
14
|
-
'employee-screening-flow': boolean
|
|
15
|
-
host: string | null
|
|
16
|
-
'host-email': string | null
|
|
17
|
-
'private-notes': string | null
|
|
18
|
-
'signed-in-at': string
|
|
19
|
-
'signed-out-at'?: string
|
|
11
|
+
'full-name': string;
|
|
12
|
+
'phone-number'?: string;
|
|
13
|
+
email: string | null;
|
|
14
|
+
'employee-screening-flow': boolean;
|
|
15
|
+
host: string | null;
|
|
16
|
+
'host-email': string | null;
|
|
17
|
+
'private-notes': string | null;
|
|
18
|
+
'signed-in-at': string;
|
|
19
|
+
'signed-out-at'?: string;
|
|
20
20
|
thumbnails: {
|
|
21
|
-
large: string | null
|
|
22
|
-
original: string | null
|
|
23
|
-
small: string | null
|
|
24
|
-
}
|
|
25
|
-
'flow-name': string
|
|
26
|
-
nda?: string
|
|
21
|
+
large: string | null;
|
|
22
|
+
original: string | null;
|
|
23
|
+
small: string | null;
|
|
24
|
+
};
|
|
25
|
+
'flow-name': string;
|
|
26
|
+
nda?: string;
|
|
27
27
|
'legal-docs'?: Array<{
|
|
28
|
-
id: string
|
|
29
|
-
url: string
|
|
30
|
-
'signed-at': string
|
|
28
|
+
id: string;
|
|
29
|
+
url: string;
|
|
30
|
+
'signed-at': string;
|
|
31
31
|
agreement: {
|
|
32
|
-
id: string
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
35
|
'user-data': Array<{
|
|
36
|
-
field: string
|
|
37
|
-
value: string | null
|
|
38
|
-
}
|
|
36
|
+
field: string;
|
|
37
|
+
value: string | null;
|
|
38
|
+
}>;
|
|
39
39
|
'approval-status'?: {
|
|
40
|
-
status: string
|
|
41
|
-
'auto-approved': boolean
|
|
40
|
+
status: string;
|
|
41
|
+
'auto-approved': boolean;
|
|
42
42
|
report: Array<{
|
|
43
|
-
reason?: string
|
|
44
|
-
result: string
|
|
45
|
-
source: string
|
|
43
|
+
reason?: string;
|
|
44
|
+
result: string;
|
|
45
|
+
source: string;
|
|
46
46
|
messages: Array<{
|
|
47
47
|
failure: {
|
|
48
|
-
text: string
|
|
49
|
-
header: string
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
blacklistReportUUID?: string
|
|
54
|
-
}
|
|
55
|
-
}
|
|
48
|
+
text: string;
|
|
49
|
+
header: string;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
}>;
|
|
53
|
+
blacklistReportUUID?: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
56
|
relationships: {
|
|
57
57
|
location: {
|
|
58
|
-
data: JSONAPIData<'locations'
|
|
59
|
-
}
|
|
58
|
+
data: JSONAPIData<'locations'>;
|
|
59
|
+
};
|
|
60
60
|
'visitor-entrance'?: {
|
|
61
|
-
data: JSONAPIData<'visitor-entrances'
|
|
62
|
-
}
|
|
61
|
+
data: JSONAPIData<'visitor-entrances'>;
|
|
62
|
+
};
|
|
63
63
|
device?: {
|
|
64
|
-
data: JSONAPIData<'devices'
|
|
65
|
-
}
|
|
64
|
+
data: JSONAPIData<'devices'>;
|
|
65
|
+
};
|
|
66
66
|
employee?: {
|
|
67
|
-
data: JSONAPIData<'employees'
|
|
68
|
-
}
|
|
67
|
+
data: JSONAPIData<'employees'>;
|
|
68
|
+
};
|
|
69
69
|
invite?: {
|
|
70
|
-
data: JSONAPIData<'invites'
|
|
71
|
-
}
|
|
70
|
+
data: JSONAPIData<'invites'>;
|
|
71
|
+
};
|
|
72
72
|
flow?: {
|
|
73
|
-
data: JSONAPIData<'flows'
|
|
74
|
-
}
|
|
73
|
+
data: JSONAPIData<'flows'>;
|
|
74
|
+
};
|
|
75
75
|
'agreeable-ndas'?: {
|
|
76
|
-
data: Array<JSONAPIData<'agreeable-ndas'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
76
|
+
data: Array<JSONAPIData<'agreeable-ndas'>>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
export function normalizeEntryPayload(payload
|
|
82
|
-
const {
|
|
83
|
-
'signed-in-at': signedInAt,
|
|
84
|
-
'signed-out-at': signedOutAt,
|
|
85
|
-
'legal-docs': legalDocs,
|
|
86
|
-
} = payload.attributes;
|
|
81
|
+
export function normalizeEntryPayload(payload: EntryPayload): EntryPayload {
|
|
82
|
+
const { 'signed-in-at': signedInAt, 'signed-out-at': signedOutAt, 'legal-docs': legalDocs } = payload.attributes;
|
|
87
83
|
const normalized = { ...payload };
|
|
88
84
|
normalized.attributes['signed-in-at'] = DateTime.fromSQL(signedInAt, { zone: 'UTC' }).toISO();
|
|
89
85
|
if (signedOutAt) {
|
|
@@ -5,69 +5,69 @@ import JSONAPIData from '../util/json-api/JSONAPIData';
|
|
|
5
5
|
* @category Event
|
|
6
6
|
*/
|
|
7
7
|
type InvitePayload = {
|
|
8
|
-
id: string
|
|
9
|
-
type: 'invites'
|
|
8
|
+
id: string;
|
|
9
|
+
type: 'invites';
|
|
10
10
|
attributes: {
|
|
11
|
-
'employee-screening-flow': boolean
|
|
12
|
-
'full-name': string
|
|
13
|
-
email: string | null
|
|
14
|
-
'inviter-name': string | null
|
|
15
|
-
'inviter-email': string | null
|
|
16
|
-
'expected-arrival-time': string
|
|
17
|
-
'private-notes': string | null
|
|
18
|
-
arrived: boolean
|
|
19
|
-
'been-here-before': boolean
|
|
20
|
-
'flow-name': string
|
|
21
|
-
'flow-id': string
|
|
11
|
+
'employee-screening-flow': boolean;
|
|
12
|
+
'full-name': string;
|
|
13
|
+
email: string | null;
|
|
14
|
+
'inviter-name': string | null;
|
|
15
|
+
'inviter-email': string | null;
|
|
16
|
+
'expected-arrival-time': string;
|
|
17
|
+
'private-notes': string | null;
|
|
18
|
+
arrived: boolean;
|
|
19
|
+
'been-here-before': boolean;
|
|
20
|
+
'flow-name': string;
|
|
21
|
+
'flow-id': string;
|
|
22
22
|
'user-data': Array<{
|
|
23
|
-
field: string
|
|
24
|
-
value: string | null
|
|
25
|
-
}
|
|
26
|
-
nda?: string
|
|
27
|
-
'secret-token': string
|
|
28
|
-
'edit-token': string
|
|
29
|
-
'photo-url': string | null
|
|
30
|
-
'qr-code': string | null
|
|
31
|
-
'qr-code-sent-at': string | null
|
|
32
|
-
'preregistration-complete': boolean
|
|
33
|
-
'reminder-sent-at': string | null
|
|
23
|
+
field: string;
|
|
24
|
+
value: string | null;
|
|
25
|
+
}>;
|
|
26
|
+
nda?: string;
|
|
27
|
+
'secret-token': string;
|
|
28
|
+
'edit-token': string;
|
|
29
|
+
'photo-url': string | null;
|
|
30
|
+
'qr-code': string | null;
|
|
31
|
+
'qr-code-sent-at': string | null;
|
|
32
|
+
'preregistration-complete': boolean;
|
|
33
|
+
'reminder-sent-at': string | null;
|
|
34
34
|
'legal-docs'?: Array<{
|
|
35
|
-
id: string
|
|
36
|
-
url: string
|
|
37
|
-
'signed-at': string
|
|
35
|
+
id: string;
|
|
36
|
+
url: string;
|
|
37
|
+
'signed-at': string;
|
|
38
38
|
agreement: {
|
|
39
|
-
id: string
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
'signed-in-at'?: string
|
|
43
|
-
'signed-out-at'?: string
|
|
44
|
-
}
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
'signed-in-at'?: string;
|
|
43
|
+
'signed-out-at'?: string;
|
|
44
|
+
};
|
|
45
45
|
relationships: {
|
|
46
46
|
entry?: {
|
|
47
|
-
data: JSONAPIData<'entries'
|
|
48
|
-
}
|
|
47
|
+
data: JSONAPIData<'entries'>;
|
|
48
|
+
};
|
|
49
49
|
location: {
|
|
50
|
-
data: JSONAPIData<'locations'
|
|
51
|
-
}
|
|
50
|
+
data: JSONAPIData<'locations'>;
|
|
51
|
+
};
|
|
52
52
|
flow?: {
|
|
53
|
-
data: JSONAPIData<'flows'
|
|
54
|
-
}
|
|
53
|
+
data: JSONAPIData<'flows'>;
|
|
54
|
+
};
|
|
55
55
|
employee?: {
|
|
56
|
-
data: JSONAPIData<'employees'
|
|
57
|
-
}
|
|
56
|
+
data: JSONAPIData<'employees'>;
|
|
57
|
+
};
|
|
58
58
|
'agreeable-ndas'?: {
|
|
59
|
-
data: Array<JSONAPIData<'agreeable-ndas'
|
|
60
|
-
}
|
|
59
|
+
data: Array<JSONAPIData<'agreeable-ndas'>>;
|
|
60
|
+
};
|
|
61
61
|
tenant?: {
|
|
62
|
-
data: JSONAPIData<'tenants'
|
|
63
|
-
}
|
|
62
|
+
data: JSONAPIData<'tenants'>;
|
|
63
|
+
};
|
|
64
64
|
'invitee-employee'?: {
|
|
65
|
-
data: JSONAPIData<'employees'
|
|
66
|
-
}
|
|
65
|
+
data: JSONAPIData<'employees'>;
|
|
66
|
+
};
|
|
67
67
|
creator?: {
|
|
68
|
-
data: JSONAPIData<'users'
|
|
69
|
-
}
|
|
70
|
-
}
|
|
68
|
+
data: JSONAPIData<'users'>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
export function normalizeInvitePayload(payload: InvitePayload): InvitePayload {
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
type NotificationPayload = {
|
|
2
2
|
recipient: {
|
|
3
3
|
name: {
|
|
4
|
-
full: string
|
|
5
|
-
}
|
|
6
|
-
email: string | null
|
|
7
|
-
user_id: number | null
|
|
8
|
-
employee_id: number | null
|
|
9
|
-
phone_number: string | null
|
|
10
|
-
}
|
|
11
|
-
message?: string
|
|
4
|
+
full: string;
|
|
5
|
+
};
|
|
6
|
+
email: string | null;
|
|
7
|
+
user_id: number | null;
|
|
8
|
+
employee_id: number | null;
|
|
9
|
+
phone_number: string | null;
|
|
10
|
+
};
|
|
11
|
+
message?: string;
|
|
12
12
|
details?: Array<{
|
|
13
|
-
label: string
|
|
14
|
-
value: string
|
|
15
|
-
}
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}>;
|
|
16
16
|
actions?: Array<{
|
|
17
|
-
label: string
|
|
18
|
-
callback_url: string
|
|
19
|
-
}
|
|
17
|
+
label: string;
|
|
18
|
+
callback_url: string;
|
|
19
|
+
}>;
|
|
20
20
|
attachments?: Array<{
|
|
21
|
-
url: string
|
|
22
|
-
}
|
|
21
|
+
url: string;
|
|
22
|
+
}>;
|
|
23
23
|
channel_overrides?: {
|
|
24
24
|
slack?: {
|
|
25
|
-
dm_only?: boolean
|
|
26
|
-
footer_text?: string
|
|
27
|
-
short_details?: boolean
|
|
28
|
-
large_image?: boolean
|
|
29
|
-
attachments?: Array<Record<string, any
|
|
30
|
-
message?: string
|
|
31
|
-
text?: string
|
|
32
|
-
}
|
|
25
|
+
dm_only?: boolean;
|
|
26
|
+
footer_text?: string;
|
|
27
|
+
short_details?: boolean;
|
|
28
|
+
large_image?: boolean;
|
|
29
|
+
attachments?: Array<Record<string, any>>;
|
|
30
|
+
message?: string;
|
|
31
|
+
text?: string;
|
|
32
|
+
};
|
|
33
33
|
email?: {
|
|
34
|
-
from: string
|
|
35
|
-
subject: string
|
|
36
|
-
html_body: string
|
|
37
|
-
text_body: string
|
|
34
|
+
from: string;
|
|
35
|
+
subject: string;
|
|
36
|
+
html_body: string;
|
|
37
|
+
text_body: string;
|
|
38
38
|
reply_to?: {
|
|
39
39
|
name: {
|
|
40
|
-
full: string
|
|
41
|
-
}
|
|
42
|
-
email: string
|
|
43
|
-
}
|
|
40
|
+
full: string;
|
|
41
|
+
};
|
|
42
|
+
email: string;
|
|
43
|
+
};
|
|
44
44
|
bcc?: Array<{
|
|
45
45
|
name: {
|
|
46
|
-
full: string
|
|
47
|
-
}
|
|
48
|
-
email: string
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
46
|
+
full: string;
|
|
47
|
+
};
|
|
48
|
+
email: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export default NotificationPayload;
|
|
@@ -23,12 +23,13 @@ export interface FlowAttributes {
|
|
|
23
23
|
enabled: boolean;
|
|
24
24
|
'created-at': string;
|
|
25
25
|
'updated-at': string;
|
|
26
|
+
type: string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* @category API Resource
|
|
30
31
|
*/
|
|
31
|
-
export type FlowRelationships = 'location' | 'sign-in-field-page' | 'agreement-page';
|
|
32
|
+
export type FlowRelationships = 'location' | 'sign-in-field-page' | 'agreement-page' | 'global-flow';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* @category API Resource
|