gsintegrations 0.0.485 → 0.0.486
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/bundle.cjs.js +756 -7
- package/dist/bundle.cjs.js.map +2 -2
- package/dist/bundle.esm.js +756 -8
- package/dist/bundle.esm.js.map +2 -2
- package/dist/index.d.ts +47 -2
- package/dist/types/pages/NearbyTerreiroSearchPage/NearbyTerreiroSearchPage.d.ts +4 -0
- package/dist/types/pages/NearbyTerreiroSearchPage/NearbyTerreiroSearchPage.types.d.ts +42 -0
- package/dist/types/pages/NearbyTerreiroSearchPage/TerreiroLocationSearch.d.ts +8 -0
- package/dist/types/pages/NearbyTerreiroSearchPage/TerreiroResultMap.d.ts +16 -0
- package/dist/types/pages/NearbyTerreiroSearchPage/index.d.ts +3 -0
- package/dist/types/pages/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -58797,6 +58797,10 @@ var DeleteOutline = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
|
58797
58797
|
d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"
|
|
58798
58798
|
}), 'DeleteOutline');
|
|
58799
58799
|
|
|
58800
|
+
var DirectionsOutlined = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
58801
|
+
d: "m22.43 10.59-9.01-9.01c-.75-.75-2.07-.76-2.83 0l-9 9c-.78.78-.78 2.04 0 2.82l9 9c.39.39.9.58 1.41.58.51 0 1.02-.19 1.41-.58l8.99-8.99c.79-.76.8-2.02.03-2.82m-10.42 10.4-9-9 9-9 9 9zM8 11v4h2v-3h4v2.5l3.5-3.5L14 7.5V10H9c-.55 0-1 .45-1 1"
|
|
58802
|
+
}), 'DirectionsOutlined');
|
|
58803
|
+
|
|
58800
58804
|
var DirectionsWalk = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
58801
58805
|
d: "M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2M9.8 8.9 7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6z"
|
|
58802
58806
|
}), 'DirectionsWalk');
|
|
@@ -59046,6 +59050,10 @@ var MoreVert = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
|
59046
59050
|
d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"
|
|
59047
59051
|
}), 'MoreVert');
|
|
59048
59052
|
|
|
59053
|
+
var MyLocation = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
59054
|
+
d: "M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7"
|
|
59055
|
+
}), 'MyLocation');
|
|
59056
|
+
|
|
59049
59057
|
var NavigateNext = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
59050
59058
|
d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
|
|
59051
59059
|
}), 'NavigateNext');
|
|
@@ -147238,6 +147246,7 @@ const ACTION_ICON_MAP = {
|
|
|
147238
147246
|
"🧘": React$1.createElement(Spa, null),
|
|
147239
147247
|
"🎓": React$1.createElement(School$1, null),
|
|
147240
147248
|
"🌐": React$1.createElement(Public, null),
|
|
147249
|
+
place: React$1.createElement(Place, null),
|
|
147241
147250
|
social: React$1.createElement(Public, null),
|
|
147242
147251
|
public: React$1.createElement(Public, null),
|
|
147243
147252
|
};
|
|
@@ -147896,7 +147905,7 @@ function getEventCoordinates(event) {
|
|
|
147896
147905
|
return null;
|
|
147897
147906
|
}
|
|
147898
147907
|
|
|
147899
|
-
const CSS = /*#__PURE__*/Object.freeze({
|
|
147908
|
+
const CSS$1 = /*#__PURE__*/Object.freeze({
|
|
147900
147909
|
Translate: {
|
|
147901
147910
|
toString(transform) {
|
|
147902
147911
|
if (!transform) {
|
|
@@ -147931,7 +147940,7 @@ const CSS = /*#__PURE__*/Object.freeze({
|
|
|
147931
147940
|
return;
|
|
147932
147941
|
}
|
|
147933
147942
|
|
|
147934
|
-
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' ');
|
|
147943
|
+
return [CSS$1.Translate.toString(transform), CSS$1.Scale.toString(transform)].join(' ');
|
|
147935
147944
|
}
|
|
147936
147945
|
|
|
147937
147946
|
},
|
|
@@ -151770,7 +151779,7 @@ const defaultTransition = {
|
|
|
151770
151779
|
easing: 'ease'
|
|
151771
151780
|
};
|
|
151772
151781
|
const transitionProperty = 'transform';
|
|
151773
|
-
const disabledTransition = /*#__PURE__*/CSS.Transition.toString({
|
|
151782
|
+
const disabledTransition = /*#__PURE__*/CSS$1.Transition.toString({
|
|
151774
151783
|
property: transitionProperty,
|
|
151775
151784
|
duration: 0,
|
|
151776
151785
|
easing: 'linear'
|
|
@@ -152004,7 +152013,7 @@ function useSortable(_ref) {
|
|
|
152004
152013
|
}
|
|
152005
152014
|
|
|
152006
152015
|
if (isSorting || shouldAnimateLayoutChanges) {
|
|
152007
|
-
return CSS.Transition.toString({ ...transition,
|
|
152016
|
+
return CSS$1.Transition.toString({ ...transition,
|
|
152008
152017
|
property: transitionProperty
|
|
152009
152018
|
});
|
|
152010
152019
|
}
|
|
@@ -152691,7 +152700,7 @@ const SortableOrderRow = ({ widget, index, total, onMove }) => {
|
|
|
152691
152700
|
const theme = useTheme$1();
|
|
152692
152701
|
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging, } = useSortable({ id: widget.id });
|
|
152693
152702
|
return (React$1.createElement(Box$1, { ref: setNodeRef, style: {
|
|
152694
|
-
transform: CSS.Transform.toString(transform),
|
|
152703
|
+
transform: CSS$1.Transform.toString(transform),
|
|
152695
152704
|
transition,
|
|
152696
152705
|
}, sx: {
|
|
152697
152706
|
display: "flex",
|
|
@@ -155027,6 +155036,14 @@ const useHomePage = (props) => {
|
|
|
155027
155036
|
route: "/terreiro",
|
|
155028
155037
|
color: "primary",
|
|
155029
155038
|
},
|
|
155039
|
+
{
|
|
155040
|
+
id: "terreiro-search",
|
|
155041
|
+
title: "Terreiros",
|
|
155042
|
+
description: "Buscar casas próximas",
|
|
155043
|
+
icon: "place",
|
|
155044
|
+
route: "/terreiros/buscar",
|
|
155045
|
+
color: "primary",
|
|
155046
|
+
},
|
|
155030
155047
|
{
|
|
155031
155048
|
id: "mediums",
|
|
155032
155049
|
title: "Médiuns",
|
|
@@ -155162,6 +155179,7 @@ const useHomePage = (props) => {
|
|
|
155162
155179
|
// Admin + personal: include Social when feature enabled
|
|
155163
155180
|
return withSocialUnreadBadge(filterByIds(withSocialPersonalOnly(withIngressos([
|
|
155164
155181
|
"terreiro",
|
|
155182
|
+
"terreiro-search",
|
|
155165
155183
|
"activities",
|
|
155166
155184
|
"ritual-baths",
|
|
155167
155185
|
"inventory",
|
|
@@ -155173,6 +155191,7 @@ const useHomePage = (props) => {
|
|
|
155173
155191
|
// Admin + terreiro: no Social
|
|
155174
155192
|
return filterByIds(withIngressos([
|
|
155175
155193
|
"terreiro",
|
|
155194
|
+
"terreiro-search",
|
|
155176
155195
|
"mediums",
|
|
155177
155196
|
"activities",
|
|
155178
155197
|
"events",
|
|
@@ -155187,6 +155206,7 @@ const useHomePage = (props) => {
|
|
|
155187
155206
|
if (selectedTerreiro) {
|
|
155188
155207
|
const filtered = filterByIds(withIngressos([
|
|
155189
155208
|
"terreiro",
|
|
155209
|
+
"terreiro-search",
|
|
155190
155210
|
"mediums",
|
|
155191
155211
|
"activities",
|
|
155192
155212
|
"events",
|
|
@@ -155200,6 +155220,7 @@ const useHomePage = (props) => {
|
|
|
155200
155220
|
// Non-admin + personal profile: include Social when feature enabled
|
|
155201
155221
|
return withSocialUnreadBadge(filterByIds(withSocialPersonalOnly([
|
|
155202
155222
|
"terreiro",
|
|
155223
|
+
"terreiro-search",
|
|
155203
155224
|
"activities",
|
|
155204
155225
|
"ritual-baths",
|
|
155205
155226
|
"inventory",
|
|
@@ -161037,7 +161058,7 @@ const FormGrid$8 = styled$1(Grid$1)(({ theme }) => ({
|
|
|
161037
161058
|
const CEP_MIN_LENGTH = 8;
|
|
161038
161059
|
const ZIP_PLACEHOLDER = "00000-000";
|
|
161039
161060
|
const ADORNMENT_SPINNER_SIZE = 20;
|
|
161040
|
-
const GOOGLE_SEARCH_PLACEHOLDER = "Digite o endereço para buscar no Google";
|
|
161061
|
+
const GOOGLE_SEARCH_PLACEHOLDER$1 = "Digite o endereço para buscar no Google";
|
|
161041
161062
|
const AddressPage = (props) => {
|
|
161042
161063
|
const theme = useTheme$1();
|
|
161043
161064
|
const { data, fns } = useAddressPage(props);
|
|
@@ -161109,7 +161130,7 @@ const AddressPage = (props) => {
|
|
|
161109
161130
|
}
|
|
161110
161131
|
}, onChange: (_, newValue) => {
|
|
161111
161132
|
fns.handleGoogleSuggestionSelect(newValue);
|
|
161112
|
-
}, renderInput: (params) => (React$1.createElement(TextField$1, Object.assign({}, params, { label: "Buscar endere\u00E7o", placeholder: GOOGLE_SEARCH_PLACEHOLDER, fullWidth: true, "data-testid": "address-google-search", InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React$1.createElement(InputAdornment$1, { position: "start" },
|
|
161133
|
+
}, renderInput: (params) => (React$1.createElement(TextField$1, Object.assign({}, params, { label: "Buscar endere\u00E7o", placeholder: GOOGLE_SEARCH_PLACEHOLDER$1, fullWidth: true, "data-testid": "address-google-search", InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React$1.createElement(InputAdornment$1, { position: "start" },
|
|
161113
161134
|
React$1.createElement(LocationOn, { sx: { color: theme.palette.text.secondary } }))) }) }))) }),
|
|
161114
161135
|
data.googleSearchError && (React$1.createElement(Box$1, { sx: { mt: 1 } },
|
|
161115
161136
|
React$1.createElement(Alert$1, { severity: "warning" }, data.googleSearchError))),
|
|
@@ -181417,6 +181438,733 @@ const QrLandingPagePropsSchema = objectType({
|
|
|
181417
181438
|
.optional(),
|
|
181418
181439
|
});
|
|
181419
181440
|
|
|
181441
|
+
const GOOGLE_SEARCH_PLACEHOLDER = "Digite o endereço para buscar no Google";
|
|
181442
|
+
const MIN_SEARCH_LENGTH = 3;
|
|
181443
|
+
const TerreiroLocationSearch = ({ apiKey, onSelect, onUnavailable, }) => {
|
|
181444
|
+
const theme = useTheme$1();
|
|
181445
|
+
const onUnavailableRef = React$1.useRef(onUnavailable);
|
|
181446
|
+
const onSelectRef = React$1.useRef(onSelect);
|
|
181447
|
+
onUnavailableRef.current = onUnavailable;
|
|
181448
|
+
onSelectRef.current = onSelect;
|
|
181449
|
+
const servicesRef = React$1.useRef({});
|
|
181450
|
+
const [ready, setReady] = React$1.useState(false);
|
|
181451
|
+
const [loading, setLoading] = React$1.useState(false);
|
|
181452
|
+
const [inputValue, setInputValue] = React$1.useState("");
|
|
181453
|
+
const [suggestions, setSuggestions] = React$1.useState([]);
|
|
181454
|
+
const [error, setError] = React$1.useState(null);
|
|
181455
|
+
React$1.useEffect(() => {
|
|
181456
|
+
let cancelled = false;
|
|
181457
|
+
loadGoogleMapsPlacesScript(apiKey, "pt-BR", "BR")
|
|
181458
|
+
.then(() => {
|
|
181459
|
+
var _a, _b;
|
|
181460
|
+
if (cancelled)
|
|
181461
|
+
return;
|
|
181462
|
+
const places = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places;
|
|
181463
|
+
if (!(places === null || places === void 0 ? void 0 : places.AutocompleteService) || !(places === null || places === void 0 ? void 0 : places.PlacesService)) {
|
|
181464
|
+
onUnavailableRef.current();
|
|
181465
|
+
return;
|
|
181466
|
+
}
|
|
181467
|
+
servicesRef.current.autocompleteService = new places.AutocompleteService();
|
|
181468
|
+
const container = document.createElement("div");
|
|
181469
|
+
servicesRef.current.placesService = new places.PlacesService(container);
|
|
181470
|
+
setReady(true);
|
|
181471
|
+
})
|
|
181472
|
+
.catch(() => {
|
|
181473
|
+
if (!cancelled)
|
|
181474
|
+
onUnavailableRef.current();
|
|
181475
|
+
});
|
|
181476
|
+
return () => {
|
|
181477
|
+
cancelled = true;
|
|
181478
|
+
};
|
|
181479
|
+
}, [apiKey]);
|
|
181480
|
+
const search = (value) => {
|
|
181481
|
+
var _a, _b;
|
|
181482
|
+
const autocomplete = servicesRef.current.autocompleteService;
|
|
181483
|
+
const places = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places;
|
|
181484
|
+
if (!autocomplete || !places)
|
|
181485
|
+
return;
|
|
181486
|
+
if (value.trim().length < MIN_SEARCH_LENGTH) {
|
|
181487
|
+
setSuggestions([]);
|
|
181488
|
+
setError(null);
|
|
181489
|
+
return;
|
|
181490
|
+
}
|
|
181491
|
+
setLoading(true);
|
|
181492
|
+
setError(null);
|
|
181493
|
+
autocomplete.getPlacePredictions({
|
|
181494
|
+
input: value,
|
|
181495
|
+
componentRestrictions: { country: "br" },
|
|
181496
|
+
types: ["address"],
|
|
181497
|
+
}, (predictions, status) => {
|
|
181498
|
+
setLoading(false);
|
|
181499
|
+
if (status !== places.PlacesServiceStatus.OK) {
|
|
181500
|
+
setSuggestions([]);
|
|
181501
|
+
if (status !== places.PlacesServiceStatus.ZERO_RESULTS) {
|
|
181502
|
+
setError("Não foi possível buscar endereços no Google");
|
|
181503
|
+
}
|
|
181504
|
+
return;
|
|
181505
|
+
}
|
|
181506
|
+
setSuggestions((predictions !== null && predictions !== void 0 ? predictions : []).map((prediction) => ({
|
|
181507
|
+
description: prediction.description,
|
|
181508
|
+
placeId: prediction.place_id,
|
|
181509
|
+
})));
|
|
181510
|
+
});
|
|
181511
|
+
};
|
|
181512
|
+
const selectSuggestion = (suggestion) => {
|
|
181513
|
+
var _a, _b;
|
|
181514
|
+
if (!suggestion)
|
|
181515
|
+
return;
|
|
181516
|
+
const placesService = servicesRef.current.placesService;
|
|
181517
|
+
const places = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places;
|
|
181518
|
+
if (!placesService || !places) {
|
|
181519
|
+
setError("Não foi possível carregar os detalhes do endereço");
|
|
181520
|
+
return;
|
|
181521
|
+
}
|
|
181522
|
+
setInputValue(suggestion.description);
|
|
181523
|
+
setLoading(true);
|
|
181524
|
+
setError(null);
|
|
181525
|
+
placesService.getDetails({
|
|
181526
|
+
placeId: suggestion.placeId,
|
|
181527
|
+
fields: ["address_components", "formatted_address"],
|
|
181528
|
+
}, (place, status) => {
|
|
181529
|
+
var _a;
|
|
181530
|
+
setLoading(false);
|
|
181531
|
+
if (status !== places.PlacesServiceStatus.OK || !place) {
|
|
181532
|
+
setError("Não foi possível obter detalhes do endereço");
|
|
181533
|
+
return;
|
|
181534
|
+
}
|
|
181535
|
+
const mapped = mapGooglePlaceToAddressForm({
|
|
181536
|
+
address_components: place.address_components,
|
|
181537
|
+
formatted_address: place.formatted_address,
|
|
181538
|
+
});
|
|
181539
|
+
if (!mapped.city) {
|
|
181540
|
+
setError("Não foi possível identificar a cidade deste endereço");
|
|
181541
|
+
return;
|
|
181542
|
+
}
|
|
181543
|
+
onSelectRef.current(mapped.city, (_a = mapped.state) !== null && _a !== void 0 ? _a : "");
|
|
181544
|
+
});
|
|
181545
|
+
};
|
|
181546
|
+
if (!ready)
|
|
181547
|
+
return null;
|
|
181548
|
+
return (React$1.createElement(Autocomplete$1, { options: suggestions, getOptionLabel: (option) => option.description, filterOptions: (options) => options, loading: loading, inputValue: inputValue, onInputChange: (_, value, reason) => {
|
|
181549
|
+
if (reason !== "input" && reason !== "clear")
|
|
181550
|
+
return;
|
|
181551
|
+
setInputValue(value);
|
|
181552
|
+
search(value);
|
|
181553
|
+
}, onChange: (_, value) => selectSuggestion(value), isOptionEqualToValue: (option, value) => option.placeId === value.placeId, noOptionsText: error !== null && error !== void 0 ? error : (inputValue.trim().length >= MIN_SEARCH_LENGTH
|
|
181554
|
+
? "Nenhum endereço encontrado para esta busca."
|
|
181555
|
+
: "Digite ao menos 3 caracteres"), renderInput: (params) => (React$1.createElement(TextField$1, Object.assign({}, params, { label: "Buscar endere\u00E7o", placeholder: GOOGLE_SEARCH_PLACEHOLDER, fullWidth: true, error: Boolean(error), helperText: error !== null && error !== void 0 ? error : undefined, inputProps: Object.assign(Object.assign({}, params.inputProps), { "data-testid": "terreiro-search-address" }), sx: {
|
|
181556
|
+
"& .MuiInputBase-input": { color: "text.primary" },
|
|
181557
|
+
"& .MuiInputBase-input::placeholder": { color: "text.secondary", opacity: 1 },
|
|
181558
|
+
}, InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React$1.createElement(InputAdornment$1, { position: "start" },
|
|
181559
|
+
React$1.createElement(LocationOn, { sx: { color: theme.palette.text.secondary } }))), endAdornment: (React$1.createElement(React$1.Fragment, null,
|
|
181560
|
+
loading ? React$1.createElement(CircularProgress$1, { size: 20 }) : null,
|
|
181561
|
+
params.InputProps.endAdornment)) }) }))) }));
|
|
181562
|
+
};
|
|
181563
|
+
|
|
181564
|
+
const BRAZIL_CENTER = { lat: -14.2, lng: -51.9 };
|
|
181565
|
+
const BRAZIL_ZOOM = 4;
|
|
181566
|
+
const SINGLE_RESULT_ZOOM = 15;
|
|
181567
|
+
const USER_LOCATION_ZOOM = 13;
|
|
181568
|
+
const PIN_ORANGE = "#BA4813";
|
|
181569
|
+
const PIN_COAL = "#201C10";
|
|
181570
|
+
const PIN_CREAM = "#F3E2B3";
|
|
181571
|
+
const mapColorScheme = (mode) => {
|
|
181572
|
+
var _a, _b;
|
|
181573
|
+
const scheme = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.ColorScheme;
|
|
181574
|
+
if (!scheme)
|
|
181575
|
+
return undefined;
|
|
181576
|
+
if (scheme.FOLLOW_SYSTEM)
|
|
181577
|
+
return scheme.FOLLOW_SYSTEM;
|
|
181578
|
+
return mode === "dark" ? scheme.DARK : scheme.LIGHT;
|
|
181579
|
+
};
|
|
181580
|
+
const finitePlaces = (results) => (results !== null && results !== void 0 ? results : []).filter((place) => Number.isFinite(place.latitude) && Number.isFinite(place.longitude));
|
|
181581
|
+
const pinIcon = (selected, mode) => {
|
|
181582
|
+
var _a, _b, _c;
|
|
181583
|
+
const maps = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps;
|
|
181584
|
+
const idleFill = mode === "dark" ? PIN_CREAM : PIN_COAL;
|
|
181585
|
+
const idleStroke = mode === "dark" ? PIN_COAL : PIN_CREAM;
|
|
181586
|
+
return {
|
|
181587
|
+
path: (_c = (_b = maps === null || maps === void 0 ? void 0 : maps.SymbolPath) === null || _b === void 0 ? void 0 : _b.CIRCLE) !== null && _c !== void 0 ? _c : 0,
|
|
181588
|
+
scale: selected ? 11 : 8,
|
|
181589
|
+
fillColor: selected ? PIN_ORANGE : idleFill,
|
|
181590
|
+
fillOpacity: 1,
|
|
181591
|
+
strokeColor: selected ? PIN_CREAM : idleStroke,
|
|
181592
|
+
strokeWeight: 2,
|
|
181593
|
+
};
|
|
181594
|
+
};
|
|
181595
|
+
const TerreiroResultMap = ({ apiKey, results, selectedPlaceId, userCoordinates, layoutKey = null, onSelectPlace, }) => {
|
|
181596
|
+
var _a, _b;
|
|
181597
|
+
const theme = useTheme$1();
|
|
181598
|
+
const mode = theme.palette.mode;
|
|
181599
|
+
const modeRef = React$1.useRef(mode);
|
|
181600
|
+
modeRef.current = mode;
|
|
181601
|
+
const containerRef = React$1.useRef(null);
|
|
181602
|
+
const mapRef = React$1.useRef(null);
|
|
181603
|
+
const markersRef = React$1.useRef(new Map());
|
|
181604
|
+
const onSelectRef = React$1.useRef(onSelectPlace);
|
|
181605
|
+
const resultsRef = React$1.useRef(results);
|
|
181606
|
+
const userCoordinatesRef = React$1.useRef(userCoordinates);
|
|
181607
|
+
const selectedPlaceIdRef = React$1.useRef(selectedPlaceId);
|
|
181608
|
+
const [mapReady, setMapReady] = React$1.useState(false);
|
|
181609
|
+
const [mapFailed, setMapFailed] = React$1.useState(!(apiKey === null || apiKey === void 0 ? void 0 : apiKey.trim()));
|
|
181610
|
+
const [mapEpoch, setMapEpoch] = React$1.useState(0);
|
|
181611
|
+
onSelectRef.current = onSelectPlace;
|
|
181612
|
+
resultsRef.current = results;
|
|
181613
|
+
userCoordinatesRef.current = userCoordinates;
|
|
181614
|
+
selectedPlaceIdRef.current = selectedPlaceId;
|
|
181615
|
+
const trimmedKey = (_a = apiKey === null || apiKey === void 0 ? void 0 : apiKey.trim()) !== null && _a !== void 0 ? _a : "";
|
|
181616
|
+
const resultSignature = (_b = results === null || results === void 0 ? void 0 : results.map((place) => `${place.placeId}:${place.latitude}:${place.longitude}`).join("|")) !== null && _b !== void 0 ? _b : "";
|
|
181617
|
+
const userLocationKey = userCoordinates
|
|
181618
|
+
? `${userCoordinates.latitude},${userCoordinates.longitude}`
|
|
181619
|
+
: "";
|
|
181620
|
+
React$1.useEffect(() => {
|
|
181621
|
+
if (!trimmedKey) {
|
|
181622
|
+
setMapFailed(true);
|
|
181623
|
+
setMapReady(false);
|
|
181624
|
+
return;
|
|
181625
|
+
}
|
|
181626
|
+
let cancelled = false;
|
|
181627
|
+
setMapFailed(false);
|
|
181628
|
+
loadGoogleMapsPlacesScript(trimmedKey, "pt-BR", "BR")
|
|
181629
|
+
.then(() => {
|
|
181630
|
+
var _a, _b, _c, _d;
|
|
181631
|
+
if (cancelled)
|
|
181632
|
+
return;
|
|
181633
|
+
if (!((_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map) || !((_d = (_c = window.google) === null || _c === void 0 ? void 0 : _c.maps) === null || _d === void 0 ? void 0 : _d.Marker)) {
|
|
181634
|
+
setMapFailed(true);
|
|
181635
|
+
return;
|
|
181636
|
+
}
|
|
181637
|
+
setMapReady(true);
|
|
181638
|
+
})
|
|
181639
|
+
.catch(() => {
|
|
181640
|
+
if (!cancelled)
|
|
181641
|
+
setMapFailed(true);
|
|
181642
|
+
});
|
|
181643
|
+
return () => {
|
|
181644
|
+
cancelled = true;
|
|
181645
|
+
};
|
|
181646
|
+
}, [trimmedKey]);
|
|
181647
|
+
React$1.useEffect(() => {
|
|
181648
|
+
var _a, _b;
|
|
181649
|
+
if (!mapReady || !containerRef.current || !((_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.Map))
|
|
181650
|
+
return;
|
|
181651
|
+
const colorScheme = mapColorScheme(modeRef.current);
|
|
181652
|
+
const map = new window.google.maps.Map(containerRef.current, Object.assign({ center: BRAZIL_CENTER, zoom: BRAZIL_ZOOM, disableDefaultUI: true, zoomControl: true, clickableIcons: false, gestureHandling: "greedy", mapTypeControl: false, streetViewControl: false, fullscreenControl: false }, (colorScheme ? { colorScheme } : {})));
|
|
181653
|
+
mapRef.current = map;
|
|
181654
|
+
setMapEpoch((epoch) => epoch + 1);
|
|
181655
|
+
return () => {
|
|
181656
|
+
markersRef.current.forEach((marker) => marker.setMap(null));
|
|
181657
|
+
markersRef.current.clear();
|
|
181658
|
+
mapRef.current = null;
|
|
181659
|
+
};
|
|
181660
|
+
}, [mapReady]);
|
|
181661
|
+
React$1.useEffect(() => {
|
|
181662
|
+
var _a;
|
|
181663
|
+
const map = mapRef.current;
|
|
181664
|
+
const maps = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps;
|
|
181665
|
+
if (!mapReady || !map || !(maps === null || maps === void 0 ? void 0 : maps.Marker))
|
|
181666
|
+
return;
|
|
181667
|
+
const places = finitePlaces(resultsRef.current);
|
|
181668
|
+
const nextIds = new Set(places.map((place) => place.placeId));
|
|
181669
|
+
markersRef.current.forEach((marker, id) => {
|
|
181670
|
+
if (!nextIds.has(id)) {
|
|
181671
|
+
marker.setMap(null);
|
|
181672
|
+
markersRef.current.delete(id);
|
|
181673
|
+
}
|
|
181674
|
+
});
|
|
181675
|
+
places.forEach((place) => {
|
|
181676
|
+
const position = { lat: place.latitude, lng: place.longitude };
|
|
181677
|
+
const existing = markersRef.current.get(place.placeId);
|
|
181678
|
+
if (existing) {
|
|
181679
|
+
existing.setPosition(position);
|
|
181680
|
+
return;
|
|
181681
|
+
}
|
|
181682
|
+
const marker = new maps.Marker({
|
|
181683
|
+
map,
|
|
181684
|
+
position,
|
|
181685
|
+
title: place.name,
|
|
181686
|
+
icon: pinIcon(place.placeId === selectedPlaceIdRef.current, modeRef.current),
|
|
181687
|
+
});
|
|
181688
|
+
marker.addListener("click", () => onSelectRef.current(place.placeId));
|
|
181689
|
+
markersRef.current.set(place.placeId, marker);
|
|
181690
|
+
});
|
|
181691
|
+
if (places.length === 1) {
|
|
181692
|
+
map.setCenter({ lat: places[0].latitude, lng: places[0].longitude });
|
|
181693
|
+
map.setZoom(SINGLE_RESULT_ZOOM);
|
|
181694
|
+
return;
|
|
181695
|
+
}
|
|
181696
|
+
if (places.length > 1) {
|
|
181697
|
+
const bounds = new maps.LatLngBounds();
|
|
181698
|
+
places.forEach((place) => {
|
|
181699
|
+
bounds.extend({ lat: place.latitude, lng: place.longitude });
|
|
181700
|
+
});
|
|
181701
|
+
map.fitBounds(bounds, 48);
|
|
181702
|
+
return;
|
|
181703
|
+
}
|
|
181704
|
+
const coords = userCoordinatesRef.current;
|
|
181705
|
+
if (coords && Number.isFinite(coords.latitude) && Number.isFinite(coords.longitude)) {
|
|
181706
|
+
map.setCenter({ lat: coords.latitude, lng: coords.longitude });
|
|
181707
|
+
map.setZoom(USER_LOCATION_ZOOM);
|
|
181708
|
+
return;
|
|
181709
|
+
}
|
|
181710
|
+
map.setCenter(BRAZIL_CENTER);
|
|
181711
|
+
map.setZoom(BRAZIL_ZOOM);
|
|
181712
|
+
}, [mapEpoch, mapReady, resultSignature, userLocationKey]);
|
|
181713
|
+
React$1.useEffect(() => {
|
|
181714
|
+
var _a;
|
|
181715
|
+
const map = mapRef.current;
|
|
181716
|
+
if (!mapReady || !map)
|
|
181717
|
+
return;
|
|
181718
|
+
const scheme = mapColorScheme(mode);
|
|
181719
|
+
if (scheme)
|
|
181720
|
+
(_a = map.setOptions) === null || _a === void 0 ? void 0 : _a.call(map, { colorScheme: scheme });
|
|
181721
|
+
markersRef.current.forEach((marker, id) => {
|
|
181722
|
+
marker.setIcon(pinIcon(id === selectedPlaceId, mode));
|
|
181723
|
+
});
|
|
181724
|
+
if (!selectedPlaceId)
|
|
181725
|
+
return;
|
|
181726
|
+
const place = finitePlaces(resultsRef.current).find((item) => item.placeId === selectedPlaceId);
|
|
181727
|
+
if (!place)
|
|
181728
|
+
return;
|
|
181729
|
+
map.panTo({ lat: place.latitude, lng: place.longitude });
|
|
181730
|
+
}, [mapEpoch, mapReady, mode, resultSignature, selectedPlaceId]);
|
|
181731
|
+
React$1.useEffect(() => {
|
|
181732
|
+
var _a, _b, _c, _d;
|
|
181733
|
+
const map = mapRef.current;
|
|
181734
|
+
if (!mapReady || !map || layoutKey === null)
|
|
181735
|
+
return;
|
|
181736
|
+
(_d = (_c = (_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.trigger) === null || _d === void 0 ? void 0 : _d.call(_c, map, "resize");
|
|
181737
|
+
}, [layoutKey, mapEpoch, mapReady]);
|
|
181738
|
+
const showPlaceholder = !trimmedKey || mapFailed || !mapReady;
|
|
181739
|
+
return (React$1.createElement(Box$1, { sx: { position: "absolute", inset: 0 } },
|
|
181740
|
+
React$1.createElement(Box$1, { ref: containerRef, role: "region", "aria-label": "Mapa de terreiros", "data-testid": "terreiro-search-map", sx: { position: "absolute", inset: 0, bgcolor: "background.default" } }),
|
|
181741
|
+
showPlaceholder ? (React$1.createElement(Box$1, { "aria-hidden": true, "data-testid": "terreiro-search-map-placeholder", sx: {
|
|
181742
|
+
position: "absolute",
|
|
181743
|
+
inset: 0,
|
|
181744
|
+
bgcolor: "background.default",
|
|
181745
|
+
zIndex: 1,
|
|
181746
|
+
} })) : null));
|
|
181747
|
+
};
|
|
181748
|
+
|
|
181749
|
+
const TRADITIONS = ["Umbanda", "Candomblé", "Omolocô", "Quimbanda"];
|
|
181750
|
+
const statusLabel = (status) => {
|
|
181751
|
+
if (status === "CLOSED_PERMANENTLY")
|
|
181752
|
+
return "Fechado permanentemente";
|
|
181753
|
+
if (status === "CLOSED_TEMPORARILY")
|
|
181754
|
+
return "Fechado temporariamente";
|
|
181755
|
+
return null;
|
|
181756
|
+
};
|
|
181757
|
+
const traditionPressed = (query, tradition) => query.trim().localeCompare(tradition, "pt-BR", { sensitivity: "accent" }) === 0;
|
|
181758
|
+
const floatingControlShadow = "0 4px 16px rgba(32, 28, 16, 0.12)";
|
|
181759
|
+
const PEEK_HEIGHT = 72;
|
|
181760
|
+
const TOP_CLEARANCE = 120;
|
|
181761
|
+
const DRAG_SLOP = 5;
|
|
181762
|
+
const maxSheetHeight = () => {
|
|
181763
|
+
const viewport = typeof window === "undefined" ? 800 : window.innerHeight;
|
|
181764
|
+
return Math.max(PEEK_HEIGHT, viewport - TOP_CLEARANCE);
|
|
181765
|
+
};
|
|
181766
|
+
const defaultOpenHeight = () => {
|
|
181767
|
+
const viewport = typeof window === "undefined" ? 800 : window.innerHeight;
|
|
181768
|
+
return Math.round(Math.min(Math.max(viewport * 0.4, PEEK_HEIGHT), maxSheetHeight()));
|
|
181769
|
+
};
|
|
181770
|
+
const focusRing = {
|
|
181771
|
+
"&:focus-visible": {
|
|
181772
|
+
outline: "2px solid",
|
|
181773
|
+
outlineColor: "primary.main",
|
|
181774
|
+
outlineOffset: 2,
|
|
181775
|
+
},
|
|
181776
|
+
};
|
|
181777
|
+
const ResultRow = ({ place, selected, onSelect, onOpenMaps }) => {
|
|
181778
|
+
const closedLabel = statusLabel(place.businessStatus);
|
|
181779
|
+
return (React$1.createElement(Box$1, { component: "li", "data-testid": `terreiro-search-result-${place.placeId}`, sx: {
|
|
181780
|
+
display: "flex",
|
|
181781
|
+
alignItems: "center",
|
|
181782
|
+
gap: 0.5,
|
|
181783
|
+
minHeight: 56,
|
|
181784
|
+
listStyle: "none",
|
|
181785
|
+
} },
|
|
181786
|
+
React$1.createElement(Box$1, { component: "button", type: "button", "aria-pressed": selected, onClick: () => onSelect(place.placeId), sx: Object.assign({ flex: 1, minWidth: 0, minHeight: 56, display: "flex", alignItems: "center", gap: 1.5, py: 1, px: 0, border: 0, background: "transparent", textAlign: "left", cursor: "pointer", color: "inherit" }, focusRing) },
|
|
181787
|
+
React$1.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
181788
|
+
width: 40,
|
|
181789
|
+
height: 40,
|
|
181790
|
+
borderRadius: "50%",
|
|
181791
|
+
display: "grid",
|
|
181792
|
+
placeItems: "center",
|
|
181793
|
+
flexShrink: 0,
|
|
181794
|
+
bgcolor: (theme) => alpha(selected ? theme.palette.primary.main : theme.palette.text.primary, 0.12),
|
|
181795
|
+
color: selected ? "primary.main" : "text.primary",
|
|
181796
|
+
} },
|
|
181797
|
+
React$1.createElement(PlaceOutlined, { fontSize: "small" })),
|
|
181798
|
+
React$1.createElement(Box$1, { sx: { minWidth: 0 } },
|
|
181799
|
+
React$1.createElement(Typography$1, { sx: {
|
|
181800
|
+
fontWeight: 700,
|
|
181801
|
+
fontSize: 16,
|
|
181802
|
+
color: selected ? "primary.main" : "text.primary",
|
|
181803
|
+
} }, place.name),
|
|
181804
|
+
React$1.createElement(Typography$1, { sx: { fontSize: 13, color: "text.secondary" } }, place.formattedAddress),
|
|
181805
|
+
closedLabel ? (React$1.createElement(Typography$1, { sx: { fontSize: 12, color: "text.secondary" } }, closedLabel)) : null)),
|
|
181806
|
+
React$1.createElement(Link$1, { href: place.googleMapsUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": "Ver no Google Maps", "data-testid": `terreiro-search-maps-${place.placeId}`, onClick: () => onOpenMaps(place), sx: Object.assign({ width: 44, height: 44, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, color: "text.primary", borderRadius: "50%" }, focusRing) },
|
|
181807
|
+
React$1.createElement(DirectionsOutlined, null))));
|
|
181808
|
+
};
|
|
181809
|
+
const NearbyTerreiroSearchPage = ({ query, onQueryChange, city, onCityChange, state, onStateChange, locationMode, geolocationNotice, isLocating = false, isLoading = false, isLoadingMore = false, results, errorMessage, hasMore = false, onSearch, onUseMyLocation, onRetry, onLoadMore, onOpenMaps, onBack, googleMapsApiKey, userCoordinates, }) => {
|
|
181810
|
+
const theme = useTheme$1();
|
|
181811
|
+
const isWide = useMediaQuery(theme.breakpoints.up("sm"));
|
|
181812
|
+
const [locationOpen, setLocationOpen] = React$1.useState(false);
|
|
181813
|
+
const [addressSearchUnavailable, setAddressSearchUnavailable] = React$1.useState(false);
|
|
181814
|
+
const [selectedPlaceId, setSelectedPlaceId] = React$1.useState(null);
|
|
181815
|
+
const [sheetHeight, setSheetHeight] = React$1.useState(null);
|
|
181816
|
+
const hasSheetContent = isLoading || Boolean(errorMessage) || results !== null;
|
|
181817
|
+
const listVisible = Boolean(results && results.length > 0);
|
|
181818
|
+
const previousMode = React$1.useRef(locationMode);
|
|
181819
|
+
const lastOpenHeight = React$1.useRef(defaultOpenHeight());
|
|
181820
|
+
const dragOrigin = React$1.useRef(null);
|
|
181821
|
+
const dragMoved = React$1.useRef(false);
|
|
181822
|
+
const resolvedSheetHeight = sheetHeight !== null && sheetHeight !== void 0 ? sheetHeight : defaultOpenHeight();
|
|
181823
|
+
const sheetOpen = resolvedSheetHeight > PEEK_HEIGHT + DRAG_SLOP;
|
|
181824
|
+
React$1.useEffect(() => {
|
|
181825
|
+
if (!listVisible || sheetHeight !== null)
|
|
181826
|
+
return;
|
|
181827
|
+
const open = defaultOpenHeight();
|
|
181828
|
+
lastOpenHeight.current = open;
|
|
181829
|
+
setSheetHeight(open);
|
|
181830
|
+
}, [listVisible, sheetHeight]);
|
|
181831
|
+
const toggleSheet = () => {
|
|
181832
|
+
setSheetHeight((current) => {
|
|
181833
|
+
const height = current !== null && current !== void 0 ? current : defaultOpenHeight();
|
|
181834
|
+
if (height <= PEEK_HEIGHT + DRAG_SLOP) {
|
|
181835
|
+
const open = lastOpenHeight.current > PEEK_HEIGHT + DRAG_SLOP
|
|
181836
|
+
? lastOpenHeight.current
|
|
181837
|
+
: defaultOpenHeight();
|
|
181838
|
+
return Math.min(open, maxSheetHeight());
|
|
181839
|
+
}
|
|
181840
|
+
lastOpenHeight.current = height;
|
|
181841
|
+
return PEEK_HEIGHT;
|
|
181842
|
+
});
|
|
181843
|
+
};
|
|
181844
|
+
const onHandlePointerDown = (event) => {
|
|
181845
|
+
if (!listVisible)
|
|
181846
|
+
return;
|
|
181847
|
+
dragMoved.current = false;
|
|
181848
|
+
dragOrigin.current = {
|
|
181849
|
+
y: event.clientY,
|
|
181850
|
+
height: sheetHeight !== null && sheetHeight !== void 0 ? sheetHeight : defaultOpenHeight(),
|
|
181851
|
+
};
|
|
181852
|
+
if (event.currentTarget.setPointerCapture && Number.isFinite(event.pointerId)) {
|
|
181853
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
181854
|
+
}
|
|
181855
|
+
};
|
|
181856
|
+
const onHandlePointerMove = (event) => {
|
|
181857
|
+
const origin = dragOrigin.current;
|
|
181858
|
+
if (!origin)
|
|
181859
|
+
return;
|
|
181860
|
+
if (Math.abs(origin.y - event.clientY) > DRAG_SLOP)
|
|
181861
|
+
dragMoved.current = true;
|
|
181862
|
+
if (!dragMoved.current)
|
|
181863
|
+
return;
|
|
181864
|
+
const next = Math.min(maxSheetHeight(), Math.max(PEEK_HEIGHT, origin.height + (origin.y - event.clientY)));
|
|
181865
|
+
setSheetHeight(next);
|
|
181866
|
+
};
|
|
181867
|
+
const onHandlePointerUp = (event) => {
|
|
181868
|
+
if (!dragOrigin.current)
|
|
181869
|
+
return;
|
|
181870
|
+
dragOrigin.current = null;
|
|
181871
|
+
if (event.currentTarget.hasPointerCapture &&
|
|
181872
|
+
Number.isFinite(event.pointerId) &&
|
|
181873
|
+
event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
181874
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
181875
|
+
}
|
|
181876
|
+
if (!dragMoved.current)
|
|
181877
|
+
return;
|
|
181878
|
+
setSheetHeight((current) => {
|
|
181879
|
+
if (current !== null && current > PEEK_HEIGHT + DRAG_SLOP) {
|
|
181880
|
+
lastOpenHeight.current = current;
|
|
181881
|
+
}
|
|
181882
|
+
return current;
|
|
181883
|
+
});
|
|
181884
|
+
};
|
|
181885
|
+
const onHandleClick = () => {
|
|
181886
|
+
if (!listVisible)
|
|
181887
|
+
return;
|
|
181888
|
+
if (dragMoved.current) {
|
|
181889
|
+
dragMoved.current = false;
|
|
181890
|
+
return;
|
|
181891
|
+
}
|
|
181892
|
+
toggleSheet();
|
|
181893
|
+
};
|
|
181894
|
+
const trimmedQuery = query.trim();
|
|
181895
|
+
const locationReady = locationMode === "geolocation" || city.trim().length >= 2;
|
|
181896
|
+
const canSearch = trimmedQuery.length >= 3 &&
|
|
181897
|
+
trimmedQuery.length <= 80 &&
|
|
181898
|
+
locationReady &&
|
|
181899
|
+
!isLoading &&
|
|
181900
|
+
!isLocating;
|
|
181901
|
+
React$1.useEffect(() => {
|
|
181902
|
+
if (previousMode.current !== "geolocation" && locationMode === "geolocation") {
|
|
181903
|
+
setLocationOpen(false);
|
|
181904
|
+
}
|
|
181905
|
+
previousMode.current = locationMode;
|
|
181906
|
+
}, [locationMode]);
|
|
181907
|
+
React$1.useEffect(() => {
|
|
181908
|
+
if (!selectedPlaceId)
|
|
181909
|
+
return;
|
|
181910
|
+
if (!(results === null || results === void 0 ? void 0 : results.some((place) => place.placeId === selectedPlaceId))) {
|
|
181911
|
+
setSelectedPlaceId(null);
|
|
181912
|
+
}
|
|
181913
|
+
}, [results, selectedPlaceId]);
|
|
181914
|
+
React$1.useEffect(() => {
|
|
181915
|
+
if (!selectedPlaceId || !listVisible)
|
|
181916
|
+
return;
|
|
181917
|
+
setSheetHeight((current) => {
|
|
181918
|
+
const height = current !== null && current !== void 0 ? current : defaultOpenHeight();
|
|
181919
|
+
if (height > PEEK_HEIGHT + DRAG_SLOP)
|
|
181920
|
+
return current;
|
|
181921
|
+
const open = lastOpenHeight.current > PEEK_HEIGHT + DRAG_SLOP
|
|
181922
|
+
? lastOpenHeight.current
|
|
181923
|
+
: defaultOpenHeight();
|
|
181924
|
+
return Math.min(open, maxSheetHeight());
|
|
181925
|
+
});
|
|
181926
|
+
let innerFrame = 0;
|
|
181927
|
+
const outerFrame = requestAnimationFrame(() => {
|
|
181928
|
+
innerFrame = requestAnimationFrame(() => {
|
|
181929
|
+
var _a;
|
|
181930
|
+
const row = (_a = document
|
|
181931
|
+
.getElementById("terreiro-search-sheet-body")) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-testid="terreiro-search-result-${CSS.escape(selectedPlaceId)}"]`);
|
|
181932
|
+
if (row instanceof HTMLElement) {
|
|
181933
|
+
row.scrollIntoView({ block: "nearest" });
|
|
181934
|
+
}
|
|
181935
|
+
});
|
|
181936
|
+
});
|
|
181937
|
+
return () => {
|
|
181938
|
+
cancelAnimationFrame(outerFrame);
|
|
181939
|
+
cancelAnimationFrame(innerFrame);
|
|
181940
|
+
};
|
|
181941
|
+
}, [listVisible, selectedPlaceId]);
|
|
181942
|
+
const locationLabel = locationMode === "geolocation"
|
|
181943
|
+
? "Perto de mim"
|
|
181944
|
+
: city.trim()
|
|
181945
|
+
? state.trim()
|
|
181946
|
+
? `${city.trim()}, ${state.trim()}`
|
|
181947
|
+
: city.trim()
|
|
181948
|
+
: "Escolher cidade";
|
|
181949
|
+
const peekLabel = (() => {
|
|
181950
|
+
if (isLoading)
|
|
181951
|
+
return "Buscando terreiros...";
|
|
181952
|
+
if (errorMessage)
|
|
181953
|
+
return "Não foi possível buscar";
|
|
181954
|
+
if (results && results.length === 1)
|
|
181955
|
+
return "1 terreiro";
|
|
181956
|
+
if (results && results.length > 1)
|
|
181957
|
+
return `${results.length} terreiros`;
|
|
181958
|
+
if (results && results.length === 0)
|
|
181959
|
+
return "Nenhum terreiro";
|
|
181960
|
+
return "Busque para ver terreiros na região";
|
|
181961
|
+
})();
|
|
181962
|
+
const submitTradition = (tradition) => {
|
|
181963
|
+
onQueryChange(tradition);
|
|
181964
|
+
if (locationReady && !isLoading && !isLocating)
|
|
181965
|
+
onSearch(tradition);
|
|
181966
|
+
};
|
|
181967
|
+
const notice = geolocationNotice ? (React$1.createElement(Typography$1, { role: "status", variant: "body2", "data-testid": "terreiro-search-geo-notice", sx: {
|
|
181968
|
+
alignSelf: "flex-start",
|
|
181969
|
+
maxWidth: "100%",
|
|
181970
|
+
bgcolor: "background.paper",
|
|
181971
|
+
color: "text.secondary",
|
|
181972
|
+
borderRadius: 2,
|
|
181973
|
+
px: 1.5,
|
|
181974
|
+
py: 1,
|
|
181975
|
+
fontSize: 13,
|
|
181976
|
+
boxShadow: floatingControlShadow,
|
|
181977
|
+
} }, geolocationNotice)) : null;
|
|
181978
|
+
return (React$1.createElement(Box$1, { sx: {
|
|
181979
|
+
position: "relative",
|
|
181980
|
+
height: "100dvh",
|
|
181981
|
+
display: "flex",
|
|
181982
|
+
overflow: "hidden",
|
|
181983
|
+
bgcolor: "background.default",
|
|
181984
|
+
} },
|
|
181985
|
+
React$1.createElement(Box$1, { component: "section", "aria-label": "Resultados", "data-testid": "terreiro-search-sheet", style: listVisible ? { height: resolvedSheetHeight } : undefined, sx: {
|
|
181986
|
+
position: listVisible ? "absolute" : { xs: "absolute", sm: "relative" },
|
|
181987
|
+
left: 0,
|
|
181988
|
+
right: { xs: 0, sm: "auto" },
|
|
181989
|
+
bottom: 0,
|
|
181990
|
+
zIndex: 2,
|
|
181991
|
+
display: "flex",
|
|
181992
|
+
flexDirection: "column",
|
|
181993
|
+
width: { xs: "100%", sm: 400 },
|
|
181994
|
+
maxWidth: { sm: 400 },
|
|
181995
|
+
flexShrink: 0,
|
|
181996
|
+
height: listVisible ? undefined : { sm: "100%" },
|
|
181997
|
+
maxHeight: listVisible ? `calc(100dvh - ${TOP_CLEARANCE}px)` : "none",
|
|
181998
|
+
bgcolor: "background.paper",
|
|
181999
|
+
borderTopLeftRadius: listVisible || !isWide ? "20px" : 0,
|
|
182000
|
+
borderTopRightRadius: listVisible || !isWide ? "20px" : 0,
|
|
182001
|
+
borderRight: listVisible ? 0 : { sm: 1 },
|
|
182002
|
+
borderColor: "divider",
|
|
182003
|
+
boxShadow: listVisible || !isWide ? "0 -8px 24px rgba(32, 28, 16, 0.08)" : "none",
|
|
182004
|
+
} },
|
|
182005
|
+
listVisible ? (React$1.createElement(Box$1, { component: "button", type: "button", "aria-expanded": sheetOpen, "aria-controls": "terreiro-search-sheet-body", "data-testid": "terreiro-search-sheet-handle", onPointerDown: onHandlePointerDown, onPointerMove: onHandlePointerMove, onPointerUp: onHandlePointerUp, onClick: onHandleClick, sx: Object.assign({ width: "100%", border: 0, bgcolor: "transparent", cursor: "ns-resize", touchAction: "none", display: "flex", flexDirection: "column", alignItems: "center", gap: 0.75, pt: 1, pb: 1, px: 2, minHeight: 44, color: "text.primary" }, focusRing) },
|
|
182006
|
+
React$1.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
182007
|
+
width: 36,
|
|
182008
|
+
height: 4,
|
|
182009
|
+
borderRadius: RADIUS.pill,
|
|
182010
|
+
bgcolor: (muiTheme) => alpha(muiTheme.palette.text.primary, 0.28),
|
|
182011
|
+
} }),
|
|
182012
|
+
React$1.createElement(Box$1, { component: "span", sx: { alignSelf: "flex-start", fontSize: 16, fontWeight: 800 } }, peekLabel))) : isWide ? (React$1.createElement(Typography$1, { sx: { px: 2, pt: 2, pb: 1, fontSize: 16, fontWeight: 800 } }, peekLabel)) : (React$1.createElement(Box$1, { sx: {
|
|
182013
|
+
width: "100%",
|
|
182014
|
+
display: "flex",
|
|
182015
|
+
flexDirection: "column",
|
|
182016
|
+
alignItems: "center",
|
|
182017
|
+
gap: 0.75,
|
|
182018
|
+
pt: 1,
|
|
182019
|
+
pb: 1,
|
|
182020
|
+
px: 2,
|
|
182021
|
+
minHeight: 44,
|
|
182022
|
+
color: "text.primary",
|
|
182023
|
+
} },
|
|
182024
|
+
React$1.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
182025
|
+
width: 36,
|
|
182026
|
+
height: 4,
|
|
182027
|
+
borderRadius: RADIUS.pill,
|
|
182028
|
+
bgcolor: (muiTheme) => alpha(muiTheme.palette.text.primary, 0.28),
|
|
182029
|
+
} }),
|
|
182030
|
+
React$1.createElement(Box$1, { component: "span", sx: { alignSelf: "flex-start", fontSize: 16, fontWeight: 800 } }, peekLabel))),
|
|
182031
|
+
React$1.createElement(Box$1, { id: "terreiro-search-sheet-body", sx: {
|
|
182032
|
+
display: hasSheetContent ? "flex" : "none",
|
|
182033
|
+
flexDirection: "column",
|
|
182034
|
+
flex: 1,
|
|
182035
|
+
minHeight: 0,
|
|
182036
|
+
overflowY: "auto",
|
|
182037
|
+
px: 2,
|
|
182038
|
+
pb: 2,
|
|
182039
|
+
} },
|
|
182040
|
+
isLoading ? (React$1.createElement(Stack$1, { spacing: 1, "data-testid": "terreiro-search-loading" }, [0, 1, 2].map((item) => (React$1.createElement(Skeleton$1, { key: item, variant: "rectangular", height: 56 }))))) : null,
|
|
182041
|
+
!isLoading && errorMessage ? (React$1.createElement(Stack$1, { spacing: 1, "data-testid": "terreiro-search-error", role: "alert" },
|
|
182042
|
+
React$1.createElement(Typography$1, null, errorMessage),
|
|
182043
|
+
onRetry ? (React$1.createElement(Button$1, { type: "button", variant: "text", onClick: onRetry, "data-testid": "terreiro-search-retry", sx: {
|
|
182044
|
+
alignSelf: "flex-start",
|
|
182045
|
+
minHeight: 44,
|
|
182046
|
+
fontWeight: 700,
|
|
182047
|
+
color: "text.primary",
|
|
182048
|
+
} }, "Tentar de novo")) : null)) : null,
|
|
182049
|
+
!isLoading && !errorMessage && results && results.length === 0 ? (React$1.createElement(Stack$1, { spacing: 1, "data-testid": "terreiro-search-empty", sx: { py: 2 } },
|
|
182050
|
+
React$1.createElement(PlaceOutlined, { sx: { color: "text.primary" } }),
|
|
182051
|
+
React$1.createElement(Typography$1, { sx: { fontWeight: 700 } }, "Nenhum terreiro encontrado para esta busca na regi\u00E3o selecionada."),
|
|
182052
|
+
React$1.createElement(Typography$1, { sx: { fontSize: 13, color: "text.secondary" } }, "Ajuste o termo ou a cidade e busque de novo."))) : null,
|
|
182053
|
+
!isLoading && !errorMessage && results && results.length > 0 ? (React$1.createElement(Box$1, { component: "ul", sx: { m: 0, p: 0 } }, results.map((place) => (React$1.createElement(ResultRow, { key: place.placeId, place: place, selected: place.placeId === selectedPlaceId, onSelect: setSelectedPlaceId, onOpenMaps: onOpenMaps }))))) : null,
|
|
182054
|
+
!isLoading && !errorMessage && hasMore ? (React$1.createElement(Button$1, { type: "button", variant: "text", onClick: onLoadMore, disabled: isLoadingMore, "data-testid": "terreiro-search-load-more", sx: {
|
|
182055
|
+
alignSelf: "flex-start",
|
|
182056
|
+
mt: 0.5,
|
|
182057
|
+
minHeight: 44,
|
|
182058
|
+
fontWeight: 700,
|
|
182059
|
+
color: "text.primary",
|
|
182060
|
+
} }, isLoadingMore ? "Carregando..." : "Carregar mais")) : null)),
|
|
182061
|
+
React$1.createElement(Box$1, { sx: { position: "relative", flex: 1, minWidth: 0 } },
|
|
182062
|
+
React$1.createElement(TerreiroResultMap, { apiKey: googleMapsApiKey, results: results, selectedPlaceId: selectedPlaceId, userCoordinates: userCoordinates, layoutKey: listVisible ? resolvedSheetHeight : null, onSelectPlace: setSelectedPlaceId }),
|
|
182063
|
+
React$1.createElement(Box$1, { component: "form", onSubmit: (event) => {
|
|
182064
|
+
event.preventDefault();
|
|
182065
|
+
if (canSearch)
|
|
182066
|
+
onSearch(trimmedQuery);
|
|
182067
|
+
}, sx: {
|
|
182068
|
+
position: "absolute",
|
|
182069
|
+
top: 16,
|
|
182070
|
+
left: 16,
|
|
182071
|
+
right: 16,
|
|
182072
|
+
zIndex: 3,
|
|
182073
|
+
display: "flex",
|
|
182074
|
+
flexDirection: "column",
|
|
182075
|
+
gap: 1,
|
|
182076
|
+
} },
|
|
182077
|
+
React$1.createElement(Box$1, { sx: { display: "flex", alignItems: "center", gap: 1 } },
|
|
182078
|
+
onBack ? (React$1.createElement(IconButton$1, { type: "button", "aria-label": "Voltar", onClick: onBack, sx: Object.assign({ width: 44, height: 44, flexShrink: 0, bgcolor: "background.paper", color: "text.primary", boxShadow: floatingControlShadow, "&:hover": { bgcolor: "background.paper" } }, focusRing) },
|
|
182079
|
+
React$1.createElement(ArrowBack$1, null))) : null,
|
|
182080
|
+
React$1.createElement(Box$1, { sx: {
|
|
182081
|
+
flex: 1,
|
|
182082
|
+
minWidth: 0,
|
|
182083
|
+
display: "flex",
|
|
182084
|
+
alignItems: "center",
|
|
182085
|
+
minHeight: 44,
|
|
182086
|
+
pl: 2,
|
|
182087
|
+
pr: 0.5,
|
|
182088
|
+
bgcolor: "background.paper",
|
|
182089
|
+
borderRadius: RADIUS.pill,
|
|
182090
|
+
boxShadow: floatingControlShadow,
|
|
182091
|
+
} },
|
|
182092
|
+
React$1.createElement(InputBase$1, { value: query, onChange: (event) => onQueryChange(event.target.value), placeholder: "Umbanda, Candombl\u00E9...", fullWidth: true, inputProps: {
|
|
182093
|
+
"aria-label": "Tradição ou nome",
|
|
182094
|
+
maxLength: 80,
|
|
182095
|
+
"data-testid": "terreiro-search-query",
|
|
182096
|
+
}, sx: {
|
|
182097
|
+
fontSize: 16,
|
|
182098
|
+
color: "text.primary",
|
|
182099
|
+
"& input::placeholder": { color: "text.secondary", opacity: 1 },
|
|
182100
|
+
} }),
|
|
182101
|
+
query ? (React$1.createElement(IconButton$1, { type: "button", "aria-label": "Limpar busca", onClick: () => onQueryChange(""), sx: { width: 44, height: 44, flexShrink: 0, color: "text.primary" } },
|
|
182102
|
+
React$1.createElement(Close$1, null))) : null),
|
|
182103
|
+
React$1.createElement(IconButton$1, { type: "submit", "aria-label": "Buscar", disabled: !canSearch, "data-testid": "terreiro-search-submit", onClick: (event) => {
|
|
182104
|
+
event.preventDefault();
|
|
182105
|
+
if (canSearch)
|
|
182106
|
+
onSearch(trimmedQuery);
|
|
182107
|
+
}, sx: Object.assign({ width: 44, height: 44, flexShrink: 0, bgcolor: "primary.main", color: "primary.contrastText", boxShadow: floatingControlShadow, "&:hover": { bgcolor: "primary.dark" }, "&.Mui-disabled": {
|
|
182108
|
+
bgcolor: (muiTheme) => alpha(muiTheme.palette.primary.main, 0.38),
|
|
182109
|
+
color: "primary.contrastText",
|
|
182110
|
+
} }, focusRing) },
|
|
182111
|
+
React$1.createElement(Search$1, null))),
|
|
182112
|
+
React$1.createElement(Box$1, { role: "group", "aria-label": "Tradi\u00E7\u00F5es", sx: {
|
|
182113
|
+
display: "flex",
|
|
182114
|
+
gap: 1,
|
|
182115
|
+
overflowX: "auto",
|
|
182116
|
+
scrollbarWidth: "none",
|
|
182117
|
+
"&::-webkit-scrollbar": { display: "none" },
|
|
182118
|
+
} }, TRADITIONS.map((tradition) => {
|
|
182119
|
+
const pressed = traditionPressed(query, tradition);
|
|
182120
|
+
return (React$1.createElement(Button$1, { key: tradition, type: "button", variant: "outlined", "aria-pressed": pressed, onClick: () => submitTradition(tradition), sx: {
|
|
182121
|
+
flexShrink: 0,
|
|
182122
|
+
minHeight: 44,
|
|
182123
|
+
px: 2,
|
|
182124
|
+
borderRadius: RADIUS.pill,
|
|
182125
|
+
textTransform: "none",
|
|
182126
|
+
fontWeight: 600,
|
|
182127
|
+
bgcolor: "background.paper",
|
|
182128
|
+
borderColor: pressed ? "primary.main" : "divider",
|
|
182129
|
+
color: pressed ? "primary.main" : "text.primary",
|
|
182130
|
+
"&:hover": {
|
|
182131
|
+
bgcolor: "background.paper",
|
|
182132
|
+
borderColor: pressed ? "primary.main" : "divider",
|
|
182133
|
+
},
|
|
182134
|
+
} }, tradition));
|
|
182135
|
+
})),
|
|
182136
|
+
React$1.createElement(Button$1, { type: "button", variant: "outlined", "aria-expanded": locationOpen, "aria-haspopup": "dialog", onClick: () => setLocationOpen(true), startIcon: locationMode === "geolocation" ? React$1.createElement(MyLocation, null) : React$1.createElement(PlaceOutlined, null), sx: {
|
|
182137
|
+
alignSelf: "flex-start",
|
|
182138
|
+
minHeight: 44,
|
|
182139
|
+
maxWidth: "100%",
|
|
182140
|
+
borderRadius: RADIUS.pill,
|
|
182141
|
+
textTransform: "none",
|
|
182142
|
+
fontWeight: 600,
|
|
182143
|
+
bgcolor: "background.paper",
|
|
182144
|
+
borderColor: "divider",
|
|
182145
|
+
color: "text.primary",
|
|
182146
|
+
"&:hover": { bgcolor: "background.paper", borderColor: "divider" },
|
|
182147
|
+
} }, locationLabel),
|
|
182148
|
+
!locationOpen ? notice : null)),
|
|
182149
|
+
React$1.createElement(GenericDrawer, { open: locationOpen, onClose: () => setLocationOpen(false), "aria-label": "Local da busca" }, locationOpen ? (React$1.createElement(Stack$1, { spacing: 2, sx: { px: 2, pb: 3 } },
|
|
182150
|
+
React$1.createElement(Typography$1, { sx: { fontSize: 16, fontWeight: 800 } }, "Onde buscar"),
|
|
182151
|
+
(googleMapsApiKey === null || googleMapsApiKey === void 0 ? void 0 : googleMapsApiKey.trim()) && !addressSearchUnavailable ? (React$1.createElement(TerreiroLocationSearch, { apiKey: googleMapsApiKey.trim(), onUnavailable: () => setAddressSearchUnavailable(true), onSelect: (nextCity, nextState) => {
|
|
182152
|
+
onCityChange(nextCity);
|
|
182153
|
+
onStateChange(nextState);
|
|
182154
|
+
setLocationOpen(false);
|
|
182155
|
+
} })) : (React$1.createElement(Stack$1, { direction: "row", spacing: 1 },
|
|
182156
|
+
React$1.createElement(TextField$1, { label: "Cidade", value: city, onChange: (event) => onCityChange(event.target.value), inputProps: { "data-testid": "terreiro-search-city" }, fullWidth: true, sx: {
|
|
182157
|
+
"& .MuiInputBase-input": { color: "text.primary" },
|
|
182158
|
+
"& .MuiInputBase-input::placeholder": { color: "text.secondary", opacity: 1 },
|
|
182159
|
+
} }),
|
|
182160
|
+
React$1.createElement(TextField$1, { label: "UF", value: state, onChange: (event) => onStateChange(event.target.value.toUpperCase().slice(0, 2)), inputProps: { maxLength: 2, "data-testid": "terreiro-search-state" }, sx: {
|
|
182161
|
+
width: 88,
|
|
182162
|
+
"& .MuiInputBase-input": { color: "text.primary" },
|
|
182163
|
+
} }))),
|
|
182164
|
+
React$1.createElement(Button$1, { type: "button", variant: "text", onClick: onUseMyLocation, disabled: isLocating || isLoading, "data-testid": "terreiro-search-geolocation", sx: { alignSelf: "flex-start", minHeight: 44, fontWeight: 700, color: "text.primary" } }, isLocating ? "Buscando localização..." : "Usar minha localização"),
|
|
182165
|
+
notice)) : null)));
|
|
182166
|
+
};
|
|
182167
|
+
|
|
181420
182168
|
/**
|
|
181421
182169
|
* Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various
|
|
181422
182170
|
* credential response ArrayBuffers to string for sending back to the server as JSON.
|
|
@@ -195061,6 +195809,7 @@ exports.MoonZodiacSchema = MoonZodiacSchema;
|
|
|
195061
195809
|
exports.MyPermissionsDetailedSchema = MyPermissionsDetailedSchema;
|
|
195062
195810
|
exports.MyPermissionsPage = MyPermissionsPage;
|
|
195063
195811
|
exports.MyPermissionsPagePropsSchema = MyPermissionsPagePropsSchema;
|
|
195812
|
+
exports.NearbyTerreiroSearchPage = NearbyTerreiroSearchPage;
|
|
195064
195813
|
exports.NotFoundPage = NotFoundPage;
|
|
195065
195814
|
exports.NotificationSettingsPage = NotificationSettingsPage;
|
|
195066
195815
|
exports.NotificationSettingsPagePropsSchema = NotificationSettingsPagePropsSchema;
|