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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@eka-care/sa-sdk

v1.0.0

Published

To integrate the SDK into your application, follow these steps:

Readme

Integration Guide

To integrate the SDK into your application, follow these steps:

Step 1: Add the JavaScript File

Include the following JavaScript file in the header of your HTML:

<script src="https://api.eka.care/sa-fe/main.js"></script>

Note: The required CSS is automatically injected, so there is no need to include a separate stylesheet. This happens internally (see main.tsx line 132).

Optional CSS Usage
Though the CSS is injected automatically, you can include it manually if needed:

<link rel="stylesheet" href="https://api.eka.care/sa-fe/styles.css" />

Step 2: Initialize the SDK

The SDK will add a function to the window object called runSaApp.

You can call this function to run SA app as shown below:

window.runSaApp({
  workflow_id: 1234, // Replace with your actual workflow ID
  container_id: 'sa-container',
  auth_token: developerAuthInitData.data.access_token,
  refresh_token: developerAuthInitData.data.refresh_token,
  params: {
    gender: 'M', // "M" for Male, "F" for Female, "O" for Other
    age: 30, // Replace with the user's age
  },
  onEndCallback: ({ success, data, error }) => {
    // Handle the callback here
  },
  // Optional parameters:
  practice_info: {
    practitioner_uuid: 'your-practitioner-uuid',
    patient_uuid: 'your-patient-uuid',
    unique_identifier: 'optional-unique-identifier',
  },
  onSaRedirectCallback: ({ success, data, error }) => {
    // Handle the redirect callback here
  },
  onSaSubmitCallback: ({ data, error }) => {
    // Handle the redirect callback here
  },
});

You can call this function to show SA submissions as shown below:

window.showSaSubmission({
  container_id: 'sa-container',
  auth_token: developerAuthInitData.data.access_token,
  refresh_token: developerAuthInitData.data.refresh_token,
  assessment_ids: ['sa_25010214342273227', 'sa_24122717143498525'], // Replace with your actual assessment ID
});

Additional Global Functions

You can manually close the SA app or the SA submission flow if needed:

window.closeSaApp();
window.closeSaSubmissionApp();

onSaSubmitCallback

The onSaSubmitCallback is called immediately after a successful SA submission. This callback receives an object containing the following information:

(params: {
  data?: {
    assessment_id: string; // The unique ID of the submitted assessment
    workflow_id: number;   // The workflow ID associated with the submission
  };
  error?: string;          // An error message if the submission failed
}) => void;

Using onCopyToRxPad

You can optionally pass a callback function for copying data to an Rx Pad:

window.showSaSubmission({
  container_id: 'sa-container',
  auth_token: developerAuthInitData.data.access_token,
  refresh_token: developerAuthInitData.data.refresh_token,
  assessment_ids: ['sa_25010214342273227', 'sa_24122717143498525'], // Replace with your actual assessment ID
  onCopyToRxPad: ({ fhirData, title }) => {
    // Handle FHIR data as needed
  },
});

Example

Here is a complete example of how to integrate the SDK:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>SDK Integration</title>
    <script src="https://api.eka.care/sa-fe/main.js"></script>
  </head>
  <body>
    <div id="sa-container"></div>
    <script>
      window.runSaApp({
        workflow_id: 1234, // Replace with your actual workflow ID
        container_id: 'sa-container',
        auth_token: developerAuthInitData.data.access_token,
        refresh_token: developerAuthInitData.data.refresh_token,
        params: {
          gender: 'M', // "M" for Male, "F" for Female, "O" for Other
          age: 30, // Replace with the user's age
        },
        onEndCallback: ({ success, data, error }) => {
          // Handle the callback here
        },
        // Optional parameters:
        practice_info: {
          practitioner_uuid: 'your-practitioner-uuid',
          patient_uuid: 'your-patient-uuid',
          unique_identifier: 'optional-unique-identifier',
        },
        onSaRedirectCallback: ({ success, data, error }) => {
          // Handle the redirect callback here
        },
        onSaSubmitCallback: ({ data, error }) => {
          // Handle the redirect callback here
        },
      });

      window.showSaSubmission({
        container_id: 'sa-container',
        auth_token: developerAuthInitData.data.access_token,
        refresh_token: developerAuthInitData.data.refresh_token,
        assessment_ids: ['sa_25010214342273227', 'sa_24122717143498525'], // Replace with your actual assessment ID
        onCopyToRxPad: ({ fhirData, title }) => {
          // Handle FHIR data as needed
        },
      });

      window.closeSaApp();
      window.closeSaSubmissionApp();
    </script>
  </body>
</html>