@singi-labs/sifa-sdk 0.12.38 → 0.12.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge/index.cjs +3 -0
- package/dist/badge/index.cjs.map +1 -1
- package/dist/badge/index.js +3 -0
- package/dist/badge/index.js.map +1 -1
- package/dist/{index-G5HiA-nk.d.cts → index-BPImvVQq.d.cts} +44 -2
- package/dist/{index-N0-ctbY1.d.ts → index-C1szgnQc.d.ts} +44 -2
- package/dist/{index-C-TwdQWh.d.cts → index-CO3z2uAZ.d.cts} +1 -1
- package/dist/{index-DzjbfKwZ.d.ts → index-DyffAaPT.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{org-OPyzh-oe.d.cts → org-DPfmXSYv.d.cts} +24 -2
- package/dist/{org-BFi9g37U.d.ts → org-dEe3TbBJ.d.ts} +24 -2
- package/dist/query/fetchers/index.cjs +32 -2
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +2 -2
- package/dist/query/fetchers/index.d.ts +2 -2
- package/dist/query/fetchers/index.js +30 -3
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +8 -2
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +2 -2
- package/dist/query/hooks/index.d.ts +2 -2
- package/dist/query/hooks/index.js +8 -2
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +83 -2
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +28 -6
- package/dist/query/index.d.ts +28 -6
- package/dist/query/index.js +78 -3
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
package/dist/badge/index.cjs
CHANGED
|
@@ -96,6 +96,9 @@ async function apiFetch(config, path, options = {}) {
|
|
|
96
96
|
}
|
|
97
97
|
throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);
|
|
98
98
|
}
|
|
99
|
+
if (res.status === 204 || res.status === 205) {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
99
102
|
return await res.json();
|
|
100
103
|
}
|
|
101
104
|
throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);
|
package/dist/badge/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/client.ts","../../src/query/fetchers/get-profile-view.ts","../../src/query/fetchers/profile-summary.ts","../../src/badge/index.ts"],"names":[],"mappings":";;;AAoBO,SAAS,oBACd,SAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,MAAA,KAAW,GAAG,OAAO,MAAA;AAEjD,EAAA,MAAM,SAAS,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,EAAE,OAAO,CAAA;AACjD,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAEhC,EAAA,MAAM,UAAU,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,YAAY,IAAI,CAAA;AACrD,EAAA,IAAI,SAAS,OAAO,OAAA;AAEpB,EAAA,OAAO,CAAC,GAAG,MAAM,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAA,CAAO,CAAA,CAAE,SAAA,IAAa,IAAI,aAAA,CAAc,CAAA,CAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAA;AAC3F;;;ACOA,IAAM,kBAAA,GAAqB,CAAA;AAEpB,SAAS,oBAAA,CACd,IAAA,EACA,OAAA,GAAuC,EAAC,EACxB;AAChB,EAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,OAAA,CAAQ,aAAa,kBAAkB,CAAA;AACjE,EAAA,MAAM,OAAA,GAAU,mBAAA,CAAoB,IAAA,CAAK,SAAS,CAAA;AAElD,EAAA,OAAO;AAAA,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,MAAA,CAAO,SAAA,GAAY,MAAA;AACnB,MAAA,MAAA,CAAO,WAAA,GAAc,IAAA;AACrB,MAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,IACpB;AAEA,IAAA,IAAI,OAAA,CAAQ,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAChC,MAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAC5C,MAAA,MAAA,CAAO,SAAA,GAAY,QAAA;AACnB,MAAA,KAAA,MAAW,KAAA,IAAS,QAAQ,SAAA,EAAW;AACrC,QAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAC1C,QAAA,IAAA,CAAK,SAAA,GAAY,MAAA;AACjB,QAAA,IAAA,CAAK,WAAA,GAAc,KAAA;AACnB,QAAA,MAAA,CAAO,OAAO,IAAI,CAAA;AAAA,MACpB;AACA,MAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,IACpB;AAEA,IAAA,IAAA,CAAK,OAAO,IAAI,CAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,CAAgB,MAAc,GAAA,EAAW;AACvD,EAAA,IAAI,OAAO,cAAA,KAAmB,WAAA,IAAe,CAAC,cAAA,CAAe,GAAA,CAAI,GAAG,CAAA,EAAG;AACrE,IAAA,cAAA,CAAe,MAAA,CAAO,KAAK,gBAAgB,CAAA;AAAA,EAC7C;AACF;AAEA,eAAA,EAAgB","file":"index.cjs","sourcesContent":["/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active.\n * 2. Otherwise, the active position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no active position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","/**\n * `<sifa-badge>` — a framework-free custom element that renders a person's\n * professional headline (name, current role and employer, top skills) from\n * their Sifa profile. Drop it into any page:\n *\n * ```html\n * <script type=\"module\" src=\"https://esm.sh/@singi-labs/sifa-sdk/badge\"></script>\n * <sifa-badge handle=\"gui.do\"></sifa-badge>\n * ```\n *\n * Or, in a bundler: `import '@singi-labs/sifa-sdk/badge'` (importing registers\n * the element). Attributes: `handle` or `did` (required), `api` (AppView base,\n * default `https://api.sifa.id`), `max-skills` (default 5).\n *\n * Reads the public `id.sifa.getProfileView` query, so it needs no auth or key.\n * Cross-origin browser use depends on that endpoint's open CORS.\n */\n\nimport type { ProfileSummary } from '../logic/profile-summary.js';\nimport { fetchProfileSummary } from '../query/fetchers/profile-summary.js';\n\nconst TAG = 'sifa-badge';\nconst DEFAULT_API_BASE = 'https://api.sifa.id';\nconst PROFILE_BASE = 'https://sifa.id/p/';\n\n// Reference HTMLElement through a guarded base so importing this module never\n// throws in a non-DOM (SSR / Node) context. The real element is only ever\n// registered and instantiated in a browser, where defineSifaBadge runs.\nconst BaseElement: typeof HTMLElement =\n typeof HTMLElement !== 'undefined' ? HTMLElement : (class {} as unknown as typeof HTMLElement);\n\nconst STYLES = `\n :host { display: inline-block; max-width: 22rem; }\n a.card {\n display: flex; gap: 0.75rem; align-items: center;\n padding: 0.75rem 0.9rem; text-decoration: none; color: inherit;\n border: 1px solid rgba(0,0,0,0.12); border-radius: 0.75rem;\n background: canvas; font: 400 0.9rem/1.4 system-ui, sans-serif;\n }\n a.card:hover { border-color: rgba(0,0,0,0.28); }\n a.card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }\n .avatar { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex: none; }\n .body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }\n .name { font-weight: 600; }\n .role { color: color-mix(in srgb, canvastext 65%, canvas); }\n .skills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }\n .chip {\n font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;\n background: color-mix(in srgb, canvastext 8%, canvas);\n }\n .msg { margin: 0; padding: 0.5rem 0.6rem; color: color-mix(in srgb, canvastext 60%, canvas);\n font: 400 0.85rem/1.4 system-ui, sans-serif; }\n`;\n\nexport class SifaBadgeElement extends BaseElement {\n static readonly observedAttributes = ['handle', 'did', 'api', 'max-skills'];\n\n private readonly shadow: ShadowRoot;\n private renderToken = 0;\n private scheduled = false;\n\n constructor() {\n super();\n this.shadow = this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback(): void {\n this.schedule();\n }\n\n attributeChangedCallback(): void {\n this.schedule();\n }\n\n /** Coalesce a burst of synchronous attribute writes (and the initial connect) into one load. */\n private schedule(): void {\n if (this.scheduled) return;\n this.scheduled = true;\n queueMicrotask(() => {\n this.scheduled = false;\n if (this.isConnected) void this.load();\n });\n }\n\n private async load(): Promise<void> {\n const token = ++this.renderToken;\n const actor = this.getAttribute('did') || this.getAttribute('handle');\n if (!actor) {\n this.paint(this.message('Set a handle or did attribute on <sifa-badge>.'));\n return;\n }\n\n const baseUrl = this.getAttribute('api') || DEFAULT_API_BASE;\n const rawMax = this.getAttribute('max-skills');\n const maxSkills = rawMax != null ? Number(rawMax) : undefined;\n const options = maxSkills != null && Number.isFinite(maxSkills) ? { maxSkills } : {};\n\n this.paint(this.message('Loading…'));\n\n let summary: ProfileSummary | null;\n try {\n summary = await fetchProfileSummary({ baseUrl }, actor, options);\n } catch {\n if (token === this.renderToken) this.paint(this.message('Could not load this profile.'));\n return;\n }\n\n if (token !== this.renderToken) return; // a newer load superseded this one\n this.paint(summary ? this.card(summary) : this.message(`No Sifa profile for ${actor}.`));\n }\n\n private paint(body: Node): void {\n const style = document.createElement('style');\n style.textContent = STYLES;\n this.shadow.replaceChildren(style, body);\n }\n\n private message(text: string): HTMLElement {\n const p = document.createElement('p');\n p.className = 'msg';\n p.textContent = text;\n return p;\n }\n\n private card(summary: ProfileSummary): HTMLElement {\n const name = summary.displayName || summary.handle;\n const link = document.createElement('a');\n link.className = 'card';\n link.href = PROFILE_BASE + encodeURIComponent(summary.handle);\n link.target = '_blank';\n link.rel = 'noopener';\n link.setAttribute('aria-label', `${name} on Sifa`);\n\n if (summary.avatar) {\n const img = document.createElement('img');\n img.className = 'avatar';\n img.src = summary.avatar;\n img.alt = '';\n img.loading = 'lazy';\n link.append(img);\n }\n\n const body = document.createElement('span');\n body.className = 'body';\n\n const nameEl = document.createElement('span');\n nameEl.className = 'name';\n nameEl.textContent = name;\n body.append(nameEl);\n\n const role =\n [summary.currentTitle, summary.currentCompany].filter(Boolean).join(' · ') ||\n summary.headline;\n if (role) {\n const roleEl = document.createElement('span');\n roleEl.className = 'role';\n roleEl.textContent = role;\n body.append(roleEl);\n }\n\n if (summary.topSkills.length > 0) {\n const skills = document.createElement('span');\n skills.className = 'skills';\n for (const skill of summary.topSkills) {\n const chip = document.createElement('span');\n chip.className = 'chip';\n chip.textContent = skill;\n skills.append(chip);\n }\n body.append(skills);\n }\n\n link.append(body);\n return link;\n }\n}\n\n/** Register the element (idempotent). Called automatically when this module is imported. */\nexport function defineSifaBadge(tag: string = TAG): void {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, SifaBadgeElement);\n }\n}\n\ndefineSifaBadge();\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/client.ts","../../src/query/fetchers/get-profile-view.ts","../../src/query/fetchers/profile-summary.ts","../../src/badge/index.ts"],"names":[],"mappings":";;;AAoBO,SAAS,oBACd,SAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,MAAA,KAAW,GAAG,OAAO,MAAA;AAEjD,EAAA,MAAM,SAAS,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,EAAE,OAAO,CAAA;AACjD,EAA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A,CAAK,SAAA,GAAY,MAAA;AACjB,QAAA,IAAA,CAAK,WAAA,GAAc,KAAA;AACnB,QAAA,MAAA,CAAO,OAAO,IAAI,CAAA;AAAA,MACpB;AACA,MAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,IACpB;AAEA,IAAA,IAAA,CAAK,OAAO,IAAI,CAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,CAAgB,MAAc,GAAA,EAAW;AACvD,EAAA,IAAI,OAAO,cAAA,KAAmB,WAAA,IAAe,CAAC,cAAA,CAAe,GAAA,CAAI,GAAG,CAAA,EAAG;AACrE,IAAA,cAAA,CAAe,MAAA,CAAO,KAAK,gBAAgB,CAAA;AAAA,EAC7C;AACF;AAEA,eAAA,EAAgB","file":"index.cjs","sourcesContent":["/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active.\n * 2. Otherwise, the active position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no active position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n // 204 and 205 are defined to carry no body, so res.json() throws on them.\n // apiWrite treats that throw as a failed write, which turned every\n // successful no-content response (roadmap unvote, remove reaction,\n // dismiss endorsement) into a reported error.\n if (res.status === 204 || res.status === 205) {\n return undefined as T;\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","/**\n * `<sifa-badge>` — a framework-free custom element that renders a person's\n * professional headline (name, current role and employer, top skills) from\n * their Sifa profile. Drop it into any page:\n *\n * ```html\n * <script type=\"module\" src=\"https://esm.sh/@singi-labs/sifa-sdk/badge\"></script>\n * <sifa-badge handle=\"gui.do\"></sifa-badge>\n * ```\n *\n * Or, in a bundler: `import '@singi-labs/sifa-sdk/badge'` (importing registers\n * the element). Attributes: `handle` or `did` (required), `api` (AppView base,\n * default `https://api.sifa.id`), `max-skills` (default 5).\n *\n * Reads the public `id.sifa.getProfileView` query, so it needs no auth or key.\n * Cross-origin browser use depends on that endpoint's open CORS.\n */\n\nimport type { ProfileSummary } from '../logic/profile-summary.js';\nimport { fetchProfileSummary } from '../query/fetchers/profile-summary.js';\n\nconst TAG = 'sifa-badge';\nconst DEFAULT_API_BASE = 'https://api.sifa.id';\nconst PROFILE_BASE = 'https://sifa.id/p/';\n\n// Reference HTMLElement through a guarded base so importing this module never\n// throws in a non-DOM (SSR / Node) context. The real element is only ever\n// registered and instantiated in a browser, where defineSifaBadge runs.\nconst BaseElement: typeof HTMLElement =\n typeof HTMLElement !== 'undefined' ? HTMLElement : (class {} as unknown as typeof HTMLElement);\n\nconst STYLES = `\n :host { display: inline-block; max-width: 22rem; }\n a.card {\n display: flex; gap: 0.75rem; align-items: center;\n padding: 0.75rem 0.9rem; text-decoration: none; color: inherit;\n border: 1px solid rgba(0,0,0,0.12); border-radius: 0.75rem;\n background: canvas; font: 400 0.9rem/1.4 system-ui, sans-serif;\n }\n a.card:hover { border-color: rgba(0,0,0,0.28); }\n a.card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }\n .avatar { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex: none; }\n .body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }\n .name { font-weight: 600; }\n .role { color: color-mix(in srgb, canvastext 65%, canvas); }\n .skills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }\n .chip {\n font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;\n background: color-mix(in srgb, canvastext 8%, canvas);\n }\n .msg { margin: 0; padding: 0.5rem 0.6rem; color: color-mix(in srgb, canvastext 60%, canvas);\n font: 400 0.85rem/1.4 system-ui, sans-serif; }\n`;\n\nexport class SifaBadgeElement extends BaseElement {\n static readonly observedAttributes = ['handle', 'did', 'api', 'max-skills'];\n\n private readonly shadow: ShadowRoot;\n private renderToken = 0;\n private scheduled = false;\n\n constructor() {\n super();\n this.shadow = this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback(): void {\n this.schedule();\n }\n\n attributeChangedCallback(): void {\n this.schedule();\n }\n\n /** Coalesce a burst of synchronous attribute writes (and the initial connect) into one load. */\n private schedule(): void {\n if (this.scheduled) return;\n this.scheduled = true;\n queueMicrotask(() => {\n this.scheduled = false;\n if (this.isConnected) void this.load();\n });\n }\n\n private async load(): Promise<void> {\n const token = ++this.renderToken;\n const actor = this.getAttribute('did') || this.getAttribute('handle');\n if (!actor) {\n this.paint(this.message('Set a handle or did attribute on <sifa-badge>.'));\n return;\n }\n\n const baseUrl = this.getAttribute('api') || DEFAULT_API_BASE;\n const rawMax = this.getAttribute('max-skills');\n const maxSkills = rawMax != null ? Number(rawMax) : undefined;\n const options = maxSkills != null && Number.isFinite(maxSkills) ? { maxSkills } : {};\n\n this.paint(this.message('Loading…'));\n\n let summary: ProfileSummary | null;\n try {\n summary = await fetchProfileSummary({ baseUrl }, actor, options);\n } catch {\n if (token === this.renderToken) this.paint(this.message('Could not load this profile.'));\n return;\n }\n\n if (token !== this.renderToken) return; // a newer load superseded this one\n this.paint(summary ? this.card(summary) : this.message(`No Sifa profile for ${actor}.`));\n }\n\n private paint(body: Node): void {\n const style = document.createElement('style');\n style.textContent = STYLES;\n this.shadow.replaceChildren(style, body);\n }\n\n private message(text: string): HTMLElement {\n const p = document.createElement('p');\n p.className = 'msg';\n p.textContent = text;\n return p;\n }\n\n private card(summary: ProfileSummary): HTMLElement {\n const name = summary.displayName || summary.handle;\n const link = document.createElement('a');\n link.className = 'card';\n link.href = PROFILE_BASE + encodeURIComponent(summary.handle);\n link.target = '_blank';\n link.rel = 'noopener';\n link.setAttribute('aria-label', `${name} on Sifa`);\n\n if (summary.avatar) {\n const img = document.createElement('img');\n img.className = 'avatar';\n img.src = summary.avatar;\n img.alt = '';\n img.loading = 'lazy';\n link.append(img);\n }\n\n const body = document.createElement('span');\n body.className = 'body';\n\n const nameEl = document.createElement('span');\n nameEl.className = 'name';\n nameEl.textContent = name;\n body.append(nameEl);\n\n const role =\n [summary.currentTitle, summary.currentCompany].filter(Boolean).join(' · ') ||\n summary.headline;\n if (role) {\n const roleEl = document.createElement('span');\n roleEl.className = 'role';\n roleEl.textContent = role;\n body.append(roleEl);\n }\n\n if (summary.topSkills.length > 0) {\n const skills = document.createElement('span');\n skills.className = 'skills';\n for (const skill of summary.topSkills) {\n const chip = document.createElement('span');\n chip.className = 'chip';\n chip.textContent = skill;\n skills.append(chip);\n }\n body.append(skills);\n }\n\n link.append(body);\n return link;\n }\n}\n\n/** Register the element (idempotent). Called automatically when this module is imported. */\nexport function defineSifaBadge(tag: string = TAG): void {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, SifaBadgeElement);\n }\n}\n\ndefineSifaBadge();\n"]}
|
package/dist/badge/index.js
CHANGED
|
@@ -94,6 +94,9 @@ async function apiFetch(config, path, options = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);
|
|
96
96
|
}
|
|
97
|
+
if (res.status === 204 || res.status === 205) {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
97
100
|
return await res.json();
|
|
98
101
|
}
|
|
99
102
|
throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);
|
package/dist/badge/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/client.ts","../../src/query/fetchers/get-profile-view.ts","../../src/query/fetchers/profile-summary.ts","../../src/badge/index.ts"],"names":[],"mappings":";AAoBO,SAAS,oBACd,SAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,MAAA,KAAW,GAAG,OAAO,MAAA;AAEjD,EAAA,MAAM,SAAS,SAAA,CAAU,M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AAc,KAAA;AACnB,QAAA,MAAA,CAAO,OAAO,IAAI,CAAA;AAAA,MACpB;AACA,MAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,IACpB;AAEA,IAAA,IAAA,CAAK,OAAO,IAAI,CAAA;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,CAAgB,MAAc,GAAA,EAAW;AACvD,EAAA,IAAI,OAAO,cAAA,KAAmB,WAAA,IAAe,CAAC,cAAA,CAAe,GAAA,CAAI,GAAG,CAAA,EAAG;AACrE,IAAA,cAAA,CAAe,MAAA,CAAO,KAAK,gBAAgB,CAAA;AAAA,EAC7C;AACF;AAEA,eAAA,EAAgB","file":"index.js","sourcesContent":["/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active.\n * 2. Otherwise, the active position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no active position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","/**\n * `<sifa-badge>` — a framework-free custom element that renders a person's\n * professional headline (name, current role and employer, top skills) from\n * their Sifa profile. Drop it into any page:\n *\n * ```html\n * <script type=\"module\" src=\"https://esm.sh/@singi-labs/sifa-sdk/badge\"></script>\n * <sifa-badge handle=\"gui.do\"></sifa-badge>\n * ```\n *\n * Or, in a bundler: `import '@singi-labs/sifa-sdk/badge'` (importing registers\n * the element). Attributes: `handle` or `did` (required), `api` (AppView base,\n * default `https://api.sifa.id`), `max-skills` (default 5).\n *\n * Reads the public `id.sifa.getProfileView` query, so it needs no auth or key.\n * Cross-origin browser use depends on that endpoint's open CORS.\n */\n\nimport type { ProfileSummary } from '../logic/profile-summary.js';\nimport { fetchProfileSummary } from '../query/fetchers/profile-summary.js';\n\nconst TAG = 'sifa-badge';\nconst DEFAULT_API_BASE = 'https://api.sifa.id';\nconst PROFILE_BASE = 'https://sifa.id/p/';\n\n// Reference HTMLElement through a guarded base so importing this module never\n// throws in a non-DOM (SSR / Node) context. The real element is only ever\n// registered and instantiated in a browser, where defineSifaBadge runs.\nconst BaseElement: typeof HTMLElement =\n typeof HTMLElement !== 'undefined' ? HTMLElement : (class {} as unknown as typeof HTMLElement);\n\nconst STYLES = `\n :host { display: inline-block; max-width: 22rem; }\n a.card {\n display: flex; gap: 0.75rem; align-items: center;\n padding: 0.75rem 0.9rem; text-decoration: none; color: inherit;\n border: 1px solid rgba(0,0,0,0.12); border-radius: 0.75rem;\n background: canvas; font: 400 0.9rem/1.4 system-ui, sans-serif;\n }\n a.card:hover { border-color: rgba(0,0,0,0.28); }\n a.card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }\n .avatar { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex: none; }\n .body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }\n .name { font-weight: 600; }\n .role { color: color-mix(in srgb, canvastext 65%, canvas); }\n .skills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }\n .chip {\n font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;\n background: color-mix(in srgb, canvastext 8%, canvas);\n }\n .msg { margin: 0; padding: 0.5rem 0.6rem; color: color-mix(in srgb, canvastext 60%, canvas);\n font: 400 0.85rem/1.4 system-ui, sans-serif; }\n`;\n\nexport class SifaBadgeElement extends BaseElement {\n static readonly observedAttributes = ['handle', 'did', 'api', 'max-skills'];\n\n private readonly shadow: ShadowRoot;\n private renderToken = 0;\n private scheduled = false;\n\n constructor() {\n super();\n this.shadow = this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback(): void {\n this.schedule();\n }\n\n attributeChangedCallback(): void {\n this.schedule();\n }\n\n /** Coalesce a burst of synchronous attribute writes (and the initial connect) into one load. */\n private schedule(): void {\n if (this.scheduled) return;\n this.scheduled = true;\n queueMicrotask(() => {\n this.scheduled = false;\n if (this.isConnected) void this.load();\n });\n }\n\n private async load(): Promise<void> {\n const token = ++this.renderToken;\n const actor = this.getAttribute('did') || this.getAttribute('handle');\n if (!actor) {\n this.paint(this.message('Set a handle or did attribute on <sifa-badge>.'));\n return;\n }\n\n const baseUrl = this.getAttribute('api') || DEFAULT_API_BASE;\n const rawMax = this.getAttribute('max-skills');\n const maxSkills = rawMax != null ? Number(rawMax) : undefined;\n const options = maxSkills != null && Number.isFinite(maxSkills) ? { maxSkills } : {};\n\n this.paint(this.message('Loading…'));\n\n let summary: ProfileSummary | null;\n try {\n summary = await fetchProfileSummary({ baseUrl }, actor, options);\n } catch {\n if (token === this.renderToken) this.paint(this.message('Could not load this profile.'));\n return;\n }\n\n if (token !== this.renderToken) return; // a newer load superseded this one\n this.paint(summary ? this.card(summary) : this.message(`No Sifa profile for ${actor}.`));\n }\n\n private paint(body: Node): void {\n const style = document.createElement('style');\n style.textContent = STYLES;\n this.shadow.replaceChildren(style, body);\n }\n\n private message(text: string): HTMLElement {\n const p = document.createElement('p');\n p.className = 'msg';\n p.textContent = text;\n return p;\n }\n\n private card(summary: ProfileSummary): HTMLElement {\n const name = summary.displayName || summary.handle;\n const link = document.createElement('a');\n link.className = 'card';\n link.href = PROFILE_BASE + encodeURIComponent(summary.handle);\n link.target = '_blank';\n link.rel = 'noopener';\n link.setAttribute('aria-label', `${name} on Sifa`);\n\n if (summary.avatar) {\n const img = document.createElement('img');\n img.className = 'avatar';\n img.src = summary.avatar;\n img.alt = '';\n img.loading = 'lazy';\n link.append(img);\n }\n\n const body = document.createElement('span');\n body.className = 'body';\n\n const nameEl = document.createElement('span');\n nameEl.className = 'name';\n nameEl.textContent = name;\n body.append(nameEl);\n\n const role =\n [summary.currentTitle, summary.currentCompany].filter(Boolean).join(' · ') ||\n summary.headline;\n if (role) {\n const roleEl = document.createElement('span');\n roleEl.className = 'role';\n roleEl.textContent = role;\n body.append(roleEl);\n }\n\n if (summary.topSkills.length > 0) {\n const skills = document.createElement('span');\n skills.className = 'skills';\n for (const skill of summary.topSkills) {\n const chip = document.createElement('span');\n chip.className = 'chip';\n chip.textContent = skill;\n skills.append(chip);\n }\n body.append(skills);\n }\n\n link.append(body);\n return link;\n }\n}\n\n/** Register the element (idempotent). Called automatically when this module is imported. */\nexport function defineSifaBadge(tag: string = TAG): void {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, SifaBadgeElement);\n }\n}\n\ndefineSifaBadge();\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/logic/primary-position.ts","../../src/logic/profile-summary.ts","../../src/query/client.ts","../../src/query/fetchers/get-profile-view.ts","../../src/query/fetchers/profile-summary.ts","../../src/badge/index.ts"],"names":[],"mappings":";AAoBO,SAAS,oBACd,SAAA,EACe;AACf,EAAA,IAAI,CAAC,SAAA,IAAa,SAAA,CAAU,MAAA,KAAW,GAAG,OAAO,MAAA;AAEjD,EAAA,MAAM,SAAS,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,EAAE,OAAO,CAAA;AACjD,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAEhC,EAAA,MAAM,UAAU,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,YAAY,IAAI,CAAA;AACrD,EAAA,IAAI,SAAS,OAAO,OAAA;AAEpB,EAAA,OAAO,CAAC,GAAG,MAAM,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAA,CAAO,CAAA,CAAE,SAAA,IAAa,IAAI,aAAA,CAAc,CAAA,CAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAA;AAC3F;;;ACOA,IAAM,kBAAA,GAAqB,CAAA;AAEpB,SAAS,oBAAA,CACd,IAAA,EACA,OAAA,GAAuC,EAAC,EACxB;AAChB,EAAA,MAAM,QAAQ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Content":["/**\n * Canonical rule for picking the \"primary\" position to surface on profile cards,\n * social previews, and structured-data outputs.\n *\n * Without this shared helper, different surfaces (visible hero, OG image,\n * <meta description>, JSON-LD) re-derived \"primary\" inconsistently and diverged\n * for users with multiple concurrent roles.\n *\n * Rules (in order):\n * 1. A position the user explicitly flagged `primary` AND that is still active.\n * 2. Otherwise, the active position with the most recent `startedAt`.\n * 3. Otherwise, undefined (no active position).\n */\n\nexport interface PrimaryPositionCandidate {\n startedAt?: string;\n endedAt?: string;\n primary?: boolean;\n}\n\nexport function pickPrimaryPosition<T extends PrimaryPositionCandidate>(\n positions: readonly T[] | undefined,\n): T | undefined {\n if (!positions || positions.length === 0) return undefined;\n\n const active = positions.filter((p) => !p.endedAt);\n if (active.length === 0) return undefined;\n\n const flagged = active.find((p) => p.primary === true);\n if (flagged) return flagged;\n\n return [...active].sort((a, b) => (b.startedAt ?? '').localeCompare(a.startedAt ?? ''))[0];\n}\n","/**\n * Compact professional summary derived from a {@link ProfileView}.\n *\n * The full `id.sifa.getProfileView` payload carries every section (all\n * positions, education, skills, publications, talks, and more). Third-party\n * surfaces that only want to show \"who is this, what do they do now\" — a badge,\n * a maintainer card, a byline — need a much smaller shape. This is that shape,\n * derived with the same canonical rules the Sifa web app uses (see\n * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.\n *\n * Pure and I/O-free: pass it a view you already fetched. For the fetch +\n * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.\n */\n\nimport type { ProfileView } from '../types/profile-view.js';\nimport { pickPrimaryPosition } from './primary-position.js';\n\nexport interface ProfileSummary {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n pronouns?: string;\n headline?: string;\n /** Title of the current primary role, if the person has an active position. */\n currentTitle?: string;\n /** Current employer: the resolved entity name when linked, else the free-text company. */\n currentCompany?: string;\n /** Skill names in the order the AppView returns them, capped by `maxSkills`. */\n topSkills: string[];\n /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */\n claimed: boolean;\n}\n\nexport interface SummarizeProfileViewOptions {\n /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */\n maxSkills?: number;\n}\n\nconst DEFAULT_MAX_SKILLS = 5;\n\nexport function summarizeProfileView(\n view: ProfileView,\n options: SummarizeProfileViewOptions = {},\n): ProfileSummary {\n const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);\n const primary = pickPrimaryPosition(view.positions);\n\n return {\n did: view.did,\n handle: view.handle,\n displayName: view.displayName,\n avatar: view.avatar,\n pronouns: view.pronouns,\n headline: view.headline,\n currentTitle: primary?.title,\n currentCompany: primary ? (primary.entityName ?? primary.company) : undefined,\n topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),\n claimed: view.claimed ?? false,\n };\n}\n","/**\n * Foundation HTTP client for talking to the Sifa AppView.\n *\n * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React\n * hooks read it from context; non-React consumers pass it explicitly). No\n * singletons, no module-level state.\n */\n\n/** Configuration passed to every fetcher. */\nexport interface SifaApiConfig {\n /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */\n baseUrl: string;\n /**\n * Optional fetch implementation. Defaults to {@link globalThis.fetch}.\n * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo\n * consumers can leave this unset.\n */\n fetch?: typeof fetch;\n}\n\n/** Options accepted by {@link apiFetch}. */\nexport interface ApiFetchOptions {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n /** Request body. Serialized to JSON automatically. */\n body?: unknown;\n /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */\n signal?: AbortSignal;\n /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */\n timeoutMs?: number;\n /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */\n retryOn429?: boolean;\n /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n cache?: RequestCache;\n /**\n * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed\n * through transparently as part of {@link RequestInit}.\n */\n next?: { revalidate?: number | false; tags?: string[] };\n}\n\n/** Error thrown by {@link apiFetch} on non-2xx responses. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(message: string, status: number, body?: unknown) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.body = body;\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst MAX_RATE_LIMIT_RETRIES = 3;\nconst RATE_LIMIT_RETRY_CAP_SECONDS = 3;\n\n/**\n * Encode a handle or DID for safe interpolation into a request path,\n * idempotently.\n *\n * Plain {@link encodeURIComponent} double-encodes an already-encoded\n * identifier: Next.js hands route params to RSC pages percent-encoded on a\n * hard navigation (`did%3Aplc%3A...`) but decoded on client-side navigation\n * (`did:plc:...`). Encoding the former again turns `%` into `%25`, so the\n * AppView reads `did%3A...` as a literal handle, finds no match, and 404s —\n * which is why DID profile links broke on direct visits but worked when\n * clicked within the app.\n *\n * AT identifiers (handles are domain names, DIDs are `did:method:...`) never\n * contain a literal `%`, so decoding a decoded value is a no-op. A malformed\n * percent sequence (lone `%`) makes {@link decodeURIComponent} throw; in that\n * case we keep the original value so behaviour matches the prior bare\n * `encodeURIComponent`.\n */\nexport function encodeIdentifier(value: string): string {\n let decoded = value;\n try {\n decoded = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding — fall back to the raw value.\n }\n return encodeURIComponent(decoded);\n}\n\n/**\n * Generic fetcher used by all SDK query and mutation functions.\n *\n * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx\n * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`\n * instead.\n */\nexport async function apiFetch<T = unknown>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}${path}`;\n const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n let body: BodyInit | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] ??= 'application/json';\n body = JSON.stringify(options.body);\n }\n\n // `next` is a Next.js extension to RequestInit; cast through.\n const init = {\n method: options.method ?? 'GET',\n headers,\n body,\n signal,\n credentials: options.credentials,\n cache: options.cache,\n ...(options.next ? { next: options.next } : {}),\n } as RequestInit;\n\n const res = await fetchFn(url, init);\n\n if (res.status === 429 && attempt < maxRetries) {\n const retryAfterRaw = res.headers.get('retry-after');\n const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;\n const waitSeconds = Math.min(\n Number.isFinite(retryAfter) ? retryAfter : 2,\n RATE_LIMIT_RETRY_CAP_SECONDS,\n );\n await new Promise((r) => setTimeout(r, waitSeconds * 1000));\n continue;\n }\n\n if (!res.ok) {\n let errBody: unknown;\n try {\n errBody = (await res.json()) as unknown;\n } catch {\n try {\n errBody = await res.text();\n } catch {\n errBody = undefined;\n }\n }\n throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);\n }\n\n // 204 and 205 are defined to carry no body, so res.json() throws on them.\n // apiWrite treats that throw as a failed write, which turned every\n // successful no-content response (roadmap unvote, remove reaction,\n // dismiss endorsement) into a reported error.\n if (res.status === 204 || res.status === 205) {\n return undefined as T;\n }\n\n return (await res.json()) as T;\n }\n\n throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);\n}\n\n/**\n * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead\n * of throwing. Useful for \"fetch by handle\" reads where missing is\n * expected (e.g. unknown profile).\n */\nexport async function apiFetchOrNull<T>(\n config: SifaApiConfig,\n path: string,\n options: ApiFetchOptions = {},\n): Promise<T | null> {\n try {\n return await apiFetch<T>(config, path, options);\n } catch (e) {\n if (e instanceof ApiError && e.status === 404) return null;\n throw e;\n }\n}\n\n/**\n * Result returned by record-write mutations (create / update / delete).\n *\n * Never throws -- writes against the user's PDS can fail in many ways\n * (network, PDS unreachable, rate limit) and the UI needs structured\n * results to render appropriate messages.\n */\nexport interface WriteResult {\n success: boolean;\n error?: string;\n /**\n * PDS hostname returned by sifa-api when a write failed at the user's\n * Personal Data Server (issue #167). Lets the UI render\n * \"Your data server (eurosky.social) isn't responding\" instead of a\n * generic \"Request failed (500)\".\n */\n pdsHost?: string;\n}\n\n/** Result returned by create mutations. Includes the newly created `rkey`. */\nexport interface CreateResult extends WriteResult {\n rkey?: string;\n}\n\ninterface ApiErrorBody {\n message?: string;\n pdsHost?: string;\n}\n\nfunction extractWriteError(data: unknown, status: number): { error: string; pdsHost?: string } {\n const body = (data ?? {}) as ApiErrorBody;\n return {\n error: body.message ?? `Request failed (${status})`,\n ...(body.pdsHost ? { pdsHost: body.pdsHost } : {}),\n };\n}\n\n/**\n * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the\n * never-throws contract used by all sifa-web mutations: returns a\n * structured {@link WriteResult} on both success and failure, and\n * preserves the `pdsHost` field when the AppView reports a PDS-side\n * failure (issue #167).\n *\n * On success: returns `{ success: true, ...payload }` where `payload` is\n * whatever the server returned in JSON (or `{}` for 204).\n *\n * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.\n *\n * Use {@link apiWriteCreate} when you specifically need the `rkey` from a\n * create response folded into the result shape.\n */\nexport async function apiWrite<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n method: 'POST' | 'PUT' | 'DELETE' | 'PATCH',\n options: Omit<ApiFetchOptions, 'method'> = {},\n): Promise<WriteResult & TExtra> {\n try {\n const data = await apiFetch<TExtra>(config, path, {\n method,\n credentials: 'include',\n ...options,\n });\n return { success: true, ...(data ?? ({} as TExtra)) };\n } catch (e) {\n if (e instanceof ApiError) {\n return { success: false, ...extractWriteError(e.body, e.status) } as WriteResult & TExtra;\n }\n return { success: false, error: 'Network error' } as WriteResult & TExtra;\n }\n}\n\n/**\n * Write mutation that expects the server to return a record key (`rkey`)\n * in its response body. Wraps {@link apiWrite} and folds the `rkey` into\n * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.\n *\n * If the server returns additional fields (e.g. `feedUrl` from external\n * account creation), pass them via the `TExtra` generic to keep them\n * typed.\n */\nexport function apiWriteCreate<TExtra extends object = Record<never, never>>(\n config: SifaApiConfig,\n path: string,\n body: unknown,\n options: Omit<ApiFetchOptions, 'method' | 'body'> = {},\n): Promise<CreateResult & TExtra> {\n return apiWrite<{ rkey?: string } & TExtra>(config, path, 'POST', {\n body,\n ...options,\n });\n}\n","import type { ProfileView } from '../../types/profile-view.js';\nimport {\n ApiError,\n apiFetch,\n encodeIdentifier,\n type ApiFetchOptions,\n type SifaApiConfig,\n} from '../client.js';\n\n/**\n * Read the aggregated public profile view via the `id.sifa.getProfileView`\n * XRPC query. This is the AppView-only join (positions, education, skills,\n * endorsements, and more) exposed as a standard lexicon method, distinct from\n * the internal `/api/profile/*` REST surface.\n *\n * Returns `null` when the AppView has no profile for the actor\n * (`ProfileNotFound`). Throws {@link ApiError} on other non-2xx responses.\n *\n * Server-callable (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchGetProfileView(\n config: SifaApiConfig,\n actor: string,\n options: ApiFetchOptions = {},\n): Promise<ProfileView | null> {\n const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;\n try {\n return await apiFetch<ProfileView>(config, path, { retryOn429: true, ...options });\n } catch (e) {\n if (\n e instanceof ApiError &&\n e.status === 400 &&\n typeof e.body === 'object' &&\n e.body !== null &&\n (e.body as { error?: unknown }).error === 'ProfileNotFound'\n ) {\n return null;\n }\n throw e;\n }\n}\n","import {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from '../../logic/profile-summary.js';\nimport { fetchGetProfileView } from './get-profile-view.js';\nimport type { ApiFetchOptions, SifaApiConfig } from '../client.js';\n\n/**\n * Fetch the aggregated public profile via `id.sifa.getProfileView` and reduce it\n * to a compact {@link ProfileSummary} (identity, headline, current role/employer,\n * top skills). Convenience over `fetchGetProfileView` + `summarizeProfileView`,\n * for third-party surfaces that only want the headline facts.\n *\n * Returns `null` when the AppView has no profile for the actor. Server-callable\n * (Next.js RSC) and client-callable (Expo, browser).\n */\nexport async function fetchProfileSummary(\n config: SifaApiConfig,\n actor: string,\n options: SummarizeProfileViewOptions & ApiFetchOptions = {},\n): Promise<ProfileSummary | null> {\n const { maxSkills, ...fetchOptions } = options;\n const view = await fetchGetProfileView(config, actor, fetchOptions);\n return view ? summarizeProfileView(view, { maxSkills }) : null;\n}\n","/**\n * `<sifa-badge>` — a framework-free custom element that renders a person's\n * professional headline (name, current role and employer, top skills) from\n * their Sifa profile. Drop it into any page:\n *\n * ```html\n * <script type=\"module\" src=\"https://esm.sh/@singi-labs/sifa-sdk/badge\"></script>\n * <sifa-badge handle=\"gui.do\"></sifa-badge>\n * ```\n *\n * Or, in a bundler: `import '@singi-labs/sifa-sdk/badge'` (importing registers\n * the element). Attributes: `handle` or `did` (required), `api` (AppView base,\n * default `https://api.sifa.id`), `max-skills` (default 5).\n *\n * Reads the public `id.sifa.getProfileView` query, so it needs no auth or key.\n * Cross-origin browser use depends on that endpoint's open CORS.\n */\n\nimport type { ProfileSummary } from '../logic/profile-summary.js';\nimport { fetchProfileSummary } from '../query/fetchers/profile-summary.js';\n\nconst TAG = 'sifa-badge';\nconst DEFAULT_API_BASE = 'https://api.sifa.id';\nconst PROFILE_BASE = 'https://sifa.id/p/';\n\n// Reference HTMLElement through a guarded base so importing this module never\n// throws in a non-DOM (SSR / Node) context. The real element is only ever\n// registered and instantiated in a browser, where defineSifaBadge runs.\nconst BaseElement: typeof HTMLElement =\n typeof HTMLElement !== 'undefined' ? HTMLElement : (class {} as unknown as typeof HTMLElement);\n\nconst STYLES = `\n :host { display: inline-block; max-width: 22rem; }\n a.card {\n display: flex; gap: 0.75rem; align-items: center;\n padding: 0.75rem 0.9rem; text-decoration: none; color: inherit;\n border: 1px solid rgba(0,0,0,0.12); border-radius: 0.75rem;\n background: canvas; font: 400 0.9rem/1.4 system-ui, sans-serif;\n }\n a.card:hover { border-color: rgba(0,0,0,0.28); }\n a.card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }\n .avatar { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex: none; }\n .body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }\n .name { font-weight: 600; }\n .role { color: color-mix(in srgb, canvastext 65%, canvas); }\n .skills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }\n .chip {\n font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;\n background: color-mix(in srgb, canvastext 8%, canvas);\n }\n .msg { margin: 0; padding: 0.5rem 0.6rem; color: color-mix(in srgb, canvastext 60%, canvas);\n font: 400 0.85rem/1.4 system-ui, sans-serif; }\n`;\n\nexport class SifaBadgeElement extends BaseElement {\n static readonly observedAttributes = ['handle', 'did', 'api', 'max-skills'];\n\n private readonly shadow: ShadowRoot;\n private renderToken = 0;\n private scheduled = false;\n\n constructor() {\n super();\n this.shadow = this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback(): void {\n this.schedule();\n }\n\n attributeChangedCallback(): void {\n this.schedule();\n }\n\n /** Coalesce a burst of synchronous attribute writes (and the initial connect) into one load. */\n private schedule(): void {\n if (this.scheduled) return;\n this.scheduled = true;\n queueMicrotask(() => {\n this.scheduled = false;\n if (this.isConnected) void this.load();\n });\n }\n\n private async load(): Promise<void> {\n const token = ++this.renderToken;\n const actor = this.getAttribute('did') || this.getAttribute('handle');\n if (!actor) {\n this.paint(this.message('Set a handle or did attribute on <sifa-badge>.'));\n return;\n }\n\n const baseUrl = this.getAttribute('api') || DEFAULT_API_BASE;\n const rawMax = this.getAttribute('max-skills');\n const maxSkills = rawMax != null ? Number(rawMax) : undefined;\n const options = maxSkills != null && Number.isFinite(maxSkills) ? { maxSkills } : {};\n\n this.paint(this.message('Loading…'));\n\n let summary: ProfileSummary | null;\n try {\n summary = await fetchProfileSummary({ baseUrl }, actor, options);\n } catch {\n if (token === this.renderToken) this.paint(this.message('Could not load this profile.'));\n return;\n }\n\n if (token !== this.renderToken) return; // a newer load superseded this one\n this.paint(summary ? this.card(summary) : this.message(`No Sifa profile for ${actor}.`));\n }\n\n private paint(body: Node): void {\n const style = document.createElement('style');\n style.textContent = STYLES;\n this.shadow.replaceChildren(style, body);\n }\n\n private message(text: string): HTMLElement {\n const p = document.createElement('p');\n p.className = 'msg';\n p.textContent = text;\n return p;\n }\n\n private card(summary: ProfileSummary): HTMLElement {\n const name = summary.displayName || summary.handle;\n const link = document.createElement('a');\n link.className = 'card';\n link.href = PROFILE_BASE + encodeURIComponent(summary.handle);\n link.target = '_blank';\n link.rel = 'noopener';\n link.setAttribute('aria-label', `${name} on Sifa`);\n\n if (summary.avatar) {\n const img = document.createElement('img');\n img.className = 'avatar';\n img.src = summary.avatar;\n img.alt = '';\n img.loading = 'lazy';\n link.append(img);\n }\n\n const body = document.createElement('span');\n body.className = 'body';\n\n const nameEl = document.createElement('span');\n nameEl.className = 'name';\n nameEl.textContent = name;\n body.append(nameEl);\n\n const role =\n [summary.currentTitle, summary.currentCompany].filter(Boolean).join(' · ') ||\n summary.headline;\n if (role) {\n const roleEl = document.createElement('span');\n roleEl.className = 'role';\n roleEl.textContent = role;\n body.append(roleEl);\n }\n\n if (summary.topSkills.length > 0) {\n const skills = document.createElement('span');\n skills.className = 'skills';\n for (const skill of summary.topSkills) {\n const chip = document.createElement('span');\n chip.className = 'chip';\n chip.textContent = skill;\n skills.append(chip);\n }\n body.append(skills);\n }\n\n link.append(body);\n return link;\n }\n}\n\n/** Register the element (idempotent). Called automatically when this module is imported. */\nexport function defineSifaBadge(tag: string = TAG): void {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, SifaBadgeElement);\n }\n}\n\ndefineSifaBadge();\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SifaApiConfig, A as ApiFetchOptions,
|
|
1
|
+
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-DPfmXSYv.cjs';
|
|
2
2
|
import { e as Profile, P as ProfileView, g as ProfilePosition, a7 as SkillRef } from './adult-content-BQoId34F.cjs';
|
|
3
3
|
import { m as EntitySearchResponse, E as EntitySearchResult, g as EntityMintDomainResponse, k as EntityResolveDomainResponse, p as EntitySelectRequest, r as EntitySelectResponse } from './feed-C8aHEPw4.cjs';
|
|
4
4
|
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-BmtnD3ix.cjs';
|
|
@@ -101,6 +101,48 @@ declare function updateRecord(config: SifaApiConfig, collection: string, rkey: s
|
|
|
101
101
|
/** Generic record-delete escape hatch. See {@link createRecord}. */
|
|
102
102
|
declare function deleteRecord(config: SifaApiConfig, collection: string, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
103
103
|
|
|
104
|
+
/** A received endorsement the subject has neither confirmed nor dismissed. */
|
|
105
|
+
interface PendingEndorsement {
|
|
106
|
+
endorserDid: string;
|
|
107
|
+
rkey: string;
|
|
108
|
+
/**
|
|
109
|
+
* AT-URI of the endorsement record. The confirm mutation needs a strongRef,
|
|
110
|
+
* so the AppView hands this back rather than making callers rebuild it.
|
|
111
|
+
*/
|
|
112
|
+
uri: string;
|
|
113
|
+
skillUri: string;
|
|
114
|
+
skillCid: string;
|
|
115
|
+
skillName: string;
|
|
116
|
+
comment?: string;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
}
|
|
119
|
+
interface PendingEndorsementsPage {
|
|
120
|
+
endorsements: PendingEndorsement[];
|
|
121
|
+
cursor?: string;
|
|
122
|
+
}
|
|
123
|
+
/** Body accepted by {@link dismissEndorsement}. */
|
|
124
|
+
interface DismissEndorsementInput {
|
|
125
|
+
endorserDid: string;
|
|
126
|
+
rkey: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Endorsements awaiting the signed-in user's decision. Requires credentials --
|
|
130
|
+
* the AppView reads the subject DID from the session, not from a parameter, so
|
|
131
|
+
* there is no way to read someone else's inbox.
|
|
132
|
+
*
|
|
133
|
+
* Returns an empty page on failure so a broken inbox degrades to "nothing
|
|
134
|
+
* pending" rather than breaking the surface hosting it.
|
|
135
|
+
*/
|
|
136
|
+
declare function fetchPendingEndorsements(config: SifaApiConfig, options?: ApiFetchOptions): Promise<PendingEndorsementsPage>;
|
|
137
|
+
/**
|
|
138
|
+
* Take a received endorsement out of the inbox.
|
|
139
|
+
*
|
|
140
|
+
* This writes nothing to any PDS. An endorsement only displays once the subject
|
|
141
|
+
* has confirmed it, so declining is already the default state -- the dismissal
|
|
142
|
+
* is a local flag that stops it reappearing, not a published rejection.
|
|
143
|
+
*/
|
|
144
|
+
declare function dismissEndorsement(config: SifaApiConfig, data: DismissEndorsementInput, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
145
|
+
|
|
104
146
|
/**
|
|
105
147
|
* Hide a keytrace claim (verified-account claim discovered on the
|
|
106
148
|
* user's external accounts) from the user's profile. The claim itself
|
|
@@ -273,4 +315,4 @@ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string,
|
|
|
273
315
|
*/
|
|
274
316
|
declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
|
|
275
317
|
|
|
276
|
-
export {
|
|
318
|
+
export { isNetworkMapResponse as A, linkSkillToPosition as B, mintEntityDomain as C, type DismissEndorsementInput as D, resolveEntityDomain as E, type FetchNetworkStreamCountOptions as F, revealMarqueDomain as G, selectEntity as H, setPositionPrimary as I, unhideKeytraceClaim as J, unlinkSkillFromPosition as K, unrevealMarqueDomain as L, unsetPositionPrimary as M, type NetworkMapEdge as N, updateEducation as O, type PendingEndorsementsPage as P, updatePosition as Q, updateRecord as R, type NetworkMapGenerationJob as a, type NetworkMapGraphData as b, type NetworkMapNode as c, type NetworkMapPendingJob as d, type NetworkMapResponse as e, type PendingEndorsement as f, checkNetworkMapJobStatus as g, createEducation as h, createPosition as i, createRecord as j, deleteEducation as k, deletePosition as l, deleteRecord as m, dismissEndorsement as n, fetchAtFundLink as o, fetchEndorsementCount as p, fetchEntitySearch as q, fetchGetProfileView as r, fetchNetworkMap as s, fetchNetworkStreamCount as t, fetchPendingEndorsements as u, fetchProfile as v, fetchProfileSummary as w, hideKeytraceClaim as x, importSearchEntities as y, initiateNetworkMapGeneration as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SifaApiConfig, A as ApiFetchOptions,
|
|
1
|
+
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-dEe3TbBJ.js';
|
|
2
2
|
import { e as Profile, P as ProfileView, g as ProfilePosition, a7 as SkillRef } from './adult-content-BQoId34F.js';
|
|
3
3
|
import { m as EntitySearchResponse, E as EntitySearchResult, g as EntityMintDomainResponse, k as EntityResolveDomainResponse, p as EntitySelectRequest, r as EntitySelectResponse } from './feed-C8aHEPw4.js';
|
|
4
4
|
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-cPc7uJVa.js';
|
|
@@ -101,6 +101,48 @@ declare function updateRecord(config: SifaApiConfig, collection: string, rkey: s
|
|
|
101
101
|
/** Generic record-delete escape hatch. See {@link createRecord}. */
|
|
102
102
|
declare function deleteRecord(config: SifaApiConfig, collection: string, rkey: string, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
103
103
|
|
|
104
|
+
/** A received endorsement the subject has neither confirmed nor dismissed. */
|
|
105
|
+
interface PendingEndorsement {
|
|
106
|
+
endorserDid: string;
|
|
107
|
+
rkey: string;
|
|
108
|
+
/**
|
|
109
|
+
* AT-URI of the endorsement record. The confirm mutation needs a strongRef,
|
|
110
|
+
* so the AppView hands this back rather than making callers rebuild it.
|
|
111
|
+
*/
|
|
112
|
+
uri: string;
|
|
113
|
+
skillUri: string;
|
|
114
|
+
skillCid: string;
|
|
115
|
+
skillName: string;
|
|
116
|
+
comment?: string;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
}
|
|
119
|
+
interface PendingEndorsementsPage {
|
|
120
|
+
endorsements: PendingEndorsement[];
|
|
121
|
+
cursor?: string;
|
|
122
|
+
}
|
|
123
|
+
/** Body accepted by {@link dismissEndorsement}. */
|
|
124
|
+
interface DismissEndorsementInput {
|
|
125
|
+
endorserDid: string;
|
|
126
|
+
rkey: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Endorsements awaiting the signed-in user's decision. Requires credentials --
|
|
130
|
+
* the AppView reads the subject DID from the session, not from a parameter, so
|
|
131
|
+
* there is no way to read someone else's inbox.
|
|
132
|
+
*
|
|
133
|
+
* Returns an empty page on failure so a broken inbox degrades to "nothing
|
|
134
|
+
* pending" rather than breaking the surface hosting it.
|
|
135
|
+
*/
|
|
136
|
+
declare function fetchPendingEndorsements(config: SifaApiConfig, options?: ApiFetchOptions): Promise<PendingEndorsementsPage>;
|
|
137
|
+
/**
|
|
138
|
+
* Take a received endorsement out of the inbox.
|
|
139
|
+
*
|
|
140
|
+
* This writes nothing to any PDS. An endorsement only displays once the subject
|
|
141
|
+
* has confirmed it, so declining is already the default state -- the dismissal
|
|
142
|
+
* is a local flag that stops it reappearing, not a published rejection.
|
|
143
|
+
*/
|
|
144
|
+
declare function dismissEndorsement(config: SifaApiConfig, data: DismissEndorsementInput, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
145
|
+
|
|
104
146
|
/**
|
|
105
147
|
* Hide a keytrace claim (verified-account claim discovered on the
|
|
106
148
|
* user's external accounts) from the user's profile. The claim itself
|
|
@@ -273,4 +315,4 @@ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string,
|
|
|
273
315
|
*/
|
|
274
316
|
declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
|
|
275
317
|
|
|
276
|
-
export {
|
|
318
|
+
export { isNetworkMapResponse as A, linkSkillToPosition as B, mintEntityDomain as C, type DismissEndorsementInput as D, resolveEntityDomain as E, type FetchNetworkStreamCountOptions as F, revealMarqueDomain as G, selectEntity as H, setPositionPrimary as I, unhideKeytraceClaim as J, unlinkSkillFromPosition as K, unrevealMarqueDomain as L, unsetPositionPrimary as M, type NetworkMapEdge as N, updateEducation as O, type PendingEndorsementsPage as P, updatePosition as Q, updateRecord as R, type NetworkMapGenerationJob as a, type NetworkMapGraphData as b, type NetworkMapNode as c, type NetworkMapPendingJob as d, type NetworkMapResponse as e, type PendingEndorsement as f, checkNetworkMapJobStatus as g, createEducation as h, createPosition as i, createRecord as j, deleteEducation as k, deletePosition as l, deleteRecord as m, dismissEndorsement as n, fetchAtFundLink as o, fetchEndorsementCount as p, fetchEntitySearch as q, fetchGetProfileView as r, fetchNetworkMap as s, fetchNetworkStreamCount as t, fetchPendingEndorsements as u, fetchProfile as v, fetchProfileSummary as w, hideKeytraceClaim as x, importSearchEntities as y, initiateNetworkMapGeneration as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult,
|
|
3
|
+
import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult, ai as RefreshPdsResult, ay as UpdateProfileOverrideInput, az as UpdateProfileSelfInput, aA as UploadAvatarResult, C as CreateResult, av as SubCategoryBulkResult, a6 as ProfileLocationInput, l as ExternalAccountInput, k as CreateExternalAccountResult, aB as VerifyExternalAccountResult, E as EndorsementInput, ah as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, T as HideProfileItemInput, au as StatsResponse, h as AppRegistryEntry, P as HiddenApp, y as FilterOptions, ap as SearchFilters, aq as SearchResponse, at as SkillSearchResult, m as FeaturedProfile, as as SimilarProfile, x as FetchSuggestionsOptions, ax as SuggestionsResponse, I as FollowUserResult, p as FetchFollowListOptions, z as FollowListPage, J as FollowingResponse, r as FetchFollowingFeedOptions, q as FetchFollowProfilePageOptions, H as FollowProfilePageResponse, F as FeatureAllowlistResponse, n as FetchActivityFeedOptions, c as ActivityFeedResponse, f as ActivityTeaserResponse, O as HeatmapResponse, V as MyGithubPullRequestsResponse, b as AccountCheckResult, ag as ReactionStatus, af as ReactionResult, ae as ReactionError, ao as RoadmapVotesResponse, i as CastRoadmapVoteResult, D as DeleteAccountResult, aj as ResetProfileResult, aC as WipePreview, Y as OrgClaimResult, a2 as OrgProfileUpdateResult, Z as OrgDomainChallengeResult, _ as OrgDomainVerifyResult, $ as OrgNotificationEmailAddResult, a0 as OrgNotificationEmailRemoveResult } from './org-DPfmXSYv.cjs';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { UseQueryOptions, UseMutationOptions, UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { e as Profile, P as ProfileView, g as ProfilePosition, a7 as SkillRef, E as ExternalAccount, S as SkillSuggestion, N as OrgFloorVerdict } from './adult-content-BQoId34F.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult,
|
|
3
|
+
import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult, ai as RefreshPdsResult, ay as UpdateProfileOverrideInput, az as UpdateProfileSelfInput, aA as UploadAvatarResult, C as CreateResult, av as SubCategoryBulkResult, a6 as ProfileLocationInput, l as ExternalAccountInput, k as CreateExternalAccountResult, aB as VerifyExternalAccountResult, E as EndorsementInput, ah as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, T as HideProfileItemInput, au as StatsResponse, h as AppRegistryEntry, P as HiddenApp, y as FilterOptions, ap as SearchFilters, aq as SearchResponse, at as SkillSearchResult, m as FeaturedProfile, as as SimilarProfile, x as FetchSuggestionsOptions, ax as SuggestionsResponse, I as FollowUserResult, p as FetchFollowListOptions, z as FollowListPage, J as FollowingResponse, r as FetchFollowingFeedOptions, q as FetchFollowProfilePageOptions, H as FollowProfilePageResponse, F as FeatureAllowlistResponse, n as FetchActivityFeedOptions, c as ActivityFeedResponse, f as ActivityTeaserResponse, O as HeatmapResponse, V as MyGithubPullRequestsResponse, b as AccountCheckResult, ag as ReactionStatus, af as ReactionResult, ae as ReactionError, ao as RoadmapVotesResponse, i as CastRoadmapVoteResult, D as DeleteAccountResult, aj as ResetProfileResult, aC as WipePreview, Y as OrgClaimResult, a2 as OrgProfileUpdateResult, Z as OrgDomainChallengeResult, _ as OrgDomainVerifyResult, $ as OrgNotificationEmailAddResult, a0 as OrgNotificationEmailRemoveResult } from './org-dEe3TbBJ.js';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { UseQueryOptions, UseMutationOptions, UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { e as Profile, P as ProfileView, g as ProfilePosition, a7 as SkillRef, E as ExternalAccount, S as SkillSuggestion, N as OrgFloorVerdict } from './adult-content-BQoId34F.js';
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -4882,7 +4882,7 @@ function roadmapIssueUrl(issue) {
|
|
|
4882
4882
|
}
|
|
4883
4883
|
|
|
4884
4884
|
// src/index.ts
|
|
4885
|
-
var SIFA_SDK_VERSION = "0.12.
|
|
4885
|
+
var SIFA_SDK_VERSION = "0.12.39";
|
|
4886
4886
|
|
|
4887
4887
|
export { ACTIVITY_TIERS, ACTIVITY_VERBS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, ALL_SECTIONS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, ARTIFACT_LINK_KIND_LABELS, ARTIFACT_LINK_KIND_OPTIONS, ArtifactLinkSchema, AtmosphereFeedItemSchema, BlobRefSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntityMintDomainResponseSchema, EntityResolveDomainRequestSchema, EntityResolveDomainResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, INVOLVEMENT_HEADING_ORDER, INVOLVEMENT_KIND_HEADINGS, INVOLVEMENT_KIND_LABELS, INVOLVEMENT_KIND_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, OrgEmploymentAttestationRecordSchema, OrgProfileRecordSchema, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PROFILE_INVOLVEMENT_NSID, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileInvolvementRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, ROADMAP_ISSUES_REPO, ROADMAP_ITEM_META, SECTION_GROUPS, SECTION_LABELS, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, STREAM_VERBS, SifaFeedItemSchema, VERIFICATION_PROVIDERS, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, buildTalkSlug, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, filterHidden, findIndustry, formatCompanyName, formatDateRange, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, formatTimelineDate, getActivityTaxonomyVersion, getActivityTier, getActivityVerbsVersion, getAppCategoryIcon, getAppIdForCollection, getArtifactLinkKindLabel, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getInvolvementKindHeading, getInvolvementKindLabel, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getVerificationProvider, getVisibleSectionIds, getWorkplaceTypeLabel, groupInvolvementByHeading, groupSkillsByCategory, groupSkillsBySubCategory, groupSkillsForDisplay, hasAdultContent, hasPersonalProfileContent, hoistPrimary, isAppCategory, isCompanyPageIndexable, isCompanyRequired, isKnownAppId, isKnownPlatform, isKnownVerificationProvider, isLinked, isPseudoEmployer, isRegistrableDomainHandle, isSectionPopulated, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, looksLikeDomain, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeLegalForm, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, parseTalkRkey, partialDateSchema, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, primaryVerification, profileToDimensionInputs, qualifiesAsOrg, relativeLuminance, rendersCompanyProfile, rendersPersonalProfile, resolveAccountFacetMode, resolveCardHealth, resolveCardUrl, resolveEmbed, resolveVerifierProvider, rgbToString, roadmapIssueUrl, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, skillRefSchema, slugifyTitle, sortByActiveDateRange, sortByDateDesc, sortCertifications, sortEducation, sortHonors, sortLanguages, sortLanguagesByProficiency, sortPositions, sortProjects, sortPublications, streamAddressSchema, streamAuthorSchema, streamCardBodySchema, streamCardSubjectSchema, streamCardVMSchema, streamExternalLinkSchema, streamGeoSchema, streamMediaSchema, streamRichSegmentSchema, streamSourceSchema, streamThemeSchema, streamVerbSchema, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, summarizeProfileView, toStreamCardVM, toStreamCardVMs, truncateGraphemes, uriSchema, verbForCollection, visibleItems, youtubeThumbnailUrl, youtubeVideoId };
|
|
4888
4888
|
//# sourceMappingURL=index.js.map
|