@beabee/beabee-common 1.13.6 → 1.13.8

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.
@@ -20,9 +20,11 @@ exports.calloutFilters = {
20
20
  },
21
21
  starts: {
22
22
  type: "date",
23
+ nullable: true,
23
24
  },
24
25
  expires: {
25
26
  type: "date",
27
+ nullable: true,
26
28
  },
27
29
  hidden: {
28
30
  type: "boolean",
@@ -20,6 +20,7 @@ exports.contactFilters = {
20
20
  },
21
21
  contributionCancelled: {
22
22
  type: "date",
23
+ nullable: true,
23
24
  },
24
25
  contributionType: {
25
26
  type: "enum",
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyAnswer = exports.isFileUploadAnswer = exports.isAddressAnswer = exports.convertComponentsToFilters = exports.flattenComponents = void 0;
3
+ exports.stringifyAnswer = exports.isFileUploadAnswer = exports.isAddressAnswer = exports.convertComponentsToFilters = exports.flattenComponents = exports.filterComponents = void 0;
4
+ function filterComponents(components, filterFn) {
5
+ return components.filter(filterFn).map((component) => {
6
+ return {
7
+ ...component,
8
+ ...(component.components && {
9
+ components: filterComponents(component.components, filterFn),
10
+ }),
11
+ };
12
+ });
13
+ }
14
+ exports.filterComponents = filterComponents;
4
15
  function flattenComponents(components) {
5
16
  return components.flatMap((component) => [
6
17
  component,
@@ -17,9 +17,11 @@ export const calloutFilters = {
17
17
  },
18
18
  starts: {
19
19
  type: "date",
20
+ nullable: true,
20
21
  },
21
22
  expires: {
22
23
  type: "date",
24
+ nullable: true,
23
25
  },
24
26
  hidden: {
25
27
  type: "boolean",
@@ -17,6 +17,7 @@ export const contactFilters = {
17
17
  },
18
18
  contributionCancelled: {
19
19
  type: "date",
20
+ nullable: true,
20
21
  },
21
22
  contributionType: {
22
23
  type: "enum",
@@ -1,3 +1,13 @@
1
+ export function filterComponents(components, filterFn) {
2
+ return components.filter(filterFn).map((component) => {
3
+ return {
4
+ ...component,
5
+ ...(component.components && {
6
+ components: filterComponents(component.components, filterFn),
7
+ }),
8
+ };
9
+ });
10
+ }
1
11
  export function flattenComponents(components) {
2
12
  return components.flatMap((component) => [
3
13
  component,
@@ -12,9 +12,11 @@ export declare const calloutFilters: {
12
12
  };
13
13
  readonly starts: {
14
14
  readonly type: "date";
15
+ readonly nullable: true;
15
16
  };
16
17
  readonly expires: {
17
18
  readonly type: "date";
19
+ readonly nullable: true;
18
20
  };
19
21
  readonly hidden: {
20
22
  readonly type: "boolean";
@@ -17,6 +17,7 @@ export declare const contactFilters: {
17
17
  };
18
18
  readonly contributionCancelled: {
19
19
  readonly type: "date";
20
+ readonly nullable: true;
20
21
  };
21
22
  readonly contributionType: {
22
23
  readonly type: "enum";
@@ -1,5 +1,6 @@
1
1
  import { CalloutComponentSchema, CalloutResponseAnswer, CalloutResponseAnswerAddress, CalloutResponseAnswerFileUpload } from "../data/callouts";
2
2
  import { FilterArgs } from "../search";
3
+ export declare function filterComponents(components: CalloutComponentSchema[], filterFn: (component: CalloutComponentSchema) => boolean): CalloutComponentSchema[];
3
4
  export declare function flattenComponents(components: CalloutComponentSchema[]): CalloutComponentSchema[];
4
5
  export declare function convertComponentsToFilters(components: CalloutComponentSchema[]): Record<string, FilterArgs & {
5
6
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beabee/beabee-common",
3
- "version": "1.13.6",
3
+ "version": "1.13.8",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",