Improve story DOE flow

This commit is contained in:
Fedor Indutny 2022-11-28 18:07:26 -08:00 committed by GitHub
parent 5e9744d62a
commit 37d383f344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 630 additions and 245 deletions

View file

@ -166,3 +166,9 @@ export enum ResolvedSendStatus {
Sending = 'Sending',
Sent = 'Sent',
}
export type StoryMessageRecipientsType = Array<{
destinationUuid: string;
distributionListIds: Array<string>;
isAllowedToReply: boolean;
}>;

View file

@ -16,11 +16,21 @@ export enum UUIDKind {
export const UUID_BYTE_SIZE = 16;
export const isValidUuid = (value: unknown): value is UUIDStringType =>
typeof value === 'string' &&
/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(
value
);
const UUID_REGEXP =
/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
export const isValidUuid = (value: unknown): value is UUIDStringType => {
if (typeof value !== 'string') {
return false;
}
// Zero UUID is a valid uuid.
if (value === '00000000-0000-0000-0000-000000000000') {
return true;
}
return UUID_REGEXP.test(value);
};
export class UUID {
constructor(protected readonly value: string) {