bookito-widget 1.3.0 → 1.4.0-beta.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.
@@ -8,5 +8,5 @@ export type InitializeBookitoWidgetOptionsType = BookitoWidgetPropsType & {
8
8
  container: HTMLElement | string;
9
9
  customCss?: string;
10
10
  };
11
- export declare function mountBookitoWidget(options: InitializeBookitoWidgetOptionsType): MountedWidgetType;
11
+ export declare function mountBookitoWidget(rawOptions: InitializeBookitoWidgetOptionsType): MountedWidgetType;
12
12
  export declare function unmountBookitoWidget(container: HTMLElement | string): void;
@@ -0,0 +1,10 @@
1
+ import { BookitoWidgetViewModeType } from '../../features/event-feed/model/widget.types';
2
+ import { SupportedLanguageType } from '../../shared/config/languages';
3
+ import { InitializeBookitoWidgetOptionsType } from './mount';
4
+ import { OpenBookitoModalOptionsType } from './open-modal';
5
+ export declare function normalizeInitializeOptions(options: InitializeBookitoWidgetOptionsType): InitializeBookitoWidgetOptionsType;
6
+ export declare function normalizeOpenModalOptions(options: OpenBookitoModalOptionsType): OpenBookitoModalOptionsType;
7
+ export declare function resolveLanguage(value: unknown): SupportedLanguageType;
8
+ export declare function resolveViewMode(value: unknown): BookitoWidgetViewModeType;
9
+ export declare function isTruthy(value: unknown): boolean;
10
+ export declare function optionalString(value: unknown): string | undefined;
@@ -2,10 +2,11 @@ import { SupportedLanguageType } from '../../shared/config/languages';
2
2
  import { MountedWidgetType } from './mount-registry';
3
3
  export type OpenBookitoModalOptionsType = {
4
4
  authId: string;
5
+ bookingSource?: string;
5
6
  eventId: string;
6
7
  container?: HTMLElement | string;
7
8
  customCss?: string;
8
9
  language?: SupportedLanguageType;
9
10
  onCloseModal?: () => void;
10
11
  };
