@wise/dynamic-flow-client 4.5.5 → 4.5.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.
Files changed (36) hide show
  1. package/build/main.js +140 -324
  2. package/build/main.mjs +140 -324
  3. package/build/types/revamp/domain/components/AllOfComponent.d.ts +4 -5
  4. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +1 -1
  5. package/build/types/revamp/domain/components/ConstComponent.d.ts +2 -3
  6. package/build/types/revamp/domain/components/ContainerComponent.d.ts +1 -2
  7. package/build/types/revamp/domain/components/DecisionComponent.d.ts +1 -1
  8. package/build/types/revamp/domain/components/FormComponent.d.ts +4 -4
  9. package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -1
  10. package/build/types/revamp/domain/components/InstructionsComponent.d.ts +1 -1
  11. package/build/types/revamp/domain/components/ListComponent.d.ts +1 -1
  12. package/build/types/revamp/domain/components/MarkdownComponent.d.ts +1 -1
  13. package/build/types/revamp/domain/components/ModalContentComponent.d.ts +1 -2
  14. package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +5 -5
  15. package/build/types/revamp/domain/components/ObjectComponent.d.ts +4 -5
  16. package/build/types/revamp/domain/components/RepeatableComponent.d.ts +6 -7
  17. package/build/types/revamp/domain/components/ReviewComponent.d.ts +1 -1
  18. package/build/types/revamp/domain/components/RootDomainComponent.d.ts +5 -2
  19. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +5 -5
  20. package/build/types/revamp/domain/components/TupleComponent.d.ts +4 -5
  21. package/build/types/revamp/domain/components/step/ExternalConfirmationComponent.d.ts +1 -2
  22. package/build/types/revamp/domain/components/step/StepDomainComponent.d.ts +6 -3
  23. package/build/types/revamp/domain/features/summary/summary-utils.d.ts +2 -2
  24. package/build/types/revamp/domain/features/validation/validation-functions.d.ts +2 -2
  25. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +2 -2
  26. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +2 -2
  27. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +2 -2
  28. package/build/types/revamp/domain/mappers/layout/modalLayoutToComponent.d.ts +2 -2
  29. package/build/types/revamp/domain/mappers/layout/modalToContent.d.ts +2 -2
  30. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +2 -2
  31. package/build/types/revamp/domain/mappers/mapSchemaToComponent.d.ts +2 -2
  32. package/build/types/revamp/domain/mappers/mapStepSchemas.d.ts +2 -2
  33. package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +1 -1
  34. package/build/types/revamp/domain/types.d.ts +15 -18
  35. package/build/types/revamp/utils/component-utils.d.ts +4 -4
  36. package/package.json +11 -11
package/build/main.mjs CHANGED
@@ -1835,37 +1835,6 @@ var getComponentAlertProps = (component, rendererMapperProps) => "alert" in comp
1835
1835
  import { useCallback as useCallback2, useEffect, useMemo, useRef as useRef2, useState } from "react";
1836
1836
  import { useIntl as useIntl2 } from "react-intl";
1837
1837
 
1838
- // src/revamp/utils/component-utils.ts
1839
- var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
1840
- (values) => values.reduce((acc, value) => mergeModels(acc, value), null)
1841
- );
1842
- var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
1843
- var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
1844
- var mergeLocalValues = (valueA, valueB) => {
1845
- if (valueA === null) {
1846
- return valueB;
1847
- }
1848
- if (valueB === null) {
1849
- return valueA;
1850
- }
1851
- if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
1852
- return __spreadValues(__spreadValues({}, valueA), valueB);
1853
- }
1854
- return valueB;
1855
- };
1856
- var mergeModels = (valueA, valueB) => {
1857
- if (valueA === null) {
1858
- return valueB;
1859
- }
1860
- if (valueB === null) {
1861
- return valueA;
1862
- }
1863
- if (isObjectModel(valueA) && isObjectModel(valueB)) {
1864
- return __spreadValues(__spreadValues({}, valueA), valueB);
1865
- }
1866
- return valueB;
1867
- };
1868
-
1869
1838
  // src/revamp/domain/components/utils/component-utils.ts
