@rolatech/angular-services 20.3.0-beta.2 → 20.3.0-beta.4

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.
@@ -3888,6 +3888,21 @@ class ApplicationService extends BaseService {
3888
3888
  })
3889
3889
  .pipe(map((response) => this.toOrganizationPage(response.data)));
3890
3890
  }
3891
+ findApplicationMembers(id, options) {
3892
+ return this.http
3893
+ .get(`${this.actionUrl}/${id}/members`, {
3894
+ params: toApiRequestParams(options),
3895
+ withCredentials: true,
3896
+ })
3897
+ .pipe(map((response) => this.toMemberPage(response)));
3898
+ }
3899
+ findApplicationMemberById(id, memberId) {
3900
+ return this.http
3901
+ .get(`${this.actionUrl}/${id}/members/${memberId}`, {
3902
+ withCredentials: true,
3903
+ })
3904
+ .pipe(map((response) => this.toMemberDetail(this.unwrapData(response))));
3905
+ }
3891
3906
  resetOrganizationOwnerPassword(id, organizationId) {
3892
3907
  return this.http
3893
3908
  .post(`${this.actionUrl}/${id}/organizations/${organizationId}/owner/password/reset-request`, {}, {
@@ -3919,6 +3934,151 @@ class ApplicationService extends BaseService {
3919
3934
  total: payload.total ?? payload.items?.length ?? 0,
3920
3935
  };
3921
3936
  }
3937
+ toMemberPage(payload) {
3938
+ if (Array.isArray(payload)) {
3939
+ return {
3940
+ items: payload.map((item) => this.toMemberSummary(item)),
3941
+ total: payload.length,
3942
+ };
3943
+ }
3944
+ const data = this.unwrapData(payload);
3945
+ if (Array.isArray(data)) {
3946
+ return {
3947
+ items: data.map((item) => this.toMemberSummary(item)),
3948
+ total: payload?.meta?.pagination?.count ?? data.length,
3949
+ };
3950
+ }
3951
+ const value = this.asRecord(data);
3952
+ const items = Array.isArray(value['items']) ? value['items'] : [];
3953
+ return {
3954
+ items: items.map((item) => this.toMemberSummary(item)),
3955
+ total: this.readNumber(value['total']) ?? payload?.meta?.pagination?.count ?? items.length,
3956
+ };
3957
+ }
3958
+ toMemberDetail(payload) {
3959
+ const value = this.asRecord(payload);
3960
+ const summary = this.toMemberSummary(payload);
3961
+ return {
3962
+ ...summary,
3963
+ permissions: this.readStringArray(value['permissions']),
3964
+ platformRoles: this.readRoles(value['platformRoles']),
3965
+ applicationRoles: this.readRoles(value['applicationRoles']) ?? summary.roles,
3966
+ organizations: this.readOrganizationMemberships(value['organizations']) ??
3967
+ this.readOrganizationMemberships(value['organizationMemberships']),
3968
+ };
3969
+ }
3970
+ toMemberSummary(payload) {
3971
+ const value = this.asRecord(payload);
3972
+ const firstName = this.readOptionalString(value['firstName']);
3973
+ const lastName = this.readOptionalString(value['lastName']);
3974
+ const derivedFullName = [firstName, lastName].filter((item) => !!item).join(' ').trim();
3975
+ const fullName = this.readOptionalString(value['fullName']) ??
3976
+ (derivedFullName.length > 0 ? derivedFullName : null);
3977
+ const organizations = this.readOrganizationMemberships(value['organizations']) ??
3978
+ this.readOrganizationMemberships(value['organizationMemberships']);
3979
+ return {
3980
+ memberId: this.readString(value['memberId']) || this.readString(value['id']) || this.readString(value['userId']),
3981
+ userId: this.readOptionalString(value['userId']),
3982
+ username: this.readOptionalString(value['username']),
3983
+ name: this.readOptionalString(value['name']) ?? fullName,
3984
+ fullName,
3985
+ firstName,
3986
+ lastName,
3987
+ email: this.readOptionalString(value['email']),
3988
+ phone: this.readOptionalString(value['phone']),
3989
+ status: this.readOptionalString(value['status']),
3990
+ joinedAt: this.readOptionalString(value['joinedAt']) ?? this.readOptionalString(value['createdAt']),
3991
+ roles: this.readRoles(value['roles']) ?? [],
3992
+ organizationCount: this.readNumber(value['organizationCount']) ?? organizations?.length ?? 0,
3993
+ verification: this.readVerification(value),
3994
+ };
3995
+ }
3996
+ readVerification(value) {
3997
+ const verification = this.asRecord(value['verification']);
3998
+ const emailVerified = this.readBoolean(verification['emailVerified']) ?? this.readBoolean(value['emailVerified']);
3999
+ const phoneVerified = this.readBoolean(verification['phoneVerified']) ?? this.readBoolean(value['phoneVerified']);
4000
+ const identityVerified = this.readBoolean(verification['identityVerified']) ??
4001
+ this.readBoolean(value['identityVerified']) ??
4002
+ this.readBoolean(value['kycVerified']);
4003
+ const status = this.readOptionalString(verification['status']) ?? this.readOptionalString(value['verificationStatus']);
4004
+ if (emailVerified === null && phoneVerified === null && identityVerified === null && !status) {
4005
+ return null;
4006
+ }
4007
+ return {
4008
+ emailVerified: emailVerified ?? false,
4009
+ phoneVerified: phoneVerified ?? false,
4010
+ identityVerified: identityVerified ?? false,
4011
+ status,
4012
+ };
4013
+ }
4014
+ readOrganizationMemberships(payload) {
4015
+ if (!Array.isArray(payload)) {
4016
+ return null;
4017
+ }
4018
+ const items = [];
4019
+ for (const item of payload) {
4020
+ const value = this.asRecord(item);
4021
+ const organization = this.asRecord(value['organization']);
4022
+ const orgId = this.readString(value['orgId']) || this.readString(value['id']) || this.readString(organization['id']);
4023
+ if (!orgId) {
4024
+ continue;
4025
+ }
4026
+ items.push({
4027
+ orgId,
4028
+ orgCode: this.readOptionalString(value['orgCode']) ?? this.readOptionalString(organization['code']) ?? undefined,
4029
+ orgName: this.readOptionalString(value['orgName']) ??
4030
+ this.readOptionalString(value['name']) ??
4031
+ this.readOptionalString(organization['name']) ??
4032
+ undefined,
4033
+ roles: this.readRoles(value['roles']) ?? [],
4034
+ });
4035
+ }
4036
+ return items;
4037
+ }
4038
+ readRoles(payload) {
4039
+ if (!Array.isArray(payload)) {
4040
+ return null;
4041
+ }
4042
+ return payload
4043
+ .map((item) => {
4044
+ if (typeof item === 'string') {
4045
+ return item;
4046
+ }
4047
+ const value = this.asRecord(item);
4048
+ return (this.readOptionalString(value['authority']) ??
4049
+ this.readOptionalString(value['code']) ??
4050
+ this.readOptionalString(value['name']) ??
4051
+ null);
4052
+ })
4053
+ .filter((item) => !!item);
4054
+ }
4055
+ readStringArray(payload) {
4056
+ if (!Array.isArray(payload)) {
4057
+ return null;
4058
+ }
4059
+ return payload.filter((item) => typeof item === 'string' && item.length > 0);
4060
+ }
4061
+ readString(value) {
4062
+ return typeof value === 'string' ? value : '';
4063
+ }
4064
+ readOptionalString(value) {
4065
+ return typeof value === 'string' && value.length > 0 ? value : null;
4066
+ }
4067
+ readNumber(value) {
4068
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
4069
+ }
4070
+ readBoolean(value) {
4071
+ return typeof value === 'boolean' ? value : null;
4072
+ }
4073
+ asRecord(value) {
4074
+ return value && typeof value === 'object' ? value : {};
4075
+ }
4076
+ unwrapData(payload) {
4077
+ if (payload && typeof payload === 'object' && 'data' in payload) {
4078
+ return payload.data;
4079
+ }
4080
+ return payload;
4081
+ }
3922
4082
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ApplicationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
3923
4083
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ApplicationService, providedIn: 'root' });
3924
4084
  }
