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

@linkeo.com/ng-stripe

v0.0.2

Published

Angular-stripe ============

Downloads

1

Readme

Angular-stripe

Installation

npm install --save @linkeo.com/ng-stripe

Use inside project

You need to import StripeModule inside one of your module.

@NgModule({
  ...
  imports:[CommonModule, StripeModule],
  ...
})
export class MyModule{}

Available components

<ngs-card>

this component will instanciate a stripe card element including card number, cvc, expiry and postal/zip code.

<ngs-card
   #card="ngsCard"
   [classes]="{ base: 'base-class', complete: 'complete', 'empty': 'empty', focus: 'focus', invalid: 'invalid', webkitAutofill: 'webkitAutoFill'};"
   [hidePostalCode]="false" 
   [iconStyle]="'default'"
   [hideIcon]="false"
   [style]="{}"
   [value]="{'k':'v'}"
   (blur)="onBlur()"
   (focus)="onFocus()"
   (error)="onError($event)"
   (ready)="onReady()"  
   (change)="onChange($event)" 
   (complete)="onComplete()"></ngs-card>

Like Stripe.js

The bindings and the events emitters are the same as the one you can use with the stripe API, so []please refer to it for more informations](https://stripe.com/docs/stripe-js/reference#elements-create).

Not like Stripe.js

  • the complete EventEmitter emits a boolean when the element has been fully completed.
  • the error EventEmitter emits an error when it occurs (validation errors).
  • You can make a reference to the Component using #myRef="ngsCard"

<ngs-card-number>, <ngs-card-expiry>,<ngs-card-cvc>

If you don't want to display your card input as a single element, you will need to use these different elements.

  <ngs-card-number (blur)="onblur()" (change)="onchange($event)"
                   (focus)="onfocus()" (complete)="oncomplete($event)" (error)="onerror($event)"
                   (ready)="onready()"></ngs-card-number>
  <ngs-card-expiry (blur)="onblur()" (change)="onchange($event)"
                   (focus)="onfocus()" (complete)="oncomplete($event)" (error)="onerror($event)"
                   (ready)="onready()"></ngs-card-expiry>
  <ngs-card-cvc (blur)="onblur()" (change)="onchange($event)"
                (focus)="onfocus()" (complete)="oncomplete($event)" (error)="onerror($event)"
                (ready)="onready()"></ngs-card-cvc> 

Like Stripe.js

These elements also supports the same element creation options as stripe js, so once again, []please refer to it](https://stripe.com/docs/stripe-js/reference#elements-create)

Not like stripe.js

  • Like card element , there is a complete and an error event emitter.
  • Like card element, you can make a reference inside your template using myRef="ngsCardNumber",myRef="ngsCardExpiry",myRef="ngsCardCvc".

<ngs-iban>

Guess what ? This instanciate an iban element !

Well seriously, that's the same as the others and I'm tired of writing some documentation.

<ngs-payment-request-button>

<ngs-payment-request-button *ngIf="req.canMakePayment()" [paymentRequest]="req"></ngs-payment-request-button>

AFAIK does not work, it needs to use https even for testing and I have no time to configure this for now.

Available directives

ngsSource

You can create a source from ngs-card,ngs-iban components or a ngsWrapper directive. When the element is completed, it creates a source :

<ngs-card (ngsSource)="source=$event"></ngs-card>
<pre>{{source|json}}</pre>

ngsToken

You can create a token from ngs-card,ngs-iban components or a ngsWrapper directive. When the element is completed, it creates a token :

<ngs-card (ngsToken)="token=$event"></ngs-card>
<pre>{{token|json}}</pre>

ngsWrapper

This directive allows to group the <ngs-card-number>, <ngs-card-expiry> and <ngs-card-cvc> and emits events when all elements have completed or one emits error:

<p ngsWrapper (ngsComplete)="log('all completed')" (ngsError)="log('error all')">
  <ngs-card-number ></ngs-card-number>
  <ngs-card-expiry ></ngs-card-expiry>
  <ngs-card-cvc ></ngs-card-cvc>
</p>