Remove code concerning onboarding events as this no longer exists, and remove more leftover tour code
This commit is contained in:
parent
ce2c06684f
commit
c60fd5ebb2
|
@ -14,7 +14,6 @@ import {
|
|||
UserPermissionAssignedEvent,
|
||||
UserPermissionRemovedEvent,
|
||||
UserUpdatedEvent,
|
||||
UserOnboardingEvent,
|
||||
} from "@budibase/types"
|
||||
import { isScim } from "../../context"
|
||||
|
||||
|
@ -51,16 +50,6 @@ async function deleted(user: User) {
|
|||
await publishEvent(Event.USER_DELETED, properties)
|
||||
}
|
||||
|
||||
export async function onboardingComplete(user: User) {
|
||||
const properties: UserOnboardingEvent = {
|
||||
userId: user._id as string,
|
||||
audited: {
|
||||
email: user.email,
|
||||
},
|
||||
}
|
||||
await publishEvent(Event.USER_ONBOARDING_COMPLETE, properties)
|
||||
}
|
||||
|
||||
// PERMISSIONS
|
||||
|
||||
async function permissionAdminAssigned(user: User, timestamp?: number) {
|
||||
|
@ -191,7 +180,6 @@ export default {
|
|||
permissionAdminRemoved,
|
||||
permissionBuilderAssigned,
|
||||
permissionBuilderRemoved,
|
||||
onboardingComplete,
|
||||
invited,
|
||||
inviteAccepted,
|
||||
passwordForceReset,
|
||||
|
|
|
@ -76,10 +76,6 @@ export const handleSaveEvents = async (
|
|||
await events.user.permissionAdminRemoved(user)
|
||||
}
|
||||
|
||||
if (isOnboardingComplete(user, existingUser)) {
|
||||
await events.user.onboardingComplete(user)
|
||||
}
|
||||
|
||||
if (
|
||||
!existingUser.forceResetPassword &&
|
||||
user.forceResetPassword &&
|
||||
|
@ -122,10 +118,6 @@ const isRemovingAdmin = (user: any, existingUser: any) => {
|
|||
return isRemovingPermission(user, existingUser, hasAdminPermissions)
|
||||
}
|
||||
|
||||
const isOnboardingComplete = (user: any, existingUser: any) => {
|
||||
return !existingUser?.onboardedAt && typeof user.onboardedAt === "string"
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a permission is being added to a new or existing user.
|
||||
*/
|
||||
|
|
|
@ -13,9 +13,6 @@ interface BuilderState {
|
|||
} | null
|
||||
propertyFocus: string | null
|
||||
builderSidePanel: boolean
|
||||
tourNodes: Record<string, HTMLElement> | null
|
||||
tourKey: string | null
|
||||
tourStepKey: string | null
|
||||
hoveredComponentId: string | null
|
||||
websocket?: Socket
|
||||
}
|
||||
|
@ -25,9 +22,6 @@ export const INITIAL_BUILDER_STATE: BuilderState = {
|
|||
highlightedSetting: null,
|
||||
propertyFocus: null,
|
||||
builderSidePanel: false,
|
||||
tourNodes: null,
|
||||
tourKey: null,
|
||||
tourStepKey: null,
|
||||
hoveredComponentId: null,
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,8 @@ export interface UpdateSelfRequest {
|
|||
lastName?: string
|
||||
password?: string
|
||||
forceResetPassword?: boolean
|
||||
onboardedAt?: string
|
||||
freeTrialConfirmedAt?: string
|
||||
appFavourites?: string[]
|
||||
tours?: Record<string, Date>
|
||||
appSort?: string
|
||||
}
|
||||
|
||||
|
|
|
@ -64,15 +64,15 @@ export interface User extends Document {
|
|||
status?: UserStatus
|
||||
createdAt?: number // override the default createdAt behaviour - users sdk historically set this to Date.now()
|
||||
userGroups?: string[]
|
||||
onboardedAt?: string
|
||||
freeTrialConfirmedAt?: string
|
||||
tours?: Record<string, Date>
|
||||
scimInfo?: { isSync: true } & Record<string, any>
|
||||
appFavourites?: string[]
|
||||
ssoId?: string
|
||||
appSort?: string
|
||||
budibaseAccess?: boolean
|
||||
accountPortalAccess?: boolean
|
||||
onboardedAt?: string // deprecated and no longer saved
|
||||
tours?: Record<string, Date> // deprecated and no longer saved
|
||||
}
|
||||
|
||||
export interface UserBindings extends Document {
|
||||
|
|
|
@ -24,14 +24,6 @@ export interface UserDeletedEvent extends BaseEvent {
|
|||
}
|
||||
}
|
||||
|
||||
export interface UserOnboardingEvent extends BaseEvent {
|
||||
userId: string
|
||||
step?: string
|
||||
audited: {
|
||||
email: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserPermissionAssignedEvent extends BaseEvent {
|
||||
userId: string
|
||||
audited: {
|
||||
|
|
|
@ -47,13 +47,12 @@ describe("/api/global/self", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("should update onboarding", async () => {
|
||||
it("should update free trial confirmation date", async () => {
|
||||
const user = await config.createUser()
|
||||
await config.createSession(user)
|
||||
|
||||
const res = await config.api.self
|
||||
.updateSelf(user, {
|
||||
onboardedAt: "2023-03-07T14:10:54.869Z",
|
||||
freeTrialConfirmedAt: "2024-03-17T14:10:54.869Z",
|
||||
})
|
||||
.expect(200)
|
||||
|
@ -61,7 +60,6 @@ describe("/api/global/self", () => {
|
|||
const dbUser = (await config.getUser(user.email))!
|
||||
|
||||
user._rev = dbUser._rev
|
||||
expect(dbUser.onboardedAt).toBe("2023-03-07T14:10:54.869Z")
|
||||
expect(dbUser.freeTrialConfirmedAt).toBe("2024-03-17T14:10:54.869Z")
|
||||
expect(res.body._id).toBe(user._id)
|
||||
})
|
||||
|
|
|
@ -25,10 +25,8 @@ export const buildSelfSaveValidation = () => {
|
|||
forceResetPassword: Joi.boolean().optional(),
|
||||
firstName: OPTIONAL_STRING,
|
||||
lastName: OPTIONAL_STRING,
|
||||
onboardedAt: Joi.string().optional(),
|
||||
freeTrialConfirmedAt: Joi.string().optional(),
|
||||
appFavourites: Joi.array().optional(),
|
||||
tours: Joi.object().optional(),
|
||||
appSort: Joi.string().optional(),
|
||||
}
|
||||
return auth.joiValidator.body(Joi.object(schema).required().unknown(false))
|
||||
|
|
Loading…
Reference in New Issue