@wise/dynamic-flow-client 3.23.1 → 3.24.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 +71 -35
- package/build/main.min.js +1 -1
- package/build/main.mjs +71 -35
- package/build/types/legacy/layout/alert/DynamicAlert.d.ts +3 -1
- package/package.json +7 -7
package/build/main.mjs
CHANGED
|
@@ -138,12 +138,12 @@ var init_clsx = __esm({
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
// ../../node_modules/.pnpm/@wise+art@2.16.
|
|
141
|
+
// ../../node_modules/.pnpm/@wise+art@2.16.3_@transferwise+neptune-css@14.19.1_@types+react@18.3.11_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js
|
|
142
142
|
import { useState as useState2, useEffect as useEffect2, forwardRef, Suspense, lazy } from "react";
|
|
143
143
|
import { jsx as jsx17, jsxs as jsxs4, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
144
144
|
var unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
|
|
145
|
-
var
|
|
146
|
-
"../../node_modules/.pnpm/@wise+art@2.16.
|
|
145
|
+
var init_index_a91e5689_esm = __esm({
|
|
146
|
+
"../../node_modules/.pnpm/@wise+art@2.16.3_@transferwise+neptune-css@14.19.1_@types+react@18.3.11_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js"() {
|
|
147
147
|
"use strict";
|
|
148
148
|
init_clsx();
|
|
149
149
|
unknownFlagName = "wise";
|
|
@@ -159,18 +159,16 @@ var init_index_c8ed1f53_esm = __esm({
|
|
|
159
159
|
}, [code]);
|
|
160
160
|
const detailed = intrinsicSize >= 150;
|
|
161
161
|
const name = fallback !== "unknown" ? `${code.toLowerCase()}${fallback == null && detailed ? "-detailed" : ""}` : unknownFlagName;
|
|
162
|
-
return /* @__PURE__ */ jsx17("
|
|
162
|
+
return /* @__PURE__ */ jsx17("img", {
|
|
163
163
|
className: clsx(`wds-flag wds-flag-${name}`, className),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
})
|
|
164
|
+
src: `https://wise.com/web-art/assets/flags/${name}.svg`,
|
|
165
|
+
loading,
|
|
166
|
+
alt: "",
|
|
167
|
+
width: intrinsicSize,
|
|
168
|
+
height: intrinsicSize,
|
|
169
|
+
onError: () => {
|
|
170
|
+
setFallback((prev) => prev == null && detailed ? "simple" : "unknown");
|
|
171
|
+
}
|
|
174
172
|
});
|
|
175
173
|
};
|
|
176
174
|
(function(Sizes2) {
|
|
@@ -6202,6 +6200,7 @@ var buttonLayoutSchema = z.object({
|
|
|
6202
6200
|
var reviewLayoutFieldSchema = z.object({
|
|
6203
6201
|
label: z.string(),
|
|
6204
6202
|
value: z.string(),
|
|
6203
|
+
rawValue: z.string().optional(),
|
|
6205
6204
|
help: helpSchema.optional()
|
|
6206
6205
|
});
|
|
6207
6206
|
var searchResultSearchSchema = z.object({
|
|
@@ -9314,6 +9313,7 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9314
9313
|
|
|
9315
9314
|
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.ts
|
|
9316
9315
|
var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
9316
|
+
var _a;
|
|
9317
9317
|
const { getErrorMessageFunctions } = mapperProps;
|
|
9318
9318
|
const { localValue, model, schema, required = false } = schemaMapperProps;
|
|
9319
9319
|
const uploadSchema = getUploadSchema(schema.items);
|
|
@@ -9327,7 +9327,10 @@ var arraySchemaToMultiUploadComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9327
9327
|
];
|
|
9328
9328
|
const persistAsyncConfig = getPersistAsyncConfig(schema.items);
|
|
9329
9329
|
const format = getFormat(schema.items);
|
|
9330
|
-
const combinedSchemaProps = __spreadProps(__spreadValues({}, schemaMapperProps), {
|
|
9330
|
+
const combinedSchemaProps = __spreadProps(__spreadValues({}, schemaMapperProps), {
|
|
9331
|
+
persistAsyncConfig,
|
|
9332
|
+
schema: __spreadProps(__spreadValues({}, uploadSchema), { hidden: (_a = schema.hidden) != null ? _a : uploadSchema.hidden })
|
|
9333
|
+
});
|
|
9331
9334
|
const { onValueChange } = mapperProps;
|
|
9332
9335
|
const { performPersistAsync } = getPersistAsyncInitialState(combinedSchemaProps, mapperProps);
|
|
9333
9336
|
const value = performPersistAsync ? getValueForPersistAsync(localValue) : [];
|
|
@@ -9890,6 +9893,11 @@ var formLayoutToComponent = (uid, { schemaId, schema: schemaRef, control, margin
|
|
|
9890
9893
|
const { step, stepLocalValue } = mapperProps;
|
|
9891
9894
|
const { schemas, model, errors } = step;
|
|
9892
9895
|
const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
|
|
9896
|
+
if (id == null) {
|
|
9897
|
+
throw new Error(
|
|
9898
|
+
"FormLayouts must refer to a schema. Set the `schemaId` property to the intended schema."
|
|
9899
|
+
);
|
|
9900
|
+
}
|
|
9893
9901
|
const schema = schemas.find((s) => s.$id === id);
|
|
9894
9902
|
if (!schema) {
|
|
9895
9903
|
throw new Error("Schema not found in schemas array.");
|
|
@@ -11218,15 +11226,34 @@ var AlertRenderer = {
|
|
|
11218
11226
|
type: context,
|
|
11219
11227
|
className: getMargin(margin),
|
|
11220
11228
|
message: markdown,
|
|
11221
|
-
action: (callToAction
|
|
11222
|
-
text: callToAction.title,
|
|
11223
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
11224
|
-
href: callToAction.href,
|
|
11225
|
-
target: "_blank"
|
|
11226
|
-
} : void 0
|
|
11229
|
+
action: mapCtaToAlertAction(callToAction)
|
|
11227
11230
|
}
|
|
11228
11231
|
)
|
|
11229
11232
|
};
|
|
11233
|
+
var mapCtaToAlertAction = (callToAction) => {
|
|
11234
|
+
if (!callToAction) {
|
|
11235
|
+
return void 0;
|
|
11236
|
+
}
|
|
11237
|
+
const { accessibilityDescription, title } = callToAction;
|
|
11238
|
+
const sharedProps = {
|
|
11239
|
+
"aria-label": accessibilityDescription,
|
|
11240
|
+
text: title
|
|
11241
|
+
};
|
|
11242
|
+
if (callToAction.type === "link") {
|
|
11243
|
+
const { href } = callToAction;
|
|
11244
|
+
return __spreadProps(__spreadValues({}, sharedProps), {
|
|
11245
|
+
href,
|
|
11246
|
+
target: "_blank"
|
|
11247
|
+
});
|
|
11248
|
+
}
|
|
11249
|
+
if (callToAction.type === "action") {
|
|
11250
|
+
const { onClick } = callToAction;
|
|
11251
|
+
return __spreadProps(__spreadValues({}, sharedProps), {
|
|
11252
|
+
onClick
|
|
11253
|
+
});
|
|
11254
|
+
}
|
|
11255
|
+
return void 0;
|
|
11256
|
+
};
|
|
11230
11257
|
var AlertRenderer_default = AlertRenderer;
|
|
11231
11258
|
|
|
11232
11259
|
// ../renderers/src/components/FieldInput.tsx
|
|
@@ -11584,8 +11611,8 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
11584
11611
|
// ../renderers/src/DecisionRenderer.tsx
|
|
11585
11612
|
import { NavigationOptionsList, NavigationOption, Header } from "@transferwise/components";
|
|
11586
11613
|
|
|
11587
|
-
// ../../node_modules/.pnpm/@wise+art@2.16.
|
|
11588
|
-
|
|
11614
|
+
// ../../node_modules/.pnpm/@wise+art@2.16.3_@transferwise+neptune-css@14.19.1_@types+react@18.3.11_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
|
|
11615
|
+
init_index_a91e5689_esm();
|
|
11589
11616
|
init_clsx();
|
|
11590
11617
|
import "react";
|
|
11591
11618
|
import "react/jsx-runtime";
|
|
@@ -14923,7 +14950,7 @@ var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.a
|
|
|
14923
14950
|
|
|
14924
14951
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
14925
14952
|
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
14926
|
-
var DynamicAlert = ({ component: alert }) => {
|
|
14953
|
+
var DynamicAlert = ({ component: alert, onAction }) => {
|
|
14927
14954
|
const { context, markdown, margin } = alert;
|
|
14928
14955
|
return /* @__PURE__ */ jsx70(
|
|
14929
14956
|
Alert4,
|
|
@@ -14931,27 +14958,36 @@ var DynamicAlert = ({ component: alert }) => {
|
|
|
14931
14958
|
type: mapContextToAlertType(legacy_mapContext(context)),
|
|
14932
14959
|
className: getMargin2(margin),
|
|
14933
14960
|
message: markdown,
|
|
14934
|
-
action: getAlertAction(alert)
|
|
14961
|
+
action: getAlertAction(alert, onAction)
|
|
14935
14962
|
}
|
|
14936
14963
|
);
|
|
14937
14964
|
};
|
|
14938
14965
|
var isAlertLayout = (layout) => {
|
|
14939
14966
|
return Object.hasOwnProperty.call(layout, "type") && layout.type === "alert";
|
|
14940
14967
|
};
|
|
14941
|
-
var getAlertAction = (component) => {
|
|
14968
|
+
var getAlertAction = (component, onAction) => {
|
|
14942
14969
|
if (!isAlertLayout(component) || !component.callToAction) {
|
|
14943
14970
|
return void 0;
|
|
14944
14971
|
}
|
|
14945
14972
|
const { title, accessibilityDescription, behavior } = component.callToAction;
|
|
14946
|
-
|
|
14947
|
-
|
|
14973
|
+
const { action, link } = behavior;
|
|
14974
|
+
if (link) {
|
|
14975
|
+
return {
|
|
14976
|
+
text: title,
|
|
14977
|
+
"aria-label": accessibilityDescription,
|
|
14978
|
+
href: link.url,
|
|
14979
|
+
target: "_blank"
|
|
14980
|
+
};
|
|
14981
|
+
}
|
|
14982
|
+
if (action && onAction) {
|
|
14983
|
+
return {
|
|
14984
|
+
text: title,
|
|
14985
|
+
"aria-label": accessibilityDescription,
|
|
14986
|
+
onClick: () => {
|
|
14987
|
+
onAction(action);
|
|
14988
|
+
}
|
|
14989
|
+
};
|
|
14948
14990
|
}
|
|
14949
|
-
return {
|
|
14950
|
-
text: title,
|
|
14951
|
-
"aria-label": accessibilityDescription,
|
|
14952
|
-
href: behavior.link.url,
|
|
14953
|
-
target: "_blank"
|
|
14954
|
-
};
|
|
14955
14991
|
};
|
|
14956
14992
|
var legacy_mapContext = (context) => {
|
|
14957
14993
|
switch (context) {
|
|
@@ -18029,7 +18065,7 @@ function DynamicLayout(props) {
|
|
|
18029
18065
|
case "image":
|
|
18030
18066
|
return /* @__PURE__ */ jsx107(DynamicImage_default, { component }, getKey(component));
|
|
18031
18067
|
case "alert":
|
|
18032
|
-
return /* @__PURE__ */ jsx107(DynamicAlert_default, { component }, getKey(component));
|
|
18068
|
+
return /* @__PURE__ */ jsx107(DynamicAlert_default, { component, onAction }, getKey(component));
|
|
18033
18069
|
case "review":
|
|
18034
18070
|
return /* @__PURE__ */ jsx107(DynamicReview_default, { component, onAction }, getKey(component));
|
|
18035
18071
|
case "divider":
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AlertLayout, Alert as AlertType } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { OnAction } from '../../dynamicFlow/DynamicFlowTypes';
|
|
2
3
|
type DynamicAlertProps = {
|
|
3
4
|
component: AlertType | AlertLayout;
|
|
5
|
+
onAction?: OnAction;
|
|
4
6
|
};
|
|
5
|
-
declare const DynamicAlert: ({ component: alert }: DynamicAlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const DynamicAlert: ({ component: alert, onAction }: DynamicAlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default DynamicAlert;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"@testing-library/jest-dom": "6.6.2",
|
|
51
51
|
"@testing-library/react": "16.0.1",
|
|
52
52
|
"@testing-library/user-event": "14.5.2",
|
|
53
|
-
"@transferwise/components": "46.
|
|
53
|
+
"@transferwise/components": "46.72.2",
|
|
54
54
|
"@transferwise/formatting": "^2.13.0",
|
|
55
|
-
"@transferwise/icons": "3.
|
|
55
|
+
"@transferwise/icons": "3.14.0",
|
|
56
56
|
"@transferwise/neptune-css": "14.19.1",
|
|
57
57
|
"@types/node": "22.7.7",
|
|
58
58
|
"@types/jest": "29.5.13",
|
|
59
59
|
"@types/react": "18.3.11",
|
|
60
60
|
"@types/react-dom": "18.3.1",
|
|
61
61
|
"@types/react-intl": "3.0.0",
|
|
62
|
-
"@wise/art": "2.16.
|
|
62
|
+
"@wise/art": "2.16.3",
|
|
63
63
|
"@wise/components-theming": "^1.6.1",
|
|
64
64
|
"babel-jest": "29.7.0",
|
|
65
65
|
"esbuild": "0.24.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"tsx": "4.19.1",
|
|
84
84
|
"typescript": "5.6.3",
|
|
85
85
|
"webpack": "5.95.0",
|
|
86
|
-
"@wise/dynamic-flow-
|
|
87
|
-
"@wise/dynamic-flow-
|
|
86
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
87
|
+
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@transferwise/components": "^46.31",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"nanoid": "5.0.7",
|
|
102
102
|
"react-webcam": "^7.2.0",
|
|
103
103
|
"screenfull": "^5.2.0",
|
|
104
|
-
"@wise/dynamic-flow-types": "2.
|
|
104
|
+
"@wise/dynamic-flow-types": "2.26.0"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|