@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.js CHANGED
@@ -1878,37 +1878,6 @@ var getComponentAlertProps = (component, rendererMapperProps) => "alert" in comp
1878
1878
  var import_react3 = require("react");
1879
1879
  var import_react_intl7 = require("react-intl");
1880
1880
 
1881
- // src/revamp/utils/component-utils.ts
1882
- var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
1883
- (values) => values.reduce((acc, value) => mergeModels(acc, value), null)
1884
- );
1885
- var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
1886
- var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
1887
- var mergeLocalValues = (valueA, valueB) => {
1888
- if (valueA === null) {
1889
- return valueB;
1890
- }
1891
- if (valueB === null) {
1892
- return valueA;
1893
- }
1894
- if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
1895
- return __spreadValues(__spreadValues({}, valueA), valueB);
1896
- }
1897
- return valueB;
1898
- };
1899
- var mergeModels = (valueA, valueB) => {
1900
- if (valueA === null) {
1901
- return valueB;
1902
- }
1903
- if (valueB === null) {
1904
- return valueA;
1905
- }
1906
- if (isObjectModel(valueA) && isObjectModel(valueB)) {
1907
- return __spreadValues(__spreadValues({}, valueA), valueB);
1908
- }
1909
- return valueB;
1910
- };
1911
-
1912
1881
  // src/revamp/domain/components/utils/component-utils.ts
