@beabee/beabee-common 1.18.0-alpha.6 → 1.18.0-alpha.7

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.
@@ -66,12 +66,17 @@ function filterComponents(components, filterFn) {
66
66
  }
67
67
  exports.filterComponents = filterComponents;
68
68
  function getCalloutComponents(formSchema) {
69
- return formSchema.slides.flatMap((slide) => flattenComponents(slide.components));
69
+ return formSchema.slides.flatMap((slide) => flattenComponents(slide.components).map((component) => ({
70
+ ...component,
71
+ slideId: slide.id,
72
+ })));
70
73
  }
71
74
  exports.getCalloutComponents = getCalloutComponents;
72
75
  function getCalloutFilters(formSchema) {
73
76
  const items = formSchema.slides.flatMap((slide) => {
74
- return slide.components.map((c) => {
77
+ return flattenComponents(slide.components)
78
+ .filter((c) => c.input)
79
+ .map((c) => {
75
80
  return [
76
81
  `answers.${slide.id}.${c.key}`,
77
82
  convertComponentToFilter(c),
@@ -61,11 +61,16 @@ export function filterComponents(components, filterFn) {
61
61
  });
62
62
  }
63
63
  export function getCalloutComponents(formSchema) {
64
- return formSchema.slides.flatMap((slide) => flattenComponents(slide.components));
64
+ return formSchema.slides.flatMap((slide) => flattenComponents(slide.components).map((component) => ({
65
+ ...component,
66
+ slideId: slide.id,
67
+ })));
65
68
  }
66
69
  export function getCalloutFilters(formSchema) {
67
70
  const items = formSchema.slides.flatMap((slide) => {
68
- return slide.components.map((c) => {
71
+ return flattenComponents(slide.components)
72
+ .filter((c) => c.input)
73
+ .map((c) => {
69
74
  return [
70
75
  `answers.${slide.id}.${c.key}`,
71
76
  convertComponentToFilter(c),
@@ -3,7 +3,9 @@ import { FilterArgs } from "../search";
3
3
  import { CalloutResponseAnswerAddress, CalloutResponseAnswerFileUpload } from "../data/callouts";
4
4
  export declare function flattenComponents(components: CalloutComponentSchema[]): CalloutComponentSchema[];
5
5
  export declare function filterComponents(components: CalloutComponentSchema[], filterFn: (component: CalloutComponentSchema) => boolean): CalloutComponentSchema[];
6
- export declare function getCalloutComponents(formSchema: CalloutFormSchema): CalloutComponentSchema[];
6
+ export declare function getCalloutComponents(formSchema: CalloutFormSchema): (CalloutComponentSchema & {
7
+ slideId: string;
8
+ })[];
7
9
  export declare function getCalloutFilters(formSchema: CalloutFormSchema): Record<string, FilterArgs & {
8
10
  label: string;
9
11
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beabee/beabee-common",
3
- "version": "1.18.0-alpha.6",
3
+ "version": "1.18.0-alpha.7",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",