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

blassa-address-verification-button-angular

v0.0.2

Published

This Angular library provides a component for verifying addresses using the Blassa Address Verify service.

Downloads

2

Readme

Blassa Address Verification Angular Library

This Angular library provides a component for verifying addresses using the Blassa Address Verify service.

Installation

To use this library in your Angular application, you need to follow these steps:

  1. Install the library using npm:

    npm install blassa-address-verification-button-angular

Authentication

Before you can use the button you need to generate your id token based on your account’s username and password:

import { CognitoIdentityProviderClient, InitiateAuthCommand } from '@aws-sdk/client-cognito-identity-provider';

GenerateApiToken() {
    const client = new CognitoIdentityProviderClient({ region: <INSERT_REGION> });
    const command = new InitiateAuthCommand({
      AuthFlow: "USER_PASSWORD_AUTH",
      ClientId: <INSERT_BLASSA_CLIENT_ID_FOR_STAGE>,
      AuthParameters: {
        USERNAME: <INSERT_USERNAME>,
        PASSWORD: <INSERT_PWD>
      }
    });

    try {
      console.log('Generating Auth token');
      const response = await client.send(command);
      return response.AuthenticationResult.IdToken;
    } catch (err) {
      console.error('Failed to generate token', { err });
      throw new Error('Failed to generate token');
    }
  }

Usage

Now, you can use the lib-blassa-address-verification-button-angular component in your Angular templates.

Basic Example

// Import necessary dependencies in your component
import { Component } from '@angular/core';
import {
  BlassaAddressVerificationComponent,
  IBlassaAddressVerificationRequest,
} from 'blassa-address-verification-button-angular';
import { AxiosResponse } from 'axios';


@Component({
  selector: 'app-your-component',
  imports: [...,BlassaAddressVerificationComponent],
  template: `
    <lib-blassa-address-verification-button-angular
    [apiToken]="yourApiToken"
    [createAddressRequestJobBody]="createAddressRequestJobBody"
    (createAddressRequestJobResponse)="onCreateAddressRequestJobResponse($event)"
    ></lib-blassa-address-verification-button-angular>
  `,
})
export class YourComponent {

  yourApiToken = 'insert_your_api_token_here';
  createAddressRequestJobBody: IBlassaAddressVerificationRequest = {
    // ... provide order details here
      type: 'PRE_CHECKOUT',
      customerDetails: {
        firstName: 'John',
        lastName: 'Doe',
        phoneNumber: '+212682519623', // must provide country code
        email: '[email protected]',  // optional
      },
      orderDetails: {
        orderSource: 'Your Company Name',
        description: 'Product details', // optional
      },
      deliveryDetails: {
        countryCode: 'MA',
        addressFields: { // optional
        city: 'Marrakesh', // optional
        street: 'Avenue Mohamed V', // optional
        buildingNumber: '775', // optional
        postalCode: '2500', // optional
      },
    };
  }

  onCreateAddressRequestJobResponse(response: AxiosResponse): void {
    console.log('Address info response:', response);
    // Handle the response as needed
  }
}

Component Inputs

  • apiToken (string): Your Blassa Address Verify API key.
  • createAddressRequestJobBody (object): An object that provides customerDetails,orderDetails,delieveryDetails for address verifying.
  • addressInfoResponse (event): An event emitted with the address information response.

Development

To contribute to the development of this library, follow these steps:

  1. Clone the repository:

    git clone https://github.com/your-username/blassa-address-verification-button-angular.git
  2. Install dependencies:

    cd blassa-address-verification-button-angular
    npm install
  3. Make changes and test:

    ng serve
  4. Build the library:

    ng build blassa-address-verification-button-angular

    The built library will be available in the dist/ directory.

License

This library is licensed under the MIT License - see the LICENSE file for details.