1913
1882
  var getInputUpdateFunction = (updateComponent) => {
1914
1883
  return (component, updateFn) => {
@@ -1946,13 +1915,7 @@ var createRootDomainComponent = (updateComponent) => {
1946
1915
  return this.stepComponent ? this.stepComponent.getLocalValue() : null;
1947
1916
  },
1948
1917
  async getSubmittableValue() {
1949
- return this.stepComponent ? getSubmittableData([this.stepComponent, ...this.stepComponent.getModals()]) : null;
1950
- },
1951
- getSubmittableValueSync() {
1952
- return this.stepComponent ? getSubmittableDataSync([this.stepComponent, ...this.stepComponent.getModals()]) : null;
1953
- },
1954
- getSummary() {
1955
- return this.stepComponent ? this.stepComponent.getSummary() : {};
1918
+ return this.stepComponent ? this.stepComponent.getSubmittableValue() : null;
1956
1919
  },
1957
1920
  validate() {
1958
1921
  return this.stepComponent ? this.stepComponent.validate() : false;
@@ -1964,8 +1927,8 @@ var createRootDomainComponent = (updateComponent) => {
1964
1927
  getLoadingState() {
1965
1928
  return this.stepComponent ? this.stepComponent.loadingState : "initial";
1966
1929
  },
1967
- getInputComponents() {
1968
- return this.stepComponent ? this.stepComponent.inputComponents : [];
1930
+ getSchemaComponents() {
1931
+ return this.stepComponent ? this.stepComponent.schemaComponents : [];
1969
1932
  },
1970
1933
  getTrackEvent() {
1971
1934
  return this.stepComponent ? this.stepComponent.trackEvent : null;
@@ -1986,46 +1949,6 @@ var createRootDomainComponent = (updateComponent) => {
1986
1949
  return rootComponent;
1987
1950
  };
1988
1951
 
1989
- // src/revamp/domain/features/summary/summary-utils.ts
1990
- var getSummariser = (schema) => (value) => {
1991
- const { summary, icon, image } = schema;
1992
- const stringValueOrNull = isString(value) ? value : null;
1993
- return summaryIfProvides(summary, { value: stringValueOrNull, icon, image });
1994
- };
1995
- var getConstSummary = (schema, model) => {
1996
- const { summary, icon, image } = schema;
1997
- const value = isString(model) ? model : null;
1998
- return summaryIfProvides(summary, { value, icon, image });
1999
- };
2000
- var summariseFromChildren = (components) => components.reduce(
2001
- (acc, component) => mergeSummaries(acc, component.getSummary()),
2002
- {}
2003
- );
2004
- var mergeSummaries = (summaryA, summaryB) => {
2005
- var _a, _b, _c, _d;
2006
- return {
2007
- title: (_a = summaryA.title) != null ? _a : summaryB.title,
2008
- description: (_b = summaryA.description) != null ? _b : summaryB.description,
2009
- icon: (_c = summaryA.icon) != null ? _c : summaryB.icon,
2010
- image: (_d = summaryA.image) != null ? _d : summaryB.image
2011
- };
2012
- };
2013
- var summaryIfProvides = (summary, { value, icon, image }) => {
2014
- if (!summary) {
2015
- return {};
2016
- }
2017
- return {
2018
- title: summary.providesTitle && value || void 0,
2019
- description: summary.providesDescription && value || void 0,
2020
- icon: summary.providesIcon && icon || void 0,
2021
- image: summary.providesImage && mapSpecImage(image != null ? image : void 0) || void 0
2022
- };
2023
- };
2024
-
2025
- // src/revamp/domain/features/validation/validation-functions.ts
2026
- var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
2027
- var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
2028
-
2029
1952
  // src/revamp/domain/components/ModalContentComponent.ts
2030
1953
  var createModalContentComponent = (modalProps, updateComponent) => {
2031
1954
  const update = getInputUpdateFunction(updateComponent);
@@ -2039,21 +1962,6 @@ var createModalContentComponent = (modalProps, updateComponent) => {
2039
1962
  getChildren() {
2040
1963
  return this.components;
2041
1964
  },
2042
- getLocalValue() {
2043
- return getLocalValues(this.getChildren());
2044
- },
2045
- async getSubmittableValue() {
2046
- return getSubmittableData(this.getChildren());
2047
- },
2048
- getSubmittableValueSync() {
2049
- return getSubmittableDataSync(this.getChildren());
2050
- },
2051
- getSummary() {
2052
- return summariseFromChildren(this.getChildren());
2053
- },
2054
- validate() {
2055
- return validateComponents(this.getChildren());
2056
- },
2057
1965
  close() {
2058
1966
  update(this, (draft) => {
2059
1967
  draft.open = false;
@@ -2067,16 +1975,9 @@ var createModalContentComponent = (modalProps, updateComponent) => {
2067
1975
  var getRandomId = () => Math.random().toString(36).substring(2);
2068
1976
 
2069
1977
  // src/revamp/domain/components/AlertComponent.ts
2070
- var createAlertComponent = (alertProps) => __spreadProps(__spreadValues({
1978
+ var createAlertComponent = (alertProps) => __spreadValues({
2071
1979
  type: "alert"
2072
- }, alertProps), {
2073
- getSubmittableValue: async () => null,
2074
- getSubmittableValueSync: () => null,
2075
- getLocalValue: () => null,
2076
- getSummary: () => ({}),
2077
- // Noop
2078
- validate: () => true
2079
- });
1980
+ }, alertProps);
2080
1981
 
2081
1982
  // src/revamp/domain/mappers/utils/behavior-utils.ts
2082
1983
  var getDomainLayerBehavior = ({
@@ -2228,47 +2129,25 @@ var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps
2228
2129
  type: "box",
2229
2130
  getChildren() {
2230
2131
  return this.components;
2231
- },
2232
- async getSubmittableValue() {
2233
- return getSubmittableData(this.components);
2234
- },
2235
- getSubmittableValueSync() {
2236
- return getSubmittableDataSync(this.components);
2237
- },
2238
- getSummary() {
2239
- return summariseFromChildren(this.getChildren());
2240
- },
2241
- getLocalValue() {
2242
- return getLocalValues(this.components);
2243
- },
2244
- validate() {
2245
- return validateComponents(this.getChildren());
2246
2132
  }
2247
2133
  });
2248
2134
 
2249
2135
  // src/revamp/domain/mappers/layout/boxLayoutToComponents.ts
2250
- var boxLayoutToComponent = (uid, { border = false, components, control, margin = "md", width = "xl" }, mapperProps, inputComponents) => createBoxComponent({
2136
+ var boxLayoutToComponent = (uid, { border = false, components, control, margin = "md", width = "xl" }, mapperProps, schemaComponents) => createBoxComponent({
2251
2137
  uid,
2252
2138
  border,
2253
2139
  control,
2254
2140
  margin,
2255
2141
  width,
2256
2142
  components: components.map(
2257
- (component, index) => mapLayoutToComponent(`${uid}.box-${index}`, component, mapperProps, inputComponents)
2143
+ (component, index) => mapLayoutToComponent(`${uid}.box-${index}`, component, mapperProps, schemaComponents)
2258
2144
  )
2259
2145
  });
2260
2146
 
2261
2147
  // src/revamp/domain/components/ButtonComponent.ts
2262
- var createButtonComponent = (buttonProps) => __spreadProps(__spreadValues({
2148
+ var createButtonComponent = (buttonProps) => __spreadValues({
2263
2149
  type: "button"
2264
- }, buttonProps), {
2265
- getSubmittableValue: async () => null,
2266
- getSubmittableValueSync: () => null,
2267
- getLocalValue: () => null,
2268
- getSummary: () => ({}),
2269
- // Noop
2270
- validate: () => true
2271
- });
2150
+ }, buttonProps);
2272
2151
 
2273
2152
  // src/revamp/domain/mappers/layout/buttonLayoutToComponent.ts
2274
2153
  var buttonLayoutToComponent = (uid, button, mapperProps) => {
@@ -2350,26 +2229,11 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
2350
2229
  type: "columns",
2351
2230
  getChildren() {
2352
2231
  return [...this.startComponents, ...this.endComponents];
2353
- },
2354
- async getSubmittableValue() {
2355
- return getSubmittableData(this.getChildren());
2356
- },
2357
- getSubmittableValueSync() {
2358
- return getSubmittableDataSync(this.getChildren());
2359
- },
2360
- getSummary() {
2361
- return summariseFromChildren(this.getChildren());
2362
- },
2363
- getLocalValue() {
2364
- return getLocalValues(this.getChildren());
2365
- },
2366
- validate() {
2367
- return validateComponents(this.getChildren());
2368
2232
  }
2369
2233
  });
2370
2234
 
2371
2235
  // src/revamp/domain/mappers/layout/columnsLayoutToComponent.ts
2372
- var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md" }, mapperProps, inputComponents) => createColumnsComponent({
2236
+ var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md" }, mapperProps, schemaComponents) => createColumnsComponent({
2373
2237
  uid,
2374
2238
  control,
2375
2239
  margin,
@@ -2379,25 +2243,18 @@ var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", marg
2379
2243
  `${uid}.columns-start-${index}`,
2380
2244
  component,
2381
2245
  mapperProps,
2382
- inputComponents
2246
+ schemaComponents
2383
2247
  )
2384
2248
  ),
2385
2249
  endComponents: right.map(
2386
- (component, index) => mapLayoutToComponent(`${uid}.columns-end-${index}`, component, mapperProps, inputComponents)
2250
+ (component, index) => mapLayoutToComponent(`${uid}.columns-end-${index}`, component, mapperProps, schemaComponents)
2387
2251
  )
2388
2252
  });
2389
2253
 
2390
2254
  // src/revamp/domain/components/DecisionComponent.ts
2391
- var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
2255
+ var createDecisionComponent = (decisionProps) => __spreadValues({
2392
2256
  type: "decision"
2393
- }, decisionProps), {
2394
- getSubmittableValue: async () => null,
2395
- getSubmittableValueSync: () => null,
2396
- getLocalValue: () => null,
2397
- getSummary: () => ({}),
2398
- // Noop
2399
- validate: () => true
2400
- });
2257
+ }, decisionProps);
2401
2258
 
2402
2259
  // src/revamp/domain/mappers/utils/utils.ts
2403
2260
  var mapInlineAlert = (alert) => {
@@ -2454,16 +2311,9 @@ var mapOption = (option, onBehavior, stepActions = []) => {
2454
2311
  };
2455
2312
 
2456
2313
  // src/revamp/domain/components/StatusListComponent.ts
2457
- var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValues({
2314
+ var createStatusListComponent = (statusListProps) => __spreadValues({
2458
2315
  type: "status-list"
2459
- }, statusListProps), {
2460
- getLocalValue: () => null,
2461
- getSubmittableValue: async () => null,
2462
- getSubmittableValueSync: () => null,
2463
- getSummary: () => ({}),
2464
- // Noop,
2465
- validate: () => true
2466
- });
2316
+ }, statusListProps);
2467
2317
 
2468
2318
  // src/revamp/domain/mappers/layout/deprecatedListLayoutToComponent.ts
2469
2319
  var isDeprecatedListLayout = (layout) => {
@@ -2498,16 +2348,9 @@ var mapLegacyStatus = (status) => {
2498
2348
  };
2499
2349
 
2500
2350
  // src/revamp/domain/components/DividerComponent.ts
2501
- var createDividerComponent = (props) => __spreadProps(__spreadValues({
2351
+ var createDividerComponent = (props) => __spreadValues({
2502
2352
  type: "divider"
2503
- }, props), {
2504
- getSubmittableValue: async () => null,
2505
- getSubmittableValueSync: () => null,
2506
- getLocalValue: () => null,
2507
- getSummary: () => ({}),
2508
- // Noop
2509
- validate: () => true
2510
- });
2353
+ }, props);
2511
2354
 
2512
2355
  // src/revamp/domain/mappers/layout/dividerLayoutToComponent.ts
2513
2356
  var dividerLayoutToComponent = (uid, { control, margin = "md" }) => createDividerComponent({ uid, control, margin });
@@ -2516,56 +2359,36 @@ var dividerLayoutToComponent = (uid, { control, margin = "md" }) => createDivide
2516
2359
  var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formProps), {
2517
2360
  type: "form",
2518
2361
  getChildren() {
2519
- return [this.inputComponent];
2520
- },
2521
- async getSubmittableValue() {
2522
- return this.inputComponent.getSubmittableValue();
2523
- },
2524
- getSubmittableValueSync() {
2525
- return this.inputComponent.getSubmittableValueSync();
2526
- },
2527
- getSummary() {
2528
- return this.inputComponent.getSummary();
2529
- },
2530
- getLocalValue() {
2531
- return this.inputComponent.getLocalValue();
2532
- },
2533
- validate() {
2534
- return this.inputComponent.validate();
2362
+ return [this.schemaComponent];
2535
2363
  }
2536
2364
  });
2537
2365
 
2538
2366
  // src/revamp/domain/mappers/layout/formLayoutToComponent.ts
2539
- var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin = "md" }, inputComponents) => {
2367
+ var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin = "md" }, schemaComponents) => {
2540
2368
  const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
2541
2369
  if (id == null) {
2542
2370
  throw new Error(
2543
2371
  "FormLayouts must refer to a schema. Set the `schemaId` property to the intended schema."
2544
2372
  );
2545
2373
  }
2546
- const inputComponent = inputComponents.find((component) => component.schemaId === id);
2547
- if (!inputComponent) {
2548
- throw new Error(`FormLayout with schemaId ${id} not found in inputComponents. The schema is probably missing in the step.schemas array.`);
2374
+ const schemaComponent = schemaComponents.find((component) => component.schemaId === id);
2375
+ if (!schemaComponent) {
2376
+ throw new Error(
2377
+ `FormLayout with schemaId ${id} not found in inputComponents. The schema is probably missing in the step.schemas array.`
2378
+ );
2549
2379
  }
2550
2380
  return createFormComponent({
2551
2381
  uid,
2552
- inputComponent,
2382
+ schemaComponent,
2553
2383
  control,
2554
2384
  margin
2555
2385
  });
2556
2386
  };
2557
2387
 
2558
2388
  // src/revamp/domain/components/HeadingComponent.ts
2559
- var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
2389
+ var createHeadingComponent = (headingProps) => __spreadValues({
2560
2390
  type: "heading"
2561
- }, headingProps), {
2562
- getSubmittableValue: async () => null,
2563
- getSubmittableValueSync: () => null,
2564
- getSummary: () => ({}),
2565
- // Noop
2566
- getLocalValue: () => null,
2567
- validate: () => true
2568
- });
2391
+ }, headingProps);
2569
2392
 
