@211la/search-react 0.9.0 → 0.11.0
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/index.js
CHANGED
|
@@ -457,4 +457,41 @@ var TaxonomyRefinementList = connectTaxonomyRefinementList(function (_a) {
|
|
|
457
457
|
React__default.createElement("span", { className: "ais-RefinementList-labelText" }, item.label))); }))));
|
|
458
458
|
});
|
|
459
459
|
|
|
460
|
-
|
|
460
|
+
var connectOpenCloseHours = createConnector({
|
|
461
|
+
displayName: 'ConnectOpenCloseHours',
|
|
462
|
+
getProvidedProps: function (props, searchState) {
|
|
463
|
+
var currentRefinement = {
|
|
464
|
+
openNow: searchState.openNow || false,
|
|
465
|
+
openAtDay: searchState.openAtDay || undefined,
|
|
466
|
+
openAtMinute: searchState.openAtMinute || undefined,
|
|
467
|
+
};
|
|
468
|
+
return __assign({ currentRefinement: currentRefinement }, props);
|
|
469
|
+
},
|
|
470
|
+
refine: function (props, searchState, nextRefinement) {
|
|
471
|
+
var openNow = nextRefinement.openNow, openAtDay = nextRefinement.openAtDay, openAtMinute = nextRefinement.openAtMinute;
|
|
472
|
+
var now = new Date();
|
|
473
|
+
var day = now.getDay();
|
|
474
|
+
var hours = now.getHours();
|
|
475
|
+
var minutes = now.getMinutes();
|
|
476
|
+
var totalMinutes = (hours * 60) + minutes;
|
|
477
|
+
return __assign(__assign({}, searchState), { openNow: openNow, openAtDay: openNow ? (openAtDay || day) : undefined, openAtMinute: openNow ? (openAtMinute || totalMinutes) : undefined });
|
|
478
|
+
},
|
|
479
|
+
getSearchParameters: function (searchParameters, props, searchState) {
|
|
480
|
+
var params = searchParameters.setQueryParameters({
|
|
481
|
+
openNow: searchState.openNow,
|
|
482
|
+
});
|
|
483
|
+
if (searchState.openNow) {
|
|
484
|
+
return params.setQueryParameters({
|
|
485
|
+
openAtDay: searchState.openAtDay,
|
|
486
|
+
openAtMinute: searchState.openAtMinute
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
return params;
|
|
490
|
+
},
|
|
491
|
+
cleanUp: function (props, searchState) {
|
|
492
|
+
searchState.openNow; searchState.openAtDay; searchState.openAtMinute; var nextSearchState = __rest(searchState, ["openNow", "openAtDay", "openAtMinute"]);
|
|
493
|
+
return nextSearchState;
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
export { ExactNumberFieldSearch, ExactStringFieldSearch, LocationDistanceFilter, PlaceAutocomplete, SearchBoxFields, StringFieldSearch, TaxonomyRefinementList, connectExactNumberFieldSearch, connectExactStringFieldSearch, connectGeolocation, connectMap, connectOpenCloseHours, connectResources, connectSearchBoxFields, connectStringFieldSearch, connectTaxonomyRefinementList, makeConnectFieldSearch };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const connectOpenCloseHours: ((stateless: import("react").FunctionComponent<any>) => import("react").ComponentClass<any, any>) & (<TProps extends Partial<any>>(Composed: import("react").ComponentType<TProps>) => import("react-instantsearch-core").ConnectedComponentClass<TProps, any, any>);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { ExactStringFieldSearch } from './ExactStringFieldSearch';
|
|
|
11
11
|
export { ExactNumberFieldSearch } from './ExactNumberFieldSearch';
|
|
12
12
|
export { connectTaxonomyRefinementList } from './taxonomyRefinementList/connectTaxonomyRefinementList';
|
|
13
13
|
export { TaxonomyRefinementList } from './taxonomyRefinementList/TaxonomyRefinementList';
|
|
14
|
+
export { connectOpenCloseHours } from './connectOpenCloseHours';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@211la/search-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"typescript": "^4.0.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@211la/search-client": "^0.
|
|
36
|
+
"@211la/search-client": "^0.11.0",
|
|
37
37
|
"react": ">=16.8.0",
|
|
38
38
|
"react-dom": ">=16.8.0",
|
|
39
39
|
"react-instantsearch-core": ">=6.11.1",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"url": "git+https://github.com/211la/cs-search-widget.git",
|
|
45
45
|
"directory": "react"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|