index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/mimetype.ts
import { getBrowser } from '@proton/shared/lib/helpers/browser'; import { MIME_TYPES } from '../constants'; import { SupportedMimeTypes } from '../drive/constants'; const isWebpSupported = () => { const { name, version } = getBrowser(); if (name === 'Safari') { /* * The support for WebP imag...
8,500
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/newsletter.ts
import { isNumber } from 'lodash'; import { NEWSLETTER_SUBSCRIPTIONS, NEWSLETTER_SUBSCRIPTIONS_BITS, NEWSLETTER_SUBSCRIPTIONS_BY_BITS, } from '../constants'; import { hasBit } from './bitset'; export type NewsletterSubscriptionUpdateData = Partial<Record<NEWSLETTER_SUBSCRIPTIONS, boolean>>; /** * if we ...
8,501
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/object.ts
/** * Convert { [key: string]: boolean } to bitmap * @param o ex: { announcements: true, features: false, newsletter: false, beta: false } * @returns bitmap */ export const toBitMap = (o: { [key: string]: boolean } = {}): number => Object.keys(o).reduce((acc, key, index) => acc + (Number(o[key]) << index), 0); ...
8,502
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/onceWithQueue.ts
/** * Ensures that a function returning a promise is only called once at a time. * * If it is called while the previous promise is resolving, another call to the * function will be queued, and run once, with the arguments of the last call * after the previous promise has resolved. The returned promise resolves aft...
8,503
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/organization.ts
import { MEMBER_PERMISSIONS, ORGANIZATION_FLAGS, ORGANIZATION_TWOFA_SETTING } from '../constants'; import { Organization } from '../interfaces'; import { hasBit } from './bitset'; export const isLoyal = (organization: Partial<Organization> = {}) => { return hasBit(organization.Flags, ORGANIZATION_FLAGS.LOYAL); }; ...
8,504
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/planIDs.ts
import { ADDON_NAMES, MEMBER_ADDON_PREFIX, PLANS, PLAN_TYPES } from '../constants'; import { Organization, Plan, PlanIDs, PlansMap } from '../interfaces'; const { MAIL, DRIVE, PASS_PLUS, VPN, VPN_PASS_BUNDLE, FAMILY, NEW_VISIONARY, ENTERPRISE, BUNDLE, BUNDLE_PRO, MAIL_PRO, ...
8,505
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/preview.ts
// Will include more rules in the future import { hasPDFSupport } from './browser'; import { isAudio, isPDF, isSupportedImage, isSupportedText, isVideo, isWordDocument } from './mimetype'; // The reason to limit preview is because the file needs to be loaded // in memory. At this moment we don't even have any progress...
8,506
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/promise.ts
export const wait = (delay: number) => new Promise<void>((resolve) => setTimeout(resolve, delay)); /** * Runs each chunk from a chunks array and waits after each one has run (unless it's the last one). */ export const runChunksDelayed = async <T>( chunks: number[][] = [], cb: (index: number) => Promise<T>, ...
8,507
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/regex.ts
export const escapeRegex = (string: string) => { return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); }; export interface MatchChunk { start: number; end: number; } export const getMatches = (regex: RegExp, b: string): MatchChunk[] => { return [...b.matchAll(regex)].map((match) => { const {...
8,508
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/runInQueue.ts
/** * Executes functions sequentially, at most `maxProcessing` functions at once. */ async function runInQueue<T>(functions: (() => Promise<T>)[], maxProcessing = 1): Promise<T[]> { const results: T[] = []; let resultIndex = 0; const runNext = async (): Promise<any> => { const index = resultInde...
8,509
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/scope.ts
import JSBI from 'jsbi'; export const hasScope = (scope: string, mask: number | string) => { const scopeInt = JSBI.BigInt(scope); const maskInt = JSBI.BigInt(mask); return JSBI.equal(JSBI.bitwiseAnd(scopeInt, maskInt), maskInt); };
8,510
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/secureSessionStorage.ts
// Not using openpgp to allow using this without having to depend on openpgp being loaded import { stringToUint8Array, uint8ArrayToString } from './encoding'; import { hasStorage as hasSessionStorage } from './sessionStorage'; /** * Partially inspired by http://www.thomasfrank.se/sessionvars.html * However, we aim t...
8,511
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/sentry.ts
import { BrowserOptions, Integrations as SentryIntegrations, captureException, configureScope, init, makeFetchTransport, captureMessage as sentryCaptureMessage, } from '@sentry/browser'; import { BrowserTransportOptions } from '@sentry/browser/types/transports/types'; import { VPN_HOSTNAME ...
8,512
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/sessionStorage.ts
export const getItem = (key: string, defaultValue?: string) => { try { const value = window.sessionStorage.getItem(key); return value === null ? defaultValue : value; } catch (e: any) { return defaultValue; } }; export const setItem = (key: string, value: string) => { try { ...
8,513
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/setupCryptoWorker.ts
import { CryptoProxy } from '@proton/crypto'; import { CryptoWorkerPool, WorkerPoolInterface } from '@proton/crypto/lib/worker/workerPool'; import { hasModulesSupport, isIos11, isSafari11 } from './browser'; let promise: undefined | Promise<void>; const isUnsupportedWorker = () => { // In safari 11 there's an un...
8,514
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/storage.ts
export const getItem = (key: string, defaultValue?: string) => { try { const value = window.localStorage.getItem(key); return value === undefined ? defaultValue : value; } catch (e: any) { return defaultValue; } }; export const setItem = (key: string, value: string) => { try { ...
8,515
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/store.ts
export default (initialState: { [key: string]: any } = {}) => { let state = initialState; const set = (key: string, data: any) => { state[key] = data; }; const get = (key: string) => state[key]; const remove = (key: string) => delete state[key]; const reset = () => { state = ...
8,516
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/string.ts
enum CURRENCIES { USD = '$', EUR = '€', CHF = 'CHF', } export const normalize = (value = '', removeDiacritics = false) => { let normalized = value.toLowerCase().trim(); if (removeDiacritics) { normalized = normalized.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); } return normali...
8,517
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/subscription.ts
import { addWeeks, fromUnixTime, isBefore } from 'date-fns'; import { ProductParam } from '@proton/shared/lib/apps/product'; import { ADDON_NAMES, APPS, APP_NAMES, COUPON_CODES, CYCLE, FreeSubscription, IPS_INCLUDED_IN_PLAN, MEMBER_ADDON_PREFIX, PLANS, PLAN_SERVICES, PLAN_T...
8,518
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/time.ts
import { format as formatDate, fromUnixTime, getUnixTime, isSameDay } from 'date-fns'; import { serverTime } from '@proton/crypto'; export type DateFnsOptions = Parameters<typeof formatDate>[2]; export type Options = DateFnsOptions & { /** * Date format if `unixTime` argument is today. If false then force `...
8,519
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/twofa.ts
import { encode } from 'hi-base32'; export const generateSharedSecret = (length = 20) => { const randomBytes = crypto.getRandomValues(new Uint8Array(length)); return encode(randomBytes); }; interface GetUriArguments { identifier: string; sharedSecret: string; issuer?: string; digits?: number; ...
8,520
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/uid.ts
/** * Generate a string of four random hex characters */ export const randomHexString4 = () => { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); }; /** * Generates a contact UID of the form 'proton-web-uuid' */ export const generateProtonWebUID = () => { const ...
8,521
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/updateCollection.ts
import { EVENT_ACTIONS } from '../constants'; const { DELETE, CREATE, UPDATE } = EVENT_ACTIONS; function getKeyToSortBy<T>(sortByKey: boolean | keyof T, todos: Partial<T>[]) { if (sortByKey === true) { const itemFromTodos = todos?.[0]; if (!itemFromTodos) { return undefined; } ...
8,522
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/updateCounter.js
const updateCounter = (model, newModel = []) => { return newModel; }; export default updateCounter;
8,523
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/updateObject.ts
const updateObject = <T>(model: T, newModel: Partial<T>) => ({ ...model, ...newModel, }); export default updateObject;
8,524
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/upsell.ts
import { APPS, APP_NAMES, APP_UPSELL_REF_PATH, UPSELL_COMPONENT } from '@proton/shared/lib/constants'; /** * Add an upsell ref param to a URL */ export const addUpsellPath = (link: string, upsellPath?: string) => { if (!upsellPath) { return link; } const hasParams = link.includes('?'); retur...
8,525
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/url.ts
import { stripLeadingSlash, stripTrailingSlash } from '@proton/shared/lib/helpers/string'; import { APPS, APPS_CONFIGURATION, APP_NAMES, DOH_DOMAINS, LINK_TYPES } from '../constants'; import window from '../window'; const PREFIX_TO_TYPE: { [prefix: string]: LINK_TYPES | undefined } = { 'tel:': LINK_TYPES.PHONE, ...
8,526
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/userSettings.ts
import { SETTINGS_PROTON_SENTINEL_STATE, UserSettings } from '../interfaces'; export const isProtonSentinelEligible = (userSettings: UserSettings) => { return ( !!userSettings.HighSecurity.Eligible || userSettings.HighSecurity.Value === SETTINGS_PROTON_SENTINEL_STATE.ENABLED ); };
8,527
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/helpers/validators.ts
import isValidDomain from 'is-valid-domain'; /* eslint-disable no-useless-escape */ export const REGEX_URL = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/; export const REGEX_HEX...
8,528
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/dateFnLocale.ts
import { Locale } from 'date-fns'; import { SETTINGS_DATE_FORMAT, SETTINGS_TIME_FORMAT, SETTINGS_WEEK_START } from '../interfaces'; import { enGBLocale, enUSLocale, faIRLocale } from './dateFnLocales'; // Support for changing the date format is not great. Hide it for now. export const IS_DATE_FORMAT_ENABLED = false; ...
8,529
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/dateFnLocales.ts
import { DateFnsLocaleMap } from '../interfaces/Locale'; const dateFnLocales = import.meta.webpackContext!('date-fns/locale', { recursive: true, regExp: /^\.\/[a-z]{2}(-([A-Z]{2}))?\/index\.js$/, mode: 'lazy', chunkName: 'date-fns/[request]', }); export default dateFnLocales.keys().reduce((acc: DateFn...
8,530
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/helper.ts
import { DEFAULT_LOCALE } from '../constants'; export const getNormalizedLocale = (locale = '') => { return locale.toLowerCase().replace(/-/g, '_'); }; // Attempts to convert the original locale (en_US) to BCP 47 (en-US) as supported by the lang attribute export const getLangAttribute = (locale: string) => { ...
8,531
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/index.ts
import { enUSLocale } from './dateFnLocales'; /** * The locales are exported as mutable exports: * 1) To avoid using a react context for components deep in the tree * 2) It's more similar to how ttag works */ export let dateLocale = enUSLocale; export let defaultDateLocale = enUSLocale; export let browserDateLocal...
8,532
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/loadLocale.ts
import { addLocale as ttagAddLocale, useLocale as ttagUseLocale } from 'ttag'; import { DEFAULT_LOCALE } from '../constants'; import { TtagLocaleMap } from '../interfaces/Locale'; import { Options, getDateFnLocaleWithLongFormat, getDateFnLocaleWithSettings } from './dateFnLocale'; import dateFnLocales from './dateFnLo...
8,533
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/locales.ts
import { LocaleData } from 'ttag'; import { TtagLocaleMap } from '../interfaces/Locale'; export let locales: TtagLocaleMap = {}; type LocaleRequireContext = { keys: () => string[]; (id: string): Promise<LocaleData> }; export const getLocalesFromRequireContext = (locales: LocaleRequireContext) => { return locale...
8,534
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/i18n/relocalize.ts
import { addLocale as ttagAddLocale, useLocale as ttagUseLocale } from 'ttag'; import { DEFAULT_LOCALE } from '../constants'; import { Options } from './dateFnLocale'; import { getBrowserLocale, getClosestLocaleCode } from './helper'; import { browserDateLocale, browserLocaleCode, dateLocale, dateLocal...
8,535
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Address.ts
import { ADDRESS_FLAGS, ADDRESS_RECEIVE, ADDRESS_SEND, ADDRESS_STATUS, ADDRESS_TYPE, EVENT_ACTIONS, } from '../constants'; import { AddressKey } from './Key'; import { ActiveSignedKeyList, SignedKeyList } from './SignedKeyList'; export enum AddressConfirmationState { CONFIRMATION_NOT_CONFIR...
8,536
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/AddressForwarding.ts
import { SIEVE_VERSION, SieveBranch } from '@proton/sieve/src/interface'; // bit 0 = unencrypted/encrypted, bit 1: internal/external export enum ForwardingType { InternalUnencrypted = 0, InternalEncrypted = 1, ExternalUnencrypted = 2, ExternalEncrypted = 3, } export enum ForwardingState { Pending ...
8,537
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Api.ts
export type Api = <T = any>(arg: object) => Promise<T>; export interface ApiResponse { Code: number; }
8,538
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/ApiEnvironmentConfig.ts
export interface ApiEnvironmentConfig { 'importer.google.client_id': string; 'importer.outlook.client_id': string; }
8,539
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/AutoResponder.ts
import { AutoReplyDuration } from '../constants'; export interface AutoResponder { IsEnabled: boolean; Message: string; Repeat: AutoReplyDuration; DaysSelected: number[]; Zone: string; Subject: string; }
8,540
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Checklist.ts
export interface ChecklistApiResponse { Code: number; Items: ChecklistKey[]; CreatedAt: number; ExpiresAt: number; UserWasRewarded: boolean; Visible: boolean; Display: CHECKLIST_DISPLAY_TYPE; } export type ChecklistId = 'get-started' | 'paying-user'; export enum ChecklistKey { SendMess...
8,541
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Domain.ts
export interface DKIMKey { ID: string; Selector: string; PublicKey: string; Algorithm: number; DNSState: number; CreateTime: number; } export interface DKIMConfig { Hostname: string; CNAME: string; Key: DKIMKey | null; } export enum DOMAIN_STATE { DOMAIN_STATE_DEFAULT = 0, // D...
8,542
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Drawer.ts
export interface DrawerFeatureFlag { CalendarInMail: boolean; CalendarInDrive: boolean; ContactsInMail: boolean; ContactsInCalendar: boolean; ContactsInDrive: boolean; }
8,543
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/EncryptionPreferences.ts
import { PublicKeyReference } from '@proton/crypto'; import { CONTACT_MIME_TYPES, CONTACT_PGP_SCHEMES, KEY_FLAG, MIME_TYPES, PGP_SCHEMES, RECIPIENT_TYPES, } from '../constants'; import { Address } from './Address'; import { KeyTransparencyVerificationResult } from './KeyTransparency'; import { ...
8,544
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Environment.ts
export type Environment = 'alpha' | 'beta'; export type EnvironmentExtended = Environment | 'default';
8,545
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Folder.ts
export interface Folder { ID: string; Name: string; Color: string; Path: string; Expanded: number; Type: number; Order: number; ParentID?: number | string; Notify: number; } export type FolderWithSubFolders = Folder & { subfolders?: Folder[] };
8,546
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Hotkeys.ts
// The following enum was initially taken from // https://github.com/ashubham/w3c-keys/blob/master/dist/index.d.ts export enum KeyboardKey { Backspace = 'Backspace', Tab = 'Tab', Enter = 'Enter', Shift = 'Shift', Control = 'Control', Alt = 'Alt', CapsLock = 'CapsLock', Escape = 'Escape',...
8,547
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/IncomingDefault.ts
import { INCOMING_DEFAULTS_LOCATION } from '../constants'; export interface IncomingDefault { ID: string; Email?: string; Domain?: string; Location: INCOMING_DEFAULTS_LOCATION; Type: number; Time: number; } export type IncomingDefaultStatus = 'not-loaded' | 'pending' | 'loaded' | 'rejected';
8,548
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Key.ts
import { PrivateKeyReference, PublicKeyReference } from '@proton/crypto'; import { RequireSome } from './utils'; export interface KeyWithRecoverySecret extends Key { RecoverySecret: string; RecoverySecretSignature: string; } export interface Key { ID: string; Primary: 1 | 0; Active: 1 | 0; Fl...
8,549
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/KeySalt.ts
export interface KeySalt { ID: string; KeySalt: string; }
8,550
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/KeyTransparency.ts
import { PrivateKeyReference, PublicKeyReference } from '@proton/crypto'; import { Epoch, SelfAuditResult } from '@proton/key-transparency/lib'; import { Address } from './Address'; import { ProcessedApiKey } from './EncryptionPreferences'; import { DecryptedAddressKey, DecryptedKey, KeyPair } from './Key'; import { F...
8,551
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Label.ts
export interface Label { ID: string; Name: string; Color: string; ContextTime?: number; Type: number; Order: number; Path: string; Display?: number; } export interface LabelCount { LabelID?: string; Total?: number; Unread?: number; }
8,552
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Locale.ts
import { Locale } from 'date-fns'; import { LocaleData } from 'ttag'; import { SimpleMap } from './utils'; export type TtagLocaleMap = SimpleMap<() => Promise<LocaleData>>; export interface DateFnsLocaleMap { [key: string]: () => Promise<Locale>; }
8,553
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/MailSettings.ts
import { BLOCK_SENDER_CONFIRMATION } from '../mail/constants'; import { ALMOST_ALL_MAIL, ATTACH_PUBLIC_KEY, AUTO_DELETE_SPAM_AND_TRASH_DAYS, AUTO_SAVE_CONTACTS, COMPOSER_MODE, CONFIRM_LINK, DELAY_IN_SECONDS, DIRECTION, DRAFT_MIME_TYPES, FOLDER_COLOR, HIDE_SENDER_IMAGES, I...
8,554
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Member.ts
import { MEMBER_PRIVATE, MEMBER_ROLE, MEMBER_TYPE } from '../constants'; import { Key } from './Key'; export interface PartialMemberAddress { ID: string; Email: string; } export enum FAMILY_PLAN_INVITE_STATE { STATUS_DISABLED = 0, STATUS_ENABLED = 1, STATUS_INVITED = 2, } export interface Member ...
8,555
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Modal.ts
export interface ModalWithProps<T = void> { isOpen: boolean; props?: T; }
8,556
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Model.ts
import { Api } from './Api'; export interface Model<T> { key: string; get: (api: Api) => T; update: (oldModel: T, newModel: Partial<T>) => T; }
8,557
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Organization.ts
import { ORGANIZATION_TWOFA_SETTING, PLANS } from '@proton/shared/lib/constants'; export interface Organization { Name: string; DisplayName: string; // DEPRECATED PlanName: PLANS; VPNPlanName: string; TwoFactorRequired: ORGANIZATION_TWOFA_SETTING; // If 0, 2FA not required, if 1, 2FA required for a...
8,558
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/OrganizationKey.ts
import { PrivateKeyReference, PublicKeyReference } from '@proton/crypto'; export interface OrganizationKey { PrivateKey?: string; PublicKey: string; } export type CachedOrganizationKey = | { Key: OrganizationKey; privateKey?: undefined; publicKey?: undefined; error?...
8,559
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/PendingInvitation.ts
export interface PendingInvitation { ID: string; InviterEmail: string; MaxSpace: number; OrganizationName: string; Validation: AcceptInvitationValidation; } export interface AcceptInvitationValidation { Valid: boolean; IsLifetimeAccount: boolean; IsOnForbiddenPlan: boolean; HasOrgWi...
8,560
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Referrals.ts
/** * State of referred user * - `0` => `invited` : The user has been invited (email invite only) * - `1` => `signedup` : User signed up with the link * - `2` => `trial` : User accepted the free trial * - `3` => `completed` : User paid a plus subscription * - `4` => `rewarded` : After some processing rewa...
8,561
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/SignedKeyList.ts
// Interface for SignedKeyList generated by the FE before uploading export interface SignedKeyList { Data: string; Signature: string; } // Metadata of a public key included in the SKL's Data property export interface SignedKeyListItem { Primary: 0 | 1; Flags: number; Fingerprint: string; SHA256...
8,562
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/Subscription.ts
import { ADDON_NAMES, CYCLE, PLANS, PLAN_TYPES } from '../constants'; export type Currency = 'EUR' | 'CHF' | 'USD'; export type Cycle = CYCLE.MONTHLY | CYCLE.YEARLY | CYCLE.TWO_YEARS | CYCLE.THIRTY | CYCLE.FIFTEEN; export interface CycleMapping<T> { [CYCLE.MONTHLY]?: T; [CYCLE.YEARLY]?: T; [CYCLE.TWO_YEAR...
8,563
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/User.ts
import { USER_ROLES } from '../constants'; import { Key } from './Key'; import { Currency } from './Subscription'; export enum MNEMONIC_STATUS { DISABLED = 0, ENABLED = 1, OUTDATED = 2, SET = 3, PROMPT = 4, } export enum UserType { PROTON = 1, MANAGED = 2, EXTERNAL = 3, } export enum ...
8,564
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/UserSettings.ts
import type { ThemeSetting } from '@proton/shared/lib/themes/themes'; import { DENSITY } from '../constants'; import { RegisteredKey } from '../webauthn/interface'; import { ChecklistId } from './Checklist'; export enum SETTINGS_STATUS { UNVERIFIED = 0, VERIFIED = 1, INVALID = 2, } export enum SETTINGS_P...
8,565
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/VPN.ts
export interface MyLocationResponse { IP: string; Lat: number; Long: number; Country: string; ISP: string; } export interface VPNServersCount { Capacity: number; Countries: number; Servers: number; } export interface VPNServersCountData { free: { countries: number; ...
8,566
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/VPNServer.ts
export interface ServerLocation { Lat: number; Long: number; } interface Server { Domain: string; EntryIP: string; ExitIP: string; ID: string; Status: number; } export interface VPNServer { City: string | null; Country: string; Domain: string; EntryCountry: string; Exit...
8,567
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/VerificationPreferences.ts
import { PublicKeyReference } from '@proton/crypto'; import { KeyTransparencyVerificationResult } from './KeyTransparency'; export interface VerificationPreferences { isOwnAddress: boolean; verifyingKeys: PublicKeyReference[]; apiKeys: PublicKeyReference[]; pinnedKeys: PublicKeyReference[]; compro...
8,568
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/config.ts
import { APP_NAMES, CLIENT_TYPES } from '../constants'; export interface ProtonConfig { CLIENT_TYPE: CLIENT_TYPES; CLIENT_SECRET: string; APP_VERSION: string; APP_NAME: APP_NAMES; API_URL: string; LOCALES: { [key: string]: string }; DATE_VERSION: string; COMMIT: string; BRANCH: stri...
8,569
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/index.ts
import type { enums } from '@proton/crypto'; export * from './Address'; export * from './AddressForwarding'; export * from './Api'; export * from './ApiEnvironmentConfig'; export * from './Checklist'; export * from './Domain'; export * from './EncryptionPreferences'; export * from './Environment'; export * from './Hot...
8,570
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/message.ts
export enum CREATE_DRAFT_MESSAGE_ACTION { REPLY = 0, REPLY_ALL = 1, FORWARD = 2, } export enum SEND_MESSAGE_DIRECT_ACTION { REPLY = 0, REPLY_ALL = 1, FORWARD = 2, AUTO_RESPONSE = 3, READ_RECEIPT = 4, }
8,571
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/utils.ts
export type SimpleMap<T> = { [key: string]: T | undefined }; export type MaybeArray<T> = T[] | T; export type LoadingMap = SimpleMap<boolean>; export type RequireOnly<T, Keys extends keyof T> = Partial<T> & Required<Pick<T, Keys>>; export type RequireSome<T, Keys extends keyof T> = T & Required<Pick<T, Keys>>; exp...
8,572
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Alarm.ts
export interface CalendarAlarm { ID: string; CalendarID: string; Occurrence: number; Trigger: string; Action: number; EventID: string; MemberID: string; }
8,573
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Api.ts
import { PaginationParams } from '../../api/interface'; import { CALENDAR_DISPLAY, CALENDAR_TYPE } from '../../calendar/constants'; import { ApiResponse } from '../Api'; import { Nullable, RequireSome } from '../utils'; import { CalendarNotificationSettings } from './Calendar'; import { CalendarKey, CalendarPassphrase ...
8,574
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Attendee.ts
import { ATTENDEE_STATUS_API } from '../../calendar/constants'; import { VcalAttendeeProperty, VcalAttendeePropertyParameters } from './VcalModel'; export interface AttendeeClearPartResult { status: ATTENDEE_STATUS_API; token: string; } interface AttendeeParameters extends VcalAttendeePropertyParameters { ...
8,575
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Calendar.ts
import { CALENDAR_DISPLAY, CALENDAR_TYPE, NOTIFICATION_TYPE_API, SETTINGS_VIEW } from '../../calendar/constants'; import { Nullable } from '../utils'; import { CalendarKey } from './CalendarKey'; import { CalendarMember, CalendarOwner } from './CalendarMember'; import { NotificationModel } from './Notification'; import...
8,576
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/CalendarKey.ts
import { PrivateKeyReference, PublicKeyReference } from '@proton/crypto'; import { CALENDAR_FLAGS } from '@proton/shared/lib/calendar/constants'; import { ApiResponse } from '@proton/shared/lib/interfaces'; export enum CalendarKeyFlags { INACTIVE = 0, ACTIVE = 1, PRIMARY = 2, } export interface CalendarKe...
8,577
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/CalendarMember.ts
import { CALENDAR_DISPLAY } from '../../calendar/constants'; export enum MEMBER_INVITATION_STATUS { PENDING = 0, ACCEPTED = 1, REJECTED = 2, } export interface CalendarOwner { Email: string; } export interface CalendarMember { ID: string; CalendarID: string; AddressID: string; Flags: ...
8,578
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Date.ts
export interface DateTime { year: number; month: number; day: number; hours: number; minutes: number; seconds: number; milliseconds?: number; }
8,579
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/DateTime.ts
export interface DateTimeValue { year: number; month: number; day: number; hours: number; minutes: number; seconds: number; }
8,580
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Decrypt.ts
import { SessionKey } from '@proton/crypto'; import { EVENT_VERIFICATION_STATUS } from '../../calendar/constants'; import { Address } from '../Address'; import { VcalAttendeeProperty, VcalVeventComponent } from './VcalModel'; export interface SelfAddressData { isOrganizer: boolean; isAttendee: boolean; se...
8,581
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Event.ts
import { CalendarNotificationSettings } from '@proton/shared/lib/interfaces/calendar/Calendar'; import { ATTENDEE_STATUS_API, CALENDAR_CARD_TYPE, DAILY_TYPE, END_TYPE, EVENT_VERIFICATION_STATUS, FREQUENCY, ICAL_ATTENDEE_ROLE, ICAL_ATTENDEE_RSVP, ICAL_ATTENDEE_STATUS, ICAL_EVENT_...
8,582
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/EventManager.ts
import { EVENT_ACTIONS } from '../../constants'; import { Calendar, CalendarAlarm, CalendarEventWithoutBlob, CalendarMember, CalendarSubscription, CalendarUrl, CalendarWithOwnMembers, } from './index'; export interface CalendarAlarmEventManagerDelete { ID: string; Action: EVENT_ACTI...
8,583
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Export.ts
import { WeekStartsOn } from '../../date-fns-utc/interface'; import { VisualCalendar } from './Calendar'; export enum EXPORT_STEPS { EXPORTING, FINISHED, } export enum EXPORT_ERRORS { NETWORK_ERROR, } export enum EXPORT_EVENT_ERROR_TYPES { DECRYPTION_ERROR, PASSWORD_RESET, } export type ExportEr...
8,584
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Import.ts
import { ICAL_METHOD } from '../../calendar/constants'; import { ImportEventError } from '../../calendar/icsSurgery/ImportEventError'; import { ImportFatalError } from '../../calendar/import/ImportFatalError'; import { ImportFileError } from '../../calendar/import/ImportFileError'; import { CalendarCreateEventBlobData ...
8,585
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Invite.ts
import { Nullable } from '@proton/shared/lib/interfaces'; import { ICAL_ATTENDEE_ROLE, ICAL_ATTENDEE_STATUS } from '../../calendar/constants'; import { DecryptedKey } from '../Key'; import { CalendarSettings, VisualCalendar } from './Calendar'; import { DecryptedCalendarKey } from './CalendarKey'; import { CalendarEve...
8,586
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Link.ts
import { Nullable } from '../utils'; import { Calendar } from './Calendar'; export enum ACCESS_LEVEL { LIMITED = 0, FULL = 1, } export interface CalendarUrl { CalendarUrlID: string; CalendarID: string; PassphraseID?: string; AccessLevel: ACCESS_LEVEL; EncryptedPurpose: Nullable<string>; ...
8,587
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Notification.ts
import { NOTIFICATION_TYPE_API, NOTIFICATION_UNITS, NOTIFICATION_WHEN } from '../../calendar/constants'; export interface NotificationModel { id: string; unit: NOTIFICATION_UNITS; type: NOTIFICATION_TYPE_API; when: NOTIFICATION_WHEN; value?: number; at?: Date; isAllDay: boolean; }
8,588
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/PartResult.ts
export interface EncryptPartResult { dataPacket: Uint8Array; signature: string; } export interface SignPartResult { data: string; signature: string; }
8,589
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Passphrase.ts
export interface MemberPassphrase { MemberID: string; Passphrase: string; Signature: string; } export interface Invitation { CalendarID: string; PassphraseID: string; InvitationID: string; Status: number; CreateTime: number; ExpirationTime: number; Permissions: number; Email...
8,590
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/Subscription.ts
import { VisualCalendar } from './Calendar'; export enum CALENDAR_SUBSCRIPTION_STATUS { OK = 0, ERROR = 1, INVALID_ICS = 2, CALENDAR_SOFT_DELETED = 3, CALENDAR_NOT_FOUND = 4, USER_NOT_EXIST = 5, ICS_SIZE_EXCEED_LIMIT = 6, SYNCHRONIZING = 7, CALENDAR_MISSING_PRIMARY_KEY = 8, HTTP...
8,591
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/VcalModel.ts
import { ICAL_ATTENDEE_ROLE, ICAL_ATTENDEE_RSVP, ICAL_ATTENDEE_STATUS, ICAL_EVENT_STATUS, } from '../../calendar/constants'; export enum VcalDays { SU, MO, TU, WE, TH, FR, SA, } export type VcalDaysKeys = keyof typeof VcalDays; export interface VcalDateValue { year: nu...
8,592
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/calendar/index.ts
export * from './Alarm'; export * from './Attendee'; export * from './Calendar'; export * from './CalendarKey'; export * from './Date'; export * from './DateTime'; export * from './Decrypt'; export * from './Event'; export * from './Export'; export * from './Import'; export * from './Invite'; export * from './CalendarM...
8,593
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/Contact.ts
import { PublicKeyReference } from '@proton/crypto'; import { CONTACT_CARD_TYPE } from '../../constants'; export interface ContactEmail { ID: string; Email: string; Name: string; Type: string[]; Defaults: number; Order: number; ContactID: string; LabelIDs: string[]; LastUsedTime: n...
8,594
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/ContactApi.ts
import { ContactMetadata } from './Contact'; export interface AddContactsApiResponse { Index: number; Response: { Code: number; Contact?: ContactMetadata; Error?: string; }; } export interface AddContactsApiResponses { Code: number; Responses: AddContactsApiResponse[]; } e...
8,595
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/FormattedContact.ts
import { Contact } from './Contact'; export interface FormattedContact extends Contact { emails: string[]; }
8,596
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/GroupsWithCount.ts
import { ContactGroup } from './Contact'; export interface GroupsWithCount extends ContactGroup { count: number; }
8,597
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/Import.ts
import { ImportContactError } from '../../contacts/errors/ImportContactError'; import { ImportFatalError } from '../../contacts/errors/ImportFatalError'; import { ImportFileError } from '../../contacts/errors/ImportFileError'; import { ContactCard, ContactGroup, ContactValue } from './Contact'; import { VCardContact, V...
8,598
0
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces
petrpan-code/ProtonMail/WebClients/packages/shared/lib/interfaces/contacts/MergeModel.ts
import { FormattedContact } from './FormattedContact'; export interface MergeModel { orderedContacts: FormattedContact[][]; isChecked: { [ID: string]: boolean; }; beDeleted: { [ID: string]: boolean; }; }
8,599