@wise/dynamic-flow-client 4.4.0 → 4.5.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/main.js +144 -35
- package/build/main.mjs +144 -35
- package/build/types/revamp/domain/components/DecisionComponent.d.ts +4 -1
- package/build/types/revamp/domain/components/ListComponent.d.ts +5 -4
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +8 -8
- package/build/types/revamp/domain/components/RootDomainComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/step/ExternalConfirmationComponent.d.ts +12 -0
- package/build/types/revamp/domain/components/{StepDomainComponent.d.ts → step/StepDomainComponent.d.ts} +8 -7
- package/build/types/revamp/domain/mappers/mapStepToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +3 -3
- package/build/types/revamp/domain/mappers/utils/utils.d.ts +4 -0
- package/build/types/revamp/domain/types.d.ts +16 -2
- package/build/types/revamp/renderers/mappers/externalComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/package.json +7 -7
package/build/main.js
CHANGED
|
@@ -1117,6 +1117,7 @@ function getChildren(node) {
|
|
|
1117
1117
|
case "status-list":
|
|
1118
1118
|
case "input-text":
|
|
1119
1119
|
case "input-upload":
|
|
1120
|
+
case "external-confirmation":
|
|
1120
1121
|
return [];
|
|
1121
1122
|
}
|
|
1122
1123
|
}
|
|
@@ -1539,7 +1540,10 @@ var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
|
1539
1540
|
};
|
|
1540
1541
|
|
|
1541
1542
|
// src/revamp/renderers/mappers/reviewComponentToProps.ts
|
|
1542
|
-
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "
|
|
1543
|
+
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "margin", "title")), {
|
|
1544
|
+
fields: component.fields.map(mapField)
|
|
1545
|
+
}), rendererMapperProps);
|
|
1546
|
+
var mapField = (field) => __spreadValues({}, field);
|
|
1543
1547
|
|
|
1544
1548
|
// src/revamp/domain/mappers/utils/image.ts
|
|
1545
1549
|
var mapSpecImage = (image) => {
|
|
@@ -1675,11 +1679,17 @@ var tupleComponentToProps = (component, rendererMapperProps) => {
|
|
|
1675
1679
|
|
|
1676
1680
|
// src/revamp/renderers/mappers/listComponentToProps.ts
|
|
1677
1681
|
var listComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "margin", "title")), rendererMapperProps), {
|
|
1678
|
-
items: component.items.map(
|
|
1679
|
-
var item = __objRest(_a, []);
|
|
1680
|
-
return __spreadValues({}, item);
|
|
1681
|
-
})
|
|
1682
|
+
items: component.items.map(mapItem)
|
|
1682
1683
|
});
|
|
1684
|
+
var mapItem = (item) => {
|
|
1685
|
+
var _a, _b;
|
|
1686
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
1687
|
+
// populate deprecated fields
|
|
1688
|
+
subtitle: item.description,
|
|
1689
|
+
value: (_a = item.supportingValues) == null ? void 0 : _a.value,
|
|
1690
|
+
subvalue: (_b = item.supportingValues) == null ? void 0 : _b.subvalue
|
|
1691
|
+
});
|
|
1692
|
+
};
|
|
1683
1693
|
|
|
1684
1694
|
// src/revamp/renderers/stepComponentToProps.ts
|
|
1685
1695
|
var stepComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -1689,7 +1699,6 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1689
1699
|
control,
|
|
1690
1700
|
description,
|
|
1691
1701
|
error,
|
|
1692
|
-
external,
|
|
1693
1702
|
loadingState,
|
|
1694
1703
|
step,
|
|
1695
1704
|
title,
|
|
@@ -1704,7 +1713,6 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1704
1713
|
control,
|
|
1705
1714
|
description,
|
|
1706
1715
|
error,
|
|
1707
|
-
external,
|
|
1708
1716
|
loadingState,
|
|
1709
1717
|
step,
|
|
1710
1718
|
title,
|
|
@@ -1719,12 +1727,12 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1719
1727
|
// src/revamp/renderers/mappers/rootComponentToProps.ts
|
|
1720
1728
|
var rootComponentToProps = (rootComponent, rendererMapperProps) => {
|
|
1721
1729
|
const childrenProps = rootComponent.getChildren().map((child) => componentToRendererProps(child, rendererMapperProps));
|
|
1722
|
-
return {
|
|
1730
|
+
return __spreadValues({
|
|
1723
1731
|
type: "root",
|
|
1724
1732
|
uid: rootComponent.uid,
|
|
1725
1733
|
children: childrenProps.map(rendererMapperProps.render),
|
|
1726
1734
|
childrenProps
|
|
1727
|
-
};
|
|
1735
|
+
}, rendererMapperProps);
|
|
1728
1736
|
};
|
|
1729
1737
|
|
|
1730
1738
|
// src/revamp/renderers/mappers/modalContentComponentToProps.ts
|
|
@@ -1742,6 +1750,19 @@ var modalContentComponentToProps = (component, rendererMapperProps) => {
|
|
|
1742
1750
|
}, rendererMapperProps);
|
|
1743
1751
|
};
|
|
1744
1752
|
|
|
1753
|
+
// src/revamp/renderers/mappers/externalComponentToProps.ts
|
|
1754
|
+
var externalComponentToProps = (component, rendererMapperProps) => {
|
|
1755
|
+
return __spreadValues({
|
|
1756
|
+
type: "external-confirmation",
|
|
1757
|
+
uid: component.uid,
|
|
1758
|
+
url: component.url,
|
|
1759
|
+
status: component.status,
|
|
1760
|
+
onSuccess: component.onSuccess.bind(component),
|
|
1761
|
+
onFailure: component.onFailure.bind(component),
|
|
1762
|
+
onCancel: component.onCancel.bind(component)
|
|
1763
|
+
}, rendererMapperProps);
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1745
1766
|
// src/revamp/renderers/mappers/componentToRendererProps.ts
|
|
1746
1767
|
var componentToRendererProps = (component, rendererMapperProps) => {
|
|
1747
1768
|
if (isHiddenComponent(component)) {
|
|
@@ -1772,6 +1793,8 @@ var componentToRendererProps = (component, rendererMapperProps) => {
|
|
|
1772
1793
|
return decisionComponentToProps(component, rendererMapperProps);
|
|
1773
1794
|
case "divider":
|
|
1774
1795
|
return dividerComponentToProps(component, rendererMapperProps);
|
|
1796
|
+
case "external-confirmation":
|
|
1797
|
+
return externalComponentToProps(component, rendererMapperProps);
|
|
1775
1798
|
case "form":
|
|
1776
1799
|
return formComponentToProps(component, rendererMapperProps);
|
|
1777
1800
|
case "heading":
|
|
@@ -1935,6 +1958,40 @@ var createRootDomainComponent = (updateComponent) => {
|
|
|
1935
1958
|
return rootComponent;
|
|
1936
1959
|
};
|
|
1937
1960
|
|
|
1961
|
+
// src/revamp/domain/components/step/ExternalConfirmationComponent.ts
|
|
1962
|
+
var createExternalConfirmation = (uid, url, updateComponent) => {
|
|
1963
|
+
const update = getInputUpdateFunction(updateComponent);
|
|
1964
|
+
return {
|
|
1965
|
+
type: "external-confirmation",
|
|
1966
|
+
uid,
|
|
1967
|
+
url,
|
|
1968
|
+
status: "initial",
|
|
1969
|
+
onSuccess() {
|
|
1970
|
+
update(this, (draft) => {
|
|
1971
|
+
draft.status = "success";
|
|
1972
|
+
});
|
|
1973
|
+
},
|
|
1974
|
+
onFailure() {
|
|
1975
|
+
if (this.status === "initial") {
|
|
1976
|
+
update(this, (draft) => {
|
|
1977
|
+
draft.status = "failure";
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
},
|
|
1981
|
+
onCancel() {
|
|
1982
|
+
update(this, (draft) => {
|
|
1983
|
+
draft.status = "dismissed";
|
|
1984
|
+
});
|
|
1985
|
+
},
|
|
1986
|
+
getSubmittableValue: async () => null,
|
|
1987
|
+
getSubmittableValueSync: () => null,
|
|
1988
|
+
getLocalValue: () => null,
|
|
1989
|
+
getSummary: () => ({}),
|
|
1990
|
+
// Noop
|
|
1991
|
+
validate: () => true
|
|
1992
|
+
};
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1938
1995
|
// src/revamp/domain/features/summary/summary-utils.ts
|
|
1939
1996
|
var getSummariser = (schema) => (value) => {
|
|
1940
1997
|
const { summary, icon, image } = schema;
|
|
@@ -1975,7 +2032,7 @@ var summaryIfProvides = (summary, { value, icon, image }) => {
|
|
|
1975
2032
|
var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
|
|
1976
2033
|
var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
|
|
1977
2034
|
|
|
1978
|
-
// src/revamp/domain/components/StepDomainComponent.ts
|
|
2035
|
+
// src/revamp/domain/components/step/StepDomainComponent.ts
|
|
1979
2036
|
var createStepComponent = (stepProps) => {
|
|
1980
2037
|
const _a = stepProps, { uid, stepPolling, stepRefreshAfter, updateComponent } = _a, rest = __objRest(_a, ["uid", "stepPolling", "stepRefreshAfter", "updateComponent"]);
|
|
1981
2038
|
const update = getInputUpdateFunction(updateComponent);
|
|
@@ -2002,7 +2059,7 @@ var createStepComponent = (stepProps) => {
|
|
|
2002
2059
|
update(this, updateFn);
|
|
2003
2060
|
},
|
|
2004
2061
|
getChildren() {
|
|
2005
|
-
return this.components;
|
|
2062
|
+
return this.externalConfirmation ? [...this.components, this.externalConfirmation] : this.components;
|
|
2006
2063
|
},
|
|
2007
2064
|
getModals() {
|
|
2008
2065
|
return this.modals;
|
|
@@ -2421,6 +2478,27 @@ var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
|
|
|
2421
2478
|
validate: () => true
|
|
2422
2479
|
});
|
|
2423
2480
|
|
|
2481
|
+
// src/revamp/domain/mappers/utils/utils.ts
|
|
2482
|
+
var mapInlineAlert = (alert) => {
|
|
2483
|
+
return alert ? {
|
|
2484
|
+
content: alert.content,
|
|
2485
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
2486
|
+
} : void 0;
|
|
2487
|
+
};
|
|
2488
|
+
var mapAdditionalInfo = (info, onBehavior) => {
|
|
2489
|
+
if (info) {
|
|
2490
|
+
const behavior = getDomainLayerBehavior(info, []);
|
|
2491
|
+
return {
|
|
2492
|
+
text: info.text,
|
|
2493
|
+
accessibilityDescription: info.accessibilityDescription,
|
|
2494
|
+
onClick: () => {
|
|
2495
|
+
void onBehavior(behavior);
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
return void 0;
|
|
2500
|
+
};
|
|
2501
|
+
|
|
2424
2502
|
// src/revamp/domain/mappers/layout/decisionLayoutToComponent.ts
|
|
2425
2503
|
var decisionLayoutToComponent = (uid, {
|
|
2426
2504
|
control,
|
|
@@ -2431,20 +2509,22 @@ var decisionLayoutToComponent = (uid, {
|
|
|
2431
2509
|
uid,
|
|
2432
2510
|
control,
|
|
2433
2511
|
margin,
|
|
2434
|
-
options: options.map((option) =>
|
|
2435
|
-
var _a, _b;
|
|
2436
|
-
const behavior = getDomainLayerBehavior(option, (_a = step.actions) != null ? _a : []);
|
|
2437
|
-
return __spreadProps(__spreadValues({}, option), {
|
|
2438
|
-
disabled: (_b = option.disabled) != null ? _b : false,
|
|
2439
|
-
href: behavior.type === "link" ? behavior.url : void 0,
|
|
2440
|
-
image: mapSpecImage(option.image),
|
|
2441
|
-
onClick: () => {
|
|
2442
|
-
void onBehavior(behavior);
|
|
2443
|
-
}
|
|
2444
|
-
});
|
|
2445
|
-
}),
|
|
2512
|
+
options: options.map((option) => mapOption(option, onBehavior, step.actions)),
|
|
2446
2513
|
title
|
|
2447
2514
|
});
|
|
2515
|
+
var mapOption = (option, onBehavior, stepActions = []) => {
|
|
2516
|
+
var _a;
|
|
2517
|
+
const behavior = getDomainLayerBehavior(option, stepActions);
|
|
2518
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
2519
|
+
disabled: (_a = option.disabled) != null ? _a : false,
|
|
2520
|
+
href: behavior.type === "link" ? behavior.url : void 0,
|
|
2521
|
+
image: mapSpecImage(option.image),
|
|
2522
|
+
inlineAlert: mapInlineAlert(option.inlineAlert),
|
|
2523
|
+
onClick: () => {
|
|
2524
|
+
void onBehavior(behavior);
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2527
|
+
};
|
|
2448
2528
|
|
|
2449
2529
|
// src/revamp/domain/components/DividerComponent.ts
|
|
2450
2530
|
var createDividerComponent = (props) => __spreadProps(__spreadValues({
|
|
@@ -5505,16 +5585,13 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
5505
5585
|
// src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
5506
5586
|
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onBehavior, step }) => createReviewComponent({
|
|
5507
5587
|
uid,
|
|
5508
|
-
callToAction:
|
|
5588
|
+
callToAction: getCallToAction2({ onBehavior, callToAction, action, stepActions: step.actions }),
|
|
5509
5589
|
control: getOrientationControl({ control, orientation }),
|
|
5510
|
-
fields: fields.map((field) => {
|
|
5511
|
-
var _a;
|
|
5512
|
-
return __spreadProps(__spreadValues({}, field), { help: (_a = field.help) == null ? void 0 : _a.markdown });
|
|
5513
|
-
}),
|
|
5590
|
+
fields: fields.map((field) => mapReviewField(field, { onBehavior, step })),
|
|
5514
5591
|
margin,
|
|
5515
5592
|
title
|
|
5516
5593
|
});
|
|
5517
|
-
var
|
|
5594
|
+
var getCallToAction2 = ({
|
|
5518
5595
|
onBehavior,
|
|
5519
5596
|
callToAction,
|
|
5520
5597
|
action,
|
|
@@ -5525,6 +5602,7 @@ var getReviewAction = ({
|
|
|
5525
5602
|
}
|
|
5526
5603
|
if (action == null ? void 0 : action.title) {
|
|
5527
5604
|
return {
|
|
5605
|
+
type: "action",
|
|
5528
5606
|
title: action.title,
|
|
5529
5607
|
onClick: () => {
|
|
5530
5608
|
void onBehavior({ type: "action", action });
|
|
@@ -5545,6 +5623,20 @@ var getOrientationControl = ({
|
|
|
5545
5623
|
}
|
|
5546
5624
|
return void 0;
|
|
5547
5625
|
};
|
|
5626
|
+
var mapReviewField = (field, { onBehavior, step }) => {
|
|
5627
|
+
var _a, _b;
|
|
5628
|
+
return __spreadProps(__spreadValues({}, field), {
|
|
5629
|
+
image: mapSpecImage(field.image),
|
|
5630
|
+
help: (_a = field.help) == null ? void 0 : _a.markdown,
|
|
5631
|
+
inlineAlert: mapInlineAlert(field.inlineAlert),
|
|
5632
|
+
additionalInfo: mapAdditionalInfo(field.additionalInfo, onBehavior),
|
|
5633
|
+
callToAction: getCallToAction2({
|
|
5634
|
+
onBehavior,
|
|
5635
|
+
callToAction: field.callToAction,
|
|
5636
|
+
stepActions: (_b = step.actions) != null ? _b : []
|
|
5637
|
+
})
|
|
5638
|
+
});
|
|
5639
|
+
};
|
|
5548
5640
|
|
|
5549
5641
|
// src/revamp/domain/components/searchComponent/SearchComponent.ts
|
|
5550
5642
|
var DEBOUNCE_TIME = 400;
|
|
@@ -5764,14 +5856,30 @@ var listLayoutToComponent = (uid, { callToAction, control, items, margin = "md",
|
|
|
5764
5856
|
return createListComponent({
|
|
5765
5857
|
uid,
|
|
5766
5858
|
control,
|
|
5767
|
-
items: items.map((item) =>
|
|
5768
|
-
image: mapSpecImage(item.image)
|
|
5769
|
-
})),
|
|
5859
|
+
items: items.map((item) => mapItem2(item, mapperProps)),
|
|
5770
5860
|
callToAction: getDomainLayerCallToAction(callToAction, onBehavior, (_a = step.actions) != null ? _a : []),
|
|
5771
5861
|
margin,
|
|
5772
5862
|
title
|
|
5773
5863
|
});
|
|
5774
5864
|
};
|
|
5865
|
+
var mapItem2 = (item, mapperProps) => {
|
|
5866
|
+
var _b;
|
|
5867
|
+
const _a = item, { value, subvalue, subtitle } = _a, rest = __objRest(_a, ["value", "subvalue", "subtitle"]);
|
|
5868
|
+
return __spreadProps(__spreadValues({}, rest), {
|
|
5869
|
+
description: (_b = item.description) != null ? _b : subtitle,
|
|
5870
|
+
image: mapSpecImage(item.image),
|
|
5871
|
+
supportingValues: mapSupportingValues(item),
|
|
5872
|
+
additionalInfo: mapAdditionalInfo(item.additionalInfo, mapperProps.onBehavior),
|
|
5873
|
+
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
5874
|
+
});
|
|
5875
|
+
};
|
|
5876
|
+
var mapSupportingValues = (item) => {
|
|
5877
|
+
const { value, subvalue, supportingValues } = item;
|
|
5878
|
+
if (supportingValues) {
|
|
5879
|
+
return supportingValues;
|
|
5880
|
+
}
|
|
5881
|
+
return value || subvalue ? { value, subvalue } : void 0;
|
|
5882
|
+
};
|
|
5775
5883
|
|
|
5776
5884
|
// src/revamp/domain/mappers/mapLayoutToComponent.ts
|
|
5777
5885
|
var mapLayoutToComponent = (uid, layout, mapperProps) => {
|
|
@@ -5906,6 +6014,7 @@ var mapStepToComponent = (_a) => {
|
|
|
5906
6014
|
const onRefresh = async (schemaId, url) => restProps.onRefresh(schemaId, url != null ? url : refreshUrl);
|
|
5907
6015
|
const stepPolling = polling ? getStepPolling({ pollingConfig: polling, onBehavior, onPoll }) : void 0;
|
|
5908
6016
|
const stepRefreshAfter = refreshAfter ? getStepRefreshAfter({ refreshAfter, onRefresh }) : void 0;
|
|
6017
|
+
const externalConfirmation = (external == null ? void 0 : external.url) ? createExternalConfirmation(`${uid}-external-confirmation`, external == null ? void 0 : external.url, updateComponent) : void 0;
|
|
5909
6018
|
const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior, onRefresh });
|
|
5910
6019
|
const unreferencedSchemaFormComponents = mapUnreferencedSchemas(mapperProps);
|
|
5911
6020
|
const layoutComponents = layout.map(
|
|
@@ -5919,7 +6028,7 @@ var mapStepToComponent = (_a) => {
|
|
|
5919
6028
|
control,
|
|
5920
6029
|
description,
|
|
5921
6030
|
error: errors == null ? void 0 : errors.error,
|
|
5922
|
-
|
|
6031
|
+
externalConfirmation,
|
|
5923
6032
|
loadingState,
|
|
5924
6033
|
stepPolling,
|
|
5925
6034
|
stepRefreshAfter,
|
|
@@ -11672,7 +11781,7 @@ var getDefinitionListLayout = (review) => {
|
|
|
11672
11781
|
function DynamicReview({ component: review, onAction }) {
|
|
11673
11782
|
var _a, _b;
|
|
11674
11783
|
const margin = getMargin(review.margin || "xs");
|
|
11675
|
-
const
|
|
11784
|
+
const getReviewAction = (callToAction2) => {
|
|
11676
11785
|
const { title, action, behavior } = callToAction2;
|
|
11677
11786
|
if (behavior) {
|
|
11678
11787
|
if ("type" in behavior) {
|
|
@@ -11720,7 +11829,7 @@ function DynamicReview({ component: review, onAction }) {
|
|
|
11720
11829
|
};
|
|
11721
11830
|
};
|
|
11722
11831
|
const orientation = getDefinitionListLayout(review);
|
|
11723
|
-
const callToAction = review.callToAction ?
|
|
11832
|
+
const callToAction = review.callToAction ? getReviewAction(review.callToAction) : null;
|
|
11724
11833
|
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick(review.action) } : null;
|
|
11725
11834
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: margin, children: [
|
|
11726
11835
|
review.title && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components30.Header, { title: review.title, action: (_b = callToAction != null ? callToAction : legacyCallToAction) != null ? _b : void 0 }),
|
package/build/main.mjs
CHANGED
|
@@ -1074,6 +1074,7 @@ function getChildren(node) {
|
|
|
1074
1074
|
case "status-list":
|
|
1075
1075
|
case "input-text":
|
|
1076
1076
|
case "input-upload":
|
|
1077
|
+
case "external-confirmation":
|
|
1077
1078
|
return [];
|
|
1078
1079
|
}
|
|
1079
1080
|
}
|
|
@@ -1496,7 +1497,10 @@ var repeatableComponentToProps = (component, rendererMapperProps) => {
|
|
|
1496
1497
|
};
|
|
1497
1498
|
|
|
1498
1499
|
// src/revamp/renderers/mappers/reviewComponentToProps.ts
|
|
1499
|
-
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "
|
|
1500
|
+
var reviewComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "margin", "title")), {
|
|
1501
|
+
fields: component.fields.map(mapField)
|
|
1502
|
+
}), rendererMapperProps);
|
|
1503
|
+
var mapField = (field) => __spreadValues({}, field);
|
|
1500
1504
|
|
|
1501
1505
|
// src/revamp/domain/mappers/utils/image.ts
|
|
1502
1506
|
var mapSpecImage = (image) => {
|
|
@@ -1632,11 +1636,17 @@ var tupleComponentToProps = (component, rendererMapperProps) => {
|
|
|
1632
1636
|
|
|
1633
1637
|
// src/revamp/renderers/mappers/listComponentToProps.ts
|
|
1634
1638
|
var listComponentToProps = (component, rendererMapperProps) => __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "type", "callToAction", "control", "margin", "title")), rendererMapperProps), {
|
|
1635
|
-
items: component.items.map(
|
|
1636
|
-
var item = __objRest(_a, []);
|
|
1637
|
-
return __spreadValues({}, item);
|
|
1638
|
-
})
|
|
1639
|
+
items: component.items.map(mapItem)
|
|
1639
1640
|
});
|
|
1641
|
+
var mapItem = (item) => {
|
|
1642
|
+
var _a, _b;
|
|
1643
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
1644
|
+
// populate deprecated fields
|
|
1645
|
+
subtitle: item.description,
|
|
1646
|
+
value: (_a = item.supportingValues) == null ? void 0 : _a.value,
|
|
1647
|
+
subvalue: (_b = item.supportingValues) == null ? void 0 : _b.subvalue
|
|
1648
|
+
});
|
|
1649
|
+
};
|
|
1640
1650
|
|
|
1641
1651
|
// src/revamp/renderers/stepComponentToProps.ts
|
|
1642
1652
|
var stepComponentToProps = (component, rendererMapperProps) => {
|
|
@@ -1646,7 +1656,6 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1646
1656
|
control,
|
|
1647
1657
|
description,
|
|
1648
1658
|
error,
|
|
1649
|
-
external,
|
|
1650
1659
|
loadingState,
|
|
1651
1660
|
step,
|
|
1652
1661
|
title,
|
|
@@ -1661,7 +1670,6 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1661
1670
|
control,
|
|
1662
1671
|
description,
|
|
1663
1672
|
error,
|
|
1664
|
-
external,
|
|
1665
1673
|
loadingState,
|
|
1666
1674
|
step,
|
|
1667
1675
|
title,
|
|
@@ -1676,12 +1684,12 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1676
1684
|
// src/revamp/renderers/mappers/rootComponentToProps.ts
|
|
1677
1685
|
var rootComponentToProps = (rootComponent, rendererMapperProps) => {
|
|
1678
1686
|
const childrenProps = rootComponent.getChildren().map((child) => componentToRendererProps(child, rendererMapperProps));
|
|
1679
|
-
return {
|
|
1687
|
+
return __spreadValues({
|
|
1680
1688
|
type: "root",
|
|
1681
1689
|
uid: rootComponent.uid,
|
|
1682
1690
|
children: childrenProps.map(rendererMapperProps.render),
|
|
1683
1691
|
childrenProps
|
|
1684
|
-
};
|
|
1692
|
+
}, rendererMapperProps);
|
|
1685
1693
|
};
|
|
1686
1694
|
|
|
1687
1695
|
// src/revamp/renderers/mappers/modalContentComponentToProps.ts
|
|
@@ -1699,6 +1707,19 @@ var modalContentComponentToProps = (component, rendererMapperProps) => {
|
|
|
1699
1707
|
}, rendererMapperProps);
|
|
1700
1708
|
};
|
|
1701
1709
|
|
|
1710
|
+
// src/revamp/renderers/mappers/externalComponentToProps.ts
|
|
1711
|
+
var externalComponentToProps = (component, rendererMapperProps) => {
|
|
1712
|
+
return __spreadValues({
|
|
1713
|
+
type: "external-confirmation",
|
|
1714
|
+
uid: component.uid,
|
|
1715
|
+
url: component.url,
|
|
1716
|
+
status: component.status,
|
|
1717
|
+
onSuccess: component.onSuccess.bind(component),
|
|
1718
|
+
onFailure: component.onFailure.bind(component),
|
|
1719
|
+
onCancel: component.onCancel.bind(component)
|
|
1720
|
+
}, rendererMapperProps);
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1702
1723
|
// src/revamp/renderers/mappers/componentToRendererProps.ts
|
|
1703
1724
|
var componentToRendererProps = (component, rendererMapperProps) => {
|
|
1704
1725
|
if (isHiddenComponent(component)) {
|
|
@@ -1729,6 +1750,8 @@ var componentToRendererProps = (component, rendererMapperProps) => {
|
|
|
1729
1750
|
return decisionComponentToProps(component, rendererMapperProps);
|
|
1730
1751
|
case "divider":
|
|
1731
1752
|
return dividerComponentToProps(component, rendererMapperProps);
|
|
1753
|
+
case "external-confirmation":
|
|
1754
|
+
return externalComponentToProps(component, rendererMapperProps);
|
|
1732
1755
|
case "form":
|
|
1733
1756
|
return formComponentToProps(component, rendererMapperProps);
|
|
1734
1757
|
case "heading":
|
|
@@ -1892,6 +1915,40 @@ var createRootDomainComponent = (updateComponent) => {
|
|
|
1892
1915
|
return rootComponent;
|
|
1893
1916
|
};
|
|
1894
1917
|
|
|
1918
|
+
// src/revamp/domain/components/step/ExternalConfirmationComponent.ts
|
|
1919
|
+
var createExternalConfirmation = (uid, url, updateComponent) => {
|
|
1920
|
+
const update = getInputUpdateFunction(updateComponent);
|
|
1921
|
+
return {
|
|
1922
|
+
type: "external-confirmation",
|
|
1923
|
+
uid,
|
|
1924
|
+
url,
|
|
1925
|
+
status: "initial",
|
|
1926
|
+
onSuccess() {
|
|
1927
|
+
update(this, (draft) => {
|
|
1928
|
+
draft.status = "success";
|
|
1929
|
+
});
|
|
1930
|
+
},
|
|
1931
|
+
onFailure() {
|
|
1932
|
+
if (this.status === "initial") {
|
|
1933
|
+
update(this, (draft) => {
|
|
1934
|
+
draft.status = "failure";
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
},
|
|
1938
|
+
onCancel() {
|
|
1939
|
+
update(this, (draft) => {
|
|
1940
|
+
draft.status = "dismissed";
|
|
1941
|
+
});
|
|
1942
|
+
},
|
|
1943
|
+
getSubmittableValue: async () => null,
|
|
1944
|
+
getSubmittableValueSync: () => null,
|
|
1945
|
+
getLocalValue: () => null,
|
|
1946
|
+
getSummary: () => ({}),
|
|
1947
|
+
// Noop
|
|
1948
|
+
validate: () => true
|
|
1949
|
+
};
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1895
1952
|
// src/revamp/domain/features/summary/summary-utils.ts
|
|
1896
1953
|
var getSummariser = (schema) => (value) => {
|
|
1897
1954
|
const { summary, icon, image } = schema;
|
|
@@ -1932,7 +1989,7 @@ var summaryIfProvides = (summary, { value, icon, image }) => {
|
|
|
1932
1989
|
var validateComponents = (components) => components.reduce((acc, component) => component.validate() && acc, true);
|
|
1933
1990
|
var getLocalValueValidator = (checks) => (currentValue) => checks.map((check) => check(currentValue)).filter(isString);
|
|
1934
1991
|
|
|
1935
|
-
// src/revamp/domain/components/StepDomainComponent.ts
|
|
1992
|
+
// src/revamp/domain/components/step/StepDomainComponent.ts
|
|
1936
1993
|
var createStepComponent = (stepProps) => {
|
|
1937
1994
|
const _a = stepProps, { uid, stepPolling, stepRefreshAfter, updateComponent } = _a, rest = __objRest(_a, ["uid", "stepPolling", "stepRefreshAfter", "updateComponent"]);
|
|
1938
1995
|
const update = getInputUpdateFunction(updateComponent);
|
|
@@ -1959,7 +2016,7 @@ var createStepComponent = (stepProps) => {
|
|
|
1959
2016
|
update(this, updateFn);
|
|
1960
2017
|
},
|
|
1961
2018
|
getChildren() {
|
|
1962
|
-
return this.components;
|
|
2019
|
+
return this.externalConfirmation ? [...this.components, this.externalConfirmation] : this.components;
|
|
1963
2020
|
},
|
|
1964
2021
|
getModals() {
|
|
1965
2022
|
return this.modals;
|
|
@@ -2378,6 +2435,27 @@ var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
|
|
|
2378
2435
|
validate: () => true
|
|
2379
2436
|
});
|
|
2380
2437
|
|
|
2438
|
+
// src/revamp/domain/mappers/utils/utils.ts
|
|
2439
|
+
var mapInlineAlert = (alert) => {
|
|
2440
|
+
return alert ? {
|
|
2441
|
+
content: alert.content,
|
|
2442
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
2443
|
+
} : void 0;
|
|
2444
|
+
};
|
|
2445
|
+
var mapAdditionalInfo = (info, onBehavior) => {
|
|
2446
|
+
if (info) {
|
|
2447
|
+
const behavior = getDomainLayerBehavior(info, []);
|
|
2448
|
+
return {
|
|
2449
|
+
text: info.text,
|
|
2450
|
+
accessibilityDescription: info.accessibilityDescription,
|
|
2451
|
+
onClick: () => {
|
|
2452
|
+
void onBehavior(behavior);
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
}
|
|
2456
|
+
return void 0;
|
|
2457
|
+
};
|
|
2458
|
+
|
|
2381
2459
|
// src/revamp/domain/mappers/layout/decisionLayoutToComponent.ts
|
|
2382
2460
|
var decisionLayoutToComponent = (uid, {
|
|
2383
2461
|
control,
|
|
@@ -2388,20 +2466,22 @@ var decisionLayoutToComponent = (uid, {
|
|
|
2388
2466
|
uid,
|
|
2389
2467
|
control,
|
|
2390
2468
|
margin,
|
|
2391
|
-
options: options.map((option) =>
|
|
2392
|
-
var _a, _b;
|
|
2393
|
-
const behavior = getDomainLayerBehavior(option, (_a = step.actions) != null ? _a : []);
|
|
2394
|
-
return __spreadProps(__spreadValues({}, option), {
|
|
2395
|
-
disabled: (_b = option.disabled) != null ? _b : false,
|
|
2396
|
-
href: behavior.type === "link" ? behavior.url : void 0,
|
|
2397
|
-
image: mapSpecImage(option.image),
|
|
2398
|
-
onClick: () => {
|
|
2399
|
-
void onBehavior(behavior);
|
|
2400
|
-
}
|
|
2401
|
-
});
|
|
2402
|
-
}),
|
|
2469
|
+
options: options.map((option) => mapOption(option, onBehavior, step.actions)),
|
|
2403
2470
|
title
|
|
2404
2471
|
});
|
|
2472
|
+
var mapOption = (option, onBehavior, stepActions = []) => {
|
|
2473
|
+
var _a;
|
|
2474
|
+
const behavior = getDomainLayerBehavior(option, stepActions);
|
|
2475
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
2476
|
+
disabled: (_a = option.disabled) != null ? _a : false,
|
|
2477
|
+
href: behavior.type === "link" ? behavior.url : void 0,
|
|
2478
|
+
image: mapSpecImage(option.image),
|
|
2479
|
+
inlineAlert: mapInlineAlert(option.inlineAlert),
|
|
2480
|
+
onClick: () => {
|
|
2481
|
+
void onBehavior(behavior);
|
|
2482
|
+
}
|
|
2483
|
+
});
|
|
2484
|
+
};
|
|
2405
2485
|
|
|
2406
2486
|
// src/revamp/domain/components/DividerComponent.ts
|
|
2407
2487
|
var createDividerComponent = (props) => __spreadProps(__spreadValues({
|
|
@@ -5462,16 +5542,13 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
5462
5542
|
// src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
5463
5543
|
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onBehavior, step }) => createReviewComponent({
|
|
5464
5544
|
uid,
|
|
5465
|
-
callToAction:
|
|
5545
|
+
callToAction: getCallToAction2({ onBehavior, callToAction, action, stepActions: step.actions }),
|
|
5466
5546
|
control: getOrientationControl({ control, orientation }),
|
|
5467
|
-
fields: fields.map((field) => {
|
|
5468
|
-
var _a;
|
|
5469
|
-
return __spreadProps(__spreadValues({}, field), { help: (_a = field.help) == null ? void 0 : _a.markdown });
|
|
5470
|
-
}),
|
|
5547
|
+
fields: fields.map((field) => mapReviewField(field, { onBehavior, step })),
|
|
5471
5548
|
margin,
|
|
5472
5549
|
title
|
|
5473
5550
|
});
|
|
5474
|
-
var
|
|
5551
|
+
var getCallToAction2 = ({
|
|
5475
5552
|
onBehavior,
|
|
5476
5553
|
callToAction,
|
|
5477
5554
|
action,
|
|
@@ -5482,6 +5559,7 @@ var getReviewAction = ({
|
|
|
5482
5559
|
}
|
|
5483
5560
|
if (action == null ? void 0 : action.title) {
|
|
5484
5561
|
return {
|
|
5562
|
+
type: "action",
|
|
5485
5563
|
title: action.title,
|
|
5486
5564
|
onClick: () => {
|
|
5487
5565
|
void onBehavior({ type: "action", action });
|
|
@@ -5502,6 +5580,20 @@ var getOrientationControl = ({
|
|
|
5502
5580
|
}
|
|
5503
5581
|
return void 0;
|
|
5504
5582
|
};
|
|
5583
|
+
var mapReviewField = (field, { onBehavior, step }) => {
|
|
5584
|
+
var _a, _b;
|
|
5585
|
+
return __spreadProps(__spreadValues({}, field), {
|
|
5586
|
+
image: mapSpecImage(field.image),
|
|
5587
|
+
help: (_a = field.help) == null ? void 0 : _a.markdown,
|
|
5588
|
+
inlineAlert: mapInlineAlert(field.inlineAlert),
|
|
5589
|
+
additionalInfo: mapAdditionalInfo(field.additionalInfo, onBehavior),
|
|
5590
|
+
callToAction: getCallToAction2({
|
|
5591
|
+
onBehavior,
|
|
5592
|
+
callToAction: field.callToAction,
|
|
5593
|
+
stepActions: (_b = step.actions) != null ? _b : []
|
|
5594
|
+
})
|
|
5595
|
+
});
|
|
5596
|
+
};
|
|
5505
5597
|
|
|
5506
5598
|
// src/revamp/domain/components/searchComponent/SearchComponent.ts
|
|
5507
5599
|
var DEBOUNCE_TIME = 400;
|
|
@@ -5721,14 +5813,30 @@ var listLayoutToComponent = (uid, { callToAction, control, items, margin = "md",
|
|
|
5721
5813
|
return createListComponent({
|
|
5722
5814
|
uid,
|
|
5723
5815
|
control,
|
|
5724
|
-
items: items.map((item) =>
|
|
5725
|
-
image: mapSpecImage(item.image)
|
|
5726
|
-
})),
|
|
5816
|
+
items: items.map((item) => mapItem2(item, mapperProps)),
|
|
5727
5817
|
callToAction: getDomainLayerCallToAction(callToAction, onBehavior, (_a = step.actions) != null ? _a : []),
|
|
5728
5818
|
margin,
|
|
5729
5819
|
title
|
|
5730
5820
|
});
|
|
5731
5821
|
};
|
|
5822
|
+
var mapItem2 = (item, mapperProps) => {
|
|
5823
|
+
var _b;
|
|
5824
|
+
const _a = item, { value, subvalue, subtitle } = _a, rest = __objRest(_a, ["value", "subvalue", "subtitle"]);
|
|
5825
|
+
return __spreadProps(__spreadValues({}, rest), {
|
|
5826
|
+
description: (_b = item.description) != null ? _b : subtitle,
|
|
5827
|
+
image: mapSpecImage(item.image),
|
|
5828
|
+
supportingValues: mapSupportingValues(item),
|
|
5829
|
+
additionalInfo: mapAdditionalInfo(item.additionalInfo, mapperProps.onBehavior),
|
|
5830
|
+
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
5831
|
+
});
|
|
5832
|
+
};
|
|
5833
|
+
var mapSupportingValues = (item) => {
|
|
5834
|
+
const { value, subvalue, supportingValues } = item;
|
|
5835
|
+
if (supportingValues) {
|
|
5836
|
+
return supportingValues;
|
|
5837
|
+
}
|
|
5838
|
+
return value || subvalue ? { value, subvalue } : void 0;
|
|
5839
|
+
};
|
|
5732
5840
|
|
|
5733
5841
|
// src/revamp/domain/mappers/mapLayoutToComponent.ts
|
|
5734
5842
|
var mapLayoutToComponent = (uid, layout, mapperProps) => {
|
|
@@ -5863,6 +5971,7 @@ var mapStepToComponent = (_a) => {
|
|
|
5863
5971
|
const onRefresh = async (schemaId, url) => restProps.onRefresh(schemaId, url != null ? url : refreshUrl);
|
|
5864
5972
|
const stepPolling = polling ? getStepPolling({ pollingConfig: polling, onBehavior, onPoll }) : void 0;
|
|
5865
5973
|
const stepRefreshAfter = refreshAfter ? getStepRefreshAfter({ refreshAfter, onRefresh }) : void 0;
|
|
5974
|
+
const externalConfirmation = (external == null ? void 0 : external.url) ? createExternalConfirmation(`${uid}-external-confirmation`, external == null ? void 0 : external.url, updateComponent) : void 0;
|
|
5866
5975
|
const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior, onRefresh });
|
|
5867
5976
|
const unreferencedSchemaFormComponents = mapUnreferencedSchemas(mapperProps);
|
|
5868
5977
|
const layoutComponents = layout.map(
|
|
@@ -5876,7 +5985,7 @@ var mapStepToComponent = (_a) => {
|
|
|
5876
5985
|
control,
|
|
5877
5986
|
description,
|
|
5878
5987
|
error: errors == null ? void 0 : errors.error,
|
|
5879
|
-
|
|
5988
|
+
externalConfirmation,
|
|
5880
5989
|
loadingState,
|
|
5881
5990
|
stepPolling,
|
|
5882
5991
|
stepRefreshAfter,
|
|
@@ -11644,7 +11753,7 @@ var getDefinitionListLayout = (review) => {
|
|
|
11644
11753
|
function DynamicReview({ component: review, onAction }) {
|
|
11645
11754
|
var _a, _b;
|
|
11646
11755
|
const margin = getMargin(review.margin || "xs");
|
|
11647
|
-
const
|
|
11756
|
+
const getReviewAction = (callToAction2) => {
|
|
11648
11757
|
const { title, action, behavior } = callToAction2;
|
|
11649
11758
|
if (behavior) {
|
|
11650
11759
|
if ("type" in behavior) {
|
|
@@ -11692,7 +11801,7 @@ function DynamicReview({ component: review, onAction }) {
|
|
|
11692
11801
|
};
|
|
11693
11802
|
};
|
|
11694
11803
|
const orientation = getDefinitionListLayout(review);
|
|
11695
|
-
const callToAction = review.callToAction ?
|
|
11804
|
+
const callToAction = review.callToAction ? getReviewAction(review.callToAction) : null;
|
|
11696
11805
|
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick(review.action) } : null;
|
|
11697
11806
|
return /* @__PURE__ */ jsxs19("div", { className: margin, children: [
|
|
11698
11807
|
review.title && /* @__PURE__ */ jsx57(Header8, { title: review.title, action: (_b = callToAction != null ? callToAction : legacyCallToAction) != null ? _b : void 0 }),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Icon } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import type { Image, LayoutComponent } from '../types';
|
|
2
|
+
import type { Image, InlineAlert, LayoutComponent, SupportingValues } from '../types';
|
|
3
3
|
export type DecisionComponent = LayoutComponent & {
|
|
4
4
|
type: 'decision';
|
|
5
5
|
options: DecisionOption[];
|
|
@@ -13,6 +13,9 @@ export type DecisionOption = {
|
|
|
13
13
|
image?: Image;
|
|
14
14
|
title: string;
|
|
15
15
|
tag?: string;
|
|
16
|
+
additionalText?: string;
|
|
17
|
+
supportingValues?: SupportingValues;
|
|
18
|
+
inlineAlert?: InlineAlert;
|
|
16
19
|
onClick: () => void;
|
|
17
20
|
};
|
|
18
21
|
export declare const createDecisionComponent: (decisionProps: Pick<DecisionComponent, "uid" | "control" | "margin" | "options" | "title">) => DecisionComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Icon } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import { CallToAction, Image, LayoutComponent } from '../types';
|
|
2
|
+
import { AdditionalInfo, CallToAction, Image, InlineAlert, LayoutComponent, SupportingValues } from '../types';
|
|
3
3
|
export type ListComponent = LayoutComponent & {
|
|
4
4
|
type: 'list';
|
|
5
5
|
items: ListItem[];
|
|
@@ -10,9 +10,10 @@ export type ListItem = {
|
|
|
10
10
|
icon?: Icon;
|
|
11
11
|
image?: Image;
|
|
12
12
|
title?: string;
|
|
13
|
-
|
|
14
|
-
value?: string;
|
|
15
|
-
subvalue?: string;
|
|
13
|
+
description?: string;
|
|
16
14
|
tag?: string;
|
|
15
|
+
supportingValues?: SupportingValues;
|
|
16
|
+
additionalInfo?: AdditionalInfo;
|
|
17
|
+
inlineAlert?: InlineAlert;
|
|
17
18
|
};
|
|
18
19
|
export declare const createListComponent: (listProps: Pick<ListComponent, "uid" | "callToAction" | "control" | "items" | "margin" | "title">) => ListComponent;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Icon } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { AdditionalInfo, CallToAction, Image, InlineAlert, LayoutComponent } from '../types';
|
|
2
3
|
export type ReviewComponent = LayoutComponent & {
|
|
3
4
|
type: 'review';
|
|
4
5
|
fields: ReviewField[];
|
|
5
6
|
title?: string;
|
|
6
|
-
callToAction?:
|
|
7
|
+
callToAction?: CallToAction;
|
|
7
8
|
};
|
|
8
9
|
export type ReviewField = {
|
|
9
10
|
help?: string;
|
|
@@ -11,11 +12,10 @@ export type ReviewField = {
|
|
|
11
12
|
value: string;
|
|
12
13
|
rawValue?: string;
|
|
13
14
|
tag?: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onClick: () => void;
|
|
15
|
+
inlineAlert?: InlineAlert;
|
|
16
|
+
additionalInfo?: AdditionalInfo;
|
|
17
|
+
callToAction?: CallToAction;
|
|
18
|
+
icon?: Icon;
|
|
19
|
+
image?: Image;
|
|
20
20
|
};
|
|
21
21
|
export declare const createReviewComponent: (reviewProps: Pick<ReviewComponent, "uid" | "callToAction" | "control" | "fields" | "margin" | "title">) => ReviewComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalyticsEventDispatcher } from '../features/events';
|
|
2
2
|
import { BaseComponent, DomainComponent, LoadingState, LocalValue, UpdateComponent } from '../types';
|
|
3
|
-
import { StepDomainComponent } from './StepDomainComponent';
|
|
3
|
+
import { StepDomainComponent } from './step/StepDomainComponent';
|
|
4
4
|
import { ModalContentComponent } from './ModalContentComponent';
|
|
5
5
|
export type RootDomainComponent = BaseComponent & {
|
|
6
6
|
type: 'root';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseComponent, LocalValue, UpdateComponent } from '../../types';
|
|
2
|
+
export type ExternalConfirmationComponent = BaseComponent & {
|
|
3
|
+
type: 'external-confirmation';
|
|
4
|
+
uid: string;
|
|
5
|
+
status: 'initial' | 'success' | 'failure' | 'dismissed';
|
|
6
|
+
url: string;
|
|
7
|
+
onSuccess: () => void;
|
|
8
|
+
onFailure: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
getLocalValue: () => LocalValue;
|
|
11
|
+
};
|
|
12
|
+
export declare const createExternalConfirmation: (uid: string, url: string, updateComponent: UpdateComponent) => ExternalConfirmationComponent;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnBehavior, UpdateComponent } from '
|
|
1
|
+
import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnBehavior, UpdateComponent } from '../../types';
|
|
2
2
|
import type { Step } from '@wise/dynamic-flow-types/build/next';
|
|
3
|
-
import type { AnalyticsEventDispatcher } from '
|
|
4
|
-
import type { StepPolling } from '
|
|
5
|
-
import { StepRefreshAfter } from '
|
|
6
|
-
import { ModalContentComponent } from '
|
|
3
|
+
import type { AnalyticsEventDispatcher } from '../../features/events';
|
|
4
|
+
import type { StepPolling } from '../../features/polling/getStepPolling';
|
|
5
|
+
import { StepRefreshAfter } from '../../features/refreshAfter/getStepRefreshAfter';
|
|
6
|
+
import { ModalContentComponent } from '../ModalContentComponent';
|
|
7
|
+
import { ExternalConfirmationComponent } from './ExternalConfirmationComponent';
|
|
7
8
|
export type StepDomainComponent = BaseComponent & {
|
|
8
9
|
type: 'step';
|
|
9
10
|
back?: BackNavigation;
|
|
@@ -11,7 +12,7 @@ export type StepDomainComponent = BaseComponent & {
|
|
|
11
12
|
control?: string;
|
|
12
13
|
description?: string;
|
|
13
14
|
error?: string;
|
|
14
|
-
|
|
15
|
+
externalConfirmation?: ExternalConfirmationComponent;
|
|
15
16
|
loadingState: LoadingState;
|
|
16
17
|
step: Step;
|
|
17
18
|
title?: string;
|
|
@@ -31,7 +32,7 @@ type BackNavigation = {
|
|
|
31
32
|
title?: string;
|
|
32
33
|
onClick: () => void;
|
|
33
34
|
};
|
|
34
|
-
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "
|
|
35
|
+
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "step" | "title" | "trackEvent" | "onBehavior"> & {
|
|
35
36
|
stepPolling?: StepPolling;
|
|
36
37
|
stepRefreshAfter?: StepRefreshAfter;
|
|
37
38
|
updateComponent: UpdateComponent;
|
|
@@ -8,4 +8,4 @@ export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
|
|
|
8
8
|
trackEvent: AnalyticsEventDispatcher<string>;
|
|
9
9
|
onPoll: OnPoll;
|
|
10
10
|
};
|
|
11
|
-
export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
|
|
11
|
+
export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/step/StepDomainComponent").StepDomainComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Context as
|
|
1
|
+
import type { Context as SpecContext, Align as SpecAlign, Action } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { Align, Bias, Context } from '../../types';
|
|
3
|
-
export declare const mapLegacyContext: (context:
|
|
3
|
+
export declare const mapLegacyContext: (context: SpecContext) => Context;
|
|
4
4
|
export declare const mapLegacyBias: (bias: "left" | "right" | "none") => Bias;
|
|
5
|
-
export declare const mapLegacyAlign: (align:
|
|
5
|
+
export declare const mapLegacyAlign: (align: SpecAlign) => Align;
|
|
6
6
|
export declare const mapLegacyActionTypeToContext: (type: Action["type"]) => Context;
|
|
7
7
|
export declare const mapLegacyActionTypeToControl: (type: Action["type"]) => "primary" | "secondary" | "tertiary";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AdditionalInfo as SpecAdditionalInfo, InlineAlert as SpecInlineAlert } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import { AdditionalInfo, InlineAlert, OnBehavior } from '../../types';
|
|
3
|
+
export declare const mapInlineAlert: (alert: SpecInlineAlert | undefined) => InlineAlert | undefined;
|
|
4
|
+
export declare const mapAdditionalInfo: (info: SpecAdditionalInfo | undefined, onBehavior: OnBehavior) => AdditionalInfo | undefined;
|
|
@@ -30,12 +30,13 @@ import type { RootDomainComponent } from './components/RootDomainComponent';
|
|
|
30
30
|
import type { SearchComponent } from './components/searchComponent/SearchComponent';
|
|
31
31
|
import type { SelectInputComponent } from './components/SelectInputComponent';
|
|
32
32
|
import type { StatusListComponent } from './components/StatusListComponent';
|
|
33
|
-
import type { StepDomainComponent } from './components/StepDomainComponent';
|
|
33
|
+
import type { StepDomainComponent } from './components/step/StepDomainComponent';
|
|
34
34
|
import type { TextInputComponent } from './components/TextInputComponent';
|
|
35
35
|
import type { TupleComponent } from './components/TupleComponent';
|
|
36
36
|
import type { UploadInputComponent } from './components/UploadInputComponent';
|
|
37
37
|
import { ModalContentComponent } from './components/ModalContentComponent';
|
|
38
|
-
|
|
38
|
+
import { ExternalConfirmationComponent } from './components/step/ExternalConfirmationComponent';
|
|
39
|
+
export type DomainComponent = RootDomainComponent | StepDomainComponent | AlertComponent | AllOfComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ConstComponent | ContainerComponent | DateInputComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | IntegerInputComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalComponent | ModalContentComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | ReviewComponent | SearchComponent | SelectInputComponent | StatusListComponent | TextInputComponent | TupleComponent | UploadInputComponent;
|
|
39
40
|
export type LocalValue = LocalValuePrimitive | LocalValueObject | LocalValueArray;
|
|
40
41
|
export type LocalValuePrimitive = string | number | boolean | File | null;
|
|
41
42
|
export interface LocalValueObject extends Record<string, LocalValuePrimitive | LocalValueObject | LocalValueArray> {
|
|
@@ -143,3 +144,16 @@ export type ValidationAsyncState = {
|
|
|
143
144
|
};
|
|
144
145
|
};
|
|
145
146
|
export type LoadingState = 'idle' | 'initial' | 'submitting' | 'refreshing';
|
|
147
|
+
export type AdditionalInfo = {
|
|
148
|
+
text: string;
|
|
149
|
+
accessibilityDescription?: string;
|
|
150
|
+
onClick?: () => void;
|
|
151
|
+
};
|
|
152
|
+
export type InlineAlert = {
|
|
153
|
+
content: string;
|
|
154
|
+
context?: Context;
|
|
155
|
+
};
|
|
156
|
+
export type SupportingValues = {
|
|
157
|
+
value?: string;
|
|
158
|
+
subvalue?: string;
|
|
159
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExternalConfirmationRendererProps } from '@wise/dynamic-flow-types/build/renderers';
|
|
2
|
+
import { ExternalConfirmationComponent } from '../../domain/components/step/ExternalConfirmationComponent';
|
|
3
|
+
import { RendererMapperProps } from './componentToRendererProps';
|
|
4
|
+
export declare const externalComponentToProps: (component: ExternalConfirmationComponent, rendererMapperProps: RendererMapperProps) => ExternalConfirmationRendererProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StepRendererProps } from '@wise/dynamic-flow-types/build/renderers';
|
|
2
|
-
import type { StepDomainComponent } from '../domain/components/StepDomainComponent';
|
|
2
|
+
import type { StepDomainComponent } from '../domain/components/step/StepDomainComponent';
|
|
3
3
|
import { type RendererMapperProps } from './mappers/componentToRendererProps';
|
|
4
4
|
export declare const stepComponentToProps: (component: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"@testing-library/jest-dom": "6.6.3",
|
|
54
54
|
"@testing-library/react": "16.3.0",
|
|
55
55
|
"@testing-library/user-event": "14.6.1",
|
|
56
|
-
"@transferwise/components": "46.96.
|
|
56
|
+
"@transferwise/components": "46.96.1",
|
|
57
57
|
"@transferwise/formatting": "^2.13.1",
|
|
58
|
-
"@transferwise/icons": "3.
|
|
59
|
-
"@transferwise/neptune-css": "14.24.
|
|
58
|
+
"@transferwise/icons": "3.21.0",
|
|
59
|
+
"@transferwise/neptune-css": "14.24.3",
|
|
60
60
|
"@types/node": "22.15.3",
|
|
61
61
|
"@types/jest": "29.5.14",
|
|
62
62
|
"@types/react": "18.3.20",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"tsx": "4.19.3",
|
|
86
86
|
"typescript": "5.8.3",
|
|
87
87
|
"webpack": "5.99.7",
|
|
88
|
-
"@wise/dynamic-flow-
|
|
89
|
-
"@wise/dynamic-flow-
|
|
88
|
+
"@wise/dynamic-flow-renderers": "0.0.0",
|
|
89
|
+
"@wise/dynamic-flow-fixtures": "0.0.1"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@transferwise/components": "^46.92.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"classnames": "2.5.1",
|
|
103
103
|
"react-webcam": "^7.2.0",
|
|
104
104
|
"screenfull": "^5.2.0",
|
|
105
|
-
"@wise/dynamic-flow-types": "3.
|
|
105
|
+
"@wise/dynamic-flow-types": "3.3.0"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|