swoop-common 2.2.176 → 2.2.177

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.
@@ -21,6 +21,7 @@ export declare const TEMPLATE_NAMES: {
21
21
  readonly FEE: "Fee";
22
22
  readonly PACKAGE: "Package";
23
23
  readonly ROOM: "Room";
24
+ readonly GROUP_TOUR: "Group Tour";
24
25
  };
25
26
  /**
26
27
  * Template Name to Template ID mapping
@@ -45,6 +46,7 @@ export declare const templateStructure: {
45
46
  readonly Fee: "template_d15cc4ab72034fb8a098d9a9ec791a7d";
46
47
  readonly "Cruise Activity": "template_12345678123456781234567812345678";
47
48
  readonly Room: "template_bb0b09c544d242c9a9ef38147966979f";
49
+ readonly "Group Tour": "template_530f2f95c21147a08422bb714d771994";
48
50
  };
49
51
  export declare const packagesTemplateStructure: {
50
52
  readonly Cruise: "template_63a57a90570c47b89f830d2c7618324f";
@@ -52,6 +54,7 @@ export declare const packagesTemplateStructure: {
52
54
  readonly GuidedMultidayActivity: "template_a64e161de5824fcb9515274b0f67d698";
53
55
  readonly AllInclusiveHotel: "template_ba7999ff957c4ca3a5e61496df6178ac";
54
56
  readonly "Private Tour": "template_d9081bfcc3b7461987a3728e57ca7363";
57
+ readonly "Group Tour": "template_530f2f95c21147a08422bb714d771994";
55
58
  };
56
59
  export declare const topLevelTemplates: {
57
60
  readonly Activity: "template_e2f0e9e5343349358037a0564a3366a0";
@@ -65,6 +68,7 @@ export declare const topLevelTemplates: {
65
68
  readonly GuidedMultidayActivity: "template_a64e161de5824fcb9515274b0f67d698";
66
69
  readonly AllInclusiveHotel: "template_ba7999ff957c4ca3a5e61496df6178ac";
67
70
  readonly "Private Tour": "template_d9081bfcc3b7461987a3728e57ca7363";
71
+ readonly "Group Tour": "template_530f2f95c21147a08422bb714d771994";
68
72
  };
69
73
  export type TemplateName = keyof typeof templateStructure;
70
74
  export type TemplateId = typeof templateStructure[TemplateName];
@@ -20,7 +20,8 @@ export const TEMPLATE_NAMES = {
20
20
  ACTIVITY: "Activity",
21
21
  FEE: "Fee",
22
22
  PACKAGE: "Package",
23
- ROOM: "Room"
23
+ ROOM: "Room",
24
+ GROUP_TOUR: "Group Tour",
24
25
  };
25
26
  /**
26
27
  * Template Name to Template ID mapping
@@ -44,7 +45,8 @@ export const templateStructure = {
44
45
  [TEMPLATE_NAMES.ACTIVITY]: "template_e2f0e9e5343349358037a0564a3366a0",
45
46
  [TEMPLATE_NAMES.FEE]: "template_d15cc4ab72034fb8a098d9a9ec791a7d",
46
47
  [TEMPLATE_NAMES.CRUISE_ACTIVITY]: "template_12345678123456781234567812345678",
47
- [TEMPLATE_NAMES.ROOM]: "template_bb0b09c544d242c9a9ef38147966979f"
48
+ [TEMPLATE_NAMES.ROOM]: "template_bb0b09c544d242c9a9ef38147966979f",
49
+ [TEMPLATE_NAMES.GROUP_TOUR]: "template_530f2f95c21147a08422bb714d771994"
48
50
  };
49
51
  export const packagesTemplateStructure = {
50
52
  [TEMPLATE_NAMES.CRUISE]: templateStructure[TEMPLATE_NAMES.CRUISE],
@@ -52,6 +54,7 @@ export const packagesTemplateStructure = {
52
54
  [TEMPLATE_NAMES.GUIDED_MULTIDAY_ACTIVITY]: templateStructure[TEMPLATE_NAMES.GUIDED_MULTIDAY_ACTIVITY],
53
55
  [TEMPLATE_NAMES.ALL_INCLUSIVE_HOTEL]: templateStructure[TEMPLATE_NAMES.ALL_INCLUSIVE_HOTEL],
54
56
  [TEMPLATE_NAMES.PRIVATE_TOUR]: templateStructure[TEMPLATE_NAMES.PRIVATE_TOUR],
57
+ [TEMPLATE_NAMES.GROUP_TOUR]: templateStructure[TEMPLATE_NAMES.GROUP_TOUR],
55
58
  };
56
59
  export const topLevelTemplates = Object.assign(Object.assign({}, packagesTemplateStructure), { [TEMPLATE_NAMES.ACTIVITY]: templateStructure[TEMPLATE_NAMES.ACTIVITY], [TEMPLATE_NAMES.FLIGHT]: templateStructure[TEMPLATE_NAMES.FLIGHT], [TEMPLATE_NAMES.GROUND_ACCOMMODATION]: templateStructure[TEMPLATE_NAMES.GROUND_ACCOMMODATION], [TEMPLATE_NAMES.SHIP_ACCOMMODATION]: templateStructure[TEMPLATE_NAMES.SHIP_ACCOMMODATION], [TEMPLATE_NAMES.TRANSFER]: templateStructure[TEMPLATE_NAMES.TRANSFER], [TEMPLATE_NAMES.INDEPENDENT_ARRANGEMENTS]: templateStructure[TEMPLATE_NAMES.INDEPENDENT_ARRANGEMENTS] });
57
60
  /**
@@ -8,12 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import React, { useState, useEffect, useMemo } from "react";
11
- import { Dialog, DialogTitle, DialogContent, DialogActions, Button, TextField, MenuItem, Box, List, Typography, InputAdornment, IconButton, CircularProgress, Pagination, Autocomplete, } from "@mui/material";
11
+ import { Dialog, DialogTitle, DialogContent, DialogActions, Button, TextField, MenuItem, Box, List, Typography, InputAdornment, IconButton, CircularProgress, Pagination, Autocomplete, Checkbox, FormControlLabel, } from "@mui/material";
12
12
  import { Search as SearchIcon, Clear as ClearIcon, FilterList as FilterIcon, } from "@mui/icons-material";
13
13
  import { fetchComponents, getAllPartners } from "../util/api";
14
14
  import { InternalServices } from "../../api/init";
15
15
  import ComponentListItem from "./ComponentListItem";
16
- import { TEMPLATE_NAMES, templateStructure } from "../../lib/config/templateStructure";
16
+ import { TEMPLATE_NAMES, templateStructure, } from "../../lib/config/templateStructure";
17
17
  export default function ComponentPickerModal({ open, onClose, onSelect, selectedComponent, parentIdsFilter, }) {
18
18
  const [searchTerm, setSearchTerm] = useState("");
19
19
  const [selectedRegion, setSelectedRegion] = useState("");
@@ -31,11 +31,12 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
31
31
  const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
32
32
  const [activityTypes, setActivityTypes] = useState([]);
33
33
  const [selectedActivityType, setSelectedActivityType] = useState("");
34
+ const [citiesOnly, setCitiesOnly] = useState(false);
34
35
  const activityTemplateId = useMemo(() => {
35
36
  var _a;
36
37
  const cruiseActivityId = templateStructure[TEMPLATE_NAMES.CRUISE_ACTIVITY];
37
38
  const activityId = templateStructure[TEMPLATE_NAMES.ACTIVITY];
38
- return (_a = parentIdsFilter === null || parentIdsFilter === void 0 ? void 0 : parentIdsFilter.find((id) => id === cruiseActivityId || id === activityId)) !== null && _a !== void 0 ? _a : null;
39
+ return ((_a = parentIdsFilter === null || parentIdsFilter === void 0 ? void 0 : parentIdsFilter.find((id) => id === cruiseActivityId || id === activityId)) !== null && _a !== void 0 ? _a : null);
39
40
  }, [parentIdsFilter]);
40
41
  useEffect(() => {
41
42
  const timer = setTimeout(() => {
@@ -69,13 +70,21 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
69
70
  selectedPartner,
70
71
  selectedTemplate,
71
72
  selectedActivityType,
73
+ citiesOnly,
72
74
  page,
73
75
  ]);
74
76
  useEffect(() => {
75
77
  if (open) {
76
78
  setPage(1);
77
79
  }
78
- }, [debouncedSearchTerm, selectedRegion, selectedPartner, selectedTemplate, selectedActivityType]);
80
+ }, [
81
+ debouncedSearchTerm,
82
+ selectedRegion,
83
+ selectedPartner,
84
+ selectedTemplate,
85
+ selectedActivityType,
86
+ citiesOnly,
87
+ ]);
79
88
  useEffect(() => {
80
89
  if (open) {
81
90
  setSearchTerm("");
@@ -83,6 +92,7 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
83
92
  setSelectedPartner("");
84
93
  setSelectedTemplate("");
85
94
  setSelectedActivityType("");
95
+ setCitiesOnly(false);
86
96
  }
87
97
  }, [open]);
88
98
  const loadInitialData = () => __awaiter(this, void 0, void 0, function* () {
@@ -123,6 +133,8 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
123
133
  query.on = "name";
124
134
  if (selectedActivityType)
125
135
  query["componentFields.data.type"] = selectedActivityType;
136
+ if (citiesOnly)
137
+ query["componentFields.data.type"] = "City";
126
138
  // Parent ids overwrites templateid filter
127
139
  if (parentIdsFilter === null || parentIdsFilter === void 0 ? void 0 : parentIdsFilter.length)
128
140
  query.templateId = parentIdsFilter.join(",");
@@ -159,7 +171,14 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
159
171
  const componentRegions = regions.filter((r) => { var _a; return (_a = component.regions) === null || _a === void 0 ? void 0 : _a.includes(r.id); });
160
172
  return { template, partners: componentPartners, regions: componentRegions };
161
173
  };
162
- const hasActiveFilters = selectedRegion || selectedPartner || selectedTemplate || selectedActivityType;
174
+ const hasActiveFilters = selectedRegion ||
175
+ selectedPartner ||
176
+ selectedTemplate ||
177
+ selectedActivityType ||
178
+ citiesOnly;
179
+ const isLocationComponent = Array.isArray(parentIdsFilter) &&
180
+ parentIdsFilter.length > 0 &&
181
+ parentIdsFilter.includes(templateStructure[TEMPLATE_NAMES.LOCATION]);
163
182
  if (initialLoading) {
164
183
  return (React.createElement(Dialog, { open: open, onClose: onClose, maxWidth: "md", fullWidth: true, PaperProps: { sx: { height: "80vh", maxHeight: "800px" } } },
165
184
  React.createElement(DialogContent, null,
@@ -170,7 +189,7 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
170
189
  return (React.createElement(Dialog, { open: open, onClose: onClose, maxWidth: "md", fullWidth: true, PaperProps: { sx: { height: "80vh", maxHeight: "800px" } } },
171
190
  React.createElement(DialogTitle, null,
172
191
  React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "space-between" },
173
- React.createElement(Typography, { variant: "h6" }, "Select Component"),
192
+ React.createElement(Typography, { variant: "h6" }, "Select Components"),
174
193
  hasActiveFilters && (React.createElement(Button, { size: "small", startIcon: React.createElement(ClearIcon, null), onClick: handleClearFilters }, "Clear Filters")))),
175
194
  React.createElement(DialogContent, { dividers: true },
176
195
  React.createElement(TextField, { fullWidth: true, placeholder: "Search components...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), InputProps: {
@@ -193,7 +212,8 @@ export default function ComponentPickerModal({ open, onClose, onSelect, selected
193
212
  template.revision))))),
194
213
  activityTypes.length > 0 && (React.createElement(TextField, { select: true, size: "small", label: "Activity Type", value: selectedActivityType, onChange: (e) => setSelectedActivityType(e.target.value), sx: { minWidth: 160 } },
195
214
  React.createElement(MenuItem, { value: "" }, "All Activity Types"),
196
- activityTypes.map((type) => (React.createElement(MenuItem, { key: type, value: type }, type)))))),
215
+ activityTypes.map((type) => (React.createElement(MenuItem, { key: type, value: type }, type))))),
216
+ isLocationComponent && (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: citiesOnly, onChange: (e) => setCitiesOnly(e.target.checked) }), label: "Cities only" }))),
197
217
  React.createElement(Box, { display: "flex", alignItems: "center", gap: 2, mb: 1 },
198
218
  React.createElement(Typography, { variant: "body2", color: "text.secondary" },
199
219
  totalCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.2.176",
3
+ "version": "2.2.177",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {