@kumori/aurora-backend-handler 1.0.100 → 1.1.1
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.
- package/api/tenant-api-service.ts +19 -3
- package/backend-handler.ts +2 -2
- package/event-helper.ts +4 -3
- package/package.json +1 -1
|
@@ -1120,7 +1120,7 @@ export const acceptInvite = async (tenant: string, security: string) => {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
1122
1122
|
|
|
1123
|
-
export const rejectInvite = async (tenant: string, security: string) => {
|
|
1123
|
+
export const rejectInvite = async (tenant: string, security: string, leave: boolean) => {
|
|
1124
1124
|
try {
|
|
1125
1125
|
await initializeGlobalWebSocketClient(security);
|
|
1126
1126
|
const queryParams = { tenant: tenant };
|
|
@@ -1128,10 +1128,24 @@ export const rejectInvite = async (tenant: string, security: string) => {
|
|
|
1128
1128
|
"tenant:reject_proposal_user",
|
|
1129
1129
|
queryParams,
|
|
1130
1130
|
30000,
|
|
1131
|
-
"
|
|
1131
|
+
"REJECT",
|
|
1132
1132
|
`${tenant}/reject`
|
|
1133
1133
|
);
|
|
1134
|
-
|
|
1134
|
+
if(leave){
|
|
1135
|
+
const tenantInviteRejectedNotification: Notification = {
|
|
1136
|
+
type: "success",
|
|
1137
|
+
subtype: "tenant-leave",
|
|
1138
|
+
date: Date.now().toString(),
|
|
1139
|
+
status: "unread",
|
|
1140
|
+
callToAction: false,
|
|
1141
|
+
data: {
|
|
1142
|
+
tenant: tenant,
|
|
1143
|
+
},
|
|
1144
|
+
};
|
|
1145
|
+
eventHelper.notification.publish.creation(tenantInviteRejectedNotification);
|
|
1146
|
+
}
|
|
1147
|
+
else{
|
|
1148
|
+
const tenantInviteRejectedNotification: Notification = {
|
|
1135
1149
|
type: "success",
|
|
1136
1150
|
subtype: "tenant-invite-rejected",
|
|
1137
1151
|
date: Date.now().toString(),
|
|
@@ -1142,6 +1156,8 @@ export const rejectInvite = async (tenant: string, security: string) => {
|
|
|
1142
1156
|
},
|
|
1143
1157
|
};
|
|
1144
1158
|
eventHelper.notification.publish.creation(tenantInviteRejectedNotification);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1145
1161
|
return response;
|
|
1146
1162
|
} catch (error) {
|
|
1147
1163
|
console.error("Error rejecting tenant invite:", {
|
package/backend-handler.ts
CHANGED
|
@@ -352,8 +352,8 @@ export class BackendHandler {
|
|
|
352
352
|
this.unsubscribeFunctions.push(() =>
|
|
353
353
|
eventHelper.tenant.unsubscribe.acceptInviteError(inviteAcceptErrorCb)
|
|
354
354
|
);
|
|
355
|
-
const rejectInviteCb = (payload: { tenant: string }) => {
|
|
356
|
-
rejectInvite(payload.tenant, token);
|
|
355
|
+
const rejectInviteCb = (payload: { tenant: string, leave: boolean }) => {
|
|
356
|
+
rejectInvite(payload.tenant, token, payload.leave);
|
|
357
357
|
}
|
|
358
358
|
eventHelper.tenant.subscribe.rejectInvite(rejectInviteCb);
|
|
359
359
|
this.unsubscribeFunctions.push(() =>
|
package/event-helper.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadUser } from './api/user-api-service';
|
|
1
2
|
import { Account, Environment, Link, MarketplaceItem, MarketplaceService, Organization, PlanProvider, Registry, Tenant, tenantRole, User, Service, Notification, Resource } from "@kumori/aurora-interfaces";
|
|
2
3
|
import { EventNames } from "./event-names";
|
|
3
4
|
export interface RegistryUpdatePayload {
|
|
@@ -63,7 +64,7 @@ export class EventHelper {
|
|
|
63
64
|
updateInvite: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.UpdateInvite).publish,
|
|
64
65
|
inviteUpdated: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdated).publish,
|
|
65
66
|
inviteUpdateError: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdateError).publish,
|
|
66
|
-
rejectInvite: this.createEvent<{ tenant: string; }>(EventNames.RejectInvite).publish,
|
|
67
|
+
rejectInvite: this.createEvent<{ tenant: string; leave: boolean }>(EventNames.RejectInvite).publish,
|
|
67
68
|
inviteRejected: this.createEvent<{ user: string; tenant: string; }>(EventNames.InviteRejected).publish,
|
|
68
69
|
inviteRejectError: this.createEvent<{ tenant: string; }>(EventNames.InviteRejectError).publish,
|
|
69
70
|
createToken: this.createEvent<{ tenant: string; expiration: string; description: string }>(EventNames.CreateToken).publish,
|
|
@@ -104,7 +105,7 @@ export class EventHelper {
|
|
|
104
105
|
updateInvite: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.UpdateInvite).subscribe,
|
|
105
106
|
inviteUpdated: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdated).subscribe,
|
|
106
107
|
inviteUpdateError: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdateError).subscribe,
|
|
107
|
-
rejectInvite: this.createEvent<{ tenant: string; }>(EventNames.RejectInvite).subscribe,
|
|
108
|
+
rejectInvite: this.createEvent<{ tenant: string; leave: boolean }>(EventNames.RejectInvite).subscribe,
|
|
108
109
|
inviteRejected: this.createEvent<{ user: string; tenant: string; }>(EventNames.InviteRejected).subscribe,
|
|
109
110
|
inviteRejectError: this.createEvent<{ tenant: string; }>(EventNames.InviteRejectError).subscribe,
|
|
110
111
|
createToken: this.createEvent<{ tenant: string; expiration: string; description: string }>(EventNames.CreateToken).subscribe,
|
|
@@ -145,7 +146,7 @@ export class EventHelper {
|
|
|
145
146
|
updateInvite: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.UpdateInvite).unsubscribe,
|
|
146
147
|
inviteUpdated: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdated).unsubscribe,
|
|
147
148
|
inviteUpdateError: this.createEvent<{ tenant: string; user: string; role: tenantRole; }>(EventNames.InviteUpdateError).unsubscribe,
|
|
148
|
-
rejectInvite: this.createEvent<{ tenant: string; }>(EventNames.RejectInvite).unsubscribe,
|
|
149
|
+
rejectInvite: this.createEvent<{ tenant: string; leave: boolean }>(EventNames.RejectInvite).unsubscribe,
|
|
149
150
|
inviteRejected: this.createEvent<{ user: string; tenant: string; }>(EventNames.InviteRejected).unsubscribe,
|
|
150
151
|
inviteRejectError: this.createEvent<{ tenant: string; }>(EventNames.InviteRejectError).unsubscribe,
|
|
151
152
|
createToken: this.createEvent<{ tenant: string; expiration: string; description: string }>(EventNames.CreateToken).unsubscribe,
|