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

@idocs-kz/widgets

v1.1.1

Published

- **[English](#English)** - **[Русский](#Русский)**

Downloads

23

Readme

IDocs Widgets

Language (Язык)

English

Library connector for iDocs widgets. Works as intermediary between website and various widgets of iDocs (right now only one way document signing)

Installation

Use the package manager npm to install iDocs-widget.

npm install --save @idocs-kz/widgets@latest

After installation add bundle.js (path to bundle "node_modules/@idocs-kz/widgets/dist/bundle.js") from package to your scripts.

Methods

signWidget

signWidget(ISignWidgetConfig) - creates sign widget instance with config, and returns it.

ISignWidgetConfig

| Parameter | Description | |:---------------:|:--------------------------------------:| | apiKey | token received from iDocs | | filename | name of the resulting archive | | widgetServerUrl | url of the widget | | onComplete | callback on success, returns File | | closeOnComplete | to close widget on complete or not | | onLicenceError | callback on Licence Error. | | onCancel | callback on canceling / closing widget |

open

open(files: File[]) - opens widget with files. Input value is Array of type File

Usage

Angular

Component ts file

import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent {

    onChange(event: any) {
        const files: File[] = event.target.files;
        
        // getting widgets from window
        const widgets = (window as any).widgets;
        
        // creation of sign widget instance with config
        const widget = new widgets.signWidget({
            apiKey: 'Your Token', // token received from iDocs
            filename: 'result', // name of the resulting archive
            widgetServerUrl: 'https://widget.idocs.kz', // url of the widget
            onComplete: (zipFile: File) => { // callback on completion of signing document
                console.log('completed')
            },

            closeOnComplete: true, // to close widget on complete or not
            onLicenceError: (error: any) => { // callback on Licence Error 
                console.log(error);
            },

            onCancel: () => // callback on canceling / closing widget
                console.log('canceled')
        });
        
        // opening of sign widget iframe
        // File must have type
        // method open(files) takes Array<File[]>
        widget.open(files);
    }

}

Javascript

HTML file


<body>
    <input type="file" multiple id="files" />

    <script src="node_modules/@idocs-kz/widgets/dist/bundle.js"></script>

    <script>
      const files = document.getElementById("files");
      
      files.onchange = function (evt) {
        openSignWidget(evt);
      };

      function openSignWidget(event) {
        const files = event.target.files;
        
        // creation of sign widget instance with config
        const signWidget = new window.widgets.signWidget({
          apiKey: "Your Token", // token received from iDocs
          filename: 'result', // name of the resulting archive 
          closeOnComplete: true, // to close widget on complete or not 
          widgetServerUrl: "https://widget.idocs.kz", // url of the widget 

          onComplete: (zipFile) => { // callback on completion of signing document 
            console.log('completed');
          },
            
          onLicenceError: (error) => console.error(error), // callback on Licence Error 
            
          onCancel: () => console.info("canceled"), // callback on canceling / closing widget 
        });
        
        // opening of sign widget iframe 
        signWidget.open(Array.from(files));
      }
    </script>
  </body>

Component html file

<input type="file" multiple (change)="onChange($event)">

Русский

Соединитель библиотеки для виджетов iDocs. Работает в качестве посредника между веб-сайтом и различными виджетами IDocs (прямо сейчас только односторонняя подпись документов)

Установка

Используйте диспетчер пакетов npm для установки iDocs-widget.

npm install --save @idocs-kz/widgets@latest

После установки добавьте bundle.js (путь к пакету "node_modules/@idocs-kz/widgets/dist/bundle.js") из пакета в ваши скрипты.

Методы

signWidget

signWidget(ISignWidgetConfig) - создает экземпляр виджета подписания с конфигурацией, и возвращает его.

ISignWidgetConfig

| Parameter | Description | |:---------------:|:----------------------------------------------------------------------------:| | apiKey | токен, полученный от IDocs | | filename | имя результирующего архива | | widgetServerUrl | url-адрес виджета | | onComplete | функция обратного вызова по завершении подписания документа, возвращает File | | closeOnComplete | чтобы закрыть виджет по завершении или нет | | onLicenceError | функция обратного вызова при ошибке лицензии | | onCancel | функция обратного вызова при отмене / закрытии виджета |

open

open(files: File[]) - открытие виджета подписания c файлами. Входной параметр должен быть Массив типа File

Использование

Angular

Typescript файл компонента

import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent {

    onChange(event: any) {
        const files: File[] = event.target.files;
        
        // получение виджетов из window
        const widgets = (window as any).widgets;
        
        // создание экземпляра виджета подписания с конфигурацией 
        const widget = new widgets.signWidget({
            apiKey: 'Your Token', // токен, полученный от IDocs 
            filename: 'result', // имя результирующего архива 
            widgetServerUrl: 'https://widget.idocs.kz', // url-адрес виджета 
            closeOnComplete: true, // чтобы закрыть виджет по завершении или нет 
            
            onComplete: (zipFile: File) => { // функция обратного вызова по завершении подписания документа 
                console.log('completed')
            },

            onLicenceError: (error: any) => { // функция обратного вызова при ошибке лицензии 
                console.log(error);
            },

            onCancel: () => // функция обратного вызова при отмене / закрытии виджета 
                console.log('canceled')
        });
        
        // открытие iframe виджета подписания 
        widget.open(files);
    }

}

HTML файл компонента


<input type="file" multiple (change)="onChange($event)">

Javascript

HTML файл


<body>
    <input type="file" multiple id="files" />

    <script src="node_modules/@idocs-kz/widgets/dist/bundle.js"></script>

    <script>
      const files = document.getElementById("files");
      
      files.onchange = function (evt) {
        openSignWidget(evt);
      };

      function openSignWidget(event) {
        const files = event.target.files;
        
        // создание экземпляра виджета подписания с конфигурацией 
        const signWidget = new window.widgets.signWidget({
            apiKey: 'Your Token', // токен, полученный от IDocs 
            filename: 'result', // имя результирующего архива 
            widgetServerUrl: 'https://widget.idocs.kz', // url-адрес виджета 
            closeOnComplete: true, // чтобы закрыть виджет по завершении или нет 

            onComplete: (zipFile) => { // функция обратного вызова по завершении подписания документа 
                console.log('completed')
            },

            onLicenceError: (error) => { // функция обратного вызова при ошибке лицензии 
                console.log(error);
            },

            onCancel: () => // функция обратного вызова при отмене / закрытии виджета 
                    console.log('canceled')
        });
        
        // открытие iframe виджета подписания
        signWidget.open(Array.from(files));
      }
    </script>
  </body>