@pobuca/email-builder 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.
Files changed (150) hide show
  1. package/README.md +1 -0
  2. package/assets/icons/dribbble.png +0 -0
  3. package/assets/icons/facebook.png +0 -0
  4. package/assets/icons/github.png +0 -0
  5. package/assets/icons/instagram.png +0 -0
  6. package/assets/icons/linkedin.png +0 -0
  7. package/assets/icons/medium.png +0 -0
  8. package/assets/icons/pinterest.png +0 -0
  9. package/assets/icons/snapchat.png +0 -0
  10. package/assets/icons/soundcloud.png +0 -0
  11. package/assets/icons/tumblr.png +0 -0
  12. package/assets/icons/twitter.png +0 -0
  13. package/assets/icons/vimeo.png +0 -0
  14. package/assets/icons/web.png +0 -0
  15. package/assets/icons/xing.png +0 -0
  16. package/assets/icons/youtube.png +0 -0
  17. package/bundles/pobuca-email-builder.umd.js +4664 -0
  18. package/bundles/pobuca-email-builder.umd.js.map +1 -0
  19. package/bundles/pobuca-email-builder.umd.min.js +2 -0
  20. package/bundles/pobuca-email-builder.umd.min.js.map +1 -0
  21. package/esm2015/lib/classes/DefaultEmail.js +53 -0
  22. package/esm2015/lib/classes/Elements.js +229 -0
  23. package/esm2015/lib/classes/Structure.js +89 -0
  24. package/esm2015/lib/components/block/block.component.js +89 -0
  25. package/esm2015/lib/components/block-settings/block-settings.component.js +53 -0
  26. package/esm2015/lib/components/builder-container/builder-container.component.js +114 -0
  27. package/esm2015/lib/components/dialog.component.js +30 -0
  28. package/esm2015/lib/components/general-settings/general-settings.component.js +25 -0
  29. package/esm2015/lib/components/import-dialog/import-dialog.component.js +62 -0
  30. package/esm2015/lib/components/preview.component.js +89 -0
  31. package/esm2015/lib/components/structure/structure.component.js +163 -0
  32. package/esm2015/lib/components/structure-settings/structure-settings.component.js +31 -0
  33. package/esm2015/lib/components/template-list-dialog/template-list-dialog.component.js +45 -0
  34. package/esm2015/lib/directives/dynamic-component.directive.js +46 -0
  35. package/esm2015/lib/elements/abstract-block.js +23 -0
  36. package/esm2015/lib/elements/button/button.component.js +29 -0
  37. package/esm2015/lib/elements/divider/divider.component.js +30 -0
  38. package/esm2015/lib/elements/image/image.component.js +54 -0
  39. package/esm2015/lib/elements/social/social.component.js +42 -0
  40. package/esm2015/lib/elements/spacer/spacer.component.js +30 -0
  41. package/esm2015/lib/elements/text-element/text-element.component.js +80 -0
  42. package/esm2015/lib/groups/align.js +79 -0
  43. package/esm2015/lib/groups/back-repeat.js +55 -0
  44. package/esm2015/lib/groups/border.js +102 -0
  45. package/esm2015/lib/groups/color.js +139 -0
  46. package/esm2015/lib/groups/direction.js +63 -0
  47. package/esm2015/lib/groups/font-styles.js +112 -0
  48. package/esm2015/lib/groups/gaps.js +45 -0
  49. package/esm2015/lib/groups/line-height.js +68 -0
  50. package/esm2015/lib/groups/link.js +67 -0
  51. package/esm2015/lib/groups/margin.js +45 -0
  52. package/esm2015/lib/groups/padding.js +53 -0
  53. package/esm2015/lib/groups/upload-image.js +112 -0
  54. package/esm2015/lib/groups/width-height.js +94 -0
  55. package/esm2015/lib/interceptors/pb-interceptor.interceptor.js +51 -0
  56. package/esm2015/lib/interfaces/interfaces.js +13 -0
  57. package/esm2015/lib/pb-email-builder.component.js +246 -0
  58. package/esm2015/lib/pb-email-builder.module.js +291 -0
  59. package/esm2015/lib/pb-email-builder.service.js +134 -0
  60. package/esm2015/lib/pipes/slugify.pipe.js +39 -0
  61. package/esm2015/lib/services/internals/pb-email-object-store/pb-email-object-store.service.js +165 -0
  62. package/esm2015/lib/services/internals/user-interfaces/user-interface.service.js +122 -0
  63. package/esm2015/lib/services/pb-storage/FreeUsersStorage.class.js +11 -0
  64. package/esm2015/lib/services/pb-storage/index.js +7 -0
  65. package/esm2015/lib/services/pb-storage/pb-storage.service.js +79 -0
  66. package/esm2015/lib/services/user-image-uploader-service/free-users-image-uploader.service.js +26 -0
  67. package/esm2015/lib/services/user-image-uploader-service/index.js +8 -0
  68. package/esm2015/lib/services/user-image-uploader-service/paid-users-image-uploader.service.js +30 -0
  69. package/esm2015/lib/services/user-image-uploader-service/upload-bottom-sheet-dialog/upload-bottom-sheet-dialog.component.js +112 -0
  70. package/esm2015/lib/services/user-image-uploader-service/upload-image-gallery/upload-image-gallery.component.js +91 -0
  71. package/esm2015/lib/services/user-image-uploader-service/user-image-uploader.service.js +26 -0
  72. package/esm2015/lib/services/user-middleware-service/FreeUsersMiddleware.js +31 -0
  73. package/esm2015/lib/services/user-middleware-service/PaidUsersMiddleware.js +12 -0
  74. package/esm2015/lib/services/user-middleware-service/index.js +8 -0
  75. package/esm2015/lib/services/user-middleware-service/pb-middlewares.service.js +195 -0
  76. package/esm2015/lib/services/user-rest-api-service/free-users-rest-api.service.js +16 -0
  77. package/esm2015/lib/services/user-rest-api-service/index.js +7 -0
  78. package/esm2015/lib/services/user-rest-api-service/user-rest-api.service.js +116 -0
  79. package/esm2015/lib/tokens/private-tokens.js +17 -0
  80. package/esm2015/lib/tokens/tokens.js +159 -0
  81. package/esm2015/lib/utils.js +147 -0
  82. package/esm2015/pobuca-email-builder.js +43 -0
  83. package/esm2015/public_api.js +26 -0
  84. package/fesm2015/pobuca-email-builder.js +4335 -0
  85. package/fesm2015/pobuca-email-builder.js.map +1 -0
  86. package/lib/classes/DefaultEmail.d.ts +9 -0
  87. package/lib/classes/Elements.d.ts +62 -0
  88. package/lib/classes/Structure.d.ts +11 -0
  89. package/lib/components/block/block.component.d.ts +25 -0
  90. package/lib/components/block-settings/block-settings.component.d.ts +18 -0
  91. package/lib/components/builder-container/builder-container.component.d.ts +36 -0
  92. package/lib/components/dialog.component.d.ts +10 -0
  93. package/lib/components/general-settings/general-settings.component.d.ts +6 -0
  94. package/lib/components/import-dialog/import-dialog.component.d.ts +16 -0
  95. package/lib/components/preview.component.d.ts +18 -0
  96. package/lib/components/structure/structure.component.d.ts +43 -0
  97. package/lib/components/structure-settings/structure-settings.component.d.ts +9 -0
  98. package/lib/components/template-list-dialog/template-list-dialog.component.d.ts +15 -0
  99. package/lib/directives/dynamic-component.directive.d.ts +13 -0
  100. package/lib/elements/abstract-block.d.ts +8 -0
  101. package/lib/elements/button/button.component.d.ts +18 -0
  102. package/lib/elements/divider/divider.component.d.ts +10 -0
  103. package/lib/elements/image/image.component.d.ts +19 -0
  104. package/lib/elements/social/social.component.d.ts +21 -0
  105. package/lib/elements/spacer/spacer.component.d.ts +5 -0
  106. package/lib/elements/text-element/text-element.component.d.ts +52 -0
  107. package/lib/groups/align.d.ts +17 -0
  108. package/lib/groups/back-repeat.d.ts +8 -0
  109. package/lib/groups/border.d.ts +13 -0
  110. package/lib/groups/color.d.ts +26 -0
  111. package/lib/groups/direction.d.ts +13 -0
  112. package/lib/groups/font-styles.d.ts +17 -0
  113. package/lib/groups/gaps.d.ts +7 -0
  114. package/lib/groups/line-height.d.ts +12 -0
  115. package/lib/groups/link.d.ts +11 -0
  116. package/lib/groups/margin.d.ts +8 -0
  117. package/lib/groups/padding.d.ts +8 -0
  118. package/lib/groups/upload-image.d.ts +19 -0
  119. package/lib/groups/width-height.d.ts +19 -0
  120. package/lib/interceptors/pb-interceptor.interceptor.d.ts +10 -0
  121. package/lib/interfaces/interfaces.d.ts +422 -0
  122. package/lib/pb-email-builder.component.d.ts +67 -0
  123. package/lib/pb-email-builder.module.d.ts +51 -0
  124. package/lib/pb-email-builder.service.d.ts +83 -0
  125. package/lib/pipes/slugify.pipe.d.ts +9 -0
  126. package/lib/services/internals/pb-email-object-store/pb-email-object-store.service.d.ts +50 -0
  127. package/lib/services/internals/user-interfaces/user-interface.service.d.ts +46 -0
  128. package/lib/services/pb-storage/FreeUsersStorage.class.d.ts +6 -0
  129. package/lib/services/pb-storage/index.d.ts +2 -0
  130. package/lib/services/pb-storage/pb-storage.service.d.ts +54 -0
  131. package/lib/services/user-image-uploader-service/free-users-image-uploader.service.d.ts +12 -0
  132. package/lib/services/user-image-uploader-service/index.d.ts +3 -0
  133. package/lib/services/user-image-uploader-service/paid-users-image-uploader.service.d.ts +14 -0
  134. package/lib/services/user-image-uploader-service/upload-bottom-sheet-dialog/upload-bottom-sheet-dialog.component.d.ts +28 -0
  135. package/lib/services/user-image-uploader-service/upload-image-gallery/upload-image-gallery.component.d.ts +27 -0
  136. package/lib/services/user-image-uploader-service/user-image-uploader.service.d.ts +26 -0
  137. package/lib/services/user-middleware-service/FreeUsersMiddleware.d.ts +15 -0
  138. package/lib/services/user-middleware-service/PaidUsersMiddleware.d.ts +7 -0
  139. package/lib/services/user-middleware-service/index.d.ts +3 -0
  140. package/lib/services/user-middleware-service/pb-middlewares.service.d.ts +190 -0
  141. package/lib/services/user-rest-api-service/free-users-rest-api.service.d.ts +10 -0
  142. package/lib/services/user-rest-api-service/index.d.ts +2 -0
  143. package/lib/services/user-rest-api-service/user-rest-api.service.d.ts +82 -0
  144. package/lib/tokens/private-tokens.d.ts +5 -0
  145. package/lib/tokens/tokens.d.ts +70 -0
  146. package/lib/utils.d.ts +88 -0
  147. package/package.json +37 -0
  148. package/pobuca-email-builder.d.ts +42 -0
  149. package/pobuca-email-builder.metadata.json +1 -0
  150. package/public_api.d.ts +16 -0
