@wise/dynamic-flow-client 3.10.0 → 3.11.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 +179 -158
- package/build/main.min.js +1 -1
- package/build/main.mjs +68 -47
- package/build/types/revamp/domain/components/StepDomainComponent.d.ts +5 -2
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/types.d.ts +3 -0
- package/package.json +1 -2
package/build/main.mjs
CHANGED
|
@@ -1269,11 +1269,14 @@ var isStringSchemaWithUpload = (schema) => isStringSchema(schema) && schema.form
|
|
|
1269
1269
|
var isSchemaWithPersistAsync = (schema) => "persistAsync" in schema && !isNullish(schema.persistAsync);
|
|
1270
1270
|
|
|
1271
1271
|
// src/revamp/renderers/stepComponentToProps.ts
|
|
1272
|
-
var stepComponentToProps = ({ back, external, loadingState, trackEvent }, children) => ({
|
|
1272
|
+
var stepComponentToProps = ({ back, description, error, external, loadingState, title, trackEvent }, children) => ({
|
|
1273
1273
|
type: "step",
|
|
1274
1274
|
back,
|
|
1275
|
+
description,
|
|
1276
|
+
error,
|
|
1275
1277
|
external,
|
|
1276
1278
|
loadingState,
|
|
1279
|
+
title,
|
|
1277
1280
|
trackEvent,
|
|
1278
1281
|
children
|
|
1279
1282
|
});
|
|
@@ -6497,27 +6500,6 @@ var alertLayoutToComponent = (uid, { control, markdown, margin = "md", context =
|
|
|
6497
6500
|
context: mapLegacyContext(context)
|
|
6498
6501
|
});
|
|
6499
6502
|
|
|
6500
|
-
// src/revamp/domain/components/HeadingComponent.ts
|
|
6501
|
-
var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
|
|
6502
|
-
type: "heading"
|
|
6503
|
-
}, headingProps), {
|
|
6504
|
-
getSubmittableValue: async () => null,
|
|
6505
|
-
getSummary: () => ({}),
|
|
6506
|
-
// Noop
|
|
6507
|
-
getLocalValue: () => null,
|
|
6508
|
-
validate: () => true
|
|
6509
|
-
});
|
|
6510
|
-
|
|
6511
|
-
// src/revamp/domain/mappers/layout/headingLayoutToComponent.ts
|
|
6512
|
-
var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md", control, text }) => createHeadingComponent({
|
|
6513
|
-
uid,
|
|
6514
|
-
align: mapLegacyAlign(align),
|
|
6515
|
-
control,
|
|
6516
|
-
margin,
|
|
6517
|
-
size,
|
|
6518
|
-
text
|
|
6519
|
-
});
|
|
6520
|
-
|
|
6521
6503
|
// src/revamp/domain/components/BoxComponent.ts
|
|
6522
6504
|
var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps), {
|
|
6523
6505
|
type: "box",
|
|
@@ -9228,6 +9210,27 @@ var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin
|
|
|
9228
9210
|
});
|
|
9229
9211
|
};
|
|
9230
9212
|
|
|
9213
|
+
// src/revamp/domain/components/HeadingComponent.ts
|
|
9214
|
+
var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
|
|
9215
|
+
type: "heading"
|
|
9216
|
+
}, headingProps), {
|
|
9217
|
+
getSubmittableValue: async () => null,
|
|
9218
|
+
getSummary: () => ({}),
|
|
9219
|
+
// Noop
|
|
9220
|
+
getLocalValue: () => null,
|
|
9221
|
+
validate: () => true
|
|
9222
|
+
});
|
|
9223
|
+
|
|
9224
|
+
// src/revamp/domain/mappers/layout/headingLayoutToComponent.ts
|
|
9225
|
+
var headingLayoutToComponent = (uid, { align = "left", margin = "md", size = "md", control, text }) => createHeadingComponent({
|
|
9226
|
+
uid,
|
|
9227
|
+
align: mapLegacyAlign(align),
|
|
9228
|
+
control,
|
|
9229
|
+
margin,
|
|
9230
|
+
size,
|
|
9231
|
+
text
|
|
9232
|
+
});
|
|
9233
|
+
|
|
9231
9234
|
// src/revamp/domain/components/ImageComponent.ts
|
|
9232
9235
|
var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
|
|
9233
9236
|
type: "image"
|
|
@@ -9700,7 +9703,7 @@ var mapStepToComponent = (_a) => {
|
|
|
9700
9703
|
]);
|
|
9701
9704
|
var _a2, _b2;
|
|
9702
9705
|
const { httpClient, step, updateComponent } = restProps;
|
|
9703
|
-
const { id,
|
|
9706
|
+
const { id, description, errors, external, key, layout = [], navigation, polling, title } = step;
|
|
9704
9707
|
const backNavigation = (_a2 = navigation == null ? void 0 : navigation.back) != null ? _a2 : navigation == null ? void 0 : navigation.backButton;
|
|
9705
9708
|
const back = backNavigation ? {
|
|
9706
9709
|
title: backNavigation.title,
|
|
@@ -9737,34 +9740,21 @@ var mapStepToComponent = (_a) => {
|
|
|
9737
9740
|
onRefresh
|
|
9738
9741
|
}))
|
|
9739
9742
|
);
|
|
9740
|
-
const additionalComponents = makeAdditionalComponents(step, uid, displayStepTitle);
|
|
9741
9743
|
const stepComponent = createStepComponent({
|
|
9742
9744
|
uid,
|
|
9743
|
-
components: [...additionalComponents, ...layoutComponents],
|
|
9744
9745
|
back,
|
|
9746
|
+
components: layoutComponents,
|
|
9747
|
+
description,
|
|
9748
|
+
error: errors == null ? void 0 : errors.error,
|
|
9745
9749
|
external,
|
|
9746
9750
|
loadingState,
|
|
9747
9751
|
stepPolling,
|
|
9748
9752
|
updateComponent,
|
|
9753
|
+
title: displayStepTitle ? title : void 0,
|
|
9749
9754
|
trackEvent
|
|
9750
9755
|
});
|
|
9751
9756
|
return stepComponent;
|
|
9752
9757
|
};
|
|
9753
|
-
var makeAdditionalComponents = (step, uid, displayStepTitle) => {
|
|
9754
|
-
const { title, errors } = step;
|
|
9755
|
-
const heading = title && displayStepTitle ? headingLayoutToComponent(`${uid}.title`, {
|
|
9756
|
-
type: "heading",
|
|
9757
|
-
text: title,
|
|
9758
|
-
align: "center",
|
|
9759
|
-
size: "lg"
|
|
9760
|
-
}) : void 0;
|
|
9761
|
-
const stepError = (errors == null ? void 0 : errors.error) ? alertLayoutToComponent(`${uid}.global-error`, {
|
|
9762
|
-
type: "alert",
|
|
9763
|
-
markdown: errors.error,
|
|
9764
|
-
context: "negative"
|
|
9765
|
-
}) : void 0;
|
|
9766
|
-
return [...heading ? [heading] : [], ...stepError ? [stepError] : []];
|
|
9767
|
-
};
|
|
9768
9758
|
|
|
9769
9759
|
// src/revamp/flow/executeRefresh.ts
|
|
9770
9760
|
var executeRefresh = async (props) => {
|
|
@@ -12280,7 +12270,7 @@ import { Fragment as Fragment10, jsx as jsx55, jsxs as jsxs20 } from "react/jsx-
|
|
|
12280
12270
|
var ReviewRenderer = {
|
|
12281
12271
|
canRenderType: "review",
|
|
12282
12272
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
12283
|
-
const orientation = control
|
|
12273
|
+
const orientation = mapControlToDefinitionListLayout(control);
|
|
12284
12274
|
const action = callToAction ? {
|
|
12285
12275
|
text: callToAction.title,
|
|
12286
12276
|
onClick: (event) => {
|
|
@@ -12305,6 +12295,21 @@ var ReviewRenderer = {
|
|
|
12305
12295
|
}
|
|
12306
12296
|
};
|
|
12307
12297
|
var ReviewRenderer_default = ReviewRenderer;
|
|
12298
|
+
var mapControlToDefinitionListLayout = (control) => {
|
|
12299
|
+
switch (control) {
|
|
12300
|
+
case "horizontal":
|
|
12301
|
+
case "horizontal-end-aligned":
|
|
12302
|
+
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
12303
|
+
case "horizontal-start-aligned":
|
|
12304
|
+
return "HORIZONTAL_LEFT_ALIGNED";
|
|
12305
|
+
case "vertical-two-column":
|
|
12306
|
+
return "VERTICAL_TWO_COLUMN";
|
|
12307
|
+
case "vertical":
|
|
12308
|
+
case "vertical-one-column":
|
|
12309
|
+
default:
|
|
12310
|
+
return "VERTICAL_ONE_COLUMN";
|
|
12311
|
+
}
|
|
12312
|
+
};
|
|
12308
12313
|
var getFieldValue = (value, help, orientation) => {
|
|
12309
12314
|
if (help) {
|
|
12310
12315
|
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
@@ -12430,13 +12435,14 @@ function BackButton({ title, onClick }) {
|
|
|
12430
12435
|
var BackButton_default = BackButton;
|
|
12431
12436
|
|
|
12432
12437
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12438
|
+
import { Alert as Alert3 } from "@transferwise/components";
|
|
12433
12439
|
import { jsx as jsx58, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
12434
12440
|
var StepRenderer = {
|
|
12435
12441
|
canRenderType: "step",
|
|
12436
12442
|
render: StepRendererComponent
|
|
12437
12443
|
};
|
|
12438
12444
|
function StepRendererComponent(props) {
|
|
12439
|
-
const { back,
|
|
12445
|
+
const { back, description, error, external, loadingState, title, trackEvent, children } = props;
|
|
12440
12446
|
const value = useMemo4(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12441
12447
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12442
12448
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
@@ -12444,6 +12450,9 @@ function StepRendererComponent(props) {
|
|
|
12444
12450
|
}
|
|
12445
12451
|
return /* @__PURE__ */ jsxs23(StepRendererContextProvider, { value, children: [
|
|
12446
12452
|
back ? /* @__PURE__ */ jsx58(BackButton_default, __spreadValues({}, back)) : null,
|
|
12453
|
+
title ? /* @__PURE__ */ jsx58("h2", { className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
12454
|
+
description ? /* @__PURE__ */ jsx58("p", { className: "text-xs-center m-b-2", children: description }) : void 0,
|
|
12455
|
+
error ? /* @__PURE__ */ jsx58(Alert3, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
12447
12456
|
children
|
|
12448
12457
|
] });
|
|
12449
12458
|
}
|
|
@@ -13813,7 +13822,7 @@ var import_classnames16 = __toESM(require_classnames());
|
|
|
13813
13822
|
import { useEffect as useEffect17, useMemo as useMemo17, useState as useState27 } from "react";
|
|
13814
13823
|
|
|
13815
13824
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13816
|
-
import { Alert as
|
|
13825
|
+
import { Alert as Alert4 } from "@transferwise/components";
|
|
13817
13826
|
|
|
13818
13827
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13819
13828
|
import { Avatar as Avatar5, AvatarType as AvatarType4 } from "@transferwise/components";
|
|
@@ -13914,7 +13923,7 @@ import { jsx as jsx69 } from "react/jsx-runtime";
|
|
|
13914
13923
|
var DynamicAlert = (props) => {
|
|
13915
13924
|
const alert = props.component;
|
|
13916
13925
|
return /* @__PURE__ */ jsx69(
|
|
13917
|
-
|
|
13926
|
+
Alert4,
|
|
13918
13927
|
{
|
|
13919
13928
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
13920
13929
|
className: getMargin2(alert.margin),
|
|
@@ -17127,9 +17136,21 @@ var getFieldValue2 = (value, help, orientation) => {
|
|
|
17127
17136
|
}
|
|
17128
17137
|
return value;
|
|
17129
17138
|
};
|
|
17130
|
-
var
|
|
17139
|
+
var getDefinitionListLayout = (review) => {
|
|
17131
17140
|
const orientation = review.control || review.orientation;
|
|
17132
|
-
|
|
17141
|
+
switch (orientation) {
|
|
17142
|
+
case "horizontal":
|
|
17143
|
+
case "horizontal-end-aligned":
|
|
17144
|
+
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
17145
|
+
case "horizontal-start-aligned":
|
|
17146
|
+
return "HORIZONTAL_LEFT_ALIGNED";
|
|
17147
|
+
case "vertical-two-column":
|
|
17148
|
+
return "VERTICAL_TWO_COLUMN";
|
|
17149
|
+
case "vertical":
|
|
17150
|
+
case "vertical-one-column":
|
|
17151
|
+
default:
|
|
17152
|
+
return "VERTICAL_ONE_COLUMN";
|
|
17153
|
+
}
|
|
17133
17154
|
};
|
|
17134
17155
|
function DynamicReview(props) {
|
|
17135
17156
|
const review = props.component;
|
|
@@ -17144,7 +17165,7 @@ function DynamicReview(props) {
|
|
|
17144
17165
|
}
|
|
17145
17166
|
}
|
|
17146
17167
|
});
|
|
17147
|
-
const orientation =
|
|
17168
|
+
const orientation = getDefinitionListLayout(review);
|
|
17148
17169
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
17149
17170
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
17150
17171
|
return /* @__PURE__ */ jsxs40("div", { className: margin, children: [
|
|
@@ -6,19 +6,22 @@ export type StepDomainComponent = BaseComponent & {
|
|
|
6
6
|
type: 'step';
|
|
7
7
|
back?: BackNavigation;
|
|
8
8
|
components: DomainComponent[];
|
|
9
|
+
description?: string;
|
|
10
|
+
error?: string;
|
|
9
11
|
external?: Step['external'];
|
|
10
12
|
loadingState: LoadingState;
|
|
13
|
+
title?: string;
|
|
14
|
+
trackEvent: AnalyticsEventDispatcher<string>;
|
|
11
15
|
setLoadingState: (loadingState: LoadingState) => void;
|
|
12
16
|
getChildren: () => DomainComponent[];
|
|
13
17
|
getLocalValue: () => LocalValue;
|
|
14
18
|
stop: () => void;
|
|
15
|
-
trackEvent: AnalyticsEventDispatcher<string>;
|
|
16
19
|
};
|
|
17
20
|
type BackNavigation = {
|
|
18
21
|
title?: string;
|
|
19
22
|
onClick: () => void;
|
|
20
23
|
};
|
|
21
|
-
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "components" | "external" | "trackEvent" | "back" | "loadingState"> & {
|
|
24
|
+
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "error" | "uid" | "title" | "components" | "description" | "external" | "trackEvent" | "back" | "loadingState"> & {
|
|
22
25
|
stepPolling?: StepPolling | undefined;
|
|
23
26
|
updateComponent: UpdateComponent;
|
|
24
27
|
}) => StepDomainComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StepDomainComponent } from '../domain/components/StepDomainComponent';
|
|
3
3
|
import type { StepRendererProps } from './types';
|
|
4
|
-
export declare const stepComponentToProps: ({ back, external, loadingState, trackEvent }: StepDomainComponent, children: ReactNode) => StepRendererProps;
|
|
4
|
+
export declare const stepComponentToProps: ({ back, description, error, external, loadingState, title, trackEvent }: StepDomainComponent, children: ReactNode) => StepRendererProps;
|
|
@@ -29,10 +29,13 @@ export type StepRendererProps = {
|
|
|
29
29
|
title?: string;
|
|
30
30
|
onClick: () => void;
|
|
31
31
|
};
|
|
32
|
+
description?: string;
|
|
33
|
+
error?: string;
|
|
32
34
|
external?: {
|
|
33
35
|
url: string;
|
|
34
36
|
};
|
|
35
37
|
loadingState: LoadingState;
|
|
38
|
+
title?: string;
|
|
36
39
|
trackEvent: AnalyticsEventDispatcher<string>;
|
|
37
40
|
children: ReactNode;
|
|
38
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"@transferwise/formatting": "^2.13.0",
|
|
45
45
|
"@transferwise/icons": "3.13.0",
|
|
46
46
|
"@transferwise/neptune-css": "14.10.0",
|
|
47
|
-
"@transferwise/neptune-tokens": "8.9.2",
|
|
48
47
|
"@types/enzyme": "^3.10.18",
|
|
49
48
|
"@types/jest": "29.5.12",
|
|
50
49
|
"@types/react": "18",
|