@todesktop/shared 7.189.19 → 7.189.20
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.
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type InvitePermissionKey = 'canBuild' | 'canRelease' | 'canManageUsers';
|
|
2
|
+
export type InvitePermissionFlags = Record<InvitePermissionKey, boolean>;
|
|
3
|
+
export declare const INVITE_PERMISSION_LABELS: Record<InvitePermissionKey, string>;
|
|
4
|
+
export declare const formatInvitePermissionSummary: (permissions: Partial<InvitePermissionFlags>) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatInvitePermissionSummary = exports.INVITE_PERMISSION_LABELS = void 0;
|
|
4
|
+
exports.INVITE_PERMISSION_LABELS = {
|
|
5
|
+
canBuild: 'Can build',
|
|
6
|
+
canRelease: 'Can release',
|
|
7
|
+
canManageUsers: 'Can manage users',
|
|
8
|
+
};
|
|
9
|
+
const formatInvitePermissionSummary = (permissions) => {
|
|
10
|
+
const enabled = Object.entries(permissions)
|
|
11
|
+
.filter(([, value]) => value === true)
|
|
12
|
+
.map(([key]) => exports.INVITE_PERMISSION_LABELS[key]);
|
|
13
|
+
return enabled.join(', ');
|
|
14
|
+
};
|
|
15
|
+
exports.formatInvitePermissionSummary = formatInvitePermissionSummary;
|
package/lib/toDesktop.d.ts
CHANGED
|
@@ -152,15 +152,25 @@ export interface FeatureFlags {
|
|
|
152
152
|
macAppStore: boolean;
|
|
153
153
|
aboutBlankWindowOpenHandler: boolean;
|
|
154
154
|
}
|
|
155
|
+
export interface InvitePermissions {
|
|
156
|
+
canBuild: boolean;
|
|
157
|
+
canRelease: boolean;
|
|
158
|
+
canManageBilling?: boolean;
|
|
159
|
+
canManageUsers?: boolean;
|
|
160
|
+
}
|
|
161
|
+
export type InviteActorRole = 'owner' | 'delegate';
|
|
162
|
+
export interface InviteActorCapabilities {
|
|
163
|
+
actorId: string;
|
|
164
|
+
actorEmail: string;
|
|
165
|
+
actorRole: InviteActorRole;
|
|
166
|
+
actorPermissions: InvitePermissions;
|
|
167
|
+
}
|
|
155
168
|
export interface UserIHaveSentInviteTo {
|
|
156
169
|
email: string;
|
|
157
|
-
permissions?:
|
|
158
|
-
canBuild: boolean;
|
|
159
|
-
canRelease: boolean;
|
|
160
|
-
canManageBilling?: boolean;
|
|
161
|
-
};
|
|
170
|
+
permissions?: InvitePermissions;
|
|
162
171
|
name: string;
|
|
163
172
|
sender: UserIHaveAcceptedInviteFrom;
|
|
173
|
+
inviterCapabilities?: InviteActorCapabilities;
|
|
164
174
|
}
|
|
165
175
|
export interface UserIHaveAcceptedInviteFrom {
|
|
166
176
|
id: string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type InvitePermissionKey = 'canBuild' | 'canRelease' | 'canManageUsers';
|
|
2
|
+
|
|
3
|
+
export type InvitePermissionFlags = Record<InvitePermissionKey, boolean>;
|
|
4
|
+
|
|
5
|
+
export const INVITE_PERMISSION_LABELS: Record<InvitePermissionKey, string> = {
|
|
6
|
+
canBuild: 'Can build',
|
|
7
|
+
canRelease: 'Can release',
|
|
8
|
+
canManageUsers: 'Can manage users',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const formatInvitePermissionSummary = (
|
|
12
|
+
permissions: Partial<InvitePermissionFlags>
|
|
13
|
+
): string => {
|
|
14
|
+
const enabled = (
|
|
15
|
+
Object.entries(permissions) as Array<
|
|
16
|
+
[InvitePermissionKey, boolean | undefined]
|
|
17
|
+
>
|
|
18
|
+
)
|
|
19
|
+
.filter(([, value]) => value === true)
|
|
20
|
+
.map(([key]) => INVITE_PERMISSION_LABELS[key]);
|
|
21
|
+
|
|
22
|
+
return enabled.join(', ');
|
|
23
|
+
};
|
package/src/toDesktop.ts
CHANGED
|
@@ -175,17 +175,30 @@ export interface FeatureFlags {
|
|
|
175
175
|
aboutBlankWindowOpenHandler: boolean;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
export interface InvitePermissions {
|
|
179
|
+
canBuild: boolean;
|
|
180
|
+
canRelease: boolean;
|
|
181
|
+
canManageBilling?: boolean;
|
|
182
|
+
canManageUsers?: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type InviteActorRole = 'owner' | 'delegate';
|
|
186
|
+
|
|
187
|
+
export interface InviteActorCapabilities {
|
|
188
|
+
actorId: string;
|
|
189
|
+
actorEmail: string;
|
|
190
|
+
actorRole: InviteActorRole;
|
|
191
|
+
actorPermissions: InvitePermissions;
|
|
192
|
+
}
|
|
193
|
+
|
|
178
194
|
// uses an `email` identifier because an invited user may not have an account
|
|
179
195
|
export interface UserIHaveSentInviteTo {
|
|
180
196
|
email: string;
|
|
181
|
-
permissions?:
|
|
182
|
-
canBuild: boolean;
|
|
183
|
-
canRelease: boolean;
|
|
184
|
-
canManageBilling?: boolean;
|
|
185
|
-
};
|
|
197
|
+
permissions?: InvitePermissions;
|
|
186
198
|
name: string;
|
|
187
199
|
// this allows us to encode information about the sender without loosening firebase privileges
|
|
188
200
|
sender: UserIHaveAcceptedInviteFrom;
|
|
201
|
+
inviterCapabilities?: InviteActorCapabilities;
|
|
189
202
|
}
|
|
190
203
|
|
|
191
204
|
export interface UserIHaveAcceptedInviteFrom {
|