@@ -0,0 +1,50 @@
1
+ import { CdkDragDrop } from '@angular/cdk/drag-drop';
2
+ import { IAddBlockEvent, IAddStructureEvent, PbUserMiddlewaresService } from '../../user-middleware-service/pb-middlewares.service';
3
+ import { IForRootConf, IMjmlServerResponse, IStructure } from '../../../interfaces/interfaces';
4
+ import { TBlocks } from '../../../classes/Elements';
5
+ import { PBEmail } from '../../../classes/DefaultEmail';
6
+ import { PbUserRestApiService } from '../../user-rest-api-service/user-rest-api.service';
7
+ import { PbStorageService } from '../../pb-storage/pb-storage.service';
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare class PbEmailObjectStoreService {
12
+ private userRestApi;
13
+ private pbStorage;
14
+ private userMiddleware;
15
+ private googleFonts;
16
+ readonly config: IForRootConf;
17
+ Email: PBEmail;
18
+ private clonedEmail;
19
+ private _Email$;
20
+ readonly emailAsObservable$: import("rxjs").Observable<PBEmail>;
21
+ readonly emailStructuresAsObservable$: import("rxjs").Observable<IStructure[]>;
22
+ readonly generalEmailOptionsAsObservable$: import("rxjs").Observable<import("../../../interfaces/interfaces").IGeneralOptions>;
23
+ readonly currentEmailHasChanges$: import("rxjs").Observable<boolean>;
24
+ readonly builderContainerStyles$: import("rxjs").Observable<{
25
+ direction: import("../../../interfaces/interfaces").TDirection;
26
+ backgroundRepeat: import("../../../interfaces/interfaces").TBackgroundRepeat;
27
+ backgroundColor: string;
28
+ backgroundSize: string;
29
+ backgroundPosition: string;
30
+ }>;
31
+ private _Mjml$;
32
+ readonly mjmlAsObservable$: import("rxjs").Observable<string>;
33
+ private _Template$;
34
+ readonly templateAsObservable$: import("rxjs").Observable<string>;
35
+ private _onTemplateCreated$;
36
+ readonly onTemplateCreated$: import("rxjs").Observable<[PBEmail, string, string]>;
37
+ constructor(userRestApi: PbUserRestApiService, pbStorage: PbStorageService, userMiddleware: PbUserMiddlewaresService, googleFonts: string[], config: IForRootConf);
38
+ createHTMLTemplate$(): import("rxjs").Observable<IMjmlServerResponse>;
39
+ markForCheck(): void;
40
+ setEmail(newEmail: PBEmail): void;
41
+ addStructure({ currentIndex, item }: IAddStructureEvent): IStructure;
42
+ changeStructureOrder({ previousIndex, currentIndex }: CdkDragDrop<Set<IStructure>>): void;
43
+ duplicateStructure(index: number): IStructure;
44
+ removeStructure(index: number): void;
45
+ addBlock({ previousIndex, currentIndex, item, previousContainer: { id, data } }: IAddBlockEvent, column: TBlocks[]): void;
46
+ changeBlockOrder({ previousIndex, currentIndex }: CdkDragDrop<TBlocks[]>, column: TBlocks[]): void;
47
+ duplicateBlock(key: number, column: TBlocks[], block: TBlocks): TBlocks;
48
+ removeBlock(key: number, column: TBlocks[]): void;
49
+ reset(): void;
50
+ }
@@ -0,0 +1,46 @@
1
+ import { MatSnackBar } from '@angular/material/snack-bar';
2
+ import { MatDialog } from '@angular/material/dialog';
3
+ import { MatBottomSheet } from '@angular/material/bottom-sheet';
4
+ import { Observable, ReplaySubject } from 'rxjs';
5
+ import { IStructure, IUserTemplate, IUserTemplateCategory } from '../../../interfaces/interfaces';
6
+ import { TBlocks } from '../../../classes/Elements';
7
+ import { PbEmailObjectStoreService } from '../pb-email-object-store/pb-email-object-store.service';
8
+ import { PBEmail } from '../../../classes/DefaultEmail';
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare class PbUserInterfaceService {
13
+ private emailObjectStore;
14
+ private matDialog;
15
+ private bottomSheet;
16
+ private snackBar;
17
+ readonly activeMatProgress$: ReplaySubject<boolean>;
18
+ readonly cdkDropListConnectedTo$: Observable<any[]>;
19
+ private readonly _currentEditingStructure$;
20
+ readonly currentEditingStructure$: Observable<IStructure>;
21
+ private readonly _currentEditingBlock$;
22
+ readonly currentEditingBlock$: Observable<TBlocks>;
23
+ private readonly _editGeneralSettings$;
24
+ readonly editGeneralSettings$: Observable<"general" | "structure" | "block">;
25
+ private readonly _currentTabIndex$;
26
+ readonly currentTabIndex$: Observable<number>;
27
+ constructor(emailObjectStore: PbEmailObjectStoreService, matDialog: MatDialog, bottomSheet: MatBottomSheet, snackBar: MatSnackBar);
28
+ editBlock(block: TBlocks): void;
29
+ editStructure(structure: IStructure): void;
30
+ editGeneralSettings(): void;
31
+ changeTabIndex(index: number): void;
32
+ confirmDialog$(): Observable<boolean>;
33
+ templatesListDialog$(templateList: IUserTemplateCategory[]): Observable<{
34
+ category: string;
35
+ template: IUserTemplate;
36
+ }>;
37
+ importDialog$(): Observable<PBEmail>;
38
+ notify(msg: string, close?: string, duration?: number): import("@angular/material/snack-bar").MatSnackBarRef<import("@angular/material/snack-bar").TextOnlySnackBar>;
39
+ currentEditingBlock(): TBlocks;
40
+ currentEditingStructure(): IStructure;
41
+ currentStructureEqualWith(structure: IStructure): boolean;
42
+ currentBlockEqualWith(block: TBlocks): boolean;
43
+ currentStructureContainsActiveBlock(structure: IStructure): boolean;
44
+ resetElements(): void;
45
+ reset(): void;
46
+ }
@@ -0,0 +1,6 @@
1
+ import { PbStorageService } from './pb-storage.service';
2
+ /**
3
+ * @internal
4
+ */
5
+ export default class FreeUsersPbStorage extends PbStorageService {
6
+ }
@@ -0,0 +1,2 @@
1
+ import FreeUsersPbStorage from './FreeUsersStorage.class';
2
+ export { FreeUsersPbStorage };
@@ -0,0 +1,54 @@
1
+ import { IUserTemplate, IUserTemplateCategory } from '../../interfaces/interfaces';
2
+ /**
3
+ * This service allow you rewrite the default Builder Storage methods. It contains all methods builder needs to cache or store objects.
4
+ * Alternatively you can rewrite the [PB_TEMPLATES_TEMPORARY_STORAGE]{@link PB_TEMPLATES_TEMPORARY_STORAGE}
5
+ * or [PB_STORAGE_FACTORY]{@link PB_STORAGE_FACTORY} tokens.
6
+ *
7
+ * In next major updates, it can have some limitations for Regular License.
8
+ *
9
+ * @example
10
+ * // Create a custom service
11
+ * class YourOwnStorageService extends IpStorageService {}
12
+ *
13
+ * // Rewrite it into AppModule
14
+ * { provide: IpStorageService, useClass: YourOwnStorageService }
15
+ */
16
+ export declare abstract class PbStorageService {
17
+ /**
18
+ * Storage for templates defined by [PB_TEMPLATES_TEMPORARY_STORAGE]{@link PB_TEMPLATES_TEMPORARY_STORAGE} token.
19
+ */
20
+ templateStorage: Storage;
21
+ constructor(
22
+ /**
23
+ * Storage for templates defined by [PB_TEMPLATES_TEMPORARY_STORAGE]{@link PB_TEMPLATES_TEMPORARY_STORAGE} token.
24
+ */
25
+ templateStorage: Storage);
26
+ /**
27
+ * Get the latest used templates end user has chosen from templates list.
28
+ * @return Latest used templates by end user.
29
+ */
30
+ getLatestUsedTemplates(): IUserTemplate[];
31
+ /**
32
+ * Add a template to end user's chosen templates list.
33
+ * @param template Template end user chosen.
34
+ */
35
+ addTemplateToLatestUsed(template: IUserTemplate): void;
36
+ /**
37
+ * Clear all latest used templates cache.
38
+ */
39
+ clearLatestUsed(): void;
40
+ /**
41
+ * Cache a fully templates list.
42
+ * @param list Template list to cache
43
+ */
44
+ cacheTemplateList(list: IUserTemplateCategory[]): void;
45
+ /**
46
+ * Get a cached templates list if exists.
47
+ * @return Either a cached templates list or an empty array.
48
+ */
49
+ getCachedTemplateList(): IUserTemplateCategory[];
50
+ /**
51
+ * Clear all templates list cache.
52
+ */
53
+ clearCachedTemplateList(): void;
54
+ }
@@ -0,0 +1,12 @@
1
+ import { MatBottomSheet } from '@angular/material/bottom-sheet';
2
+ import { PbUserMiddlewaresService } from '../user-middleware-service/pb-middlewares.service';
3
+ import { PbUserImageUploaderService } from './user-image-uploader.service';
4
+ /**
5
+ * @internal
6
+ */
7
+ export default class ImageUploader extends PbUserImageUploaderService {
8
+ private matBottomSheet;
9
+ private userMiddlewaresService;
10
+ constructor(matBottomSheet: MatBottomSheet, userMiddlewaresService: PbUserMiddlewaresService);
11
+ browse$(): import("rxjs").Observable<string>;
12
+ }
@@ -0,0 +1,3 @@
1
+ import FreeUsersImageUploader from './free-users-image-uploader.service';
2
+ import PaidUsersImageUploader from './paid-users-image-uploader.service';
3
+ export { FreeUsersImageUploader, PaidUsersImageUploader };
@@ -0,0 +1,14 @@
1
+ import { MatDialog } from '@angular/material/dialog';
2
+ import { PbUserImageUploaderService } from './user-image-uploader.service';
3
+ import { PbUserMiddlewaresService } from '../user-middleware-service/pb-middlewares.service';
4
+ import { PbUserRestApiService } from '../user-rest-api-service/user-rest-api.service';
5
+ /**
6
+ * @internal
7
+ */
8
+ export default class PaidUsersImageUploaderServiceService extends PbUserImageUploaderService {
9
+ private matDialog;
10
+ private userMiddleware;
11
+ private userRestApi;
12
+ constructor(matDialog: MatDialog, userMiddleware: PbUserMiddlewaresService, userRestApi: PbUserRestApiService);
13
+ browse$(): import("rxjs").Observable<string>;
14
+ }
@@ -0,0 +1,28 @@
1
+ import { ElementRef, OnDestroy } from '@angular/core';
2
+ import { DomSanitizer } from '@angular/platform-browser';
3
+ import { Subject } from 'rxjs';
4
+ import { MatBottomSheetRef } from '@angular/material/bottom-sheet';
5
+ import { PbEmailBuilderService } from '../../../pb-email-builder.service';
6
+ import { PbUserMiddlewaresService } from '../../user-middleware-service/pb-middlewares.service';
7
+ import { PbUserInterfaceService } from '../../internals/user-interfaces/user-interface.service';
8
+ import { PbUserRestApiService } from '../../user-rest-api-service/user-rest-api.service';
9
+ export declare class UploadBottomSheetDialogComponent implements OnDestroy {
10
+ private sanitizer;
11
+ private ngb;
12
+ private userRestApi;
13
+ private userInterface;
14
+ private middlewares;
15
+ private bottomSheetRef;
16
+ uploadInput: ElementRef<HTMLInputElement>;
17
+ choosedImage: File;
18
+ uploading: boolean;
19
+ progress: Subject<number>;
20
+ private objectUrl;
21
+ constructor(sanitizer: DomSanitizer, ngb: PbEmailBuilderService, userRestApi: PbUserRestApiService, userInterface: PbUserInterfaceService, middlewares: PbUserMiddlewaresService, bottomSheetRef: MatBottomSheetRef<UploadBottomSheetDialogComponent>);
22
+ get imageInfo(): string;
23
+ previewLink(): import("@angular/platform-browser").SafeResourceUrl;
24
+ openBrowserModal(event: MouseEvent): void;
25
+ uploadInputChanged(): void;
26
+ private _startUploading;
27
+ ngOnDestroy(): void;
28
+ }
@@ -0,0 +1,27 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { MatDialogRef } from '@angular/material/dialog';
3
+ import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
4
+ import { PbUserRestApiService } from '../../user-rest-api-service/user-rest-api.service';
5
+ import { IForRootConf } from '../../../interfaces/interfaces';
6
+ import { PbUserMiddlewaresService } from '../../user-middleware-service/pb-middlewares.service';
7
+ import { PbUserInterfaceService } from '../../internals/user-interfaces/user-interface.service';
8
+ export declare class UploadImageGalleryComponent implements OnDestroy {
9
+ imageCategoryList: string[];
10
+ private userConfig;
11
+ private matDialogRef;
12
+ private sanitizer;
13
+ private userRestApi;
14
+ private middlewares;
15
+ private userInterface;
16
+ currentMenuItem: 'gallery' | 'upload';
17
+ choseImage: string;
18
+ uploadImagePreview: SafeResourceUrl;
19
+ private imagePreviewObjectUrl;
20
+ private uploadImageFile;
21
+ constructor(imageCategoryList: string[], userConfig: IForRootConf, matDialogRef: MatDialogRef<UploadImageGalleryComponent, string>, sanitizer: DomSanitizer, userRestApi: PbUserRestApiService, middlewares: PbUserMiddlewaresService, userInterface: PbUserInterfaceService);
22
+ changeCurrentMenuItem(item: 'gallery' | 'upload'): void;
23
+ addImageToTemplate(imagePath?: string): void;
24
+ previewImage({ target }: Event): void;
25
+ startUploading(): import("rxjs").Subscription;
26
+ ngOnDestroy(): void;
27
+ }
@@ -0,0 +1,26 @@
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * A service that must be extended in case you want to rewrite the default
4
+ * uploading process. In case you have a Regular License, you'll get a simple upload
5
+ * service, for any other paid Licenses - you get an Image Gallery.
6
+ *
7
+ * It won't work if you have a Regular/Free License - you'll get an error on running the project,
8
+ * you need either an [Extended or Commercial License]{@link https://wlocalhost.org} key for this purpose.
9
+ *
10
+ * @example
11
+ * // Create a custom service
12
+ * class YourOwnUploaderService extends PbUserImageUploaderService {}
13
+ *
14
+ * // Rewrite it into AppModule
15
+ * { provide: PbUserImageUploaderService, useClass: YourOwnUploaderService }
16
+ */
17
+ export declare abstract class PbUserImageUploaderService {
18
+ /**
19
+ * A method called once end user intends to upload an image.
20
+ * It must returns always an `Observable<string>` - where `string` is the uploaded
21
+ * image path.
22
+ *
23
+ * @return Uploaded image path.
24
+ */
25
+ abstract browse$(): Observable<string>;
26
+ }
@@ -0,0 +1,15 @@
1
+ import { Observable } from 'rxjs';
2
+ import { PbUserMiddlewaresService, TExportType } from './pb-middlewares.service';
3
+ import { IUserTemplate } from '../../interfaces/interfaces';
4
+ /**
5
+ * @internal
6
+ */
7
+ export default class FreeUsersMiddleware extends PbUserMiddlewaresService {
8
+ constructor();
9
+ chooseTemplate(): Observable<{
10
+ category: string;
11
+ template: IUserTemplate;
12
+ }>;
13
+ exportFile(type: TExportType): Observable<TExportType>;
14
+ importFile(file: File): Observable<File>;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { PbUserMiddlewaresService } from './pb-middlewares.service';
2
+ /**
3
+ * @internal
4
+ * No limitations are applied for Paid users
5
+ */
6
+ export default class PaidUsersMiddleware extends PbUserMiddlewaresService {
7
+ }
@@ -0,0 +1,3 @@
1
+ import FreeUsersMiddleware from './FreeUsersMiddleware';
2
+ import PaidUsersMiddleware from './PaidUsersMiddleware';
3
+ export { FreeUsersMiddleware, PaidUsersMiddleware };
@@ -0,0 +1,190 @@
1
+ import { HttpErrorResponse } from '@angular/common/http';
2
+ import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
3
+ import { MatButtonToggleChange } from '@angular/material/button-toggle';
4
+ import { Observable } from 'rxjs';
5
+ import { IStructure, IUserTemplate } from '../../interfaces/interfaces';
6
+ import { TBlocks } from '../../classes/Elements';
7
+ import { PBEmail } from '../../classes/DefaultEmail';
8
+ import { TPreviewDevice } from '../../components/preview.component';
9
+ /**
10
+ * Email editor export file types.
11
+ */
12
+ export declare type TExportType = 'html' | 'json' | 'mjml';
13
+ /**
14
+ * Email editor import file types. 'mjml' type is under development - don't use it yet.
15
+ */
16
+ export declare type TImportType = 'json' | 'mjml';
17
+ /**
18
+ * Add new Structure within email body event
19
+ */
20
+ export interface IAddStructureEvent extends CdkDragDrop<Set<IStructure>, Set<IStructure>> {
21
+ item: CdkDrag<IStructure>;
22
+ }
23
+ /**
24
+ * Add new Block within structures' columns event
25
+ */
26
+ export interface IAddBlockEvent extends CdkDragDrop<TBlocks[], TBlocks[]> {
27
+ item: CdkDrag<TBlocks>;
28
+ }
29
+ /**
30
+ * Preview device buttons
31
+ */
32
+ export interface IPreviewToggleButton extends MatButtonToggleChange {
33
+ value: TPreviewDevice;
34
+ }
35
+ /**
36
+ * This service allows you to control all your users' abilities within this builder. Lets say you want to implement user Roles or just
37
+ * need to disable some functionality for certain users based on purchase plan or on something else. You can allow or disallow almost
38
+ * everything.
39
+ *
40
+ * All the methods must return an Observable, so, in my opinion, that's the best part of this service, you can either return an
41
+ * [EMPTY Observable]{@link https://rxjs.dev/api/index/const/EMPTY}, a modified object or an (Info Modal).pipe(mapTo(EMPTY)) - I think you
42
+ * got the idea.
43
+ *
44
+ * I recommend always using a Modal or a Toast for forbidden actions.
45
+ *
46
+ * It won't work if you have a Regular/Free License - you'll get an error on running the project,
47
+ * you need either an [Extended or Commercial License]{@link https://wlocalhost.org} key for this purpose.
48
+ *
49
+ * @example
50
+ * // Create a custom service
51
+ * class YourOwnMiddlewareService extends PbUserMiddlewaresService {}
52
+ *
53
+ * // Rewrite it into AppModule
54
+ * { provide: PbUserMiddlewaresService, useClass: YourOwnMiddlewareService }
55
+ */
56
+ export declare abstract class PbUserMiddlewaresService {
57
+ /**
58
+ * This method is called before sending the request to MJML Convertor. Use it to add some additional blocks or anything else to
59
+ * the PBEmail object.
60
+ * @param email PBEmail object that's being sent to MJML Convertor.
61
+ */
62
+ createHTMLTemplate(email: PBEmail): Observable<PBEmail>;
63
+ /**
64
+ * Allow or Disallow preview window.
65
+ * @param state Coming Preview state
66
+ */
67
+ togglePreview(state: boolean): Observable<boolean>;
68
+ /**
69
+ * Allow or Disallow preview devices.
70
+ * @param button Device's button that has been clicked
71
+ */
72
+ togglePreviewDevice(button: IPreviewToggleButton): Observable<TPreviewDevice>;
73
+ /**
74
+ * Allow or disallow users to select certain templates based either on category or template object.
75
+ * @param category Template's category user has selected
76
+ * @param template Template user has selected
77
+ */
78
+ chooseTemplate(category: string, template: IUserTemplate): Observable<{
79
+ category: string;
80
+ template: IUserTemplate;
81
+ }>;
82
+ /**
83
+ * Allow, disallow or return the same path for all user's uploaded images.
84
+ * @param path Path of uploaded image
85
+ *
86
+ * @TODO Check if this middleware is being called before image has been uploaded
87
+ */
88
+ uploadImage(path: string): Observable<string>;
89
+ /**
90
+ * Allow or disallow users to add blocks within email structures.
91
+ * @param event Event of dropped block
92
+ * @param column Column that block has been dropped
93
+ *
94
+ * @TODO add parent structure as a parameter
95
+ */
96
+ addBlock(event: IAddBlockEvent, column: TBlocks[]): Observable<{
97
+ column: TBlocks[];
98
+ event: IAddBlockEvent;
99
+ }>;
100
+ /**
101
+ * Prevent user to edit blocks within email body.
102
+ * @param block Block that user intends to edit
103
+ */
104
+ editBlock(block: TBlocks): Observable<TBlocks>;
105
+ /**
106
+ * Prevent user to remove blocks within email body.
107
+ * @param index Block's Index
108
+ * @param column Block's parent column
109
+ * @param block Block that user intends to remove
110
+ */
111
+ removeBlock(index: number, column: TBlocks[], block: TBlocks): Observable<{
112
+ index: number;
113
+ column: TBlocks[];
114
+ }>;
115
+ /**
116
+ * Prevent user to duplicate blocks within email body.
117
+ * @param index Block's Index
118
+ * @param column Block's parent column
119
+ * @param block Block that user intends to duplicate
120
+ */
121
+ duplicateBlock(index: number, column: TBlocks[], block: TBlocks): Observable<{
122
+ index: number;
123
+ column: TBlocks[];
124
+ block: TBlocks;
125
+ }>;
126
+ /**
127
+ * Disable Drag and Drop certain blocks from Blocks list to Email body.
128
+ * Return TRUE to disable all blocks - no matter on block's data.
129
+ * @param block Block to allow or disallow from being dragged
130
+ */
131
+ disableBlockDragFromList(block: TBlocks): Observable<boolean>;
132
+ /**
133
+ * Prevent users to sort blocks within email body.
134
+ * @param block Block that user intends to change the order
135
+ */
136
+ disableBlockDragWithinEmailBody(block: TBlocks): Observable<boolean>;
137
+ /**
138
+ * Prevent user to add new structure.
139
+ * @param event Event of dropped structure
140
+ */
141
+ addStructure(event: IAddStructureEvent): Observable<IAddStructureEvent>;
142
+ /**
143
+ * Prevent user to edit the structure.
144
+ * @param structure Structure that user intends to edit
145
+ */
146
+ editStructure(structure: IStructure): Observable<IStructure>;
147
+ /**
148
+ * Prevent user to remove the structure.
149
+ * @param index Index of the structure
150
+ * @param structure Structure that user intends to remove
151
+ */
152
+ removeStructure(index: number, structure: IStructure): Observable<number>;
153
+ /**
154
+ * Prevent user to duplicate the structure within email body.
155
+ * @param index Index of structure
156
+ * @param structure Structure that user intends to duplicate
157
+ */
158
+ duplicateStructure(index: number, structure: IStructure): Observable<number>;
159
+ /**
160
+ * Disable Drag and Drop certain structures from Structures list to Email body.
161
+ * Return TRUE to disable all structures.
162
+ * @param structure Structure to prevent from being dragged
163
+ */
164
+ disableStructureDragFromList(structure: IStructure): Observable<boolean>;
165
+ /**
166
+ * Allow or disallow users to sort structures within email body.
167
+ * @param structure Structure that user intends to change the order
168
+ */
169
+ disableStructureDragWithinEmailBody(structure: IStructure): Observable<boolean>;
170
+ /**
171
+ * I don't know why would you do that, but you can disable OnExit confirm modal.
172
+ * @param event Window [BeforeUnloadEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/BeforeUnloadEvent}
173
+ */
174
+ preventWindowExit(event: BeforeUnloadEvent): Observable<BeforeUnloadEvent>;
175
+ /**
176
+ * Allow or disallow user to export certain types of file
177
+ * @param type Type that user intends to download
178
+ */
179
+ exportFile(type: TExportType): Observable<TExportType>;
180
+ /**
181
+ * Allow or disallow user to import certain types of file
182
+ * @param file Web APIs [FILE]{@link https://developer.mozilla.org/en-US/docs/Web/API/File}
183
+ */
184
+ importFile(file: File): Observable<File>;
185
+ /**
186
+ * Catch all errors within email editor, it might not work 100%, it's still on working process.
187
+ * @param error Throwable Error
188
+ */
189
+ catchError(error: Error | HttpErrorResponse): Observable<Error | HttpErrorResponse>;
190
+ }
@@ -0,0 +1,10 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { PbUserRestApiService } from './user-rest-api.service';
3
+ /**
4
+ * @internal
5
+ * The free User Rest API service for Regular license.
6
+ * No differences between other licenses for now, but might be in the future.
7
+ */
8
+ export default class FreeUsersRestApi extends PbUserRestApiService {
9
+ constructor(http: HttpClient);
10
+ }
@@ -0,0 +1,2 @@
1
+ import FreeUsersRestApi from './free-users-rest-api.service';
2
+ export { FreeUsersRestApi };
@@ -0,0 +1,82 @@
1
+ import { HttpClient, HttpEvent } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { IMjmlServerResponse, IUserModule, IUserTemplate, IUserTemplateCategory } from '../../interfaces/interfaces';
4
+ import { PBEmail } from '../../classes/DefaultEmail';
5
+ /**
6
+ * Add Google Fonts list to PBEmail object to include into template.
7
+ * MJML Convertor will filter and remove fonts that aren't used.
8
+ */
9
+ export interface IEmailAndGoogleFonts extends PBEmail {
10
+ googleFonts: string[];
11
+ }
12
+ /**
13
+ * The abstract service that must extend the user's custom REST API service.
14
+ * Contains all required properties needed within project.
15
+ *
16
+ * Rewrite the default methods/properties to get the desired data.
17
+ * We recommend using `shareReplay()` operator if it's just a simple static data.
18
+ *
19
+ * @example
20
+ * // Create a custom service
21
+ * class YourOwnRestApiService extends PbUserRestApiService {}
22
+ *
23
+ * // Rewrite it into AppModule
24
+ * { provide: PbUserRestApiService, useClass: YourOwnRestApiService }
25
+ */
26
+ export declare abstract class PbUserRestApiService {
27
+ http: HttpClient;
28
+ /**
29
+ * Get all user merge fields to inject into text editor.
30
+ */
31
+ getAllUserMergeFields$: Observable<string[]>;
32
+ /**
33
+ * Get all Custom Modules to be included into Modules List.
34
+ * We're looking for someone who could create many modules to be included by default, if you feel you can help us, please leave a message!
35
+ */
36
+ getAllUserModules$: Observable<IUserModule[]>;
37
+ /**
38
+ * Get all Predefined Templates and categories.
39
+ * You can leave it to get all default templates from NGB API
40
+ */
41
+ getAllUserTemplates$: Observable<IUserTemplateCategory[]>;
42
+ constructor(http: HttpClient);
43
+ /**
44
+ * This method must return the chosen template from Template Gallery List PBEmail object,
45
+ * see {@link PbUserRestApiService#getAllUserTemplates$|getAllUserTemplates$}.
46
+ *
47
+ * Sometimes it can contain 'templateData' property - in this case, just return it.
48
+ *
49
+ * @param category Selected Category from Template Gallery.
50
+ * @param template Selected Template from Template Gallery.
51
+ *
52
+ * @example
53
+ * if (template.templateData) { return template }
54
+ */
55
+ getUserTemplateData$(category: string, template: IUserTemplate): Observable<IUserTemplate>;
56
+ /**
57
+ * Handle all uploaded images.
58
+ * FormData 'csrf' is deprecated in favor of [HttpClientXsrfModule]{@link https://angular.io/api/common/http/HttpClientXsrfModule}.
59
+ *
60
+ * @param body A FormData that contains 'image' and 'csrf' data.
61
+ * @param uploadImagePath Define a path where NGB have to send the upload request.
62
+ */
63
+ userImageUpload$(body: FormData, uploadImagePath: string): Observable<HttpEvent<{
64
+ success: boolean;
65
+ path: string;
66
+ message?: string;
67
+ }>>;
68
+ /**
69
+ * Get all images to include into Image Gallery.
70
+ */
71
+ getUserImages$(): Observable<string[]>;
72
+ /**
73
+ * Rewrite the default request which converts PBEmail to HTML, if you have a paid License,
74
+ * this method allows you to rewrite the default Convertor API Path to yours.
75
+ *
76
+ * You can still use the default Convertor API Path, since you have a valid and active License Key.
77
+ *
78
+ * @param emailAndFonts PBEmail plus Google Fonts List object.
79
+ * @param url Your own Convertor API Path, or leave it empty to use NGB servers.
80
+ */
81
+ createHTMLTemplate$(emailAndFonts: IEmailAndGoogleFonts, url?: string): Observable<IMjmlServerResponse>;
82
+ }
@@ -0,0 +1,5 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const LIBRARY_IS_PRO: InjectionToken<boolean>;