Merged in feat/sw-2867-move-user-router-to-trpc-package (pull request #2428)
Move user router to trpc package * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Move booking router to trpc package * Move partners router to trpc package * Move autocomplete router to trpc package * Move booking router to trpc package * Remove translations from My Pages navigation trpc procedure * Move navigation router to trpc package * Move user router to trpc package * Merge branch 'master' into feat/sw-2862-move-booking-router-to-trpc-package * Merge branch 'feat/sw-2862-move-booking-router-to-trpc-package' into feat/sw-2865-move-navigation-router-to-trpc-package * Merge branch 'master' into feat/sw-2865-move-navigation-router-to-trpc-package * Merge branch 'master' into feat/sw-2865-move-navigation-router-to-trpc-package * Merge branch 'master' into feat/sw-2865-move-navigation-router-to-trpc-package * Merge branch 'feat/sw-2865-move-navigation-router-to-trpc-package' into feat/sw-2867-move-user-router-to-trpc-package * Merge branch 'master' into feat/sw-2867-move-user-router-to-trpc-package Approved-by: Linus Flood
This commit is contained in:
@@ -4,6 +4,7 @@ import { usePathname } from "next/navigation"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { Transactions } from "@scandic-hotels/trpc/enums/transactions"
|
||||
|
||||
import { webviews } from "@/constants/routes/webviews"
|
||||
|
||||
@@ -15,7 +16,6 @@ import useLang from "@/hooks/useLang"
|
||||
import AwardPoints from "../../../AwardPoints"
|
||||
|
||||
import type { RowProps } from "@/types/components/myPages/myPage/earnAndBurn"
|
||||
import { Transactions } from "@/types/enums/transactions"
|
||||
|
||||
export default function Row({ transaction }: RowProps) {
|
||||
const intl = useIntl()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
@@ -6,7 +7,6 @@ import Link from "@/components/TempDesignSystem/Link"
|
||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
import styles from "./emptyUpcomingStays.module.css"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { findMyBookingCurrentWebPath } from "@scandic-hotels/common/constants/routes/findMyBooking"
|
||||
import { myPages } from "@scandic-hotels/common/constants/routes/myPages"
|
||||
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
|
||||
|
||||
import { logout } from "@/constants/routes/handleAuth"
|
||||
import { env } from "@/env/client"
|
||||
@@ -18,7 +19,6 @@ import SkeletonShimmer from "@/components/SkeletonShimmer"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import useLang from "@/hooks/useLang"
|
||||
import { trackClick } from "@/utils/tracking"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
import BookingButton from "../BookingButton"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { signup } from "@scandic-hotels/common/constants/routes/signup"
|
||||
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
import { signup } from "@/constants/routes/signup"
|
||||
|
||||
import Card from "@/components/TempDesignSystem/Card"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from "react"
|
||||
|
||||
import { signup } from "@scandic-hotels/common/constants/routes/signup"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { isValidSession } from "@scandic-hotels/trpc/utils/session"
|
||||
|
||||
import { dtmcLogin } from "@/constants/routes/dtmc"
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
import { signup } from "@/constants/routes/signup"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import ButtonLink from "@/components/ButtonLink"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { passwordValidator } from "@/utils/zod/passwordValidator"
|
||||
import { phoneValidator } from "@/utils/zod/phoneValidator"
|
||||
import { passwordValidator } from "@scandic-hotels/common/utils/zod/passwordValidator"
|
||||
import { phoneValidator } from "@scandic-hotels/common/utils/zod/phoneValidator"
|
||||
|
||||
export const editProfileErrors = {
|
||||
COUNTRY_REQUIRED: "COUNTRY_REQUIRED",
|
||||
|
||||
@@ -8,6 +8,10 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { Button } from "@scandic-hotels/design-system/Button"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import {
|
||||
type SignUpSchema,
|
||||
signUpSchema,
|
||||
} from "@scandic-hotels/trpc/routers/user/schemas"
|
||||
|
||||
import { getDefaultCountryFromLang } from "@/constants/languages"
|
||||
import {
|
||||
@@ -28,8 +32,7 @@ import { useFormTracking } from "@/components/TrackingSDK/hooks"
|
||||
import useLang from "@/hooks/useLang"
|
||||
import { formatPhoneNumber } from "@/utils/phone"
|
||||
|
||||
import { type SignUpSchema, signUpSchema } from "./schema"
|
||||
|
||||
// import { type SignUpSchema, signUpSchema } from "./schema"
|
||||
import styles from "./form.module.css"
|
||||
|
||||
import type { SignUpFormProps } from "@/types/components/form/signupForm"
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { passwordValidator } from "@/utils/zod/passwordValidator"
|
||||
import { phoneValidator } from "@/utils/zod/phoneValidator"
|
||||
|
||||
export const signupErrors = {
|
||||
COUNTRY_REQUIRED: "COUNTRY_REQUIRED",
|
||||
FIRST_NAME_REQUIRED: "FIRST_NAME_REQUIRED",
|
||||
LAST_NAME_REQUIRED: "LAST_NAME_REQUIRED",
|
||||
EMAIL_INVALID: "EMAIL_INVALID",
|
||||
EMAIL_REQUIRED: "EMAIL_REQUIRED",
|
||||
PHONE_REQUIRED: "PHONE_REQUIRED",
|
||||
PHONE_REQUESTED: "PHONE_REQUESTED",
|
||||
BIRTH_DATE_REQUIRED: "BIRTH_DATE_REQUIRED",
|
||||
PASSWORD_REQUIRED: "PASSWORD_REQUIRED",
|
||||
TERMS_REQUIRED: "TERMS_REQUIRED",
|
||||
ZIP_CODE_REQUIRED: "ZIP_CODE_REQUIRED",
|
||||
ZIP_CODE_INVALID: "ZIP_CODE_INVALID",
|
||||
} as const
|
||||
|
||||
export const signUpSchema = z.object({
|
||||
firstName: z
|
||||
.string()
|
||||
.max(250)
|
||||
.trim()
|
||||
.min(1, signupErrors.FIRST_NAME_REQUIRED),
|
||||
lastName: z.string().max(250).trim().min(1, signupErrors.LAST_NAME_REQUIRED),
|
||||
email: z
|
||||
.string()
|
||||
.max(250)
|
||||
.min(1, signupErrors.EMAIL_REQUIRED)
|
||||
.email({ message: signupErrors.EMAIL_INVALID }),
|
||||
phoneNumber: phoneValidator(
|
||||
signupErrors.PHONE_REQUIRED,
|
||||
signupErrors.PHONE_REQUESTED
|
||||
),
|
||||
phoneNumberCC: z.string(),
|
||||
dateOfBirth: z.string().min(1, {
|
||||
message: signupErrors.BIRTH_DATE_REQUIRED,
|
||||
}),
|
||||
address: z.object({
|
||||
countryCode: z
|
||||
.string({
|
||||
required_error: signupErrors.COUNTRY_REQUIRED,
|
||||
invalid_type_error: signupErrors.COUNTRY_REQUIRED,
|
||||
})
|
||||
.min(1, signupErrors.COUNTRY_REQUIRED),
|
||||
zipCode: z
|
||||
.string()
|
||||
.min(1, signupErrors.ZIP_CODE_REQUIRED)
|
||||
.regex(/^[A-Za-z0-9-\s]{1,9}$/g, signupErrors.ZIP_CODE_INVALID),
|
||||
}),
|
||||
password: passwordValidator(signupErrors.PASSWORD_REQUIRED),
|
||||
termsAccepted: z
|
||||
.boolean()
|
||||
.refine((value) => value === true, signupErrors.TERMS_REQUIRED),
|
||||
})
|
||||
|
||||
export type SignUpSchema = z.infer<typeof signUpSchema>
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
findMyBooking,
|
||||
findMyBookingCurrentWebPath,
|
||||
} from "@scandic-hotels/common/constants/routes/findMyBooking"
|
||||
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
|
||||
|
||||
import { customerService } from "@/constants/webHrefs"
|
||||
import { env } from "@/env/client"
|
||||
@@ -19,7 +20,6 @@ import LanguageSwitcher from "@/components/LanguageSwitcher"
|
||||
import { useHandleKeyUp } from "@/hooks/useHandleKeyUp"
|
||||
import { useIsLangLive } from "@/hooks/useIsLangLive"
|
||||
import useLang from "@/hooks/useLang"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
import HeaderLink from "../../HeaderLink"
|
||||
import TopLink from "../../TopLink"
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
findMyBooking,
|
||||
findMyBookingCurrentWebPath,
|
||||
} from "@scandic-hotels/common/constants/routes/findMyBooking"
|
||||
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { getHeader } from "@/lib/trpc/memoizedRequests"
|
||||
@@ -12,7 +13,6 @@ import SkeletonShimmer from "@/components/SkeletonShimmer"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { isLoggedInUser } from "@/utils/isLoggedInUser"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
import HeaderLink from "../HeaderLink"
|
||||
import TopLink from "../TopLink"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { phoneValidator } from "@scandic-hotels/common/utils/zod/phoneValidator"
|
||||
|
||||
import { specialRequestSchema } from "@/components/HotelReservation/EnterDetails/Details/SpecialRequests/schema"
|
||||
import { phoneValidator } from "@/utils/zod/phoneValidator"
|
||||
|
||||
// stringMatcher regex is copied from current web as specified by requirements.
|
||||
const stringMatcher =
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { phoneValidator } from "@scandic-hotels/common/utils/zod/phoneValidator"
|
||||
|
||||
import { specialRequestSchema } from "@/components/HotelReservation/EnterDetails/Details/SpecialRequests/schema"
|
||||
import { phoneValidator } from "@/utils/zod/phoneValidator"
|
||||
|
||||
// stringMatcher regex is copied from current web as specified by requirements.
|
||||
const stringMatcher =
|
||||
|
||||
@@ -3,6 +3,7 @@ import { notFound } from "next/navigation"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
|
||||
import ScandicLogoIcon from "@scandic-hotels/design-system/Icons/ScandicLogoIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { parseRefId } from "@scandic-hotels/trpc/utils/refId"
|
||||
@@ -16,7 +17,6 @@ import {
|
||||
|
||||
import { getIntl } from "@/i18n"
|
||||
import { isLoggedInUser } from "@/utils/isLoggedInUser"
|
||||
import * as maskValue from "@/utils/maskValue"
|
||||
|
||||
import AdditionalInfoForm from "../../FindMyBooking/AdditionalInfoForm"
|
||||
import accessBooking, {
|
||||
|
||||
@@ -2,6 +2,8 @@ import { cookies } from "next/headers"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
|
||||
import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
|
||||
import { parseRefId } from "@scandic-hotels/trpc/utils/refId"
|
||||
@@ -35,8 +37,6 @@ import Image from "@/components/Image"
|
||||
import { getIntl } from "@/i18n"
|
||||
import MyStayProvider from "@/providers/MyStay"
|
||||
import { isLoggedInUser } from "@/utils/isLoggedInUser"
|
||||
import * as maskValue from "@/utils/maskValue"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
import styles from "./index.module.css"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { signupErrors } from "@/components/Forms/Signup/schema"
|
||||
import { signupErrors } from "@scandic-hotels/trpc/routers/user/schemas"
|
||||
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { phoneErrors } from "@scandic-hotels/common/utils/zod/phoneValidator"
|
||||
import { signupErrors } from "@scandic-hotels/trpc/routers/user/schemas"
|
||||
|
||||
import { bookingWidgetErrors } from "@/components/Forms/BookingWidget/schema"
|
||||
import { editProfileErrors } from "@/components/Forms/Edit/Profile/schema"
|
||||
import { signupErrors } from "@/components/Forms/Signup/schema"
|
||||
import { multiroomErrors } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema"
|
||||
import { roomOneErrors } from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
|
||||
import { findMyBookingErrors } from "@/components/HotelReservation/FindMyBooking/schema"
|
||||
import { phoneErrors } from "@/utils/zod/phoneValidator"
|
||||
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ import { Text, TextField } from "react-aria-components"
|
||||
import { Controller, useFormContext } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { passwordValidators } from "@scandic-hotels/common/utils/zod/passwordValidator"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Input } from "@scandic-hotels/design-system/Input"
|
||||
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||
import { passwordValidators } from "@/utils/zod/passwordValidator"
|
||||
|
||||
import { getErrorMessage } from "../Input/errors"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user