@rolatech/angular-services 20.0.2-beta.2 → 20.0.3

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.
@@ -5,7 +5,7 @@ import * as i1 from '@angular/material/button';
5
5
  import { MatButtonModule } from '@angular/material/button';
6
6
  import { switchMap, map, take, BehaviorSubject, Observable, Subject, firstValueFrom } from 'rxjs';
7
7
  import _ from 'lodash';
8
- import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
8
+ import { HttpClient, HttpParams, HTTP_INTERCEPTORS } from '@angular/common/http';
9
9
  import { APP_CONFIG } from '@rolatech/angular-common';
10
10
  import { Location, isPlatformBrowser } from '@angular/common';
11
11
  import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
@@ -126,11 +126,6 @@ class BaseService {
126
126
  withCredentials: true,
127
127
  });
128
128
  }
129
- search(word, withCredentials = true) {
130
- return this.http.get(`${this.actionUrl}?search=${word}`, {
131
- withCredentials,
132
- });
133
- }
134
129
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: BaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
135
130
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: BaseService, providedIn: 'root' });
136
131
  }
@@ -1870,6 +1865,9 @@ class PropertyService extends BaseService {
1870
1865
  withCredentials: true,
1871
1866
  });
1872
1867
  }
1868
+ getHighlights(id) {
1869
+ return this.http.get(`${this.actionUrl}/${id}/highlights`, { withCredentials: false });
1870
+ }
1873
1871
  findFeatures(id) {
1874
1872
  return this.http.get(`${this.actionUrl}/${id}/features`, { withCredentials: false });
1875
1873
  }
