@metigan/angular 1.0.0
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/LICENSE +22 -0
- package/README.md +581 -0
- package/dist/LICENSE +22 -0
- package/dist/README.md +581 -0
- package/dist/esm2022/metigan-angular.mjs +5 -0
- package/dist/esm2022/public-api.mjs +21 -0
- package/dist/esm2022/src/lib/audiences.service.mjs +157 -0
- package/dist/esm2022/src/lib/config.mjs +30 -0
- package/dist/esm2022/src/lib/contacts.service.mjs +267 -0
- package/dist/esm2022/src/lib/email.service.mjs +267 -0
- package/dist/esm2022/src/lib/errors.mjs +40 -0
- package/dist/esm2022/src/lib/forms.service.mjs +180 -0
- package/dist/esm2022/src/lib/http-client.service.mjs +111 -0
- package/dist/esm2022/src/lib/metigan.module.mjs +67 -0
- package/dist/esm2022/src/lib/metigan.service.mjs +72 -0
- package/dist/esm2022/src/lib/templates.service.mjs +85 -0
- package/dist/esm2022/src/lib/types.mjs +6 -0
- package/dist/fesm2022/metigan-angular.mjs +1241 -0
- package/dist/fesm2022/metigan-angular.mjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/public-api.d.ts +15 -0
- package/dist/src/lib/audiences.service.d.ts +62 -0
- package/dist/src/lib/config.d.ts +28 -0
- package/dist/src/lib/contacts.service.d.ts +80 -0
- package/dist/src/lib/email.service.d.ts +44 -0
- package/dist/src/lib/errors.d.ts +24 -0
- package/dist/src/lib/forms.service.d.ts +67 -0
- package/dist/src/lib/http-client.service.d.ts +46 -0
- package/dist/src/lib/metigan.module.d.ts +27 -0
- package/dist/src/lib/metigan.service.d.ts +27 -0
- package/dist/src/lib/templates.service.d.ts +36 -0
- package/dist/src/lib/types.d.ts +329 -0
- package/examples/basic.component.ts +113 -0
- package/ng-package.json +8 -0
- package/package.json +68 -0
- package/public-api.ts +26 -0
- package/src/lib/audiences.service.ts +230 -0
- package/src/lib/config.ts +35 -0
- package/src/lib/contacts.service.ts +377 -0
- package/src/lib/email.service.ts +286 -0
- package/src/lib/errors.ts +45 -0
- package/src/lib/forms.service.ts +263 -0
- package/src/lib/http-client.service.ts +156 -0
- package/src/lib/metigan.module.ts +55 -0
- package/src/lib/metigan.service.ts +80 -0
- package/src/lib/templates.service.ts +103 -0
- package/src/lib/types.ts +398 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MetiganEmailService } from './email.service';
|
|
2
|
+
import { MetiganFormsService } from './forms.service';
|
|
3
|
+
import { MetiganContactsService } from './contacts.service';
|
|
4
|
+
import { MetiganAudiencesService } from './audiences.service';
|
|
5
|
+
import { MetiganTemplatesService } from './templates.service';
|
|
6
|
+
import { MetiganClientOptions } from './types';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare const METIGAN_CONFIG = "METIGAN_CONFIG";
|
|
9
|
+
export declare class MetiganService {
|
|
10
|
+
readonly email: MetiganEmailService;
|
|
11
|
+
readonly forms: MetiganFormsService;
|
|
12
|
+
readonly contacts: MetiganContactsService;
|
|
13
|
+
readonly audiences: MetiganAudiencesService;
|
|
14
|
+
readonly templates: MetiganTemplatesService;
|
|
15
|
+
private initialized;
|
|
16
|
+
constructor(emailService: MetiganEmailService, formsService: MetiganFormsService, contactsService: MetiganContactsService, audiencesService: MetiganAudiencesService, templatesService: MetiganTemplatesService, config?: MetiganClientOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Initialize all services with API key and options
|
|
19
|
+
*/
|
|
20
|
+
initialize(options: MetiganClientOptions): void;
|
|
21
|
+
/**
|
|
22
|
+
* Check if services are initialized
|
|
23
|
+
*/
|
|
24
|
+
isInitialized(): boolean;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MetiganService, [null, null, null, null, null, { optional: true; }]>;
|
|
26
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MetiganService>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { MetiganHttpClient } from './http-client.service';
|
|
3
|
+
import { EmailTemplate, EmailTemplateListResponse, PaginationOptions } from './types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class MetiganTemplatesService {
|
|
6
|
+
private http;
|
|
7
|
+
private apiKey;
|
|
8
|
+
private apiUrl;
|
|
9
|
+
private timeout;
|
|
10
|
+
private retryCount;
|
|
11
|
+
private retryDelay;
|
|
12
|
+
constructor(http: MetiganHttpClient);
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the service with API key and options
|
|
15
|
+
*/
|
|
16
|
+
initialize(apiKey: string, options?: {
|
|
17
|
+
apiUrl?: string;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
retryCount?: number;
|
|
20
|
+
retryDelay?: number;
|
|
21
|
+
}): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get default headers
|
|
24
|
+
*/
|
|
25
|
+
private getHeaders;
|
|
26
|
+
/**
|
|
27
|
+
* List all templates
|
|
28
|
+
*/
|
|
29
|
+
list(options?: PaginationOptions): Observable<EmailTemplateListResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Get template by ID
|
|
32
|
+
*/
|
|
33
|
+
get(templateId: string): Observable<EmailTemplate>;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MetiganTemplatesService, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MetiganTemplatesService>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Metigan Angular SDK
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Email attachment interface for Angular
|
|
7
|
+
*/
|
|
8
|
+
export interface EmailAttachment {
|
|
9
|
+
content: ArrayBuffer | Uint8Array | string;
|
|
10
|
+
filename: string;
|
|
11
|
+
contentType: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Email options interface
|
|
15
|
+
*/
|
|
16
|
+
export interface EmailOptions {
|
|
17
|
+
/** Sender email address (or Name <email>) */
|
|
18
|
+
from: string;
|
|
19
|
+
/** List of recipient email addresses */
|
|
20
|
+
recipients: string[];
|
|
21
|
+
/** Email subject */
|
|
22
|
+
subject: string;
|
|
23
|
+
/** Email content (HTML supported) - Required if not using templateId */
|
|
24
|
+
content?: string;
|
|
25
|
+
/** Template ID for using pre-created templates (optional) */
|
|
26
|
+
templateId?: string;
|
|
27
|
+
/** Optional file attachments */
|
|
28
|
+
attachments?: File[] | EmailAttachment[];
|
|
29
|
+
/** Optional CC recipients */
|
|
30
|
+
cc?: string[];
|
|
31
|
+
/** Optional BCC recipients */
|
|
32
|
+
bcc?: string[];
|
|
33
|
+
/** Optional reply-to address */
|
|
34
|
+
replyTo?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* API response interface for successful email
|
|
38
|
+
*/
|
|
39
|
+
export interface EmailSuccessResponse {
|
|
40
|
+
success: true;
|
|
41
|
+
message: string;
|
|
42
|
+
successfulEmails: {
|
|
43
|
+
recipient: string;
|
|
44
|
+
trackingId: string;
|
|
45
|
+
}[];
|
|
46
|
+
failedEmails: {
|
|
47
|
+
recipient: string;
|
|
48
|
+
error: string;
|
|
49
|
+
}[];
|
|
50
|
+
recipientCount: number;
|
|
51
|
+
emailsRemaining: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API error response interfaces
|
|
55
|
+
*/
|
|
56
|
+
export interface EmailErrorResponse {
|
|
57
|
+
error: string;
|
|
58
|
+
message: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Union type for all possible API responses
|
|
62
|
+
*/
|
|
63
|
+
export type EmailApiResponse = EmailSuccessResponse | EmailErrorResponse;
|
|
64
|
+
/**
|
|
65
|
+
* Form field types
|
|
66
|
+
*/
|
|
67
|
+
export type FormFieldType = 'text' | 'email' | 'number' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'date' | 'phone' | 'url' | 'file' | 'step' | 'password' | 'rating' | 'slider' | 'heading' | 'image-choice' | 'matrix';
|
|
68
|
+
/**
|
|
69
|
+
* Form field configuration
|
|
70
|
+
*/
|
|
71
|
+
export interface FormFieldConfig {
|
|
72
|
+
id: string;
|
|
73
|
+
type: FormFieldType;
|
|
74
|
+
label: string;
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
required?: boolean;
|
|
77
|
+
helpText?: string;
|
|
78
|
+
options?: string[];
|
|
79
|
+
imageUrls?: string[];
|
|
80
|
+
defaultValue?: string | number | boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Form settings
|
|
84
|
+
*/
|
|
85
|
+
export interface FormSettings {
|
|
86
|
+
successMessage?: string;
|
|
87
|
+
processingMessage?: string;
|
|
88
|
+
redirectUrl?: string;
|
|
89
|
+
notifyEmail?: string;
|
|
90
|
+
enableCaptcha?: boolean;
|
|
91
|
+
storeResponses?: boolean;
|
|
92
|
+
allowMultipleSubmissions?: boolean;
|
|
93
|
+
showProgressBar?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Complete form configuration
|
|
97
|
+
*/
|
|
98
|
+
export interface FormConfig {
|
|
99
|
+
id?: string;
|
|
100
|
+
title: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
coverImage?: string;
|
|
103
|
+
fields: FormFieldConfig[];
|
|
104
|
+
audienceId?: string;
|
|
105
|
+
settings?: FormSettings;
|
|
106
|
+
published?: boolean;
|
|
107
|
+
publishedUrl?: string;
|
|
108
|
+
slug?: string;
|
|
109
|
+
analytics?: {
|
|
110
|
+
views: number;
|
|
111
|
+
submissions: number;
|
|
112
|
+
conversionRate?: number;
|
|
113
|
+
};
|
|
114
|
+
createdAt?: Date;
|
|
115
|
+
updatedAt?: Date;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Form submission data
|
|
119
|
+
*/
|
|
120
|
+
export interface FormSubmissionData {
|
|
121
|
+
[fieldId: string]: any;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Form submission options
|
|
125
|
+
*/
|
|
126
|
+
export interface FormSubmissionOptions {
|
|
127
|
+
formId: string;
|
|
128
|
+
data: FormSubmissionData;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Form submission response
|
|
132
|
+
*/
|
|
133
|
+
export interface FormSubmissionResponse {
|
|
134
|
+
success: boolean;
|
|
135
|
+
message: string;
|
|
136
|
+
submissionId?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Form list response
|
|
140
|
+
*/
|
|
141
|
+
export interface FormListResponse {
|
|
142
|
+
forms: FormConfig[];
|
|
143
|
+
pagination: {
|
|
144
|
+
total: number;
|
|
145
|
+
page: number;
|
|
146
|
+
limit: number;
|
|
147
|
+
pages: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Contact status
|
|
152
|
+
*/
|
|
153
|
+
export type ContactStatus = 'subscribed' | 'unsubscribed' | 'pending' | 'bounced' | 'complained';
|
|
154
|
+
/**
|
|
155
|
+
* Contact data
|
|
156
|
+
*/
|
|
157
|
+
export interface Contact {
|
|
158
|
+
id?: string;
|
|
159
|
+
email: string;
|
|
160
|
+
firstName?: string;
|
|
161
|
+
lastName?: string;
|
|
162
|
+
phone?: string;
|
|
163
|
+
status: ContactStatus;
|
|
164
|
+
audienceId: string;
|
|
165
|
+
tags?: string[];
|
|
166
|
+
customFields?: Record<string, any>;
|
|
167
|
+
createdAt?: Date;
|
|
168
|
+
updatedAt?: Date;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Contact creation options
|
|
172
|
+
*/
|
|
173
|
+
export interface CreateContactOptions {
|
|
174
|
+
email: string;
|
|
175
|
+
firstName?: string;
|
|
176
|
+
lastName?: string;
|
|
177
|
+
phone?: string;
|
|
178
|
+
audienceId: string;
|
|
179
|
+
tags?: string[];
|
|
180
|
+
customFields?: Record<string, any>;
|
|
181
|
+
status?: ContactStatus;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Contact update options
|
|
185
|
+
*/
|
|
186
|
+
export interface UpdateContactOptions {
|
|
187
|
+
firstName?: string;
|
|
188
|
+
lastName?: string;
|
|
189
|
+
phone?: string;
|
|
190
|
+
tags?: string[];
|
|
191
|
+
customFields?: Record<string, any>;
|
|
192
|
+
status?: ContactStatus;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Contact list filters
|
|
196
|
+
*/
|
|
197
|
+
export interface ContactListFilters {
|
|
198
|
+
audienceId?: string;
|
|
199
|
+
status?: ContactStatus;
|
|
200
|
+
tag?: string;
|
|
201
|
+
search?: string;
|
|
202
|
+
page?: number;
|
|
203
|
+
limit?: number;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Contact list response
|
|
207
|
+
*/
|
|
208
|
+
export interface ContactListResponse {
|
|
209
|
+
contacts: Contact[];
|
|
210
|
+
pagination: {
|
|
211
|
+
total: number;
|
|
212
|
+
page: number;
|
|
213
|
+
limit: number;
|
|
214
|
+
pages: number;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Bulk contact operation result
|
|
219
|
+
*/
|
|
220
|
+
export interface BulkContactResult {
|
|
221
|
+
success: boolean;
|
|
222
|
+
imported: number;
|
|
223
|
+
failed: number;
|
|
224
|
+
errors?: {
|
|
225
|
+
email: string;
|
|
226
|
+
error: string;
|
|
227
|
+
}[];
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Audience data
|
|
231
|
+
*/
|
|
232
|
+
export interface Audience {
|
|
233
|
+
id?: string;
|
|
234
|
+
name: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
count: number;
|
|
237
|
+
createdAt?: Date;
|
|
238
|
+
updatedAt?: Date;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Audience creation options
|
|
242
|
+
*/
|
|
243
|
+
export interface CreateAudienceOptions {
|
|
244
|
+
name: string;
|
|
245
|
+
description?: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Audience update options
|
|
249
|
+
*/
|
|
250
|
+
export interface UpdateAudienceOptions {
|
|
251
|
+
name?: string;
|
|
252
|
+
description?: string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Audience list response
|
|
256
|
+
*/
|
|
257
|
+
export interface AudienceListResponse {
|
|
258
|
+
audiences: Audience[];
|
|
259
|
+
pagination: {
|
|
260
|
+
total: number;
|
|
261
|
+
page: number;
|
|
262
|
+
limit: number;
|
|
263
|
+
pages: number;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Audience statistics
|
|
268
|
+
*/
|
|
269
|
+
export interface AudienceStats {
|
|
270
|
+
total: number;
|
|
271
|
+
subscribed: number;
|
|
272
|
+
unsubscribed: number;
|
|
273
|
+
pending: number;
|
|
274
|
+
bounced: number;
|
|
275
|
+
complained: number;
|
|
276
|
+
growthRate?: number;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Email template data
|
|
280
|
+
*/
|
|
281
|
+
export interface EmailTemplate {
|
|
282
|
+
id: string;
|
|
283
|
+
name: string;
|
|
284
|
+
subject: string;
|
|
285
|
+
components?: any[];
|
|
286
|
+
styles?: any;
|
|
287
|
+
createdAt?: Date;
|
|
288
|
+
updatedAt?: Date;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Email template list response
|
|
292
|
+
*/
|
|
293
|
+
export interface EmailTemplateListResponse {
|
|
294
|
+
templates: EmailTemplate[];
|
|
295
|
+
pagination: {
|
|
296
|
+
total: number;
|
|
297
|
+
page: number;
|
|
298
|
+
limit: number;
|
|
299
|
+
pages: number;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Pagination options
|
|
304
|
+
*/
|
|
305
|
+
export interface PaginationOptions {
|
|
306
|
+
page?: number;
|
|
307
|
+
limit?: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Client options for Metigan
|
|
311
|
+
*/
|
|
312
|
+
export interface MetiganClientOptions {
|
|
313
|
+
/** API Key */
|
|
314
|
+
apiKey: string;
|
|
315
|
+
/** User ID for logging */
|
|
316
|
+
userId?: string;
|
|
317
|
+
/** Disable logging */
|
|
318
|
+
disableLogs?: boolean;
|
|
319
|
+
/** Request timeout in ms */
|
|
320
|
+
timeout?: number;
|
|
321
|
+
/** Number of retries */
|
|
322
|
+
retryCount?: number;
|
|
323
|
+
/** Delay between retries in ms */
|
|
324
|
+
retryDelay?: number;
|
|
325
|
+
/** Enable debug mode */
|
|
326
|
+
debug?: boolean;
|
|
327
|
+
/** Custom API URL */
|
|
328
|
+
apiUrl?: string;
|
|
329
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic example of using Metigan Angular SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Component, OnInit } from '@angular/core';
|
|
6
|
+
import { MetiganService } from '@metigan/angular';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'app-metigan-example',
|
|
10
|
+
template: `
|
|
11
|
+
<div>
|
|
12
|
+
<h2>Metigan SDK Example</h2>
|
|
13
|
+
|
|
14
|
+
<button (click)="sendEmail()">Send Email</button>
|
|
15
|
+
<button (click)="submitForm()">Submit Form</button>
|
|
16
|
+
<button (click)="createContact()">Create Contact</button>
|
|
17
|
+
<button (click)="listAudiences()">List Audiences</button>
|
|
18
|
+
|
|
19
|
+
<div *ngIf="message">{{ message }}</div>
|
|
20
|
+
<div *ngIf="error" style="color: red;">{{ error }}</div>
|
|
21
|
+
</div>
|
|
22
|
+
`
|
|
23
|
+
})
|
|
24
|
+
export class MetiganExampleComponent implements OnInit {
|
|
25
|
+
message: string = '';
|
|
26
|
+
error: string = '';
|
|
27
|
+
|
|
28
|
+
constructor(private metigan: MetiganService) {}
|
|
29
|
+
|
|
30
|
+
ngOnInit() {
|
|
31
|
+
// Initialize if not done via module
|
|
32
|
+
if (!this.metigan.isInitialized()) {
|
|
33
|
+
this.metigan.initialize({
|
|
34
|
+
apiKey: 'your-api-key-here'
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
sendEmail() {
|
|
40
|
+
this.message = '';
|
|
41
|
+
this.error = '';
|
|
42
|
+
|
|
43
|
+
this.metigan.email.sendEmail({
|
|
44
|
+
from: 'Your Company <noreply@yourcompany.com>',
|
|
45
|
+
recipients: ['customer@email.com'],
|
|
46
|
+
subject: 'Welcome!',
|
|
47
|
+
content: '<h1>Hello!</h1><p>Thank you for signing up.</p>'
|
|
48
|
+
}).subscribe({
|
|
49
|
+
next: (response) => {
|
|
50
|
+
this.message = `Email sent! ${response.message}`;
|
|
51
|
+
},
|
|
52
|
+
error: (error) => {
|
|
53
|
+
this.error = `Error: ${error.message}`;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
submitForm() {
|
|
59
|
+
this.message = '';
|
|
60
|
+
this.error = '';
|
|
61
|
+
|
|
62
|
+
this.metigan.forms.submit({
|
|
63
|
+
formId: 'form-123',
|
|
64
|
+
data: {
|
|
65
|
+
'field-email': 'user@email.com',
|
|
66
|
+
'field-name': 'John Doe'
|
|
67
|
+
}
|
|
68
|
+
}).subscribe({
|
|
69
|
+
next: (response) => {
|
|
70
|
+
this.message = response.message;
|
|
71
|
+
},
|
|
72
|
+
error: (error) => {
|
|
73
|
+
this.error = `Error: ${error.message}`;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
createContact() {
|
|
79
|
+
this.message = '';
|
|
80
|
+
this.error = '';
|
|
81
|
+
|
|
82
|
+
this.metigan.contacts.create({
|
|
83
|
+
email: 'new@email.com',
|
|
84
|
+
firstName: 'Jane',
|
|
85
|
+
lastName: 'Doe',
|
|
86
|
+
audienceId: 'audience-123',
|
|
87
|
+
tags: ['customer']
|
|
88
|
+
}).subscribe({
|
|
89
|
+
next: (contact) => {
|
|
90
|
+
this.message = `Contact created: ${contact.email}`;
|
|
91
|
+
},
|
|
92
|
+
error: (error) => {
|
|
93
|
+
this.error = `Error: ${error.message}`;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
listAudiences() {
|
|
99
|
+
this.message = '';
|
|
100
|
+
this.error = '';
|
|
101
|
+
|
|
102
|
+
this.metigan.audiences.list({ page: 1, limit: 10 }).subscribe({
|
|
103
|
+
next: (response) => {
|
|
104
|
+
const names = response.audiences.map(a => a.name).join(', ');
|
|
105
|
+
this.message = `Audiences: ${names}`;
|
|
106
|
+
},
|
|
107
|
+
error: (error) => {
|
|
108
|
+
this.error = `Error: ${error.message}`;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
package/ng-package.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metigan/angular",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official Metigan SDK for Angular - Email, Forms, Contacts, and Audiences management",
|
|
5
|
+
"author": "Metigan <support@metigan.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/frantchessico/metigan-angular.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/frantchessico/metigan-angular/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://metigan.com",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"angular",
|
|
17
|
+
"metigan",
|
|
18
|
+
"email",
|
|
19
|
+
"email-api",
|
|
20
|
+
"forms",
|
|
21
|
+
"contacts",
|
|
22
|
+
"audiences",
|
|
23
|
+
"marketing",
|
|
24
|
+
"marketing-automation",
|
|
25
|
+
"sdk",
|
|
26
|
+
"newsletter",
|
|
27
|
+
"email-sending"
|
|
28
|
+
],
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
31
|
+
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
32
|
+
"rxjs": "^7.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "npx ng-packagr -p ng-package.json",
|
|
36
|
+
"prepublishOnly": "npm run build"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"tslib": "^2.3.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@angular/common": "^17.0.0",
|
|
43
|
+
"@angular/compiler": "^17.0.0",
|
|
44
|
+
"@angular/compiler-cli": "^17.0.0",
|
|
45
|
+
"@angular/core": "^17.0.0",
|
|
46
|
+
"ng-packagr": "^17.0.0",
|
|
47
|
+
"typescript": ">=5.2.0 <5.5.0"
|
|
48
|
+
},
|
|
49
|
+
"main": "./dist/bundles/metigan-angular.umd.js",
|
|
50
|
+
"module": "./dist/fesm2022/metigan-angular.mjs",
|
|
51
|
+
"es2022": "./dist/fesm2022/metigan-angular.mjs",
|
|
52
|
+
"esm2022": "./dist/esm2022/metigan-angular.mjs",
|
|
53
|
+
"fesm2022": "./dist/fesm2022/metigan-angular.mjs",
|
|
54
|
+
"typings": "./dist/index.d.ts",
|
|
55
|
+
"exports": {
|
|
56
|
+
".": {
|
|
57
|
+
"types": "./dist/index.d.ts",
|
|
58
|
+
"esm2022": "./dist/esm2022/metigan-angular.mjs",
|
|
59
|
+
"es2022": "./dist/fesm2022/metigan-angular.mjs",
|
|
60
|
+
"default": "./dist/fesm2022/metigan-angular.mjs"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"sideEffects": false,
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
package/public-api.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for @metigan/angular
|
|
3
|
+
* Export all public classes, services, and types
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Services
|
|
7
|
+
export { MetiganService, METIGAN_CONFIG } from './src/lib/metigan.service';
|
|
8
|
+
export { MetiganEmailService } from './src/lib/email.service';
|
|
9
|
+
export { MetiganFormsService } from './src/lib/forms.service';
|
|
10
|
+
export { MetiganContactsService } from './src/lib/contacts.service';
|
|
11
|
+
export { MetiganAudiencesService } from './src/lib/audiences.service';
|
|
12
|
+
export { MetiganTemplatesService } from './src/lib/templates.service';
|
|
13
|
+
export { MetiganHttpClient } from './src/lib/http-client.service';
|
|
14
|
+
|
|
15
|
+
// Module
|
|
16
|
+
export { MetiganModule } from './src/lib/metigan.module';
|
|
17
|
+
|
|
18
|
+
// Errors
|
|
19
|
+
export { MetiganError, ValidationError, ApiError } from './src/lib/errors';
|
|
20
|
+
|
|
21
|
+
// Types
|
|
22
|
+
export * from './src/lib/types';
|
|
23
|
+
|
|
24
|
+
// Config
|
|
25
|
+
export { API_URL, SDK_VERSION, DEFAULT_TIMEOUT, DEFAULT_RETRY_COUNT, DEFAULT_RETRY_DELAY, MAX_FILE_SIZE } from './src/lib/config';
|
|
26
|
+
|