@qite/tide-booking-component 1.4.86 → 1.4.87

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.
@@ -45956,11 +45956,15 @@ var GroupTourCard = function (_a) {
45956
45956
  var result = _a.result,
45957
45957
  languageCode = _a.languageCode,
45958
45958
  cmsItem = _a.cmsItem;
45959
- var dispatch = reactRedux.useDispatch();
45960
- var translations = getTranslations(languageCode !== null && languageCode !== void 0 ? languageCode : 'en-GB');
45959
+ var context = React.useContext(SearchResultsConfigurationContext);
45961
45960
  var selectedSearchResultId = reactRedux.useSelector(function (state) {
45962
45961
  return state.searchResults;
45963
45962
  }).selectedSearchResultId;
45963
+ if (!context) {
45964
+ return;
45965
+ }
45966
+ var dispatch = reactRedux.useDispatch();
45967
+ var translations = getTranslations(languageCode !== null && languageCode !== void 0 ? languageCode : 'en-GB');
45964
45968
  var genders = ((_b = result.allotment) === null || _b === void 0 ? void 0 : _b.travellerGenders) || [];
45965
45969
  var maleCount = genders.filter(function (g) {
45966
45970
  return g === 0;
@@ -45972,6 +45976,7 @@ var GroupTourCard = function (_a) {
45972
45976
  return g === 2;
45973
45977
  }).length;
45974
45978
  var handleChange = function (productId) {
45979
+ console.log('Selected product ID:', productId);
45975
45980
  dispatch(setSelectedSearchResult(productId));
45976
45981
  };
45977
45982
  return React__default['default'].createElement(
@@ -46092,6 +46097,17 @@ var GroupTourCard = function (_a) {
46092
46097
  translations.PRODUCT.PER_PERSON
46093
46098
  )
46094
46099
  ),
46100
+ React__default['default'].createElement(
46101
+ 'button',
46102
+ {
46103
+ type: 'button',
46104
+ className: 'cta cta--select',
46105
+ onClick: function () {
46106
+ return context.onBook && context.onBook(result);
46107
+ }
46108
+ },
46109
+ translations === null || translations === void 0 ? void 0 : translations.PRODUCT.BOOK_NOW
46110
+ ),
46095
46111
  React__default['default'].createElement(
46096
46112
  'button',
46097
46113
  {
@@ -47023,11 +47039,11 @@ var SearchResultsContainer = function () {
47023
47039
  function () {
47024
47040
  var fetchDetails = function () {
47025
47041
  return __awaiter(void 0, void 0, void 0, function () {
47026
- var config, selectedItem, params, entryId, requestRooms, rooms, detailsRequest, detailsResponse, detailsWLResponse, err_3;
47027
- var _a, _b;
47028
- return __generator(this, function (_c) {
47029
- switch (_c.label) {
47042
+ var config, selectedItem, params, entryId, requestRooms, rooms, detailsRequest, detailsResponse, detailsResponse, err_3;
47043
+ return __generator(this, function (_a) {
47044
+ switch (_a.label) {
47030
47045
  case 0:
47046
+ console.log('Fetching details for selected search result', selectedSearchResultId);
47031
47047
  if (!selectedSearchResultId || !context) return [2 /*return*/];
47032
47048
  if (
47033
47049
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.Accommodation ||
@@ -47035,9 +47051,9 @@ var SearchResultsContainer = function () {
47035
47051
  ) {
47036
47052
  handleFlyInToggle(true);
47037
47053
  }
47038
- _c.label = 1;
47054
+ _a.label = 1;
47039
47055
  case 1:
47040
- _c.trys.push([1, 6, , 7]);
47056
+ _a.trys.push([1, 6, , 7]);
47041
47057
  config = {
47042
47058
  host: context.tideConnection.host,
47043
47059
  apiKey: context.tideConnection.apiKey
@@ -47081,36 +47097,20 @@ var SearchResultsContainer = function () {
47081
47097
  requestRooms = getRequestRoomsFromEntry(entry.rooms);
47082
47098
  return [4 /*yield*/, build.details(config, detailsRequest)];
47083
47099
  case 2:
47084
- detailsResponse = _c.sent();
47100
+ detailsResponse = _a.sent();
47085
47101
  console.log('Details:', detailsResponse);
47086
47102
  dispatch(setBookingPackageDetails({ details: detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.payload }));
47087
47103
  return [3 /*break*/, 5];
47088
47104
  case 3:
47089
- return [4 /*yield*/, build.detailsWL(config, detailsRequest)];
47105
+ return [4 /*yield*/, build.details(config, detailsRequest)];
47090
47106
  case 4:
47091
- detailsWLResponse = _c.sent();
47092
- console.log('Details with entryLight:', detailsWLResponse);
47093
- dispatch(
47094
- setBookingPackageDetails({
47095
- details:
47096
- (_a = detailsWLResponse === null || detailsWLResponse === void 0 ? void 0 : detailsWLResponse.payload) === null || _a === void 0
47097
- ? void 0
47098
- : _a.bookingPackage
47099
- })
47100
- );
47101
- dispatch(
47102
- setEntry({
47103
- entry:
47104
- (_b = detailsWLResponse === null || detailsWLResponse === void 0 ? void 0 : detailsWLResponse.payload) === null || _b === void 0
47105
- ? void 0
47106
- : _b.entry
47107
- })
47108
- );
47109
- _c.label = 5;
47107
+ detailsResponse = _a.sent();
47108
+ dispatch(setBookingPackageDetails({ details: detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.payload }));
47109
+ _a.label = 5;
47110
47110
  case 5:
47111
47111
  return [3 /*break*/, 7];
47112
47112
  case 6:
47113
- err_3 = _c.sent();
47113
+ err_3 = _a.sent();
47114
47114
  console.error('Failed to fetch package details', err_3);
47115
47115
  return [3 /*break*/, 7];
47116
47116
  case 7:
@@ -1,4 +1,4 @@
1
- import { FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
1
+ import { BookingPackageItem, FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
2
2
  import { ReactNode } from 'react';
3
3
  export type FlightSelectionMode = 'paired' | 'independent';
4
4
  export interface SearchResultsConfiguration {
@@ -34,6 +34,7 @@ export interface SearchResultsConfiguration {
34
34
  url: string;
35
35
  alt: string;
36
36
  };
37
+ onBook?: (result: BookingPackageItem) => void;
37
38
  }
38
39
  export type FilterType = 'checkbox' | 'toggle' | 'slider' | 'star-rating';
39
40
  export type FilterProperty = 'regime' | 'accommodation' | 'max-duration' | 'price' | 'rating' | 'theme';
@@ -45708,11 +45708,15 @@ var GroupTourCard = function (_a) {
45708
45708
  var result = _a.result,
45709
45709
  languageCode = _a.languageCode,
45710
45710
  cmsItem = _a.cmsItem;
45711
- var dispatch = useDispatch();
45712
- var translations = getTranslations(languageCode !== null && languageCode !== void 0 ? languageCode : 'en-GB');
45711
+ var context = useContext(SearchResultsConfigurationContext);
45713
45712
  var selectedSearchResultId = useSelector(function (state) {
45714
45713
  return state.searchResults;
45715
45714
  }).selectedSearchResultId;
45715
+ if (!context) {
45716
+ return;
45717
+ }
45718
+ var dispatch = useDispatch();
45719
+ var translations = getTranslations(languageCode !== null && languageCode !== void 0 ? languageCode : 'en-GB');
45716
45720
  var genders = ((_b = result.allotment) === null || _b === void 0 ? void 0 : _b.travellerGenders) || [];
45717
45721
  var maleCount = genders.filter(function (g) {
45718
45722
  return g === 0;
@@ -45724,6 +45728,7 @@ var GroupTourCard = function (_a) {
45724
45728
  return g === 2;
45725
45729
  }).length;
45726
45730
  var handleChange = function (productId) {
45731
+ console.log('Selected product ID:', productId);
45727
45732
  dispatch(setSelectedSearchResult(productId));
45728
45733
  };
45729
45734
  return React__default.createElement(
@@ -45844,6 +45849,17 @@ var GroupTourCard = function (_a) {
45844
45849
  translations.PRODUCT.PER_PERSON
45845
45850
  )
45846
45851
  ),
45852
+ React__default.createElement(
45853
+ 'button',
45854
+ {
45855
+ type: 'button',
45856
+ className: 'cta cta--select',
45857
+ onClick: function () {
45858
+ return context.onBook && context.onBook(result);
45859
+ }
45860
+ },
45861
+ translations === null || translations === void 0 ? void 0 : translations.PRODUCT.BOOK_NOW
45862
+ ),
45847
45863
  React__default.createElement(
45848
45864
  'button',
45849
45865
  {
@@ -46775,11 +46791,11 @@ var SearchResultsContainer = function () {
46775
46791
  function () {
46776
46792
  var fetchDetails = function () {
46777
46793
  return __awaiter(void 0, void 0, void 0, function () {
46778
- var config, selectedItem, params, entryId, requestRooms, rooms, detailsRequest, detailsResponse, detailsWLResponse, err_3;
46779
- var _a, _b;
46780
- return __generator(this, function (_c) {
46781
- switch (_c.label) {
46794
+ var config, selectedItem, params, entryId, requestRooms, rooms, detailsRequest, detailsResponse, detailsResponse, err_3;
46795
+ return __generator(this, function (_a) {
46796
+ switch (_a.label) {
46782
46797
  case 0:
46798
+ console.log('Fetching details for selected search result', selectedSearchResultId);
46783
46799
  if (!selectedSearchResultId || !context) return [2 /*return*/];
46784
46800
  if (
46785
46801
  (context === null || context === void 0 ? void 0 : context.searchConfiguration.qsmType) === build.PortalQsmType.Accommodation ||
@@ -46787,9 +46803,9 @@ var SearchResultsContainer = function () {
46787
46803
  ) {
46788
46804
  handleFlyInToggle(true);
46789
46805
  }
46790
- _c.label = 1;
46806
+ _a.label = 1;
46791
46807
  case 1:
46792
- _c.trys.push([1, 6, , 7]);
46808
+ _a.trys.push([1, 6, , 7]);
46793
46809
  config = {
46794
46810
  host: context.tideConnection.host,
46795
46811
  apiKey: context.tideConnection.apiKey
@@ -46833,36 +46849,20 @@ var SearchResultsContainer = function () {
46833
46849
  requestRooms = getRequestRoomsFromEntry(entry.rooms);
46834
46850
  return [4 /*yield*/, build.details(config, detailsRequest)];
46835
46851
  case 2:
46836
- detailsResponse = _c.sent();
46852
+ detailsResponse = _a.sent();
46837
46853
  console.log('Details:', detailsResponse);
46838
46854
  dispatch(setBookingPackageDetails({ details: detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.payload }));
46839
46855
  return [3 /*break*/, 5];
46840
46856
  case 3:
46841
- return [4 /*yield*/, build.detailsWL(config, detailsRequest)];
46857
+ return [4 /*yield*/, build.details(config, detailsRequest)];
46842
46858
  case 4:
46843
- detailsWLResponse = _c.sent();
46844
- console.log('Details with entryLight:', detailsWLResponse);
46845
- dispatch(
46846
- setBookingPackageDetails({
46847
- details:
46848
- (_a = detailsWLResponse === null || detailsWLResponse === void 0 ? void 0 : detailsWLResponse.payload) === null || _a === void 0
46849
- ? void 0
46850
- : _a.bookingPackage
46851
- })
46852
- );
46853
- dispatch(
46854
- setEntry({
46855
- entry:
46856
- (_b = detailsWLResponse === null || detailsWLResponse === void 0 ? void 0 : detailsWLResponse.payload) === null || _b === void 0
46857
- ? void 0
46858
- : _b.entry
46859
- })
46860
- );
46861
- _c.label = 5;
46859
+ detailsResponse = _a.sent();
46860
+ dispatch(setBookingPackageDetails({ details: detailsResponse === null || detailsResponse === void 0 ? void 0 : detailsResponse.payload }));
46861
+ _a.label = 5;
46862
46862
  case 5:
46863
46863
  return [3 /*break*/, 7];
46864
46864
  case 6:
46865
- err_3 = _c.sent();
46865
+ err_3 = _a.sent();
46866
46866
  console.error('Failed to fetch package details', err_3);
46867
46867
  return [3 /*break*/, 7];
46868
46868
  case 7:
@@ -1,4 +1,4 @@
1
- import { FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
1
+ import { BookingPackageItem, FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
2
2
  import { ReactNode } from 'react';
3
3
  export type FlightSelectionMode = 'paired' | 'independent';
4
4
  export interface SearchResultsConfiguration {
@@ -34,6 +34,7 @@ export interface SearchResultsConfiguration {
34
34
  url: string;
35
35
  alt: string;
36
36
  };
37
+ onBook?: (result: BookingPackageItem) => void;
37
38
  }
38
39
  export type FilterType = 'checkbox' | 'toggle' | 'slider' | 'star-rating';
39
40
  export type FilterProperty = 'regime' | 'accommodation' | 'max-duration' | 'price' | 'rating' | 'theme';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.86",
3
+ "version": "1.4.87",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "types": "build/build-cjs/src/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
2
  import Icon from '../icon';
3
3
  import { BookingPackageItem } from '@qite/tide-client';
4
4
  import { format } from 'date-fns';
@@ -7,6 +7,7 @@ import { SearchResultsRootState } from '../../store/search-results-store';
7
7
  import { useDispatch, useSelector } from 'react-redux';
8
8
  import { setSelectedSearchResult } from '../../store/search-results-slice';
9
9
  import he from 'he';
10
+ import SearchResultsConfigurationContext from '../../search-results-configuration-context';
10
11
 
11
12
  interface GroupTourCardProps {
12
13
  result: BookingPackageItem;
@@ -15,9 +16,13 @@ interface GroupTourCardProps {
15
16
  }
16
17
 
17
18
  const GroupTourCard: React.FC<GroupTourCardProps> = ({ result, languageCode, cmsItem }) => {
19
+ const context = useContext(SearchResultsConfigurationContext);
20
+ const { selectedSearchResultId } = useSelector((state: SearchResultsRootState) => state.searchResults);
21
+ if (!context) {
22
+ return;
23
+ }
18
24
  const dispatch = useDispatch();
19
25
  const translations = getTranslations(languageCode ?? 'en-GB');
20
- const { selectedSearchResultId } = useSelector((state: SearchResultsRootState) => state.searchResults);
21
26
 
22
27
  const genders = result.allotment?.travellerGenders || [];
23
28
  const maleCount = genders.filter((g) => g === 0).length;
@@ -88,6 +93,9 @@ const GroupTourCard: React.FC<GroupTourCardProps> = ({ result, languageCode, cms
88
93
  </div>
89
94
  {/* <div className="search__result-card__allotment__price__info">Gelieve € 450,00 zakgeld mee te nemen</div> */}
90
95
  </div>
96
+ <button type="button" className="cta cta--select" onClick={() => context.onBook && context.onBook(result)}>
97
+ {translations?.PRODUCT.BOOK_NOW}
98
+ </button>
91
99
  <button
92
100
  type="button"
93
101
  className={`cta ${selectedSearchResultId === result.productId ? 'cta--selected' : 'cta--select'}`}
@@ -577,8 +577,8 @@ const SearchResultsContainer: React.FC = () => {
577
577
  // Seperate detailsCall
578
578
  useEffect(() => {
579
579
  const fetchDetails = async () => {
580
+ console.log('Fetching details for selected search result', selectedSearchResultId);
580
581
  if (!selectedSearchResultId || !context) return;
581
-
582
582
  if (context?.searchConfiguration.qsmType === PortalQsmType.Accommodation || context?.searchConfiguration.qsmType === PortalQsmType.GroupTour) {
583
583
  handleFlyInToggle(true);
584
584
  }
@@ -632,10 +632,13 @@ const SearchResultsContainer: React.FC = () => {
632
632
  console.log('Details:', detailsResponse);
633
633
  dispatch(setBookingPackageDetails({ details: detailsResponse?.payload }));
634
634
  } else {
635
- const detailsWLResponse = await detailsWL(config, detailsRequest);
636
- console.log('Details with entryLight:', detailsWLResponse);
637
- dispatch(setBookingPackageDetails({ details: detailsWLResponse?.payload?.bookingPackage }));
638
- dispatch(setEntry({ entry: detailsWLResponse?.payload?.entry }));
635
+ // const detailsWLResponse = await detailsWL(config, detailsRequest);
636
+ // console.log('Details with entryLight:', detailsWLResponse);
637
+ // dispatch(setBookingPackageDetails({ details: detailsWLResponse?.payload?.bookingPackage }));
638
+ // dispatch(setEntry({ entry: detailsWLResponse?.payload?.entry }));
639
+
640
+ const detailsResponse = await details(config, detailsRequest);
641
+ dispatch(setBookingPackageDetails({ details: detailsResponse?.payload }));
639
642
  }
640
643
  } catch (err) {
641
644
  console.error('Failed to fetch package details', err);
@@ -1,4 +1,4 @@
1
- import { FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
1
+ import { BookingPackageItem, FlightSearchResponseItem, WebsiteConfigurationSearchConfiguration } from '@qite/tide-client';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  export type FlightSelectionMode = 'paired' | 'independent';
@@ -51,6 +51,7 @@ export interface SearchResultsConfiguration {
51
51
  languageCode?: string;
52
52
 
53
53
  destinationImage?: { url: string; alt: string };
54
+ onBook?: (result: BookingPackageItem) => void;
54
55
  }
55
56
 
56
57
  export type FilterType = 'checkbox' | 'toggle' | 'slider' | 'star-rating';