@@ -4788,7 +4948,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
4788
4948
 
4789
4949
  class OrganizationInvitationService extends BaseService {
4790
4950
  init() {
4791
- this.endpoint = 'organizations';
4951
+ this.endpoint = 'platform/organizations';
4792
4952
  super.init();
4793
4953
  }
4794
4954
  findInvitations(orgId) {
@@ -4812,6 +4972,14 @@ class OrganizationInvitationService extends BaseService {
4812
4972
  })
4813
4973
  .pipe(map(() => undefined));
4814
4974
  }
4975
+ acceptInvitation(orgId, token) {
4976
+ return this.http
4977
+ .post(`${this.actionUrl}/${orgId}/invitations/accept`, {}, {
4978
+ params: { token },
4979
+ withCredentials: true,
4980
+ })
4981
+ .pipe(map((response) => response.data));
4982
+ }
4815
4983
  revokeInvitation(orgId, invitationId) {
4816
4984
  return this.http
4817
4985
  .delete(`${this.actionUrl}/${orgId}/invitations/${invitationId}`, {
@@ -4843,7 +5011,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
4843
5011
 
4844
5012
  class OrganizationMemberService extends BaseService {
4845
5013
  init() {
4846
- this.endpoint = 'organizations';
5014
+ this.endpoint = 'platform/organizations';
4847
5015
  super.init();
4848
5016
  }
4849
5017
  findMembers(orgId) {
@@ -4851,21 +5019,21 @@ class OrganizationMemberService extends BaseService {
4851
5019
  .get(`${this.actionUrl}/${orgId}/members`, {
4852
5020
  withCredentials: true,
4853
5021
  })
4854
- .pipe(map((response) => this.toMemberPage(response.data)));
5022
+ .pipe(map((response) => this.toMembers(response.data)));
4855
5023
  }
4856
5024
  findMemberById(orgId, memberId) {
4857
5025
  return this.http
4858
5026
  .get(`${this.actionUrl}/${orgId}/members/${memberId}`, {
4859
5027
  withCredentials: true,
4860
5028
  })
4861
- .pipe(map((response) => response.data));
5029
+ .pipe(map((response) => this.normalizeMember(response.data)));
4862
5030
  }
4863
5031
  updateMemberRoles(orgId, memberId, request) {
4864
5032
  return this.http
4865
5033
  .put(`${this.actionUrl}/${orgId}/members/${memberId}/roles`, request, {
4866
5034
  withCredentials: true,
4867
5035
  })
4868
- .pipe(map((response) => response.data));
5036
+ .pipe(map((response) => this.normalizeMember(response.data)));
4869
5037
  }
4870
5038
  resetMemberPassword(orgId, memberId) {
4871
5039
  return this.http
@@ -4874,16 +5042,16 @@ class OrganizationMemberService extends BaseService {
4874
5042
  })
4875
5043
  .pipe(map(() => undefined));
4876
5044
  }
4877
- toMemberPage(payload) {
5045
+ toMembers(payload) {
4878
5046
  if (Array.isArray(payload)) {
4879
- return {
4880
- items: payload,
4881
- total: payload.length,
4882
- };
5047
+ return payload.map((member) => this.normalizeMember(member));
4883
5048
  }
5049
+ return (payload.items ?? []).map((member) => this.normalizeMember(member));
5050
+ }
5051
+ normalizeMember(member) {
4884
5052
  return {
4885
- items: payload.items ?? [],
4886
- total: payload.total ?? payload.items?.length ?? 0,
5053
+ ...member,
5054
+ roles: member.roles ?? [],
4887
5055
  };
4888
5056
  }
4889
5057
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: OrganizationMemberService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -4995,6 +5163,13 @@ class OnboardingAdminService extends BaseService {
4995
5163
  })
4996
5164
  .pipe(map((response) => response.data));
4997
5165
  }
5166
+ getDocumentPreviewUrl(applicationId, documentId) {
5167
+ return this.http
5168
+ .get(`${this.actionUrl}/${applicationId}/documents/${documentId}/preview-url`, {
5169
+ withCredentials: true,
5170
+ })
5171
+ .pipe(map((response) => response.data));
5172
+ }
4998
5173
  startReview(applicationId) {
4999
5174
  return this.http
5000
5175
  .post(`${this.actionUrl}/${applicationId}/review/start`, {}, {
@@ -5033,6 +5208,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
5033
5208
  }]
5034
5209
  }] });
