doxy.me
v1.0.0
Published
Embeddable SDK for easily iframing doxy.me into your application
Maintainers
Readme
Doxy.me Embeddable SDK
Easily embed doxy.me into your application using iframes with this simple npm package.
Installation
npm install doxy.meUsage
Basic Usage
Embed any doxy.me URL:
import { embedDoxyMe } from 'doxy.me';
// Embed into a container element
const container = document.getElementById('doxy-container');
const { iframe, destroy } = embedDoxyMe(container, {
url: 'https://doxy.me/sign-in',
width: '100%',
height: '600px'
});
// Clean up when done
// destroy();Provider Sign-In
Embed the provider sign-in page:
import { embedProviderSignIn } from 'doxy.me';
const container = document.getElementById('doxy-container');
const { iframe } = embedProviderSignIn(container, {
width: '100%',
height: '700px'
});Patient Room
Embed a patient room using a room slug:
import { embedPatientRoom } from 'doxy.me';
const container = document.getElementById('doxy-container');
const roomSlug = 'patient-room-123';
const { iframe } = embedPatientRoom(container, roomSlug, {
width: '100%',
height: '800px'
});Using CSS Selector
You can also use a CSS selector string instead of an element:
import { embedDoxyMe } from 'doxy.me';
embedDoxyMe('#doxy-container', {
url: 'https://doxy.me/sign-in',
width: '100%',
height: '600px'
});Advanced Options
import { embedDoxyMe } from 'doxy.me';
embedDoxyMe('#doxy-container', {
url: 'https://doxy.me/sign-in',
width: '100%',
height: '600px',
allow: 'camera; microphone; fullscreen',
className: 'doxy-iframe',
id: 'doxy-iframe-1',
style: {
borderRadius: '8px',
boxShadow: '0 2px 8px rgba(0,0,0,0.1)'
},
onLoad: () => {
console.log('Doxy.me iframe loaded');
},
onError: (error) => {
console.error('Error loading doxy.me:', error);
}
});API Reference
embedDoxyMe(container, options)
Embeds a doxy.me iframe into the specified container.
Parameters:
container(HTMLElement | string): The DOM element or CSS selector where the iframe should be embeddedoptions(DoxyMeOptions): Configuration optionsurl(string, required): The doxy.me URL to embedwidth(string | number, optional): Iframe width (default: '100%')height(string | number, optional): Iframe height (default: '600px')allow(string, optional): Iframe allow attribute (default: 'camera; microphone; fullscreen')sandbox(string, optional): Iframe sandbox attributeclassName(string, optional): CSS class name for the iframeid(string, optional): ID attribute for the iframestyle(object, optional): Custom CSS stylesonLoad(function, optional): Callback when iframe loadsonError(function, optional): Callback when iframe errors
Returns:
- Object with
iframe(HTMLIFrameElement) anddestroy()method
embedProviderSignIn(container, options?)
Embeds the provider sign-in page.
Parameters:
container(HTMLElement | string): The DOM element or CSS selectoroptions(optional): Same asembedDoxyMeoptions (excludingurl)
Returns:
- Object with
iframeanddestroy()method
embedPatientRoom(container, roomSlug, options?)
Embeds a patient room.
Parameters:
container(HTMLElement | string): The DOM element or CSS selectorroomSlug(string, required): The room slug for the patient roomoptions(optional): Same asembedDoxyMeoptions (excludingurl)
Returns:
- Object with
iframeanddestroy()method
Examples
React Example
import React, { useEffect, useRef } from 'react';
import { embedDoxyMe } from 'doxy.me';
function DoxyMeEmbed({ url }) {
const containerRef = useRef(null);
useEffect(() => {
if (containerRef.current) {
const { destroy } = embedDoxyMe(containerRef.current, {
url,
width: '100%',
height: '600px'
});
return () => {
destroy();
};
}
}, [url]);
return <div ref={containerRef} />;
}Vanilla JavaScript Example
<!DOCTYPE html>
<html>
<head>
<title>Doxy.me Embed</title>
</head>
<body>
<div id="doxy-container"></div>
<script type="module">
import { embedPatientRoom } from 'doxy.me';
embedPatientRoom('#doxy-container', 'patient-room-123', {
width: '100%',
height: '800px'
});
</script>
</body>
</html>License
MIT
