@roomstay/frontend 2.6.94 → 2.6.96

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.
Files changed (61) hide show
  1. package/dist/{984.bundle.js → 180.bundle.js} +1 -1
  2. package/dist/625.bundle.js +1 -1
  3. package/dist/870.bundle.js +1 -0
  4. package/dist/main.bundle.js +1 -1
  5. package/dist/src/api/AvailabilityAPI.d.ts +1 -1
  6. package/dist/src/api/AvailabilityAPI.js +14 -6
  7. package/dist/src/api/AvailabilityAPI.js.map +1 -1
  8. package/dist/src/api/ErrorAPI.d.ts +3 -0
  9. package/dist/src/api/ErrorAPI.js +27 -0
  10. package/dist/src/api/ErrorAPI.js.map +1 -1
  11. package/dist/src/api/HotelAPI.js +27 -19
  12. package/dist/src/api/HotelAPI.js.map +1 -1
  13. package/dist/src/components/generic/modal/ErrorModal.d.ts +2 -0
  14. package/dist/src/components/generic/modal/ErrorModal.js +31 -8
  15. package/dist/src/components/generic/modal/ErrorModal.js.map +1 -1
  16. package/dist/src/components/members/SignInModal/InternalMemberSignInModal.js +20 -9
  17. package/dist/src/components/members/SignInModal/InternalMemberSignInModal.js.map +1 -1
  18. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentForm.d.ts +3 -0
  19. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentForm.js +80 -0
  20. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentForm.js.map +1 -0
  21. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentOption.d.ts +3 -0
  22. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentOption.js +84 -0
  23. package/dist/src/components/steps/confirmation/StripePaymentOption/StripePaymentOption.js.map +1 -0
  24. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js +6 -9
  25. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js.map +1 -1
  26. package/dist/src/contexts/BasketContext/BasketContextWrapper.js +4 -0
  27. package/dist/src/contexts/BasketContext/BasketContextWrapper.js.map +1 -1
  28. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +22 -3
  29. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
  30. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +3 -1
  31. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
  32. package/dist/src/contexts/ErrorContext.d.ts +3 -0
  33. package/dist/src/contexts/ErrorContext.js +3 -1
  34. package/dist/src/contexts/ErrorContext.js.map +1 -1
  35. package/dist/src/contexts/HotelOverridesContext.js +8 -3
  36. package/dist/src/contexts/HotelOverridesContext.js.map +1 -1
  37. package/dist/src/errors/APIError.d.ts +5 -0
  38. package/dist/src/errors/APIError.js +32 -0
  39. package/dist/src/errors/APIError.js.map +1 -0
  40. package/dist/src/errors/GetAvailabilityError.d.ts +2 -4
  41. package/dist/src/errors/GetAvailabilityError.js +2 -16
  42. package/dist/src/errors/GetAvailabilityError.js.map +1 -1
  43. package/dist/src/handlers/payment/PaymentHandler.d.ts +1 -1
  44. package/dist/src/handlers/payment/PaymentHandler.js.map +1 -1
  45. package/dist/src/handlers/payment/StripePaymentHandler.d.ts +2 -0
  46. package/dist/src/handlers/payment/StripePaymentHandler.js +74 -0
  47. package/dist/src/handlers/payment/StripePaymentHandler.js.map +1 -0
  48. package/dist/src/models/Api/HotelDTO.d.ts +1 -1
  49. package/dist/src/models/Api/HotelDTO.js.map +1 -1
  50. package/dist/src/providers/RoomstayThemeEngine.d.ts +2 -0
  51. package/dist/src/providers/RoomstayThemeEngine.js +2 -1
  52. package/dist/src/providers/RoomstayThemeEngine.js.map +1 -1
  53. package/dist/src/translations/Translation.d.ts +1 -0
  54. package/dist/src/translations/Translation.js +1 -0
  55. package/dist/src/translations/Translation.js.map +1 -1
  56. package/dist/src/translations/languages/en-gb.js +1 -0
  57. package/dist/src/translations/languages/en-gb.js.map +1 -1
  58. package/dist/test.bundle.js +1 -1
  59. package/dist/vendors.bundle.js +1 -1
  60. package/package.json +4 -2
  61. package/dist/4.bundle.js +0 -1
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.APIError = void 0;
7
+ const contexts_1 = require("../contexts/index.js");
8
+ const ui_1 = require("@roomstay/ui");
9
+ const BookingAPI_1 = __importDefault(require("../api/BookingAPI"));
10
+ const RoomstayThemeEngine_1 = __importDefault(require("../providers/RoomstayThemeEngine"));
11
+ const Translation_1 = require("../translations/Translation");
12
+ const RoomstayError_1 = require("./RoomstayError");
13
+ class APIError extends RoomstayError_1.RoomstayError {
14
+ constructor(message) {
15
+ super(message !== null && message !== void 0 ? message : 'Failed to load API data');
16
+ }
17
+ toString() {
18
+ // We'll fetch the error API quickly to see if there is any scheduled maintenance.
19
+ BookingAPI_1.default.Error.getStatus().then((response) => {
20
+ var _a, _b;
21
+ if (response) {
22
+ contexts_1.ErrorHandler.add({
23
+ title: (_a = response.title) !== null && _a !== void 0 ? _a : (_b = RoomstayThemeEngine_1.default.translation) === null || _b === void 0 ? void 0 : _b.call(RoomstayThemeEngine_1.default, Translation_1.Translation.Misc.APIErrorTitle),
24
+ message: response.message,
25
+ icon: ui_1.IconType.Error,
26
+ });
27
+ }
28
+ });
29
+ }
30
+ }
31
+ exports.APIError = APIError;
32
+ //# sourceMappingURL=APIError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APIError.js","sourceRoot":"/","sources":["src/errors/APIError.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAkD;AAClD,qCAAwC;AAExC,kEAAmC;AACnC,0FAAkE;AAClE,4DAAyD;AAEzD,mDAAgD;AAEhD,MAAa,QAAS,SAAQ,6BAAa;IACvC,YAAmB,OAAgB;QAC/B,KAAK,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,yBAAyB,CAAC,CAAC;IAChD,CAAC;IAEM,QAAQ;QACX,kFAAkF;QAClF,oBAAG,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;;YACpC,IAAI,QAAQ,EAAE,CAAC;gBACX,uBAAY,CAAC,GAAG,CAAC;oBACb,KAAK,EAAE,MAAA,QAAQ,CAAC,KAAK,mCAAI,MAAA,6BAAmB,CAAC,WAAW,8EAAG,yBAAW,CAAC,IAAI,CAAC,aAAa,CAAC;oBAC1F,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,IAAI,EAAE,aAAQ,CAAC,KAAK;iBACvB,CAAC,CAAC;YACP,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAjBD,4BAiBC","sourcesContent":["import { ErrorHandler } from '@frontend/contexts';\nimport { IconType } from '@roomstay/ui';\n\nimport API from '@/api/BookingAPI';\nimport RoomstayThemeEngine from '@/providers/RoomstayThemeEngine';\nimport { Translation } from '@/translations/Translation';\n\nimport { RoomstayError } from './RoomstayError';\n\nexport class APIError extends RoomstayError {\n public constructor(message?: string) {\n super(message ?? 'Failed to load API data');\n }\n\n public toString() {\n // We'll fetch the error API quickly to see if there is any scheduled maintenance.\n API.Error.getStatus().then((response) => {\n if (response) {\n ErrorHandler.add({\n title: response.title ?? RoomstayThemeEngine.translation?.(Translation.Misc.APIErrorTitle),\n message: response.message,\n icon: IconType.Error,\n });\n }\n });\n }\n}\n"]}
@@ -1,8 +1,6 @@
1
1
  import dayjs from 'dayjs';
