npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ocularsolution/react

v0.1.1

Published

Adaptador React para el SDK de Ocular Solution.

Readme

@ocularsolution/react

SDK oficial de Ocular Solution para integrar videollamadas en aplicaciones React (Vite, Next.js, CRA).

Provee un Provider + hooks que cargan el widget de Ocular en su página y lo controlan programáticamente. SSR-safe: no accede a window/document en el servidor.

Compatibilidad

| Componente | Versión | |---|---| | React / React DOM | ≥ 18 (validado con 19.1) | | Bundlers | Vite, Next.js, Webpack, CRA | | TypeScript (opcional) | ≥ 5.0 — tipos .d.ts incluidos |

1. Antes de empezar

Solicite a Ocular Solution sus datos de aprovisionamiento:

  1. widgetCode — código de organización de su widget. Configúrelo por variable de entorno; no lo incruste en el repositorio.
  2. widgetUrl — URL https del script del widget para su entorno.
  3. Autorización de su dominio — el origin desde el que su web usará el widget debe estar dado de alta por Ocular Solution. Sin este registro el widget no se inicializa (verá OCULAR_E_WIDGET_TIMEOUT).

2. Instalación

pnpm add @ocularsolution/react
# o
npm install @ocularsolution/react

3. Uso

// src/App.jsx (ejemplo con Vite)
import { OcularProvider, useOcularCall } from '@ocularsolution/react';

function Controls() {
  const { state, show, hide, toggle } = useOcularCall();
  return (
    <>
      <button onClick={() => show(true)}>Abrir videollamada</button>
      <button onClick={() => hide()} disabled={state !== 'visible'}>Ocultar</button>
      <span>Estado: {state}</span>
    </>
  );
}

export default function App() {
  return (
    <OcularProvider
      widgetCode={import.meta.env.VITE_OCULAR_WIDGET_CODE}
      widgetUrl={import.meta.env.VITE_OCULAR_WIDGET_URL}
      appOrigin={import.meta.env.VITE_OCULAR_APP_ORIGIN}
    >
      <Controls />
    </OcularProvider>
  );
}

Next.js (App Router)

Los componentes del SDK son client components: use la directiva 'use client' en el archivo que monte <OcularProvider>. El SDK es SSR-safe (la carga del widget ocurre solo en el navegador).

4. API

<OcularProvider>

| Prop | Tipo | Req. | Descripción | |---|---|---|---| | widgetCode | string | Sí | Código de organización | | widgetUrl | string | Sí | URL https del script del widget | | appOrigin | string | No | Origin del iframe para validar mensajes | | widgetModule | string | No | Módulos del widget (default 'call') | | dataset | Record<string,string> | No | Atributos data-* extra del loader | | autoLoad | boolean | No | Carga el widget al montar | | nonce | string | No | Nonce CSP para los scripts inyectados | | scriptIntegrity | string | No | Hash SRI del script del widget |

useOcularCall()

const { state, load, show, hide, toggle, setLocale, setCustomer, showPopUp, align } = useOcularCall();
// state: 'idle' | 'loading' | 'ready' | 'visible' | 'hidden' | 'error'

useOcular()

Devuelve el cliente de bajo nivel (OcularClient) para suscribirse a eventos: state:changed, widget:ready, widget:message, error.

5. Content Security Policy

Si su sitio usa CSP estricta, permita el script del widget en script-src y pase nonce al Provider para el bridge inline. Consulte la guía de implementación completa con su contacto de Ocular Solution.

6. Errores comunes

| Código | Causa | Solución | |---|---|---| | OCULAR_E_WIDGET_TIMEOUT | Dominio no autorizado, widgetUrl/widgetCode incorrectos | Verifique el aprovisionamiento con Ocular Solution | | OCULAR_E_SCRIPT_LOAD | El navegador no pudo descargar el script (red/CSP) | Verifique la URL y su política CSP | | OCULAR_E_INVALID_CONFIG | Configuración incompleta | El mensaje indica el campo |

Protección de datos

setCustomer() permite asociar datos del usuario a la sesión. No envíe datos personales sin base legal y consentimiento. Las videollamadas pueden ser grabadas según la configuración de su organización: informe al usuario conforme a la normativa aplicable.


© Ocular Solution. Soporte: a través de su canal de cuenta. Incidentes de seguridad: [email protected]