11
- export declare function openBookitoModal(options: OpenBookitoModalOptionsType): MountedWidgetType;
12
+ export declare function openBookitoModal(rawOptions: OpenBookitoModalOptionsType): MountedWidgetType;
@@ -12,7 +12,7 @@ export type BookitoBookingParticipantDtoType = {
12
12
  export type CreateBookitoBookingRequestType = {
13
13
  bookedForDate: string;
14
14
  booker?: BookitoBookingParticipantDtoType;
15
- bookingSource: 'app' | 'kiosk' | 'web_widget';
15
+ bookingSource: string;
16
16
  chosenEmployeeId?: string;
17
17
  comment?: string;
18
18
  eventId: string;
@@ -4,6 +4,7 @@ import { BookingGuestOptionType } from '../../../../features/guest-auth/api/gues
4
4
  export type BookingFlowPanelPropsType = {
5
5
  authId: string;
6
6
  availableDates?: string[];
7
+ bookingSource?: string;
7
8
  currency?: string;
8
9
  event: BookitoEventType;
9
10
  initialDate: string;
@@ -3,6 +3,7 @@ import { BookitoEventType } from '../../../../features/event-feed/model/widget.t
3
3
  type OptionsType = {
4
4
  authId: string;
5
5
  availableDates?: string[];
6
+ bookingSource?: string;
6
7
  currency?: string;
7
8
  event: BookitoEventType;
8
9
  initialDate: string;
@@ -12,6 +12,7 @@ export type GuestLoginMutationType = {
12
12
  };
13
13
  export type BookingFlowActionsOptionsType = {
14
14
  authId: string;
15
+ bookingSource?: string;
15
16
  event: BookitoEventType;
16
17
  form: BookingFormStateType;
17
18
  hasCompletedConfirmStep: Ref<boolean>;
@@ -1,4 +1,4 @@
1
1
  import { CreateBookitoBookingRequestType } from '../../../../features/booking-flow/api/bookito-booking.dto';
2
2
  import { BookingFormStateType } from '../../../../features/booking-flow/model/booking-form.types';
3
3
  import { BookingGuestOptionType } from '../../../../features/guest-auth/api/guest-auth.dto';
4
- export declare function resolveBookingParticipants(form: BookingFormStateType, selectedGuests: BookingGuestOptionType[]): CreateBookitoBookingRequestType['participants'];
4
+ export declare function resolveBookingParticipants(form: BookingFormStateType, selectedGuests: BookingGuestOptionType[], language?: string): CreateBookitoBookingRequestType['participants'];
@@ -3,7 +3,7 @@ import { CreateBookitoBookingRequestType } from '../../../../features/booking-fl
3
3
  import { BookingFormStateType } from '../../../../features/booking-flow/model/booking-form.types';
4
4
  export declare function formatMoneyAmount(price: number | null, language: string, freeLabel: string, currency?: string): string;
5
5
  export declare function formatExtraPrice(price: number | null, language: string, freeLabel: string, currency?: string): string;
6
- export declare function buildCreateBookingPayload(eventId: string, form: BookingFormStateType, timeSlots?: BookitoTimeSlotType[]): CreateBookitoBookingRequestType;
6
+ export declare function buildCreateBookingPayload(eventId: string, form: BookingFormStateType, timeSlots?: BookitoTimeSlotType[], bookingSource?: string, language?: string): CreateBookitoBookingRequestType;
7
7
  export declare function resolveBookingSuccessMessageKey(options: {
8
8
  bookability: BookitoEventType['bookability'];
9
9
  canBePutOnWaitingList: boolean;
@@ -1,6 +1,7 @@
1
1
  import { SupportedLanguageType } from '../../../../shared/config/languages';
2
2
  type __VLS_Props = {
3
3
  authId: string;
4
+ bookingSource?: string;
4
5
  eventId: string;
5
6
  language?: SupportedLanguageType;
6
7
  };
@@ -1,6 +1,7 @@
1
1
  import { BookitoEventFeedItemType } from '../../../../features/event-feed/model/widget.types';
2
2
  type __VLS_Props = {
3
3
  authId: string;
4
+ bookingSource?: string;
4
5
  currency?: string;
5
6
  forceBookable?: boolean;
6
7
  item: BookitoEventFeedItemType | null;
@@ -2,6 +2,7 @@ import { BookitoEventFeedItemType } from '../../../../features/event-feed/model/
2
2
  type __VLS_Props = {
3
3
  authId: string;
4
4
  backLabel: string;
5
+ bookingSource?: string;
5
6
  bookingInitialDate: string;
6
7
  closeLabel: string;
7
8
  currency: string;
@@ -0,0 +1,12 @@
1
+ export type FallbackReasonType = 'invalid_hotel_id' | 'request_failed' | 'timeout' | `http_${number}`;
2
+ export type LoaderHotelType = {
3
+ useNewGuestApp: boolean;
4
+ };
5
+ export type HotelResultType = {
6
+ ok: true;
7
+ hotel: LoaderHotelType;
8
+ } | {
9
+ ok: false;
10
+ reason: FallbackReasonType;
11
+ };
12
+ export declare function getHotel(strapiUrl: string, hotelId: string, timeoutMs: number): Promise<HotelResultType>;
@@ -0,0 +1,4 @@
1
+ export declare function createHotelIdSource(): {
2
+ firstId: Promise<string>;
3
+ offer: (hotelId: unknown) => void;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { LoaderConfigType } from './run-loader';
2
+ export declare function createLoaderConfig(): LoaderConfigType;
@@ -0,0 +1,7 @@
1
+ export type LoaderConfigType = {
2
+ legacyUrl: string;
3
+ strapiUrl: string;
4
+ timeoutMs: number;
5
+ vueUrl: string;
6
+ };
7
+ export declare function runLoader(config: LoaderConfigType): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bookito-widget",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-beta.2",
4
4
  "description": "Embeddable Bookito booking widget for hotel websites",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,8 +11,8 @@
11
11
  "main": "./dist/bookito-widget.umd.js",
12
12
  "module": "./dist/bookito-widget.js",
13
13
  "types": "./dist/src/index.d.ts",
14
- "unpkg": "./dist/bookito-widget.iife.js",
15
- "jsdelivr": "./dist/bookito-widget.iife.js",
14
+ "unpkg": "./dist/bookito-widget.loader.js",
15
+ "jsdelivr": "./dist/bookito-widget.loader.js",
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/src/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  "scripts": {
28
28
  "dev": "vite",
29
29
  "build": "run-p type-check \"build-only {@}\" --",
30
- "build:lib": "vite build --config vite.library.config.ts && vite build --config vite.embed.config.ts",
31
- "preview:embed": "VITE_STAGE=prerelease npm run build:lib && vite preview --config vite.embed.config.ts --outDir . --port 5175 --strictPort --open /embed-test/",
30
+ "build:lib": "vite build --config vite.library.config.ts && vite build --config vite.embed.config.ts && vite build --config vite.loader.config.ts",
31
+ "preview:embed": "VITE_STAGE=prerelease npm run build:lib && vite preview --config vite.embed.config.ts --outDir . --port 5175 --strictPort --open /embed-test/hotel-site.html",
32
32
  "build-only": "vite build",
33
33
  "preview": "vite preview",
34
34
  "test:unit": "vitest --project unit",