@messaia/cdk 20.2.3 → 20.2.5

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.
@@ -20013,15 +20013,17 @@ class GenericFormBaseComponent extends BaseComponent {
20013
20013
  * @param errorCallback - A function to be called if an error occurs during loading.
20014
20014
  * This function will receive the error as an argument.
20015
20015
  * @param headers - Optional HTTP headers to include in the request.
20016
+ * @param handleError - Indicates whether to automatically handle and parse errors (default: true).
20017
+ * @param observeResponse - If true, the full HTTP response will be observed instead of just the body (default: false).
20016
20018
  */
20017
- loadItem(successCallback, errorCallback, headers) {
20019
+ loadItem(successCallback, errorCallback, headers, handleError = true, observeResponse = true) {
20018
20020
  if (this.isEditMode && this.service?.endpoint) {
20019
20021
  /* Set loading state to true to indicate that an item is being loaded */
20020
20022
  this.isLoading = true;
20021
20023
  /* Trigger change detection to update the view with the loading state */
20022
20024
  this.changeDetectorRef.detectChanges();
20023
20025
  /* Call the asynchronous method to load the item */
20024
- this.loadItemAsync(headers).subscribe({
20026
+ this.loadItemAsync(headers, handleError, observeResponse).subscribe({
20025
20027
  /* Handle the response when the item is successfully loaded */
20026
20028
  next: (item) => {
20027
20029
  /* Set loading state to false to indicate that loading has completed */
@@ -20049,9 +20051,11 @@ class GenericFormBaseComponent extends BaseComponent {
20049
20051
  * Loads an item by ID asynchronously.
20050
20052
  *
20051
20053
  * @param headers - Optional HTTP headers to include in the request.
20054
+ * @param handleError - Indicates whether to automatically handle and parse errors (default: true).
20055
+ * @param observeResponse - If true, the full HTTP response will be observed instead of just the body (default: false).
20052
20056
  * @returns An Observable of the loaded entity.
20053
20057
  */
20054
- loadItemAsync(headers) {
20058
+ loadItemAsync(headers, handleError = true, observeResponse = true) {
20055
20059
  if (this.id) {
20056
20060
  /* Merge provided headers with default 'Disable-Cache' header */
20057
20061
  const mergedHeaders = Object.assign({ 'Disable-Cache': 'Yes' }, headers || {});
@@ -20060,7 +20064,7 @@ class GenericFormBaseComponent extends BaseComponent {
20060
20064
  includes: this.includes?.length ? this.includes : this.updateIncludes,
20061
20065
  projection: this.projection?.join(','),
20062
20066
  observe: 'response'
20063
- }), mergedHeaders, true, true).pipe(map((response) => {
20067
+ }), mergedHeaders, handleError, observeResponse).pipe(map((response) => {
20064
20068
  /* Read permissions from the http headers */
20065
20069
  const permissions = response?.headers?.get('Permissions')?.split(';') ?? [];
20066
20070
  return {