@wise/dynamic-flow-client 5.2.0-exp-bits-29346f3 → 5.3.0
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.
- package/build/i18n/uk.json +2 -2
- package/build/main.css +6 -2
- package/build/main.js +159 -26
- package/build/main.mjs +159 -26
- package/build/types/DynamicFlowCore.d.ts +0 -3
- package/build/types/domain/components/FormattedValueComponent.d.ts +16 -0
- package/build/types/domain/features/validation/value-checks.d.ts +1 -0
- package/build/types/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.d.ts +7 -0
- package/build/types/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +25 -0
- package/build/types/domain/mappers/schema/persistAsyncSchemaToComponent.d.ts +25 -0
- package/build/types/domain/types.d.ts +2 -1
- package/build/types/renderers/mappers/formattedValueComponentToProps.d.ts +4 -0
- package/build/types/renderers/mappers/multiSelectComponentToProps.d.ts +1 -1
- package/build/types/renderers/mappers/selectInputComponentToProps.d.ts +1 -1
- package/build/types/renderers/mappers/utils/selectInputOptionsToProps.d.ts +5 -0
- package/build/types/useDynamicFlow.d.ts +6 -7
- package/build/types/useDynamicFlowController.d.ts +1 -2
- package/build/types/utils/type-validators.d.ts +1 -0
- package/package.json +13 -13
- package/build/types/utils/useFeatureFlags.d.ts +0 -2
package/build/i18n/uk.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynamicFlows.ArraySchema.addItem": "Зберегти",
|
|
3
|
-
"dynamicFlows.ArraySchema.addItemTitle": "
|
|
3
|
+
"dynamicFlows.ArraySchema.addItemTitle": "Додати позицію",
|
|
4
4
|
"dynamicFlows.ArraySchema.editItem": "Зберегти",
|
|
5
5
|
"dynamicFlows.ArraySchema.maxItemsError": "Додайте {maxItems} або менше.",
|
|
6
6
|
"dynamicFlows.ArraySchema.minItemsError": "Додайте принаймні {minItems}.",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dynamicFlows.ExternalConfirmation.open": "Відкрити в новій вкладці",
|
|
25
25
|
"dynamicFlows.ExternalConfirmation.title": "Підтвердьте",
|
|
26
26
|
"dynamicFlows.FileUploadSchema.maxFileSizeError": "Вибачте, але цей файл завеликий. Завантажте менший файл.",
|
|
27
|
-
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "
|
|
27
|
+
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "Цей формат файлу не підтримується. Завантажте інший файл.",
|
|
28
28
|
"dynamicFlows.Help.ariaLabel": "Натисніть тут, щоб дізнатися більше.",
|
|
29
29
|
"dynamicFlows.MultiSelect.summary": "{first} і ще {count}",
|
|
30
30
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "Вибачте, але цей файл завеликий. Завантажте менший файл.",
|
package/build/main.css
CHANGED
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
.df-box-renderer-width-lg {
|
|
15
15
|
width: 100%;
|
|
16
16
|
}
|
|
17
|
-
@media screen and (width >=
|
|
17
|
+
@media screen and (width >=768px) {
|
|
18
|
+
.df-box-renderer-border {
|
|
19
|
+
padding: var(--size-24);
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
.df-box-renderer-width-xs {
|
|
19
23
|
width: 33.33%;
|
|
20
24
|
}
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
width: 83.33%;
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
@media screen and (width >=
|
|
38
|
+
@media screen and (width >=990px) {
|
|
35
39
|
.df-box-renderer-width-xs {
|
|
36
40
|
width: 25%;
|
|
37
41
|
}
|
package/build/main.js
CHANGED
|
@@ -789,6 +789,7 @@ var isNull = (value) => value === null;
|
|
|
789
789
|
var isUndefined = (value) => typeof value === "undefined";
|
|
790
790
|
var isNullish = (v) => isNull(v) || isUndefined(v);
|
|
791
791
|
var isFile = (value) => value instanceof File;
|
|
792
|
+
var isValidDate = (value) => isString(value) && /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
792
793
|
|
|
793
794
|
// src/renderers/utils.ts
|
|
794
795
|
function findRendererPropsByType(root, type, predicate = () => true) {
|
|
@@ -828,6 +829,7 @@ var getChildren = (node) => {
|
|
|
828
829
|
case "input-date":
|
|
829
830
|
case "decision":
|
|
830
831
|
case "divider":
|
|
832
|
+
case "formatted-value":
|
|
831
833
|
case "heading":
|
|
832
834
|
case "hidden":
|
|
833
835
|
case "image":
|
|
@@ -1275,6 +1277,29 @@ var externalComponentToProps = (component, rendererMapperProps) => {
|
|
|
1275
1277
|
}, rendererMapperProps);
|
|
1276
1278
|
};
|
|
1277
1279
|
|
|
1280
|
+
// src/renderers/mappers/formattedValueComponentToProps.ts
|
|
1281
|
+
var formattedValueComponentToProps = (component, rendererMapperProps) => {
|
|
1282
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
1283
|
+
type: "formatted-value"
|
|
1284
|
+
}, pick(
|
|
1285
|
+
component,
|
|
1286
|
+
"format",
|
|
1287
|
+
"uid",
|
|
1288
|
+
"analyticsId",
|
|
1289
|
+
"control",
|
|
1290
|
+
"description",
|
|
1291
|
+
"help",
|
|
1292
|
+
"media",
|
|
1293
|
+
"tags",
|
|
1294
|
+
"title"
|
|
1295
|
+
// for now, we don't want to pass `value` down to the renderer to avoid the "WhateverComponent".
|
|
1296
|
+
// 'value',
|
|
1297
|
+
)), {
|
|
1298
|
+
validationState: getValidationState(component.errors, void 0),
|
|
1299
|
+
onChange: component.onChange.bind(component)
|
|
1300
|
+
}), rendererMapperProps);
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1278
1303
|
// src/renderers/mappers/formComponentToProps.ts
|
|
1279
1304
|
var formComponentToProps = (component, rendererMapperProps) => {
|
|
1280
1305
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
@@ -1438,10 +1463,28 @@ var pickValidationState = (states) => {
|
|
|
1438
1463
|
return definedStates[0];
|
|
1439
1464
|
};
|
|
1440
1465
|
|
|
1466
|
+
// src/renderers/mappers/utils/selectInputOptionsToProps.ts
|
|
1467
|
+
var selectInputOptionsToProps = (options, children, rendererMapperProps) => {
|
|
1468
|
+
return options.map((option, index) => {
|
|
1469
|
+
const child = children[index];
|
|
1470
|
+
const optionChildrenProps = child ? componentToRendererProps(child, rendererMapperProps) : null;
|
|
1471
|
+
const optionChildren = optionChildrenProps ? rendererMapperProps.render(optionChildrenProps) : null;
|
|
1472
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
1473
|
+
children: optionChildren,
|
|
1474
|
+
childrenProps: optionChildrenProps
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1441
1479
|
// src/renderers/mappers/multiSelectComponentToProps.ts
|
|
1442
1480
|
var multiSelectInputComponentToProps = (component, rendererMapperProps) => {
|
|
1443
|
-
const { autoComplete, maxItems, minItems,
|
|
1481
|
+
const { autoComplete, maxItems, minItems, selectedIndices, onSelect } = component;
|
|
1444
1482
|
const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
|
|
1483
|
+
const options = selectInputOptionsToProps(
|
|
1484
|
+
component.options,
|
|
1485
|
+
component.getChildren(),
|
|
1486
|
+
rendererMapperProps
|
|
1487
|
+
);
|
|
1445
1488
|
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
1446
1489
|
autoComplete,
|
|
1447
1490
|
maxItems,
|
|
@@ -1782,10 +1825,15 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
1782
1825
|
|
|
1783
1826
|
// src/renderers/mappers/selectInputComponentToProps.ts
|
|
1784
1827
|
var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
1785
|
-
const { autoComplete,
|
|
1828
|
+
const { autoComplete, selectedIndex, onSelect } = component;
|
|
1786
1829
|
const selectedChild = component.getSelectedChild();
|
|
1787
1830
|
const childrenProps = selectedChild ? componentToRendererProps(selectedChild, rendererMapperProps) : null;
|
|
1788
1831
|
const _a = inputComponentToProps(component, "input-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
1832
|
+
const options = selectInputOptionsToProps(
|
|
1833
|
+
component.options,
|
|
1834
|
+
component.getChildren(),
|
|
1835
|
+
rendererMapperProps
|
|
1836
|
+
);
|
|
1789
1837
|
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
1790
1838
|
autoComplete,
|
|
1791
1839
|
options,
|
|
@@ -1907,6 +1955,8 @@ var getComponentProps = (component, rendererMapperProps) => {
|
|
|
1907
1955
|
return dividerComponentToProps(component, rendererMapperProps);
|
|
1908
1956
|
case "external-confirmation":
|
|
1909
1957
|
return externalComponentToProps(component, rendererMapperProps);
|
|
1958
|
+
case "formatted-value":
|
|
1959
|
+
return formattedValueComponentToProps(component, rendererMapperProps);
|
|
1910
1960
|
case "form":
|
|
1911
1961
|
return formComponentToProps(component, rendererMapperProps);
|
|
1912
1962
|
case "heading":
|
|
@@ -3978,6 +4028,12 @@ var getRequiredCheck = (required, messageFunctions) => (value) => {
|
|
|
3978
4028
|
}
|
|
3979
4029
|
return isNullish(value) ? messageFunctions.required() : null;
|
|
3980
4030
|
};
|
|
4031
|
+
var getValidDateCheck = (required, messageFunctions) => (value) => {
|
|
4032
|
+
if (required && !isValidDate(value)) {
|
|
4033
|
+
return messageFunctions.required();
|
|
4034
|
+
}
|
|
4035
|
+
return null;
|
|
4036
|
+
};
|
|
3981
4037
|
|
|
3982
4038
|
// src/domain/mappers/utils/getAutocompleteString.ts
|
|
3983
4039
|
var getAutocompleteString = (hints) => {
|
|
@@ -5569,6 +5625,83 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5569
5625
|
);
|
|
5570
5626
|
};
|
|
5571
5627
|
|
|
5628
|
+
// src/domain/components/FormattedValueComponent.ts
|
|
5629
|
+
var createFormattedValueComponent = (props, updateComponent) => {
|
|
5630
|
+
const {
|
|
5631
|
+
uid,
|
|
5632
|
+
schemaId,
|
|
5633
|
+
analyticsId,
|
|
5634
|
+
alert,
|
|
5635
|
+
control,
|
|
5636
|
+
description,
|
|
5637
|
+
errors,
|
|
5638
|
+
format,
|
|
5639
|
+
help,
|
|
5640
|
+
hidden,
|
|
5641
|
+
media,
|
|
5642
|
+
summariser,
|
|
5643
|
+
title,
|
|
5644
|
+
tags,
|
|
5645
|
+
value,
|
|
5646
|
+
schemaOnChange
|
|
5647
|
+
} = props;
|
|
5648
|
+
const update = getInputUpdateFunction(updateComponent);
|
|
5649
|
+
return {
|
|
5650
|
+
type: "formatted-value",
|
|
5651
|
+
kind: "input",
|
|
5652
|
+
uid,
|
|
5653
|
+
schemaId,
|
|
5654
|
+
analyticsId,
|
|
5655
|
+
alert,
|
|
5656
|
+
control,
|
|
5657
|
+
description,
|
|
5658
|
+
errors,
|
|
5659
|
+
format,
|
|
5660
|
+
help,
|
|
5661
|
+
hidden,
|
|
5662
|
+
media,
|
|
5663
|
+
title,
|
|
5664
|
+
tags,
|
|
5665
|
+
value,
|
|
5666
|
+
async getSubmittableValue() {
|
|
5667
|
+
return this.getSubmittableValueSync();
|
|
5668
|
+
},
|
|
5669
|
+
getSubmittableValueSync() {
|
|
5670
|
+
return this.getLocalValue();
|
|
5671
|
+
},
|
|
5672
|
+
getSummary() {
|
|
5673
|
+
return summariser(this.getLocalValue());
|
|
5674
|
+
},
|
|
5675
|
+
getLocalValue() {
|
|
5676
|
+
return this.value;
|
|
5677
|
+
},
|
|
5678
|
+
validate() {
|
|
5679
|
+
return true;
|
|
5680
|
+
},
|
|
5681
|
+
onChange(newValue) {
|
|
5682
|
+
update(this, (draft) => {
|
|
5683
|
+
draft.value = newValue;
|
|
5684
|
+
});
|
|
5685
|
+
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
5686
|
+
}
|
|
5687
|
+
};
|
|
5688
|
+
};
|
|
5689
|
+
|
|
5690
|
+
// src/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.ts
|
|
5691
|
+
var objectSchemaToFormattedValueComponent = (schemaMapperProps, mapperProps) => {
|
|
5692
|
+
const { onBehavior } = mapperProps;
|
|
5693
|
+
const { schema } = schemaMapperProps;
|
|
5694
|
+
const { format } = schema;
|
|
5695
|
+
return createFormattedValueComponent(
|
|
5696
|
+
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
5697
|
+
format,
|
|
5698
|
+
value: schemaMapperProps.model,
|
|
5699
|
+
schemaOnChange: getSchemaOnChange(schema, onBehavior)
|
|
5700
|
+
}),
|
|
5701
|
+
mapperProps.updateComponent
|
|
5702
|
+
);
|
|
5703
|
+
};
|
|
5704
|
+
|
|
5572
5705
|
// src/domain/components/MoneyInputComponent.ts
|
|
5573
5706
|
var createMoneyInputComponent = (moneyInputProps, updateComponent) => {
|
|
5574
5707
|
const _a = moneyInputProps, {
|
|
@@ -6196,7 +6329,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, u
|
|
|
6196
6329
|
};
|
|
6197
6330
|
|
|
6198
6331
|
// src/domain/mappers/schema/persistAsyncSchemaToComponent.ts
|
|
6199
|
-
var isSupported = (type) => ["boolean", "text", "date", "integer", "number", "upload"].includes(type);
|
|
6332
|
+
var isSupported = (type) => ["const", "boolean", "text", "date", "integer", "number", "upload"].includes(type);
|
|
6200
6333
|
var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
6201
6334
|
const { uid, schema, model, localValue } = schemaMapperProps;
|
|
6202
6335
|
const { persistAsync, tags } = schema;
|
|
@@ -6295,8 +6428,10 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
6295
6428
|
return this.getSubmittableValueSync();
|
|
6296
6429
|
},
|
|
6297
6430
|
getSubmittableValueSync() {
|
|
6298
|
-
|
|
6299
|
-
|
|
6431
|
+
if (isValidDate(this.getLocalValue())) {
|
|
6432
|
+
return this.getLocalValue();
|
|
6433
|
+
}
|
|
6434
|
+
return null;
|
|
6300
6435
|
},
|
|
6301
6436
|
getSummary() {
|
|
6302
6437
|
return summariser(this.getLocalValue());
|
|
@@ -6360,6 +6495,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6360
6495
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
6361
6496
|
checks: schema.hidden ? [] : [
|
|
6362
6497
|
getRequiredCheck(required, errorMessageFunctions),
|
|
6498
|
+
getValidDateCheck(required, errorMessageFunctions),
|
|
6363
6499
|
getAboveMaximumDateCheck(schema, errorMessageFunctions),
|
|
6364
6500
|
getBelowMinimumDateCheck(schema, errorMessageFunctions)
|
|
6365
6501
|
],
|
|
@@ -6588,9 +6724,16 @@ var mapSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6588
6724
|
return booleanSchemaToComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6589
6725
|
}
|
|
6590
6726
|
if (isObjectSchema(schema)) {
|
|
6591
|
-
|
|
6727
|
+
const { format } = schema;
|
|
6728
|
+
if (format === "money") {
|
|
6592
6729
|
return objectSchemaToMoneyInputComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6593
6730
|
}
|
|
6731
|
+
if (format != null && Object.keys(schema.properties).length === 0) {
|
|
6732
|
+
return objectSchemaToFormattedValueComponent(
|
|
6733
|
+
__spreadProps(__spreadValues({}, schemaMapperProps), { schema: __spreadProps(__spreadValues({}, schema), { format }) }),
|
|
6734
|
+
mapperProps
|
|
6735
|
+
);
|
|
6736
|
+
}
|
|
6594
6737
|
return objectSchemaToObjectComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6595
6738
|
}
|
|
6596
6739
|
if (isIntegerSchema(schema)) {
|
|
@@ -7726,16 +7869,7 @@ function useDynamicFlowController(props) {
|
|
|
7726
7869
|
}
|
|
7727
7870
|
return {
|
|
7728
7871
|
rootComponent: rootComponentRef.current,
|
|
7729
|
-
|
|
7730
|
-
navigateBack: () => {
|
|
7731
|
-
var _a2;
|
|
7732
|
-
if (((_a2 = rootComponentRef.current.stepStack) == null ? void 0 : _a2.length) > 1) {
|
|
7733
|
-
rootComponentRef.current.navigateBack();
|
|
7734
|
-
} else {
|
|
7735
|
-
closeWithCancellation();
|
|
7736
|
-
}
|
|
7737
|
-
rootComponentRef.current.setLoadingState("idle");
|
|
7738
|
-
}
|
|
7872
|
+
cancel: closeWithCancellation
|
|
7739
7873
|
};
|
|
7740
7874
|
}
|
|
7741
7875
|
var useRerender = () => {
|
|
@@ -7764,7 +7898,7 @@ var normaliseFlowId = (flowId) => flowId.toLowerCase().replace(/[^a-z-]/g, "-");
|
|
|
7764
7898
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
7765
7899
|
var className = "dynamic-flow";
|
|
7766
7900
|
function useDynamicFlow(props) {
|
|
7767
|
-
var _a
|
|
7901
|
+
var _a;
|
|
7768
7902
|
const { flowId, renderers, httpClient, onEvent, onError, onLog } = props;
|
|
7769
7903
|
const normalisedFlowId = normaliseFlowId(flowId);
|
|
7770
7904
|
const scrollToTop = (0, import_react4.useMemo)(
|
|
@@ -7775,7 +7909,7 @@ function useDynamicFlow(props) {
|
|
|
7775
7909
|
var _a2;
|
|
7776
7910
|
return new FeatureFlags((_a2 = props.features) != null ? _a2 : {});
|
|
7777
7911
|
}, []);
|
|
7778
|
-
const { rootComponent,
|
|
7912
|
+
const { rootComponent, cancel } = useDynamicFlowController(__spreadProps(__spreadValues({}, props), {
|
|
7779
7913
|
features,
|
|
7780
7914
|
scrollToTop
|
|
7781
7915
|
}));
|
|
@@ -7792,13 +7926,12 @@ function useDynamicFlow(props) {
|
|
|
7792
7926
|
stepLoadingState: rootComponent.getLoadingState()
|
|
7793
7927
|
});
|
|
7794
7928
|
return {
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
component: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
7929
|
+
controller: {
|
|
7930
|
+
getSubmittableValue: async () => rootComponent.getSubmittableValue(),
|
|
7931
|
+
validate: () => rootComponent.validate(),
|
|
7932
|
+
cancel
|
|
7933
|
+
},
|
|
7934
|
+
view: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
7802
7935
|
ErrorBoundary_default,
|
|
7803
7936
|
{
|
|
7804
7937
|
onError: (error) => {
|
|
@@ -7817,5 +7950,5 @@ function useDynamicFlow(props) {
|
|
|
7817
7950
|
// src/DynamicFlowCore.tsx
|
|
7818
7951
|
function DynamicFlowCore(props) {
|
|
7819
7952
|
const df = useDynamicFlow(props);
|
|
7820
|
-
return df.
|
|
7953
|
+
return df.view;
|
|
7821
7954
|
}
|
package/build/main.mjs
CHANGED
|
@@ -762,6 +762,7 @@ var isNull = (value) => value === null;
|
|
|
762
762
|
var isUndefined = (value) => typeof value === "undefined";
|
|
763
763
|
var isNullish = (v) => isNull(v) || isUndefined(v);
|
|
764
764
|
var isFile = (value) => value instanceof File;
|
|
765
|
+
var isValidDate = (value) => isString(value) && /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
765
766
|
|
|
766
767
|
// src/renderers/utils.ts
|
|
767
768
|
function findRendererPropsByType(root, type, predicate = () => true) {
|
|
@@ -801,6 +802,7 @@ var getChildren = (node) => {
|
|
|
801
802
|
case "input-date":
|
|
802
803
|
case "decision":
|
|
803
804
|
case "divider":
|
|
805
|
+
case "formatted-value":
|
|
804
806
|
case "heading":
|
|
805
807
|
case "hidden":
|
|
806
808
|
case "image":
|
|
@@ -1248,6 +1250,29 @@ var externalComponentToProps = (component, rendererMapperProps) => {
|
|
|
1248
1250
|
}, rendererMapperProps);
|
|
1249
1251
|
};
|
|
1250
1252
|
|
|
1253
|
+
// src/renderers/mappers/formattedValueComponentToProps.ts
|
|
1254
|
+
var formattedValueComponentToProps = (component, rendererMapperProps) => {
|
|
1255
|
+
return __spreadValues(__spreadProps(__spreadValues({
|
|
1256
|
+
type: "formatted-value"
|
|
1257
|
+
}, pick(
|
|
1258
|
+
component,
|
|
1259
|
+
"format",
|
|
1260
|
+
"uid",
|
|
1261
|
+
"analyticsId",
|
|
1262
|
+
"control",
|
|
1263
|
+
"description",
|
|
1264
|
+
"help",
|
|
1265
|
+
"media",
|
|
1266
|
+
"tags",
|
|
1267
|
+
"title"
|
|
1268
|
+
// for now, we don't want to pass `value` down to the renderer to avoid the "WhateverComponent".
|
|
1269
|
+
// 'value',
|
|
1270
|
+
)), {
|
|
1271
|
+
validationState: getValidationState(component.errors, void 0),
|
|
1272
|
+
onChange: component.onChange.bind(component)
|
|
1273
|
+
}), rendererMapperProps);
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1251
1276
|
// src/renderers/mappers/formComponentToProps.ts
|
|
1252
1277
|
var formComponentToProps = (component, rendererMapperProps) => {
|
|
1253
1278
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
@@ -1411,10 +1436,28 @@ var pickValidationState = (states) => {
|
|
|
1411
1436
|
return definedStates[0];
|
|
1412
1437
|
};
|
|
1413
1438
|
|
|
1439
|
+
// src/renderers/mappers/utils/selectInputOptionsToProps.ts
|
|
1440
|
+
var selectInputOptionsToProps = (options, children, rendererMapperProps) => {
|
|
1441
|
+
return options.map((option, index) => {
|
|
1442
|
+
const child = children[index];
|
|
1443
|
+
const optionChildrenProps = child ? componentToRendererProps(child, rendererMapperProps) : null;
|
|
1444
|
+
const optionChildren = optionChildrenProps ? rendererMapperProps.render(optionChildrenProps) : null;
|
|
1445
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
1446
|
+
children: optionChildren,
|
|
1447
|
+
childrenProps: optionChildrenProps
|
|
1448
|
+
});
|
|
1449
|
+
});
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1414
1452
|
// src/renderers/mappers/multiSelectComponentToProps.ts
|
|
1415
1453
|
var multiSelectInputComponentToProps = (component, rendererMapperProps) => {
|
|
1416
|
-
const { autoComplete, maxItems, minItems,
|
|
1454
|
+
const { autoComplete, maxItems, minItems, selectedIndices, onSelect } = component;
|
|
1417
1455
|
const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
|
|
1456
|
+
const options = selectInputOptionsToProps(
|
|
1457
|
+
component.options,
|
|
1458
|
+
component.getChildren(),
|
|
1459
|
+
rendererMapperProps
|
|
1460
|
+
);
|
|
1418
1461
|
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
1419
1462
|
autoComplete,
|
|
1420
1463
|
maxItems,
|
|
@@ -1755,10 +1798,15 @@ var sectionComponentToProps = (component, rendererMapperProps) => {
|
|
|
1755
1798
|
|
|
1756
1799
|
// src/renderers/mappers/selectInputComponentToProps.ts
|
|
1757
1800
|
var selectInputComponentToProps = (component, rendererMapperProps) => {
|
|
1758
|
-
const { autoComplete,
|
|
1801
|
+
const { autoComplete, selectedIndex, onSelect } = component;
|
|
1759
1802
|
const selectedChild = component.getSelectedChild();
|
|
1760
1803
|
const childrenProps = selectedChild ? componentToRendererProps(selectedChild, rendererMapperProps) : null;
|
|
1761
1804
|
const _a = inputComponentToProps(component, "input-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
1805
|
+
const options = selectInputOptionsToProps(
|
|
1806
|
+
component.options,
|
|
1807
|
+
component.getChildren(),
|
|
1808
|
+
rendererMapperProps
|
|
1809
|
+
);
|
|
1762
1810
|
return __spreadProps(__spreadValues(__spreadValues({}, props), rendererMapperProps), {
|
|
1763
1811
|
autoComplete,
|
|
1764
1812
|
options,
|
|
@@ -1880,6 +1928,8 @@ var getComponentProps = (component, rendererMapperProps) => {
|
|
|
1880
1928
|
return dividerComponentToProps(component, rendererMapperProps);
|
|
1881
1929
|
case "external-confirmation":
|
|
1882
1930
|
return externalComponentToProps(component, rendererMapperProps);
|
|
1931
|
+
case "formatted-value":
|
|
1932
|
+
return formattedValueComponentToProps(component, rendererMapperProps);
|
|
1883
1933
|
case "form":
|
|
1884
1934
|
return formComponentToProps(component, rendererMapperProps);
|
|
1885
1935
|
case "heading":
|
|
@@ -3951,6 +4001,12 @@ var getRequiredCheck = (required, messageFunctions) => (value) => {
|
|
|
3951
4001
|
}
|
|
3952
4002
|
return isNullish(value) ? messageFunctions.required() : null;
|
|
3953
4003
|
};
|
|
4004
|
+
var getValidDateCheck = (required, messageFunctions) => (value) => {
|
|
4005
|
+
if (required && !isValidDate(value)) {
|
|
4006
|
+
return messageFunctions.required();
|
|
4007
|
+
}
|
|
4008
|
+
return null;
|
|
4009
|
+
};
|
|
3954
4010
|
|
|
3955
4011
|
// src/domain/mappers/utils/getAutocompleteString.ts
|
|
3956
4012
|
var getAutocompleteString = (hints) => {
|
|
@@ -5542,6 +5598,83 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5542
5598
|
);
|
|
5543
5599
|
};
|
|
5544
5600
|
|
|
5601
|
+
// src/domain/components/FormattedValueComponent.ts
|
|
5602
|
+
var createFormattedValueComponent = (props, updateComponent) => {
|
|
5603
|
+
const {
|
|
5604
|
+
uid,
|
|
5605
|
+
schemaId,
|
|
5606
|
+
analyticsId,
|
|
5607
|
+
alert,
|
|
5608
|
+
control,
|
|
5609
|
+
description,
|
|
5610
|
+
errors,
|
|
5611
|
+
format,
|
|
5612
|
+
help,
|
|
5613
|
+
hidden,
|
|
5614
|
+
media,
|
|
5615
|
+
summariser,
|
|
5616
|
+
title,
|
|
5617
|
+
tags,
|
|
5618
|
+
value,
|
|
5619
|
+
schemaOnChange
|
|
5620
|
+
} = props;
|
|
5621
|
+
const update = getInputUpdateFunction(updateComponent);
|
|
5622
|
+
return {
|
|
5623
|
+
type: "formatted-value",
|
|
5624
|
+
kind: "input",
|
|
5625
|
+
uid,
|
|
5626
|
+
schemaId,
|
|
5627
|
+
analyticsId,
|
|
5628
|
+
alert,
|
|
5629
|
+
control,
|
|
5630
|
+
description,
|
|
5631
|
+
errors,
|
|
5632
|
+
format,
|
|
5633
|
+
help,
|
|
5634
|
+
hidden,
|
|
5635
|
+
media,
|
|
5636
|
+
title,
|
|
5637
|
+
tags,
|
|
5638
|
+
value,
|
|
5639
|
+
async getSubmittableValue() {
|
|
5640
|
+
return this.getSubmittableValueSync();
|
|
5641
|
+
},
|
|
5642
|
+
getSubmittableValueSync() {
|
|
5643
|
+
return this.getLocalValue();
|
|
5644
|
+
},
|
|
5645
|
+
getSummary() {
|
|
5646
|
+
return summariser(this.getLocalValue());
|
|
5647
|
+
},
|
|
5648
|
+
getLocalValue() {
|
|
5649
|
+
return this.value;
|
|
5650
|
+
},
|
|
5651
|
+
validate() {
|
|
5652
|
+
return true;
|
|
5653
|
+
},
|
|
5654
|
+
onChange(newValue) {
|
|
5655
|
+
update(this, (draft) => {
|
|
5656
|
+
draft.value = newValue;
|
|
5657
|
+
});
|
|
5658
|
+
void (schemaOnChange == null ? void 0 : schemaOnChange());
|
|
5659
|
+
}
|
|
5660
|
+
};
|
|
5661
|
+
};
|
|
5662
|
+
|
|
5663
|
+
// src/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.ts
|
|
5664
|
+
var objectSchemaToFormattedValueComponent = (schemaMapperProps, mapperProps) => {
|
|
5665
|
+
const { onBehavior } = mapperProps;
|
|
5666
|
+
const { schema } = schemaMapperProps;
|
|
5667
|
+
const { format } = schema;
|
|
5668
|
+
return createFormattedValueComponent(
|
|
5669
|
+
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
5670
|
+
format,
|
|
5671
|
+
value: schemaMapperProps.model,
|
|
5672
|
+
schemaOnChange: getSchemaOnChange(schema, onBehavior)
|
|
5673
|
+
}),
|
|
5674
|
+
mapperProps.updateComponent
|
|
5675
|
+
);
|
|
5676
|
+
};
|
|
5677
|
+
|
|
5545
5678
|
// src/domain/components/MoneyInputComponent.ts
|
|
5546
5679
|
var createMoneyInputComponent = (moneyInputProps, updateComponent) => {
|
|
5547
5680
|
const _a = moneyInputProps, {
|
|
@@ -6169,7 +6302,7 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, u
|
|
|
6169
6302
|
};
|
|
6170
6303
|
|
|
6171
6304
|
// src/domain/mappers/schema/persistAsyncSchemaToComponent.ts
|
|
6172
|
-
var isSupported = (type) => ["boolean", "text", "date", "integer", "number", "upload"].includes(type);
|
|
6305
|
+
var isSupported = (type) => ["const", "boolean", "text", "date", "integer", "number", "upload"].includes(type);
|
|
6173
6306
|
var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
6174
6307
|
const { uid, schema, model, localValue } = schemaMapperProps;
|
|
6175
6308
|
const { persistAsync, tags } = schema;
|
|
@@ -6268,8 +6401,10 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
6268
6401
|
return this.getSubmittableValueSync();
|
|
6269
6402
|
},
|
|
6270
6403
|
getSubmittableValueSync() {
|
|
6271
|
-
|
|
6272
|
-
|
|
6404
|
+
if (isValidDate(this.getLocalValue())) {
|
|
6405
|
+
return this.getLocalValue();
|
|
6406
|
+
}
|
|
6407
|
+
return null;
|
|
6273
6408
|
},
|
|
6274
6409
|
getSummary() {
|
|
6275
6410
|
return summariser(this.getLocalValue());
|
|
@@ -6333,6 +6468,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6333
6468
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
6334
6469
|
checks: schema.hidden ? [] : [
|
|
6335
6470
|
getRequiredCheck(required, errorMessageFunctions),
|
|
6471
|
+
getValidDateCheck(required, errorMessageFunctions),
|
|
6336
6472
|
getAboveMaximumDateCheck(schema, errorMessageFunctions),
|
|
6337
6473
|
getBelowMinimumDateCheck(schema, errorMessageFunctions)
|
|
6338
6474
|
],
|
|
@@ -6561,9 +6697,16 @@ var mapSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
6561
6697
|
return booleanSchemaToComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6562
6698
|
}
|
|
6563
6699
|
if (isObjectSchema(schema)) {
|
|
6564
|
-
|
|
6700
|
+
const { format } = schema;
|
|
6701
|
+
if (format === "money") {
|
|
6565
6702
|
return objectSchemaToMoneyInputComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6566
6703
|
}
|
|
6704
|
+
if (format != null && Object.keys(schema.properties).length === 0) {
|
|
6705
|
+
return objectSchemaToFormattedValueComponent(
|
|
6706
|
+
__spreadProps(__spreadValues({}, schemaMapperProps), { schema: __spreadProps(__spreadValues({}, schema), { format }) }),
|
|
6707
|
+
mapperProps
|
|
6708
|
+
);
|
|
6709
|
+
}
|
|
6567
6710
|
return objectSchemaToObjectComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema }), mapperProps);
|
|
6568
6711
|
}
|
|
6569
6712
|
if (isIntegerSchema(schema)) {
|
|
@@ -7699,16 +7842,7 @@ function useDynamicFlowController(props) {
|
|
|
7699
7842
|
}
|
|
7700
7843
|
return {
|
|
7701
7844
|
rootComponent: rootComponentRef.current,
|
|
7702
|
-
|
|
7703
|
-
navigateBack: () => {
|
|
7704
|
-
var _a2;
|
|
7705
|
-
if (((_a2 = rootComponentRef.current.stepStack) == null ? void 0 : _a2.length) > 1) {
|
|
7706
|
-
rootComponentRef.current.navigateBack();
|
|
7707
|
-
} else {
|
|
7708
|
-
closeWithCancellation();
|
|
7709
|
-
}
|
|
7710
|
-
rootComponentRef.current.setLoadingState("idle");
|
|
7711
|
-
}
|
|
7845
|
+
cancel: closeWithCancellation
|
|
7712
7846
|
};
|
|
7713
7847
|
}
|
|
7714
7848
|
var useRerender = () => {
|
|
@@ -7737,7 +7871,7 @@ var normaliseFlowId = (flowId) => flowId.toLowerCase().replace(/[^a-z-]/g, "-");
|
|
|
7737
7871
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
7738
7872
|
var className = "dynamic-flow";
|
|
7739
7873
|
function useDynamicFlow(props) {
|
|
7740
|
-
var _a
|
|
7874
|
+
var _a;
|
|
7741
7875
|
const { flowId, renderers, httpClient, onEvent, onError, onLog } = props;
|
|
7742
7876
|
const normalisedFlowId = normaliseFlowId(flowId);
|
|
7743
7877
|
const scrollToTop = useMemo2(
|
|
@@ -7748,7 +7882,7 @@ function useDynamicFlow(props) {
|
|
|
7748
7882
|
var _a2;
|
|
7749
7883
|
return new FeatureFlags((_a2 = props.features) != null ? _a2 : {});
|
|
7750
7884
|
}, []);
|
|
7751
|
-
const { rootComponent,
|
|
7885
|
+
const { rootComponent, cancel } = useDynamicFlowController(__spreadProps(__spreadValues({}, props), {
|
|
7752
7886
|
features,
|
|
7753
7887
|
scrollToTop
|
|
7754
7888
|
}));
|
|
@@ -7765,13 +7899,12 @@ function useDynamicFlow(props) {
|
|
|
7765
7899
|
stepLoadingState: rootComponent.getLoadingState()
|
|
7766
7900
|
});
|
|
7767
7901
|
return {
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
component: /* @__PURE__ */ jsx6(
|
|
7902
|
+
controller: {
|
|
7903
|
+
getSubmittableValue: async () => rootComponent.getSubmittableValue(),
|
|
7904
|
+
validate: () => rootComponent.validate(),
|
|
7905
|
+
cancel
|
|
7906
|
+
},
|
|
7907
|
+
view: /* @__PURE__ */ jsx6(
|
|
7775
7908
|
ErrorBoundary_default,
|
|
7776
7909
|
{
|
|
7777
7910
|
onError: (error) => {
|
|
@@ -7790,7 +7923,7 @@ function useDynamicFlow(props) {
|
|
|
7790
7923
|
// src/DynamicFlowCore.tsx
|
|
7791
7924
|
function DynamicFlowCore(props) {
|
|
7792
7925
|
const df = useDynamicFlow(props);
|
|
7793
|
-
return df.
|
|
7926
|
+
return df.view;
|
|
7794
7927
|
}
|
|
7795
7928
|
export {
|
|
7796
7929
|
DynamicFlowCore as DynamicFlow,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JsonElement } from '@wise/dynamic-flow-types/spec';
|
|
2
|
+
import { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
|
|
3
|
+
import type { BaseSchemaComponent, InlineAlert, LocalValue, RepeatableSummary, UpdateComponent } from '../types';
|
|
4
|
+
export type FormattedValueComponent = BaseSchemaComponent<JsonElement> & {
|
|
5
|
+
type: 'formatted-value';
|
|
6
|
+
kind: 'input';
|
|
7
|
+
format: string;
|
|
8
|
+
alert?: InlineAlert;
|
|
9
|
+
errors: string[] | undefined;
|
|
10
|
+
value: JsonElement;
|
|
11
|
+
onChange: (newValue: JsonElement) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const createFormattedValueComponent: (props: Pick<FormattedValueComponent, "uid" | "schemaId" | "analyticsId" | "alert" | "control" | "description" | "errors" | "format" | "help" | "hidden" | "media" | "title" | "tags" | "value"> & {
|
|
14
|
+
summariser: (value: LocalValue | null) => RepeatableSummary;
|
|
15
|
+
schemaOnChange: SchemaOnChange | undefined;
|
|
16
|
+
}, updateComponent: UpdateComponent) => FormattedValueComponent;
|
|
@@ -23,4 +23,5 @@ export declare const getAboveMaximumDateCheck: GetIsInvalidCheck<StringSchema, s
|
|
|
23
23
|
export declare const getBelowMinimumDateCheck: GetIsInvalidCheck<StringSchema, string | null>;
|
|
24
24
|
export declare const getNotAdheringToPatternCheck: GetIsInvalidCheck<StringSchema, string | null>;
|
|
25
25
|
export declare const getRequiredCheck: (required: boolean, messageFunctions: ErrorMessageFunctions) => IsInvalidCheck<LocalValue | null>;
|
|
26
|
+
export declare const getValidDateCheck: (required: boolean, messageFunctions: ErrorMessageFunctions) => IsInvalidCheck<string | null>;
|
|
26
27
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ObjectSchema } from '@wise/dynamic-flow-types/spec';
|
|
2
|
+
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
3
|
+
export declare const objectSchemaToFormattedValueComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
|
+
schema: ObjectSchema & {
|
|
5
|
+
format: string;
|
|
6
|
+
};
|
|
7
|
+
}, mapperProps: MapperProps) => import("../../../components/FormattedValueComponent").FormattedValueComponent;
|
package/build/types/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts
CHANGED
|
@@ -471,6 +471,31 @@ export declare const oneOfSchemaToComponent: (schemaMapperProps: SchemaMapperPro
|
|
|
471
471
|
onUpload: (value: File | null) => Promise<void>;
|
|
472
472
|
} & {
|
|
473
473
|
kind: "input";
|
|
474
|
+
}) | (import("../../../types").BaseComponent & {
|
|
475
|
+
schemaId?: string;
|
|
476
|
+
isSchemaReferencedInStep?: boolean;
|
|
477
|
+
control?: string;
|
|
478
|
+
description?: string;
|
|
479
|
+
help?: string;
|
|
480
|
+
hidden: boolean;
|
|
481
|
+
media?: import("../../../types").Media;
|
|
482
|
+
title?: string;
|
|
483
|
+
tags?: string[];
|
|
484
|
+
getLocalValue: () => import("@wise/dynamic-flow-types/spec").JsonElement;
|
|
485
|
+
getSubmittableValueSync: () => import("@wise/dynamic-flow-types/spec").Model;
|
|
486
|
+
getSummary: () => import("../../../types").RepeatableSummary;
|
|
487
|
+
getSubmittableValue: () => Promise<import("@wise/dynamic-flow-types/spec").Model>;
|
|
488
|
+
validate: () => boolean;
|
|
489
|
+
} & {
|
|
490
|
+
type: "formatted-value";
|
|
491
|
+
kind: "input";
|
|
492
|
+
format: string;
|
|
493
|
+
alert?: import("../../../types").InlineAlert;
|
|
494
|
+
errors: string[] | undefined;
|
|
495
|
+
value: import("@wise/dynamic-flow-types/spec").JsonElement;
|
|
496
|
+
onChange: (newValue: import("@wise/dynamic-flow-types/spec").JsonElement) => void;
|
|
497
|
+
} & {
|
|
498
|
+
kind: "input";
|
|
474
499
|
}) | (import("../../../types").BaseComponent & {
|
|
475
500
|
schemaId?: string;
|
|
476
501
|
isSchemaReferencedInStep?: boolean;
|
|
@@ -484,6 +484,31 @@ export declare const persistAsyncSchemaToComponent: (schemaMapperProps: SchemaMa
|
|
|
484
484
|
onUpload: (value: File | null) => Promise<void>;
|
|
485
485
|
} & {
|
|
486
486
|
kind: "input";
|
|
487
|
+
}) | (import("../../types").BaseComponent & {
|
|
488
|
+
schemaId?: string;
|
|
489
|
+
isSchemaReferencedInStep?: boolean;
|
|
490
|
+
control?: string;
|
|
491
|
+
description?: string;
|
|
492
|
+
help?: string;
|
|
493
|
+
hidden: boolean;
|
|
494
|
+
media?: import("../../types").Media;
|
|
495
|
+
title?: string;
|
|
496
|
+
tags?: string[];
|
|
497
|
+
getLocalValue: () => import("@wise/dynamic-flow-types/spec").JsonElement;
|
|
498
|
+
getSubmittableValueSync: () => import("@wise/dynamic-flow-types/spec").Model;
|
|
499
|
+
getSummary: () => import("../../types").RepeatableSummary;
|
|
500
|
+
getSubmittableValue: () => Promise<import("@wise/dynamic-flow-types/spec").Model>;
|
|
501
|
+
validate: () => boolean;
|
|
502
|
+
} & {
|
|
503
|
+
type: "formatted-value";
|
|
504
|
+
kind: "input";
|
|
505
|
+
format: string;
|
|
506
|
+
alert?: import("../../types").InlineAlert;
|
|
507
|
+
errors: string[] | undefined;
|
|
508
|
+
value: import("@wise/dynamic-flow-types/spec").JsonElement;
|
|
509
|
+
onChange: (newValue: import("@wise/dynamic-flow-types/spec").JsonElement) => void;
|
|
510
|
+
} & {
|
|
511
|
+
kind: "input";
|
|
487
512
|
}) | (import("../../types").BaseComponent & {
|
|
488
513
|
schemaId?: string;
|
|
489
514
|
isSchemaReferencedInStep?: boolean;
|
|
@@ -10,6 +10,7 @@ import type { ContainerComponent } from './components/ContainerComponent';
|
|
|
10
10
|
import type { DateInputComponent } from './components/DateInputComponent';
|
|
11
11
|
import type { DecisionComponent } from './components/DecisionComponent';
|
|
12
12
|
import type { DividerComponent } from './components/DividerComponent';
|
|
13
|
+
import type { FormattedValueComponent } from './components/FormattedValueComponent';
|
|
13
14
|
import type { FormComponent } from './components/FormComponent';
|
|
14
15
|
import type { HeadingComponent } from './components/HeadingComponent';
|
|
15
16
|
import type { ImageComponent } from './components/ImageComponent';
|
|
@@ -41,7 +42,7 @@ import type { TabsComponent } from './components/TabsComponent';
|
|
|
41
42
|
import type { TextInputComponent } from './components/TextInputComponent';
|
|
42
43
|
import type { TupleComponent } from './components/TupleComponent';
|
|
43
44
|
import type { UploadInputComponent } from './components/UploadInputComponent';
|
|
44
|
-
export type DomainComponent = RootDomainComponent | StepDomainComponent | PersistAsyncComponent | AllOfComponent | BooleanInputComponent | ConstComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | RepeatableComponent | SelectInputComponent | TextInputComponent | TupleComponent | UploadInputComponent | AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalLayoutComponent | ModalComponent | MoneyInputComponent | ParagraphComponent | ProgressComponent | ReviewComponent | SearchComponent | SectionComponent | StatusListComponent | TabsComponent;
|
|
45
|
+
export type DomainComponent = RootDomainComponent | StepDomainComponent | PersistAsyncComponent | AllOfComponent | BooleanInputComponent | ConstComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | RepeatableComponent | SelectInputComponent | TextInputComponent | TupleComponent | UploadInputComponent | AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormattedValueComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalLayoutComponent | ModalComponent | MoneyInputComponent | ParagraphComponent | ProgressComponent | ReviewComponent | SearchComponent | SectionComponent | StatusListComponent | TabsComponent;
|
|
45
46
|
export type SchemaComponent = DomainComponent & {
|
|
46
47
|
kind: 'input';
|
|
47
48
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FormattedValueRendererProps } from '@wise/dynamic-flow-types/renderers';
|
|
2
|
+
import type { FormattedValueComponent } from '../../domain/components/FormattedValueComponent';
|
|
3
|
+
import type { RendererMapperProps } from './componentToRendererProps';
|
|
4
|
+
export declare const formattedValueComponentToProps: (component: FormattedValueComponent, rendererMapperProps: RendererMapperProps) => FormattedValueRendererProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MultiSelectComponent } from '../../domain/components/MultiSelectInputComponent';
|
|
2
1
|
import type { MultiSelectInputRendererProps } from '@wise/dynamic-flow-types/renderers';
|
|
2
|
+
import type { MultiSelectComponent } from '../../domain/components/MultiSelectInputComponent';
|
|
3
3
|
import { RendererMapperProps } from './componentToRendererProps';
|
|
4
4
|
export declare const multiSelectInputComponentToProps: (component: MultiSelectComponent, rendererMapperProps: RendererMapperProps) => MultiSelectInputRendererProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SelectInputComponent } from '../../domain/components/SelectInputComponent';
|
|
2
1
|
import type { SelectInputRendererProps } from '@wise/dynamic-flow-types/renderers';
|
|
2
|
+
import type { SelectInputComponent } from '../../domain/components/SelectInputComponent';
|
|
3
3
|
import { type RendererMapperProps } from './componentToRendererProps';
|
|
4
4
|
export declare const selectInputComponentToProps: (component: SelectInputComponent, rendererMapperProps: RendererMapperProps) => SelectInputRendererProps;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SelectInputRendererOption } from '@wise/dynamic-flow-types/renderers';
|
|
2
|
+
import { SelectInputOption } from '../../../domain/components/SelectInputComponent';
|
|
3
|
+
import { SchemaComponent } from '../../../domain/types';
|
|
4
|
+
import { RendererMapperProps } from '../componentToRendererProps';
|
|
5
|
+
export declare const selectInputOptionsToProps: (options: SelectInputOption[], children: SchemaComponent[], rendererMapperProps: RendererMapperProps) => SelectInputRendererOption[];
|
|
@@ -3,11 +3,10 @@ import type { DynamicFlowCoreProps } from './types';
|
|
|
3
3
|
* @experimental This hook may be changed or removed in the future without notice.
|
|
4
4
|
*/
|
|
5
5
|
export declare function useDynamicFlow(props: DynamicFlowCoreProps): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
component: import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
controller: {
|
|
7
|
+
getSubmittableValue: () => Promise<import("@wise/dynamic-flow-types/spec").JsonElement>;
|
|
8
|
+
validate: () => boolean;
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
};
|
|
11
|
+
view: import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
};
|
|
@@ -10,7 +10,6 @@ type UseDynamicFlowCoreProps = Omit<DynamicFlowCoreProps, 'renderers' | 'feature
|
|
|
10
10
|
};
|
|
11
11
|
export declare function useDynamicFlowController(props: UseDynamicFlowCoreProps): {
|
|
12
12
|
rootComponent: RootDomainComponent;
|
|
13
|
-
|
|
14
|
-
navigateBack: () => void;
|
|
13
|
+
cancel: () => void;
|
|
15
14
|
};
|
|
16
15
|
export {};
|
|
@@ -8,3 +8,4 @@ export declare const isNull: (value: unknown) => value is null;
|
|
|
8
8
|
export declare const isUndefined: (value: unknown) => value is undefined;
|
|
9
9
|
export declare const isNullish: (v: unknown) => v is null | undefined;
|
|
10
10
|
export declare const isFile: (value: unknown) => value is File;
|
|
11
|
+
export declare const isValidDate: (value: string | null) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@chromatic-com/storybook": "4.1.3",
|
|
35
|
-
"@formatjs/cli": "^6.
|
|
35
|
+
"@formatjs/cli": "^6.11.0",
|
|
36
36
|
"@storybook/addon-a11y": "^10.1.11",
|
|
37
37
|
"@storybook/addon-docs": "^10.1.11",
|
|
38
38
|
"@storybook/addon-links": "^10.1.11",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"@testing-library/jest-dom": "6.9.1",
|
|
42
42
|
"@testing-library/react": "16.3.1",
|
|
43
43
|
"@testing-library/user-event": "14.6.1",
|
|
44
|
-
"@transferwise/components": "^46.
|
|
44
|
+
"@transferwise/components": "^46.121.1",
|
|
45
45
|
"@transferwise/formatting": "^2.13.4",
|
|
46
|
-
"@transferwise/icons": "4.0.
|
|
46
|
+
"@transferwise/icons": "4.0.2",
|
|
47
47
|
"@transferwise/navigation-ui": "4.41.0",
|
|
48
|
-
"@transferwise/neptune-css": "14.26.
|
|
49
|
-
"@types/node": "22.19.
|
|
48
|
+
"@transferwise/neptune-css": "14.26.1",
|
|
49
|
+
"@types/node": "22.19.7",
|
|
50
50
|
"@types/react": "18.3.27",
|
|
51
51
|
"@types/react-dom": "18.3.7",
|
|
52
52
|
"@types/react-intl": "3.0.0",
|
|
53
53
|
"@vitejs/plugin-react": "5.1.2",
|
|
54
|
-
"@wise/art": "2.
|
|
55
|
-
"@wise/components-theming": "^1.
|
|
54
|
+
"@wise/art": "2.26.0",
|
|
55
|
+
"@wise/components-theming": "^1.10.0",
|
|
56
56
|
"esbuild": "0.27.0",
|
|
57
57
|
"eslint-plugin-storybook": "10.1.11",
|
|
58
|
-
"framer-motion": "^12.
|
|
58
|
+
"framer-motion": "^12.26.2",
|
|
59
59
|
"npm-run-all2": "8.0.4",
|
|
60
60
|
"postcss": "^8.5.6",
|
|
61
61
|
"postcss-cli": "^11.0.1",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"stylelint-value-no-unknown-custom-properties": "6.1.0",
|
|
71
71
|
"tsx": "4.21.0",
|
|
72
72
|
"typescript": "5.9.3",
|
|
73
|
-
"vitest": "4.0.
|
|
73
|
+
"vitest": "4.0.17",
|
|
74
74
|
"vitest-fetch-mock": "0.4.5",
|
|
75
|
-
"@wise/dynamic-flow-
|
|
76
|
-
"@wise/dynamic-flow-
|
|
75
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
76
|
+
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@transferwise/components": "^46.104.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"react-intl": "^6"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@wise/dynamic-flow-types": "4.
|
|
89
|
+
"@wise/dynamic-flow-types": "4.4.0"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",
|