@rolatech/angular-services 20.3.1-beta.3 → 20.3.2-beta.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.
@@ -1806,9 +1806,18 @@ class PropertyService extends BaseService {
1806
1806
  .pipe(map((response) => this.normalizeViewingResponse(response)));
1807
1807
  }
1808
1808
  confirmViewing(viewingId, slotId) {
1809
- return this.http.post(`${this.actionUrl}/viewings/${viewingId}/confirm?slotId=${slotId}`, {}, {
1809
+ return this.http
1810
+ .post(`${this.actionUrl}/viewings/${viewingId}/confirm?slotId=${slotId}`, {}, {
1810
1811
  withCredentials: true,
1811
- });
1812
+ })
1813
+ .pipe(map((response) => this.normalizeViewingResponse(response)));
1814
+ }
1815
+ counterViewing(viewingId, data) {
1816
+ return this.http
1817
+ .post(`${this.actionUrl}/viewings/${viewingId}/counter`, data, {
1818
+ withCredentials: true,
1819
+ })
1820
+ .pipe(map((response) => this.normalizeViewingResponse(response)));
1812
1821
  }
1813
1822
  getViewing(viewingId) {
1814
1823
  return this.http
@@ -1945,6 +1954,18 @@ class PropertyService extends BaseService {
1945
1954
  tenantCategory: viewing.tenantCategory ?? viewing.applicantType ?? null,
1946
1955
  viewerCategory: this.normalizeCode(viewing.viewerCategory),
1947
1956
  status: this.normalizeCode(viewing.status),
1957
+ slotProposalSource: this.normalizeCode(viewing.slotProposalSource ?? viewing.proposedSlotsSource ?? viewing.lastSlotProposalBy ?? viewing.counteredBy),
1958
+ slotDecisionRequired: typeof viewing.slotDecisionRequired === 'boolean'
1959
+ ? viewing.slotDecisionRequired
1960
+ : typeof viewing.requiresSlotAcceptance === 'boolean'
1961
+ ? viewing.requiresSlotAcceptance
1962
+ : null,
1963
+ counteredAt: viewing.counteredAt ?? viewing.slotCounteredAt ?? null,
1964
+ proposedSlots: (Array.isArray(viewing.proposedSlots) ? viewing.proposedSlots : []).map((slot) => ({
1965
+ ...slot,
1966
+ source: this.normalizeCode(slot?.source ?? slot?.slotSource ?? viewing.slotProposalSource ?? null),
1967
+ state: this.normalizeCode(slot?.state ?? slot?.status ?? null),
1968
+ })),
1948
1969
  item: viewing.item ? this.normalizeViewingItem(viewing.item, viewing.property?.media) : viewing.item,
1949
1970
  };
1950
1971
  }
@@ -1957,11 +1978,7 @@ class PropertyService extends BaseService {
1957
1978
  const inheritedMedia = this.normalizeViewingMedia(fallbackMedia);
1958
1979
  return {
1959
1980
  ...item,
1960
- media: media.length > 0
1961
- ? media
1962
- : fallbackUrl
1963
- ? [{ id: '', url: fallbackUrl, alt: item.title ?? '' }]
1964
- : inheritedMedia,
1981
+ media: media.length > 0 ? media : fallbackUrl ? [{ id: '', url: fallbackUrl, alt: item.title ?? '' }] : inheritedMedia,
1965
1982
  };
1966
1983
  }
