@roomstay/frontend 2.6.18 → 2.6.20
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/dist/166.bundle.js +1 -1
- package/dist/279.bundle.js +1 -1
- package/dist/370.bundle.js +1 -1
- package/dist/449.bundle.js +1 -1
- package/dist/586.bundle.js +1 -0
- package/dist/736.bundle.js +1 -1
- package/dist/873.bundle.js +1 -1
- package/dist/903.bundle.js +1 -1
- package/dist/927.bundle.js +1 -0
- package/dist/972.bundle.js +1 -1
- package/dist/978.bundle.js +1 -0
- package/dist/e2e/data/checkoutTestData.d.ts +16 -0
- package/dist/e2e/data/checkoutTestData.js +32 -0
- package/dist/e2e/data/checkoutTestData.js.map +1 -0
- package/dist/e2e/goBackAndCheckoutAgain.spec.d.ts +1 -0
- package/dist/e2e/goBackAndCheckoutAgain.spec.js +72 -0
- package/dist/e2e/goBackAndCheckoutAgain.spec.js.map +1 -0
- package/dist/e2e/helpers/checkoutHelpers.d.ts +7 -0
- package/dist/e2e/helpers/checkoutHelpers.js +164 -0
- package/dist/e2e/helpers/checkoutHelpers.js.map +1 -0
- package/dist/e2e/price.spec.d.ts +1 -0
- package/dist/e2e/price.spec.js +154 -0
- package/dist/e2e/price.spec.js.map +1 -0
- package/dist/main.bundle.js +1 -1
- package/dist/src/api/MemberAPI.d.ts +2 -3
- package/dist/src/api/MemberAPI.js +2 -6
- package/dist/src/api/MemberAPI.js.map +1 -1
- package/dist/src/components/User/Forms/ForgotPasswordForm.js +6 -2
- package/dist/src/components/User/Forms/ForgotPasswordForm.js.map +1 -1
- package/dist/src/components/generic/InputGroup/InputGroup.js +6 -0
- package/dist/src/components/generic/InputGroup/InputGroup.js.map +1 -1
- package/dist/src/components/generic/InputGroup/InputGroup.types.d.ts +1 -1
- package/dist/src/components/generic/InputGroup/InputGroup.types.js.map +1 -1
- package/dist/src/components/generic/Select/InputSelect.js +1 -1
- package/dist/src/components/generic/Select/InputSelect.js.map +1 -1
- package/dist/src/components/members/EditMyProfile.js +3 -3
- package/dist/src/components/members/EditMyProfile.js.map +1 -1
- package/dist/src/components/steps/addons/AddonList.js +2 -2
- package/dist/src/components/steps/addons/AddonList.js.map +1 -1
- package/dist/src/components/steps/addons/AddonsNotFoundBlock.d.ts +2 -0
- package/dist/src/components/steps/addons/{AddonsNotFound.js → AddonsNotFoundBlock.js} +9 -3
- package/dist/src/components/steps/addons/AddonsNotFoundBlock.js.map +1 -0
- package/dist/src/components/steps/confirmation/RoomContactDetails.js +53 -29
- package/dist/src/components/steps/confirmation/RoomContactDetails.js.map +1 -1
- package/dist/src/components/steps/confirmation/StepConfirmationAcknowledgement.js +3 -1
- package/dist/src/components/steps/confirmation/StepConfirmationAcknowledgement.js.map +1 -1
- package/dist/src/components/steps/confirmation/StepConfirmationForm.js +1 -1
- package/dist/src/components/steps/confirmation/StepConfirmationForm.js.map +1 -1
- package/dist/src/components/steps/room/MemberSignInModal/EmailAndFullnameMemberModal.d.ts +4 -0
- package/dist/src/components/steps/room/MemberSignInModal/EmailAndFullnameMemberModal.js +37 -0
- package/dist/src/components/steps/room/MemberSignInModal/EmailAndFullnameMemberModal.js.map +1 -0
- package/dist/src/components/steps/room/MemberSignInModal/ExternalMemberModal.d.ts +16 -5
- package/dist/src/components/steps/room/MemberSignInModal/ExternalMemberModal.js +51 -54
- package/dist/src/components/steps/room/MemberSignInModal/ExternalMemberModal.js.map +1 -1
- package/dist/src/components/steps/room/MemberSignInModal/FamilyNameMemberModal.d.ts +8 -0
- package/dist/src/components/steps/room/MemberSignInModal/FamilyNameMemberModal.js +27 -0
- package/dist/src/components/steps/room/MemberSignInModal/FamilyNameMemberModal.js.map +1 -0
- package/dist/src/components/steps/room/MemberSignInModal/InternalMemberSignInModal.d.ts +6 -0
- package/dist/src/components/steps/room/MemberSignInModal/InternalMemberSignInModal.js +318 -0
- package/dist/src/components/steps/room/MemberSignInModal/InternalMemberSignInModal.js.map +1 -0
- package/dist/src/components/steps/room/MemberSignInModal/{MemberSignInModal.types.d.ts → InternalMemberSignInModal.types.d.ts} +1 -1
- package/dist/src/components/steps/room/MemberSignInModal/{MemberSignInModal.types.js → InternalMemberSignInModal.types.js} +1 -1
- package/dist/src/components/steps/room/MemberSignInModal/InternalMemberSignInModal.types.js.map +1 -0
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.d.ts +1 -6
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js +28 -284
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js.map +1 -1
- package/dist/src/components/steps/room/StepRoomBestRateAlert.js +22 -3
- package/dist/src/components/steps/room/StepRoomBestRateAlert.js.map +1 -1
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js +9 -6
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextType.type.d.ts +9 -3
- package/dist/src/contexts/CompanyContext/CompanyContextType.type.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +51 -44
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +5 -3
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
- package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContext.d.ts +8 -1
- package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContext.js +2 -0
- package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContext.js.map +1 -1
- package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContextProvider.js +16 -4
- package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContextProvider.js.map +1 -1
- package/dist/src/contexts/Members/RoomstayMemberContext/RoomstayMemberContextProvider.js +2 -12
- package/dist/src/contexts/Members/RoomstayMemberContext/RoomstayMemberContextProvider.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.d.ts +1 -0
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js +17 -9
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js.map +1 -1
- package/dist/src/events/{views → actions}/PlacedBookingEvent.d.ts +3 -1
- package/dist/src/events/{views → actions}/PlacedBookingEvent.js +2 -1
- package/dist/src/events/actions/PlacedBookingEvent.js.map +1 -0
- package/dist/src/events/views/StepThanksViewEvent.d.ts +3 -1
- package/dist/src/events/views/StepThanksViewEvent.js +3 -1
- package/dist/src/events/views/StepThanksViewEvent.js.map +1 -1
- package/dist/src/hooks/useExternalMember.d.ts +1 -1
- package/dist/src/hooks/useNextStepAction.js +1 -1
- package/dist/src/hooks/useNextStepAction.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +9 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/Api/HotelDTO.d.ts +2 -6
- package/dist/src/models/Api/HotelDTO.js +1 -7
- package/dist/src/models/Api/HotelDTO.js.map +1 -1
- package/dist/src/models/BasketRow.d.ts +3 -3
- package/dist/src/models/BasketRow.js +0 -3
- package/dist/src/models/BasketRow.js.map +1 -1
- package/dist/src/models/Client/Hotel/Hotel.d.ts +5 -4
- package/dist/src/models/Client/Hotel/Hotel.js.map +1 -1
- package/dist/src/models/Confirmation.d.ts +3 -0
- package/dist/src/models/Confirmation.js +2 -0
- package/dist/src/models/Confirmation.js.map +1 -1
- package/dist/src/models/RoomstaySession.d.ts +5 -0
- package/dist/src/models/RoomstaySession.js.map +1 -1
- package/dist/src/pages/account/AccountRouter.js +2 -0
- package/dist/src/pages/account/AccountRouter.js.map +1 -1
- package/dist/src/pages/account/AccountRoutes.d.ts +3 -0
- package/dist/src/pages/account/AccountRoutes.js +3 -0
- package/dist/src/pages/account/AccountRoutes.js.map +1 -1
- package/dist/src/pages/account/ChangePassword/AccountChangePasswordPage.d.ts +1 -0
- package/dist/src/pages/account/ChangePassword/AccountChangePasswordPage.js +143 -0
- package/dist/src/pages/account/ChangePassword/AccountChangePasswordPage.js.map +1 -0
- package/dist/src/pages/account/Details/AccountDetailsProfilePage.js +11 -16
- package/dist/src/pages/account/Details/AccountDetailsProfilePage.js.map +1 -1
- package/dist/src/pages/steps/StepDate/StepDateComponent.js +7 -0
- package/dist/src/pages/steps/StepDate/StepDateComponent.js.map +1 -1
- package/dist/src/pages/steps/StepThanks/StepThanksComponent.js +1 -1
- package/dist/src/pages/steps/StepThanks/StepThanksComponent.js.map +1 -1
- package/dist/src/providers/FeatureProvider.d.ts +1 -1
- package/dist/src/providers/FeatureProvider.js +6 -2
- package/dist/src/providers/FeatureProvider.js.map +1 -1
- package/dist/src/providers/SessionProvider.js +5 -1
- package/dist/src/providers/SessionProvider.js.map +1 -1
- package/dist/src/providers/feature/DerbysoftClickTrackingFeature.d.ts +7 -0
- package/dist/src/providers/feature/DerbysoftClickTrackingFeature.js +32 -0
- package/dist/src/providers/feature/DerbysoftClickTrackingFeature.js.map +1 -0
- package/dist/src/providers/feature/Feature.d.ts +3 -3
- package/dist/src/providers/feature/Feature.js +3 -3
- package/dist/src/providers/feature/Feature.js.map +1 -1
- package/dist/src/providers/feature/GuestTitleFieldFeature.d.ts +21 -0
- package/dist/src/providers/feature/GuestTitleFieldFeature.js +37 -0
- package/dist/src/providers/feature/GuestTitleFieldFeature.js.map +1 -0
- package/dist/src/providers/storage/LocalStorageProvider.js +1 -1
- package/dist/src/providers/storage/LocalStorageProvider.js.map +1 -1
- package/dist/src/translations/Translation.d.ts +19 -3
- package/dist/src/translations/Translation.js +19 -3
- package/dist/src/translations/Translation.js.map +1 -1
- package/dist/src/translations/languages/en-gb.js +20 -4
- package/dist/src/translations/languages/en-gb.js.map +1 -1
- package/dist/src/util/DerbysoftPixel.d.ts +4 -0
- package/dist/src/util/DerbysoftPixel.js +56 -0
- package/dist/src/util/DerbysoftPixel.js.map +1 -0
- package/dist/test.bundle.js +1 -1
- package/dist/tests/offline/entry/OfflineEngineDefaults.js +5 -0
- package/dist/tests/offline/entry/OfflineEngineDefaults.js.map +1 -1
- package/dist/vendors.bundle.js +1 -1
- package/dist/vendors.bundle.js.LICENSE.txt +2 -0
- package/package.json +2 -2
- package/dist/201.bundle.js +0 -1
- package/dist/457.bundle.js +0 -1
- package/dist/468.bundle.js +0 -1
- package/dist/src/components/steps/addons/AddonsNotFound.d.ts +0 -1
- package/dist/src/components/steps/addons/AddonsNotFound.js.map +0 -1
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.types.js.map +0 -1
- package/dist/src/events/views/PlacedBookingEvent.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { IMember, IMemberVerification } from '@roomstay/core';
|
|
1
2
|
import BaseAPI from './BaseAPI';
|
|
2
3
|
export default class MemberAPI extends BaseAPI {
|
|
3
4
|
addMember: (firstName: string, lastName: string, email: string, extra: any[], hotelId: string, captchaId?: string) => Promise<any>;
|
|
4
|
-
|
|
5
|
-
memberId: string;
|
|
6
|
-
}>;
|
|
5
|
+
verifyMember: (hotelId: string, data: IMemberVerification) => Promise<IMember>;
|
|
7
6
|
}
|
|
@@ -45,12 +45,8 @@ class MemberAPI extends BaseAPI_1.default {
|
|
|
45
45
|
Captcha: captchaId,
|
|
46
46
|
}, hotelId);
|
|
47
47
|
});
|
|
48
|
-
this.
|
|
49
|
-
return this.post(BaseAPI_1.APIEndpoint.Member,
|
|
50
|
-
type: 'big4',
|
|
51
|
-
memberNumber,
|
|
52
|
-
surname: familyName,
|
|
53
|
-
}, hotelId, undefined, 'verify-member');
|
|
48
|
+
this.verifyMember = (hotelId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return this.post(BaseAPI_1.APIEndpoint.Member, data, hotelId, undefined, 'verify-member');
|
|
54
50
|
});
|
|
55
51
|
}
|
|
56
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemberAPI.js","sourceRoot":"/","sources":["src/api/MemberAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MemberAPI.js","sourceRoot":"/","sources":["src/api/MemberAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yDAAqD;AAErD,MAAqB,SAAU,SAAQ,iBAAO;IAA9C;;QACW,cAAS,GAAG,CAAO,SAAiB,EAAE,QAAgB,EAAE,KAAa,EAAE,KAAY,EAAE,OAAe,EAAE,SAAkB,EAAgB,EAAE;YAC7I,OAAO,IAAI,CAAC,IAAI,CACZ,qBAAW,CAAC,MAAM,EAClB;gBACI,SAAS,EAAE,SAAS;gBACpB,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,SAAS;aACrB,EACD,OAAO,CACV,CAAC;QACN,CAAC,CAAA,CAAC;QAEK,iBAAY,GAAG,CAAO,OAAe,EAAE,IAAyB,EAAoB,EAAE;YACzF,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QACpF,CAAC,CAAA,CAAC;IACN,CAAC;CAAA;AAlBD,4BAkBC","sourcesContent":["import { IMember, IMemberVerification } from '@roomstay/core';\n\nimport BaseAPI, { APIEndpoint } from '@/api/BaseAPI';\n\nexport default class MemberAPI extends BaseAPI {\n public addMember = async (firstName: string, lastName: string, email: string, extra: any[], hotelId: string, captchaId?: string): Promise<any> => {\n return this.post(\n APIEndpoint.Member,\n {\n FirstName: firstName,\n LastName: lastName,\n Email: email,\n Extra: extra,\n Captcha: captchaId,\n },\n hotelId\n );\n };\n\n public verifyMember = async (hotelId: string, data: IMemberVerification): Promise<IMember> => {\n return this.post(APIEndpoint.Member, data, hotelId, undefined, 'verify-member');\n };\n}\n"]}
|
|
@@ -62,9 +62,13 @@ const ForgotPasswordForm = (props) => {
|
|
|
62
62
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
63
63
|
const { cognitoLoginState, loading: cognitoLoading, forgotPassword, resetPassword, reset } = (0, react_1.useContext)(contexts_1.AuthenticationContext);
|
|
64
64
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
65
|
-
const { register, formState, handleSubmit, watch, setError } = (0, react_hook_form_1.useForm)({
|
|
65
|
+
const { register, trigger, formState, handleSubmit, watch, setError } = (0, react_hook_form_1.useForm)({
|
|
66
66
|
mode: 'onSubmit',
|
|
67
67
|
});
|
|
68
|
+
const passwordWatch = watch('password');
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
trigger('confirmPassword');
|
|
71
|
+
}, [passwordWatch, trigger]);
|
|
68
72
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
69
73
|
const getValidationClass = (name) => {
|
|
70
74
|
if (formState.errors) {
|
|
@@ -132,7 +136,7 @@ const ForgotPasswordForm = (props) => {
|
|
|
132
136
|
react_1.default.createElement(LabelAndInputGroup, { label: t(Translation_1.Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label), error: formState.errors.confirmPassword, component: react_1.default.createElement(PasswordBox_1.PasswordBox, Object.assign({ placeholder: t(Translation_1.Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Placeholder), validationStatus: getValidationClass('confirmPassword'), inputProps: { disabled: isLoading || cognitoLoading } }, register('confirmPassword', {
|
|
133
137
|
required: (0, Validation_1.makeRequiredRule)(t)(areResettingPassword, t(Translation_1.Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label)),
|
|
134
138
|
validate: {
|
|
135
|
-
isSame: (0, Validation_1.isPasswordMatch)(t)(
|
|
139
|
+
isSame: (0, Validation_1.isPasswordMatch)(t)(passwordWatch),
|
|
136
140
|
},
|
|
137
141
|
}))) })),
|
|
138
142
|
react_1.default.createElement("div", { className: "u-marg-top" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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K,SAAS,EAAC,YAAY;gBACvB,8BAAC,kBAAQ,IAAC,OAAO,QAAC,MAAM,QAAC,IAAI,QAAC,QAAQ,EAAC,QAAQ,EAAC,SAAS,EAAE,cAAc,IAAI,SAAS,IACjF,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAC5D,CACT;YACN,uCAAK,SAAS,EAAC,2BAA2B;gBACtC,8BAAC,kBAAQ,IAAC,MAAM,QAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAC,OAAO,IAClD,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAC5D,CACT,CACH,CACL,CACT,CAAC;AACN,CAAC,CAAC;AArJW,QAAA,kBAAkB,sBAqJ7B","sourcesContent":["import { AuthenticationContext, CognitoLoginState } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport React, { useContext, useState } from 'react';\nimport { FieldError, useForm } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport AutoAutoHeight from '@/animations/AutoAutoHeight';\nimport BEButton from '@/components/generic/BEButton';\nimport Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport TextBox from '@/components/generic/TextBox';\nimport { Color } from '@/util/Color';\n\nimport { isPasswordMatch, makeEmailPatternRule, makePasswordPatternRule, makeRequiredRule } from '../../../util/Validation';\nimport { PasswordBox } from '../../generic/PasswordBox/PasswordBox';\n\ntype ForgotPasswordFormProps = {\n onPasswordReset?: () => void;\n onCancelled?: () => void;\n onDone?: () => void;\n};\n\ntype ForgotPasswordFormValues = {\n email: string;\n code: number;\n password: string;\n confirmPassword: string;\n};\n\ntype LabelAndInputGroupProps = {\n component: React.ReactNode;\n label: string;\n\n error?: FieldError;\n};\n\nconst LabelAndInputGroup = (props: LabelAndInputGroupProps) => {\n const { label, component, error } = props;\n\n return (\n <div className=\"u-marg-bottom--light\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Label} color={Color.Navy} bold>\n {label}\n </Text>\n </div>\n {component}\n {!!error && (\n <p className=\"text-small\" style={{ color: '#ED4362' }}>\n {error.message}\n </p>\n )}\n </div>\n );\n};\n\nexport const ForgotPasswordForm = (props: ForgotPasswordFormProps) => {\n const { t } = useTranslation();\n\n const { cognitoLoginState, loading: cognitoLoading, forgotPassword, resetPassword, reset } = useContext(AuthenticationContext);\n const { hotel } = useCurrentHotel();\n\n const { register, formState, handleSubmit, watch, setError } = useForm<ForgotPasswordFormValues>({\n mode: 'onSubmit',\n });\n\n const [isLoading, setIsLoading] = useState(false);\n\n const getValidationClass = (name: keyof ForgotPasswordFormValues) => {\n if (formState.errors) {\n if (formState.errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n }\n };\n\n const forgotPasswordStates: CognitoLoginState[] = [CognitoLoginState.ForgotPassword, CognitoLoginState.CodeMismatch];\n\n const areResettingPassword = forgotPasswordStates.includes(cognitoLoginState as CognitoLoginState);\n\n const onSubmit = async (values: any) => {\n setIsLoading(true);\n\n try {\n if (areResettingPassword) {\n const state = await resetPassword(values.email, values.code, values.password, { hotel });\n if (state === CognitoLoginState.CodeMismatch)\n setError('code', {\n message: t(Translation.Navigation.ForgotPassword.Inputs.Code.Validation.InvalidCode),\n });\n else props.onDone?.();\n } else {\n const state = await forgotPassword(values.email, { hotel });\n if (state === CognitoLoginState.UserNotFound) {\n setError('email', {\n message: t(Translation.Navigation.ForgotPassword.Inputs.Email.Validation.UserNotFound),\n });\n }\n }\n } catch (ex) {\n console.error(ex);\n } finally {\n setIsLoading(false);\n }\n };\n\n const onCancelPressed = () => {\n reset();\n props.onCancelled?.();\n };\n\n return (\n <div>\n <div className=\"u-marg-bottom--heavy\">\n <Headline color={Color.Navy} bold className=\"u-marg-bottom--light\">\n {t(Translation.Navigation.ForgotPassword.Title)}\n </Headline>\n {areResettingPassword && (\n <Text type={TextType.Small} color={Color.Success}>\n {t(Translation.Navigation.ForgotPassword.CodeSent)}\n </Text>\n )}\n </div>\n\n <form onSubmit={handleSubmit(onSubmit)}>\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Email.Label)}\n error={formState.errors.email}\n component={\n <TextBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Email.Placeholder)}\n required\n validationStatus={getValidationClass('email')}\n inputProps={{ disabled: areResettingPassword || isLoading || cognitoLoading }}\n {...register('email', {\n required: true,\n pattern: makeEmailPatternRule(t),\n })}\n />\n }\n />\n\n <AutoAutoHeight open={areResettingPassword}>\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Code.Label)}\n error={formState.errors.code}\n component={\n <TextBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Code.Placeholder)}\n validationStatus={getValidationClass('code')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('code', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.Code.Label)),\n })}\n />\n }\n />\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Password.Label)}\n error={formState.errors.password}\n component={\n <PasswordBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Password.Placeholder)}\n validationStatus={getValidationClass('password')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('password', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.Password.Label)),\n pattern: makePasswordPatternRule(t),\n })}\n />\n }\n />\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label)}\n error={formState.errors.confirmPassword}\n component={\n <PasswordBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Placeholder)}\n validationStatus={getValidationClass('confirmPassword')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('confirmPassword', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label)),\n validate: {\n isSame: isPasswordMatch(t)(watch('password')),\n },\n })}\n />\n }\n />\n </AutoAutoHeight>\n <div className=\"u-marg-top\">\n <BEButton primary filled wide htmlType=\"submit\" isLoading={cognitoLoading || isLoading}>\n {t(Translation.Navigation.ForgotPassword.Inputs.SubmitButton.Label)}\n </BEButton>\n </div>\n <div className=\"u-marg-top u-align-center\">\n <BEButton isText onClick={onCancelPressed} size=\"small\">\n {t(Translation.Navigation.ForgotPassword.Inputs.CancelButton.Label)}\n </BEButton>\n </div>\n </form>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ForgotPasswordForm.js","sourceRoot":"/","sources":["src/components/User/Forms/ForgotPasswordForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8E;AAC9E,2CAAkD;AAClD,+CAA+D;AAC/D,qDAAsD;AACtD,iDAA+C;AAC/C,0DAAuD;AAEvD,iFAAyD;AACzD,6EAAqD;AACrD,6EAAqD;AACrD,kEAA2D;AAC3D,2EAAmD;AACnD,wCAAqC;AAErC,yDAA4H;AAC5H,uEAAoE;AAsBpE,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE;IAC1D,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAE1C,OAAO,CACH,uCAAK,SAAS,EAAC,sBAAsB;QACjC,uCAAK,SAAS,EAAC,sBAAsB;YACjC,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,IAAI,UAC9C,KAAK,CACH,CACL;QACL,SAAS;QACT,CAAC,CAAC,KAAK,IAAI,CACR,qCAAG,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAChD,KAAK,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AAE,SAAS,CAAC,MAAM,CAAC,eAAe,EACvC,SAAS,EACL,8BAAC,yBAAW,kBACR,WAAW,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,EACvF,gBAAgB,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,EACvD,UAAU,EAAE,EAAE,QAAQ,EAAE,SAAS,IAAI,cAAc,EAAE,IACjD,QAAQ,CAAC,iBAAiB,EAAE;wBAC5B,QAAQ,EAAE,IAAA,6BAAgB,EAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;wBACzH,QAAQ,EAAE;4BACN,MAAM,EAAE,IAAA,4BAAe,EAAC,CAAC,CAAC,CAAC,aAAa,CAAC;yBAC5C;qBACJ,CAAC,EACJ,GAER,CACW;YACjB,uCAAK,SAAS,EAAC,YAAY;gBACvB,8BAAC,kBAAQ,IAAC,OAAO,QAAC,MAAM,QAAC,IAAI,QAAC,QAAQ,EAAC,QAAQ,EAAC,SAAS,EAAE,cAAc,IAAI,SAAS,IACjF,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAC5D,CACT;YACN,uCAAK,SAAS,EAAC,2BAA2B;gBACtC,8BAAC,kBAAQ,IAAC,MAAM,QAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAC,OAAO,IAClD,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAC5D,CACT,CACH,CACL,CACT,CAAC;AACN,CAAC,CAAC;AA3JW,QAAA,kBAAkB,sBA2J7B","sourcesContent":["import { AuthenticationContext, CognitoLoginState } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport React, { useContext, useEffect, useState } from 'react';\nimport { FieldError, useForm } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport AutoAutoHeight from '@/animations/AutoAutoHeight';\nimport BEButton from '@/components/generic/BEButton';\nimport Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport TextBox from '@/components/generic/TextBox';\nimport { Color } from '@/util/Color';\n\nimport { isPasswordMatch, makeEmailPatternRule, makePasswordPatternRule, makeRequiredRule } from '../../../util/Validation';\nimport { PasswordBox } from '../../generic/PasswordBox/PasswordBox';\n\ntype ForgotPasswordFormProps = {\n onPasswordReset?: () => void;\n onCancelled?: () => void;\n onDone?: () => void;\n};\n\ntype ForgotPasswordFormValues = {\n email: string;\n code: number;\n password: string;\n confirmPassword: string;\n};\n\ntype LabelAndInputGroupProps = {\n component: React.ReactNode;\n label: string;\n\n error?: FieldError;\n};\n\nconst LabelAndInputGroup = (props: LabelAndInputGroupProps) => {\n const { label, component, error } = props;\n\n return (\n <div className=\"u-marg-bottom--light\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Label} color={Color.Navy} bold>\n {label}\n </Text>\n </div>\n {component}\n {!!error && (\n <p className=\"text-small\" style={{ color: '#ED4362' }}>\n {error.message}\n </p>\n )}\n </div>\n );\n};\n\nexport const ForgotPasswordForm = (props: ForgotPasswordFormProps) => {\n const { t } = useTranslation();\n\n const { cognitoLoginState, loading: cognitoLoading, forgotPassword, resetPassword, reset } = useContext(AuthenticationContext);\n const { hotel } = useCurrentHotel();\n\n const { register, trigger, formState, handleSubmit, watch, setError } = useForm<ForgotPasswordFormValues>({\n mode: 'onSubmit',\n });\n\n const passwordWatch = watch('password');\n\n useEffect(() => {\n trigger('confirmPassword');\n }, [passwordWatch, trigger]);\n\n const [isLoading, setIsLoading] = useState(false);\n\n const getValidationClass = (name: keyof ForgotPasswordFormValues) => {\n if (formState.errors) {\n if (formState.errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n }\n };\n\n const forgotPasswordStates: CognitoLoginState[] = [CognitoLoginState.ForgotPassword, CognitoLoginState.CodeMismatch];\n\n const areResettingPassword = forgotPasswordStates.includes(cognitoLoginState as CognitoLoginState);\n\n const onSubmit = async (values: any) => {\n setIsLoading(true);\n\n try {\n if (areResettingPassword) {\n const state = await resetPassword(values.email, values.code, values.password, { hotel });\n if (state === CognitoLoginState.CodeMismatch)\n setError('code', {\n message: t(Translation.Navigation.ForgotPassword.Inputs.Code.Validation.InvalidCode),\n });\n else props.onDone?.();\n } else {\n const state = await forgotPassword(values.email, { hotel });\n if (state === CognitoLoginState.UserNotFound) {\n setError('email', {\n message: t(Translation.Navigation.ForgotPassword.Inputs.Email.Validation.UserNotFound),\n });\n }\n }\n } catch (ex) {\n console.error(ex);\n } finally {\n setIsLoading(false);\n }\n };\n\n const onCancelPressed = () => {\n reset();\n props.onCancelled?.();\n };\n\n return (\n <div>\n <div className=\"u-marg-bottom--heavy\">\n <Headline color={Color.Navy} bold className=\"u-marg-bottom--light\">\n {t(Translation.Navigation.ForgotPassword.Title)}\n </Headline>\n {areResettingPassword && (\n <Text type={TextType.Small} color={Color.Success}>\n {t(Translation.Navigation.ForgotPassword.CodeSent)}\n </Text>\n )}\n </div>\n\n <form onSubmit={handleSubmit(onSubmit)}>\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Email.Label)}\n error={formState.errors.email}\n component={\n <TextBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Email.Placeholder)}\n required\n validationStatus={getValidationClass('email')}\n inputProps={{ disabled: areResettingPassword || isLoading || cognitoLoading }}\n {...register('email', {\n required: true,\n pattern: makeEmailPatternRule(t),\n })}\n />\n }\n />\n\n <AutoAutoHeight open={areResettingPassword}>\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Code.Label)}\n error={formState.errors.code}\n component={\n <TextBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Code.Placeholder)}\n validationStatus={getValidationClass('code')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('code', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.Code.Label)),\n })}\n />\n }\n />\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.Password.Label)}\n error={formState.errors.password}\n component={\n <PasswordBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.Password.Placeholder)}\n validationStatus={getValidationClass('password')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('password', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.Password.Label)),\n pattern: makePasswordPatternRule(t),\n })}\n />\n }\n />\n <LabelAndInputGroup\n label={t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label)}\n error={formState.errors.confirmPassword}\n component={\n <PasswordBox\n placeholder={t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Placeholder)}\n validationStatus={getValidationClass('confirmPassword')}\n inputProps={{ disabled: isLoading || cognitoLoading }}\n {...register('confirmPassword', {\n required: makeRequiredRule(t)(areResettingPassword, t(Translation.Navigation.ForgotPassword.Inputs.RepeatPassword.Label)),\n validate: {\n isSame: isPasswordMatch(t)(passwordWatch),\n },\n })}\n />\n }\n />\n </AutoAutoHeight>\n <div className=\"u-marg-top\">\n <BEButton primary filled wide htmlType=\"submit\" isLoading={cognitoLoading || isLoading}>\n {t(Translation.Navigation.ForgotPassword.Inputs.SubmitButton.Label)}\n </BEButton>\n </div>\n <div className=\"u-marg-top u-align-center\">\n <BEButton isText onClick={onCancelPressed} size=\"small\">\n {t(Translation.Navigation.ForgotPassword.Inputs.CancelButton.Label)}\n </BEButton>\n </div>\n </form>\n </div>\n );\n};\n"]}
|
|
@@ -20,6 +20,12 @@ function InputGroup(props) {
|
|
|
20
20
|
(childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[0]) && react_1.default.createElement("div", null, childrenArray[0]),
|
|
21
21
|
(childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[1]) && react_1.default.createElement("div", { className: ((_b = (_a = childrenArray[1]) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.name) === InputGroup.name ? 'no-marg' : '' }, childrenArray[1])));
|
|
22
22
|
break;
|
|
23
|
+
case '1/2/2':
|
|
24
|
+
innerLayout = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
|
+
(childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[0]) && react_1.default.createElement("div", null, childrenArray[0]),
|
|
26
|
+
(childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[1]) && react_1.default.createElement("div", null, childrenArray[1]),
|
|
27
|
+
(childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[2]) && react_1.default.createElement("div", null, childrenArray[2])));
|
|
28
|
+
break;
|
|
23
29
|
case '1':
|
|
24
30
|
default:
|
|
25
31
|
innerLayout = props.children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.js","sourceRoot":"/","sources":["src/components/generic/InputGroup/InputGroup.tsx"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,kDAAyC;AAUzC,SAAwB,UAAU,CAAC,KAAsB;;IACrD,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,eAAe,EAAE;QACxC,CAAC,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU;KAChD,CAAC,CAAC;IAEH,IAAI,WAAW,CAAC;IAEhB,MAAM,aAAa,GAAU,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpE,QAAQ,KAAK,CAAC,UAAU,EAAE;QACtB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACN,WAAW,GAAG,CACV;gBACK,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CA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C,CAAC,KAAI,uCAAK,SAAS,EAAE,CAAA,MAAA,MAAA,aAAa,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,IAAI,MAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAG,aAAa,CAAC,CAAC,CAAC,CAAO,CACnI,CACN,CAAC;YAEF,MAAM;QACV,KAAK,OAAO;YACR,WAAW,GAAG,CACV;gBACK,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,CAAC,CAAC,KAAI,2CAAM,aAAa,CAAC,CAAC,CAAC,CAAO;gBACnD,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,CAAC,CAAC,KAAI,2CAAM,aAAa,CAAC,CAAC,CAAC,CAAO;gBACnD,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,CAAC,CAAC,KAAI,2CAAM,aAAa,CAAC,CAAC,CAAC,CAAO,CACrD,CACN,CAAC;YAEF,MAAM;QACV,KAAK,GAAG,CAAC;QACT;YACI,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC7B,MAAM;KACb;IAED,OAAO,uCAAK,SAAS,EAAE,OAAO,IAAG,WAAW,CAAO,CAAC;AACxD,CAAC;AArCD,6BAqCC","sourcesContent":["import classNames from 'classnames';\nimport React, { ReactNode } from 'react';\n\nimport { InputGroupDimensions } from '@/components/generic/InputGroup/InputGroup.types';\n\nexport interface InputGroupProps {\n children: ReactNode | ReactNode[];\n\n dimensions?: InputGroupDimensions;\n}\n\nexport default function InputGroup(props: InputGroupProps) {\n const classes = classNames('be-form-group', {\n [`s-${props.dimensions}`]: !!props.dimensions,\n });\n\n let innerLayout;\n\n const childrenArray: any[] = React.Children.toArray(props.children);\n switch (props.dimensions) {\n case '1/3':\n case '3/1':\n case '2/2':\n innerLayout = (\n <>\n {childrenArray?.[0] && <div>{childrenArray[0]}</div>}\n {childrenArray?.[1] && <div className={childrenArray[1]?.type?.name === InputGroup.name ? 'no-marg' : ''}>{childrenArray[1]}</div>}\n </>\n );\n\n break;\n case '1/2/2':\n innerLayout = (\n <>\n {childrenArray?.[0] && <div>{childrenArray[0]}</div>}\n {childrenArray?.[1] && <div>{childrenArray[1]}</div>}\n {childrenArray?.[2] && <div>{childrenArray[2]}</div>}\n </>\n );\n\n break;\n case '1':\n default:\n innerLayout = props.children;\n break;\n }\n\n return <div className={classes}>{innerLayout}</div>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type InputGroupDimensions = '1' | '2/2' | '3/1' | '1/3';
|
|
1
|
+
export type InputGroupDimensions = '1' | '2/2' | '3/1' | '1/3' | '1/2/2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.types.js","sourceRoot":"/","sources":["src/components/generic/InputGroup/InputGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["export type InputGroupDimensions = '1' | '2/2' | '3/1' | '1/3';\n"]}
|
|
1
|
+
{"version":3,"file":"InputGroup.types.js","sourceRoot":"/","sources":["src/components/generic/InputGroup/InputGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["export type InputGroupDimensions = '1' | '2/2' | '3/1' | '1/3' | '1/2/2';\n"]}
|
|
@@ -46,7 +46,7 @@ function InputSelect({ value, onChange, options, keyName, labelName, label, plac
|
|
|
46
46
|
react_1.default.createElement(TextBox_1.default, { label: label, inputProps: {
|
|
47
47
|
onClick: onTriggerClicked,
|
|
48
48
|
autoComplete: 'off',
|
|
49
|
-
}, value: ((_a = getOption(value)) === null || _a === void 0 ? void 0 : _a[labelName]) || '', ref: innerRef, placeholder: placeholder, required: required, validationStatus: validationStatus, className: InputSelect_module_scss_1.default['text-input'], icon: Icon_1.IconType.
|
|
49
|
+
}, value: ((_a = getOption(value)) === null || _a === void 0 ? void 0 : _a[labelName]) || '', ref: innerRef, placeholder: placeholder, required: required, validationStatus: validationStatus, className: InputSelect_module_scss_1.default['text-input'], icon: Icon_1.IconType.Dropdown, iconProps: { size: '18px' }, iconPosition: "right" }),
|
|
50
50
|
react_1.default.createElement("div", { ref: setContainer, style: { width: '100%', display: 'block' } }),
|
|
51
51
|
react_1.default.createElement(Select_1.Select, { keyName: keyName, labelName: labelName, options: options, target: container, onClose: onDropdownClosed, onChange: (value) => {
|
|
52
52
|
onItemSelected();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelect.js","sourceRoot":"/","sources":["src/components/generic/Select/InputSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8D;AAE9D,+DAAiF;AACjF,2EAAqE;AACrE,iEAAiE;AAEjE,uCAAwC;AACxC,wFAA+C;AAO/C,SAAwB,WAAW,CAA0D,EACzF,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,gBAAgB,GACkB;;IAClC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAwB,IAAI,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAEhD,MAAM,SAAS,GAAG,CAAC,GAAsB,EAAuB,EAAE;QAC9D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,IAAA,wCAAoB,EAAC;QAChG,GAAG,EAAE,QAAQ,CAAC,OAAO;KACxB,CAAC,CAAC;IAEH,OAAO,CACH;QACI,8BAAC,iBAAO,IACJ,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE;gBACR,OAAO,EAAE,gBAAgB;gBACzB,YAAY,EAAE,KAAK;aACtB,EACD,KAAK,EAAE,CAAA,MAAA,SAAS,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A,SAAS,CAAC,KAAK,CAAC,0CAAG,SAAS,CAAC,KAAI,EAAE,EAC1C,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,iCAAM,CAAC,YAAY,CAAC,EAC/B,IAAI,EAAE,eAAQ,CAAC,QAAQ,EACvB,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAC3B,YAAY,EAAC,OAAO,GACtB;QACF,uCAAK,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAI;QACtE,8BAAC,eAAM,IACH,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,cAAc,EAAE,CAAC;gBACjB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,CAAC,CAAC;YACtB,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,cAAc,GACtB,CACH,CACN,CAAC;AACN,CAAC;AAxDD,8BAwDC","sourcesContent":["import React, { ReactElement, useRef, useState } from 'react';\n\nimport { Option, Select, SelectProps } from '@/components/generic/Select/Select';\nimport TextBox, { TextBoxProps } from '@/components/generic/TextBox';\nimport { useAutoFocusOnSelect } from '@/hooks/AutoFocusOnSelect';\n\nimport { IconType } from '../Icon/Icon';\nimport styles from './InputSelect.module.scss';\n\ntype IInputSelectProps<TOption extends Option<KeyName>, KeyName extends string> = Pick<SelectProps<TOption, KeyName>, 'value' | 'onChange' | 'keyName' | 'labelName'> &\n Pick<TextBoxProps, 'label' | 'placeholder' | 'required' | 'validationStatus'> & {\n options: TOption[];\n };\n\nexport default function InputSelect<TOption extends Option<KeyName>, KeyName extends string>({\n value,\n onChange,\n options,\n keyName,\n labelName,\n label,\n placeholder,\n required,\n validationStatus,\n}: IInputSelectProps<TOption, KeyName>): ReactElement | null {\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const innerRef = useRef<HTMLInputElement>(null);\n\n const getOption = (key?: TOption[KeyName]): TOption | undefined => {\n return options.find((option) => option[keyName] === key);\n };\n\n const { onDropdownClosed, onItemSelected, onTriggerClicked, isDropdownOpen } = useAutoFocusOnSelect({\n ref: innerRef.current,\n });\n\n return (\n <>\n <TextBox\n label={label}\n inputProps={{\n onClick: onTriggerClicked,\n autoComplete: 'off',\n }}\n value={getOption(value)?.[labelName] || ''}\n ref={innerRef}\n placeholder={placeholder}\n required={required}\n validationStatus={validationStatus}\n className={styles['text-input']}\n icon={IconType.Dropdown}\n iconProps={{ size: '18px' }}\n iconPosition=\"right\"\n />\n <div ref={setContainer} style={{ width: '100%', display: 'block' }} />\n <Select<TOption, KeyName>\n keyName={keyName}\n labelName={labelName}\n options={options}\n target={container}\n onClose={onDropdownClosed}\n onChange={(value) => {\n onItemSelected();\n onChange?.(value);\n }}\n value={value}\n open={isDropdownOpen}\n />\n </>\n );\n}\n"]}
|
|
@@ -111,13 +111,13 @@ const EditMyProfile = () => {
|
|
|
111
111
|
react_1.default.createElement(TextBox_1.default, Object.assign({ inputProps: { className: '' } }, register('address.zip'), { label: t(Translation_1.Translation.UserPortal.ProfileScreen.Field.Zip) })),
|
|
112
112
|
react_1.default.createElement(ForwardedSelect_1.default, Object.assign({}, register('address.country'), { options: countriesOptions, label: t(Translation_1.Translation.UserPortal.ProfileScreen.Field.Country) })))),
|
|
113
113
|
react_1.default.createElement(InputGroup_1.default, null,
|
|
114
|
-
react_1.default.createElement(PasswordBox_1.PasswordBox, Object.assign({}, register('currentPassword'), { label: t(Translation_1.Translation.UserPortal.
|
|
114
|
+
react_1.default.createElement(PasswordBox_1.PasswordBox, Object.assign({}, register('currentPassword'), { label: t(Translation_1.Translation.UserPortal.ChangePassword.Field.CurrentPassword) })),
|
|
115
115
|
react_1.default.createElement(PasswordBox_1.PasswordBox, Object.assign({}, register('newPassword', {
|
|
116
116
|
pattern: (0, Validation_1.makePasswordPatternRule)(t),
|
|
117
|
-
}), { label: t(Translation_1.Translation.UserPortal.
|
|
117
|
+
}), { label: t(Translation_1.Translation.UserPortal.ChangePassword.Field.NewPassword) })),
|
|
118
118
|
react_1.default.createElement(PasswordBox_1.PasswordBox, Object.assign({}, register('confirmPassword', {
|
|
119
119
|
pattern: (0, Validation_1.makePasswordPatternRule)(t),
|
|
120
|
-
}), { label: t(Translation_1.Translation.UserPortal.
|
|
120
|
+
}), { label: t(Translation_1.Translation.UserPortal.ChangePassword.Field.ConfirmPassword) })),
|
|
121
121
|
cognitoError && (react_1.default.createElement("p", { className: "text-small", style: { color: '#ED4362' } }, cognitoError === null || cognitoError === void 0 ? void 0 : cognitoError.message))),
|
|
122
122
|
react_1.default.createElement("button", { type: "submit", disabled: loading, color: "primary" }, t(Translation_1.Translation.Misc.SaveAllChanges))))) : (react_1.default.createElement(LargeLoader_1.default, null))));
|
|
123
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditMyProfile.js","sourceRoot":"/","sources":["src/components/members/EditMyProfile.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmG;AAEnG,+CAA8D;AAC9D,qDAAsD;AACtD,iDAA+C;AAE/C,6IAAqH;AACrH,2FAAqF;AACrF,4FAAoE;AACpE,0FAAkE;AAClE,2EAAmD;AACnD,4EAA0E;AAC1E,4DAAyD;AACzD,kDAA4D;AAE5D,oEAAiE;AAEjE,MAAM,aAAa,GAAa,GAAG,EAAE;IACjC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IAC3F,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAA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AAW,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CACpI,CACJ;YAEb,8BAAC,oBAAU;gBACP,8BAAC,yBAAW,oBAAK,QAAQ,CAAC,iBAAiB,CAAC,IAAE,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI;gBACtH,8BAAC,yBAAW,oBACJ,QAAQ,CAAC,aAAa,EAAE;oBACxB,OAAO,EAAE,IAAA,oCAAuB,EAAC,CAAC,CAAC;iBACtC,CAAC,IACF,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,IAClE;gBACF,8BAAC,yBAAW,oBACJ,QAAQ,CAAC,iBAAiB,EAAE;oBAC5B,OAAO,EAAE,IAAA,oCAAuB,EAAC,CAAC,CAAC;iBACtC,CAAC,IACF,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,IACtE;gBACD,YAAY,IAAI,CACb,qCAAG,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAChD,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CACtB,CACP,CACQ;YAEb,0CAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAC,SAAS,IACnD,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAC9B,CACN,CAIL,CACT,CAAC,CAAC,CAAC,CACA,8BAAC,qBAAW,OAAG,CAClB,CACF,CACN,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["import { AuthenticationContext, IChangePassword, RoomstayMemberContext } from '@frontend/contexts';\nimport { IRoomstayMember } from '@roomstay/core';\nimport React, { useContext, useEffect, useMemo } from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nimport EnhancedPhoneNumberField from '@/components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField';\nimport ForwardedSelect, { SelectOption } from '@/components/generic/ForwardedSelect';\nimport InputGroup from '@/components/generic/InputGroup/InputGroup';\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport TextBox from '@/components/generic/TextBox';\nimport { ListOfCountriesAndCodes } from '@/models/CountryCodesAndNumbers';\nimport { Translation } from '@/translations/Translation';\nimport { makePasswordPatternRule } from '@/util/Validation';\n\nimport { PasswordBox } from '../generic/PasswordBox/PasswordBox';\n\nconst EditMyProfile: React.FC = () => {\n const { roomstayMember, loading, updateMemberDetails } = useContext(RoomstayMemberContext);\n const { error: cognitoError } = useContext(AuthenticationContext);\n\n const { handleSubmit, register, reset, control, formState, setError } = useForm<IRoomstayMember & IChangePassword>({\n defaultValues: useMemo(() => roomstayMember, [roomstayMember]),\n });\n const { t } = useTranslation();\n\n useEffect(() => {\n reset(roomstayMember);\n }, [roomstayMember, reset]);\n\n const onSubmit = async (data: IRoomstayMember & IChangePassword) => {\n if (data?.currentPassword || data?.newPassword || data?.confirmPassword) {\n if (data.newPassword !== data.confirmPassword) {\n setError('confirmPassword', { message: t(Translation.UserPortal.ProfileScreen.Validation.Password.DoesNotMatch) });\n return;\n }\n }\n await updateMemberDetails?.(data);\n reset({ ...roomstayMember, currentPassword: '', newPassword: '', confirmPassword: '' });\n };\n\n const countriesOptions: SelectOption[] = useMemo(() => {\n const countries = ListOfCountriesAndCodes.map(({ label }) => ({ label, value: label }));\n countries.unshift({ label: '', value: '' });\n return countries;\n }, []);\n\n const getValidationClass = (field: keyof (IRoomstayMember & IChangePassword)) => {\n if (formState.errors && formState.touchedFields[field]) {\n if (formState.errors[field]) {\n return 'error';\n } else {\n return 'success';\n }\n } else {\n return null;\n }\n };\n\n return (\n <>\n {roomstayMember ? (\n <div>\n <form onSubmit={handleSubmit(onSubmit)}>\n <InputGroup>\n <>\n <input className=\"c-input textbox\" disabled value={roomstayMember?.email} />\n </>\n <TextBox {...register('forename')} label={t(Translation.UserPortal.ProfileScreen.Field.Forename)} />\n <TextBox {...register('surname')} label={t(Translation.UserPortal.ProfileScreen.Field.Surname)} />\n <>\n <Controller\n control={control}\n name=\"phoneNumber\"\n rules={{\n maxLength: {\n value: 17,\n message: t(Translation.UserPortal.ProfileScreen.Validation.Phone.IsTooLong),\n },\n pattern: {\n value: /^\\+[1-9]( |\\d){1,15}$/g,\n message: t(Translation.UserPortal.ProfileScreen.Validation.Phone.IsNotValid),\n },\n }}\n render={({ field }) => <EnhancedPhoneNumberField {...field} onChange={field.onChange} validationStatus={getValidationClass('phoneNumber')} />}\n />\n </>\n </InputGroup>\n\n <InputGroup>\n <TextBox {...register('address.address')} label={t(Translation.UserPortal.ProfileScreen.Field.Address)} />\n <TextBox {...register('address.city')} label={t(Translation.UserPortal.ProfileScreen.Field.City)} />\n <InputGroup dimensions=\"2/2\">\n <TextBox inputProps={{ className: '' }} {...register('address.zip')} label={t(Translation.UserPortal.ProfileScreen.Field.Zip)} />\n <ForwardedSelect {...register('address.country')} options={countriesOptions} label={t(Translation.UserPortal.ProfileScreen.Field.Country)} />\n </InputGroup>\n </InputGroup>\n\n <InputGroup>\n <PasswordBox {...register('currentPassword')} label={t(Translation.UserPortal.ProfileScreen.Field.CurrentPassword)} />\n <PasswordBox\n {...register('newPassword', {\n pattern: makePasswordPatternRule(t),\n })}\n label={t(Translation.UserPortal.ProfileScreen.Field.NewPassword)}\n />\n <PasswordBox\n {...register('confirmPassword', {\n pattern: makePasswordPatternRule(t),\n })}\n label={t(Translation.UserPortal.ProfileScreen.Field.ConfirmPassword)}\n />\n {cognitoError && (\n <p className=\"text-small\" style={{ color: '#ED4362' }}>\n {cognitoError?.message}\n </p>\n )}\n </InputGroup>\n\n <button type=\"submit\" disabled={loading} color=\"primary\">\n {t(Translation.Misc.SaveAllChanges)}\n </button>\n </form>\n {/* <Backdrop open={loading} style={{ zIndex: 1234 }}>\n <LargeLoader />\n </Backdrop> */}\n </div>\n ) : (\n <LargeLoader />\n )}\n </>\n );\n};\n\nexport default EditMyProfile;\n"]}
|
|
1
|
+
{"version":3,"file":"EditMyProfile.js","sourceRoot":"/","sources":["src/components/members/EditMyProfile.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmG;AAEnG,+CAA8D;AAC9D,qDAAsD;AACtD,iDAA+C;AAE/C,6IAAqH;AACrH,2FAAqF;AACrF,4FAAoE;AACpE,0FAAkE;AAClE,2EAAmD;AACnD,4EAA0E;AAC1E,4DAAyD;AACzD,kDAA4D;AAE5D,oEAAiE;AAEjE,MAAM,aAAa,GAAa,GAAG,EAAE;IACjC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IAC3F,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IAElE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,yBAAO,EAAoC;QAC/G,aAAa,EAAE,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,CAAC;KACjE,CAAC,CAAC;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAE/B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,KAAK,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,CAAC;IAE5B,MAAM,QAAQ,GAAG,CAAO,IAAuC,EAAE,EAAE;QAC/D,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe,MAAI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,CAAC,IACF,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,IACvE;gBACD,YAAY,IAAI,CACb,qCAAG,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAChD,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CACtB,CACP,CACQ;YAEb,0CAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAC,SAAS,IACnD,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAC9B,CACN,CAIL,CACT,CAAC,CAAC,CAAC,CACA,8BAAC,qBAAW,OAAG,CAClB,CACF,CACN,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["import { AuthenticationContext, IChangePassword, RoomstayMemberContext } from '@frontend/contexts';\nimport { IRoomstayMember } from '@roomstay/core';\nimport React, { useContext, useEffect, useMemo } from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\n\nimport EnhancedPhoneNumberField from '@/components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField';\nimport ForwardedSelect, { SelectOption } from '@/components/generic/ForwardedSelect';\nimport InputGroup from '@/components/generic/InputGroup/InputGroup';\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport TextBox from '@/components/generic/TextBox';\nimport { ListOfCountriesAndCodes } from '@/models/CountryCodesAndNumbers';\nimport { Translation } from '@/translations/Translation';\nimport { makePasswordPatternRule } from '@/util/Validation';\n\nimport { PasswordBox } from '../generic/PasswordBox/PasswordBox';\n\nconst EditMyProfile: React.FC = () => {\n const { roomstayMember, loading, updateMemberDetails } = useContext(RoomstayMemberContext);\n const { error: cognitoError } = useContext(AuthenticationContext);\n\n const { handleSubmit, register, reset, control, formState, setError } = useForm<IRoomstayMember & IChangePassword>({\n defaultValues: useMemo(() => roomstayMember, [roomstayMember]),\n });\n const { t } = useTranslation();\n\n useEffect(() => {\n reset(roomstayMember);\n }, [roomstayMember, reset]);\n\n const onSubmit = async (data: IRoomstayMember & IChangePassword) => {\n if (data?.currentPassword || data?.newPassword || data?.confirmPassword) {\n if (data.newPassword !== data.confirmPassword) {\n setError('confirmPassword', { message: t(Translation.UserPortal.ProfileScreen.Validation.Password.DoesNotMatch) });\n return;\n }\n }\n await updateMemberDetails?.(data);\n reset({ ...roomstayMember, currentPassword: '', newPassword: '', confirmPassword: '' });\n };\n\n const countriesOptions: SelectOption[] = useMemo(() => {\n const countries = ListOfCountriesAndCodes.map(({ label }) => ({ label, value: label }));\n countries.unshift({ label: '', value: '' });\n return countries;\n }, []);\n\n const getValidationClass = (field: keyof (IRoomstayMember & IChangePassword)) => {\n if (formState.errors && formState.touchedFields[field]) {\n if (formState.errors[field]) {\n return 'error';\n } else {\n return 'success';\n }\n } else {\n return null;\n }\n };\n\n return (\n <>\n {roomstayMember ? (\n <div>\n <form onSubmit={handleSubmit(onSubmit)}>\n <InputGroup>\n <>\n <input className=\"c-input textbox\" disabled value={roomstayMember?.email} />\n </>\n <TextBox {...register('forename')} label={t(Translation.UserPortal.ProfileScreen.Field.Forename)} />\n <TextBox {...register('surname')} label={t(Translation.UserPortal.ProfileScreen.Field.Surname)} />\n <>\n <Controller\n control={control}\n name=\"phoneNumber\"\n rules={{\n maxLength: {\n value: 17,\n message: t(Translation.UserPortal.ProfileScreen.Validation.Phone.IsTooLong),\n },\n pattern: {\n value: /^\\+[1-9]( |\\d){1,15}$/g,\n message: t(Translation.UserPortal.ProfileScreen.Validation.Phone.IsNotValid),\n },\n }}\n render={({ field }) => <EnhancedPhoneNumberField {...field} onChange={field.onChange} validationStatus={getValidationClass('phoneNumber')} />}\n />\n </>\n </InputGroup>\n\n <InputGroup>\n <TextBox {...register('address.address')} label={t(Translation.UserPortal.ProfileScreen.Field.Address)} />\n <TextBox {...register('address.city')} label={t(Translation.UserPortal.ProfileScreen.Field.City)} />\n <InputGroup dimensions=\"2/2\">\n <TextBox inputProps={{ className: '' }} {...register('address.zip')} label={t(Translation.UserPortal.ProfileScreen.Field.Zip)} />\n <ForwardedSelect {...register('address.country')} options={countriesOptions} label={t(Translation.UserPortal.ProfileScreen.Field.Country)} />\n </InputGroup>\n </InputGroup>\n\n <InputGroup>\n <PasswordBox {...register('currentPassword')} label={t(Translation.UserPortal.ChangePassword.Field.CurrentPassword)} />\n <PasswordBox\n {...register('newPassword', {\n pattern: makePasswordPatternRule(t),\n })}\n label={t(Translation.UserPortal.ChangePassword.Field.NewPassword)}\n />\n <PasswordBox\n {...register('confirmPassword', {\n pattern: makePasswordPatternRule(t),\n })}\n label={t(Translation.UserPortal.ChangePassword.Field.ConfirmPassword)}\n />\n {cognitoError && (\n <p className=\"text-small\" style={{ color: '#ED4362' }}>\n {cognitoError?.message}\n </p>\n )}\n </InputGroup>\n\n <button type=\"submit\" disabled={loading} color=\"primary\">\n {t(Translation.Misc.SaveAllChanges)}\n </button>\n </form>\n {/* <Backdrop open={loading} style={{ zIndex: 1234 }}>\n <LargeLoader />\n </Backdrop> */}\n </div>\n ) : (\n <LargeLoader />\n )}\n </>\n );\n};\n\nexport default EditMyProfile;\n"]}
|
|
@@ -33,7 +33,7 @@ const BookingAPI_1 = __importDefault(require("../../../api/BookingAPI"));
|
|
|
33
33
|
const StepLayout_1 = require("../../generic/Layout/StepLayout");
|
|
34
34
|
const LargeLoader_1 = __importDefault(require("../../generic/loader/LargeLoader"));
|
|
35
35
|
const AddonCard_1 = __importDefault(require("./AddonCard"));
|
|
36
|
-
const
|
|
36
|
+
const AddonsNotFoundBlock_1 = __importDefault(require("./AddonsNotFoundBlock"));
|
|
37
37
|
const StepRoomSummaryAndButton_1 = __importDefault(require("../room/StepRoomSummaryAndButton"));
|
|
38
38
|
const AddonList = () => {
|
|
39
39
|
const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
|
|
@@ -53,7 +53,7 @@ const AddonList = () => {
|
|
|
53
53
|
react_1.default.createElement(StepLayout_1.StepLayoutContainer, null,
|
|
54
54
|
react_1.default.createElement(StepLayout_1.StepLayoutLeftContent, null, !isLoading ? ((addons === null || addons === void 0 ? void 0 : addons.length) ? (addons.map((addon, index) => {
|
|
55
55
|
return react_1.default.createElement(AddonCard_1.default, { key: index, className: "u-marg-bottom", addon: addon });
|
|
56
|
-
})) : (react_1.default.createElement(
|
|
56
|
+
})) : (react_1.default.createElement(AddonsNotFoundBlock_1.default, null))) : (react_1.default.createElement(LargeLoader_1.default, null))),
|
|
57
57
|
react_1.default.createElement(StepLayout_1.StepLayoutRightContent, null,
|
|
58
58
|
react_1.default.createElement(StepRoomSummaryAndButton_1.default, null)))));
|
|
59
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddonList.js","sourceRoot":"/","sources":["src/components/steps/addons/AddonList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmE;AACnE,2CAAkD;AAClD,+CAAoD;AAEpD,kEAAmC;AACnC,uEAA4H;AAC5H,0FAAkE;AAClE,oFAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"AddonList.js","sourceRoot":"/","sources":["src/components/steps/addons/AddonList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmE;AACnE,2CAAkD;AAClD,+CAAoD;AAEpD,kEAAmC;AACnC,uEAA4H;AAC5H,0FAAkE;AAClE,oFAA4D;AAC5D,wGAAgF;AAChF,gHAAwF;AAGxF,MAAM,SAAS,GAAG,GAAG,EAAE;IACnB,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,yBAAc,CAAC,CAAC;IAEvC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAEpC,MAAM,IAAI,GAAG,aAAa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ext, CompanyContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport React, { useContext, useState } from 'react';\n\nimport API from '@/api/BookingAPI';\nimport { StepLayoutContainer, StepLayoutLeftContent, StepLayoutRightContent } from '@/components/generic/Layout/StepLayout';\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport AddonCard from '@/components/steps/addons/AddonCard';\nimport AddonsNotFoundBlock from '@/components/steps/addons/AddonsNotFoundBlock';\nimport StepRoomSummaryAndButton from '@/components/steps/room/StepRoomSummaryAndButton';\nimport { Addon } from '@/models/Addon/Addon';\n\nconst AddonList = () => {\n const basketContext = useContext(BasketContext);\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const rows = basketContext.getAllValidRows();\n const [addons, setAddons] = useState<Addon[] | null>(null);\n const [isLoading, setLoading] = useState(false);\n\n React.useEffect(() => {\n setLoading(true);\n API.Addons.findAddons(rows, hotel?.hotelID as string).then((foundedAddons) => {\n setLoading(false);\n setAddons(foundedAddons);\n });\n }, [ccx.currentLanguage]);\n\n return (\n <div className=\"u-flex\">\n <StepLayoutContainer>\n <StepLayoutLeftContent>\n {!isLoading ? (\n addons?.length ? (\n addons.map((addon: Addon, index: number) => {\n return <AddonCard key={index} className=\"u-marg-bottom\" addon={addon} />;\n })\n ) : (\n <AddonsNotFoundBlock />\n )\n ) : (\n <LargeLoader />\n )}\n </StepLayoutLeftContent>\n\n <StepLayoutRightContent>\n <StepRoomSummaryAndButton />\n </StepLayoutRightContent>\n </StepLayoutContainer>\n </div>\n );\n};\n\nexport default AddonList;\n"]}
|
|
@@ -3,14 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BE_NO_ADDONS_FOUND_BLOCK = void 0;
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
8
|
const react_i18next_1 = require("react-i18next");
|
|
8
9
|
const Translation_1 = require("translations/Translation");
|
|
9
10
|
const Headline_1 = __importDefault(require("../../generic/Headline"));
|
|
10
11
|
const Text_1 = __importDefault(require("../../generic/Text"));
|
|
12
|
+
const DIProvider_1 = require("../../../providers/DIProvider");
|
|
11
13
|
const Color_1 = require("../../../util/Color");
|
|
12
14
|
const TravelerNotfound_1 = __importDefault(require("../../graphics/TravelerNotfound"));
|
|
13
|
-
function
|
|
15
|
+
function OriginalAddonsNotFoundBlock() {
|
|
14
16
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
15
17
|
return (react_1.default.createElement("div", { className: "u-align-center" },
|
|
16
18
|
react_1.default.createElement("div", { className: "u-marg-bottom--heavy" },
|
|
@@ -19,5 +21,9 @@ function AddonsNotFound() {
|
|
|
19
21
|
react_1.default.createElement(Headline_1.default, { size: "large", bold: true }, t(Translation_1.Translation.Step.Addon.NotFound.Title))),
|
|
20
22
|
react_1.default.createElement(Text_1.default, { color: Color_1.Color.DarkGrey }, t(Translation_1.Translation.Step.Addon.NotFound.Message))));
|
|
21
23
|
}
|
|
22
|
-
exports.
|
|
23
|
-
|
|
24
|
+
exports.BE_NO_ADDONS_FOUND_BLOCK = 'BENoAddonsFoundBlock';
|
|
25
|
+
function AddonsNotFoundBlock() {
|
|
26
|
+
return (0, DIProvider_1.withDI)(exports.BE_NO_ADDONS_FOUND_BLOCK, OriginalAddonsNotFoundBlock, null);
|
|
27
|
+
}
|
|
28
|
+
exports.default = AddonsNotFoundBlock;
|
|
29
|
+
//# sourceMappingURL=AddonsNotFoundBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddonsNotFoundBlock.js","sourceRoot":"/","sources":["src/components/steps/addons/AddonsNotFoundBlock.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,qEAA6C;AAC7C,uDAAgD;AAChD,wCAAqC;AAErC,uFAA+D;AAE/D,SAAS,2BAA2B;IAChC,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,OAAO,CACH,uCAAK,SAAS,EAAC,gBAAgB;QAC3B,uCAAK,SAAS,EAAC,sBAAsB;YAEjC,8BAAC,0BAAgB,OAAG,CAClB;QACN,uCAAK,SAAS,EAAC,eAAe;YAC1B,8BAAC,kBAAQ,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,UACtB,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAClC,CACT;QACN,8BAAC,cAAI,IAAC,KAAK,EAAE,aAAK,CAAC,QAAQ,IAAG,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAQ,CAC9E,CACT,CAAC;AACN,CAAC;AACY,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D,SAAwB,mBAAmB;IACvC,OAAO,IAAA,mBAAM,EAAC,gCAAwB,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAC;AAC/E,CAAC;AAFD,sCAEC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport Headline from '@/components/generic/Headline';\nimport Text from '@/components/generic/Text';\nimport { withDI } from '@/providers/DIProvider';\nimport { Color } from '@/util/Color';\n\nimport TravelerNotfound from '../../graphics/TravelerNotfound';\n\nfunction OriginalAddonsNotFoundBlock() {\n const { t } = useTranslation();\n return (\n <div className=\"u-align-center\">\n <div className=\"u-marg-bottom--heavy\">\n {/*BLANK SLATE IMAGE*/}\n <TravelerNotfound />\n </div>\n <div className=\"u-marg-bottom\">\n <Headline size=\"large\" bold>\n {t(Translation.Step.Addon.NotFound.Title)}\n </Headline>\n </div>\n <Text color={Color.DarkGrey}>{t(Translation.Step.Addon.NotFound.Message)}</Text>\n </div>\n );\n}\nexport const BE_NO_ADDONS_FOUND_BLOCK = 'BENoAddonsFoundBlock';\n\nexport default function AddonsNotFoundBlock() {\n return withDI(BE_NO_ADDONS_FOUND_BLOCK, OriginalAddonsNotFoundBlock, null);\n}\n"]}
|
|
@@ -59,6 +59,7 @@ const StepConfirmationCountrySelector_1 = __importDefault(require("./StepConfirm
|
|
|
59
59
|
const useSearchScopeHook_1 = require("../../../hooks/useSearchScopeHook");
|
|
60
60
|
const Confirmation_1 = require("../../../models/Confirmation");
|
|
61
61
|
const E164PhoneNumberFieldFeature_1 = __importDefault(require("../../../providers/feature/E164PhoneNumberFieldFeature"));
|
|
62
|
+
const GuestTitleFieldFeature_1 = __importDefault(require("../../../providers/feature/GuestTitleFieldFeature"));
|
|
62
63
|
const Color_1 = require("../../../util/Color");
|
|
63
64
|
const DataLayer_1 = __importStar(require("../../../util/DataLayer"));
|
|
64
65
|
const StringHelper_1 = __importDefault(require("../../../util/StringHelper"));
|
|
@@ -95,19 +96,23 @@ const RoomContactDetails = () => {
|
|
|
95
96
|
const getDefaultValue = (index, potentialDefaultValue = '') => {
|
|
96
97
|
return index === 0 ? potentialDefaultValue : '';
|
|
97
98
|
};
|
|
98
|
-
const userProfiles = basketRows.map((
|
|
99
|
-
var _a, _b, _c, _d;
|
|
99
|
+
const userProfiles = basketRows.map((basketRow, index) => {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
101
|
+
const defaults = basketRow.checkoutDefaults;
|
|
102
|
+
const addr = defaults === null || defaults === void 0 ? void 0 : defaults.Address;
|
|
100
103
|
return {
|
|
101
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
102
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
103
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
104
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
105
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
106
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
107
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
108
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
109
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
110
|
-
[Confirmation_1.EUserProfileFormKey.
|
|
104
|
+
[Confirmation_1.EUserProfileFormKey.Title]: '',
|
|
105
|
+
[Confirmation_1.EUserProfileFormKey.Forename]: getDefaultValue(index, (_a = defaults === null || defaults === void 0 ? void 0 : defaults.FirstName) !== null && _a !== void 0 ? _a : member === null || member === void 0 ? void 0 : member.forename),
|
|
106
|
+
[Confirmation_1.EUserProfileFormKey.Surname]: getDefaultValue(index, (_b = defaults === null || defaults === void 0 ? void 0 : defaults.LastName) !== null && _b !== void 0 ? _b : member === null || member === void 0 ? void 0 : member.surname),
|
|
107
|
+
[Confirmation_1.EUserProfileFormKey.Email]: getDefaultValue(index, (_c = defaults === null || defaults === void 0 ? void 0 : defaults.Email) !== null && _c !== void 0 ? _c : member === null || member === void 0 ? void 0 : member.email),
|
|
108
|
+
[Confirmation_1.EUserProfileFormKey.Phone]: getDefaultValue(index, (_d = defaults === null || defaults === void 0 ? void 0 : defaults.Phone) !== null && _d !== void 0 ? _d : member === null || member === void 0 ? void 0 : member.phoneNumber),
|
|
109
|
+
[Confirmation_1.EUserProfileFormKey.Address]: getDefaultValue(index, (_e = addr === null || addr === void 0 ? void 0 : addr.Line1) !== null && _e !== void 0 ? _e : (_f = member === null || member === void 0 ? void 0 : member.address) === null || _f === void 0 ? void 0 : _f.address),
|
|
110
|
+
[Confirmation_1.EUserProfileFormKey.City]: getDefaultValue(index, (_g = addr === null || addr === void 0 ? void 0 : addr.City) !== null && _g !== void 0 ? _g : (_h = member === null || member === void 0 ? void 0 : member.address) === null || _h === void 0 ? void 0 : _h.city),
|
|
111
|
+
[Confirmation_1.EUserProfileFormKey.PostCode]: getDefaultValue(index, (_j = addr === null || addr === void 0 ? void 0 : addr.PostalCode) !== null && _j !== void 0 ? _j : (_k = member === null || member === void 0 ? void 0 : member.address) === null || _k === void 0 ? void 0 : _k.zip),
|
|
112
|
+
[Confirmation_1.EUserProfileFormKey.State]: getDefaultValue(index, (_l = addr === null || addr === void 0 ? void 0 : addr.State) !== null && _l !== void 0 ? _l : (_m = member === null || member === void 0 ? void 0 : member.address) === null || _m === void 0 ? void 0 : _m.state),
|
|
113
|
+
[Confirmation_1.EUserProfileFormKey.Country]: getDefaultValue(index, (_o = addr === null || addr === void 0 ? void 0 : addr.Country) !== null && _o !== void 0 ? _o : (_p = member === null || member === void 0 ? void 0 : member.address) === null || _p === void 0 ? void 0 : _p.country),
|
|
114
|
+
[Confirmation_1.EUserProfileFormKey.CountryId]: getDefaultValue(index, (_q = addr === null || addr === void 0 ? void 0 : addr.CountryId) === null || _q === void 0 ? void 0 : _q.toString()),
|
|
115
|
+
[Confirmation_1.EUserProfileFormKey.CountryCode]: getDefaultValue(index, addr === null || addr === void 0 ? void 0 : addr.CountryCode),
|
|
111
116
|
};
|
|
112
117
|
});
|
|
113
118
|
setValue('userProfiles', userProfiles);
|
|
@@ -186,6 +191,8 @@ const RoomContactDetails = () => {
|
|
|
186
191
|
const currentRoom = basketRow.getRoom();
|
|
187
192
|
const isDisabled = (copyCheckBox && index >= 1) || paymentMethod === core_1.EBookingPaymentMethod.Planpay;
|
|
188
193
|
const roomGroup = (_a = hotel === null || hotel === void 0 ? void 0 : hotel.roomGroups) === null || _a === void 0 ? void 0 : _a.find(({ id }) => id === currentRoom.roomGroupId);
|
|
194
|
+
const includeStateField = (hotel === null || hotel === void 0 ? void 0 : hotel.stateFieldConfiguration) === core_1.EHotelStateFieldConfiguration.Optional || (hotel === null || hotel === void 0 ? void 0 : hotel.stateFieldConfiguration) === core_1.EHotelStateFieldConfiguration.Required;
|
|
195
|
+
const stateFieldRequired = (hotel === null || hotel === void 0 ? void 0 : hotel.stateFieldConfiguration) === core_1.EHotelStateFieldConfiguration.Required;
|
|
189
196
|
const requiredInputs = [];
|
|
190
197
|
for (const inputKey of Object.keys((_b = roomGroup === null || roomGroup === void 0 ? void 0 : roomGroup.filters) !== null && _b !== void 0 ? _b : {})) {
|
|
191
198
|
const input = roomGroup === null || roomGroup === void 0 ? void 0 : roomGroup.filters[inputKey];
|
|
@@ -193,6 +200,23 @@ const RoomContactDetails = () => {
|
|
|
193
200
|
requiredInputs.push({ id: `AuxInputs.${inputKey}`, name: input.name, label: input.name, options: input.options });
|
|
194
201
|
}
|
|
195
202
|
}
|
|
203
|
+
// The Country input field will be included in different places, depending on whether the State field is enabled or not.
|
|
204
|
+
const countryInputField = (react_1.default.createElement(react_hook_form_1.Controller, { control: control, name: padInputName(Confirmation_1.EUserProfileFormKey.Country), rules: {
|
|
205
|
+
required: {
|
|
206
|
+
value: true,
|
|
207
|
+
message: t(Translation_1.Translation.Step.Confirmation.Inputs.Required, { field: t(Translation_1.Translation.Step.Confirmation.Inputs.Country) }),
|
|
208
|
+
},
|
|
209
|
+
}, render: ({ field }) => {
|
|
210
|
+
const { ref, onChange } = field, rest = __rest(field, ["ref", "onChange"]);
|
|
211
|
+
return (react_1.default.createElement(StepConfirmationCountrySelector_1.default, Object.assign({ disabled: isDisabled, validationStatus: getValidationClass(Confirmation_1.EUserProfileFormKey.Country), onChange: (e) => {
|
|
212
|
+
onChange(e);
|
|
213
|
+
onInputChange(padInputName(Confirmation_1.EUserProfileFormKey.Country), 'Country - Address')(e);
|
|
214
|
+
}, onChangeId: (id) => {
|
|
215
|
+
setValue(padInputName(Confirmation_1.EUserProfileFormKey.CountryId), id); // Hack to make CountryID be set...
|
|
216
|
+
}, onChangeCode: (code) => {
|
|
217
|
+
setValue(padInputName(Confirmation_1.EUserProfileFormKey.CountryCode), code); // Hack to make CountryID be set...
|
|
218
|
+
} }, rest)));
|
|
219
|
+
} }));
|
|
196
220
|
return (react_1.default.createElement("div", { key: field.id },
|
|
197
221
|
react_1.default.createElement("div", { className: index === 0 ? '' : 'u-marg-bottom--heavy' },
|
|
198
222
|
react_1.default.createElement("div", { className: "u-marg-bottom", onClick: openExpandable },
|
|
@@ -226,7 +250,11 @@ const RoomContactDetails = () => {
|
|
|
226
250
|
react_1.default.createElement("div", { className: "u-marg-bottom--light" },
|
|
227
251
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small },
|
|
228
252
|
react_1.default.createElement("strong", null, t(Translation_1.Translation.Step.Confirmation.ContactInfo)))),
|
|
229
|
-
react_1.default.createElement(InputGroup_1.default, { dimensions:
|
|
253
|
+
react_1.default.createElement(InputGroup_1.default, { dimensions: GuestTitleFieldFeature_1.default.isActive() ? '1/2/2' : '2/2' },
|
|
254
|
+
GuestTitleFieldFeature_1.default.isActive() && (react_1.default.createElement(react_hook_form_1.Controller, { control: control, name: padInputName(Confirmation_1.EUserProfileFormKey.Title), rules: { required: true }, render: ({ field }) => {
|
|
255
|
+
const { ref } = field, rest = __rest(field, ["ref"]);
|
|
256
|
+
return (react_1.default.createElement(Select_1.InputSelect, Object.assign({ keyName: "value", labelName: "label", options: GuestTitleFieldFeature_1.default.getTitleOptions(), placeholder: t(Translation_1.Translation.Step.Confirmation.Inputs.Title) + ' *', required: true, validationStatus: getValidationClass(Confirmation_1.EUserProfileFormKey.Title) }, rest)));
|
|
257
|
+
} })),
|
|
230
258
|
react_1.default.createElement(TextBox_1.default, Object.assign({ inputProps: {
|
|
231
259
|
disabled: isDisabled,
|
|
232
260
|
}, placeholder: t(Translation_1.Translation.Step.Confirmation.Inputs.Forename) + ' *', wide: true, required: true, validationStatus: getValidationClass(Confirmation_1.EUserProfileFormKey.Forename) }, register(padInputName(Confirmation_1.EUserProfileFormKey.Forename), {
|
|
@@ -323,22 +351,18 @@ const RoomContactDetails = () => {
|
|
|
323
351
|
message: t(Translation_1.Translation.Step.Confirmation.Inputs.Required, { field: t(Translation_1.Translation.Step.Confirmation.Inputs.PostCode) }),
|
|
324
352
|
},
|
|
325
353
|
}))),
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}, onChangeCode: (code) => {
|
|
339
|
-
setValue(padInputName(Confirmation_1.EUserProfileFormKey.CountryCode), code); // Hack to make CountryID be set...
|
|
340
|
-
} }, rest)));
|
|
341
|
-
} })))),
|
|
354
|
+
includeStateField ? (
|
|
355
|
+
// Render the State field here if it's required, otherwise render the Country field
|
|
356
|
+
react_1.default.createElement(TextBox_1.default, Object.assign({ inputProps: {
|
|
357
|
+
disabled: isDisabled,
|
|
358
|
+
}, placeholder: t(Translation_1.Translation.Step.Confirmation.Inputs.State) + (stateFieldRequired ? ' *' : ''), wide: true, required: stateFieldRequired, validationStatus: getValidationClass(Confirmation_1.EUserProfileFormKey.State) }, register(padInputName(Confirmation_1.EUserProfileFormKey.State), {
|
|
359
|
+
onChange: onInputChange(padInputName(Confirmation_1.EUserProfileFormKey.State), 'State - Address'),
|
|
360
|
+
required: {
|
|
361
|
+
value: stateFieldRequired,
|
|
362
|
+
message: t(Translation_1.Translation.Step.Confirmation.Inputs.Required, { field: t(Translation_1.Translation.Step.Confirmation.Inputs.State) }),
|
|
363
|
+
},
|
|
364
|
+
})))) : (countryInputField)),
|
|
365
|
+
includeStateField && react_1.default.createElement(InputGroup_1.default, { dimensions: "1" }, countryInputField))),
|
|
342
366
|
requiredInputs.length > 0 && (react_1.default.createElement("div", { className: "u-marg-top" },
|
|
343
367
|
react_1.default.createElement("div", { className: "u-marg-top" },
|
|
344
368
|
react_1.default.createElement(InputGroup_1.default, { dimensions: "2/2" }, requiredInputs.map((input) => {
|