@solidpepper/solidpepper-service 1.0.4 → 1.0.6

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.
@@ -99,7 +99,13 @@ class SettingsService {
99
99
  year: '2019',
100
100
  };
101
101
  }
102
+ setToken(token) {
103
+ this.customToken = token;
104
+ }
102
105
  getToken() {
106
+ if (this.customToken) {
107
+ return this.customToken;
108
+ }
103
109
  if (this.tokenGetter) {
104
110
  return this.tokenGetter();
105
111
  }
@@ -132,11 +138,14 @@ class SettingsService {
132
138
  getHeaders() {
133
139
  let token = this.getToken();
134
140
  let language = this.getLanguage();
135
- this.headers = {
136
- Authorization: 'Bearer ' + token,
141
+ let headersObj = {
137
142
  'Content-Type': 'application/json',
138
143
  'Accept-Language': language,
139
144
  };
145
+ if (token && token !== 'undefined' && token !== 'null') {
146
+ headersObj['Authorization'] = 'Bearer ' + token;
147
+ }
148
+ this.headers = headersObj;
140
149
  return this.headers;
141
150
  }
142
151
  getPrimoTexto(name) {
@@ -6438,7 +6447,7 @@ class UsersService {
6438
6447
  /* ========================================================================
6439
6448
  CREATE
6440
6449
  ======================================================================== */
6441
- createUser(login, password, profileguid, language, active, email) {
6450
+ createUser(login, password, profileguid, language, active, email, firstName = '', lastName = '') {
6442
6451
  let headers = this._settingsService.getHeaders();
6443
6452
  let options = { headers: headers };
6444
6453
  return this.http.post(this._settingsService.getSettings('apiUrl') + 'Users', {
@@ -6448,6 +6457,8 @@ class UsersService {
6448
6457
  userLanguage: language,
6449
6458
  userIsActive: active,
6450
6459
  userEmail: email,
6460
+ userFirstName: firstName,
6461
+ userLastName: lastName,
6451
6462
  }, options);
6452
6463
  }
6453
6464
  uploadProfilePicture(formData, login) {
@@ -9909,6 +9920,45 @@ class Document {
9909
9920
  }
9910
9921
  }
9911
9922
 
9923
+ class DocumentCommentService {
9924
+ constructor(http, settingsService) {
9925
+ this.http = http;
9926
+ this.settingsService = settingsService;
9927
+ }
9928
+ getAliasQuery() {
9929
+ const alias = this.settingsService.getSettings('alias') || this.settingsService.getAppSetting('alias');
9930
+ return alias ? `?alias=${alias}` : '';
9931
+ }
9932
+ getComments(documentGuid) {
9933
+ const headers = this.settingsService.getHeaders();
9934
+ const apiUrl = this.settingsService.getSettings('apiUrl');
9935
+ return this.http.get(`${apiUrl}dam/documents/${documentGuid}/comments${this.getAliasQuery()}`, { headers });
9936
+ }
9937
+ addComment(comment) {
9938
+ const headers = this.settingsService.getHeaders();
9939
+ const apiUrl = this.settingsService.getSettings('apiUrl');
9940
+ return this.http.post(`${apiUrl}dam/documents/comments${this.getAliasQuery()}`, comment, { headers });
9941
+ }
9942
+ deleteComment(commentGuid) {
9943
+ const headers = this.settingsService.getHeaders();
9944
+ const apiUrl = this.settingsService.getSettings('apiUrl');
9945
+ return this.http.delete(`${apiUrl}dam/documents/comments/${commentGuid}${this.getAliasQuery()}`, { headers });
9946
+ }
9947
+ updateComment(commentGuid, updates) {
9948
+ const headers = this.settingsService.getHeaders();
9949
+ const apiUrl = this.settingsService.getSettings('apiUrl');
9950
+ return this.http.put(`${apiUrl}dam/documents/comments/${commentGuid}${this.getAliasQuery()}`, updates, { headers });
9951
+ }
9952
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: DocumentCommentService, deps: [{ token: i1.HttpClient }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
9953
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: DocumentCommentService, providedIn: 'root' }); }
9954
+ }
9955
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: DocumentCommentService, decorators: [{
9956
+ type: Injectable,
9957
+ args: [{
9958
+ providedIn: 'root'
9959
+ }]
9960
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: SettingsService }] });
9961
+
9912
9962
  class StripeService {
9913
9963
  constructor(http, _settingsService) {
9914
9964
  this.http = http;
@@ -9959,5 +10009,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
9959
10009
  * Generated bundle index. Do not edit.
9960
10010
  */
9961
10011
 
9962
- export { AccountsService, AttributesService, AuthService, CategoriesService, CompaniesService, CompanyService, CompletenessService, DEFAULT_PUBLICATION_STR, DEFAULT_TEMPLATEGUID, DamAssetsProfilesService, DamAssetsSelectionsService, DamAssetsService, Document, DocumentsService, EasypiechartDirective, ExportsService, FrameworkagreementsService, GenerationService, LocaleNumberPipe, LoginService, MasksService, MediaSelectionService, MenuService, NotificationServiceService, PricesTaxService, ProductSheetsService, Publication, PublicationBreak, PublicationData, PublicationDataType, PublicationPage, PublicationTemplate, PublicationsService, PublicationsTemplatesService, RightsService, SOLIDPEPPER_API_URL, SOLIDPEPPER_TOKEN_GETTER, SearchService, SettingsService, SidebarRightService, SkusService, StatusService, StripeService, SuppliersService, TeamsService, Template, TemplatesService, ThumbnailService, TimeElapsedPipe, TranslateService, TranslatorService, UsersService, ViewsService, WorkflowsDesksService, WorkflowsHistoricalService, websocketService };
10012
+ export { AccountsService, AttributesService, AuthService, CategoriesService, CompaniesService, CompanyService, CompletenessService, DEFAULT_PUBLICATION_STR, DEFAULT_TEMPLATEGUID, DamAssetsProfilesService, DamAssetsSelectionsService, DamAssetsService, Document, DocumentCommentService, DocumentsService, EasypiechartDirective, ExportsService, FrameworkagreementsService, GenerationService, LocaleNumberPipe, LoginService, MasksService, MediaSelectionService, MenuService, NotificationServiceService, PricesTaxService, ProductSheetsService, Publication, PublicationBreak, PublicationData, PublicationDataType, PublicationPage, PublicationTemplate, PublicationsService, PublicationsTemplatesService, RightsService, SOLIDPEPPER_API_URL, SOLIDPEPPER_TOKEN_GETTER, SearchService, SettingsService, SidebarRightService, SkusService, StatusService, StripeService, SuppliersService, TeamsService, Template, TemplatesService, ThumbnailService, TimeElapsedPipe, TranslateService, TranslatorService, UsersService, ViewsService, WorkflowsDesksService, WorkflowsHistoricalService, websocketService };
9963
10013
  //# sourceMappingURL=solidpepper-solidpepper-service.mjs.map