0.68.1 • Published 26 days ago

@daffodil/newsletter v0.68.1

Weekly downloads
141
License
MIT
Repository
github
Last release
26 days ago

@daffodil/newsletter

The @daffodil/newsletter library allows you to quickly scaffold a "newsletter" subscription UI feature in an Angular application. It supports drivers for a variety of ecommerce platforms in order to make connecting your UI to your platform's newsletter feature easy.

Getting Started

This overview assumes that you have already set up an Angular project and have gone through the Newsletter installation guide. If you have not, we recommend you do that first.

Setting up your AppModule

To get started, import the StoreModule and the DaffNewsletterModule at the top of your app.module file.

import { DaffNewsletterModule } from '@daffodil/newsletter';
import { StoreModule } from '@ngrx/store';

Then import the DaffNewsletterModule in your app.module. Afterwards, also import StoreModule.forRoot({}), as this will be relevant later on when utilizing the redux and state management features of the newsletter module.

@ngModule({
  imports:[
    StoreModule.forRoot({}),
    DaffNewsletterModule
  ]
})

Utilizing inside your component

The DaffNewsletterModule provides a DaffNewsletterFacade that wraps the complexities of the library into one place. This facade will handle sending your newsletter subscription to your application's backend and and can also be utilized to build your UI with behaviors common to a newsletter.

To inject the facade inside your component, include an instance of DaffNewsletterFacade in your component's constructor.

export class NewsletterComponent {
  constructor(public newsletterFacade: DaffNewsletterFacade) {}
}

Sending a Newsletter Subscription to your platform's backend

The DaffNewsletterFacade supports sending a DaffNewsletterSubmission when sending a subscription to your platform's backend.

export interface DaffNewsletterSubmission {
  email: string;
}

The DaffNewsletterSubmission is the default object and only contains a value of email. To learn how to customize your submission, read the customizing submission data guide.

Using the facade

Once the DaffNewsletterFacade has been set up in your component, it can now be used to send off your newsletter data. To do so, the facade will dispatch an action of type DaffNewsletterSubscribe<T>() with T being the type of submission your object you are using. In addition, it will also update three observable streams of success$, error$, and loading$. These can be used to enhance your application's UI.

import { DaffNewsletterSubscribe, DaffNewsletterSubmission, DaffNewsletterFacade } from '@daffodil/newsletter';

export class NewsletterComponent implements OnInit{
  ngOnInit(){
    success$: Observable<boolean> = this.newsletterFacade.success$;
    error$: Observable<string> = this.newsletterFacade.error$;
    loading$: Observable<boolean> = this.newsletterFacade.loading$;
  }


  email:string = "JohnDoe@email.com"

  constructor(public newsletterFacade: DaffNewsletterFacade) {
  }
  submitData() {
      this.newsletterFacade.dispatch(new DaffNewsletterSubscribe<DaffNewsletterSubmission>(this.email));
  }

}

In this example, three observable streams are assigned from newsletterFacade. Then when submitData is called, the newsletterFacade will call its dispatch function which will send your data off to the backend and update the three observable streams.

Live Demo

Checkout a live example of the DaffNewsletter library in action!

0.68.1

26 days ago

0.68.0

2 months ago

0.67.0

3 months ago

0.66.1

4 months ago

0.66.0

4 months ago

0.62.1

9 months ago

0.62.0

9 months ago

0.62.3

9 months ago

0.62.2

9 months ago

0.63.0

7 months ago

0.63.2

7 months ago

0.63.1

7 months ago

0.64.2

5 months ago

0.64.1

6 months ago

0.64.0

6 months ago

0.61.0

9 months ago

0.62.4

8 months ago

0.59.2

11 months ago

0.59.0

11 months ago

0.59.1

11 months ago

0.58.10

12 months ago

0.60.0

11 months ago

0.58.9

12 months ago

0.58.7

12 months ago

0.58.8

12 months ago

0.58.5

12 months ago

0.58.6

12 months ago

0.56.1

1 year ago

0.56.0

1 year ago

0.57.0

1 year ago

0.58.3

1 year ago

0.58.4

1 year ago

0.58.1

1 year ago

0.58.2

1 year ago

0.58.0

1 year ago

0.54.0

1 year ago

0.53.0

1 year ago

0.53.1

1 year ago

0.51.0

1 year ago

0.51.1

1 year ago

0.49.0

1 year ago

0.50.0

1 year ago

0.48.2

1 year ago

0.48.0

1 year ago

0.48.1

1 year ago

0.47.3

1 year ago

0.47.1

1 year ago

0.47.2

1 year ago

0.44.0

2 years ago

0.44.1

2 years ago

0.45.1

2 years ago

0.45.0

2 years ago

0.46.0

2 years ago

0.43.0

2 years ago

0.43.1

2 years ago

0.42.4

2 years ago

0.42.2

2 years ago

0.42.3

2 years ago

0.41.0

2 years ago

0.42.0

2 years ago

0.42.1

2 years ago

0.40.1

2 years ago

0.39.13

2 years ago

0.39.10

2 years ago

0.39.11

2 years ago

0.39.12

2 years ago

0.39.9

2 years ago

0.39.8

2 years ago

0.39.7

2 years ago

0.39.1

3 years ago

0.39.6

3 years ago

0.39.5

3 years ago

0.39.4

3 years ago

0.39.3

3 years ago

0.39.2

3 years ago

0.39.0

3 years ago

0.38.9

3 years ago

0.38.7

3 years ago

0.38.6

3 years ago

0.38.5

3 years ago

0.38.4

3 years ago

0.38.3

3 years ago

0.38.2

3 years ago

0.38.1

3 years ago

0.38.0

3 years ago

0.37.0

3 years ago

0.36.1

3 years ago

0.36.0

3 years ago

0.35.0

3 years ago

0.32.0

3 years ago

0.33.0

3 years ago

0.34.0

3 years ago

0.31.1

3 years ago

0.31.0

3 years ago

0.30.0

3 years ago

0.29.0

3 years ago

0.27.0

3 years ago

0.28.1

3 years ago

0.28.0

3 years ago

0.25.2

3 years ago

0.26.0

3 years ago

0.25.1

3 years ago

0.25.0

3 years ago

0.24.0

3 years ago

0.23.1

3 years ago

0.23.0

3 years ago

0.22.1

3 years ago

0.22.0

3 years ago

0.21.3

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago

0.21.0

3 years ago

0.20.3

3 years ago

0.20.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.2

3 years ago

0.19.0

3 years ago

0.19.1

3 years ago

0.18.0

3 years ago

0.17.2

3 years ago

0.17.0

3 years ago

0.17.1

3 years ago

0.16.1

3 years ago

0.16.0

3 years ago

0.15.0

3 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.12.1

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.9.4

4 years ago

0.10.0

4 years ago

0.9.2

4 years ago

0.9.3

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.22

4 years ago

0.4.20

4 years ago

0.4.21

4 years ago

0.4.19

4 years ago

0.4.18

4 years ago

0.4.17

4 years ago

0.4.16

4 years ago

0.4.15

4 years ago

0.4.14

4 years ago

0.4.13

4 years ago

0.4.11

4 years ago

0.4.12

4 years ago

0.4.10

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago