swoop-common 2.0.28 → 2.0.30

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.
@@ -7,9 +7,10 @@ export type DTOComponentCreate = {
7
7
  componentFields: Array<Field>;
8
8
  partners: Array<string>;
9
9
  details: ComponentDetails;
10
- bundle: Bundle;
10
+ bundle?: Bundle;
11
11
  startDate?: string | null;
12
12
  endDate?: string | null;
13
13
  duration?: number | null;
14
14
  state: string;
15
+ templateId?: string;
15
16
  };
@@ -13,7 +13,7 @@ export type DTOComponentRead = {
13
13
  componentFields: Array<Field>;
14
14
  partners: Array<string>;
15
15
  details: ComponentDetails;
16
- bundle: Bundle;
16
+ bundle?: Bundle;
17
17
  startDate?: string | null;
18
18
  endDate?: string | null;
19
19
  duration?: number | null;
@@ -2,13 +2,13 @@ import type { Bundle } from './Bundle';
2
2
  import type { ComponentDetails } from './ComponentDetails';
3
3
  import type { Field } from './Field';
4
4
  export type DTOComponentUpdate = {
5
- name: string;
6
- componentFields: Array<Field>;
7
- partners: Array<string>;
8
- details: ComponentDetails;
9
- bundle: Bundle;
5
+ name?: string;
6
+ componentFields?: Array<Field>;
7
+ partners?: Array<string>;
8
+ details?: ComponentDetails;
9
+ bundle?: Bundle;
10
10
  startDate?: string | null;
11
11
  endDate?: string | null;
12
12
  duration?: number | null;
13
- state: string;
13
+ state?: string;
14
14
  };
@@ -1,7 +1,7 @@
1
1
  import type { ComponentInstance } from './ComponentInstance';
2
2
  import type { Fee } from './Fee';
3
3
  export type DTOItineraryCreate = {
4
- enquirerId: string;
4
+ enquiryId: string;
5
5
  title: string;
6
6
  componentInstances: Array<ComponentInstance>;
7
7
  fees: Array<Fee>;
@@ -3,7 +3,7 @@ import type { Fee } from './Fee';
3
3
  import type { Metadata } from './Metadata';
4
4
  export type DTOItineraryEntity = {
5
5
  id: string;
6
- enquirerId: string;
6
+ enquiryId: string;
7
7
  metadata: Metadata;
8
8
  title: string;
9
9
  componentInstances: Array<ComponentInstance>;
@@ -3,7 +3,7 @@ import type { Fee } from './Fee';
3
3
  import type { Metadata } from './Metadata';
4
4
  export type DTOItineraryRead = {
5
5
  id: string;
6
- enquirerId: string;
6
+ enquiryId: string;
7
7
  metadata: Metadata;
8
8
  title: string;
9
9
  componentInstances: Array<ComponentInstance>;
@@ -1,7 +1,7 @@
1
1
  import type { ComponentInstance } from './ComponentInstance';
2
2
  import type { Fee } from './Fee';
3
3
  export type DTOItineraryUpdate = {
4
- enquirerId: string;
4
+ enquiryId: string;
5
5
  title: string;
6
6
  componentInstances: Array<ComponentInstance>;
7
7
  fees: Array<Fee>;
@@ -7,9 +7,10 @@ export type DTOComponentCreate = {
7
7
  componentFields: Array<Field>;
8
8
  partners: Array<string>;
9
9
  details: ComponentDetails;
10
- bundle: Bundle;
10
+ bundle?: Bundle;
11
11
  startDate?: string | null;
12
12
  endDate?: string | null;
13
13
  duration?: number | null;
14
14
  state: string;
15
+ templateId?: string;
15
16
  };
@@ -13,7 +13,7 @@ export type DTOComponentRead = {
13
13
  componentFields: Array<Field>;
14
14
  partners: Array<string>;
15
15
  details: ComponentDetails;
16
- bundle: Bundle;
16
+ bundle?: Bundle;
17
17
  startDate?: string | null;
18
18
  endDate?: string | null;
19
19
  duration?: number | null;
@@ -2,13 +2,13 @@ import type { Bundle } from './Bundle';
2
2
  import type { ComponentDetails } from './ComponentDetails';
3
3
  import type { Field } from './Field';
4
4
  export type DTOComponentUpdate = {
5
- name: string;
6
- componentFields: Array<Field>;
7
- partners: Array<string>;
8
- details: ComponentDetails;
9
- bundle: Bundle;
5
+ name?: string;
6
+ componentFields?: Array<Field>;
7
+ partners?: Array<string>;
8
+ details?: ComponentDetails;
9
+ bundle?: Bundle;
10
10
  startDate?: string | null;
11
11
  endDate?: string | null;
12
12
  duration?: number | null;
13
- state: string;
13
+ state?: string;
14
14
  };
@@ -1,7 +1,7 @@
1
1
  import type { ComponentInstance } from './ComponentInstance';
2
2
  import type { Fee } from './Fee';
3
3
  export type DTOItineraryCreate = {
4
- enquirerId: string;
4
+ enquiryId: string;
5
5
  title: string;
6
6
  componentInstances: Array<ComponentInstance>;
7
7
  fees: Array<Fee>;
@@ -3,7 +3,7 @@ import type { Fee } from './Fee';
3
3
  import type { Metadata } from './Metadata';
4
4
  export type DTOItineraryEntity = {
5
5
  id: string;
6
- enquirerId: string;
6
+ enquiryId: string;
7
7
  metadata: Metadata;
8
8
  title: string;
9
9
  componentInstances: Array<ComponentInstance>;
@@ -3,7 +3,7 @@ import type { Fee } from './Fee';
3
3
  import type { Metadata } from './Metadata';
4
4
  export type DTOItineraryRead = {
5
5
  id: string;
6
- enquirerId: string;
6
+ enquiryId: string;
7
7
  metadata: Metadata;
8
8
  title: string;
9
9
  componentInstances: Array<ComponentInstance>;
@@ -1,7 +1,7 @@
1
1
  import type { ComponentInstance } from './ComponentInstance';
2
2
  import type { Fee } from './Fee';
3
3
  export type DTOItineraryUpdate = {
4
- enquirerId: string;
4
+ enquiryId: string;
5
5
  title: string;
6
6
  componentInstances: Array<ComponentInstance>;
7
7
  fees: Array<Fee>;
@@ -17,7 +17,7 @@ interface BaseProps {
17
17
  * Dictates which mode the form will display in.
18
18
  * Each mode has a different pool of renderers.
19
19
  */
20
- pool: ComponentPool;
20
+ pool?: ComponentPool;
21
21
  /**
22
22
  * Whether this form should be readonly.
23
23
  * Has little to no effect if using the presentation pool of components
@@ -11,5 +11,5 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
11
11
  const json = overrideJsonSchema || generateJsonSchema(schema, stage, hideReadonlyFields);
12
12
  const ui = overrideUiSchema || generateUiSchema(schema, stage, hideReadonlyFields);
13
13
  return (React.createElement(ComponentContext, { componentId: hintComponentId, stage: stage },
14
- React.createElement(JsonForms, { onChange: onChange, data: initialData, schema: json, uischema: ui, renderers: [...materialRenderers, ...getComponents(pool)], readonly: readonly, cells: materialCells })));
14
+ React.createElement(JsonForms, { onChange: onChange, data: initialData, schema: json, uischema: ui, renderers: [...materialRenderers, ...(pool && getComponents(pool) || [])], readonly: readonly, cells: materialCells })));
15
15
  };
@@ -12,7 +12,7 @@ export declare const fetchComponents: () => Promise<{
12
12
  componentFields: Array<import("../../api/generated/core").Field>;
13
13
  partners: Array<string>;
14
14
  details: import("../../api/generated/core").ComponentDetails;
15
- bundle: import("../../api/generated/core").Bundle;
15
+ bundle?: import("../../api/generated/core").Bundle;
16
16
  startDate?: string | null;
17
17
  endDate?: string | null;
18
18
  duration?: number | null;
@@ -15,10 +15,7 @@ import { registerComponent } from '../registry/components';
15
15
  import { ComponentPool } from '../registry/types';
16
16
  import { CoreService } from '../../api/generated/core';
17
17
  const FormTemplatePicker = ({ templates, selectedTemplates, onChange, label, enabled }) => {
18
- const selectedValues = templates.filter(t => (Array.isArray(selectedTemplates) ? selectedTemplates : (() => {
19
- console.log("SELECTED TEMPLATES IS NOT ARRAY", selectedTemplates);
20
- return [];
21
- })()).includes(t.id));
18
+ const selectedValues = templates.filter(t => (Array.isArray(selectedTemplates) ? selectedTemplates : [...selectedTemplates]).includes(t.id));
22
19
  return (React.createElement(Paper, { component: "form", sx: { display: 'flex', flexDirection: 'column', gap: 2, p: 2, mb: 1 }, noValidate: true, autoComplete: "off" },
23
20
  React.createElement(Typography, { variant: "h6" }, label),
24
21
  React.createElement(Autocomplete, { multiple: true, options: templates, getOptionLabel: (option) => option.name, getOptionKey: o => o.id, value: selectedValues, onChange: (_, newValue) => {
@@ -26,7 +26,7 @@ export const FORM_BUILDER_JSON_SCHEMA = {
26
26
  items: { $ref: "#/$defs/fieldDefinition" },
27
27
  },
28
28
  },
29
- required: ["name", "formFields"],
29
+ required: ["name", "fields"],
30
30
  $defs: {
31
31
  fieldDefinition: {
32
32
  type: "object",
@@ -12,7 +12,7 @@ export const generateJsonSchema = (formSchema, stage, onlyEditableFields) => {
12
12
  formSchema.forEach((s) => {
13
13
  if (stage < +s.existsFrom)
14
14
  return;
15
- if (onlyEditableFields && !s.editableIn.map(Number).includes(stage))
15
+ if (onlyEditableFields && !(Array.isArray(s.editableIn) ? s.editableIn : []).map(Number).includes(stage))
16
16
  return;
17
17
  const fieldSchema = defaultConverter(s, stage);
18
18
  built.properties[generateFieldId(s.name)] = fieldSchema;
@@ -76,5 +76,5 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
76
76
  ? { "x-templateIds": (_e = field.componentOptions) === null || _e === void 0 ? void 0 : _e.templateIds }
77
77
  : {};
78
78
  let title = omitTitle ? undefined : field.name;
79
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (!isChild && !field.editableIn.map(Number).includes(stage) && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), { required: requiredFields }), (enumOpts && { enum: enumOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties }));
79
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (!isChild && !(Array.isArray(field.editableIn) ? field.editableIn : []).map(Number).includes(stage) && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), { required: requiredFields }), (enumOpts && { enum: enumOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties }));
80
80
  };
@@ -5,7 +5,7 @@ export const generateUiSchema = (formSchema, stage, onlyEditableFields) => {
5
5
  formSchema.forEach((field) => {
6
6
  if (stage < +field.existsFrom)
7
7
  return;
8
- if (onlyEditableFields && !field.editableIn.map(Number).includes(stage))
8
+ if (onlyEditableFields && !(Array.isArray(field.editableIn) ? field.editableIn : []).map(Number).includes(stage))
9
9
  return;
10
10
  uiSchema.elements.push(uiFieldSchemaFromFieldDefinition(field));
11
11
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.0.28",
3
+ "version": "2.0.30",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {