Merged in feat/loy-291-new-claim-points-flow (pull request #3508)

feat(LOY-291): New claim points flow for logged in users

* wip new flow

* More wip

* More wip

* Wip styling

* wip with a mutation

* Actually fetch booking data

* More styling wip

* Fix toast duration

* fix loading a11y maybe

* More stuff

* Add feature flag

* Add invalid state

* Clean up

* Add fields for missing user info

* Restructure files

* Add todos

* Disable warning

* Fix icon and border radius


Approved-by: Emma Zettervall
Approved-by: Matilda Landström
This commit is contained in:
Anton Gunnarsson
2026-02-03 13:27:24 +00:00
parent 310ad7bc7f
commit c2cf6b03a7
13 changed files with 775 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
import z from "zod"
import { signupVerify } from "@scandic-hotels/common/constants/routes/signup"
import { createLogger } from "@scandic-hotels/common/logger/createLogger"
import { createCounter } from "@scandic-hotels/common/telemetry"
@@ -318,4 +320,33 @@ export const userMutationRouter = router({
return true
}),
}),
claimPoints: protectedProcedure
.input(
z.object({
from: z.string(),
to: z.string(),
city: z.string(),
hotel: z.string(),
firstName: z.string(),
lastName: z.string(),
email: z.string().email(),
phone: z.string(),
})
)
.mutation(async function ({ input, ctx }) {
userMutationLogger.info("api.user.claimPoints start")
const user = await ctx.getScandicUser()
if (!user) {
throw "error"
}
// eslint-disable-next-line no-console
console.log("Claiming points", input, user.membershipNumber)
// TODO Waiting for API endpoint, simulating delay
await new Promise((resolve) => setTimeout(resolve, 2_000))
userMutationLogger.info("api.user.claimPoints success")
return true
}),
})