@roomstay/frontend 2.3.1 → 2.3.2
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/213.bundle.js +1 -1
- package/dist/572.bundle.js +1 -1
- package/dist/main.bundle.js +1 -1
- package/dist/src/components/steps/confirmation/PaymentInformation.js +5 -5
- package/dist/src/components/steps/confirmation/PaymentInformation.js.map +1 -1
- package/dist/test.bundle.js +1 -1
- package/dist/vendors.bundle.js +1 -1
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ const hooks_1 = require("../../../hooks");
|
|
|
43
43
|
const contexts_1 = require("../../../contexts");
|
|
44
44
|
const InlinePaymentOption_1 = __importDefault(require("../../generic/PaymentCard/InlinePaymentOption"));
|
|
45
45
|
const PaymentInformation = ({ tokenizerRef, onChangeCb }) => {
|
|
46
|
-
var _a, _b;
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
48
48
|
const methods = (0, react_hook_form_1.useFormContext)();
|
|
49
49
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
@@ -57,7 +57,7 @@ const PaymentInformation = ({ tokenizerRef, onChangeCb }) => {
|
|
|
57
57
|
renderContent: () => react_1.default.createElement(StepConfirmationPaymentDetails_1.StepConfirmationVGSPaymentInput, { ref: tokenizerRef }),
|
|
58
58
|
};
|
|
59
59
|
const options = [];
|
|
60
|
-
if (hotel === null || hotel === void 0 ? void 0 : hotel.paymentMethods.includes(core_1.EBookingPaymentMethod.Card)) {
|
|
60
|
+
if ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.paymentMethods) === null || _a === void 0 ? void 0 : _a.includes(core_1.EBookingPaymentMethod.Card)) {
|
|
61
61
|
let defaultCardOption;
|
|
62
62
|
// Reason this is split up is in case someone doesn't have a default card selected
|
|
63
63
|
// We still want to select the first card they have, if they have any.
|
|
@@ -83,9 +83,9 @@ const PaymentInformation = ({ tokenizerRef, onChangeCb }) => {
|
|
|
83
83
|
}
|
|
84
84
|
options.push(Object.assign(Object.assign({}, defaultCardOption), { options: selectableStoredCardOptions.length > 0 ? selectableStoredCardOptions : undefined }));
|
|
85
85
|
}
|
|
86
|
-
if ((hotel === null || hotel === void 0 ? void 0 : hotel.paymentMethods.includes(core_1.EBookingPaymentMethod.Planpay)) &&
|
|
87
|
-
((
|
|
88
|
-
(0, dayjs_1.default)(basketContext.startDate).diff((0, dayjs_1.default)(), 'day') > ((
|
|
86
|
+
if (((_b = hotel === null || hotel === void 0 ? void 0 : hotel.paymentMethods) === null || _b === void 0 ? void 0 : _b.includes(core_1.EBookingPaymentMethod.Planpay)) &&
|
|
87
|
+
((_c = hotel === null || hotel === void 0 ? void 0 : hotel.planpay) === null || _c === void 0 ? void 0 : _c.minDaysShowPlanpay) &&
|
|
88
|
+
(0, dayjs_1.default)(basketContext.startDate).diff((0, dayjs_1.default)(), 'day') > ((_d = hotel === null || hotel === void 0 ? void 0 : hotel.planpay) === null || _d === void 0 ? void 0 : _d.minDaysShowPlanpay)) {
|
|
89
89
|
options.push({
|
|
90
90
|
value: core_1.EBookingPaymentMethod.Planpay,
|
|
91
91
|
label: (react_1.default.createElement("div", { className: "u-flex u-flex-align-center" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentInformation.js","sourceRoot":"/","sources":["src/components/steps/confirmation/PaymentInformation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAC3C,8GAA8G;AAC9G,yCAAuD;AACvD,4DAAyD;AACzD,kIAAgI;AAChI,0FAAkE;AAClE,qEAA6C;AAC7C,wCAAqC;AACrC,uEAAgE;AAChE,+FAA4F;AAC5F,kDAA0B;AAC1B,qDAA6D;AAC7D,iDAA+C;AAE/C,mCAA0C;AAC1C,yCAAyD;AACzD,+GAAuF;AAOvF,MAAM,kBAAkB,GAAgC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,E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KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACvC,OAAO,CACH;gBACI;oBACI,8BAAC,0BAAgB,IACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;4BACf,QAAQ,CAAC,IAAI,CAAC,CAAC;4BACf,UAAU,CAAC,IAAI,CAAC,CAAC;wBACrB,CAAC,GACH,CACA,CACP,CACN,CAAC;QACN,CAAC,GACH,CACL,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC","sourcesContent":["import React, { FC, useMemo } from 'react';\nimport RadioButtonGroup, { IRadioButtonOption } from '@/components/generic/RadioButtonGroup/RadioButtonGroup';\nimport { EBookingPaymentMethod } from '@roomstay/core';\nimport { Translation } from '@/translations/Translation';\nimport { StepConfirmationVGSPaymentInput } from '@/components/steps/confirmation/PaymentDetails/StepConfirmationPaymentDetails';\nimport RoomstayThemeEngine from '@/providers/RoomstayThemeEngine';\nimport Text from '@/components/generic/Text';\nimport { Color } from '@/util/Color';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport { PlanpayPaymentMethod } from '@/components/steps/confirmation/PlanpayPaymentMethod';\nimport dayjs from 'dayjs';\nimport { Controller, useFormContext } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { ConfirmationFormValues } from '@/models/Confirmation';\nimport { useCurrentHotel } from '@/hooks';\nimport { useBasket, useMemberContext } from '@/contexts';\nimport InlinePaymentOption from '@/components/generic/PaymentCard/InlinePaymentOption';\n\ninterface PaymentInformationProps {\n tokenizerRef: any;\n onChangeCb: (code: string) => void;\n}\n\nconst PaymentInformation: FC<PaymentInformationProps> = ({ tokenizerRef, onChangeCb }) => {\n const { t } = useTranslation();\n const methods = useFormContext<ConfirmationFormValues>();\n const { hotel } = useCurrentHotel();\n const basketContext = useBasket();\n\n const { cards = [], roomstayMember } = useMemberContext();\n const defaultCard = useMemo(() => cards.find((card) => card.cardId === roomstayMember?.defaultCard), [cards, roomstayMember]);\n\n const paymentMethod = methods.watch('paymentMethod');\n const vgsCardInputOption: IRadioButtonOption = {\n value: EBookingPaymentMethod.Card,\n label: <InlinePaymentOption active={paymentMethod === EBookingPaymentMethod.Card} />,\n renderContent: () => <StepConfirmationVGSPaymentInput ref={tokenizerRef} />,\n };\n\n const options: IRadioButtonOption[] = [];\n if (hotel?.paymentMethods?.includes(EBookingPaymentMethod.Card)) {\n let defaultCardOption: IRadioButtonOption;\n // Reason this is split up is in case someone doesn't have a default card selected\n // We still want to select the first card they have, if they have any.\n if (cards.length) {\n const selectedMemberCard = defaultCard ? defaultCard : cards[0];\n\n defaultCardOption = {\n value: selectedMemberCard.cardId,\n label: <InlinePaymentOption card={selectedMemberCard} />,\n };\n } else {\n defaultCardOption = vgsCardInputOption;\n }\n\n const selectableStoredCardOptions = [];\n\n if (cards.length) {\n for (const memberCard of cards) {\n selectableStoredCardOptions.push({\n value: memberCard.cardId,\n label: <InlinePaymentOption card={memberCard} />,\n });\n }\n selectableStoredCardOptions.push(vgsCardInputOption);\n }\n\n options.push({\n ...defaultCardOption,\n options: selectableStoredCardOptions.length > 0 ? selectableStoredCardOptions : undefined,\n });\n }\n\n if (\n hotel?.paymentMethods?.includes(EBookingPaymentMethod.Planpay) &&\n hotel?.planpay?.minDaysShowPlanpay &&\n dayjs(basketContext.startDate).diff(dayjs(), 'day') > hotel?.planpay?.minDaysShowPlanpay\n ) {\n options.push({\n value: EBookingPaymentMethod.Planpay,\n label: (\n <div className=\"u-flex u-flex-align-center\">\n <div>{t(Translation.Step.Confirmation.PlanpayLabel)}</div>\n <div\n className=\"u-flex u-flex-align-center u-marg-left--light\"\n style={{\n borderRadius: '24px',\n overflow: 'hidden',\n }}\n >\n <img height={16} src={RoomstayThemeEngine.getImageAssetUrl('planpay-logo-small.svg')} alt=\"\" />\n </div>\n {!methods.formState.isValid && (\n <Text\n color={Color.Graphite}\n className=\"u-flex u-flex-align-center\"\n style={{\n color: '#313131',\n fontSize: 10,\n }}\n >\n <Icon color={Color.DarkGrey} icon={IconType.Info} className=\"u-marg-right--lighter u-marg-left--light\" />\n {t(Translation.Step.Confirmation.PlanpayHelperText)}\n </Text>\n )}\n </div>\n ),\n disabled: !methods.formState.isValid,\n disabledReason: !methods.formState.isValid ? 'You must fill all the above details before proceeding with Planpay' : '',\n renderContent: () => <PlanpayPaymentMethod />,\n });\n }\n\n return (\n <Controller\n control={methods.control}\n name=\"paymentMethod\"\n render={({ field: { onChange, value } }) => {\n return (\n <>\n <div>\n <RadioButtonGroup\n options={options}\n value={value}\n onChange={(code) => {\n onChange(code);\n onChangeCb(code);\n }}\n />\n </div>\n </>\n );\n }}\n />\n );\n};\n\nexport default PaymentInformation;\n"]}
|