@@ -1882,18 +1880,23 @@ class PropertyService extends BaseService {
1882
1880
  updateAgent(id, data) {
1883
1881
  return this.http.post(`${this.actionUrl}/${id}/agents`, data, { withCredentials: true });
1884
1882
  }
1885
- // Video tour
1886
- getVideoTour(id) {
1887
- return this.http.get(`${this.actionUrl}/${id}/video-tour`, { withCredentials: true });
1883
+ // Videos
1884
+ getVideos(id) {
1885
+ return this.http.get(`${this.actionUrl}/${id}/videos`, { withCredentials: true });
1888
1886
  }
1889
- addVideoTour(id, data) {
1890
- return this.http.post(`${this.actionUrl}/${id}/video-tour`, data, { withCredentials: true });
1887
+ addVideo(id, data) {
1888
+ return this.http.post(`${this.actionUrl}/${id}/videos`, data, { withCredentials: true });
1891
1889
  }
1892
- updateVideoTour(id, data) {
1893
- return this.http.put(`${this.actionUrl}/${id}/video-tour`, data, { withCredentials: true });
1890
+ updateVideo(id, videoId, data) {
1891
+ return this.http.put(`${this.actionUrl}/${id}/videos/${videoId}`, data, { withCredentials: true });
1894
1892
  }
1895
- deleteVideoTour(id, videoTourId) {
1896
- return this.http.delete(`${this.actionUrl}/${id}/video-tour/${videoTourId}`, { withCredentials: true });
1893
+ deleteVideo(id, videoId) {
1894
+ return this.http.delete(`${this.actionUrl}/${id}/videos/${videoId}`, { withCredentials: true });
1895
+ }
1896
+ uploadVideoThumbnail(videoId, data) {
1897
+ return this.http.post(`${this.actionUrl}/videos/${videoId}/thumbnail`, data, {
1898
+ withCredentials: true,
1899
+ });
1897
1900
  }
1898
1901
  // Tenants
1899
1902
  findTenants(options) {
@@ -1912,34 +1915,47 @@ class PropertyService extends BaseService {
1912
1915
  return this.http.delete(`${this.actionUrl}/tenants/${id}`, { withCredentials: true });
1913
1916
  }
1914
1917
  //COS
1915
- uploadVideoTourInit(propertyId, data) {
1916
- return this.http.post(`${this.actionUrl}/${propertyId}/video-tour/init`, data, {
1918
+ uploadVideosInit(propertyId, data) {
1919
+ return this.http.post(`${this.actionUrl}/${propertyId}/videos/init`, data, {
1917
1920
  withCredentials: true,
1918
1921
  });
1919
1922
  }
1920
- uploadVideoTourPartsToProperty(propertyId, data) {
1921
- return this.http.post(`${this.actionUrl}/${propertyId}/video-tour/parts`, data, {
1923
+ uploadVideosPartsToProperty(propertyId, data) {
1924
+ return this.http.post(`${this.actionUrl}/${propertyId}/videos/parts`, data, {
1922
1925
  withCredentials: true,
1923
1926
  });
1924
1927
  }
1925
- completePartUpload(propertyId, data) {
1926
- return this.http.put(`${this.actionUrl}/${propertyId}/video-tour/parts`, data, {
1928
+ completePartUpload(videoId, data) {
1929
+ return this.http.put(`${this.actionUrl}/videos/${videoId}/parts`, data, {
1927
1930
  withCredentials: true,
1928
1931
  });
1929
1932
  }
1930
1933
  uploadVideoToProperty(propertyId, data) {
1931
- return this.http.post(`${this.actionUrl}/${propertyId}/video-tour`, data, {
1934
+ return this.http.post(`${this.actionUrl}/${propertyId}/videos`, data, {
1932
1935
  withCredentials: true,
1933
1936
  });
1934
1937
  }
1935
1938
  deletePropertyVideo(propertyId, videoId) {
1936
- return this.http.delete(`${this.actionUrl}/${propertyId}/video-tour/${videoId}`, { withCredentials: true });
1939
+ return this.http.delete(`${this.actionUrl}/${propertyId}/videos/${videoId}`, { withCredentials: true });
1937
1940
  }
1938
1941
  uploadPropertyVideoThumbnail(videoId, data) {
1939
- return this.http.post(`${this.actionUrl}/video-tour/${videoId}/thumbnail`, data, {
1942
+ return this.http.post(`${this.actionUrl}/videos/${videoId}/thumbnail`, data, {
1940
1943
  withCredentials: true,
1941
1944
  });
1942
1945
  }
1946
+ // epc
1947
+ getEpc(id) {
1948
+ return this.http.get(`${this.actionUrl}/${id}/epc`, { withCredentials: false });
1949
+ }
1950
+ addEpc(id, data) {
1951
+ return this.http.post(`${this.actionUrl}/${id}/epc`, data, { withCredentials: true });
1952
+ }
1953
+ updateEpc(id, data) {
1954
+ return this.http.put(`${this.actionUrl}/${id}/epc`, data, { withCredentials: true });
1955
+ }
1956
+ deleteEpc(id) {
1957
+ return this.http.delete(`${this.actionUrl}/${id}/epc`, { withCredentials: true });
1958
+ }
1943
1959
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: PropertyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1944
1960
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: PropertyService, providedIn: 'root' });
1945
1961
  }
@@ -2347,18 +2363,18 @@ class OfferingService extends BaseService {
2347
2363
  updateLocation(id, data) {
2348
2364
  return this.http.post(`${this.actionUrl}/${id}/location`, data, { withCredentials: true });
2349
2365
  }
2350
- // Video tour
2351
- getVideoTour(id) {
2352
- return this.http.get(`${this.actionUrl}/${id}/video-tour`, { withCredentials: true });
2366
+ // Videos
2367
+ getVideos(id) {
2368
+ return this.http.get(`${this.actionUrl}/${id}/videos`, { withCredentials: true });
2353
2369
  }
2354
- addVideoTour(id, data) {
2355
- return this.http.post(`${this.actionUrl}/${id}/video-tour`, data, { withCredentials: true });
2370
+ addVideo(id, data) {
2371
+ return this.http.post(`${this.actionUrl}/${id}/videos`, data, { withCredentials: true });
2356
2372
  }
2357
- updateVideoTour(id, data) {
2358
- return this.http.put(`${this.actionUrl}/${id}/video-tour`, data, { withCredentials: true });
2373
+ updateVideo(id, data) {
2374
+ return this.http.put(`${this.actionUrl}/${id}/videos`, data, { withCredentials: true });
2359
2375
  }
2360
- deleteVideoTour(id, videoTourId, y) {
2361
- return this.http.delete(`${this.actionUrl}/${id}/video-tour/${videoTourId}`, { withCredentials: true });
2376
+ deleteVideo(id, videoId, y) {
2377
+ return this.http.delete(`${this.actionUrl}/${id}/videos/${videoId}`, { withCredentials: true });
2362
2378
  }
2363
2379
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: OfferingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2364
2380
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: OfferingService, providedIn: 'root' });
@@ -2986,6 +3002,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0", ngImpor
2986
3002
  args: [{ providedIn: 'root' }]
2987
3003
  }] });
2988
3004
 
3005
+ class PropertySearchService extends BaseService {
3006
+ init() {
3007
+ this.endpoint = 'properties';
3008
+ super.init();
3009
+ }
3010
+ search1(options) {
3011
+ return this.http.get(`${this.actionUrl}/search`, {
3012
+ params: options,
3013
+ });
3014
+ }
3015
+ search(rawParams) {
3016
+ const params = this.stripUndefined(rawParams);
3017
+ // Decide route: empty filter → DB list; else → Elasticsearch-backed search
3018
+ const isEmpty = this.isEmptyFilter(params);
3019
+ let httpParams = new HttpParams();
3020
+ for (const [k, v] of Object.entries(params)) {
3021
+ if (Array.isArray(v)) {
3022
+ v.forEach((item) => (httpParams = httpParams.append(k, String(item))));
3023
+ }
3024
+ else {
3025
+ httpParams = httpParams.set(k, String(v));
3026
+ }
3027
+ }
3028
+ return isEmpty
3029
+ ? this.http.get(`${this.actionUrl}`, { params: httpParams }) // DB list
3030
+ : this.http.get(`${this.actionUrl}/search`, { params: httpParams }); // ES search
3031
+ }
3032
+ stripUndefined(obj) {
3033
+ const out = {};
3034
+ for (const [k, v] of Object.entries(obj)) {
3035
+ if (v !== undefined && v !== null && !(Array.isArray(v) && v.length === 0) && v !== '') {
3036
+ out[k] = v;
3037
+ }
3038
+ }
3039
+ return out;
3040
+ }
3041
+ isEmptyFilter(params, ignoreKeys = ['page', 'limit', 'sort']) {
3042
+ return Object.entries(params).every(([k, v]) => ignoreKeys.includes(k) || v === undefined || v === null || v === '' || (Array.isArray(v) && v.length === 0));
3043
+ }
3044
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: PropertySearchService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
3045
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: PropertySearchService, providedIn: 'root' });
3046
+ }
3047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0", ngImport: i0, type: PropertySearchService, decorators: [{
3048
+ type: Injectable,
3049
+ args: [{
3050
+ providedIn: 'root',
3051
+ }]
3052
+ }] });
3053
+
2989
3054
  class LoadingInterceptor {
2990
3055
  loadingService;
2991
3056
  activeRequests = 0;
@@ -3080,5 +3145,5 @@ function provideAngularServices() {
3080
3145
  * Generated bundle index. Do not edit.
3081
3146
  */
3082
3147
 
3083
- export { AmenityService, BackButtonDirective, BaseService, BookingService, BreadcrumbService, CartEventType, CartService, CategoryService, ConversationInitService, ConversationService, DialogComponent, DialogService, FacilityService, FeatureService, FulfillmentService, HideFooterDirective, InventoryService, LayoutService, LoadingInterceptor, LoadingService, MediaService, MembershipService, NavigationService, NotificationService, NotificationStore, NotificationTemplateService, OfferingService, OrderPayoutService, OrderService, PaymentService, PostService, ProductCategoryService, ProductService, PropertyService, ResourceCategoryService, ResourceService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, TitleService, provideAngularServices };
3148
+ export { AmenityService, BackButtonDirective, BaseService, BookingService, BreadcrumbService, CartEventType, CartService, CategoryService, ConversationInitService, ConversationService, DialogComponent, DialogService, FacilityService, FeatureService, FulfillmentService, HideFooterDirective, InventoryService, LayoutService, LoadingInterceptor, LoadingService, MediaService, MembershipService, NavigationService, NotificationService, NotificationStore, NotificationTemplateService, OfferingService, OrderPayoutService, OrderService, PaymentService, PostService, ProductCategoryService, ProductService, PropertySearchService, PropertyService, ResourceCategoryService, ResourceService, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, TitleService, provideAngularServices };
3084
3149
  //# sourceMappingURL=rolatech-angular-services.mjs.map