5035
5210
 
5211
+ class OnboardingDocumentService extends BaseService {
5212
+ init() {
5213
+ this.endpoint = 'onboarding/documents';
5214
+ super.init();
5215
+ }
5216
+ getPreviewUrl(documentId) {
5217
+ return this.http
5218
+ .get(`${this.actionUrl}/${documentId}/preview-url`, {
5219
+ withCredentials: true,
5220
+ })
5221
+ .pipe(map((response) => response.data));
5222
+ }
5223
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: OnboardingDocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
5224
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: OnboardingDocumentService, providedIn: 'root' });
5225
+ }
5226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: OnboardingDocumentService, decorators: [{
5227
+ type: Injectable,
5228
+ args: [{
5229
+ providedIn: 'root',
5230
+ }]
5231
+ }] });
5232
+
5036
5233
  class LoadingInterceptor {
5037
5234
  loadingService = inject(LoadingService);
5038
5235
  activeRequests = 0;
@@ -5336,5 +5533,5 @@ function onboardingVatModeLabel(mode) {
5336
5533
  * Generated bundle index. Do not edit.
5337
5534
  */
5338
5535
 
5339
- export { AmenityService, ApplicationService, AutomationService, BackButtonDirective, BaseService, BillingService, BookingService, BreadcrumbService, CartEventType, CartService, CategoryService, ConversationInitService, ConversationService, DialogComponent, DialogService, EnumApiClient, EnumCacheService, FacilityService, FeatureService, FloorplanService, FulfillmentService, HideFooterDirective, InventoryService, InvoiceLineService, InvoiceService, InvoiceStatsService, LayoutService, LoadingInterceptor, LoadingService, MediaService, MembershipService, NavigationService, NotificationService, NotificationStore, NotificationTemplateService, ONBOARDING_APPLICANT_TYPE_LABEL, ONBOARDING_DOCUMENT_TYPE_LABEL, ONBOARDING_ISSUE_TYPE_LABEL, ONBOARDING_STATUS_LABEL, ONBOARDING_VAT_MODE_LABEL, OfferingService, OnboardingAdminService, OnboardingApplicantService, OrderPayoutService, OrderService, OrganizationInvitationService, OrganizationMemberService, PROPERTY_OFFER_STATUS_LABEL, PaymentService, PermissionService, PlatformAuthClientService, PlatformEndpointService, PlatformServiceRegistryService, PlatformUserService, PostService, ProductCategoryService, ProductService, PropertyHighlightsService, PropertyOfferCounterService, PropertyOfferService, PropertyOfferStatus, PropertySearchService, PropertyService, PropertyStatsService, PropertyViewingService, ResourceCategoryService, ResourceService, RoleService, SCHEDULE_CRON_META, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, TimeZoneService, TitleService, acceptLanguageInterceptor, offerStatusLabel, onboardingApplicantTypeLabel, onboardingDocumentTypeLabel, onboardingIssueTypeLabel, onboardingStatusLabel, onboardingVatModeLabel, provideAngularServices };
5536
+ export { AmenityService, ApplicationService, AutomationService, BackButtonDirective, BaseService, BillingService, BookingService, BreadcrumbService, CartEventType, CartService, CategoryService, ConversationInitService, ConversationService, DialogComponent, DialogService, EnumApiClient, EnumCacheService, FacilityService, FeatureService, FloorplanService, FulfillmentService, HideFooterDirective, InventoryService, InvoiceLineService, InvoiceService, InvoiceStatsService, LayoutService, LoadingInterceptor, LoadingService, MediaService, MembershipService, NavigationService, NotificationService, NotificationStore, NotificationTemplateService, ONBOARDING_APPLICANT_TYPE_LABEL, ONBOARDING_DOCUMENT_TYPE_LABEL, ONBOARDING_ISSUE_TYPE_LABEL, ONBOARDING_STATUS_LABEL, ONBOARDING_VAT_MODE_LABEL, OfferingService, OnboardingAdminService, OnboardingApplicantService, OnboardingDocumentService, OrderPayoutService, OrderService, OrganizationInvitationService, OrganizationMemberService, PROPERTY_OFFER_STATUS_LABEL, PaymentService, PermissionService, PlatformAuthClientService, PlatformEndpointService, PlatformServiceRegistryService, PlatformUserService, PostService, ProductCategoryService, ProductService, PropertyHighlightsService, PropertyOfferCounterService, PropertyOfferService, PropertyOfferStatus, PropertySearchService, PropertyService, PropertyStatsService, PropertyViewingService, ResourceCategoryService, ResourceService, RoleService, SCHEDULE_CRON_META, SERVICE_DIRECTIVES, SidenavService, SnackBarService, SupportService, ThemeService, TimeZoneService, TitleService, acceptLanguageInterceptor, offerStatusLabel, onboardingApplicantTypeLabel, onboardingDocumentTypeLabel, onboardingIssueTypeLabel, onboardingStatusLabel, onboardingVatModeLabel, provideAngularServices };
5340
5537
  //# sourceMappingURL=rolatech-angular-services.mjs.map