2
- import { RoomstayError } from 'errors/RoomstayError';
3
- import { TFunction } from 'i18next';
4
- export default class GetAvailabilityError extends RoomstayError {
2
+ import { APIError } from './APIError';
3
+ export default class GetAvailabilityError extends APIError {
5
4
  private fromMonth;
6
5
  constructor(fromMonth: dayjs.Dayjs, toMonth: dayjs.Dayjs);
7
- toString(t?: TFunction): void;
8
6
  }
@@ -1,28 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const contexts_1 = require("../contexts/index.js");
7
- const RoomstayError_1 = require("errors/RoomstayError");
8
- const i18next_1 = __importDefault(require("i18next"));
9
3
  const BaseAPI_1 = require("../api/BaseAPI");
10
- const Translation_1 = require("../translations/Translation");
11
- class GetAvailabilityError extends RoomstayError_1.RoomstayError {
4
+ const APIError_1 = require("./APIError");
5
+ class GetAvailabilityError extends APIError_1.APIError {
12
6
  constructor(fromMonth, toMonth) {
13
7
  const fromDatePretty = fromMonth.format(BaseAPI_1.API_DATE_FORMAT);
14
8
  const toDatePretty = toMonth.format(BaseAPI_1.API_DATE_FORMAT);
15
9
  super(`Failed to load calendar data for: ${fromDatePretty} - ${toDatePretty}`);
16
10
  this.fromMonth = fromMonth;
17
11
  }
18
- toString(t = i18next_1.default.t) {
19
- contexts_1.ErrorHandler.add({
20
- title: t(Translation_1.Translation.Step.Date.AvailabilityCheckFailed.Title),
21
- message: t(Translation_1.Translation.Step.Date.AvailabilityCheckFailed.Message, {
22
- month: this.fromMonth.format('MMMM'),
23
- }),
24
- });
25
- }
26
12
  }
27
13
  exports.default = GetAvailabilityError;
28
14
  //# sourceMappingURL=GetAvailabilityError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GetAvailabilityError.js","sourceRoot":"/","sources":["src/errors/GetAvailabilityError.ts"],"names":[],"mappings":";;;;;AAAA,iDAAkD;AAElD,wDAAqD;AACrD,sDAA6C;AAE7C,2CAAgD;AAChD,4DAAyD;AAEzD,MAAqB,oBAAqB,SAAQ,6BAAa;IAG3D,YAAmB,SAAsB,EAAE,OAAoB;QAC3D,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,yBAAe,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,yBAAe,CAAC,CAAC;QAErD,KAAK,CAAC,qCAAqC,cAAc,MAAM,YAAY,EAAE,CAAC,CAAC;QAE/E,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAEM,QAAQ,CAAC,IAAe,iBAAO,CAAC,CAAC;QACpC,uBAAY,CAAC,GAAG,CAAC;YACb,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;YAC7D,OAAO,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE;gBAC9D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;aACvC,CAAC;SACL,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,uCAoBC","sourcesContent":["import { ErrorHandler } from '@frontend/contexts';\nimport dayjs from 'dayjs';\nimport { RoomstayError } from 'errors/RoomstayError';\nimport i18next, { TFunction } from 'i18next';\n\nimport { API_DATE_FORMAT } from '@/api/BaseAPI';\nimport { Translation } from '@/translations/Translation';\n\nexport default class GetAvailabilityError extends RoomstayError {\n private fromMonth: dayjs.Dayjs;\n\n public constructor(fromMonth: dayjs.Dayjs, toMonth: dayjs.Dayjs) {\n const fromDatePretty = fromMonth.format(API_DATE_FORMAT);\n const toDatePretty = toMonth.format(API_DATE_FORMAT);\n\n super(`Failed to load calendar data for: ${fromDatePretty} - ${toDatePretty}`);\n\n this.fromMonth = fromMonth;\n }\n\n public toString(t: TFunction = i18next.t) {\n ErrorHandler.add({\n title: t(Translation.Step.Date.AvailabilityCheckFailed.Title),\n message: t(Translation.Step.Date.AvailabilityCheckFailed.Message, {\n month: this.fromMonth.format('MMMM'),\n }),\n });\n }\n}\n"]}
1
+ {"version":3,"file":"GetAvailabilityError.js","sourceRoot":"/","sources":["src/errors/GetAvailabilityError.ts"],"names":[],"mappings":";;AAEA,2CAAgD;AAEhD,yCAAsC;AAEtC,MAAqB,oBAAqB,SAAQ,mBAAQ;IAGtD,YAAmB,SAAsB,EAAE,OAAoB;QAC3D,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,yBAAe,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,yBAAe,CAAC,CAAC;QAErD,KAAK,CAAC,qCAAqC,cAAc,MAAM,YAAY,EAAE,CAAC,CAAC;QAE/E,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAXD,uCAWC","sourcesContent":["import dayjs from 'dayjs';\n\nimport { API_DATE_FORMAT } from '@/api/BaseAPI';\n\nimport { APIError } from './APIError';\n\nexport default class GetAvailabilityError extends APIError {\n private fromMonth: dayjs.Dayjs;\n\n public constructor(fromMonth: dayjs.Dayjs, toMonth: dayjs.Dayjs) {\n const fromDatePretty = fromMonth.format(API_DATE_FORMAT);\n const toDatePretty = toMonth.format(API_DATE_FORMAT);\n\n super(`Failed to load calendar data for: ${fromDatePretty} - ${toDatePretty}`);\n\n this.fromMonth = fromMonth;\n }\n}\n"]}
@@ -33,5 +33,5 @@ export type PaymentHandler = {
33
33
  onSubOptionChange?: (value?: string) => void;
34
34
  };
35
35
  export interface PaymentHandlerElementRef {
36
- submitPayment: () => ReturnType<PaymentHandler['onConfirm']>;
36
+ submitPayment: (args?: any) => ReturnType<PaymentHandler['onConfirm']>;
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentHandler.js","sourceRoot":"/","sources":["src/handlers/payment/PaymentHandler.ts"],"names":[],"mappings":"","sourcesContent":["import { EBookingPaymentMethod, IBookingPayment } from '@roomstay/core';\nimport { ReactNode } from 'react';\n\nimport { IRadioButtonOption } from '@/components/generic/RadioButtonGroup/RadioButtonGroup';\n\nexport type PaymentHandler = {\n name: string;\n /** If the payment option should be considered. It doesn't mean it will be selectable yet */\n isAvailable: boolean;\n\n isDisabled?: boolean;\n disabledReason?: string;\n\n requireFormFilled?: boolean;\n /** Payment handler will only be selectable if booking has been placed */\n requireBookingPlaced: boolean;\n /**\n * Exclusive payment methods will be displayed separately from all others.\n * Only one exclusive payment handler will execute. This depends on the order of the handlers.\n */\n isExclusive: boolean;\n\n /**\n * An exclusive payment method may have its own confirm/pay button\n */\n hasCustomConfirmButton?: boolean;\n\n bookingPaymentMethod: EBookingPaymentMethod;\n\n subOptions?: IRadioButtonOption[];\n\n getBookingPaymentRequestObject: () => Promise<IBookingPayment>;\n onSelect?: () => void;\n\n renderInput?: () => JSX.Element;\n renderPaymentInput?: () => ReactNode | undefined;\n\n onConfirm: () => Promise<{ success: boolean; message: string; data?: Partial<IBookingPayment> | any }>;\n\n onSubOptionChange?: (value?: string) => void;\n};\n\nexport interface PaymentHandlerElementRef {\n submitPayment: () => ReturnType<PaymentHandler['onConfirm']>;\n}\n"]}
1
+ {"version":3,"file":"PaymentHandler.js","sourceRoot":"/","sources":["src/handlers/payment/PaymentHandler.ts"],"names":[],"mappings":"","sourcesContent":["import { EBookingPaymentMethod, IBookingPayment } from '@roomstay/core';\nimport { ReactNode } from 'react';\n\nimport { IRadioButtonOption } from '@/components/generic/RadioButtonGroup/RadioButtonGroup';\n\nexport type PaymentHandler = {\n name: string;\n /** If the payment option should be considered. It doesn't mean it will be selectable yet */\n isAvailable: boolean;\n\n isDisabled?: boolean;\n disabledReason?: string;\n\n requireFormFilled?: boolean;\n /** Payment handler will only be selectable if booking has been placed */\n requireBookingPlaced: boolean;\n /**\n * Exclusive payment methods will be displayed separately from all others.\n * Only one exclusive payment handler will execute. This depends on the order of the handlers.\n */\n isExclusive: boolean;\n\n /**\n * An exclusive payment method may have its own confirm/pay button\n */\n hasCustomConfirmButton?: boolean;\n\n bookingPaymentMethod: EBookingPaymentMethod;\n\n subOptions?: IRadioButtonOption[];\n\n getBookingPaymentRequestObject: () => Promise<IBookingPayment>;\n onSelect?: () => void;\n\n renderInput?: () => JSX.Element;\n renderPaymentInput?: () => ReactNode | undefined;\n\n onConfirm: () => Promise<{ success: boolean; message: string; data?: Partial<IBookingPayment> | any }>;\n\n onSubOptionChange?: (value?: string) => void;\n};\n\nexport interface PaymentHandlerElementRef {\n submitPayment: (args?: any) => ReturnType<PaymentHandler['onConfirm']>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { PaymentHandler } from './PaymentHandler';
2
+ export declare const stripePaymentHandler: () => PaymentHandler;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.stripePaymentHandler = void 0;
46
+ const core_1 = require("@roomstay/core");
47
+ const react_1 = __importStar(require("react"));
48
+ const StripePaymentOption_1 = require("../../components/steps/confirmation/StripePaymentOption/StripePaymentOption");
49
+ const hooks_1 = require("../../hooks");
50
+ const stripePaymentHandler = () => {
51
+ const { hotel } = (0, hooks_1.useCurrentHotel)();
52
+ const paymentRef = (0, react_1.useRef)(null);
53
+ return {
54
+ name: 'Stripe',
55
+ isAvailable: (hotel === null || hotel === void 0 ? void 0 : hotel.cardProcessor) === core_1.EHotelCardProcessor.Stripe,
56
+ isExclusive: true,
57
+ requireBookingPlaced: true,
58
+ bookingPaymentMethod: core_1.EBookingPaymentMethod.Card,
59
+ onConfirm: () => __awaiter(void 0, void 0, void 0, function* () {
60
+ if (paymentRef.current) {
61
+ return paymentRef.current.submitPayment();
62
+ }
63
+ return { success: false, retryPayment: false, message: 'Something has gone wrong. Failed to get payment information details.' };
64
+ }),
65
+ getBookingPaymentRequestObject: () => __awaiter(void 0, void 0, void 0, function* () {
66
+ return {
67
+ Method: core_1.EBookingPaymentMethod.Card,
68
+ };
69
+ }),
70
+ renderPaymentInput: () => react_1.default.createElement(StripePaymentOption_1.StripePaymentOption, { ref: paymentRef }),
71
+ };
72
+ };
73
+ exports.stripePaymentHandler = stripePaymentHandler;
74
+ //# sourceMappingURL=StripePaymentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StripePaymentHandler.js","sourceRoot":"/","sources":["src/handlers/payment/StripePaymentHandler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA4E;AAC5E,+CAAsC;AAEtC,iHAA8G;AAE9G,mCAA0C;AAEnC,MAAM,oBAAoB,GAAG,GAAmB,EAAE;IACrD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAEpC,MAAM,UAAU,GAAG,IAAA,cAAM,EAA2B,IAAI,CAAC,CAAC;IAE1D,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,MAAK,0BAAmB,CAAC,MAAM;QAChE,WAAW,EAAE,IAAI;QACjB,oBAAoB,EAAE,IAAI;QAC1B,oBAAoB,EAAE,4BAAqB,CAAC,IAAI;QAChD,SAAS,EAAE,GAAS,EAAE;YAClB,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;gBACrB,OAAO,UAAU,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC9C,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,sEAAsE,EAAE,CAAC;QACpI,CAAC,CAAA;QACD,8BAA8B,EAAE,GAAS,EAAE;YACvC,OAAO;gBACH,MAAM,EAAE,4BAAqB,CAAC,IAAI;aACrC,CAAC;QACN,CAAC,CAAA;QACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,8BAAC,yCAAmB,IAAC,GAAG,EAAE,UAAU,GAAI;KACrE,CAAC;AACN,CAAC,CAAC;AAzBW,QAAA,oBAAoB,wBAyB/B","sourcesContent":["import { EBookingPaymentMethod, EHotelCardProcessor } from '@roomstay/core';\nimport React, { useRef } from 'react';\n\nimport { StripePaymentOption } from '@/components/steps/confirmation/StripePaymentOption/StripePaymentOption';\nimport { PaymentHandler, PaymentHandlerElementRef } from '@/handlers/payment/PaymentHandler';\nimport { useCurrentHotel } from '@/hooks';\n\nexport const stripePaymentHandler = (): PaymentHandler => {\n const { hotel } = useCurrentHotel();\n\n const paymentRef = useRef<PaymentHandlerElementRef>(null);\n\n return {\n name: 'Stripe',\n isAvailable: hotel?.cardProcessor === EHotelCardProcessor.Stripe,\n isExclusive: true,\n requireBookingPlaced: true,\n bookingPaymentMethod: EBookingPaymentMethod.Card,\n onConfirm: async () => {\n if (paymentRef.current) {\n return paymentRef.current.submitPayment();\n }\n\n return { success: false, retryPayment: false, message: 'Something has gone wrong. Failed to get payment information details.' };\n },\n getBookingPaymentRequestObject: async () => {\n return {\n Method: EBookingPaymentMethod.Card,\n };\n },\n renderPaymentInput: () => <StripePaymentOption ref={paymentRef} />,\n };\n};\n"]}
@@ -118,7 +118,7 @@ export type HotelDTO = {
118
118
  disableSavedPayments: boolean;
119
119
  enableRoomUpsells?: boolean;
120
120
  enableRateUpsells?: boolean;
121
- } & Pick<AdminHotelConfig, 'childConfiguration' | 'perks' | 'perkTitle' | 'countryPrefix' | 'quoteImageDesktop' | 'quoteImageMobile' | 'memberOnlyImage' | 'captureChildAge' | 'company' | 'fees' | 'addDepositFeeToBookingTotal' | 'minAdultAge' | 'maxAdultAge' | 'countInfantsInOccupancy' | 'preferProviderBookingId' | 'showUnavailableRooms' | 'isRACMemberNoRequired'> & Pick<ClientHotelConfig, 'memberOnlyRenderRateLast'>;
121
+ } & Pick<AdminHotelConfig, 'childConfiguration' | 'perks' | 'perkTitle' | 'countryPrefix' | 'quoteImageDesktop' | 'quoteImageMobile' | 'memberOnlyImage' | 'captureChildAge' | 'company' | 'fees' | 'addDepositFeeToBookingTotal' | 'minAdultAge' | 'maxAdultAge' | 'countInfantsInOccupancy' | 'preferProviderBookingId' | 'showUnavailableRooms' | 'isRACMemberNoRequired' | 'countryCode'> & Pick<ClientHotelConfig, 'memberOnlyRenderRateLast'>;
122
122
  export declare enum VGSCardName {
123
123
  Visa = "visa",
124
124
  Mastercard = "mastercard",
@@ -1 +1 @@
1
- {"version":3,"file":"HotelDTO.js","sourceRoot":"/","sources":["src/models/Api/HotelDTO.ts"],"names":[],"mappings":";;;AAMA,uDAAiH;AA0JjH,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,0BAAW,CAAA;IACX,wCAAyB,CAAA;IACzB,uCAAwB,CAAA;IACxB,oCAAqB,CAAA;AACzB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAEY,QAAA,0BAA0B,GAAsD;IACzF,CAAC,wBAAgB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,IAAI;IACzC,CAAC,wBAAgB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU;IACrD,CAAC,wBAAgB,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG;IACvC,CAAC,wBAAgB,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,eAAe;IAC/D,CAAC,wBAAgB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU;IACrD,CAAC,wBAAgB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ;CACpD,CAAC","sourcesContent":["import { EnvironmentName } from '@planpay/web/src/lib/shared-lib-duplicates';\nimport type { EBookingPaymentMethod, EHotelCardProcessor, EHotelStateFieldConfiguration, EIntegration, IAuxiliaryFilter } from '@roomstay/core';\nimport { DeepPartial } from 'react-hook-form';\n\nimport ColorProfile from '@/models/Client/Hotel/ColorProfile';\nimport { DistanceUnitType } from '@/models/Client/Hotel/DistanceUnitType.types';\nimport { AdminHotelConfig, ClientHotelConfig, ConfigHotel, EPaymentCardType } from '@/models/Client/Hotel/Hotel';\nimport HotelAddress from '@/models/Client/Hotel/HotelAddress';\nimport { HotelDataSource } from '@/models/Client/Hotel/HotelDataSource.types';\nimport { WeekdayStartsOn } from '@/models/Client/Hotel/WeekdayStartsOn.types';\n\nexport type HotelServiceDTO = {\n detail: string;\n included: boolean;\n name: string;\n onsite: boolean;\n};\n\nexport type HotelRoomsDTO = {\n [roomTypeCode: string]: HotelRoomDTO;\n};\n\nexport type HotelRoomGroupsDTO = {\n groupName: string;\n id: string;\n checkInTime?: string | null;\n checkOutTime?: string | null;\n filters: {\n [id: string]: {\n // Options on the AuxiliaryFilter itself:\n name: string;\n type: 'select';\n includeAllAbove: boolean;\n requireInput: boolean;\n options: IAuxiliaryFilter['options'];\n\n // Options on the RoomGroupAuxiliaryFilter:\n requireSelection: boolean;\n };\n };\n}[];\n\nexport type HotelRoomAmenitiesDTO = {\n type: string;\n description: string;\n};\n\nexport type HotelRoomDTO = {\n code: string;\n name: string;\n shortDescription: string;\n longDescription: string;\n images: string[];\n quantity: number;\n maxOccupancy: number;\n bedQuantity: number;\n showBedType?: boolean;\n standardNumBeds: number;\n maxRollaways: number;\n bedType: string;\n amenities: HotelRoomAmenitiesDTO[];\n features: HotelRoomAmenitiesDTO[];\n bedTypeOverride?: string;\n roomGroupId?: string;\n roomSize?: number;\n prePerkDisclaimer?: string;\n perks?: ConfigHotel['perks'];\n petFriendly?: boolean;\n};\n\nexport type HotelDTO = {\n id: number;\n name: string;\n chainId: number;\n chainName: string;\n\n address: HotelAddress;\n phone: string;\n\n latitude: string;\n longitude: string;\n\n utcOffset: string;\n timeZone: string;\n\n languageCode: string;\n currencyCode: string;\n\n checkInTime: string;\n checkOutTime: string;\n\n paymentCardTypes: EPaymentCardType[];\n\n description: string;\n locationDescription: string;\n policies: string;\n\n hotelServices: HotelServiceDTO[];\n businessServices: HotelServiceDTO[];\n\n rooms: { [roomTypeCode: string]: HotelRoomDTO };\n dataSource: HotelDataSource;\n\n // Following fields are only present if dataSource = 'roomstay'\n logo?: string;\n colors: DeepPartial<ColorProfile>;\n distanceUnitType?: DistanceUnitType;\n weekdayStartsOn?: WeekdayStartsOn;\n\n crossSellHotelIds?: string[];\n paymentMethods: EBookingPaymentMethod[];\n cardProcessor: EHotelCardProcessor;\n planpay?: {\n username: string;\n minDaysShowPlanpay: number;\n env: EnvironmentName;\n };\n\n email?: string;\n hotelUrl?: string;\n heroImage?: string;\n images?: string[];\n integrations?: EIntegration[];\n roomGroups: HotelRoomGroupsDTO;\n rmsUseDepositQuote?: boolean;\n checkAreaAvailabilityOnRoomStep?: boolean;\n /** @deprecated Use the new Fees model instead */\n enableCreditCardSurcharge?: boolean;\n availableCountries?: { name: string; value: string }[];\n preventCancellation?: boolean;\n maxAdults?: number;\n maxChildren?: number;\n maxInfants?: number;\n stateFieldConfiguration?: EHotelStateFieldConfiguration;\n itineraryNote: string;\n disableSavedPayments: boolean;\n enableRoomUpsells?: boolean;\n enableRateUpsells?: boolean;\n} & Pick<\n AdminHotelConfig,\n | 'childConfiguration'\n | 'perks'\n | 'perkTitle'\n | 'countryPrefix'\n | 'quoteImageDesktop'\n | 'quoteImageMobile'\n | 'memberOnlyImage'\n | 'captureChildAge'\n | 'company'\n | 'fees'\n | 'addDepositFeeToBookingTotal'\n | 'minAdultAge'\n | 'maxAdultAge'\n | 'countInfantsInOccupancy'\n | 'preferProviderBookingId'\n | 'showUnavailableRooms'\n | 'isRACMemberNoRequired'\n> &\n Pick<ClientHotelConfig, 'memberOnlyRenderRateLast'>;\n\nexport enum VGSCardName {\n Visa = 'visa',\n Mastercard = 'mastercard',\n JCB = 'jcb',\n DinersClub = 'dinersclub',\n AmericanExpress = 'amex',\n UnionPay = 'unionpay',\n}\n\nexport const SynxisToVGSCardNameMapping: { [synxisName in EPaymentCardType]: VGSCardName } = {\n [EPaymentCardType.Visa]: VGSCardName.Visa,\n [EPaymentCardType.Mastercard]: VGSCardName.Mastercard,\n [EPaymentCardType.JCB]: VGSCardName.JCB,\n [EPaymentCardType.AmericanExpress]: VGSCardName.AmericanExpress,\n [EPaymentCardType.DinersClub]: VGSCardName.DinersClub,\n [EPaymentCardType.UnionPay]: VGSCardName.UnionPay,\n};\n"]}
1
+ {"version":3,"file":"HotelDTO.js","sourceRoot":"/","sources":["src/models/Api/HotelDTO.ts"],"names":[],"mappings":";;;AAMA,uDAAiH;AA2JjH,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,0BAAW,CAAA;IACX,wCAAyB,CAAA;IACzB,uCAAwB,CAAA;IACxB,oCAAqB,CAAA;AACzB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAEY,QAAA,0BAA0B,GAAsD;IACzF,CAAC,wBAAgB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,IAAI;IACzC,CAAC,wBAAgB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU;IACrD,CAAC,wBAAgB,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG;IACvC,CAAC,wBAAgB,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,eAAe;IAC/D,CAAC,wBAAgB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU;IACrD,CAAC,wBAAgB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ;CACpD,CAAC","sourcesContent":["import { EnvironmentName } from '@planpay/web/src/lib/shared-lib-duplicates';\nimport type { EBookingPaymentMethod, EHotelCardProcessor, EHotelStateFieldConfiguration, EIntegration, IAuxiliaryFilter } from '@roomstay/core';\nimport { DeepPartial } from 'react-hook-form';\n\nimport ColorProfile from '@/models/Client/Hotel/ColorProfile';\nimport { DistanceUnitType } from '@/models/Client/Hotel/DistanceUnitType.types';\nimport { AdminHotelConfig, ClientHotelConfig, ConfigHotel, EPaymentCardType } from '@/models/Client/Hotel/Hotel';\nimport HotelAddress from '@/models/Client/Hotel/HotelAddress';\nimport { HotelDataSource } from '@/models/Client/Hotel/HotelDataSource.types';\nimport { WeekdayStartsOn } from '@/models/Client/Hotel/WeekdayStartsOn.types';\n\nexport type HotelServiceDTO = {\n detail: string;\n included: boolean;\n name: string;\n onsite: boolean;\n};\n\nexport type HotelRoomsDTO = {\n [roomTypeCode: string]: HotelRoomDTO;\n};\n\nexport type HotelRoomGroupsDTO = {\n groupName: string;\n id: string;\n checkInTime?: string | null;\n checkOutTime?: string | null;\n filters: {\n [id: string]: {\n // Options on the AuxiliaryFilter itself:\n name: string;\n type: 'select';\n includeAllAbove: boolean;\n requireInput: boolean;\n options: IAuxiliaryFilter['options'];\n\n // Options on the RoomGroupAuxiliaryFilter:\n requireSelection: boolean;\n };\n };\n}[];\n\nexport type HotelRoomAmenitiesDTO = {\n type: string;\n description: string;\n};\n\nexport type HotelRoomDTO = {\n code: string;\n name: string;\n shortDescription: string;\n longDescription: string;\n images: string[];\n quantity: number;\n maxOccupancy: number;\n bedQuantity: number;\n showBedType?: boolean;\n standardNumBeds: number;\n maxRollaways: number;\n bedType: string;\n amenities: HotelRoomAmenitiesDTO[];\n features: HotelRoomAmenitiesDTO[];\n bedTypeOverride?: string;\n roomGroupId?: string;\n roomSize?: number;\n prePerkDisclaimer?: string;\n perks?: ConfigHotel['perks'];\n petFriendly?: boolean;\n};\n\nexport type HotelDTO = {\n id: number;\n name: string;\n chainId: number;\n chainName: string;\n\n address: HotelAddress;\n phone: string;\n\n latitude: string;\n longitude: string;\n\n utcOffset: string;\n timeZone: string;\n\n languageCode: string;\n currencyCode: string;\n\n checkInTime: string;\n checkOutTime: string;\n\n paymentCardTypes: EPaymentCardType[];\n\n description: string;\n locationDescription: string;\n policies: string;\n\n hotelServices: HotelServiceDTO[];\n businessServices: HotelServiceDTO[];\n\n rooms: { [roomTypeCode: string]: HotelRoomDTO };\n dataSource: HotelDataSource;\n\n // Following fields are only present if dataSource = 'roomstay'\n logo?: string;\n colors: DeepPartial<ColorProfile>;\n distanceUnitType?: DistanceUnitType;\n weekdayStartsOn?: WeekdayStartsOn;\n\n crossSellHotelIds?: string[];\n paymentMethods: EBookingPaymentMethod[];\n cardProcessor: EHotelCardProcessor;\n planpay?: {\n username: string;\n minDaysShowPlanpay: number;\n env: EnvironmentName;\n };\n\n email?: string;\n hotelUrl?: string;\n heroImage?: string;\n images?: string[];\n integrations?: EIntegration[];\n roomGroups: HotelRoomGroupsDTO;\n rmsUseDepositQuote?: boolean;\n checkAreaAvailabilityOnRoomStep?: boolean;\n /** @deprecated Use the new Fees model instead */\n enableCreditCardSurcharge?: boolean;\n availableCountries?: { name: string; value: string }[];\n preventCancellation?: boolean;\n maxAdults?: number;\n maxChildren?: number;\n maxInfants?: number;\n stateFieldConfiguration?: EHotelStateFieldConfiguration;\n itineraryNote: string;\n disableSavedPayments: boolean;\n enableRoomUpsells?: boolean;\n enableRateUpsells?: boolean;\n} & Pick<\n AdminHotelConfig,\n | 'childConfiguration'\n | 'perks'\n | 'perkTitle'\n | 'countryPrefix'\n | 'quoteImageDesktop'\n | 'quoteImageMobile'\n | 'memberOnlyImage'\n | 'captureChildAge'\n | 'company'\n | 'fees'\n | 'addDepositFeeToBookingTotal'\n | 'minAdultAge'\n | 'maxAdultAge'\n | 'countInfantsInOccupancy'\n | 'preferProviderBookingId'\n | 'showUnavailableRooms'\n | 'isRACMemberNoRequired'\n | 'countryCode'\n> &\n Pick<ClientHotelConfig, 'memberOnlyRenderRateLast'>;\n\nexport enum VGSCardName {\n Visa = 'visa',\n Mastercard = 'mastercard',\n JCB = 'jcb',\n DinersClub = 'dinersclub',\n AmericanExpress = 'amex',\n UnionPay = 'unionpay',\n}\n\nexport const SynxisToVGSCardNameMapping: { [synxisName in EPaymentCardType]: VGSCardName } = {\n [EPaymentCardType.Visa]: VGSCardName.Visa,\n [EPaymentCardType.Mastercard]: VGSCardName.Mastercard,\n [EPaymentCardType.JCB]: VGSCardName.JCB,\n [EPaymentCardType.AmericanExpress]: VGSCardName.AmericanExpress,\n [EPaymentCardType.DinersClub]: VGSCardName.DinersClub,\n [EPaymentCardType.UnionPay]: VGSCardName.UnionPay,\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  import { IHotelColorScheme } from '@roomstay/core';
2
+ import { TFunction } from 'i18next';
2
3
  import type { Company } from '../models/Client/Hotel/Company';
3
4
  import { Language } from './LanguageProvider';
4
5
  declare global {
@@ -21,6 +22,7 @@ declare class RoomstayThemeEngine {
21
22
  ThemeType: RoomstayTheme;
22
23
  ExternalStyles: string[];
23
24
  ExternalScripts: string[];
25
+ translation: TFunction | null;
24
26
  constructor();
25
27
  changeCompany: (newCompany: Company) => void;
26
28
  changeTheme: (profile: IHotelColorScheme) => Promise<void>;
@@ -75,6 +75,7 @@ class RoomstayThemeEngine {
75
75
  this.ThemeType = RoomstayTheme.Light;
76
76
  this.ExternalStyles = [];
77
77
  this.ExternalScripts = ['https://js.verygoodvault.com/vgs-collect/1/AC7dReJwJ6EWF1L9FHdcCw7n.js'];
78
+ this.translation = null;
78
79
  this.changeCompany = (newCompany) => {
79
80
  this.currentCompany = newCompany;
80
81
  this.registerStyles(newCompany.colors);
@@ -173,7 +174,7 @@ class RoomstayThemeEngine {
173
174
  dayjs_1.default.extend(isSameOrBefore_1.default);
174
175
  dayjs_1.default.extend(isSameOrAfter_1.default);
175
176
  if (i18next_1.default) {
176
- i18next_1.default.use(react_i18next_1.initReactI18next).init({
177
+ this.translation = yield i18next_1.default.use(react_i18next_1.initReactI18next).init({
177
178
  interpolation: { escapeValue: false },
178
179
  lng: LanguageProvider_1.Language.en_us,
179
180
  resources: LanguageProvider_1.LanguageProvider.getI18nMappedLanguages(),
@@ -1 +1 @@
1
- {"version":3,"file":"RoomstayThemeEngine.js","sourceRoot":"/","sources":["src/providers/RoomstayThemeEngine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+C;AAE/C,wDAA0C;AAC1C,kDAA0B;AAC1B,+EAAuD;AACvD,iFAAyD;AACzD,sDAA2B;AAC3B,iDAAiD;AAGjD,mEAA0E;AAC1E,wCAA6D;AAY7D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;IACxC,MAAM,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;AAC/C,CAAC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,kCAAiB,CAAA;IACjB,gCAAe,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,MAAM,mBA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BAAiB,CAAC,KAAK,0CAAE,OAAO,CAAC,qCAAqC,CAAY,IAAG,CAAC,CAAC,EAAE,CAAC;oCAChG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;oCAC1B,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;gCAC1C,CAAC;4BACL,CAAC;wBACL,CAAC;wBAAC,OAAO,EAAE,EAAE,CAAC;4BACV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;wBACpB,CAAC;wBAED,OAAO,KAAK,CAAC;oBACjB,CAAC;iBACJ,CAAC,CAAC;YACP,CAAC;YAED,IAAI,CAAC,8BAA8B,EAAE,CAAC;QAC1C,CAAC,CAAA,CAAC;QAEM,mCAA8B,GAAG,GAAG,EAAE;YAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;YAClF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YAEpF,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,EAAE,CAAC;YACpC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,EAAE,CAAC;YAEnC,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1B,CAAC,CAAC;QAlKE,OAAO,CAAC,GAAG,CAAC,yCAAyC,kBAAU,EAAE,CAAC,CAAC;IACvE,CAAC;CAkKJ;AAED,kBAAe,IAAI,mBAAmB,EAAE,CAAC","sourcesContent":["import * as ROP from '@juggle/resize-observer';\nimport { IHotelColorScheme } from '@roomstay/core';\nimport * as Sentry from '@sentry/browser';\nimport dayjs from 'dayjs';\nimport isSameOrAfter from 'dayjs/plugin/isSameOrAfter';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore';\nimport i18n from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport type { Company } from '@/models/Client/Hotel/Company';\nimport { Language, LanguageProvider } from '@/providers/LanguageProvider';\nimport { getAccentOverrideStyleContent } from '@/util/Color';\n\ndeclare global {\n interface Window {\n ResizeObserver: any;\n }\n}\n\ndeclare const ASSET_URL: string;\n\nexport declare const RS_VERSION: string;\n\nif (typeof ResizeObserver === 'undefined') {\n window.ResizeObserver = ROP.ResizeObserver;\n}\n\nexport enum RoomstayTheme {\n Medium = 'medium',\n Light = 'light',\n}\n\nclass RoomstayThemeEngine {\n public currentCompany: Company | null = null;\n\n public EngineContainer!: HTMLElement;\n\n public ScriptContainer: Element | null = null;\n public StyleContainer: Element | null = null;\n\n public selectedLang: Language = Language.en_us;\n\n // TODO This needs to be changed, not ideal to just check for localhost\n public isLocalhost: boolean = location.hostname === 'localhost';\n\n // TODO: This needs to be refactored to not be a fixed string.\n public ThemeType = RoomstayTheme.Light;\n\n public ExternalStyles: string[] = [];\n public ExternalScripts: string[] = ['https://js.verygoodvault.com/vgs-collect/1/AC7dReJwJ6EWF1L9FHdcCw7n.js'];\n\n public constructor() {\n console.log(`Initializing Roomstay Booking Engine v${RS_VERSION}`);\n }\n\n public changeCompany = (newCompany: Company) => {\n this.currentCompany = newCompany;\n this.registerStyles(newCompany.colors);\n };\n\n public changeTheme = async (profile: IHotelColorScheme) => {\n const styleOverrides = this.createElementOrReuseExisting('style', 'engine-styles');\n\n styleOverrides.setAttribute('rel', 'preload');\n\n styleOverrides.innerHTML = `\n :root {\n ${getAccentOverrideStyleContent(profile)}\n }`;\n };\n\n public registerStyles = async (profile?: IHotelColorScheme) => {\n console.log('Loading custom Theme Styles');\n if (profile) {\n this.changeTheme(profile);\n }\n\n this.ExternalStyles.forEach((url, index) => {\n const style = this.createElementOrReuseExisting('link', `engine-external-style-${index}`);\n style.setAttribute('rel', 'stylesheet');\n style.setAttribute('href', this.getAssetUrl() + url);\n });\n };\n\n public getAssetUrl = () => {\n return ASSET_URL;\n };\n\n public getImageAssetUrl = (url = '') => {\n return this.getAssetUrl() + 'assets/img/' + url;\n };\n\n /**\n * Detects if URL is absolute, and needs to be\n * @param url string\n */\n public wrapAssetUrl = (url: string) => {\n if (url.match(/^(?:[a-z]+:)?\\/\\//)) {\n return url;\n }\n\n return this.getAssetUrl() + url;\n };\n\n public registerScripts = async () => {\n this.ExternalScripts.forEach((url: string, index) => {\n this.loadScript(url, `legacy-${index}`);\n });\n };\n\n public loadScript = (src: string, name: string, alwaysExecute = false, timeout = 5_000): Promise<void> =>\n new Promise((resolve, reject) => {\n const container = this.EngineContainer;\n const existingScript = container.querySelector(`script[name=\"roomstay-script-${name}\"]`);\n\n if (existingScript) {\n if (alwaysExecute) {\n existingScript.remove();\n } else {\n resolve();\n return;\n }\n }\n\n const cleanup = () => {\n clearTimeout(timer);\n script.removeEventListener('load', onLoad);\n script.removeEventListener('error', onError);\n };\n\n const onLoad = () => {\n cleanup();\n resolve();\n };\n\n const onError = () => {\n cleanup();\n reject(new Error(`Failed to load script \"${src}\"`));\n };\n\n const script = document.createElement('script');\n script.setAttribute('name', `roomstay-script-${name}`);\n script.setAttribute('src', src);\n\n script.addEventListener('load', onLoad);\n script.addEventListener('error', onError);\n\n // Guarantee that we won't get stuck here forever\n const timer = setTimeout(onError, timeout);\n\n // Append the script twice for some reason\n container.appendChild(script);\n this.ScriptContainer?.appendChild(script);\n });\n\n public createElementOrReuseExisting = <K extends keyof HTMLElementTagNameMap>(type: K, name: string) => {\n const container = this.EngineContainer;\n const findingElement = container.querySelector(`${type}[name=\"roomstay-${name}\"]`);\n\n if (findingElement) {\n return findingElement;\n } else {\n const target = document.createElement(type);\n target.setAttribute('name', `roomstay-${name}`);\n container.appendChild(target);\n return target;\n }\n };\n\n public init = async () => {\n dayjs.extend(isSameOrBefore);\n dayjs.extend(isSameOrAfter);\n\n if (i18n) {\n i18n.use(initReactI18next).init({\n interpolation: { escapeValue: false },\n lng: Language.en_us,\n resources: LanguageProvider.getI18nMappedLanguages(),\n });\n }\n\n if (!this.isLocalhost) {\n Sentry.init({\n dsn: 'https://3bfba949561e48f1862c843ce8254a2d@o398412.ingest.sentry.io/5254086',\n beforeSend: (event, hint) => {\n event.tags = event.tags ?? { logger: '_default_' };\n\n try {\n if (hint?.originalException instanceof Error) {\n if ((hint.originalException.stack?.indexOf('www.googletagmanager.com/gtm.js?id=') as number) > -1) {\n event.tags.logger = 'gtm';\n event.level = Sentry.Severity.Warning;\n }\n }\n } catch (ex) {\n console.log(ex);\n }\n\n return event;\n },\n });\n }\n\n this.reloadScriptAndStyleContainers();\n };\n\n private reloadScriptAndStyleContainers = () => {\n this.StyleContainer = this.createElementOrReuseExisting('div', 'style-container');\n this.ScriptContainer = this.createElementOrReuseExisting('div', 'script-container');\n\n this.ScriptContainer.innerHTML = '';\n this.StyleContainer.innerHTML = '';\n\n this.registerStyles();\n };\n}\n\nexport default new RoomstayThemeEngine();\n"]}
1
+ {"version":3,"file":"RoomstayThemeEngine.js","sourceRoot":"/","sources":["src/providers/RoomstayThemeEngine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+C;AAE/C,wDAA0C;AAC1C,kDAA0B;AAC1B,+EAAuD;AACvD,iFAAyD;AACzD,sDAA0C;AAC1C,iDAAiD;AAGjD,mEAA0E;AAC1E,wCAA6D;AAY7D,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;IACxC,MAAM,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;AAC/C,CAAC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,kCAAiB,CAAA;IACjB,gCAAe,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,MAAM,mBAAmB;IAqBrB;QApBO,mBAAc,GAAmB,IAAI,CAAC;QAItC,oBAAe,GAAmB,IAAI,CAAC;QACvC,mBAAc,GAAmB,IAAI,CAAC;QAEtC,iBAAY,GAAa,2BAAQ,CAAC,KAAK,CAAC;QAE/C,uEAAuE;QAChE,gBA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AAG,KAAK,CAAC;oCAC1B,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;gCAC1C,CAAC;4BACL,CAAC;wBACL,CAAC;wBAAC,OAAO,EAAE,EAAE,CAAC;4BACV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;wBACpB,CAAC;wBAED,OAAO,KAAK,CAAC;oBACjB,CAAC;iBACJ,CAAC,CAAC;YACP,CAAC;YAED,IAAI,CAAC,8BAA8B,EAAE,CAAC;QAC1C,CAAC,CAAA,CAAC;QAEM,mCAA8B,GAAG,GAAG,EAAE;YAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;YAClF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YAEpF,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,EAAE,CAAC;YACpC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,EAAE,CAAC;YAEnC,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1B,CAAC,CAAC;QAlKE,OAAO,CAAC,GAAG,CAAC,yCAAyC,kBAAU,EAAE,CAAC,CAAC;IACvE,CAAC;CAkKJ;AAED,kBAAe,IAAI,mBAAmB,EAAE,CAAC","sourcesContent":["import * as ROP from '@juggle/resize-observer';\nimport { IHotelColorScheme } from '@roomstay/core';\nimport * as Sentry from '@sentry/browser';\nimport dayjs from 'dayjs';\nimport isSameOrAfter from 'dayjs/plugin/isSameOrAfter';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore';\nimport i18n, { TFunction } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport type { Company } from '@/models/Client/Hotel/Company';\nimport { Language, LanguageProvider } from '@/providers/LanguageProvider';\nimport { getAccentOverrideStyleContent } from '@/util/Color';\n\ndeclare global {\n interface Window {\n ResizeObserver: any;\n }\n}\n\ndeclare const ASSET_URL: string;\n\nexport declare const RS_VERSION: string;\n\nif (typeof ResizeObserver === 'undefined') {\n window.ResizeObserver = ROP.ResizeObserver;\n}\n\nexport enum RoomstayTheme {\n Medium = 'medium',\n Light = 'light',\n}\n\nclass RoomstayThemeEngine {\n public currentCompany: Company | null = null;\n\n public EngineContainer!: HTMLElement;\n\n public ScriptContainer: Element | null = null;\n public StyleContainer: Element | null = null;\n\n public selectedLang: Language = Language.en_us;\n\n // TODO This needs to be changed, not ideal to just check for localhost\n public isLocalhost: boolean = location.hostname === 'localhost';\n\n // TODO: This needs to be refactored to not be a fixed string.\n public ThemeType = RoomstayTheme.Light;\n\n public ExternalStyles: string[] = [];\n public ExternalScripts: string[] = ['https://js.verygoodvault.com/vgs-collect/1/AC7dReJwJ6EWF1L9FHdcCw7n.js'];\n\n public translation: TFunction | null = null;\n\n public constructor() {\n console.log(`Initializing Roomstay Booking Engine v${RS_VERSION}`);\n }\n\n public changeCompany = (newCompany: Company) => {\n this.currentCompany = newCompany;\n this.registerStyles(newCompany.colors);\n };\n\n public changeTheme = async (profile: IHotelColorScheme) => {\n const styleOverrides = this.createElementOrReuseExisting('style', 'engine-styles');\n\n styleOverrides.setAttribute('rel', 'preload');\n\n styleOverrides.innerHTML = `\n :root {\n ${getAccentOverrideStyleContent(profile)}\n }`;\n };\n\n public registerStyles = async (profile?: IHotelColorScheme) => {\n console.log('Loading custom Theme Styles');\n if (profile) {\n this.changeTheme(profile);\n }\n\n this.ExternalStyles.forEach((url, index) => {\n const style = this.createElementOrReuseExisting('link', `engine-external-style-${index}`);\n style.setAttribute('rel', 'stylesheet');\n style.setAttribute('href', this.getAssetUrl() + url);\n });\n };\n\n public getAssetUrl = () => {\n return ASSET_URL;\n };\n\n public getImageAssetUrl = (url = '') => {\n return this.getAssetUrl() + 'assets/img/' + url;\n };\n\n /**\n * Detects if URL is absolute, and needs to be\n * @param url string\n */\n public wrapAssetUrl = (url: string) => {\n if (url.match(/^(?:[a-z]+:)?\\/\\//)) {\n return url;\n }\n\n return this.getAssetUrl() + url;\n };\n\n public registerScripts = async () => {\n this.ExternalScripts.forEach((url: string, index) => {\n this.loadScript(url, `legacy-${index}`);\n });\n };\n\n public loadScript = (src: string, name: string, alwaysExecute = false, timeout = 5_000): Promise<void> =>\n new Promise((resolve, reject) => {\n const container = this.EngineContainer;\n const existingScript = container.querySelector(`script[name=\"roomstay-script-${name}\"]`);\n\n if (existingScript) {\n if (alwaysExecute) {\n existingScript.remove();\n } else {\n resolve();\n return;\n }\n }\n\n const cleanup = () => {\n clearTimeout(timer);\n script.removeEventListener('load', onLoad);\n script.removeEventListener('error', onError);\n };\n\n const onLoad = () => {\n cleanup();\n resolve();\n };\n\n const onError = () => {\n cleanup();\n reject(new Error(`Failed to load script \"${src}\"`));\n };\n\n const script = document.createElement('script');\n script.setAttribute('name', `roomstay-script-${name}`);\n script.setAttribute('src', src);\n\n script.addEventListener('load', onLoad);\n script.addEventListener('error', onError);\n\n // Guarantee that we won't get stuck here forever\n const timer = setTimeout(onError, timeout);\n\n // Append the script twice for some reason\n container.appendChild(script);\n this.ScriptContainer?.appendChild(script);\n });\n\n public createElementOrReuseExisting = <K extends keyof HTMLElementTagNameMap>(type: K, name: string) => {\n const container = this.EngineContainer;\n const findingElement = container.querySelector(`${type}[name=\"roomstay-${name}\"]`);\n\n if (findingElement) {\n return findingElement;\n } else {\n const target = document.createElement(type);\n target.setAttribute('name', `roomstay-${name}`);\n container.appendChild(target);\n return target;\n }\n };\n\n public init = async () => {\n dayjs.extend(isSameOrBefore);\n dayjs.extend(isSameOrAfter);\n\n if (i18n) {\n this.translation = await i18n.use(initReactI18next).init({\n interpolation: { escapeValue: false },\n lng: Language.en_us,\n resources: LanguageProvider.getI18nMappedLanguages(),\n });\n }\n\n if (!this.isLocalhost) {\n Sentry.init({\n dsn: 'https://3bfba949561e48f1862c843ce8254a2d@o398412.ingest.sentry.io/5254086',\n beforeSend: (event, hint) => {\n event.tags = event.tags ?? { logger: '_default_' };\n\n try {\n if (hint?.originalException instanceof Error) {\n if ((hint.originalException.stack?.indexOf('www.googletagmanager.com/gtm.js?id=') as number) > -1) {\n event.tags.logger = 'gtm';\n event.level = Sentry.Severity.Warning;\n }\n }\n } catch (ex) {\n console.log(ex);\n }\n\n return event;\n },\n });\n }\n\n this.reloadScriptAndStyleContainers();\n };\n\n private reloadScriptAndStyleContainers = () => {\n this.StyleContainer = this.createElementOrReuseExisting('div', 'style-container');\n this.ScriptContainer = this.createElementOrReuseExisting('div', 'script-container');\n\n this.ScriptContainer.innerHTML = '';\n this.StyleContainer.innerHTML = '';\n\n this.registerStyles();\n };\n}\n\nexport default new RoomstayThemeEngine();\n"]}
@@ -589,6 +589,7 @@ export declare const Translation: {
589
589
  PerksDisclaimer: string;
590
590
  LoadMoreDates: string;
591
591
  MoreInfo: string;
592
+ APIErrorTitle: string;
592
593
  };
593
594
  FindReservation: {
594
595
  FindYourReservation: string;
@@ -592,6 +592,7 @@ exports.Translation = {
592
592
  PerksDisclaimer: 'Misc.PerksDisclaimer',
593
593
  LoadMoreDates: 'Misc.LoadMoreDates',
594
594
  MoreInfo: 'Misc.MoreInfo',
595
+ APIErrorTitle: 'Misc.APIErrorTitle',
595
596
  },
596
597
  FindReservation: {
597
598
  FindYourReservation: 'FindReservation.FindYourReservation',