1967
1984
  normalizeViewingMedia(media) {
@@ -5106,27 +5123,42 @@ class RoleService extends BaseService {
5106
5123
  .get(`${this.actionUrl}/organizations/${orgId}/${id}`)
5107
5124
  .pipe(map((response) => response.data));
5108
5125
  }
5109
- createOrganizationRole(orgId, request) {
5126
+ createOrganizationRole(orgId, request, appId) {
5127
+ if (appId) {
5128
+ return this.createApplicationOrganizationRole(appId, orgId, request);
5129
+ }
5110
5130
  return this.http
5111
5131
  .post(`${this.actionUrl}/organizations/${orgId}`, request)
5112
5132
  .pipe(map((response) => response.data));
5113
5133
  }
5114
- updateOrganizationRole(orgId, id, request) {
5134
+ updateOrganizationRole(orgId, id, request, appId) {
5135
+ if (appId) {
5136
+ return this.updateApplicationOrganizationRole(appId, orgId, id, request);
5137
+ }
5115
5138
  return this.http
5116
5139
  .put(`${this.actionUrl}/organizations/${orgId}/${id}`, request)
5117
5140
  .pipe(map((response) => response.data));
5118
5141
  }
5119
- findOrganizationRolePermissionPage(orgId, id) {
5142
+ findOrganizationRolePermissionPage(orgId, id, appId) {
5143
+ if (appId) {
5144
+ return this.findApplicationOrganizationRolePermissionPage(appId, orgId, id);
5145
+ }
5120
5146
  return this.http
5121
5147
  .get(`${this.actionUrl}/organizations/${orgId}/${id}/permissions`)
5122
5148
  .pipe(map((response) => response.data));
5123
5149
  }
5124
- updateOrganizationRolePermissions(orgId, id, request) {
5150
+ updateOrganizationRolePermissions(orgId, id, request, appId) {
5151
+ if (appId) {
5152
+ return this.updateApplicationOrganizationRolePermissions(appId, orgId, id, request);
5153
+ }
5125
5154
  return this.http
5126
5155
  .put(`${this.actionUrl}/organizations/${orgId}/${id}/permissions`, request)
5127
5156
  .pipe(map((response) => response.data));
5128
5157
  }
5129
- deleteOrganizationRoleById(orgId, id) {
5158
+ deleteOrganizationRoleById(orgId, id, appId) {
5159
+ if (appId) {
5160
+ return this.deleteApplicationOrganizationRoleById(appId, orgId, id);
5161
+ }
5130
5162
  return this.http
5131
5163
  .delete(`${this.actionUrl}/organizations/${orgId}/${id}`)
5132
5164
  .pipe(map((response) => response.data));
@@ -5147,6 +5179,41 @@ class RoleService extends BaseService {
5147
5179
  }
5148
5180
  return params;
5149
5181
  }
5182
+ createApplicationOrganizationRole(appId, orgId, request) {
5183
+ return this.http
5184
+ .post(this.toApplicationOrganizationRoleUrl(appId, orgId), request)
5185
+ .pipe(map((response) => response.data));
5186
+ }
5187
+ updateApplicationOrganizationRole(appId, orgId, id, request) {
5188
+ return this.http
5189
+ .put(this.toApplicationOrganizationRoleUrl(appId, orgId, id), request)
5190
+ .pipe(map((response) => response.data));
5191
+ }
5192
+ findApplicationOrganizationRolePermissionPage(appId, orgId, id) {
5193
+ return this.http
5194
+ .get(this.toApplicationOrganizationRoleUrl(appId, orgId, id, 'permissions'))
5195
+ .pipe(map((response) => response.data));
5196
+ }
5197
+ updateApplicationOrganizationRolePermissions(appId, orgId, id, request) {
5198
+ return this.http
5199
+ .put(this.toApplicationOrganizationRoleUrl(appId, orgId, id, 'permissions'), request)
5200
+ .pipe(map((response) => response.data));
5201
+ }
5202
+ deleteApplicationOrganizationRoleById(appId, orgId, id) {
5203
+ return this.http
5204
+ .delete(this.toApplicationOrganizationRoleUrl(appId, orgId, id))
5205
+ .pipe(map((response) => response.data));
5206
+ }
5207
+ toApplicationOrganizationRoleUrl(appId, orgId, roleId, suffix) {
5208
+ const segments = [this.environment.baseUrl, 'platform', 'applications', appId, 'organizations', orgId, 'roles'];
5209
+ if (roleId) {
5210
+ segments.push(roleId);
5211
+ }
5212
+ if (suffix) {
5213
+ segments.push(suffix);
5214
+ }
5215
+ return segments.join('/');
5216
+ }
5150
5217
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RoleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
5151
5218
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RoleService, providedIn: 'root' });
5152
5219
  }