2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2019 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-12-01 17:52:58 +00:00
|
|
|
import type {
|
|
|
|
ProcessStickerImageErrorType,
|
|
|
|
StickerImageData,
|
|
|
|
} from '../window/phase3-sticker-functions';
|
2019-12-19 23:27:02 +00:00
|
|
|
|
2020-09-14 21:56:35 +00:00
|
|
|
declare global {
|
2021-01-14 18:07:05 +00:00
|
|
|
// We want to extend `window`'s properties, so we need an interface.
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
2020-09-14 21:56:35 +00:00
|
|
|
interface Window {
|
2020-09-28 18:40:26 +00:00
|
|
|
processStickerImage: ProcessStickerImageFn;
|
2020-09-14 21:56:35 +00:00
|
|
|
encryptAndUpload: EncryptAndUploadFn;
|
2022-12-01 01:44:17 +00:00
|
|
|
ProcessStickerImageError: ProcessStickerImageErrorType;
|
2020-09-14 21:56:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:52:58 +00:00
|
|
|
export { StickerImageData };
|
2019-12-17 20:25:57 +00:00
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
type ProcessStickerImageFn = (
|
|
|
|
path: string | undefined
|
|
|
|
) => Promise<StickerImageData>;
|
2019-12-17 20:25:57 +00:00
|
|
|
|
2020-09-28 18:40:26 +00:00
|
|
|
export type StickerData = { imageData?: StickerImageData; emoji?: string };
|
2019-12-17 20:25:57 +00:00
|
|
|
export type PackMetaData = { packId: string; key: string };
|
|
|
|
|
|
|
|
export type EncryptAndUploadFn = (
|
|
|
|
manifest: { title: string; author: string },
|
|
|
|
stickers: Array<StickerData>,
|
2022-09-07 22:10:15 +00:00
|
|
|
cover: StickerImageData,
|
2019-12-17 20:25:57 +00:00
|
|
|
onProgress?: () => unknown
|
|
|
|
) => Promise<PackMetaData>;
|
|
|
|
|
2020-09-28 18:40:26 +00:00
|
|
|
export const { encryptAndUpload, processStickerImage } = window;
|