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

@telecomsoft/dss-create-meta-react

v0.0.4

Published

A Vite React Typescript package for creating meta with DSS system

Downloads

1

Readme

CreateMeta React Component

This package provides a CreateMeta React component for integrating with a meta-creation system. It allows handling files (such as PDFs) and signatories, using base64-encoded file data. The component also integrates react-pdf for rendering PDFs in the browser.

Installation

To use this package, install it along with its peer dependencies:

npm install @telecomsoft/dss-create-meta-react react-pdf

If you don't use vite js project run this command

cp ./node_modules/pdfjs-dist/legacy/build/pdf.worker.min.mjs ./public/

Usage

Here’s a basic example of how to use the CreateMeta component in your React app:

import { CreateMeta } from '@telecomsoft/dss-create-meta-react';
import data from './data.json';

//If you don't use vite js project use this line
//pdfjs.GlobalWorkerOptions.workerSrc = `/pdf.worker.min.mjs`;

function App() {
  const fileBase64Value = data.fileBase64; // Base64 encoded file content

  const signatories = [
    {
      priority: 1,
      fio: "test1",
      identifier: "32432432554354",
    },
    {
      priority: 2,
      fio: "test2",
      identifier: "43254354354354",
    },
    {
      priority: 3,
      fio: "test3",
      identifier: "53456564234324",
    },
  ];

  return (
    <CreateMeta
      locale="ru"
      base_url={""} // Your base URL
      auth_url={""} // Your auth URL
      create_url={""} // Your create meta URL
      client_id={""} // Your client ID
      client_secret={""} // Your client secret
      external_document_id={""} // Your external document ID
      signatories={signatories} // List of signatories
      file_base64={fileBase64Value} // Base64 encoded file
      handleSuccessfullySaved={() => {
        if (window) window.location.reload(); // Reload on success
      }}
    />
  );
}

export default App;

Component Props

| Prop | Type | Required | Description | |--------------------------|------------|----------|----------------------------------------------------------------------------------------------| | locale | string | Yes | Locale setting (e.g., "ru", "en") | | base_url | string | Yes | Base URL for API calls | | auth_url | string | Yes | URL for authentication | | create_url | string | Yes | URL for creating meta data | | client_id | string | Yes | Client ID for authentication | | client_secret | string | Yes | Client secret for authentication | | external_document_id | string | Yes | External document identifier | | signatories | array | Yes | Array of signatories, each with priority, fio, and identifier properties | | file_base64 | string | Yes | Base64 encoded file content (typically a PDF) | | handleSuccessfullySaved| function | Yes | Callback function to handle post-save actions, called after the file is successfully saved. |

Signatories Object Example

The signatories prop expects an array of objects with the following structure:

[
  {
    "priority": 1,
    "fio": "John Doe",
    "identifier": "1234567890"
  },
  {
    "priority": 2,
    "fio": "Jane Doe",
    "identifier": "0987654321"
  }
]

PDF File (Base64)

The file_base64 prop should be a Base64-encoded string representing the file content, typically a PDF.

Example:

{
  "fileBase64": "JVBERi0xLjQKJdP0zOEKMSAwIG9iago8PAov..."
}

Packages Used

  • react-pdf: Used for rendering PDF documents in the browser.
  • typescript: For static typing and improved developer experience.
  • vite: A fast build tool optimized for modern web development with instant HMR.
  • react: A popular JavaScript library for building user interfaces.

Development

To develop locally, clone the repository and install the dependencies:

npm install

Start the development server:

npm run dev

Build the project for production:

npm run build

License

This project is licensed under the MIT License.