@roomstay/frontend 2.0.0-1 → 2.0.0
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/201.bundle.js +1 -1
- package/dist/218.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/873.bundle.js +1 -1
- package/dist/882.bundle.js +1 -1
- package/dist/972.bundle.js +1 -1
- package/dist/main.bundle.js +1 -1
- package/dist/src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.js +1 -11
- package/dist/src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.js.map +1 -1
- package/dist/src/components/steps/confirmation/RoomContactDetails.js +2 -1
- package/dist/src/components/steps/confirmation/RoomContactDetails.js.map +1 -1
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js +18 -12
- package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js.map +1 -1
- package/dist/src/components/steps/room/RoomList.js +1 -1
- package/dist/src/components/steps/room/RoomList.js.map +1 -1
- package/dist/src/components/steps/room/StepRoomErrorForm.js +2 -1
- package/dist/src/components/steps/room/StepRoomErrorForm.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/RoomDetails.js +8 -8
- package/dist/src/components/steps/room/roomDetails/RoomDetails.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/MembersOnlyRow.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateListPromotion/RoomRateListPromotion.d.ts +7 -0
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateListPromotion/RoomRateListPromotion.js +31 -0
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateListPromotion/RoomRateListPromotion.js.map +1 -0
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRates.js +14 -7
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRates.js.map +1 -1
- package/dist/src/contexts/BasketContext/BasketContextType.js.map +1 -1
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js +12 -8
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextType.type.d.ts +3 -1
- package/dist/src/contexts/CompanyContext/CompanyContextType.type.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +9 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +3 -2
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
- package/dist/src/contexts/FullPageEngineContext/FullPageEngineContextWrapper.js.map +1 -1
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngineElement.js +71 -1
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngineElement.js.map +1 -1
- package/dist/src/events/RoomstayEventManager.d.ts +1 -1
- package/dist/src/events/RoomstayEventManager.js +23 -4
- package/dist/src/events/RoomstayEventManager.js.map +1 -1
- package/dist/src/events/actions/MemberOnlyFence/MemberOnlyFenceSignUp.d.ts +7 -0
- package/dist/src/events/actions/MemberOnlyFence/MemberOnlyFenceSignUp.js +15 -0
- package/dist/src/events/actions/MemberOnlyFence/MemberOnlyFenceSignUp.js.map +1 -0
- package/dist/src/events/actions/Promotion/PromotionAddedEvent.d.ts +7 -0
- package/dist/src/events/actions/Promotion/PromotionAddedEvent.js +15 -0
- package/dist/src/events/actions/Promotion/PromotionAddedEvent.js.map +1 -0
- package/dist/src/events/actions/Promotion/PromotionClickedEvent.d.ts +7 -0
- package/dist/src/events/actions/Promotion/PromotionClickedEvent.js +15 -0
- package/dist/src/events/actions/Promotion/PromotionClickedEvent.js.map +1 -0
- package/dist/src/events/actions/Promotion/PromotionRemovedEvent.d.ts +7 -0
- package/dist/src/events/actions/Promotion/PromotionRemovedEvent.js +15 -0
- package/dist/src/events/actions/Promotion/PromotionRemovedEvent.js.map +1 -0
- package/dist/src/events/index.d.ts +1 -0
- package/dist/src/events/index.js +1 -0
- package/dist/src/events/index.js.map +1 -1
- package/dist/src/hooks/EventHook.d.ts +1 -1
- package/dist/src/hooks/EventHook.js +2 -2
- package/dist/src/hooks/EventHook.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/Promotion/IPromotion.type.d.ts +27 -0
- package/dist/src/models/Promotion/IPromotion.type.js +3 -0
- package/dist/src/models/Promotion/IPromotion.type.js.map +1 -0
- package/dist/src/pages/findReservation/FindReservation.js +2 -1
- package/dist/src/pages/findReservation/FindReservation.js.map +1 -1
- package/dist/src/providers/LanguageProvider.d.ts +14 -3
- package/dist/src/providers/LanguageProvider.js +3 -19
- package/dist/src/providers/LanguageProvider.js.map +1 -1
- package/dist/src/providers/PromotionProvider.d.ts +14 -0
- package/dist/src/providers/PromotionProvider.js +213 -0
- package/dist/src/providers/PromotionProvider.js.map +1 -0
- package/dist/src/util/ObjectHelper.d.ts +4 -0
- package/dist/src/util/ObjectHelper.js +25 -0
- package/dist/src/util/ObjectHelper.js.map +1 -0
- package/dist/src/util/Validation.d.ts +1 -0
- package/dist/src/util/Validation.js +2 -1
- package/dist/src/util/Validation.js.map +1 -1
- package/dist/test.bundle.js +1 -1
- package/dist/tests/jest/helpers/ObjectHelper.test.d.ts +1 -0
- package/dist/tests/jest/helpers/ObjectHelper.test.js +72 -0
- package/dist/tests/jest/helpers/ObjectHelper.test.js.map +1 -0
- package/dist/tests/offline/entry/RSCompany.js +42 -1
- package/dist/tests/offline/entry/RSCompany.js.map +1 -1
- package/dist/vendors.bundle.js +1 -1
- package/package.json +1 -1
- package/dist/src/components/steps/confirmation/StepConfirmationPaymentDetails.d.ts +0 -8
- package/dist/src/components/steps/confirmation/StepConfirmationPaymentDetails.js +0 -241
- package/dist/src/components/steps/confirmation/StepConfirmationPaymentDetails.js.map +0 -1
- package/dist/src/contexts/BasketContext/BasketContextType.d.ts +0 -41
package/dist/src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.js
CHANGED
|
@@ -14,16 +14,6 @@ const hooks_1 = require("@frontend/hooks");
|
|
|
14
14
|
const VGSHooks_1 = require("hooks/VGSHooks");
|
|
15
15
|
const ExistingCardPicker_1 = require("./ExistingCardPicker");
|
|
16
16
|
const AcceptablePaymentCard_1 = require("components/steps/confirmation/PaymentDetails/AcceptablePaymentCard");
|
|
17
|
-
class VGSInputMapper {
|
|
18
|
-
constructor(name, type, ref, vgsProps) {
|
|
19
|
-
this.name = name;
|
|
20
|
-
this.ref = ref;
|
|
21
|
-
this.type = type;
|
|
22
|
-
this.vgsProps = vgsProps;
|
|
23
|
-
this.isValid = null;
|
|
24
|
-
this.isFocused = false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
17
|
function StepConfirmationPaymentDetails(props, ref) {
|
|
28
18
|
var _a;
|
|
29
19
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
@@ -137,7 +127,7 @@ function StepConfirmationPaymentDetails(props, ref) {
|
|
|
137
127
|
Expiry: expiration,
|
|
138
128
|
Name: cardData['card-name'],
|
|
139
129
|
Number: cardData['credit-card'],
|
|
140
|
-
Type:
|
|
130
|
+
Type: cardNumber.state.cardType,
|
|
141
131
|
};
|
|
142
132
|
resolve(card);
|
|
143
133
|
}, (error) => {
|
package/dist/src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepConfirmationPaymentDetails.js","sourceRoot":"/","sources":["src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.tsx"],"names":[],"mappings":";;AACA,+BAA+B;AAC/B,iCAAqF;AACrF,yEAAkE;AAClE,8DAAuD;AACvD,oDAA4D;AAC5D,uDAAwD;AACxD,kDAAyD;AACzD,iDAA+C;AAC/C,0DAAuD;AACvD,kDAAiE;AACjE,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AC,GAAG,GAAI;wBACxE,6BAAK,SAAS,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAI,CAC3D,CACJ;gBACb,oBAAC,oBAAU,IAAC,UAAU,EAAC,GAAG;oBACtB,6BAAK,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,GAAI,CACvD,CACV,CACL,CACJ,CACT,CAAC;AACN,CAAC;AAED,kBAAe,IAAA,kBAAU,EAAC,8BAA8B,CAAC,CAAC","sourcesContent":["import PaymentCard from 'models/PaymentCard';\nimport * as React from 'react';\nimport { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport AutoAutoHeight from 'animations/AutoAutoHeight';\nimport Alert, { AlertType } from 'components/generic/Alert';\nimport { IconType } from 'components/generic/Icon/Icon';\nimport Text, { TextType } from 'components/generic/Text';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\nimport { SynxisToVGSCardNameMapping } from 'models/Api/HotelDTO';\nimport { useCurrentHotel, useMember, useWindowScroll } from '@frontend/hooks';\nimport { useVgsCollect } from 'hooks/VGSHooks';\nimport { IRoomstayMemberCards } from '@roomstay/core';\nimport { ExistingCardPicker } from './ExistingCardPicker';\nimport AcceptablePaymentCard from 'components/steps/confirmation/PaymentDetails/AcceptablePaymentCard';\n\ntype VGSInputType = 'card-number' | 'text' | 'card-expiration-date' | 'card-security-code';\n\nclass VGSInputMapper {\n public ref: React.MutableRefObject<any>;\n public vgsProps: any;\n public name: string;\n public type: VGSInputType;\n\n public isFocused: boolean;\n public isValid: boolean;\n\n public constructor(name: string, type: VGSInputType, ref: React.MutableRefObject<any>, vgsProps: any) {\n this.name = name;\n this.ref = ref;\n this.type = type;\n this.vgsProps = vgsProps;\n\n this.isValid = null;\n this.isFocused = false;\n }\n}\n\nfunction StepConfirmationPaymentDetails(props: any, ref: any) {\n const { hotel } = useCurrentHotel();\n const member = useMember();\n\n const [errors, setErrors] = useState<{ [x: string]: string }>({});\n\n const { t } = useTranslation();\n\n const { focusElement } = useWindowScroll();\n\n const vgsInputCss = {\n fontSize: '13px',\n lineHeight: '18px',\n '&::placeholder': {\n color: '#8B8F9A',\n opacity: 1,\n },\n };\n\n const {\n fields: [cardNumber, nameOnCard, expirationDate, securityCode],\n triggerFieldUpdate,\n vgsForm,\n } = useVgsCollect([\n {\n label: t(Translation.Step.Confirmation.Inputs.CardNumber),\n name: 'credit-card',\n type: 'card-number',\n vgsProps: {\n autoComplete: ['cc-number'],\n successColor: '#4F8A10',\n errorColor: '#D8000C',\n showCardIcon: false,\n placeholder: t(Translation.Step.Confirmation.Inputs.CardNumber) + ' *',\n validations: ['required', 'validCardNumber'],\n css: vgsInputCss,\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.NameOnCard),\n name: 'card-name',\n type: 'text',\n vgsProps: {\n validations: ['required'],\n css: vgsInputCss,\n placeholder: t(Translation.Step.Confirmation.Inputs.NameOnCard) + ' *',\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.CardExpiry),\n name: 'expiration-date',\n type: 'card-expiration-date',\n vgsProps: {\n placeholder: t(Translation.Step.Confirmation.Inputs.CardExpiry) + ' *',\n validations: ['required', 'validCardExpirationDate'],\n css: vgsInputCss,\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.SecurityCode),\n name: 'security-code',\n type: 'card-security-code',\n vgsProps: {\n placeholder: t(Translation.Step.Confirmation.Inputs.SecurityCode) + ' *',\n validations: ['required', 'validCardSecurityCode'],\n css: vgsInputCss,\n },\n },\n ]);\n\n const setErrorsOnFaults = (faults: any) => {\n const newErrors: { [x: string]: string } = {};\n\n Object.keys(faults).forEach((input) => {\n let name = '';\n\n switch (input) {\n case 'credit-card':\n name = 'Credit Card';\n break;\n case 'expiration-date':\n name = 'Expiration Date';\n break;\n case 'security-code':\n name = 'Security Code';\n break;\n default:\n name = 'Card Name';\n break;\n }\n\n newErrors[input] = name + ' ' + faults[input].errorMessages[faults[input].errorMessages.length - 1];\n });\n\n setErrors(newErrors);\n };\n\n useEffect(() => {\n if (errors && Object.keys(errors).length !== 0 && cardNumber?.ref?.current) {\n focusElement(cardNumber?.ref?.current);\n }\n }, [errors]);\n\n useImperativeHandle(ref, () => ({\n getTokenizedCode: () =>\n new Promise<PaymentCard | IRoomstayMemberCards>((resolve, reject) => {\n if (vgsForm) {\n vgsForm.submit(\n '/post',\n {\n serializer: 'deep',\n methods: 'POST',\n },\n (status: any, response: any) => {\n const cardData = JSON.parse(response.data);\n const expMatch = cardData['expiration-date'].match(/^(\\d+)\\s*\\/\\s*(\\d+)$/);\n if (!expMatch || expMatch[1].length > 2 || (expMatch[2].length !== 4 && expMatch[2].length !== 2)) {\n setErrorsOnFaults({\n 'expiration-date': {\n errorMessages: ['Invalid - it must be in the format MM / YY or MM / YYYY'],\n },\n });\n reject('invalid expiration date');\n return;\n }\n\n const expiration = (expMatch[1].length === 1 ? '0' : '') + expMatch[1] + (expMatch[2].length === 2 ? expMatch[2] : expMatch[2].substr(2));\n\n const card: any = {\n CVV: cardData['security-code'],\n Expiry: expiration,\n Name: cardData['card-name'],\n Number: cardData['credit-card'],\n Type: window.VGSCollect.enteredCardType,\n };\n\n resolve(card);\n },\n (error: any) => {\n setErrorsOnFaults(error);\n reject(error);\n }\n );\n } else {\n console.error('VGS not on element, problem has occurred');\n }\n }),\n }));\n\n const formRef = useRef(null);\n\n const inputNames = ['credit-card', 'card-name', 'expiration-date', 'security-code'];\n const cardTypes = (hotel?.paymentCardTypes ?? [])\n .map((card: string) => {\n const mapping = SynxisToVGSCardNameMapping[card];\n if (!mapping) {\n return null;\n }\n\n return {\n name: SynxisToVGSCardNameMapping[card],\n status: false,\n };\n })\n .filter((obj) => obj);\n\n const onMemberCardSelected = (card: IRoomstayMemberCards) => {\n // TODO:\n };\n\n return (\n <div>\n <div>{!!member.user && <ExistingCardPicker onCardSelected={onMemberCardSelected} />}</div>\n <div>\n {inputNames.map((name) => {\n const errorMessage = errors[name];\n return (\n <AutoAutoHeight open={!!errorMessage} key={name}>\n <div className=\"u-flex\">\n <Alert type={AlertType.Danger} icon={IconType.Error}>\n <Text type={TextType.Small}>{errorMessage}</Text>\n </Alert>\n </div>\n </AutoAutoHeight>\n );\n })}\n <div className=\"u-marg-bottom\">\n <AcceptablePaymentCard\n isCurrent={(cardKey: any) => {\n return cardNumber.state.cardType !== null && cardTypes[cardKey].name === cardNumber.state.cardType;\n }}\n isDefault={(cardKey: any) => {\n return cardNumber.state.cardType === null;\n }}\n />\n </div>\n <form ref={formRef}>\n <InputGroup dimensions=\"2/2\">\n <div className={cardNumber.getClasses()} ref={cardNumber.ref} />\n <InputGroup dimensions=\"2/2\">\n <div className={expirationDate.getClasses()} ref={expirationDate.ref} />\n <div className={securityCode.getClasses()} ref={securityCode.ref} />\n </InputGroup>\n </InputGroup>\n <InputGroup dimensions=\"1\">\n <div className={nameOnCard.getClasses()} ref={nameOnCard.ref} />\n </InputGroup>\n </form>\n </div>\n </div>\n );\n}\n\nexport default forwardRef(StepConfirmationPaymentDetails);\n"]}
|
|
1
|
+
{"version":3,"file":"StepConfirmationPaymentDetails.js","sourceRoot":"/","sources":["src/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails.tsx"],"names":[],"mappings":";;AACA,+BAA+B;AAC/B,iCAAqF;AACrF,yEAAkE;AAClE,8DAAuD;AACvD,oDAA4D;AAC5D,uDAAwD;AACxD,kDAAyD;AACzD,iDAA+C;AAC/C,0DAAuD;AACvD,kDAAiE;AACjE,2CAA8E;AAC9E,6CAA+C;AAE/C,6DAA0D;AAC1D,8GAAuG;AAIvG,SAAS,8BAA8B,CAAC,KAAU,EAAE,GAAQ;;IACxD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IACpC,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAE3B,MAAM,CAAC,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AAC,eAAe;gBAC1B,oBAAC,+BAAqB,IAClB,SAAS,EAAE,CAAC,OAAY,EAAE,EAAE;wBACxB,OAAO,UAAU,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC;oBACvG,CAAC,EACD,SAAS,EAAE,CAAC,OAAY,EAAE,EAAE;wBACxB,OAAO,UAAU,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;oBAC9C,CAAC,GACH,CACA;YACN,8BAAM,GAAG,EAAE,OAAO;gBACd,oBAAC,oBAAU,IAAC,UAAU,EAAC,KAAK;oBACxB,6BAAK,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,GAAI;oBAChE,oBAAC,oBAAU,IAAC,UAAU,EAAC,KAAK;wBACxB,6BAAK,SAAS,EAAE,cAAc,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,cAAc,CAAC,GAAG,GAAI;wBACxE,6BAAK,SAAS,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAI,CAC3D,CACJ;gBACb,oBAAC,oBAAU,IAAC,UAAU,EAAC,GAAG;oBACtB,6BAAK,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,GAAI,CACvD,CACV,CACL,CACJ,CACT,CAAC;AACN,CAAC;AAED,kBAAe,IAAA,kBAAU,EAAC,8BAA8B,CAAC,CAAC","sourcesContent":["import PaymentCard from 'models/PaymentCard';\nimport * as React from 'react';\nimport { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport AutoAutoHeight from 'animations/AutoAutoHeight';\nimport Alert, { AlertType } from 'components/generic/Alert';\nimport { IconType } from 'components/generic/Icon/Icon';\nimport Text, { TextType } from 'components/generic/Text';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\nimport { SynxisToVGSCardNameMapping } from 'models/Api/HotelDTO';\nimport { useCurrentHotel, useMember, useWindowScroll } from '@frontend/hooks';\nimport { useVgsCollect } from 'hooks/VGSHooks';\nimport { IRoomstayMemberCards } from '@roomstay/core';\nimport { ExistingCardPicker } from './ExistingCardPicker';\nimport AcceptablePaymentCard from 'components/steps/confirmation/PaymentDetails/AcceptablePaymentCard';\n\ntype VGSInputType = 'card-number' | 'text' | 'card-expiration-date' | 'card-security-code';\n\nfunction StepConfirmationPaymentDetails(props: any, ref: any) {\n const { hotel } = useCurrentHotel();\n const member = useMember();\n\n const [errors, setErrors] = useState<{ [x: string]: string }>({});\n\n const { t } = useTranslation();\n\n const { focusElement } = useWindowScroll();\n\n const vgsInputCss = {\n fontSize: '13px',\n lineHeight: '18px',\n '&::placeholder': {\n color: '#8B8F9A',\n opacity: 1,\n },\n };\n\n const {\n fields: [cardNumber, nameOnCard, expirationDate, securityCode],\n triggerFieldUpdate,\n vgsForm,\n } = useVgsCollect([\n {\n label: t(Translation.Step.Confirmation.Inputs.CardNumber),\n name: 'credit-card',\n type: 'card-number',\n vgsProps: {\n autoComplete: ['cc-number'],\n successColor: '#4F8A10',\n errorColor: '#D8000C',\n showCardIcon: false,\n placeholder: t(Translation.Step.Confirmation.Inputs.CardNumber) + ' *',\n validations: ['required', 'validCardNumber'],\n css: vgsInputCss,\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.NameOnCard),\n name: 'card-name',\n type: 'text',\n vgsProps: {\n validations: ['required'],\n css: vgsInputCss,\n placeholder: t(Translation.Step.Confirmation.Inputs.NameOnCard) + ' *',\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.CardExpiry),\n name: 'expiration-date',\n type: 'card-expiration-date',\n vgsProps: {\n placeholder: t(Translation.Step.Confirmation.Inputs.CardExpiry) + ' *',\n validations: ['required', 'validCardExpirationDate'],\n css: vgsInputCss,\n },\n },\n {\n label: t(Translation.Step.Confirmation.Inputs.SecurityCode),\n name: 'security-code',\n type: 'card-security-code',\n vgsProps: {\n placeholder: t(Translation.Step.Confirmation.Inputs.SecurityCode) + ' *',\n validations: ['required', 'validCardSecurityCode'],\n css: vgsInputCss,\n },\n },\n ]);\n\n const setErrorsOnFaults = (faults: any) => {\n const newErrors: { [x: string]: string } = {};\n\n Object.keys(faults).forEach((input) => {\n let name = '';\n\n switch (input) {\n case 'credit-card':\n name = 'Credit Card';\n break;\n case 'expiration-date':\n name = 'Expiration Date';\n break;\n case 'security-code':\n name = 'Security Code';\n break;\n default:\n name = 'Card Name';\n break;\n }\n\n newErrors[input] = name + ' ' + faults[input].errorMessages[faults[input].errorMessages.length - 1];\n });\n\n setErrors(newErrors);\n };\n\n useEffect(() => {\n if (errors && Object.keys(errors).length !== 0 && cardNumber?.ref?.current) {\n focusElement(cardNumber?.ref?.current);\n }\n }, [errors]);\n\n useImperativeHandle(ref, () => ({\n getTokenizedCode: () =>\n new Promise<PaymentCard | IRoomstayMemberCards>((resolve, reject) => {\n if (vgsForm) {\n vgsForm.submit(\n '/post',\n {\n serializer: 'deep',\n methods: 'POST',\n },\n (status: any, response: any) => {\n const cardData = JSON.parse(response.data);\n const expMatch = cardData['expiration-date'].match(/^(\\d+)\\s*\\/\\s*(\\d+)$/);\n if (!expMatch || expMatch[1].length > 2 || (expMatch[2].length !== 4 && expMatch[2].length !== 2)) {\n setErrorsOnFaults({\n 'expiration-date': {\n errorMessages: ['Invalid - it must be in the format MM / YY or MM / YYYY'],\n },\n });\n reject('invalid expiration date');\n return;\n }\n\n const expiration = (expMatch[1].length === 1 ? '0' : '') + expMatch[1] + (expMatch[2].length === 2 ? expMatch[2] : expMatch[2].substr(2));\n\n const card: any = {\n CVV: cardData['security-code'],\n Expiry: expiration,\n Name: cardData['card-name'],\n Number: cardData['credit-card'],\n Type: cardNumber.state.cardType,\n };\n\n resolve(card);\n },\n (error: any) => {\n setErrorsOnFaults(error);\n reject(error);\n }\n );\n } else {\n console.error('VGS not on element, problem has occurred');\n }\n }),\n }));\n\n const formRef = useRef(null);\n\n const inputNames = ['credit-card', 'card-name', 'expiration-date', 'security-code'];\n const cardTypes = (hotel?.paymentCardTypes ?? [])\n .map((card: string) => {\n const mapping = SynxisToVGSCardNameMapping[card];\n if (!mapping) {\n return null;\n }\n\n return {\n name: SynxisToVGSCardNameMapping[card],\n status: false,\n };\n })\n .filter((obj) => obj);\n\n const onMemberCardSelected = (card: IRoomstayMemberCards) => {\n // TODO:\n };\n\n return (\n <div>\n <div>{!!member.user && <ExistingCardPicker onCardSelected={onMemberCardSelected} />}</div>\n <div>\n {inputNames.map((name) => {\n const errorMessage = errors[name];\n return (\n <AutoAutoHeight open={!!errorMessage} key={name}>\n <div className=\"u-flex\">\n <Alert type={AlertType.Danger} icon={IconType.Error}>\n <Text type={TextType.Small}>{errorMessage}</Text>\n </Alert>\n </div>\n </AutoAutoHeight>\n );\n })}\n <div className=\"u-marg-bottom\">\n <AcceptablePaymentCard\n isCurrent={(cardKey: any) => {\n return cardNumber.state.cardType !== null && cardTypes[cardKey].name === cardNumber.state.cardType;\n }}\n isDefault={(cardKey: any) => {\n return cardNumber.state.cardType === null;\n }}\n />\n </div>\n <form ref={formRef}>\n <InputGroup dimensions=\"2/2\">\n <div className={cardNumber.getClasses()} ref={cardNumber.ref} />\n <InputGroup dimensions=\"2/2\">\n <div className={expirationDate.getClasses()} ref={expirationDate.ref} />\n <div className={securityCode.getClasses()} ref={securityCode.ref} />\n </InputGroup>\n </InputGroup>\n <InputGroup dimensions=\"1\">\n <div className={nameOnCard.getClasses()} ref={nameOnCard.ref} />\n </InputGroup>\n </form>\n </div>\n </div>\n );\n}\n\nexport default forwardRef(StepConfirmationPaymentDetails);\n"]}
|
|
@@ -34,6 +34,7 @@ const Confirmation_1 = require("../../../models/Confirmation");
|
|
|
34
34
|
const Checkbox_1 = require("../../generic/Checkbox/Checkbox");
|
|
35
35
|
const contexts_1 = require("@frontend/contexts");
|
|
36
36
|
const core_1 = require("@roomstay/core");
|
|
37
|
+
const Validation_1 = require("util/Validation");
|
|
37
38
|
const RoomContactDetails = () => {
|
|
38
39
|
const { register, formState, control, watch, getValues, setValue } = (0, react_hook_form_1.useFormContext)();
|
|
39
40
|
const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
|
|
@@ -197,7 +198,7 @@ const RoomContactDetails = () => {
|
|
|
197
198
|
message: t(Translation_1.Translation.Step.Confirmation.Inputs.Required, { field: t(Translation_1.Translation.Step.Confirmation.Inputs.Email) }),
|
|
198
199
|
},
|
|
199
200
|
pattern: {
|
|
200
|
-
value:
|
|
201
|
+
value: Validation_1.EMAIL_REGEX,
|
|
201
202
|
message: t(Translation_1.Translation.Step.Confirmation.Inputs.InvalidEmail),
|
|
202
203
|
},
|
|
203
204
|
}))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomContactDetails.js","sourceRoot":"/","sources":["src/components/steps/confirmation/RoomContactDetails.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,iCAA4D;AAC5D,kDAAyD;AACzD,yEAAkE;AAClE,wDAAiD;AACjD,0DAAuD;AACvD,iDAA+C;AAC/C,0DAAmD;AACnD,uDAA8D;AAC9D,sCAAmC;AACnC,mHAA4G;AAC5G,oDAA6C;AAC7C,4DAAqD;AACrD,qDAAwF;AACxF,oDAA4D;AAC5D,8DAAuD;AACvD,8CAA6E;AAC7E,0HAAmH;AACnH,+FAAwF;AACxF,+DAA2F;AAC3F,8DAAuD;AACvD,iDAA0E;AAC1E,yCAAuD;AAEvD,MAAM,kBAAkB,GAAO,GAAG,EAAE;IAChC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,gCAAc,GAA0B,CAAC;IAC9G,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa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YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;qCACxH;iCACJ,EACD,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;oCAClB,MAAM,EAAE,GAAG,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAlC,mBAA0B,CAAQ,CAAC;oCACzC,OAAO,CACH,oBAAC,yCAA+B,kBAC5B,QAAQ,EAAE,UAAU,EACpB,gBAAgB,EAAE,kBAAkB,CAAC,kCAAmB,CAAC,OAAO,CAAC,EACjE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;4CACZ,QAAQ,CAAC,CAAC,CAAC,CAAC;4CACZ,aAAa,CAAC,YAAY,CAAC,kCAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;wCACrF,CAAC,IACG,IAAI,EACV,CACL,CAAC;gCACN,CAAC,GACH,CACO,CACX,CACJ;gBACN,oBAAC,mBAAS,OAAG,CACX;YACL,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAChC,6BAAK,SAAS,EAAC,sBAAsB;gBACjC,oBAAC,kBAAQ,kBAAC,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,IAAM,QAAQ,CAAC,cAAc,CAAC,EAAI,CAC3G,CACT,CAAC,CAAC,CAAC,IAAI,CACN,CACT,CAAC;IACN,CAAC,CAAC,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC","sourcesContent":["import * as React from 'react';\nimport { FC, useContext, useEffect, useState } from 'react';\nimport Text, { TextType } from 'components/generic/Text';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport TextBox from 'components/generic/TextBox';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\nimport Headline from 'components/generic/Headline';\nimport Icon, { IconType } from 'components/generic/Icon/Icon';\nimport { Color } from 'util/Color';\nimport StepConfirmationCountrySelector from 'components/steps/confirmation/StepConfirmationCountrySelector';\nimport StringHelper from 'util/StringHelper';\nimport LineBreak from 'components/generic/LineBreak';\nimport { Controller, FieldError, useFieldArray, useFormContext } from 'react-hook-form';\nimport Alert, { AlertType } from 'components/generic/Alert';\nimport AutoAutoHeight from 'animations/AutoAutoHeight';\nimport DataLayer, { InteractionStep, InteractionType } from 'util/DataLayer';\nimport EnhancedPhoneNumberField from 'components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField';\nimport E164PhoneNumberFieldFeature from 'providers/feature/E164PhoneNumberFieldFeature';\nimport { ConfirmationFormValues, EUserProfileFormKey } from '../../../models/Confirmation';\nimport Checkbox from '../../generic/Checkbox/Checkbox';\nimport { BasketContext, RoomstayMemberContext } from '@frontend/contexts';\nimport { EBookingPaymentMethod } from '@roomstay/core';\n\nconst RoomContactDetails: FC = () => {\n const { register, formState, control, watch, getValues, setValue } = useFormContext<ConfirmationFormValues>();\n const basketContext = useContext(BasketContext);\n const basketRows = basketContext.getAllValidRows();\n const basketAddonRows = basketContext.basketAddonRows;\n\n const { update, fields } = useFieldArray({\n control,\n name: 'userProfiles',\n });\n const [copyCheckBox, paymentMethod] = watch(['copyCheckBox', 'paymentMethod']);\n\n const errors = formState.errors;\n\n const { t } = useTranslation();\n const { roomstayMember: member } = useContext(RoomstayMemberContext);\n\n useEffect(() => {\n errors.userProfiles?.forEach((_, index) => {\n if (errors.userProfiles[index]) {\n opens[index] = true;\n }\n });\n setOpens(opens.slice(0));\n }, [errors.userProfiles, copyCheckBox]);\n\n useEffect(() => {\n const getDefaultValue = (index: number, potentialDefaultValue = '') => {\n return index === 0 ? potentialDefaultValue : '';\n };\n const userProfiles = basketRows.map((basketRows, index) => {\n return {\n [EUserProfileFormKey.Forename]: getDefaultValue(index, member?.forename),\n [EUserProfileFormKey.Surname]: getDefaultValue(index, member?.surname),\n [EUserProfileFormKey.Email]: getDefaultValue(index, member?.email),\n [EUserProfileFormKey.Phone]: getDefaultValue(index, member?.phoneNumber),\n [EUserProfileFormKey.Address]: getDefaultValue(index, member?.address?.address),\n [EUserProfileFormKey.City]: getDefaultValue(index, member?.address?.city),\n [EUserProfileFormKey.PostCode]: getDefaultValue(index, member?.address?.zip),\n [EUserProfileFormKey.Country]: getDefaultValue(index, member?.address?.country),\n };\n });\n setValue('userProfiles', userProfiles);\n setValue('copyCheckBox', basketRows?.length && basketRows.length > 1);\n }, [member, basketRows?.length]);\n\n const padInputNameByRoomNumber = (name: EUserProfileFormKey, index: number) => `userProfiles.${index}.${name}` as const;\n\n const [opens, setOpens] = useState<boolean[]>(basketRows.map((basketRow, index) => index === 0));\n\n const onInputChange =\n (fieldName: string, interactionName: string) =>\n (event: any): void => {\n DataLayer.instance.sendInteraction(interactionName, InteractionType.FORM_FIELD, InteractionStep.GUEST_DETAILS);\n };\n\n useEffect(() => {\n if (copyCheckBox)\n fields.forEach((basketRow, index) => {\n if (index === 0) return;\n update(index, getValues(`userProfiles.0`));\n });\n }, [copyCheckBox]);\n\n useEffect(() => {\n const { unsubscribe } = watch((allFields, { name, type }) => {\n if (type === 'change' && name.includes('userProfiles') && name.split('.')[1] === '0' && allFields.copyCheckBox) {\n fields.map((field, index) => {\n if (index === 0) return;\n update(index, getValues('userProfiles.0'));\n });\n }\n });\n\n return () => {\n unsubscribe();\n };\n }, [fields]);\n\n useEffect(() => {\n DataLayer.instance.sendCheckoutView(basketRows, basketAddonRows);\n }, []);\n\n const setOpenByIndex = (index: number, value: boolean) => {\n opens.splice(index, 1, value);\n setOpens(opens.slice(0));\n };\n\n return (\n <>\n {fields.map((field, index) => {\n const padInputName = (name: EUserProfileFormKey) => padInputNameByRoomNumber(name, index);\n const getValidationClass = (name: EUserProfileFormKey) => {\n if (!errors.userProfiles || (copyCheckBox && index >= 1)) return null;\n if (errors.userProfiles[index]?.[name]) {\n return 'error';\n } else {\n return 'success';\n }\n };\n\n const openExpandable = () => {\n if (index !== 0) {\n setOpenByIndex(index, !opens[index]);\n }\n };\n\n const basketRow = basketRows[index];\n\n const isDisabled = (copyCheckBox && index >= 1) || paymentMethod === EBookingPaymentMethod.Planpay;\n\n return (\n <div key={field.id}>\n <div className={index === 0 ? '' : 'u-marg-bottom--heavy'}>\n <div className=\"u-marg-bottom\" onClick={openExpandable}>\n <div className=\"u-flex u-marg-bottom align-items-center\">\n <Headline bold={true}>\n {t(Translation.Misc.Room)} {index + 1}\n </Headline>\n {index !== 0 && <Icon icon={opens[index] ? IconType.ArrowDown2 : IconType.ArrowUp2} color={Color.Grey} />}\n </div>\n {basketRow && (\n <div className=\"u-marg-bottom\">\n <Text>\n <strong className=\"u-block@l-\">{basketRow.getRoom().name}</strong> for{' '}\n {StringHelper.pluralWithDictAndCount(basketRow.getAdults(), Translation.Step.Date.Adult, t)}\n , \n {StringHelper.pluralWithDictAndCount(basketRow.getChildren(), Translation.Step.Date.Child, t)}\n </Text>\n <div className=\"step-one-status--dates u-flex justify-content-start\">\n <Text type={TextType.Small} color={Color.Accent}>\n <strong>{basketRow.getStartDate().format('ddd, MMM D')}</strong>\n </Text>\n <Icon icon={IconType.ArrowRight2} size={'18px'} />\n <Text type={TextType.Small} color={Color.Accent}>\n <strong>{basketRow.getEndDate().format('ddd, MMM D')}</strong>\n </Text>\n </div>\n </div>\n )}\n {errors.userProfiles?.[index] &&\n formState.submitCount >= 1 &&\n (index === 0 || !copyCheckBox) &&\n Object.values(errors.userProfiles[index]).map((error: FieldError, errorIndex) => {\n return (\n <AutoAutoHeight key={errorIndex} open>\n <div className=\"u-flex\">\n <Alert\n icon={IconType.Error}\n type={AlertType.Danger}\n noMargin={errorIndex === Object.keys(errors.userProfiles[index]).length - 1}\n >\n <Text type={TextType.Small}>{error?.message}</Text>\n </Alert>\n </div>\n </AutoAutoHeight>\n );\n })}\n </div>\n <div className=\"room-contact-details--row\" style={{ maxHeight: opens[index] ? '' : 0 }}>\n <div className=\"u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Confirmation.ContactInfo)}</strong>\n </Text>\n </div>\n <InputGroup dimensions=\"2/2\">\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Forename) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Forename)}\n {...register(padInputName(EUserProfileFormKey.Forename), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Forename), 'Forename - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Forename) }),\n },\n })}\n />\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Surname) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Surname)}\n {...register(padInputName(EUserProfileFormKey.Surname), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Surname), 'Surname - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Surname) }),\n },\n })}\n />\n </InputGroup>\n\n <InputGroup dimensions={'2/2'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Email) + ' *'}\n wide={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Email)}\n required={true}\n {...register(padInputName(EUserProfileFormKey.Email), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Email), 'Email - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Email) }),\n },\n pattern: {\n value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i,\n message: t(Translation.Step.Confirmation.Inputs.InvalidEmail),\n },\n })}\n />\n {E164PhoneNumberFieldFeature.isActive() ? (\n <Controller\n control={control}\n name={padInputName(EUserProfileFormKey.Phone)}\n rules={{\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Phone) }),\n },\n minLength: {\n value: 5,\n message: 'Phone number is required',\n },\n maxLength: {\n value: 17,\n message: 'Phone number is too long',\n },\n pattern: {\n value: /^[1-9]( |\\d){1,15}$/g,\n message: 'Incorrect phone number entered',\n },\n }}\n render={({ field }) => {\n return (\n <EnhancedPhoneNumberField\n disabled={isDisabled}\n validationStatus={getValidationClass(EUserProfileFormKey.Phone)}\n {...field}\n onChange={(e: any) => {\n field.onChange(e);\n onInputChange(padInputName(EUserProfileFormKey.Phone), 'Phone - Contact Info')(e);\n }}\n />\n );\n }}\n />\n ) : (\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Phone) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Phone)}\n {...register(padInputName(EUserProfileFormKey.Phone), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Phone), 'Phone - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Phone) }),\n },\n })}\n />\n )}\n </InputGroup>\n </div>\n <div className=\"\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Confirmation.Address)}</strong>\n </Text>\n </div>\n\n <InputGroup dimensions={'3/1'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Address) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Address)}\n {...register(padInputName(EUserProfileFormKey.Address), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Address), 'Address - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Address) }),\n },\n })}\n />\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.City) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.City)}\n {...register(padInputName(EUserProfileFormKey.City), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.City), 'City - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.City) }),\n },\n })}\n />\n </InputGroup>\n <InputGroup dimensions={'2/2'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.PostCode) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.PostCode)}\n {...register(padInputName(EUserProfileFormKey.PostCode), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.PostCode), 'PostCode - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.PostCode) }),\n },\n })}\n />\n <Controller\n control={control}\n name={padInputName(EUserProfileFormKey.Country)}\n rules={{\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Country) }),\n },\n }}\n render={({ field }) => {\n const { ref, onChange, ...rest } = field;\n return (\n <StepConfirmationCountrySelector\n disabled={isDisabled}\n validationStatus={getValidationClass(EUserProfileFormKey.Country)}\n onChange={(e) => {\n onChange(e);\n onInputChange(padInputName(EUserProfileFormKey.Country), 'Country - Address')(e);\n }}\n {...rest}\n />\n );\n }}\n />\n </InputGroup>\n </div>\n </div>\n <LineBreak />\n </div>\n {fields.length > 1 && index === 0 ? (\n <div className=\"u-marg-bottom--heavy\">\n <Checkbox label={t(Translation.Step.Confirmation.ApplySameInfoToOtherRooms)} {...register('copyCheckBox')} />\n </div>\n ) : null}\n </div>\n );\n })}\n </>\n );\n};\n\nexport default RoomContactDetails;\n"]}
|
|
1
|
+
{"version":3,"file":"RoomContactDetails.js","sourceRoot":"/","sources":["src/components/steps/confirmation/RoomContactDetails.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,iCAA4D;AAC5D,kDAAyD;AACzD,yEAAkE;AAClE,wDAAiD;AACjD,0DAAuD;AACvD,iDAA+C;AAC/C,0DAAmD;AACnD,uDAA8D;AAC9D,sCAAmC;AACnC,mHAA4G;AAC5G,oDAA6C;AAC7C,4DAAqD;AACrD,qDAAwF;AACxF,oDAA4D;AAC5D,8DAAuD;AACvD,8CAA6E;AAC7E,0HAAmH;AACnH,+FAAwF;AACxF,+DAA2F;AAC3F,8DAAuD;AACvD,iDAA0E;AAC1E,yCAAuD;AACvD,gDAA8C;AAE9C,MAAM,kBAAkB,GAAO,GAAG,EAAE;IAChC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,gCAAc,GAA0B,CAAC;IAC9G,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,aAAa,CAAC,eAAe,EAAE,CAAC;IACnD,MAAM,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IAEtD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAa,EAAC;QACrC,OAAO;QACP,IAAI,EAAE,cAAc;KACvB,CAAC,CAAC;IACH,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAEhC,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAA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jE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;4CACZ,QAAQ,CAAC,CAAC,CAAC,CAAC;4CACZ,aAAa,CAAC,YAAY,CAAC,kCAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;wCACrF,CAAC,IACG,IAAI,EACV,CACL,CAAC;gCACN,CAAC,GACH,CACO,CACX,CACJ;gBACN,oBAAC,mBAAS,OAAG,CACX;YACL,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAChC,6BAAK,SAAS,EAAC,sBAAsB;gBACjC,oBAAC,kBAAQ,kBAAC,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,IAAM,QAAQ,CAAC,cAAc,CAAC,EAAI,CAC3G,CACT,CAAC,CAAC,CAAC,IAAI,CACN,CACT,CAAC;IACN,CAAC,CAAC,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC","sourcesContent":["import * as React from 'react';\nimport { FC, useContext, useEffect, useState } from 'react';\nimport Text, { TextType } from 'components/generic/Text';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport TextBox from 'components/generic/TextBox';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\nimport Headline from 'components/generic/Headline';\nimport Icon, { IconType } from 'components/generic/Icon/Icon';\nimport { Color } from 'util/Color';\nimport StepConfirmationCountrySelector from 'components/steps/confirmation/StepConfirmationCountrySelector';\nimport StringHelper from 'util/StringHelper';\nimport LineBreak from 'components/generic/LineBreak';\nimport { Controller, FieldError, useFieldArray, useFormContext } from 'react-hook-form';\nimport Alert, { AlertType } from 'components/generic/Alert';\nimport AutoAutoHeight from 'animations/AutoAutoHeight';\nimport DataLayer, { InteractionStep, InteractionType } from 'util/DataLayer';\nimport EnhancedPhoneNumberField from 'components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField';\nimport E164PhoneNumberFieldFeature from 'providers/feature/E164PhoneNumberFieldFeature';\nimport { ConfirmationFormValues, EUserProfileFormKey } from '../../../models/Confirmation';\nimport Checkbox from '../../generic/Checkbox/Checkbox';\nimport { BasketContext, RoomstayMemberContext } from '@frontend/contexts';\nimport { EBookingPaymentMethod } from '@roomstay/core';\nimport { EMAIL_REGEX } from 'util/Validation';\n\nconst RoomContactDetails: FC = () => {\n const { register, formState, control, watch, getValues, setValue } = useFormContext<ConfirmationFormValues>();\n const basketContext = useContext(BasketContext);\n const basketRows = basketContext.getAllValidRows();\n const basketAddonRows = basketContext.basketAddonRows;\n\n const { update, fields } = useFieldArray({\n control,\n name: 'userProfiles',\n });\n const [copyCheckBox, paymentMethod] = watch(['copyCheckBox', 'paymentMethod']);\n\n const errors = formState.errors;\n\n const { t } = useTranslation();\n const { roomstayMember: member } = useContext(RoomstayMemberContext);\n\n useEffect(() => {\n errors.userProfiles?.forEach((_, index) => {\n if (errors.userProfiles[index]) {\n opens[index] = true;\n }\n });\n setOpens(opens.slice(0));\n }, [errors.userProfiles, copyCheckBox]);\n\n useEffect(() => {\n const getDefaultValue = (index: number, potentialDefaultValue = '') => {\n return index === 0 ? potentialDefaultValue : '';\n };\n const userProfiles = basketRows.map((basketRows, index) => {\n return {\n [EUserProfileFormKey.Forename]: getDefaultValue(index, member?.forename),\n [EUserProfileFormKey.Surname]: getDefaultValue(index, member?.surname),\n [EUserProfileFormKey.Email]: getDefaultValue(index, member?.email),\n [EUserProfileFormKey.Phone]: getDefaultValue(index, member?.phoneNumber),\n [EUserProfileFormKey.Address]: getDefaultValue(index, member?.address?.address),\n [EUserProfileFormKey.City]: getDefaultValue(index, member?.address?.city),\n [EUserProfileFormKey.PostCode]: getDefaultValue(index, member?.address?.zip),\n [EUserProfileFormKey.Country]: getDefaultValue(index, member?.address?.country),\n };\n });\n setValue('userProfiles', userProfiles);\n setValue('copyCheckBox', basketRows?.length && basketRows.length > 1);\n }, [member, basketRows?.length]);\n\n const padInputNameByRoomNumber = (name: EUserProfileFormKey, index: number) => `userProfiles.${index}.${name}` as const;\n\n const [opens, setOpens] = useState<boolean[]>(basketRows.map((basketRow, index) => index === 0));\n\n const onInputChange =\n (fieldName: string, interactionName: string) =>\n (event: any): void => {\n DataLayer.instance.sendInteraction(interactionName, InteractionType.FORM_FIELD, InteractionStep.GUEST_DETAILS);\n };\n\n useEffect(() => {\n if (copyCheckBox)\n fields.forEach((basketRow, index) => {\n if (index === 0) return;\n update(index, getValues(`userProfiles.0`));\n });\n }, [copyCheckBox]);\n\n useEffect(() => {\n const { unsubscribe } = watch((allFields, { name, type }) => {\n if (type === 'change' && name.includes('userProfiles') && name.split('.')[1] === '0' && allFields.copyCheckBox) {\n fields.map((field, index) => {\n if (index === 0) return;\n update(index, getValues('userProfiles.0'));\n });\n }\n });\n\n return () => {\n unsubscribe();\n };\n }, [fields]);\n\n useEffect(() => {\n DataLayer.instance.sendCheckoutView(basketRows, basketAddonRows);\n }, []);\n\n const setOpenByIndex = (index: number, value: boolean) => {\n opens.splice(index, 1, value);\n setOpens(opens.slice(0));\n };\n\n return (\n <>\n {fields.map((field, index) => {\n const padInputName = (name: EUserProfileFormKey) => padInputNameByRoomNumber(name, index);\n const getValidationClass = (name: EUserProfileFormKey) => {\n if (!errors.userProfiles || (copyCheckBox && index >= 1)) return null;\n if (errors.userProfiles[index]?.[name]) {\n return 'error';\n } else {\n return 'success';\n }\n };\n\n const openExpandable = () => {\n if (index !== 0) {\n setOpenByIndex(index, !opens[index]);\n }\n };\n\n const basketRow = basketRows[index];\n\n const isDisabled = (copyCheckBox && index >= 1) || paymentMethod === EBookingPaymentMethod.Planpay;\n\n return (\n <div key={field.id}>\n <div className={index === 0 ? '' : 'u-marg-bottom--heavy'}>\n <div className=\"u-marg-bottom\" onClick={openExpandable}>\n <div className=\"u-flex u-marg-bottom align-items-center\">\n <Headline bold={true}>\n {t(Translation.Misc.Room)} {index + 1}\n </Headline>\n {index !== 0 && <Icon icon={opens[index] ? IconType.ArrowDown2 : IconType.ArrowUp2} color={Color.Grey} />}\n </div>\n {basketRow && (\n <div className=\"u-marg-bottom\">\n <Text>\n <strong className=\"u-block@l-\">{basketRow.getRoom().name}</strong> for{' '}\n {StringHelper.pluralWithDictAndCount(basketRow.getAdults(), Translation.Step.Date.Adult, t)}\n , \n {StringHelper.pluralWithDictAndCount(basketRow.getChildren(), Translation.Step.Date.Child, t)}\n </Text>\n <div className=\"step-one-status--dates u-flex justify-content-start\">\n <Text type={TextType.Small} color={Color.Accent}>\n <strong>{basketRow.getStartDate().format('ddd, MMM D')}</strong>\n </Text>\n <Icon icon={IconType.ArrowRight2} size={'18px'} />\n <Text type={TextType.Small} color={Color.Accent}>\n <strong>{basketRow.getEndDate().format('ddd, MMM D')}</strong>\n </Text>\n </div>\n </div>\n )}\n {errors.userProfiles?.[index] &&\n formState.submitCount >= 1 &&\n (index === 0 || !copyCheckBox) &&\n Object.values(errors.userProfiles[index]).map((error: FieldError, errorIndex) => {\n return (\n <AutoAutoHeight key={errorIndex} open>\n <div className=\"u-flex\">\n <Alert\n icon={IconType.Error}\n type={AlertType.Danger}\n noMargin={errorIndex === Object.keys(errors.userProfiles[index]).length - 1}\n >\n <Text type={TextType.Small}>{error?.message}</Text>\n </Alert>\n </div>\n </AutoAutoHeight>\n );\n })}\n </div>\n <div className=\"room-contact-details--row\" style={{ maxHeight: opens[index] ? '' : 0 }}>\n <div className=\"u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Confirmation.ContactInfo)}</strong>\n </Text>\n </div>\n <InputGroup dimensions=\"2/2\">\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Forename) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Forename)}\n {...register(padInputName(EUserProfileFormKey.Forename), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Forename), 'Forename - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Forename) }),\n },\n })}\n />\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Surname) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Surname)}\n {...register(padInputName(EUserProfileFormKey.Surname), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Surname), 'Surname - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Surname) }),\n },\n })}\n />\n </InputGroup>\n\n <InputGroup dimensions={'2/2'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Email) + ' *'}\n wide={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Email)}\n required={true}\n {...register(padInputName(EUserProfileFormKey.Email), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Email), 'Email - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Email) }),\n },\n pattern: {\n value: EMAIL_REGEX,\n message: t(Translation.Step.Confirmation.Inputs.InvalidEmail),\n },\n })}\n />\n {E164PhoneNumberFieldFeature.isActive() ? (\n <Controller\n control={control}\n name={padInputName(EUserProfileFormKey.Phone)}\n rules={{\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Phone) }),\n },\n minLength: {\n value: 5,\n message: 'Phone number is required',\n },\n maxLength: {\n value: 17,\n message: 'Phone number is too long',\n },\n pattern: {\n value: /^[1-9]( |\\d){1,15}$/g,\n message: 'Incorrect phone number entered',\n },\n }}\n render={({ field }) => {\n return (\n <EnhancedPhoneNumberField\n disabled={isDisabled}\n validationStatus={getValidationClass(EUserProfileFormKey.Phone)}\n {...field}\n onChange={(e: any) => {\n field.onChange(e);\n onInputChange(padInputName(EUserProfileFormKey.Phone), 'Phone - Contact Info')(e);\n }}\n />\n );\n }}\n />\n ) : (\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Phone) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Phone)}\n {...register(padInputName(EUserProfileFormKey.Phone), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Phone), 'Phone - Contact Info'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Phone) }),\n },\n })}\n />\n )}\n </InputGroup>\n </div>\n <div className=\"\">\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Confirmation.Address)}</strong>\n </Text>\n </div>\n\n <InputGroup dimensions={'3/1'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.Address) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.Address)}\n {...register(padInputName(EUserProfileFormKey.Address), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.Address), 'Address - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Address) }),\n },\n })}\n />\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.City) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.City)}\n {...register(padInputName(EUserProfileFormKey.City), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.City), 'City - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.City) }),\n },\n })}\n />\n </InputGroup>\n <InputGroup dimensions={'2/2'}>\n <TextBox\n inputProps={{\n disabled: isDisabled,\n }}\n placeholder={t(Translation.Step.Confirmation.Inputs.PostCode) + ' *'}\n wide={true}\n required={true}\n validationStatus={getValidationClass(EUserProfileFormKey.PostCode)}\n {...register(padInputName(EUserProfileFormKey.PostCode), {\n onChange: onInputChange(padInputName(EUserProfileFormKey.PostCode), 'PostCode - Address'),\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.PostCode) }),\n },\n })}\n />\n <Controller\n control={control}\n name={padInputName(EUserProfileFormKey.Country)}\n rules={{\n required: {\n value: true,\n message: t(Translation.Step.Confirmation.Inputs.Required, { field: t(Translation.Step.Confirmation.Inputs.Country) }),\n },\n }}\n render={({ field }) => {\n const { ref, onChange, ...rest } = field;\n return (\n <StepConfirmationCountrySelector\n disabled={isDisabled}\n validationStatus={getValidationClass(EUserProfileFormKey.Country)}\n onChange={(e) => {\n onChange(e);\n onInputChange(padInputName(EUserProfileFormKey.Country), 'Country - Address')(e);\n }}\n {...rest}\n />\n );\n }}\n />\n </InputGroup>\n </div>\n </div>\n <LineBreak />\n </div>\n {fields.length > 1 && index === 0 ? (\n <div className=\"u-marg-bottom--heavy\">\n <Checkbox label={t(Translation.Step.Confirmation.ApplySameInfoToOtherRooms)} {...register('copyCheckBox')} />\n </div>\n ) : null}\n </div>\n );\n })}\n </>\n );\n};\n\nexport default RoomContactDetails;\n"]}
|
|
@@ -41,6 +41,7 @@ const hooks_1 = require("@frontend/hooks");
|
|
|
41
41
|
const contexts_2 = require("@frontend/contexts");
|
|
42
42
|
const InputGroup_1 = require("components/generic/InputGroup/InputGroup");
|
|
43
43
|
const RoomstayThemeEngine_1 = require("providers/RoomstayThemeEngine");
|
|
44
|
+
const Validation_1 = require("util/Validation");
|
|
44
45
|
const MemberOnlyModalDefaultInputs = {
|
|
45
46
|
Lines: [
|
|
46
47
|
{
|
|
@@ -69,7 +70,7 @@ const MemberOnlyModalDefaultInputs = {
|
|
|
69
70
|
placeholder: 'Email Address',
|
|
70
71
|
isRequired: true,
|
|
71
72
|
validate: (input) => {
|
|
72
|
-
if (!input.match(
|
|
73
|
+
if (!input.match(Validation_1.EMAIL_REGEX)) {
|
|
73
74
|
return 'Invalid Email Address';
|
|
74
75
|
}
|
|
75
76
|
return true;
|
|
@@ -80,7 +81,7 @@ const MemberOnlyModalDefaultInputs = {
|
|
|
80
81
|
],
|
|
81
82
|
};
|
|
82
83
|
function MemberSignInModal(props) {
|
|
83
|
-
var _a, _b, _c;
|
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
84
85
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
85
86
|
const context = (0, react_1.useContext)(contexts_1.BookingEngineContext);
|
|
86
87
|
const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
|
|
@@ -161,9 +162,9 @@ function MemberSignInModal(props) {
|
|
|
161
162
|
yield signUpMember();
|
|
162
163
|
});
|
|
163
164
|
const signUpMember = () => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
var
|
|
165
|
+
var _m, _o;
|
|
165
166
|
setIsLoading(true);
|
|
166
|
-
const
|
|
167
|
+
const _p = methods.getValues(), { FirstName, LastName, Email } = _p, extra = __rest(_p, ["FirstName", "LastName", "Email"]);
|
|
167
168
|
if (!FirstName || !LastName || !Email) {
|
|
168
169
|
setIsLoading(false);
|
|
169
170
|
ErrorContext_1.ErrorHandler.add({
|
|
@@ -182,8 +183,8 @@ function MemberSignInModal(props) {
|
|
|
182
183
|
}
|
|
183
184
|
else {
|
|
184
185
|
ccx.signUserIn(Email);
|
|
185
|
-
if (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode) {
|
|
186
|
-
(
|
|
186
|
+
if ((hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode) && !((_m = ccx.memberOnlyModalPromotion) === null || _m === void 0 ? void 0 : _m.memberOnlyDisableDefaultPromo)) {
|
|
187
|
+
(_o = basketContext.currentBasketRows) === null || _o === void 0 ? void 0 : _o.forEach((row) => {
|
|
187
188
|
row.setPromoCode(hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode);
|
|
188
189
|
basketContext.updateBasketRow(row);
|
|
189
190
|
});
|
|
@@ -212,10 +213,16 @@ function MemberSignInModal(props) {
|
|
|
212
213
|
setShowErrors(true);
|
|
213
214
|
return false;
|
|
214
215
|
});
|
|
216
|
+
const modalTitle = (_e = (_d = ccx === null || ccx === void 0 ? void 0 : ccx.memberOnlyModalPromotion) === null || _d === void 0 ? void 0 : _d.memberOnlyModalTitle) !== null && _e !== void 0 ? _e : t(Translation_1.Translation.MemberOnlyPopup.Headline, {
|
|
217
|
+
companyShort: ccx === null || ccx === void 0 ? void 0 : ccx.companyShort,
|
|
218
|
+
});
|
|
219
|
+
const modalSubtitle = (_g = (_f = ccx === null || ccx === void 0 ? void 0 : ccx.memberOnlyModalPromotion) === null || _f === void 0 ? void 0 : _f.memberOnlyModalSubtitle) !== null && _g !== void 0 ? _g : t(Translation_1.Translation.MemberOnlyPopup.Subtitle);
|
|
220
|
+
const modalButtonText = (_j = (_h = ccx === null || ccx === void 0 ? void 0 : ccx.memberOnlyModalPromotion) === null || _h === void 0 ? void 0 : _h.memberOnlyModalButtonText) !== null && _j !== void 0 ? _j : t(Translation_1.Translation.MemberOnlyPopup.SubmitButtonText);
|
|
221
|
+
const modalLeadImage = (_l = (_k = ccx === null || ccx === void 0 ? void 0 : ccx.memberOnlyModalPromotion) === null || _k === void 0 ? void 0 : _k.memberOnlyModalImage) !== null && _l !== void 0 ? _l : hotel === null || hotel === void 0 ? void 0 : hotel.heroImage;
|
|
215
222
|
return (React.createElement(SimpleModal_1.default, { open: props.isOpen, onClose: loadingOnClose, size: SimpleModal_1.SimpleModalSize.Normal, alignCenter: true },
|
|
216
223
|
React.createElement("div", { className: "row" },
|
|
217
224
|
React.createElement("div", { className: "col-md-6 u-mh-none", style: {
|
|
218
|
-
background: 'url("' +
|
|
225
|
+
background: 'url("' + modalLeadImage + '")',
|
|
219
226
|
backgroundRepeat: 'no-repeat',
|
|
220
227
|
backgroundPosition: 'center',
|
|
221
228
|
backgroundSize: 'cover',
|
|
@@ -227,12 +234,11 @@ function MemberSignInModal(props) {
|
|
|
227
234
|
React.createElement("div", { className: "u-marg-bottom-half" },
|
|
228
235
|
React.createElement(Headline_1.default, { bold: true, color: Color_1.Color.Success },
|
|
229
236
|
React.createElement("div", { style: { color: Color_1.Color.Success }, dangerouslySetInnerHTML: {
|
|
230
|
-
__html:
|
|
231
|
-
companyShort: ccx === null || ccx === void 0 ? void 0 : ccx.companyShort,
|
|
232
|
-
}),
|
|
237
|
+
__html: modalTitle,
|
|
233
238
|
} }))),
|
|
234
239
|
React.createElement("div", { className: "u-marg-bottom" },
|
|
235
|
-
React.createElement(Text_1.default, { type: Text_1.TextType.Small, color: Color_1.Color.DarkGrey },
|
|
240
|
+
React.createElement(Text_1.default, { type: Text_1.TextType.Small, color: Color_1.Color.DarkGrey },
|
|
241
|
+
React.createElement("span", { dangerouslySetInnerHTML: { __html: modalSubtitle } }))),
|
|
236
242
|
React.createElement(react_hook_form_1.FormProvider, Object.assign({}, methods),
|
|
237
243
|
React.createElement("div", null, modalInputs.Lines.map((inputLine, lineIndex) => {
|
|
238
244
|
return (React.createElement(InputGroup_1.default, { dimensions: inputLine.Dimension, key: lineIndex }, inputLine.Inputs.map((input, inputIndex) => {
|
|
@@ -249,7 +255,7 @@ function MemberSignInModal(props) {
|
|
|
249
255
|
captchaScriptLoaded && (React.createElement(React.Fragment, null,
|
|
250
256
|
captchaError && (React.createElement(Text_1.default, { type: Text_1.TextType.Label, color: Color_1.Color.Alert }, captchaError)),
|
|
251
257
|
React.createElement("div", { ref: captchaRef, className: "u-marg-bottom" }))),
|
|
252
|
-
React.createElement(BEButton_1.default, { size: "normal", filled: true, success: true, isLoading: isLoading, stopIconAnimation: true, icon: context.screenSize > ScreenSize_1.default.Mobile ? Icon_1.IconType.ArrowRight : null, onClick: buttonOnClickHandler },
|
|
258
|
+
React.createElement(BEButton_1.default, { size: "normal", filled: true, success: true, isLoading: isLoading, stopIconAnimation: true, icon: context.screenSize > ScreenSize_1.default.Mobile ? Icon_1.IconType.ArrowRight : null, onClick: buttonOnClickHandler }, modalButtonText))),
|
|
253
259
|
React.createElement(Text_1.default, { type: Text_1.TextType.Label, color: Color_1.Color.DarkGrey },
|
|
254
260
|
React.createElement("span", { dangerouslySetInnerHTML: { __html: t(Translation_1.Translation.MemberOnlyPopup.AgreeToReceiveDeals, { companyShort: ccx === null || ccx === void 0 ? void 0 : ccx.companyShort }) } })),
|
|
255
261
|
' ',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemberSignInModal.js","sourceRoot":"/","sources":["src/components/steps/room/MemberSignInModal/MemberSignInModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAoF;AACpF,uDAA8D;AAC9D,sCAAmC;AACnC,0DAAmD;AACnD,kDAAyD;AACzD,0DAAmD;AACnD,+BAA+B;AAC/B,iCAAgE;AAChE,wDAAiD;AACjD,qDAAwD;AACxD,+CAAiC;AACjC,wDAAqD;AACrD,iDAAyE;AACzE,gDAAyC;AACzC,0CAA0C;AAC1C,0DAAuD;AACvD,iDAA+C;AAE/C,2CAAkD;AAElD,iDAAoD;AACpD,yEAAkE;AAElE,uEAAgE;AAOhE,MAAM,4BAA4B,GAA0B;IACxD,KAAK,EAAE;QACH;YACI,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE;gBACJ;oBACI,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,YAAY;oBACzB,UAAU,EAAE,IAAI;iBACnB;gBACD;oBACI,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,WAAW;oBACxB,UAAU,EAAE,IAAI;iBACnB;aACJ;SACJ;QACD;YACI,SAAS,EAAE,GAAG;YACd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Q,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;wBAC7C,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,yBAAW,CAAC,eAAe,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,EAAE,CAAC,EAAE,GAAS,CACxI;oBAAC,GAAG;oBACX,oBAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;wBAC7C,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,yBAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,GAAS,CAClG,CACL,CACJ,CACJ,CACI,CACjB,CAAC;AACN,CAAC;AAzPD,oCAyPC","sourcesContent":["import SimpleModal, { SimpleModalSize } from 'components/generic/modal/SimpleModal';\nimport Icon, { IconType } from 'components/generic/Icon/Icon';\nimport { Color } from 'util/Color';\nimport Headline from 'components/generic/Headline';\nimport Text, { TextType } from 'components/generic/Text';\nimport BEButton from 'components/generic/BEButton';\nimport * as React from 'react';\nimport { useContext, useState, useEffect, useRef } from 'react';\nimport TextBox from 'components/generic/TextBox';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport API from 'api/BookingAPI';\nimport { ErrorHandler } from 'contexts/ErrorContext';\nimport { BasketContext, BookingEngineContext } from '@frontend/contexts';\nimport ScreenSize from 'util/ScreenSize';\nimport * as Sentry from '@sentry/browser';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\n\nimport { useCurrentHotel } from '@frontend/hooks';\n\nimport { CompanyContext } from '@frontend/contexts';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport { MemberOnlyModalInputs } from 'components/steps/room/MemberSignInModal/MemberSignInModal.types';\nimport RoomstayThemeEngine from 'providers/RoomstayThemeEngine';\n\ninterface MemberSignInModalProps {\n onClose?: () => void;\n isOpen?: boolean;\n}\n\nconst MemberOnlyModalDefaultInputs: MemberOnlyModalInputs = {\n Lines: [\n {\n Dimension: '2/2',\n Inputs: [\n {\n name: 'FirstName',\n type: 'TextBox',\n placeholder: 'First Name',\n isRequired: true,\n },\n {\n name: 'LastName',\n type: 'TextBox',\n placeholder: 'Last Name',\n isRequired: true,\n },\n ],\n },\n {\n Dimension: '1',\n Inputs: [\n {\n name: 'Email',\n type: 'TextBox',\n placeholder: 'Email Address',\n isRequired: true,\n validate: (input: string) => {\n if (!input.match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i)) {\n return 'Invalid Email Address';\n }\n return true;\n },\n },\n ],\n },\n ],\n};\n\nexport default function MemberSignInModal(props: MemberSignInModalProps) {\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const [isLoading, setIsLoading] = useState(false);\n const [showErrors, setShowErrors] = useState(false);\n\n const [captchaScriptLoaded, setCaptchaScriptLoaded] = useState(false);\n const [reCaptchaSecret, setReCaptchaSecret] = useState<string>();\n const [captchaError, setCaptchaError] = useState<string>();\n\n const captchaRef = useRef(null);\n\n const shouldLoadCaptcha = !!hotel?.googleReCaptcha?.loadForMembers && !!hotel?.googleReCaptcha?.siteKey;\n\n useEffect(() => {\n let cancelled = false;\n\n if (shouldLoadCaptcha) {\n RoomstayThemeEngine.loadScript('https://www.google.com/recaptcha/api.js', 'Google ReCaptcha').then(() => {\n /** @ts-ignore */\n window.grecaptcha.ready(() => {\n if (!cancelled) {\n setCaptchaScriptLoaded(true);\n }\n });\n });\n }\n\n return () => {\n cancelled = true;\n };\n }, [hotel]);\n\n useEffect(() => {\n if (shouldLoadCaptcha && captchaScriptLoaded && !captchaRef?.current && props.isOpen) {\n try {\n setTimeout(() => {\n const captchaCallback = (secret: string) => {\n setReCaptchaSecret(secret);\n setCaptchaError(undefined);\n };\n\n /** @ts-ignore */\n window.grecaptcha.render(captchaRef.current, {\n sitekey: hotel.googleReCaptcha.siteKey,\n callback: captchaCallback,\n });\n }, 5);\n } catch (ex) {\n Sentry.captureException(ex);\n }\n }\n }, [props.isOpen, captchaScriptLoaded, captchaRef, captchaRef?.current]);\n\n useEffect(() => {\n if (!props.isOpen) {\n setReCaptchaSecret(null);\n setCaptchaError(null);\n }\n }, [props.isOpen]);\n\n const getValidationClass = (name: string) => {\n if (errors && (formState.touchedFields[name] || showErrors)) {\n if (errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n } else {\n return null;\n }\n };\n\n const methods = useForm({\n mode: 'onChange',\n });\n\n const { formState, register } = methods;\n const errors = methods.formState.errors;\n\n const onSubmit = async () => {\n if (shouldLoadCaptcha && (!reCaptchaSecret || reCaptchaSecret === '')) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.PleaseTick));\n return;\n }\n\n await signUpMember();\n };\n\n const signUpMember = async () => {\n setIsLoading(true);\n const { FirstName, LastName, Email, ...extra } = methods.getValues();\n\n if (!FirstName || !LastName || !Email) {\n setIsLoading(false);\n ErrorHandler.add({\n title: 'Required fields in the Member Signup are missing.',\n message: 'First Name, Last Name, and Email Mandatory Fields, make sure that these fields are present to avoid loss of data.',\n });\n\n return;\n }\n\n try {\n const extraFields = Object.keys(extra).map((extraFieldKey: string) => {\n return { name: extraFieldKey, value: extra[extraFieldKey] };\n });\n\n const response = await API.Member.addMember(FirstName, LastName, Email, extraFields, hotel.hotelID, reCaptchaSecret);\n\n if (response.error) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.ValidationError));\n } else {\n ccx.signUserIn(Email);\n\n if (hotel?.memberOnlyPromoCode) {\n basketContext.currentBasketRows?.forEach((row) => {\n row.setPromoCode(hotel?.memberOnlyPromoCode);\n basketContext.updateBasketRow(row);\n });\n }\n }\n } catch (e) {\n ErrorHandler.add({\n title: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Title),\n message: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Message),\n });\n } finally {\n setIsLoading(false);\n }\n };\n\n const modalInputs: MemberOnlyModalInputs = hotel?.memberOnlySignupInputs ?? MemberOnlyModalDefaultInputs;\n\n const loadingOnClose = () => {\n setIsLoading(false);\n if (props.onClose) {\n props.onClose();\n }\n };\n const buttonOnClickHandler = async () => {\n await methods.handleSubmit(onSubmit)();\n setShowErrors(true);\n\n return false;\n };\n\n return (\n <SimpleModal open={props.isOpen} onClose={loadingOnClose} size={SimpleModalSize.Normal} alignCenter={true}>\n <div className=\"row\">\n <div\n className=\"col-md-6 u-mh-none\"\n style={{\n background: 'url(\"' + hotel?.heroImage + '\")',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n }}\n />\n <div className=\"col-md-6\">\n <div className=\"u-pad u-pad-heavy@m-\">\n <div className=\"u-marg-bottom-half\">\n <Icon icon={IconType.Money} size=\"24px\" color={Color.Success} backgroundColor={Color.SuccessTint} />\n </div>\n <div className=\"u-marg-bottom-half\">\n <Headline bold={true} color={Color.Success}>\n <div\n style={{ color: Color.Success }}\n dangerouslySetInnerHTML={{\n __html: t(Translation.MemberOnlyPopup.Headline, {\n companyShort: ccx?.companyShort,\n }),\n }}\n ></div>\n </Headline>\n </div>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n {t(Translation.MemberOnlyPopup.Subtitle)}\n </Text>\n </div>\n <FormProvider {...methods}>\n <div>\n {modalInputs.Lines.map((inputLine, lineIndex) => {\n return (\n <InputGroup dimensions={inputLine.Dimension} key={lineIndex}>\n {inputLine.Inputs.map((input, inputIndex) => {\n switch (input.type) {\n case 'TextBox':\n return (\n <TextBox\n key={inputIndex}\n wide={true}\n placeholder={input.placeholder}\n required={input.isRequired}\n validationStatus={getValidationClass(input.name)}\n {...register(input.name, {\n required: input.isRequired,\n validate: input.validate,\n })}\n />\n );\n }\n })}\n </InputGroup>\n );\n })}\n </div>\n <div className=\"u-marg-top--light\" style={{ marginBottom: '45px' }}>\n {captchaScriptLoaded && (\n <>\n {captchaError && (\n <Text type={TextType.Label} color={Color.Alert}>\n {captchaError}\n </Text>\n )}\n <div ref={captchaRef} className=\"u-marg-bottom\"></div>\n </>\n )}\n <BEButton\n size=\"normal\"\n filled={true}\n success={true}\n isLoading={isLoading}\n stopIconAnimation={true}\n icon={context.screenSize > ScreenSize.Mobile ? IconType.ArrowRight : null}\n onClick={buttonOnClickHandler}\n >\n {t(Translation.MemberOnlyPopup.SubmitButtonText)}\n </BEButton>\n </div>\n </FormProvider>\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.AgreeToReceiveDeals, { companyShort: ccx?.companyShort }) }}></span>\n </Text>{' '}\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.UnsubscribeAnytime) }}></span>\n </Text>\n </div>\n </div>\n </div>\n </SimpleModal>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MemberSignInModal.js","sourceRoot":"/","sources":["src/components/steps/room/MemberSignInModal/MemberSignInModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAoF;AACpF,uDAA8D;AAC9D,sCAAmC;AACnC,0DAAmD;AACnD,kDAAyD;AACzD,0DAAmD;AACnD,+BAA+B;AAC/B,iCAAgE;AAChE,wDAAiD;AACjD,qDAAwD;AACxD,+CAAiC;AACjC,wDAAqD;AACrD,iDAAyE;AACzE,gDAAyC;AACzC,0CAA0C;AAC1C,0DAAuD;AACvD,iDAA+C;AAE/C,2CAAkD;AAElD,iDAAoD;AACpD,yEAAkE;AAElE,uEAAgE;AAChE,gDAA8C;AAO9C,MAAM,4BAA4B,GAA0B;IACxD,KAAK,EAAE;QACH;YACI,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE;gBACJ;oBACI,IAA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E,CAAC,CAAC,yBAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,GAAS,CAClG,CACL,CACJ,CACJ,CACI,CACjB,CAAC;AACN,CAAC;AAlQD,oCAkQC","sourcesContent":["import SimpleModal, { SimpleModalSize } from 'components/generic/modal/SimpleModal';\nimport Icon, { IconType } from 'components/generic/Icon/Icon';\nimport { Color } from 'util/Color';\nimport Headline from 'components/generic/Headline';\nimport Text, { TextType } from 'components/generic/Text';\nimport BEButton from 'components/generic/BEButton';\nimport * as React from 'react';\nimport { useContext, useState, useEffect, useRef } from 'react';\nimport TextBox from 'components/generic/TextBox';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport API from 'api/BookingAPI';\nimport { ErrorHandler } from 'contexts/ErrorContext';\nimport { BasketContext, BookingEngineContext } from '@frontend/contexts';\nimport ScreenSize from 'util/ScreenSize';\nimport * as Sentry from '@sentry/browser';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\n\nimport { useCurrentHotel } from '@frontend/hooks';\n\nimport { CompanyContext } from '@frontend/contexts';\nimport InputGroup from 'components/generic/InputGroup/InputGroup';\nimport { MemberOnlyModalInputs } from 'components/steps/room/MemberSignInModal/MemberSignInModal.types';\nimport RoomstayThemeEngine from 'providers/RoomstayThemeEngine';\nimport { EMAIL_REGEX } from 'util/Validation';\n\ninterface MemberSignInModalProps {\n onClose?: () => void;\n isOpen?: boolean;\n}\n\nconst MemberOnlyModalDefaultInputs: MemberOnlyModalInputs = {\n Lines: [\n {\n Dimension: '2/2',\n Inputs: [\n {\n name: 'FirstName',\n type: 'TextBox',\n placeholder: 'First Name',\n isRequired: true,\n },\n {\n name: 'LastName',\n type: 'TextBox',\n placeholder: 'Last Name',\n isRequired: true,\n },\n ],\n },\n {\n Dimension: '1',\n Inputs: [\n {\n name: 'Email',\n type: 'TextBox',\n placeholder: 'Email Address',\n isRequired: true,\n validate: (input: string) => {\n if (!input.match(EMAIL_REGEX)) {\n return 'Invalid Email Address';\n }\n return true;\n },\n },\n ],\n },\n ],\n};\n\nexport default function MemberSignInModal(props: MemberSignInModalProps) {\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const [isLoading, setIsLoading] = useState(false);\n const [showErrors, setShowErrors] = useState(false);\n\n const [captchaScriptLoaded, setCaptchaScriptLoaded] = useState(false);\n const [reCaptchaSecret, setReCaptchaSecret] = useState<string>();\n const [captchaError, setCaptchaError] = useState<string>();\n\n const captchaRef = useRef(null);\n\n const shouldLoadCaptcha = !!hotel?.googleReCaptcha?.loadForMembers && !!hotel?.googleReCaptcha?.siteKey;\n\n useEffect(() => {\n let cancelled = false;\n\n if (shouldLoadCaptcha) {\n RoomstayThemeEngine.loadScript('https://www.google.com/recaptcha/api.js', 'Google ReCaptcha').then(() => {\n /** @ts-ignore */\n window.grecaptcha.ready(() => {\n if (!cancelled) {\n setCaptchaScriptLoaded(true);\n }\n });\n });\n }\n\n return () => {\n cancelled = true;\n };\n }, [hotel]);\n\n useEffect(() => {\n if (shouldLoadCaptcha && captchaScriptLoaded && !captchaRef?.current && props.isOpen) {\n try {\n setTimeout(() => {\n const captchaCallback = (secret: string) => {\n setReCaptchaSecret(secret);\n setCaptchaError(undefined);\n };\n\n /** @ts-ignore */\n window.grecaptcha.render(captchaRef.current, {\n sitekey: hotel.googleReCaptcha.siteKey,\n callback: captchaCallback,\n });\n }, 5);\n } catch (ex) {\n Sentry.captureException(ex);\n }\n }\n }, [props.isOpen, captchaScriptLoaded, captchaRef, captchaRef?.current]);\n\n useEffect(() => {\n if (!props.isOpen) {\n setReCaptchaSecret(null);\n setCaptchaError(null);\n }\n }, [props.isOpen]);\n\n const getValidationClass = (name: string) => {\n if (errors && (formState.touchedFields[name] || showErrors)) {\n if (errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n } else {\n return null;\n }\n };\n\n const methods = useForm({\n mode: 'onChange',\n });\n\n const { formState, register } = methods;\n const errors = methods.formState.errors;\n\n const onSubmit = async () => {\n if (shouldLoadCaptcha && (!reCaptchaSecret || reCaptchaSecret === '')) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.PleaseTick));\n return;\n }\n\n await signUpMember();\n };\n\n const signUpMember = async () => {\n setIsLoading(true);\n const { FirstName, LastName, Email, ...extra } = methods.getValues();\n\n if (!FirstName || !LastName || !Email) {\n setIsLoading(false);\n ErrorHandler.add({\n title: 'Required fields in the Member Signup are missing.',\n message: 'First Name, Last Name, and Email Mandatory Fields, make sure that these fields are present to avoid loss of data.',\n });\n\n return;\n }\n\n try {\n const extraFields = Object.keys(extra).map((extraFieldKey: string) => {\n return { name: extraFieldKey, value: extra[extraFieldKey] };\n });\n\n const response = await API.Member.addMember(FirstName, LastName, Email, extraFields, hotel.hotelID, reCaptchaSecret);\n\n if (response.error) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.ValidationError));\n } else {\n ccx.signUserIn(Email);\n\n if (hotel?.memberOnlyPromoCode && !ccx.memberOnlyModalPromotion?.memberOnlyDisableDefaultPromo) {\n basketContext.currentBasketRows?.forEach((row) => {\n row.setPromoCode(hotel?.memberOnlyPromoCode);\n basketContext.updateBasketRow(row);\n });\n }\n }\n } catch (e) {\n ErrorHandler.add({\n title: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Title),\n message: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Message),\n });\n } finally {\n setIsLoading(false);\n }\n };\n\n const modalInputs: MemberOnlyModalInputs = hotel?.memberOnlySignupInputs ?? MemberOnlyModalDefaultInputs;\n\n const loadingOnClose = () => {\n setIsLoading(false);\n if (props.onClose) {\n props.onClose();\n }\n };\n const buttonOnClickHandler = async () => {\n await methods.handleSubmit(onSubmit)();\n setShowErrors(true);\n\n return false;\n };\n\n const modalTitle =\n ccx?.memberOnlyModalPromotion?.memberOnlyModalTitle ??\n t(Translation.MemberOnlyPopup.Headline, {\n companyShort: ccx?.companyShort,\n });\n\n const modalSubtitle = ccx?.memberOnlyModalPromotion?.memberOnlyModalSubtitle ?? t(Translation.MemberOnlyPopup.Subtitle);\n\n const modalButtonText = ccx?.memberOnlyModalPromotion?.memberOnlyModalButtonText ?? t(Translation.MemberOnlyPopup.SubmitButtonText);\n const modalLeadImage = ccx?.memberOnlyModalPromotion?.memberOnlyModalImage ?? hotel?.heroImage;\n\n return (\n <SimpleModal open={props.isOpen} onClose={loadingOnClose} size={SimpleModalSize.Normal} alignCenter={true}>\n <div className=\"row\">\n <div\n className=\"col-md-6 u-mh-none\"\n style={{\n background: 'url(\"' + modalLeadImage + '\")',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n }}\n />\n <div className=\"col-md-6\">\n <div className=\"u-pad u-pad-heavy@m-\">\n <div className=\"u-marg-bottom-half\">\n <Icon icon={IconType.Money} size=\"24px\" color={Color.Success} backgroundColor={Color.SuccessTint} />\n </div>\n <div className=\"u-marg-bottom-half\">\n <Headline bold={true} color={Color.Success}>\n <div\n style={{ color: Color.Success }}\n dangerouslySetInnerHTML={{\n __html: modalTitle,\n }}\n ></div>\n </Headline>\n </div>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: modalSubtitle }}></span>\n </Text>\n </div>\n <FormProvider {...methods}>\n <div>\n {modalInputs.Lines.map((inputLine, lineIndex) => {\n return (\n <InputGroup dimensions={inputLine.Dimension} key={lineIndex}>\n {inputLine.Inputs.map((input, inputIndex) => {\n switch (input.type) {\n case 'TextBox':\n return (\n <TextBox\n key={inputIndex}\n wide={true}\n placeholder={input.placeholder}\n required={input.isRequired}\n validationStatus={getValidationClass(input.name)}\n {...register(input.name, {\n required: input.isRequired,\n validate: input.validate,\n })}\n />\n );\n }\n })}\n </InputGroup>\n );\n })}\n </div>\n <div className=\"u-marg-top--light\" style={{ marginBottom: '45px' }}>\n {captchaScriptLoaded && (\n <>\n {captchaError && (\n <Text type={TextType.Label} color={Color.Alert}>\n {captchaError}\n </Text>\n )}\n <div ref={captchaRef} className=\"u-marg-bottom\"></div>\n </>\n )}\n <BEButton\n size=\"normal\"\n filled={true}\n success={true}\n isLoading={isLoading}\n stopIconAnimation={true}\n icon={context.screenSize > ScreenSize.Mobile ? IconType.ArrowRight : null}\n onClick={buttonOnClickHandler}\n >\n {modalButtonText}\n </BEButton>\n </div>\n </FormProvider>\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.AgreeToReceiveDeals, { companyShort: ccx?.companyShort }) }}></span>\n </Text>{' '}\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.UnsubscribeAnytime) }}></span>\n </Text>\n </div>\n </div>\n </div>\n </SimpleModal>\n );\n}\n"]}
|
|
@@ -164,7 +164,7 @@ function RoomList() {
|
|
|
164
164
|
return (React.createElement(React.Fragment, null,
|
|
165
165
|
React.createElement(RoomListAlert_1.RoomListAlert, null, !isLoading && retargetingRoom ? React.createElement(RoomDetailsRetargeting_1.RoomDetailsRetargeting, { key: retargetingRoom.code, room: retargetingRoom }) : null),
|
|
166
166
|
elements));
|
|
167
|
-
}, [rooms, isLoading, openRoom, sortBy, beContext.currentFilters]);
|
|
167
|
+
}, [rooms, isLoading, openRoom, sortBy, beContext.currentFilters, basketContext.loadedPromotion]);
|
|
168
168
|
}
|
|
169
169
|
exports.default = RoomList;
|
|
170
170
|
//# sourceMappingURL=RoomList.js.map
|