Merged in feat/sw-2859-set-up-shared-trpc-package (pull request #2319)

feat(SW-2859): Create trpc package

* Add isEdge, safeTry and dataCache to new common package

* Add eslint and move prettier config

* Clean up tests

* Create trpc package and move initialization

* Move errors and a few procedures

* Move telemetry to common package

* Move tokenManager to common package

* Add Sentry to procedures

* Clean up procedures

* Fix self-referencing imports

* Add exports to packages and lint rule to prevent relative imports

* Add env to trpc package

* Add eslint to trpc package

* Apply lint rules

* Use direct imports from trpc package

* Add lint-staged config to trpc

* Move lang enum to common

* Restructure trpc package folder structure

* Fix lang imports


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-06-18 12:14:20 +00:00
parent 2f38bdf0b1
commit 846fd904a6
211 changed files with 989 additions and 627 deletions

View File

@@ -14,8 +14,9 @@ import { getIntl } from "@/i18n"
import { SASModal } from "../components/SASModal"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
import type { Lang } from "@/constants/languages"
import type { State } from "../sasUtils"
const searchParamsSchema = z.object({
@@ -24,9 +25,11 @@ const searchParamsSchema = z.object({
type Intent = z.infer<typeof searchParamsSchema>["intent"]
export default async function SASxScandicLoginPage(props: PageArgs<LangParams> & SearchParams) {
const params = await props.params;
const searchParams = await props.searchParams;
export default async function SASxScandicLoginPage(
props: PageArgs<LangParams> & SearchParams
) {
const params = await props.params
const searchParams = await props.searchParams
const result = searchParamsSchema.safeParse(searchParams)
if (!result.success) {
// TOOD where to redirect?

View File

@@ -14,10 +14,10 @@ import OneTimePasswordForm, {
type OnSubmitHandler,
} from "./OneTimePasswordForm"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { ReactNode } from "react"
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
import type { Lang } from "@/constants/languages"
const otpError = z.enum(["invalidCode", "expiredCode"])
const intent = z.enum(["link", "unlink", "transfer"])

View File

@@ -17,8 +17,9 @@ import { SASModal } from "../../components/SASModal"
import styles from "./transferSuccess.module.css"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
import type { Lang } from "@/constants/languages"
export default async function SASxScandicTransferSuccessPage(
props: PageArgs<LangParams> & SearchParams<{ p?: string }>

View File

@@ -6,7 +6,8 @@ import "@scandic-hotels/design-system/style.css"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
import Script from "next/script"
import { Lang } from "@/constants/languages"
import { Lang } from "@scandic-hotels/common/constants/language"
import { env } from "@/env/server"
import TrpcProvider from "@/lib/trpc/Provider"