@beabee/beabee-common 1.13.3 → 1.13.5

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.
@@ -4,7 +4,9 @@ exports.stringifyAnswer = exports.isFileUploadAnswer = exports.isAddressAnswer =
4
4
  function flattenComponents(components) {
5
5
  return components.flatMap((component) => [
6
6
  component,
7
- ...flattenComponents(component.components || []),
7
+ ...flattenComponents(
8
+ // Addresses have embedded components we don't want in our component list
9
+ (component.type !== "address" && component.components) || []),
8
10
  ]);
9
11
  }
10
12
  exports.flattenComponents = flattenComponents;
@@ -74,7 +76,7 @@ function stringifyAnswer(component, answer) {
74
76
  return "";
75
77
  }
76
78
  else if (isAddressAnswer(answer)) {
77
- return `${answer.geometry.location.lat}, ${answer.geometry.location.lng}`;
79
+ return answer.formatted_address;
78
80
  }
79
81
  else if (isFileUploadAnswer(answer)) {
80
82
  return answer.url;
@@ -1,7 +1,9 @@
1
1
  export function flattenComponents(components) {
2
2
  return components.flatMap((component) => [
3
3
  component,
4
- ...flattenComponents(component.components || []),
4
+ ...flattenComponents(
5
+ // Addresses have embedded components we don't want in our component list
6
+ (component.type !== "address" && component.components) || []),
5
7
  ]);
6
8
  }
7
9
  function convertValuesToOptions(values) {
@@ -67,7 +69,7 @@ export function stringifyAnswer(component, answer) {
67
69
  return "";
68
70
  }
69
71
  else if (isAddressAnswer(answer)) {
70
- return `${answer.geometry.location.lat}, ${answer.geometry.location.lng}`;
72
+ return answer.formatted_address;
71
73
  }
72
74
  else if (isFileUploadAnswer(answer)) {
73
75
  return answer.url;
@@ -6,7 +6,7 @@ export interface BaseCalloutComponentSchema {
6
6
  [key: string]: unknown;
7
7
  }
8
8
  export interface OtherCalloutComponentSchema extends BaseCalloutComponentSchema {
9
- type: "address" | "button" | "checkbox" | "email" | "number" | "password" | "textfield" | "textarea";
9
+ type: "address" | "button" | "checkbox" | "email" | "file" | "number" | "password" | "textfield" | "textarea";
10
10
  }
11
11
  export interface SelectCalloutComponentSchema extends BaseCalloutComponentSchema {
12
12
  type: "select";
@@ -29,6 +29,7 @@ export interface CalloutFormSchema {
29
29
  components: CalloutComponentSchema[];
30
30
  }
31
31
  export interface CalloutResponseAnswerAddress {
32
+ formatted_address: string;
32
33
  geometry: {
33
34
  location: {
34
35
  lat: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beabee/beabee-common",
3
- "version": "1.13.3",
3
+ "version": "1.13.5",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",