@trackunit/filters-filter-bar 0.0.341 → 0.0.342
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/index.cjs.js +8 -9
- package/index.esm.js +8 -9
- package/package.json +1 -1
- package/src/lib/utils/FilterEvents.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -439,11 +439,10 @@ const ResetFiltersButton = ({ filtersHaveBeenApplied, resetFiltersToInitialState
|
|
|
439
439
|
* which properties are required/recommended when using logEvent() on said event
|
|
440
440
|
*/
|
|
441
441
|
const FilterEvents = {
|
|
442
|
-
|
|
443
|
-
amplitudeName: "Filters Applied - V2",
|
|
442
|
+
"Filters Applied - V2": reactCoreContextsApi.createEvent({
|
|
444
443
|
description: "A filter was applied",
|
|
445
444
|
}),
|
|
446
|
-
|
|
445
|
+
"Starring Filter - Toggled": reactCoreContextsApi.createEvent(),
|
|
447
446
|
};
|
|
448
447
|
|
|
449
448
|
/**
|
|
@@ -472,14 +471,14 @@ const StarredFiltersMenu = ({ filterBarDefinition, updateStarredFilters, starred
|
|
|
472
471
|
return (jsxRuntime.jsxs("div", { className: "mb-2", children: [jsxRuntime.jsx("div", { className: "mt-2 mb-1 flex px-2", children: jsxRuntime.jsx(reactComponents.Text, { dataTestId: "starred-filters-group-title", size: "small", subtle: true, uppercase: true, weight: "bold", children: group.key }) }), group.filters.map(filter => {
|
|
473
472
|
return (jsxRuntime.jsxs("div", { className: "flex w-full cursor-pointer items-center justify-between rounded-sm py-0 px-2 transition hover:bg-neutral-50", "data-testid": `${filter.filterKey}-star-filter`, onClick: () => {
|
|
474
473
|
updateStarredFilters(filter.filterKey);
|
|
475
|
-
logEvent("
|
|
474
|
+
logEvent("Starring Filter - Toggled", {
|
|
476
475
|
type: filter.filterKey,
|
|
477
476
|
});
|
|
478
477
|
}, children: [jsxRuntime.jsx(reactComponents.Text, { weight: "thick", children: filter.title }), jsxRuntime.jsx(reactComponents.StarButton, { onClick: e => {
|
|
479
478
|
e.preventDefault();
|
|
480
479
|
e.stopPropagation();
|
|
481
480
|
updateStarredFilters(filter.filterKey);
|
|
482
|
-
logEvent("
|
|
481
|
+
logEvent("Starring Filter - Toggled", {
|
|
483
482
|
type: filter.filterKey,
|
|
484
483
|
});
|
|
485
484
|
}, starred: starredFilterKeys.includes(filter.filterKey) })] }, filter.filterKey));
|
|
@@ -615,7 +614,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
615
614
|
const [undefinedCount, setUndefinedCount] = react.useState(null);
|
|
616
615
|
const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
|
|
617
616
|
const handleClick = (value) => {
|
|
618
|
-
logEvent("
|
|
617
|
+
logEvent("Filters Applied - V2", {
|
|
619
618
|
type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
|
|
620
619
|
value: value.key,
|
|
621
620
|
});
|
|
@@ -723,7 +722,7 @@ const DefaultDateRangeFilter = ({ filterDefinition, filterName, value, setValue,
|
|
|
723
722
|
};
|
|
724
723
|
const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
|
|
725
724
|
const handleApply = (fromDateValue, toDateValue) => {
|
|
726
|
-
logEvent("
|
|
725
|
+
logEvent("Filters Applied - V2", {
|
|
727
726
|
type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
|
|
728
727
|
value: JSON.stringify({ from: fromDateValue, to: toDateValue }),
|
|
729
728
|
});
|
|
@@ -756,7 +755,7 @@ const DefaultMinMaxFilter = ({ filterDefinition, filterName, value, setValue, fi
|
|
|
756
755
|
const handleApply = () => {
|
|
757
756
|
const realMinValue = minValue === 0 ? undefined : minValue !== null && minValue !== void 0 ? minValue : undefined;
|
|
758
757
|
const realMaxValue = maxValue === 0 ? undefined : maxValue !== null && maxValue !== void 0 ? maxValue : undefined;
|
|
759
|
-
logEvent("
|
|
758
|
+
logEvent("Filters Applied - V2", {
|
|
760
759
|
type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
|
|
761
760
|
value: JSON.stringify({ min: realMinValue, max: realMaxValue }),
|
|
762
761
|
});
|
|
@@ -781,7 +780,7 @@ const DefaultRadioFilter = ({ filterDefinition, filterBarActions, options, loadi
|
|
|
781
780
|
const { key, label } = (_a = filteredOptions.find(({ key: id }) => id === selectedId)) !== null && _a !== void 0 ? _a : {};
|
|
782
781
|
if (key && label) {
|
|
783
782
|
filterBarActions.setArrayObjectValue(filterDefinition.filterKey, [{ value: key, name: label }]);
|
|
784
|
-
logEvent("
|
|
783
|
+
logEvent("Filters Applied - V2", {
|
|
785
784
|
type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
|
|
786
785
|
value: String(label),
|
|
787
786
|
});
|
package/index.esm.js
CHANGED
|
@@ -431,11 +431,10 @@ const ResetFiltersButton = ({ filtersHaveBeenApplied, resetFiltersToInitialState
|
|
|
431
431
|
* which properties are required/recommended when using logEvent() on said event
|
|
432
432
|
*/
|
|
433
433
|
const FilterEvents = {
|
|
434
|
-
|
|
435
|
-
amplitudeName: "Filters Applied - V2",
|
|
434
|
+
"Filters Applied - V2": createEvent({
|
|
436
435
|
description: "A filter was applied",
|
|
437
436
|
}),
|
|
438
|
-
|
|
437
|
+
"Starring Filter - Toggled": createEvent(),
|
|
439
438
|
};
|
|
440
439
|
|
|
441
440
|
/**
|
|
@@ -464,14 +463,14 @@ const StarredFiltersMenu = ({ filterBarDefinition, updateStarredFilters, starred
|
|
|
464
463
|
return (jsxs("div", { className: "mb-2", children: [jsx("div", { className: "mt-2 mb-1 flex px-2", children: jsx(Text, { dataTestId: "starred-filters-group-title", size: "small", subtle: true, uppercase: true, weight: "bold", children: group.key }) }), group.filters.map(filter => {
|
|
465
464
|
return (jsxs("div", { className: "flex w-full cursor-pointer items-center justify-between rounded-sm py-0 px-2 transition hover:bg-neutral-50", "data-testid": `${filter.filterKey}-star-filter`, onClick: () => {
|
|
466
465
|
updateStarredFilters(filter.filterKey);
|
|
467
|
-
logEvent("
|
|
466
|
+
logEvent("Starring Filter - Toggled", {
|
|
468
467
|
type: filter.filterKey,
|
|
469
468
|
});
|
|
470
469
|
}, children: [jsx(Text, { weight: "thick", children: filter.title }), jsx(StarButton, { onClick: e => {
|
|
471
470
|
e.preventDefault();
|
|
472
471
|
e.stopPropagation();
|
|
473
472
|
updateStarredFilters(filter.filterKey);
|
|
474
|
-
logEvent("
|
|
473
|
+
logEvent("Starring Filter - Toggled", {
|
|
475
474
|
type: filter.filterKey,
|
|
476
475
|
});
|
|
477
476
|
}, starred: starredFilterKeys.includes(filter.filterKey) })] }, filter.filterKey));
|
|
@@ -607,7 +606,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
607
606
|
const [undefinedCount, setUndefinedCount] = useState(null);
|
|
608
607
|
const { logEvent } = useAnalytics(FilterEvents);
|
|
609
608
|
const handleClick = (value) => {
|
|
610
|
-
logEvent("
|
|
609
|
+
logEvent("Filters Applied - V2", {
|
|
611
610
|
type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
|
|
612
611
|
value: value.key,
|
|
613
612
|
});
|
|
@@ -715,7 +714,7 @@ const DefaultDateRangeFilter = ({ filterDefinition, filterName, value, setValue,
|
|
|
715
714
|
};
|
|
716
715
|
const { logEvent } = useAnalytics(FilterEvents);
|
|
717
716
|
const handleApply = (fromDateValue, toDateValue) => {
|
|
718
|
-
logEvent("
|
|
717
|
+
logEvent("Filters Applied - V2", {
|
|
719
718
|
type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
|
|
720
719
|
value: JSON.stringify({ from: fromDateValue, to: toDateValue }),
|
|
721
720
|
});
|
|
@@ -748,7 +747,7 @@ const DefaultMinMaxFilter = ({ filterDefinition, filterName, value, setValue, fi
|
|
|
748
747
|
const handleApply = () => {
|
|
749
748
|
const realMinValue = minValue === 0 ? undefined : minValue !== null && minValue !== void 0 ? minValue : undefined;
|
|
750
749
|
const realMaxValue = maxValue === 0 ? undefined : maxValue !== null && maxValue !== void 0 ? maxValue : undefined;
|
|
751
|
-
logEvent("
|
|
750
|
+
logEvent("Filters Applied - V2", {
|
|
752
751
|
type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
|
|
753
752
|
value: JSON.stringify({ min: realMinValue, max: realMaxValue }),
|
|
754
753
|
});
|
|
@@ -773,7 +772,7 @@ const DefaultRadioFilter = ({ filterDefinition, filterBarActions, options, loadi
|
|
|
773
772
|
const { key, label } = (_a = filteredOptions.find(({ key: id }) => id === selectedId)) !== null && _a !== void 0 ? _a : {};
|
|
774
773
|
if (key && label) {
|
|
775
774
|
filterBarActions.setArrayObjectValue(filterDefinition.filterKey, [{ value: key, name: label }]);
|
|
776
|
-
logEvent("
|
|
775
|
+
logEvent("Filters Applied - V2", {
|
|
777
776
|
type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
|
|
778
777
|
value: String(label),
|
|
779
778
|
});
|
package/package.json
CHANGED
|
@@ -12,6 +12,6 @@ export interface FilterEvent extends BaseEvent {
|
|
|
12
12
|
* which properties are required/recommended when using logEvent() on said event
|
|
13
13
|
*/
|
|
14
14
|
export declare const FilterEvents: {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
"Filters Applied - V2": import("@trackunit/react-core-contexts-api").Event<FilterEvent>;
|
|
16
|
+
"Starring Filter - Toggled": import("@trackunit/react-core-contexts-api").Event<import("@trackunit/react-core-contexts-api").AdditionalProperties>;
|
|
17
17
|
};
|