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

@uzum-tech/account-form

v1.4.10

Published

Uzum account form

Downloads

643

Readme

Package version License

Table of Contents

Installing

Package manager

Using npm:

npm i @uzum-tech/account-form

Using yarn:

yarn add @uzum-tech/account-form

CDN

Using jsDelivr

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@uzum-tech/account-form/lib/style.css">
<script src="https://cdn.jsdelivr.net/npm/@uzum-tech/account-form/lib/main.iife.js"></script>

Using unpkg

<link rel="stylesheet" href="https://unpkg.com/@uzum-tech/account-form/lib/style.css">
<script src="https://unpkg.com/@uzum-tech/account-form/lib/main.iife.js"></script>

Usage

Initialization

Default value source: 1

HTML

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <div data-account-form data-source="-1" style="width: 530px"></div>
  </body>
</html>

Script

import '@uzum-tech/account-form/lib/style.css';
import AccountForm from '@uzum-tech/account-form';

new AccountForm('[data-account-form]');

Add/Remove listeners

import AccountForm, { AccountFormEvent, AccountApplication } from '@uzum-tech/account-form';

const accountForm = new AccountForm();

const handleAccountFormSubmit = (payload: AccountApplication) => console.log(payload);

// Add listener
accountForm.addListener(
  AccountFormEvent.SUBMIT,
  handleAccountFormSubmit
);

// Remove listener
accountForm.removeListener(
  AccountFormEvent.SUBMIT,
  handleAccountFormSubmit
);

// Remove all listener
accountForm.removeAllListeners(
  AccountFormEvent.SUBMIT,
  handleAccountFormSubmit
);

Events from AccountFormEvent:

| Value | Payload | Description | |--|----------------------------------------|---------------------------------------------------------------------------------------------------------------------------| | SUBMIT | AccountApplication | Will fire after successful validation, before sending the request | | ERROR_RESPONSE | AccountApplication | Will fire after an unsuccessful response | | SUCCESS_RESPONSE | AccountApplication | Will fire after a successful response | | FINALLY_RESPONSE | AccountApplication | It will always work after the response | | VALIDATE | AccountApplicationFormValidationResult | It will work after the form is validated, before sending the request. Validation status is available in the event payload | | BLUR | AccountApplicationFieldBlurResult | Will fire after removing focus from any field inside the form | | TOGGLE_TIN_OR_PINFL | boolean | Will fire after toggle 'Не помню ИНН или ПИНФЛ' checkbox | | TOGGLE_ACCEPT_CHECKBOX | boolean | Will fire after toggle 'Я соглашаюсь на обработку персональных данных' checkbox |

Fields visibility

import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// Show/hide single field
accountForm.showFields('name');
accountForm.hideFields('name');

// Show/hide multiple fields
accountForm.showFields('name', 'phone');
accountForm.hideFields('name', 'phone');

Default values

import AccountForm, { AccountProduct } from '@uzum-tech/account-form';

const accountForm = new AccountForm();

accountForm.setDefaultFields({
  product: AccountProduct.ACCOUNT_IN_SOUMS
});

Custom request sending

  • If you return a non-empty string, it will be displayed as error text.
  • If nothing is returned, the response will be considered successful
import AccountForm, { AccountApplication } from '@uzum-tech/account-form';

const accountForm = new AccountForm();

accountForm.onRequest = (payload: AccountApplication) => {
  // Logic for sending the request
};

Toggle pinfl

  • updates the mask
  • updates localization
  • if necessary, trims the original field value
  • emits the event TOGGLE_ACCEPT_CHECKBOX
import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// To support both INN and PINFL
accountForm.withPinfl();

// To leave only the INN
accountForm.withoutPinfl();

API Version

  • by default version is 2.0
  • version will send in header X-Api-Version
import { ApiVersion } from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// Change version
accountForm.apiVersion = ApiVersion.v3; // Available keys - v1-v4

// Clear version in order to remove X-Api-Version header
accountForm.apiVersion = undefined;

Custom response callback

  • If you want to handle the response you can pass the function
import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

accountForm.onResponse = (response: ApiResponse<ELMAResponse>): void => {
  // Logic for handling the response
};

Update text for send button

  • If you want to update text of send button, you can use method setSendButtonLocale
  • The method accepts text as a text, that should be replaced
  • BE CAREFULL: After changing text, there will be no 'reactive' locale on button. That means that changing language will not force any changing in text.
import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

accountForm.setSendButtonLocale('Book a call');

Computed values

| Property | Type | Readonly | |-|-|-| | acceptChecked | boolean | Yes | | hideTINOrPINFLChecked | boolean | Yes | | lang | string | No | | productValue | AccountProduct | null | No | | buttonLoading | boolean | No |

Status alerts

import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// If you don't need to show alert then change the value to false
accountForm.autoShowAlert = false;

Manual submitting

import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// If you need submit with validations and all other handlers
accountForm.submit();

// If you need request only without handlers
accountForm.requestOnly();

Reset

import AccountForm from '@uzum-tech/account-form';

const accountForm = new AccountForm();

// If you need disable auto reset after submit
accountForm.autoReset = false;

// If you need reset manually
accountForm.resetForm();

License

MIT license