@pobuca/email-builder 1.0.1 → 1.1.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 (135) hide show
  1. package/README.md +1 -1
  2. package/bundles/pobuca-email-builder.umd.js +4464 -4414
  3. package/bundles/pobuca-email-builder.umd.js.map +1 -1
  4. package/bundles/pobuca-email-builder.umd.min.js +1 -1
  5. package/bundles/pobuca-email-builder.umd.min.js.map +1 -1
  6. package/esm2015/lib/classes/DefaultEmail.js +54 -53
  7. package/esm2015/lib/classes/Elements.js +229 -229
  8. package/esm2015/lib/classes/Structure.js +89 -89
  9. package/esm2015/lib/components/block/block.component.js +89 -89
  10. package/esm2015/lib/components/block-settings/block-settings.component.js +53 -53
  11. package/esm2015/lib/components/builder-container/builder-container.component.js +114 -114
  12. package/esm2015/lib/components/dialog.component.js +30 -30
  13. package/esm2015/lib/components/general-settings/general-settings.component.js +25 -25
  14. package/esm2015/lib/components/import-dialog/import-dialog.component.js +62 -62
  15. package/esm2015/lib/components/preview.component.js +89 -89
  16. package/esm2015/lib/components/structure/structure.component.js +163 -163
  17. package/esm2015/lib/components/structure-settings/structure-settings.component.js +31 -31
  18. package/esm2015/lib/components/template-list-dialog/template-list-dialog.component.js +45 -45
  19. package/esm2015/lib/directives/dynamic-component.directive.js +46 -46
  20. package/esm2015/lib/elements/abstract-block.js +23 -23
  21. package/esm2015/lib/elements/button/button.component.js +29 -29
  22. package/esm2015/lib/elements/divider/divider.component.js +30 -30
  23. package/esm2015/lib/elements/image/image.component.js +54 -54
  24. package/esm2015/lib/elements/social/social.component.js +42 -42
  25. package/esm2015/lib/elements/spacer/spacer.component.js +30 -30
  26. package/esm2015/lib/elements/text-element/text-element.component.js +80 -80
  27. package/esm2015/lib/groups/align.js +79 -79
  28. package/esm2015/lib/groups/back-repeat.js +55 -55
  29. package/esm2015/lib/groups/border.js +102 -102
  30. package/esm2015/lib/groups/color.js +139 -139
  31. package/esm2015/lib/groups/direction.js +63 -63
  32. package/esm2015/lib/groups/font-styles.js +127 -112
  33. package/esm2015/lib/groups/gaps.js +45 -45
  34. package/esm2015/lib/groups/line-height.js +68 -68
  35. package/esm2015/lib/groups/link.js +67 -67
  36. package/esm2015/lib/groups/margin.js +45 -45
  37. package/esm2015/lib/groups/padding.js +53 -53
  38. package/esm2015/lib/groups/upload-image.js +112 -112
  39. package/esm2015/lib/groups/width-height.js +94 -94
  40. package/esm2015/lib/interceptors/pb-interceptor.interceptor.js +51 -51
  41. package/esm2015/lib/interfaces/interfaces.js +13 -13
  42. package/esm2015/lib/pb-email-builder.component.js +258 -246
  43. package/esm2015/lib/pb-email-builder.module.js +291 -291
  44. package/esm2015/lib/pb-email-builder.service.js +134 -134
  45. package/esm2015/lib/pipes/slugify.pipe.js +39 -39
  46. package/esm2015/lib/services/internals/pb-email-object-store/pb-email-object-store.service.js +175 -165
  47. package/esm2015/lib/services/internals/user-interfaces/user-interface.service.js +122 -122
  48. package/esm2015/lib/services/pb-storage/FreeUsersStorage.class.js +11 -11
  49. package/esm2015/lib/services/pb-storage/index.js +7 -7
  50. package/esm2015/lib/services/pb-storage/pb-storage.service.js +79 -79
  51. package/esm2015/lib/services/user-image-uploader-service/free-users-image-uploader.service.js +26 -26
  52. package/esm2015/lib/services/user-image-uploader-service/index.js +8 -8
  53. package/esm2015/lib/services/user-image-uploader-service/paid-users-image-uploader.service.js +30 -30
  54. package/esm2015/lib/services/user-image-uploader-service/upload-bottom-sheet-dialog/upload-bottom-sheet-dialog.component.js +112 -112
  55. package/esm2015/lib/services/user-image-uploader-service/upload-image-gallery/upload-image-gallery.component.js +91 -91
  56. package/esm2015/lib/services/user-image-uploader-service/user-image-uploader.service.js +26 -26
  57. package/esm2015/lib/services/user-middleware-service/FreeUsersMiddleware.js +31 -31
  58. package/esm2015/lib/services/user-middleware-service/PaidUsersMiddleware.js +12 -12
  59. package/esm2015/lib/services/user-middleware-service/index.js +8 -8
  60. package/esm2015/lib/services/user-middleware-service/pb-middlewares.service.js +195 -195
  61. package/esm2015/lib/services/user-rest-api-service/free-users-rest-api.service.js +16 -16
  62. package/esm2015/lib/services/user-rest-api-service/index.js +7 -7
  63. package/esm2015/lib/services/user-rest-api-service/user-rest-api.service.js +116 -116
  64. package/esm2015/lib/tokens/private-tokens.js +17 -17
  65. package/esm2015/lib/tokens/tokens.js +159 -159
  66. package/esm2015/lib/utils.js +147 -147
  67. package/esm2015/pobuca-email-builder.js +42 -42
  68. package/esm2015/public_api.js +26 -26
  69. package/fesm2015/pobuca-email-builder.js +4206 -4168
  70. package/fesm2015/pobuca-email-builder.js.map +1 -1
  71. package/lib/classes/DefaultEmail.d.ts +10 -9
  72. package/lib/classes/Elements.d.ts +62 -62
  73. package/lib/classes/Structure.d.ts +11 -11
  74. package/lib/components/block/block.component.d.ts +25 -25
  75. package/lib/components/block-settings/block-settings.component.d.ts +18 -18
  76. package/lib/components/builder-container/builder-container.component.d.ts +36 -36
  77. package/lib/components/dialog.component.d.ts +10 -10
  78. package/lib/components/general-settings/general-settings.component.d.ts +6 -6
  79. package/lib/components/import-dialog/import-dialog.component.d.ts +16 -16
  80. package/lib/components/preview.component.d.ts +18 -18
  81. package/lib/components/structure/structure.component.d.ts +43 -43
  82. package/lib/components/structure-settings/structure-settings.component.d.ts +9 -9
  83. package/lib/components/template-list-dialog/template-list-dialog.component.d.ts +15 -15
  84. package/lib/directives/dynamic-component.directive.d.ts +13 -13
  85. package/lib/elements/abstract-block.d.ts +8 -8
  86. package/lib/elements/button/button.component.d.ts +18 -18
  87. package/lib/elements/divider/divider.component.d.ts +10 -10
  88. package/lib/elements/image/image.component.d.ts +19 -19
  89. package/lib/elements/social/social.component.d.ts +21 -21
  90. package/lib/elements/spacer/spacer.component.d.ts +5 -5
  91. package/lib/elements/text-element/text-element.component.d.ts +52 -52
  92. package/lib/groups/align.d.ts +17 -17
  93. package/lib/groups/back-repeat.d.ts +8 -8
  94. package/lib/groups/border.d.ts +13 -13
  95. package/lib/groups/color.d.ts +26 -26
  96. package/lib/groups/direction.d.ts +13 -13
  97. package/lib/groups/font-styles.d.ts +21 -17
  98. package/lib/groups/gaps.d.ts +7 -7
  99. package/lib/groups/line-height.d.ts +12 -12
  100. package/lib/groups/link.d.ts +11 -11
  101. package/lib/groups/margin.d.ts +8 -8
  102. package/lib/groups/padding.d.ts +8 -8
  103. package/lib/groups/upload-image.d.ts +19 -19
  104. package/lib/groups/width-height.d.ts +19 -19
  105. package/lib/interceptors/pb-interceptor.interceptor.d.ts +10 -10
  106. package/lib/interfaces/interfaces.d.ts +430 -422
  107. package/lib/pb-email-builder.component.d.ts +67 -67
  108. package/lib/pb-email-builder.module.d.ts +51 -51
  109. package/lib/pb-email-builder.service.d.ts +83 -83
  110. package/lib/pipes/slugify.pipe.d.ts +9 -9
  111. package/lib/services/internals/pb-email-object-store/pb-email-object-store.service.d.ts +50 -50
  112. package/lib/services/internals/user-interfaces/user-interface.service.d.ts +46 -46
  113. package/lib/services/pb-storage/FreeUsersStorage.class.d.ts +6 -6
  114. package/lib/services/pb-storage/index.d.ts +2 -2
  115. package/lib/services/pb-storage/pb-storage.service.d.ts +54 -54
  116. package/lib/services/user-image-uploader-service/free-users-image-uploader.service.d.ts +12 -12
  117. package/lib/services/user-image-uploader-service/index.d.ts +3 -3
  118. package/lib/services/user-image-uploader-service/paid-users-image-uploader.service.d.ts +14 -14
  119. package/lib/services/user-image-uploader-service/upload-bottom-sheet-dialog/upload-bottom-sheet-dialog.component.d.ts +28 -28
  120. package/lib/services/user-image-uploader-service/upload-image-gallery/upload-image-gallery.component.d.ts +27 -27
  121. package/lib/services/user-image-uploader-service/user-image-uploader.service.d.ts +26 -26
  122. package/lib/services/user-middleware-service/FreeUsersMiddleware.d.ts +15 -15
  123. package/lib/services/user-middleware-service/PaidUsersMiddleware.d.ts +7 -7
  124. package/lib/services/user-middleware-service/index.d.ts +3 -3
  125. package/lib/services/user-middleware-service/pb-middlewares.service.d.ts +190 -190
  126. package/lib/services/user-rest-api-service/free-users-rest-api.service.d.ts +10 -10
  127. package/lib/services/user-rest-api-service/index.d.ts +2 -2
  128. package/lib/services/user-rest-api-service/user-rest-api.service.d.ts +82 -82
  129. package/lib/tokens/private-tokens.d.ts +5 -5
  130. package/lib/tokens/tokens.d.ts +70 -70
  131. package/lib/utils.d.ts +88 -88
  132. package/package.json +8 -3
  133. package/pobuca-email-builder.d.ts +42 -42
  134. package/pobuca-email-builder.metadata.json +1 -1
  135. package/public_api.d.ts +16 -16
@@ -1,190 +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
- }
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
+ }
@@ -1,10 +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
- }
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
+ }
@@ -1,2 +1,2 @@
1
- import FreeUsersRestApi from './free-users-rest-api.service';
2
- export { FreeUsersRestApi };
1
+ import FreeUsersRestApi from './free-users-rest-api.service';
2
+ export { FreeUsersRestApi };
@@ -1,82 +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
- }
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
+ }
@@ -1,5 +1,5 @@
1
- import { InjectionToken } from '@angular/core';
2
- /**
3
- * @internal
4
- */
5
- export declare const LIBRARY_IS_PRO: InjectionToken<boolean>;
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const LIBRARY_IS_PRO: InjectionToken<boolean>;