summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/stickers/resolver.ts
blob: 0002e716fd3ac2dbd8d6539450fd47082f62ac0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { stickersRegistry } from "./registry";
import { parseStickerId } from "./sticker-id";
import { registerDefaultStickerProviders } from "./providers";
import type { StickerResolveOptions } from "@/lib/stickers/types";

export function resolveStickerId({
	stickerId,
	options,
}: {
	stickerId: string;
	options?: StickerResolveOptions;
}): string {
	registerDefaultStickerProviders();

	const parsedStickerId = parseStickerId({ stickerId });
	return stickersRegistry.get(parsedStickerId.providerId).resolveUrl({
		stickerId,
		options,
	});
}