2570
2393
  // src/revamp/domain/mappers/layout/headingLayoutToComponent.ts
2571
2394
  var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md", control, text }) => createHeadingComponent({
@@ -2578,16 +2401,9 @@ var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md
2578
2401
  });
2579
2402
 
2580
2403
  // src/revamp/domain/components/ImageComponent.ts
2581
- var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
2404
+ var createImageComponent = (imageProps) => __spreadValues({
2582
2405
  type: "image"
2583
- }, imageProps), {
2584
- getSubmittableValue: async () => null,
2585
- getSubmittableValueSync: () => null,
2586
- getLocalValue: () => null,
2587
- getSummary: () => ({}),
2588
- // Noop
2589
- validate: () => true
2590
- });
2406
+ }, imageProps);
2591
2407
 
2592
2408
  // src/revamp/domain/mappers/layout/imageLayoutToComponent.ts
2593
2409
  var imageLayoutToComponent = (uid, {
@@ -2615,15 +2431,9 @@ var imageLayoutToComponent = (uid, {
2615
2431
  };
2616
2432
 
2617
2433
  // src/revamp/domain/components/MarkdownComponent.ts
2618
- var createMarkdownComponent = (markdownProps) => __spreadProps(__spreadValues({
2434
+ var createMarkdownComponent = (markdownProps) => __spreadValues({
2619
2435
  type: "markdown"
2620
- }, markdownProps), {
2621
- getSubmittableValue: async () => null,
2622
- getSubmittableValueSync: () => null,
2623
- getLocalValue: () => null,
2624
- getSummary: () => ({}),
2625
- validate: () => true
2626
- });
2436
+ }, markdownProps);
2627
2437
 
2628
2438
  // src/revamp/domain/mappers/layout/infoLayoutToComponent.ts
2629
2439
  var infoLayoutToComponent = (uid, { align = "left", control, margin = "md", markdown: content }) => createMarkdownComponent({
@@ -2635,16 +2445,9 @@ var infoLayoutToComponent = (uid, { align = "left", control, margin = "md", mark
2635
2445
  });
2636
2446
 
2637
2447
  // src/revamp/domain/components/InstructionsComponent.ts
2638
- var createInstructionsComponent = (instructionsProps) => __spreadProps(__spreadValues({
2448
+ var createInstructionsComponent = (instructionsProps) => __spreadValues({
2639
2449
  type: "instructions"
2640
- }, instructionsProps), {
2641
- getLocalValue: () => null,
2642
- getSubmittableValue: async () => null,
2643
- getSubmittableValueSync: () => null,
2644
- getSummary: () => ({}),
2645
- // Noop
2646
- validate: () => true
2647
- });
2450
+ }, instructionsProps);
2648
2451
 
2649
2452
  // src/revamp/domain/mappers/layout/instructionsLayoutToComponent.ts
2650
2453
  var instructionsLayoutToComponent = (uid, { control, items, margin = "md", title }) => createInstructionsComponent({
@@ -2658,16 +2461,9 @@ var instructionsLayoutToComponent = (uid, { control, items, margin = "md", title
2658
2461
  });
2659
2462
 
2660
2463
  // src/revamp/domain/components/ListComponent.ts
2661
- var createListComponent = (listProps) => __spreadProps(__spreadValues({
2464
+ var createListComponent = (listProps) => __spreadValues({
2662
2465
  type: "list"
2663
- }, listProps), {
2664
- getLocalValue: () => null,
2665
- getSubmittableValue: async () => null,
2666
- getSubmittableValueSync: () => null,
2667
- getSummary: () => ({}),
2668
- // noop
2669
- validate: () => true
2670
- });
2466
+ }, listProps);
2671
2467
 
2672
2468
  // src/revamp/domain/mappers/layout/listLayoutToComponent.ts
2673
2469
  var listLayoutToComponent = (uid, { callToAction, control, items, margin = "md", title }, mapperProps) => {
@@ -2702,16 +2498,9 @@ var mapSupportingValues = (item) => {
2702
2498
  };
2703
2499
 
2704
2500
  // src/revamp/domain/components/LoadingIndicatorComponent.ts
2705
- var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadProps(__spreadValues({
2501
+ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadValues({
2706
2502
  type: "loading-indicator"
2707
- }, loadingIndicatorProps), {
2708
- getSubmittableValue: async () => null,
2709
- getSubmittableValueSync: () => null,
2710
- getLocalValue: () => null,
2711
- getSummary: () => ({}),
2712
- // Noop
2713
- validate: () => true
2714
- });
2503
+ }, loadingIndicatorProps);
2715
2504
 
2716
2505
  // src/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
2717
2506
  var loadingIndicatorLayoutToComponent = (uid, { size = "md", margin = "md", control }) => createLoadingIndicatorComponent({ uid, size, control, margin });
@@ -2731,32 +2520,17 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
2731
2520
  }, modalProps), {
2732
2521
  getChildren() {
2733
2522
  return this.content.components;
2734
- },
2735
- getLocalValue() {
2736
- return getLocalValues(this.getChildren());
2737
- },
2738
- async getSubmittableValue() {
2739
- return getSubmittableData(this.getChildren());
2740
- },
2741
- getSubmittableValueSync() {
2742
- return getSubmittableDataSync(this.getChildren());
2743
- },
2744
- getSummary() {
2745
- return summariseFromChildren(this.getChildren());
2746
- },
2747
- validate() {
2748
- return validateComponents(this.getChildren());
2749
2523
  }
2750
2524
  });
2751
2525
 
2752
2526
  // src/revamp/domain/mappers/layout/modalLayoutToComponent.ts
2753
- var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger }, mapperProps, inputComponents) => {
2527
+ var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger }, mapperProps, schemaComponents) => {
2754
2528
  const { components, title } = content;
2755
2529
  return createModalComponent({
2756
2530
  uid,
2757
2531
  content: {
2758
2532
  components: components.map(
2759
- (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, inputComponents)
2533
+ (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, schemaComponents)
2760
2534
  ),
2761
2535
  title
2762
2536
  },
@@ -2767,16 +2541,9 @@ var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger },
2767
2541
  };
2768
2542
 
2769
2543
  // src/revamp/domain/components/ParagraphComponent.ts
2770
- var createParagraphComponent = (paragraphProps) => __spreadProps(__spreadValues({
2544
+ var createParagraphComponent = (paragraphProps) => __spreadValues({
2771
2545
  type: "paragraph"
2772
- }, paragraphProps), {
2773
- getSubmittableValue: async () => null,
2774
- getSubmittableValueSync: () => null,
2775
- getSummary: () => ({}),
2776
- // Noop
2777
- getLocalValue: () => null,
2778
- validate: () => true
2779
- });
2546
+ }, paragraphProps);
2780
2547
 
2781
2548
  // src/revamp/domain/mappers/layout/paragraphLayoutToComponent.ts
2782
2549
  var paragraphLayoutToComponent = (uid, { align = "left", control, margin = "md", text }) => createParagraphComponent({
@@ -2788,16 +2555,9 @@ var paragraphLayoutToComponent = (uid, { align = "left", control, margin = "md",
2788
2555
  });
2789
2556
 
2790
2557
  // src/revamp/domain/components/ReviewComponent.ts
2791
- var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
2558
+ var createReviewComponent = (reviewProps) => __spreadValues({
2792
2559
  type: "review"
2793
- }, reviewProps), {
2794
- getLocalValue: () => null,
2795
- getSubmittableValue: async () => null,
2796
- getSubmittableValueSync: () => null,
2797
- getSummary: () => ({}),
2798
- // Noop
2799
- validate: () => true
2800
- });
2560
+ }, reviewProps);
2801
2561
 
2802
2562
  // src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
2803
2563
  var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onBehavior, step }) => createReviewComponent({
@@ -2937,12 +2697,6 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, updateCompo
2937
2697
  _update(updateFn) {
2938
2698
  update(this, updateFn);
2939
2699
  },
2940
- getSubmittableValue: async () => null,
2941
- getSubmittableValueSync: () => null,
2942
- getLocalValue: () => null,
2943
- getSummary: () => ({}),
2944
- // Noop
2945
- validate: () => true,
2946
2700
  onChange(query) {
2947
2701
  this._update((draft) => {
2948
2702
  draft.query = query;
@@ -3055,22 +2809,22 @@ var statusListLayoutToComponent = (uid, { control, items, margin = "md", title }
3055
2809
  });
3056
2810
 
3057
2811
  // src/revamp/domain/mappers/mapLayoutToComponent.ts
3058
- var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
2812
+ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
3059
2813
  switch (layout.type) {
3060
2814
  case "alert":
3061
2815
  return alertLayoutToComponent(uid, layout, mapperProps);
3062
2816
  case "box":
3063
- return boxLayoutToComponent(uid, layout, mapperProps, inputComponents);
2817
+ return boxLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3064
2818
  case "button":
3065
2819
  return buttonLayoutToComponent(uid, layout, mapperProps);
3066
2820
  case "columns":
3067
- return columnsLayoutToComponent(uid, layout, mapperProps, inputComponents);
2821
+ return columnsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3068
2822
  case "decision":
3069
2823
  return decisionLayoutToComponent(uid, layout, mapperProps);
3070
2824
  case "divider":
3071
2825
  return dividerLayoutToComponent(uid, layout);
3072
2826
  case "form":
3073
- return formLayoutToComponent(uid, layout, inputComponents);
2827
+ return formLayoutToComponent(uid, layout, schemaComponents);
3074
2828
  case "heading":
3075
2829
  return headingLayoutToComponent(uid, layout);
3076
2830
  case "image":
@@ -3086,7 +2840,7 @@ var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
3086
2840
  case "markdown":
3087
2841
  return markdownLayoutToComponent(uid, layout);
3088
2842
  case "modal":
3089
- return modalLayoutToComponent(uid, layout, mapperProps, inputComponents);
2843
+ return modalLayoutToComponent(uid, layout, mapperProps, schemaComponents);
3090
2844
  case "paragraph":
3091
2845
  return paragraphLayoutToComponent(uid, layout);
3092
2846
  case "review":
@@ -3101,12 +2855,12 @@ var mapLayoutToComponent = (uid, layout, mapperProps, inputComponents) => {
3101
2855
  };
3102
2856
 
3103
2857
  // src/revamp/domain/mappers/layout/modalToContent.ts
3104
- var modalToContent = (uid, { content, title }, mapperProps, inputComponents) => createModalContentComponent(
2858
+ var modalToContent = (uid, { content, title }, mapperProps, schemaComponents) => createModalContentComponent(
3105
2859
  {
3106
2860
  uid: `${uid}-modal-${getRandomId()}`,
3107
2861
  title,
3108
2862
  components: content.map(
3109
- (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, inputComponents)
2863
+ (component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps, schemaComponents)
3110
2864
  )
3111
2865
  },
3112
2866
  mapperProps.updateComponent
@@ -3136,16 +2890,41 @@ var createExternalConfirmation = (uid, url, updateComponent) => {
3136
2890
  update(this, (draft) => {
3137
2891
  draft.status = "dismissed";
3138
2892
  });
3139
- },
3140
- getSubmittableValue: async () => null,
3141
- getSubmittableValueSync: () => null,
3142
- getLocalValue: () => null,
3143
- getSummary: () => ({}),
3144
- // Noop
3145
- validate: () => true
2893
+ }
3146
2894
  };
3147
2895
  };
3148
2896
 
2897
+ // src/revamp/utils/component-utils.ts
2898
+ var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
2899
+ (values) => values.reduce((acc, value) => mergeModels(acc, value), null)
2900
+ );
2901
+ var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
2902
+ var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
2903
+ var mergeLocalValues = (valueA, valueB) => {
2904
+ if (valueA === null) {
2905
+ return valueB;
2906
+ }
2907
+ if (valueB === null) {
2908
+ return valueA;
2909
+ }
2910
+ if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
2911
+ return __spreadValues(__spreadValues({}, valueA), valueB);
2912
+ }
2913
+ return valueB;
2914
+ };
2915
+ var mergeModels = (valueA, valueB) => {
2916
+ if (valueA === null) {
2917
+ return valueB;
2918
+ }
2919
+ if (valueB === null) {
2920
+ return valueA;
2921
+ }
2922
+ if (isObjectModel(valueA) && isObjectModel(valueB)) {
2923
+ return __spreadValues(__spreadValues({}, valueA), valueB);
2924
+ }
2925
+ return valueB;
2926
+ };
2927
+
3149
2928
  // src/revamp/domain/components/step/StepDomainComponent.ts
3150
2929
  var createStepComponent = (stepProps) => {
3151
2930
  const _a = stepProps, { uid, stepPolling, stepRefreshAfter, updateComponent } = _a, rest = __objRest(_a, ["uid", "stepPolling", "stepRefreshAfter", "updateComponent"]);
@@ -3179,19 +2958,13 @@ var createStepComponent = (stepProps) => {
3179
2958
  return this.modals;
3180
2959
  },
3181
2960
  async getSubmittableValue() {
3182
- return getSubmittableData(this.inputComponents);
3183
- },
3184
- getSubmittableValueSync() {
3185
- return getSubmittableDataSync(this.inputComponents);
3186
- },
3187
- getSummary() {
3188
- return summariseFromChildren(this.getChildren());
2961
+ return getSubmittableData(this.schemaComponents);
3189
2962
  },
3190
2963
  getLocalValue() {
3191
- return getLocalValues(this.inputComponents);
2964
+ return getLocalValues(this.schemaComponents);
3192
2965
  },
3193
2966
  validate() {
3194
- return this.inputComponents.every(
2967
+ return this.schemaComponents.every(
3195
2968
  (inputComponent) => inputComponent.isSchemaReferencedInStep ? inputComponent.validate() : true
3196
2969
  );
3197
2970
  },
@@ -3435,6 +3208,10 @@ var getDebouncedPerformRefresh = (performRefresh, getValidationErrors) => {
3435
3208
  return debouncedFn;
3436
3209
  };
3437
3210
 
3211
+ // src/revamp/domain/features/validation/validation-functions.ts
3212
+ var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
3213
+ var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
3214
+
3438
3215
  // src/revamp/domain/features/validationAsync/getComponentValidationAsync.ts
3439
3216
  var getComponentValidationAsync = (update, performValidationAsync) => (
3440
3217
  /**
@@ -3935,6 +3712,42 @@ var getPerformPersisAsyncFn = (schemaMapperProps, mapperProps) => {
3935
3712
  };
3936
3713
  var schemaHasValidationMessages = (schema) => Boolean("validationMessages" in schema && schema.validationMessages);
3937
3714
 
3715
+ // src/revamp/domain/features/summary/summary-utils.ts
3716
+ var getSummariser = (schema) => (value) => {
3717
+ const { summary, icon, image } = schema;
3718
+ const stringValueOrNull = isString(value) ? value : null;
3719
+ return summaryIfProvides(summary, { value: stringValueOrNull, icon, image });
3720
+ };
3721
+ var getConstSummary = (schema, model) => {
3722
+ const { summary, icon, image } = schema;
3723
+ const value = isString(model) ? model : null;
3724
+ return summaryIfProvides(summary, { value, icon, image });
3725
+ };
3726
+ var summariseFromChildren = (components) => components.reduce(
3727
+ (acc, component) => mergeSummaries(acc, component.getSummary()),
3728
+ {}
3729
+ );
3730
+ var mergeSummaries = (summaryA, summaryB) => {
3731
+ var _a, _b, _c, _d;
3732
+ return {
3733
+ title: (_a = summaryA.title) != null ? _a : summaryB.title,
3734
+ description: (_b = summaryA.description) != null ? _b : summaryB.description,
3735
+ icon: (_c = summaryA.icon) != null ? _c : summaryB.icon,
3736
+ image: (_d = summaryA.image) != null ? _d : summaryB.image
3737
+ };
3738
+ };
3739
+ var summaryIfProvides = (summary, { value, icon, image }) => {
3740
+ if (!summary) {
3741
+ return {};
3742
+ }
3743
+ return {
3744
+ title: summary.providesTitle && value || void 0,
3745
+ description: summary.providesDescription && value || void 0,
3746
+ icon: summary.providesIcon && icon || void 0,
3747
+ image: summary.providesImage && mapSpecImage(image != null ? image : void 0) || void 0
3748
+ };
3749
+ };
3750
+
3938
3751
  // src/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.ts
3939
3752
  var mapCommonSchemaProps = (schemaMapperProps) => {
3940
3753
  var _a;
@@ -4572,7 +4385,7 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4572
4385
  const children = options.map((option) => option.component);
4573
4386
  const selectedIndices = getInitialModelIndices(initialValue, children);
4574
4387
  const getValidationErrors = getLocalValueValidator(checks);
4575
- const inputComponent = __spreadProps(__spreadValues({
4388
+ const component = __spreadProps(__spreadValues({
4576
4389
  uid,
4577
4390
  type: "multi-select",
4578
4391
  children,
@@ -4632,13 +4445,13 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4632
4445
  }
4633
4446
  });
4634
4447
  if (performRefresh) {
4635
- return inputComponent;
4448
+ return component;
4636
4449
  }
4637
4450
  if (performValidationAsync) {
4638
4451
  const validateAsync = getComponentValidationAsync(update, performValidationAsync);
4639
- return __spreadProps(__spreadValues({}, inputComponent), {
4452
+ return __spreadProps(__spreadValues({}, component), {
4640
4453
  onSelect(indices) {
4641
- inputComponent.onSelect.call(this, indices);
4454
+ component.onSelect.call(this, indices);
4642
4455
  if (this.validate()) {
4643
4456
  validateAsync(this, this.getLocalValue()).catch(() => {
4644
4457
  });
@@ -4646,7 +4459,7 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
4646
4459
  }
4647
4460
  });
4648
4461
  }
4649
- return inputComponent;
4462
+ return component;
4650
4463
  };
4651
4464
  var getInitialModelIndices = (model, options) => {
4652
4465
  if (!isArray(model)) {
@@ -5095,6 +4908,7 @@ var createConstComponent = (hiddenProps) => {
5095
4908
  uid,
5096
4909
  schemaId,
5097
4910
  analyticsId,
4911
+ hidden: true,
5098
4912
  getLocalValue: () => value,
5099
4913
  getSubmittableValue: async () => value,
5100
4914
  getSubmittableValueSync: () => value,
@@ -6007,7 +5821,7 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps, referencedSchemaId
6007
5821
  const isReferenced = (schemaId) => schemaId != null && referencedSchemaIds.includes(schemaId);
6008
5822
  return step.schemas.map((schema, i) => {
6009
5823
  var _a, _b;
6010
- const inputComponent = mapSchemaToComponent(
5824
+ const schemaComponent = mapSchemaToComponent(
6011
5825
  {
6012
5826
  uid: `${uid}.schemas-${i}.${schema.$id}`,
6013
5827
  schemaId: schema.$id,
@@ -6019,7 +5833,9 @@ var mapStepSchemas = (uid, step, stepLocalValue, mapperProps, referencedSchemaId
6019
5833
  },
6020
5834
  mapperProps
6021
5835
  );
6022
- return __spreadProps(__spreadValues({}, inputComponent), { isSchemaReferencedInStep: isReferenced(schema.$id) });
5836
+ return __spreadProps(__spreadValues({}, schemaComponent), {
5837
+ isSchemaReferencedInStep: isReferenced(schema.$id)
5838
+ });
6023
5839
  });
6024
5840
  };
6025
5841
 
@@ -6077,7 +5893,7 @@ var mapStepToComponent = (_a) => {
6077
5893
  const externalConfirmation = (external == null ? void 0 : external.url) ? createExternalConfirmation(`${uid}-external-confirmation`, external == null ? void 0 : external.url, updateComponent) : void 0;
6078
5894
  const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior, onRefresh });
6079
5895
  const referencedSchemaIds = getReferencedSchemaId(step);
6080
- const inputComponents = mapStepSchemas(
5896
+ const schemaComponents = mapStepSchemas(
6081
5897
  uid,
6082
5898
  step,
6083
5899
  stepLocalValue,
@@ -6085,13 +5901,13 @@ var mapStepToComponent = (_a) => {
6085
5901
  referencedSchemaIds
6086
5902
  );
6087
5903
  const layoutComponents = layout.map(
6088
- (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, inputComponents)
5904
+ (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
6089
5905
  );
6090
5906
  const stepComponent = createStepComponent({
6091
5907
  uid,
6092
5908
  back,
6093
5909
  layoutComponents,
6094
- inputComponents,
5910
+ schemaComponents,
6095
5911
  control,
6096
5912
  description,
6097
5913
  error: errors == null ? void 0 : errors.error,
@@ -6726,7 +6542,7 @@ function useDynamicFlowCore(props) {
6726
6542
  step: stepRef.current,
6727
6543
  stepLocalValue: rootComponentRef.current.getLocalValue()
6728
6544
  }, getMapperProps()),
6729
- rootComponentRef.current.getInputComponents()
6545
+ rootComponentRef.current.getSchemaComponents()
6730
6546
  )
6731
6547
  );
6732
6548
  }