1870
1839
  var getInputUpdateFunction = (updateComponent) => {
1871
1840
  return (component, updateFn) => {
@@ -1903,13 +1872,7 @@ var createRootDomainComponent = (updateComponent) => {
1903
1872
  return this.stepComponent ? this.stepComponent.getLocalValue() : null;
1904
1873
  },
1905
1874
  async getSubmittableValue() {
1906
- return this.stepComponent ? getSubmittableData([this.stepComponent, ...this.stepComponent.getModals()]) : null;
1907
- },
1908
- getSubmittableValueSync() {
1909
- return this.stepComponent ? getSubmittableDataSync([this.stepComponent, ...this.stepComponent.getModals()]) : null;
1910
- },
1911
- getSummary() {
1912
- return this.stepComponent ? this.stepComponent.getSummary() : {};
1875
+ return this.stepComponent ? this.stepComponent.getSubmittableValue() : null;
1913
1876
  },
1914
1877
  validate() {
1915
1878
  return this.stepComponent ? this.stepComponent.validate() : false;
@@ -1921,8 +1884,8 @@ var createRootDomainComponent = (updateComponent) => {
1921
1884
  getLoadingState() {
1922
1885
  return this.stepComponent ? this.stepComponent.loadingState : "initial";
1923
1886
  },
1924
- getInputComponents() {
1925
- return this.stepComponent ? this.stepComponent.inputComponents : [];
1887
+ getSchemaComponents() {
1888
+ return this.stepComponent ? this.stepComponent.schemaComponents : [];
1926
1889
  },
1927
1890
  getTrackEvent() {
1928
1891
  return this.stepComponent ? this.stepComponent.trackEvent : null;
@@ -1943,46 +1906,6 @@ var createRootDomainComponent = (updateComponent) => {
1943
1906
  return rootComponent;
1944
1907
  };
1945
1908
 
1946
- // src/revamp/domain/features/summary/summary-utils.ts
1947
- var getSummariser = (schema) => (value) => {
1948
- const { summary, icon, image } = schema;
1949
- const stringValueOrNull = isString(value) ? value : null;
1950
- return summaryIfProvides(summary, { value: stringValueOrNull, icon, image });
1951
- };
1952
- var getConstSummary = (schema, model) => {
1953
- const { summary, icon, image } = schema;
1954
- const value = isString(model) ? model : null;
1955
- return summaryIfProvides(summary, { value, icon, image });
1956
- };
1957
- var summariseFromChildren = (components) => components.reduce(
1958
- (acc, component) => mergeSummaries(acc, component.getSummary()),
1959
- {}
1960
- );
1961
- var mergeSummaries = (summaryA, summaryB) => {
1962
- var _a, _b, _c, _d;
1963
- return {
1964
- title: (_a = summaryA.title) != null ? _a : summaryB.title,
1965
- description: (_b = summaryA.description) != null ? _b : summaryB.description,
1966
- icon: (_c = summaryA.icon) != null ? _c : summaryB.icon,
1967
- image: (_d = summaryA.image) != null ? _d : summaryB.image
1968
- };
1969
- };
1970
- var summaryIfProvides = (summary, { value, icon, image }) => {
1971
- if (!summary) {
1972
- return {};
1973
- }
1974
- return {
1975
- title: summary.providesTitle && value || void 0,
1976
- description: summary.providesDescription && value || void 0,
1977
- icon: summary.providesIcon && icon || void 0,
1978
- image: summary.providesImage && mapSpecImage(image != null ? image : void 0) || void 0
1979
- };
1980
- };
1981
-
1982
- // src/revamp/domain/features/validation/validation-functions.ts
1983
- var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
1984
- var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
1985
-
1986
1909
  // src/revamp/domain/components/ModalContentComponent.ts
1987
1910
  var createModalContentComponent = (modalProps, updateComponent) => {
1988
1911
  const update = getInputUpdateFunction(updateComponent);
@@ -1996,21 +1919,6 @@ var createModalContentComponent = (modalProps, updateComponent) => {
1996
1919
  getChildren() {
1997
1920
  return this.components;
1998
1921
  },
1999
- getLocalValue() {
2000
- return getLocalValues(this.getChildren());
2001
- },
2002
- async getSubmittableValue() {
2003
- return getSubmittableData(this.getChildren());
2004
- },
2005
- getSubmittableValueSync() {
2006
- return getSubmittableDataSync(this.getChildren());
2007
- },
2008
- getSummary() {
2009
- return summariseFromChildren(this.getChildren());
2010
- },
2011
- validate() {
2012
- return validateComponents(this.getChildren());
2013
- },
2014
1922
  close() {
2015
1923
  update(this, (draft) => {
2016
1924
  draft.open = false;
@@ -2024,16 +1932,9 @@ var createModalContentComponent = (modalProps, updateComponent) => {
2024
1932
  var getRandomId = () => Math.random().toString(36).substring(2);
2025
1933
 
2026
1934
  // src/revamp/domain/components/AlertComponent.ts
2027
- var createAlertComponent = (alertProps) => __spreadProps(__spreadValues({
1935
+ var createAlertComponent = (alertProps) => __spreadValues({
2028
1936
  type: "alert"
2029
- }, alertProps), {
2030
- getSubmittableValue: async () => null,
2031
- getSubmittableValueSync: () => null,
2032
- getLocalValue: () => null,
2033
- getSummary: () => ({}),
2034
- // Noop
2035
- validate: () => true
2036
- });
1937
+ }, alertProps);
2037
1938
 
2038
1939
  // src/revamp/domain/mappers/utils/behavior-utils.ts
2039
1940
  var getDomainLayerBehavior = ({
@@ -2185,47 +2086,25 @@ var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps
2185
2086
  type: "box",
2186
2087
  getChildren() {
2187
2088
  return this.components;
2188
- },
2189
- async getSubmittableValue() {
2190
- return getSubmittableData(this.components);
2191
- },
2192
- getSubmittableValueSync() {
2193
- return getSubmittableDataSync(this.components);
2194
- },
2195
- getSummary() {
2196
- return summariseFromChildren(this.getChildren());
2197
- },
2198
- getLocalValue() {
2199
- return getLocalValues(this.components);
2200
- },
2201
- validate() {
2202
- return validateComponents(this.getChildren());
2203
2089
  }
2204
2090
  });
2205
2091
 
2206
2092
  // src/revamp/domain/mappers/layout/boxLayoutToComponents.ts
2207
- var boxLayoutToComponent = (uid, { border = false, components, control, margin = "md", width = "xl" }, mapperProps, inputComponents) => createBoxComponent({
2093
+ var boxLayoutToComponent = (uid, { border = false, components, control, margin = "md", width = "xl" }, mapperProps, schemaComponents) => createBoxComponent({
2208
2094
  uid,
2209
2095
  border,
2210
2096
  control,
2211
2097
  margin,
2212
2098
  width,
2213
2099
  components: components.map(
2214
- (component, index) => mapLayoutToComponent(`${uid}.box-${index}`, component, mapperProps, inputComponents)
2100
+ (component, index) => mapLayoutToComponent(`${uid}.box-${index}`, component, mapperProps, schemaComponents)
2215
2101
  )
2216
2102
  });
2217
2103
 
2218
2104
  // src/revamp/domain/components/ButtonComponent.ts
2219
- var createButtonComponent = (buttonProps) => __spreadProps(__spreadValues({
2105
+ var createButtonComponent = (buttonProps) => __spreadValues({
2220
2106
  type: "button"
2221
- }, buttonProps), {
2222
- getSubmittableValue: async () => null,
2223
- getSubmittableValueSync: () => null,
2224
- getLocalValue: () => null,
2225
- getSummary: () => ({}),
2226
- // Noop
2227
- validate: () => true
2228
- });
2107
+ }, buttonProps);
2229
2108
 
2230
2109
  // src/revamp/domain/mappers/layout/buttonLayoutToComponent.ts
2231
2110
  var buttonLayoutToComponent = (uid, button, mapperProps) => {
@@ -2307,26 +2186,11 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
2307
2186
  type: "columns",
2308
2187
  getChildren() {
2309
2188
  return [...this.startComponents, ...this.endComponents];
2310
- },
2311
- async getSubmittableValue() {
2312
- return getSubmittableData(this.getChildren());
2313
- },
2314
- getSubmittableValueSync() {
2315
- return getSubmittableDataSync(this.getChildren());
2316
- },
2317
- getSummary() {
2318
- return summariseFromChildren(this.getChildren());
2319
- },
2320
- getLocalValue() {
2321
- return getLocalValues(this.getChildren());
2322
- },
2323
- validate() {
2324
- return validateComponents(this.getChildren());
2325
2189
  }
2326
2190
  });
2327
2191
 
2328
2192
  // src/revamp/domain/mappers/layout/columnsLayoutToComponent.ts
2329
- var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md" }, mapperProps, inputComponents) => createColumnsComponent({
2193
+ var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md" }, mapperProps, schemaComponents) => createColumnsComponent({
2330
2194
  uid,
2331
2195
  control,
2332
2196
  margin,
@@ -2336,25 +2200,18 @@ var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", marg
2336
2200
  `${uid}.columns-start-${index}`,
2337
2201
  component,
2338
2202
  mapperProps,
2339
- inputComponents
2203
+ schemaComponents
2340
2204
  )
2341
2205
  ),
2342
2206
  endComponents: right.map(
2343
- (component, index) => mapLayoutToComponent(`${uid}.columns-end-${index}`, component, mapperProps, inputComponents)
2207
+ (component, index) => mapLayoutToComponent(`${uid}.columns-end-${index}`, component, mapperProps, schemaComponents)
2344
2208
  )
2345
2209
  });
2346
2210
 
2347
2211
  // src/revamp/domain/components/DecisionComponent.ts
2348
- var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
2212
+ var createDecisionComponent = (decisionProps) => __spreadValues({
2349
2213
  type: "decision"
2350
- }, decisionProps), {
2351
- getSubmittableValue: async () => null,
2352
- getSubmittableValueSync: () => null,
2353
- getLocalValue: () => null,
2354
- getSummary: () => ({}),
2355
- // Noop
2356
- validate: () => true
2357
- });
2214
+ }, decisionProps);
2358
2215
 
2359
2216
  // src/revamp/domain/mappers/utils/utils.ts
2360
2217
  var mapInlineAlert = (alert) => {
@@ -2411,16 +2268,9 @@ var mapOption = (option, onBehavior, stepActions = []) => {
2411
2268
  };
2412
2269
 
2413
2270
  // src/revamp/domain/components/StatusListComponent.ts
2414
- var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValues({
2271
+ var createStatusListComponent = (statusListProps) => __spreadValues({
2415
2272
  type: "status-list"
2416
- }, statusListProps), {
2417
- getLocalValue: () => null,
2418
- getSubmittableValue: async () => null,
2419
- getSubmittableValueSync: () => null,
2420
- getSummary: () => ({}),
2421
- // Noop,
2422
- validate: () => true
2423
- });
2273
+ }, statusListProps);
2424
2274
 
2425
2275
  // src/revamp/domain/mappers/layout/deprecatedListLayoutToComponent.ts
2426
2276
  var isDeprecatedListLayout = (layout) => {
@@ -2455,16 +2305,9 @@ var mapLegacyStatus = (status) => {
2455
2305
  };
2456
2306
 
2457
2307
  // src/revamp/domain/components/DividerComponent.ts
2458
- var createDividerComponent = (props) => __spreadProps(__spreadValues({
2308
+ var createDividerComponent = (props) => __spreadValues({
2459
2309
  type: "divider"
2460
- }, props), {
2461
- getSubmittableValue: async () => null,
2462
- getSubmittableValueSync: () => null,
2463
- getLocalValue: () => null,
2464
- getSummary: () => ({}),
2465
- // Noop
2466
- validate: () => true
2467
- });
2310
+ }, props);
2468
2311
 
2469
2312
  // src/revamp/domain/mappers/layout/dividerLayoutToComponent.ts
2470
2313
  var dividerLayoutToComponent = (uid, { control, margin = "md" }) => createDividerComponent({ uid, control, margin });
@@ -2473,56 +2316,36 @@ var dividerLayoutToComponent = (uid, { control, margin = "md" }) => createDivide
2473
2316
  var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formProps), {
2474
2317
  type: "form",
2475
2318
  getChildren() {
2476
- return [this.inputComponent];
2477
- },
2478
- async getSubmittableValue() {
2479
- return this.inputComponent.getSubmittableValue();
2480
- },
2481
- getSubmittableValueSync() {
2482
- return this.inputComponent.getSubmittableValueSync();
2483
- },
2484
- getSummary() {
2485
- return this.inputComponent.getSummary();
2486
- },
2487
- getLocalValue() {
2488
- return this.inputComponent.getLocalValue();
2489
- },
2490
- validate() {
2491
- return this.inputComponent.validate();
2319
+ return [this.schemaComponent];
2492
2320
  }
2493
2321
  });
2494
2322
 
2495
2323
  // src/revamp/domain/mappers/layout/formLayoutToComponent.ts
2496
- var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin = "md" }, inputComponents) => {
2324
+ var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin = "md" }, schemaComponents) => {
2497
2325
  const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
2498
2326
  if (id == null) {
2499
2327
  throw new Error(
2500
2328
  "FormLayouts must refer to a schema. Set the `schemaId` property to the intended schema."
2501
2329
  );
2502
2330
  }
2503
- const inputComponent = inputComponents.find((component) => component.schemaId === id);
2504
- if (!inputComponent) {
2505
- throw new Error(`FormLayout with schemaId ${id} not found in inputComponents. The schema is probably missing in the step.schemas array.`);
2331
+ const schemaComponent = schemaComponents.find((component) => component.schemaId === id);
2332
+ if (!schemaComponent) {
2333
+ throw new Error(
2334
+ `FormLayout with schemaId ${id} not found in inputComponents. The schema is probably missing in the step.schemas array.`
2335
+ );
2506
2336
  }
2507
2337
  return createFormComponent({
2508
2338
  uid,
2509
- inputComponent,
2339
+ schemaComponent,
2510
2340
  control,
2511
2341
  margin
2512
2342
  });
2513
2343
  };
2514
2344
 
2515
2345
  // src/revamp/domain/components/HeadingComponent.ts
2516
- var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
2346
+ var createHeadingComponent = (headingProps) => __spreadValues({
2517
2347
  type: "heading"
2518
- }, headingProps), {
2519
- getSubmittableValue: async () => null,
2520
- getSubmittableValueSync: () => null,
2521
- getSummary: () => ({}),
2522
- // Noop
2523
- getLocalValue: () => null,
2524
- validate: () => true
2525
- });
2348
+ }, headingProps);
2526
2349
 
