ngx-brevo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # NgxBrevo
2
+
3
+ An Angular library for seamless integration with the Brevo (formerly Sendinblue) email platform. It provides components, services, and utilities for managing email templates, handling authentication, and interacting with Brevo APIs within your Angular applications.
4
+
5
+ ## Features
6
+
7
+ - **Easy Integration**: Quickly connect your Angular app with Brevo.
8
+ - **Template Management**: Ready-to-use components for listing and managing email templates.
9
+ - **Authentication**: Built-in authentication providers for securing your requests.
10
+ - **State Management**: Uses robust state management for a smooth user experience.
11
+ - **Highly Customizable**: Designed to be flexible and adaptable to your specific needs.
12
+
13
+ ## Installation
14
+
15
+ To install `ngx-brevo` in your Angular project, run:
16
+
17
+ ```bash
18
+ npm install ngx-brevo
19
+ ```
20
+
21
+ ## Setup & Configuration
22
+
23
+ 1. **Import the Module**
24
+
25
+ Import the `NgxBrevoModule` in your root `AppModule` (or standalone component) and provide your Brevo configuration.
26
+
27
+ ```typescript
28
+ import { NgModule } from '@angular/core';
29
+ import { BrowserModule } from '@angular/platform-browser';
30
+ import { NgxBrevoModule } from 'ngx-brevo';
31
+
32
+ import { AppComponent } from './app.component';
33
+
34
+ @NgModule({
35
+ declarations: [
36
+ AppComponent
37
+ ],
38
+ imports: [
39
+ BrowserModule,
40
+ // Initialize with your configuration
41
+ NgxBrevoModule.forRoot({
42
+ apiKey: 'YOUR_BREVO_API_KEY' // Ensure to keep this secure!
43
+ })
44
+ ],
45
+ providers: [],
46
+ bootstrap: [AppComponent]
47
+ })
48
+ export class AppModule { }
49
+ ```
50
+
51
+ *Note: For security reasons, it's highly recommended to proxy your API requests through a secure backend server rather than exposing your API key directly in the client application. The above example is for demonstration.*
52
+
53
+ ## Example Usage
54
+
55
+ ### Displaying the Template List
56
+
57
+ You can use the built-in `ngx-brevo-template-list` component to easily display your Brevo email templates.
58
+
59
+ ```html
60
+ <!-- your.component.html -->
61
+ <ngx-brevo-template-list></ngx-brevo-template-list>
62
+ ```
63
+
64
+ ### Using the Brevo Service
65
+
66
+ You can inject the service to fetch templates or perform other operations programmatically.
67
+
68
+ ```typescript
69
+ import { Component, OnInit } from '@angular/core';
70
+ import { BrevoService } from 'ngx-brevo';
71
+
72
+ @Component({
73
+ selector: 'app-my-email-manager',
74
+ template: `
75
+ <div *ngIf="templates">
76
+ <h2>My Templates</h2>
77
+ <ul>
78
+ <li *ngFor="let template of templates">{{ template.name }}</li>
79
+ </ul>
80
+ </div>
81
+ `
82
+ })
83
+ export class MyEmailManagerComponent implements OnInit {
84
+ templates: any[] = [];
85
+
86
+ constructor(private brevoService: BrevoService) {}
87
+
88
+ ngOnInit(): void {
89
+ this.brevoService.getTemplates().subscribe(
90
+ data => {
91
+ this.templates = data;
92
+ },
93
+ error => {
94
+ console.error('Error fetching templates', error);
95
+ }
96
+ );
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## License
102
+
103
+ MIT