@beabee/beabee-common 1.11.0 → 1.12.1

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertAnswers = exports.stringifyAnswer = exports.convertComponentsToFilters = exports.flattenComponents = void 0;
3
+ exports.stringifyAnswer = exports.convertComponentsToFilters = exports.flattenComponents = void 0;
4
4
  function flattenComponents(components) {
5
5
  return components.flatMap((component) => [
6
6
  component,
@@ -74,13 +74,3 @@ function stringifyAnswer(component, answer) {
74
74
  }
75
75
  }
76
76
  exports.stringifyAnswer = stringifyAnswer;
77
- function convertAnswers(formSchema, answers) {
78
- const validComponents = flattenComponents(formSchema.components).filter((c) => c.input);
79
- const labels = validComponents.map((c) => [c.key, c.label || c.key]);
80
- const values = validComponents.map((c) => [c.key, stringifyAnswer(c, answers[c.key])]);
81
- return {
82
- labels: Object.fromEntries(labels),
83
- values: Object.fromEntries(values),
84
- };
85
- }
86
- exports.convertAnswers = convertAnswers;
@@ -68,12 +68,3 @@ export function stringifyAnswer(component, answer) {
68
68
  return answer.toString();
69
69
  }
70
70
  }
71
- export function convertAnswers(formSchema, answers) {
72
- const validComponents = flattenComponents(formSchema.components).filter((c) => c.input);
73
- const labels = validComponents.map((c) => [c.key, c.label || c.key]);
74
- const values = validComponents.map((c) => [c.key, stringifyAnswer(c, answers[c.key])]);
75
- return {
76
- labels: Object.fromEntries(labels),
77
- values: Object.fromEntries(values),
78
- };
79
- }
@@ -1,9 +1,7 @@
1
- import { CalloutComponentSchema, CalloutFormSchema, CalloutResponseAnswer, CalloutResponseAnswers } from "../data/callouts";
2
- import { Filters } from "../search";
1
+ import { CalloutComponentSchema, CalloutResponseAnswer } from "../data/callouts";
2
+ import { FilterArgs } from "../search";
3
3
  export declare function flattenComponents(components: CalloutComponentSchema[]): CalloutComponentSchema[];
4
- export declare function convertComponentsToFilters(components: CalloutComponentSchema[]): Filters;
4
+ export declare function convertComponentsToFilters(components: CalloutComponentSchema[]): Record<string, FilterArgs & {
5
+ label: string;
6
+ }>;
5
7
  export declare function stringifyAnswer(component: CalloutComponentSchema, answer: CalloutResponseAnswer): string;
6
- export declare function convertAnswers(formSchema: CalloutFormSchema, answers: CalloutResponseAnswers): {
7
- labels: Record<string, string>;
8
- values: Record<string, string>;
9
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beabee/beabee-common",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",