2527
2350
  // src/revamp/domain/mappers/layout/headingLayoutToComponent.ts
2528
2351
  var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md", control, text }) => createHeadingComponent({
@@ -2535,16 +2358,9 @@ var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md
2535
2358
  });
2536
2359
 
2537
2360
  // src/revamp/domain/components/ImageComponent.ts
2538
- var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
2361
+ var createImageComponent = (imageProps) => __spreadValues({
2539
2362
  type: "image"
2540
- }, imageProps), {
2541
- getSubmittableValue: async () => null,
2542
- getSubmittableValueSync: () => null,
2543
- getLocalValue: () => null,
2544
- getSummary: () => ({}),
2545
- // Noop
2546
- validate: () => true
2547
- });
2363
+ }, imageProps);
2548
2364
 
2549
2365
  // src/revamp/domain/mappers/layout/imageLayoutToComponent.ts
2550
2366
  var imageLayoutToComponent = (uid, {
@@ -2572,15 +2388,9 @@ var imageLayoutToComponent = (uid, {
2572
2388
  };
2573
2389
 
2574
2390
  // src/revamp/domain/components/MarkdownComponent.ts
2575
- var createMarkdownComponent = (markdownProps) => __spreadProps(__spreadValues({
2391
+ var createMarkdownComponent = (markdownProps) => __spreadValues({
2576
2392
  type: "markdown"
2577
- }, markdownProps), {
2578
- getSubmittableValue: async () => null,
2579
- getSubmittableValueSync: () => null,
2580
- getLocalValue: () => null,
2581
- getSummary: () => ({}),
2582
- validate: () => true
2583
- });
2393
+ }, markdownProps);
2584
2394
 
2585
2395
  // src/revamp/domain/mappers/layout/infoLayoutToComponent.ts
2586
2396
  var infoLayoutToComponent = (uid, { align = "left", control, margin = "md", markdown: content }) => createMarkdownComponent({
@@ -2592,16 +2402,9 @@ var infoLayoutToComponent = (uid, { align = "left", control, margin = "md", mark
2592
2402
  });
2593
2403
 
2594
2404
  // src/revamp/domain/components/InstructionsComponent.ts
2595
- var createInstructionsComponent = (instructionsProps) => __spreadProps(__spreadValues({
2405
+ var createInstructionsComponent = (instructionsProps) => __spreadValues({
2596
2406
  type: "instructions"
2597
- }, instructionsProps), {
2598
- getLocalValue: () => null,
2599
- getSubmittableValue: async () => null,
2600
- getSubmittableValueSync: () => null,
2601
- getSummary: () => ({}),
2602
- // Noop
2603
- validate: () => true
2604
- });
2407
+ }, instructionsProps);
2605
2408
 
2606
2409
  // src/revamp/domain/mappers/layout/instructionsLayoutToComponent.ts
2607
2410
  var instructionsLayoutToComponent = (uid, { control, items, margin = "md", title }) => createInstructionsComponent({
@@ -2615,16 +2418,9 @@ var instructionsLayoutToComponent = (uid, { control, items, margin = "md", title
2615
2418
  });
2616
2419
 
2617
2420
  // src/revamp/domain/components/ListComponent.ts
2618
- var createListComponent = (listProps) => __spreadProps(__spreadValues({
2421
+ var createListComponent = (listProps) => __spreadValues({
2619
2422
  type: "list"
2620
- }, listProps), {
2621
- getLocalValue: () => null,
2622
- getSubmittableValue: async () => null,
2623
- getSubmittableValueSync: () => null,
2624
- getSummary: () => ({}),
2625
- // noop
2626
- validate: () => true
2627
- });
2423
+ }, listProps);
2628
2424
 
2629
2425
  // src/revamp/domain/mappers/layout/listLayoutToComponent.ts
2630
2426
  var listLayoutToComponent = (uid, { callToAction, control, items, margin = "md", title }, mapperProps) => {
@@ -2659,16 +2455,9 @@ var mapSupportingValues = (item) => {
2659
2455
  };
2660
2456
 
2661
2457
  // src/revamp/domain/components/LoadingIndicatorComponent.ts
2662
- var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadProps(__spreadValues({
2458
+ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadValues({
2663
2459
  type: "loading-indicator"
2664
- }, loadingIndicatorProps), {
2665
- getSubmittableValue: async () => null,
2666
- getSubmittableValueSync: () => null,
2667
- getLocalValue: () => null,
2668
- getSummary: () => ({}),
2669
- // Noop
2670
- validate: () => true
2671
- });
2460
+ }, loadingIndicatorProps);
2672
2461
 
2673
2462
  // src/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
2674
2463
  var loadingIndicatorLayoutToComponent = (uid, { size = "md", margin = "md", control }) => createLoadingIndicatorComponent({ uid, size, control, margin });
@@ -2688,32 +2477,17 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
2688
2477
  }, modalProps), {
2689
2478
  getChildren() {
2690
2479
  return this.content.components;
2691
- },
2692
- getLocalValue() {
2693
- return getLocalValues(this.getChildren());
2694
- },
2695
- async getSubmittableValue() {
2696
- return getSubmittableData(this.getChildren());
2697
- },
2698
- getSubmittableValueSync() {
2699
- return getSubmittableDataSync(this.getChildren());
2700
- },
2701
- getSummary() {
2702
- return summariseFromChildren(this.getChildren());
2703
- },
2704
- validate() {
2705
- return validateComponents(this.getChildren());
2706
2480
  }
2707
2481
  });
2708
2482
 
2709
2483
  // src/revamp/domain/mappers/layout/modalLayoutToComponent.ts
2710
- var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger }, mapperProps, inputComponents) => {
2484
+ var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger }, mapperProps, schemaComponents) => {
2711
2485
  const { components, title } = content;
2712
2486
  return createModalComponent({
2713
2487
  uid,
2714
2488
  content: {
2715
2489
  components: components.map(
2716
- (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, inputComponents)
2490
+ (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, schemaComponents)
2717
2491
  ),
2718
2492
  title
2719
2493
  },
@@ -2724,16 +2498,9 @@ var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger },
2724
2498
  };
2725
2499
 
2726
2500
  // src/revamp/domain/components/ParagraphComponent.ts
2727
- var createParagraphComponent = (paragraphProps) => __spreadProps(__spreadValues({
2501
+ var createParagraphComponent = (paragraphProps) => __spreadValues({
2728
2502
  type: "paragraph"
2729
- }, paragraphProps), {
2730
- getSubmittableValue: async () => null,
2731
- getSubmittableValueSync: () => null,
2732
- getSummary: () => ({}),
2733
- // Noop
2734
- getLocalValue: () => null,
2735
- validate: () => true
2736
- });
2503
+ }, paragraphProps);
2737
2504
 
2738
2505
  // src/revamp/domain/mappers/layout/paragraphLayoutToComponent.ts
2739
2506
  var paragraphLayoutToComponent = (uid, { align = "left", control, margin = "md", text }) => createParagraphComponent({
@@ -2745,16 +2512,9 @@ var paragraphLayoutToComponent = (uid, { align = "left", control, margin = "md",
2745
2512
  });
2746
2513
 
2747
2514
  // src/revamp/domain/components/ReviewComponent.ts
2748
- var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
2515
+ var createReviewComponent = (reviewProps) => __spreadValues({
2749
2516
  type: "review"
2750
- }, reviewProps), {
2751
- getLocalValue: () => null,
2752
- getSubmittableValue: async () => null,
2753
- getSubmittableValueSync: () => null,
2754
- getSummary: () => ({}),
2755
- // Noop
2756
- validate: () => true
2757
- });
2517
+ }, reviewProps);
2758
2518
 
2759
2519
  // src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
2760
2520
  var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onBehavior, step }) => createReviewComponent({
@@ -2894,12 +2654,6 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, updateCompo
2894
2654
  _update(updateFn) {
2895
2655
  update(this, updateFn);
2896
2656
  },
2897
- getSubmittableValue: async () => null,
2898
- getSubmittableValueSync: () => null,
2899
- getLocalValue: () => null,
2900
- getSummary: () => ({}),
2901
- // Noop
2902
- validate: () => true,
2903
2657
  onChange(query) {
2904
2658
  this._update((draft) => {
2905
2659
  draft.query = query;
@@ -3012,22 +2766,22 @@ var statusListLayoutToComponent = (uid, { control, items, margin = "md", title }
3012
2766
  });
3013
2767
 
3014
2768
  // src/revamp/domain/mappers/mapLayoutToComponent.ts
3015
- var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
2769
+ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
3016
2770
  switch (layout.type) {
3017
2771
  case "alert":
3018
2772
  return alertLayoutToComponent(uid, layout, mapperProps);
3019
2773
  case "box":
3020
- return boxLayoutToComponent(uid, layout, mapperProps, inputComponents);
2774
+ return boxLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3021
2775
  case "button":
3022
2776
  return buttonLayoutToComponent(uid, layout, mapperProps);
3023
2777
  case "columns":
3024
- return columnsLayoutToComponent(uid, layout, mapperProps, inputComponents);
2778
+ return columnsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3025
2779
  case "decision":
3026
2780
  return decisionLayoutToComponent(uid, layout, mapperProps);
3027
2781
  case "divider":
3028
2782
  return dividerLayoutToComponent(uid, layout);
3029
2783
  case "form":
3030
- return formLayoutToComponent(uid, layout, inputComponents);
2784
+ return formLayoutToComponent(uid, layout, schemaComponents);
3031
2785
  case "heading":
3032
2786
  return headingLayoutToComponent(uid, layout);
3033
2787
  case "image":
@@ -3043,7 +2797,7 @@ var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
3043
2797
  case "markdown":
3044
2798
  return markdownLayoutToComponent(uid, layout);
3045
2799
  case "modal":
3046
- return modalLayoutToComponent(uid, layout, mapperProps, inputComponents);
2800
+ return modalLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3047
2801
  case "paragraph":
3048
2802
  return paragraphLayoutToComponent(uid, layout);
3049
2803
  case "review":
@@ -3058,12 +2812,12 @@ var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
3058
2812
  };
3059
2813
 
3060
2814
  // src/revamp/domain/mappers/layout/modalToContent.ts
3061
- var modalToContent = (uid, { content, title }, mapperProps, inputComponents) => createModalContentComponent(
2815
+ var modalToContent = (uid, { content, title }, mapperProps, schemaComponents) => createModalContentComponent(
3062
2816
  {
3063
2817
  uid: `${uid}-modal-${getRandomId()}`,
3064
2818
  title,
3065
2819
  components: content.map(
3066
- (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, inputComponents)
2820
+ (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, schemaComponents)
3067
2821
  )
3068
2822
  },
3069
2823
  mapperProps.updateComponent
@@ -3093,16 +2847,41 @@ var createExternalConfirmation = (uid, url, updateComponent) => {
3093
2847
  update(this, (draft) => {
3094
2848
  draft.status = "dismissed";
3095
2849
  });
3096
- },
3097
- getSubmittableValue: async () => null,
3098
- getSubmittableValueSync: () => null,
3099
- getLocalValue: () => null,
3100
- getSummary: () => ({}),
3101
- // Noop
3102
- validate: () => true
2850
+ }
3103
2851
  };
3104
2852
  };
3105
2853
 
2854
+ // src/revamp/utils/component-utils.ts
2855
+ var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
2856
+ (values) => values.reduce((acc, value) => mergeModels(acc, value), null)
2857
+ );
2858
+ var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
2859
+ var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
2860
+ var mergeLocalValues = (valueA, valueB) => {
2861
+ if (valueA === null) {
2862
+ return valueB;
2863
+ }
2864
+ if (valueB === null) {
2865
+ return valueA;
2866
+ }
2867
+ if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
2868
+ return __spreadValues(__spreadValues({}, valueA), valueB);
2869
+ }
2870
+ return valueB;
2871
+ };
2872
+ var mergeModels = (valueA, valueB) => {
2873
+ if (valueA === null) {
2874
+ return valueB;
2875
+ }
2876
+ if (valueB === null) {
2877
+ return valueA;
2878
+ }
2879
+ if (isObjectModel(valueA) && isObjectModel(valueB)) {
2880
+ return __spreadValues(__spreadValues({}, valueA), valueB);
2881
+ }
2882
+ return valueB;
2883
+ };
2884
+
3106
2885
  // src/revamp/domain/components/step/StepDomainComponent.ts
3107
2886
  var createStepComponent = (stepProps) => {
3108
2887
  const _a = stepProps, { uid, stepPolling, stepRefreshAfter, updateComponent } = _a, rest = __objRest(_a, ["uid", "stepPolling", "stepRefreshAfter", "updateComponent"]);
@@ -3136,19 +2915,13 @@ var createStepComponent = (stepProps) => {
3136
2915
  return this.modals;
3137
2916
  },
3138
2917
  async getSubmittableValue() {
3139
- return getSubmittableData(this.inputComponents);
3140
- },
3141
- getSubmittableValueSync() {
3142
- return getSubmittableDataSync(this.inputComponents);
3143
- },
3144
- getSummary() {
3145
- return summariseFromChildren(this.getChildren());
2918
+ return getSubmittableData(this.schemaComponents);
3146
2919
  },
3147
2920
  getLocalValue() {
3148
- return getLocalValues(this.inputComponents);
2921
+ return getLocalValues(this.schemaComponents);
3149
2922
  },
3150
2923
  validate() {
3151
- return this.inputComponents.every(
2924
+ return this.schemaComponents.every(
3152
2925
  (inputComponent) => inputComponent.isSchemaReferencedInStep ? inputComponent.validate() : true
3153
2926
  );
3154
2927
  },
@@ -3392,6 +3165,10 @@ var getDebouncedPerformRefresh = (performRefresh, getValidationErrors) => {
3392
3165
  return debouncedFn;
3393
3166
  };
3394
3167
 
3168
+ // src/revamp/domain/features/validation/validation-functions.ts
3169
+ var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
3170
+ var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
3171
+
3395
3172
  // src/revamp/domain/features/validationAsync/getComponentValidationAsync.ts
3396
3173
  var getComponentValidationAsync = (update, performValidationAsync) => (
3397
3174
  /**
@@ -3892,6 +3669,42 @@ var getPerformPersisAsyncFn = (schemaMapperProps, mapperProps) => {
3892
3669
  };
3893
3670
  var schemaHasValidationMessages = (schema) => Boolean("validationMessages" in schema && schema.validationMessages);
3894
3671
 
3672
+ // src/revamp/domain/features/summary/summary-utils.ts
3673
+ var getSummariser = (schema) => (value) => {
3674
+ const { summary, icon, image } = schema;
3675
+ const stringValueOrNull = isString(value) ? value : null;
3676
+ return summaryIfProvides(summary, { value: stringValueOrNull, icon, image });
3677
+ };
3678
+ var getConstSummary = (schema, model) => {
3679
+ const { summary, icon, image } = schema;
3680
+ const value = isString(model) ? model : null;
3681
+ return summaryIfProvides(summary, { value, icon, image });
3682
+ };
3683
+ var summariseFromChildren = (components) => components.reduce(
3684
+ (acc, component) => mergeSummaries(acc, component.getSummary()),
3685
+ {}
3686
+ );
3687
+ var mergeSummaries = (summaryA, summaryB) => {
3688
+ var _a, _b, _c, _d;
3689
+ return {
3690
+ title: (_a = summaryA.title) != null ? _a : summaryB.title,
3691
+ description: (_b = summaryA.description) != null ? _b : summaryB.description,
3692
+ icon: (_c = summaryA.icon) != null ? _c : summaryB.icon,
3693
+ image: (_d = summaryA.image) != null ? _d : summaryB.image
3694
+ };
3695
+ };
3696
+ var summaryIfProvides = (summary, { value, icon, image }) => {
3697
+ if (!summary) {
3698
+ return {};
3699
+ }
3700
+ return {
3701
+ title: summary.providesTitle && value || void 0,
3702
+ description: summary.providesDescription && value || void 0,
3703
+ icon: summary.providesIcon && icon || void 0,
3704
+ image: summary.providesImage && mapSpecImage(image != null ? image : void 0) || void 0
3705
+ };
3706
+ };
3707
+
3895
3708
  // src/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.ts
3896
3709
  var mapCommonSchemaProps = (schemaMapperProps) => {
3897
3710
  var _a;
@@ -4529,7 +4342,7 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4529
4342
  const children = options.map((option) => option.component);
4530
4343
  const selectedIndices = getInitialModelIndices(initialValue, children);
4531
4344
  const getValidationErrors = getLocalValueValidator(checks);
4532
- const inputComponent = __spreadProps(__spreadValues({
4345
+ const component = __spreadProps(__spreadValues({
4533
4346
  uid,
4534
4347
  type: "multi-select",
4535
4348
  children,
@@ -4589,13 +4402,13 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4589
4402
  }
4590
4403
  });
4591
4404
  if (performRefresh) {
4592
- return inputComponent;
4405
+ return component;
4593
4406
  }
4594
4407
  if (performValidationAsync) {
4595
4408
  const validateAsync = getComponentValidationAsync(update, performValidationAsync);
4596
- return __spreadProps(__spreadValues({}, inputComponent), {
4409
+ return __spreadProps(__spreadValues({}, component), {
4597
4410
  onSelect(indices) {
4598
- inputComponent.onSelect.call(this, indices);
4411
+ component.onSelect.call(this, indices);
4599
4412
  if (this.validate()) {
4600
4413
  validateAsync(this, this.getLocalValue()).catch(() => {
4601
4414
  });
@@ -4603,7 +4416,7 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4603
4416
  }
4604
4417
  });
4605
4418
  }
4606
- return inputComponent;
4419
+ return component;
4607
4420
  };
4608
4421
  var getInitialModelIndices = (model, options) => {
4609
4422
  if (!isArray(model)) {
@@ -5052,6 +4865,7 @@ var createConstComponent = (hiddenProps) => {
5052
4865
  uid,
5053
4866
  schemaId,
5054
4867
  analyticsId,
4868
+ hidden: true,
5055
4869
  getLocalValue: () => value,
5056
4870
  getSubmittableValue: async () => value,
5057
4871
  getSubmittableValueSync: () => value,
@@ -5964,7 +5778,7 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps, referencedSchemaId
5964
5778
  const isReferenced = (schemaId) => schemaId != null && referencedSchemaIds.includes(schemaId);
5965
5779
  return step.schemas.map((schema, i) => {
5966
5780
  var _a, _b;
5967
- const inputComponent = mapSchemaToComponent(
5781
+ const schemaComponent = mapSchemaToComponent(
5968
5782
  {
5969
5783
  uid: `${uid}.schemas-${i}.${schema.$id}`,
5970
5784
  schemaId: schema.$id,
@@ -5976,7 +5790,9 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps, referencedSchemaId
5976
5790
  },
5977
5791
  mapperProps
5978
5792
  );
5979
- return __spreadProps(__spreadValues({}, inputComponent), { isSchemaReferencedInStep: isReferenced(schema.$id) });
5793
+ return __spreadProps(__spreadValues({}, schemaComponent), {
5794
+ isSchemaReferencedInStep: isReferenced(schema.$id)
5795
+ });
5980
5796
  });
5981
5797
  };
5982
5798
 
@@ -6034,7 +5850,7 @@ var mapStepToComponent = (_a) => {
6034
5850
  const externalConfirmation = (external == null ? void 0 : external.url) ? createExternalConfirmation(`${uid}-external-confirmation`, external == null ? void 0 : external.url, updateComponent) : void 0;
6035
5851
  const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior, onRefresh });
6036
5852
  const referencedSchemaIds = getReferencedSchemaId(step);
6037
- const inputComponents = mapStepSchemas(
5853
+ const schemaComponents = mapStepSchemas(
6038
5854
  uid,
6039
5855
  step,
6040
5856
  stepLocalValue,
@@ -6042,13 +5858,13 @@ var mapStepToComponent = (_a) => {
6042
5858
  referencedSchemaIds
6043
5859
  );
6044
5860
  const layoutComponents = layout.map(
6045
- (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, inputComponents)
5861
+ (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
6046
5862
  );
6047
5863
  const stepComponent = createStepComponent({
6048
5864
  uid,
6049
5865
  back,
6050
5866
  layoutComponents,
6051
- inputComponents,
5867
+ schemaComponents,
6052
5868
  control,
6053
5869
  description,
6054
5870
  error: errors == null ? void 0 : errors.error,
@@ -6683,7 +6499,7 @@ function useDynamicFlowCore(props) {
6683
6499
  step: stepRef.current,
6684
6500
  stepLocalValue: rootComponentRef.current.getLocalValue()
6685
6501
  }, getMapperProps()),
6686
- rootComponentRef.current.getInputComponents()
6502
+ rootComponentRef.current.getSchemaComponents()
6687
6503
  )
6688
6504
  );
6689
6505
  }