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 🙏

© 2024 – Pkg Stats / Ryan Hefner

owic-app-service

v1.2.26

Published

Enables a web experience to communicate and interact with OWiC Connect

Downloads

7

Readme

OWiC App Service

Introduction

OWiCAppService is a JavaScript package designed to enable web app developers to integrate their applications seamlessly with OWiC Connect. OWiC Connect is a platform used for scanning OWiC tags and providing enhanced interactive experiences. By using OWiCAppService, developers can turn their web apps into Experiences for OWiC Connect, facilitating a two-way communication system between the Experience (running in an iframe or webview) and the OWiC Connect application.

Installation

To install the OWiCAppService package, run the following command in your project directory:

npm install owic-app-service

Usage

To use OWiCAppService in your project:

  1. Import OWiCConnect:
    import OWiCConnect from 'owic-app-service';
  2. Initialize OWiCConnect in your application's main component. For example, in Vue.js:
    // In App.vue's mounted function
    mounted() {
      OWiCConnect.initialize();
    }

API Documentation

OWiCAppService provides the following methods for interacting with OWiC Connect:

initialize()

Initializes the two-way communication system between the Experience and OWiC Connect.

  • Usage: OWiCConnect.initialize()

getTagInfo()

Retrieves detailed information about the scanned OWiC tag.

  • Returns: A Promise resolving to an object containing tag details. Example response:
    {
      "id": "tag-unique-id",
      "created_time": "creation-timestamp",
      "last_edited_time": "last-edit-timestamp",
      "created_by": { "id": "creator-user-id" },
      "last_edited_by": { "id": "editor-user-id" },
      "permissions": {
        "public": { "read": true, "write": true },
        "anon": { "read": true, "write": false }
      },
      "app": {
        "appId": "associated-app-id",
        "appData": { /* Custom app data */ }
      },
      "platform": "web | mobile",
      "tag_id": "tag-identifier"
    }

getPlatform()

Determines the platform on which the Experience is running.

  • Returns: A string indicating the platform ('web' or 'mobile').

getData(key)

Fetches data associated with a specified key.

  • Parameters:
    • key (String): The key of the data to retrieve.
  • Returns: A Promise resolving to the requested data. Example response for key = "videoGift":
    {
      "video": {
        "filename": "video-file-name",
        "url": "video-url",
        "type": "video-type"
      },
      "montage": [
        {
          "type": "image-type",
          "displayMode": "display-mode",
          "url": "image-url",
          "filename": "image-file-name"
        }
      ]
    }

getUser()

Retrieves information about the current user.

  • Returns: A Promise resolving to an object with user details. Example response:
    {
      "id": "response-id",
      "data": {
        "user-id": {
          "uid": "user-id",
          "email": "user-email",
          "displayName": "user-display-name",
          "photoURL": "user-photo-url"
        }
      },
      "errors": []
    }

uploadMedia(fileObj, update)

Uploads media and provides progress updates.

  • Parameters:
    • fileObj (Array): An array of file objects.
    • update (Function): A function called with upload progress.
  • Returns: A Promise resolving to an array of uploaded file details. Example response:
    [
      {
        "type": "file-type",
        "filename": "file-name",
        "url": "file-url"
      }
    ]

setData(key, data)

Stores data under a specified key.

  • Parameters:
    • key (String): The key under which to store the data.
    • data (Any): The data to store.
  • Returns: A Promise resolving to an acknowledgment object. Example response for key = "memories":
    {
      "id": "response-id",
      "data": {
        "memories": [
          {
            "url": "image-url",
            "type": "image-type",
            "filename": "image-file-name"
          }
        ]
      },
      "errors": []
    }

Examples

Here are some examples of how to use OWiCAppService:

Initializing Communication

// In a React component
componentDidMount() {
  OWiCConnect.initialize();
}

Fetching Tag Data

async function getTagData() {
  let tagData = await OWiCConnect.getTagInfo();
  console.log(tagData);
}

Contribution

Contributions to OWiCAppService are welcome! Please read our contribution guidelines for more information.

License

OWiCAppService is licensed under AGPLv3 License.