@asksoma/muhurat-embed
v1.1.2
Published
Host-agnostic Muhurat Finder access helpers, theme tokens, proxy recipe, and iframe postMessage protocol for sub-brands and third parties.
Readme
@asksoma/muhurat-embed
Host-agnostic building blocks for white-label Muhurat Finder UIs (subhmuhurat.ai + third parties).
| Export | Use |
|--------|-----|
| MuhuratFinder | Full Finder UI — AskSoma section order: location → activity → priorities → mode → range presets / compare clocks → factor-in → availability |
| mapIntention / mapPrioritiesToHouses / defaultPrioritiesForActivity | Free-text / chip priorities → target_houses; activity → suggested priorities |
| findMuhuratViaProxy / findMuhuratDailyViaProxy | POST helpers for your /api/muhurat (+ /daily) proxy |
| access | Teaser gate (guest/free/pro) — display only; engine is full-fidelity |
| theme | CSS tokens (SUBHMUHURAT_THEME, DEFAULT_PARTNER_THEME) |
| proxy | createMuhuratProxyHandler / proxyMuhuratFind — server-side only (also forwards /daily) |
| iframeProtocol | postMessage types for iframe embeds |
| MuhuratResultsList | Results-only React chrome |
Never put
sk_live_in the browser. Call AskSoma Partner API from your backend proxy.
Partner kit upgrade
npm i @asksoma/partner@latestAskSoma dogfoods MuhuratFinder on /embed/muhurat-finder and apps/subhmuhurat (same package partners install), including priorities → target_houses, range presets, compare Time A/B (onResults meta compareTimes), moon signs, extra charts, time slots, and daily frames. First-party-only chrome remains Cosmic Contacts sync, doctor/gated flows, and logged-in primary chart. See docs/PARTNER_API_SDK_UPGRADE.md.
onResults meta (v1.1+)
onResults={(result, meta) => {
// meta.mode, meta.onlyDates, meta.compareTimes, meta.intentionLabels, meta.request
}}compareTimes is for Kundli side-by-side only — not a Brain ranking field. Ranking uses only_dates + optional time_window.
Install (monorepo)
cd packages/muhurat-embed && npm install && npm run buildProxy (Node / Cloudflare Worker)
import { createMuhuratProxyHandler } from '@asksoma/muhurat-embed/proxy';
export default {
fetch: createMuhuratProxyHandler({
getApiKey: () => process.env.ASKSOMA_API_KEY,
resolveAccess: () => 'guest', // or read session → free/pro
}),
};See examples/cloudflare-worker.mjs and docs/PARTNER_API_EMBED.md.
iframe
Host page:
<iframe id="muhurat" src="https://embed.subhmuhurat.ai/v1/finder" style="width:100%;border:0;min-height:640px"></iframe>
<script type="module">
import { MUHURAT_EMBED_PROTOCOL, isMuhuratEmbedMessage } from '@asksoma/muhurat-embed/iframe';
window.addEventListener('message', (e) => {
if (!isMuhuratEmbedMessage(e.data)) return;
if (e.data.type === 'resize') document.getElementById('muhurat').style.height = e.data.height + 'px';
});
</script>Security
- Secret keys stay on the server.
- Teaser gating is a rendering decision on the same computed result.
- Partners own their paywall; AskSoma meters by API call quota.
