v0.2.13 · Apache-2.0

LinkMe Web SDK

Zero-dependency TypeScript library for deep linking and deferred linking. Works with Next.js, React, Vue, Svelte, Angular, and vanilla JavaScript.

1 Install

npm install @li-nk.me/web-sdk

2 Initialize

import { configure, resolveFromUrl, onLink } from '@li-nk.me/web-sdk';

await configure({
    appId: 'your_app_id',
    appKey: 'your_read_only_key',
});

3 Handle Links

// Resolve current URL on page load
const initial = await resolveFromUrl();
if (initial?.path) {
    router.replace(initial.path);
}

// Deferred deep link
const deferred = await claimDeferredIfAvailable();
if (deferred?.path) {
    router.replace(deferred.path);
}

// Listen for navigation-triggered links
const sub = onLink((payload) => {
    if (payload?.path) router.replace(payload.path);
});

// Clean up
sub.remove();

Features

Zero Dependencies

Pure TypeScript with no runtime dependencies. Tree-shakeable and works in any bundler or even a plain <script> tag.

Any Framework

Next.js, React, Vue, Svelte, Angular, SvelteKit, Nuxt, Astro — or plain JavaScript. Same API everywhere.

Deferred Linking

Fingerprint-based deferred claim for first-visit attribution. Automatically strips cid from the URL bar.

Auto-Resolution

Resolves the current URL on page load and listens for popstate/hashchange events automatically.