@wise/dynamic-flow-client 3.17.1 → 3.18.1
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 +32 -82
- package/build/main.min.js +1 -1
- package/build/main.mjs +32 -82
- package/build/types/revamp/domain/components/ModalComponent.d.ts +1 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/utils/isPartialModelMatch.d.ts +2 -0
- package/build/types/revamp/renderers/mappers/modalComponentToProps.d.ts +1 -1
- package/package.json +10 -10
- package/build/types/revamp/domain/components/utils/getComponentForLocalValueKey.d.ts +0 -7
- package/build/types/revamp/domain/components/utils/isPartialLocalValueMatch.d.ts +0 -2
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.14.0_@transferwise+neptune-css@14.
|
|
141
|
+
// ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.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
145
|
var init_index_93a0c34e_esm = __esm({
|
|
146
|
-
"../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.
|
|
146
|
+
"../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js"() {
|
|
147
147
|
"use strict";
|
|
148
148
|
init_clsx();
|
|
149
149
|
unknownFlagName = "wise";
|
|
@@ -1628,9 +1628,9 @@ var markdownComponentToProps = ({
|
|
|
1628
1628
|
});
|
|
1629
1629
|
|
|
1630
1630
|
// src/revamp/renderers/mappers/modalComponentToProps.ts
|
|
1631
|
-
var modalComponentToProps = ({ control, margin, trigger }, components) => ({
|
|
1631
|
+
var modalComponentToProps = ({ content, control, margin, trigger }, components) => ({
|
|
1632
1632
|
type: "modal",
|
|
1633
|
-
content: { components },
|
|
1633
|
+
content: { components, title: content.title },
|
|
1634
1634
|
control,
|
|
1635
1635
|
margin,
|
|
1636
1636
|
trigger
|
|
@@ -8018,7 +8018,7 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
8018
8018
|
return getLocalValues(this.components);
|
|
8019
8019
|
},
|
|
8020
8020
|
validate() {
|
|
8021
|
-
return validateComponents(this.getChildren());
|
|
8021
|
+
return hidden ? true : validateComponents(this.getChildren());
|
|
8022
8022
|
}
|
|
8023
8023
|
};
|
|
8024
8024
|
};
|
|
@@ -8218,82 +8218,29 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8218
8218
|
);
|
|
8219
8219
|
};
|
|
8220
8220
|
|
|
8221
|
-
// src/revamp/domain/components/utils/
|
|
8222
|
-
var
|
|
8223
|
-
if (
|
|
8224
|
-
return
|
|
8225
|
-
}
|
|
8226
|
-
if (component.type === "select") {
|
|
8227
|
-
const selectedChild = component.getSelectedChild();
|
|
8228
|
-
return selectedChild ? getComponentForLocalValueKey(key, selectedChild) : null;
|
|
8229
|
-
}
|
|
8230
|
-
const child = hasChildren(component) ? [...component.getChildren()].reverse().find((c) => {
|
|
8231
|
-
const v = c.getLocalValue();
|
|
8232
|
-
return isObjectLocalValue(v) && key in v;
|
|
8233
|
-
}) : void 0;
|
|
8234
|
-
return child ? getComponentForLocalValueKey(key, child) : null;
|
|
8235
|
-
};
|
|
8236
|
-
|
|
8237
|
-
// src/revamp/domain/components/utils/isPartialLocalValueMatch.ts
|
|
8238
|
-
var isPartialLocalValueMatch = (partialValue, component) => {
|
|
8239
|
-
if (!component) {
|
|
8240
|
-
return false;
|
|
8241
|
-
}
|
|
8242
|
-
const componentValue = component.getLocalValue();
|
|
8243
|
-
if (component.type === "const") {
|
|
8244
|
-
return isExactLocalValueMatch(partialValue, componentValue);
|
|
8245
|
-
}
|
|
8246
|
-
if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
|
|
8247
|
-
return isPartialObjectMatch(partialValue, componentValue, component);
|
|
8248
|
-
}
|
|
8249
|
-
if (isArrayLocalValue(partialValue) && component.type === "tuple") {
|
|
8250
|
-
return isPartialTupleMatch(partialValue, component);
|
|
8251
|
-
}
|
|
8252
|
-
return null;
|
|
8253
|
-
};
|
|
8254
|
-
var isPartialObjectMatch = (partialValue, componentValue, component) => {
|
|
8255
|
-
const results = getMatchingKeys(partialValue, componentValue).map((key) => {
|
|
8256
|
-
const componentForKey = getComponentForLocalValueKey(key, component);
|
|
8257
|
-
return componentForKey && componentForKey.type === "const" ? isPartialLocalValueMatch(partialValue[key], componentForKey) : null;
|
|
8258
|
-
});
|
|
8259
|
-
if (results.includes(false)) {
|
|
8260
|
-
return false;
|
|
8261
|
-
}
|
|
8262
|
-
if (results.includes(true)) {
|
|
8263
|
-
return true;
|
|
8221
|
+
// src/revamp/domain/components/utils/isPartialModelMatch.ts
|
|
8222
|
+
var isPartialModelMatch = (localModel, incomingModel) => {
|
|
8223
|
+
if (isArrayModel(localModel) && isArrayModel(incomingModel)) {
|
|
8224
|
+
return localModel.length === incomingModel.length && localModel.every((value, index) => isPartialModelMatch(value, incomingModel[index]));
|
|
8264
8225
|
}
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
const results = shortest.map((_value, index) => {
|
|
8271
|
-
if (children[index].type !== "const") {
|
|
8272
|
-
return null;
|
|
8273
|
-
}
|
|
8274
|
-
return isPartialLocalValueMatch(partialValue[index], children[index]);
|
|
8275
|
-
});
|
|
8276
|
-
if (results.includes(false)) {
|
|
8277
|
-
return false;
|
|
8278
|
-
}
|
|
8279
|
-
if (results.includes(true)) {
|
|
8280
|
-
return true;
|
|
8226
|
+
if (isObjectModel(localModel) && isObjectModel(incomingModel)) {
|
|
8227
|
+
const nonNullishKeysInBoth = nonNullishKeys(localModel).filter(
|
|
8228
|
+
(key) => nonNullishKeys(incomingModel).includes(key)
|
|
8229
|
+
);
|
|
8230
|
+
return nonNullishKeysInBoth.length > 0 && nonNullishKeysInBoth.every((key) => isPartialModelMatch(localModel[key], incomingModel[key]));
|
|
8281
8231
|
}
|
|
8282
|
-
return
|
|
8283
|
-
};
|
|
8284
|
-
var getMatchingKeys = (a, b) => {
|
|
8285
|
-
const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]));
|
|
8286
|
-
return allKeys.filter((key) => !isNullish(a[key]) && !isNullish(b[key]));
|
|
8232
|
+
return localModel === incomingModel;
|
|
8287
8233
|
};
|
|
8234
|
+
var nonNullishKeys = (model) => Object.keys(model).filter((key) => !isNullish(model[key]));
|
|
8288
8235
|
|
|
8289
8236
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
8290
8237
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
8291
|
-
const _a = selectProps, { uid, checks,
|
|
8238
|
+
const _a = selectProps, { uid, checks, initialModel, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialModel", "options", "performRefresh", "onValueChange", "summariser"]);
|
|
8292
8239
|
const children = options.map((option) => option.component);
|
|
8293
8240
|
const matchingOptions = options.map(
|
|
8294
|
-
(option) =>
|
|
8241
|
+
(option) => isPartialModelMatch(option.component.getSubmittableValueSync(), initialModel)
|
|
8295
8242
|
);
|
|
8296
|
-
const selectedIndex = matchingOptions.filter(
|
|
8243
|
+
const selectedIndex = matchingOptions.filter((match) => match).length === 1 ? matchingOptions.indexOf(true) : null;
|
|
8297
8244
|
const update = getInputUpdateFunction(uid, updateComponent);
|
|
8298
8245
|
const getValidationErrors = getLocalValueValidator(checks);
|
|
8299
8246
|
const getAndSetValidationErrors = (currentValue) => {
|
|
@@ -8361,11 +8308,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8361
8308
|
}
|
|
8362
8309
|
});
|
|
8363
8310
|
};
|
|
8364
|
-
var isTrue = (value) => value === true;
|
|
8365
8311
|
|
|
8366
8312
|
// src/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.ts
|
|
8367
8313
|
var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
8368
|
-
var _a
|
|
8314
|
+
var _a;
|
|
8369
8315
|
const {
|
|
8370
8316
|
uid,
|
|
8371
8317
|
localValue,
|
|
@@ -8387,7 +8333,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8387
8333
|
component: mapSchemaToComponent(
|
|
8388
8334
|
{
|
|
8389
8335
|
uid: `${uid}.oneOf-${index}`,
|
|
8390
|
-
schema: supressSchemaTitleAndDescription(childSchema),
|
|
8336
|
+
schema: isFormSectionSchema(childSchema) ? supressSchemaTitleAndDescription(childSchema) : childSchema,
|
|
8391
8337
|
model: initialModel,
|
|
8392
8338
|
localValue,
|
|
8393
8339
|
validationErrors: initialError,
|
|
@@ -8398,15 +8344,14 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8398
8344
|
};
|
|
8399
8345
|
});
|
|
8400
8346
|
const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
|
|
8401
|
-
const {
|
|
8347
|
+
const { validationMessages } = schema;
|
|
8402
8348
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8403
|
-
const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8404
8349
|
return createSelectInputComponent(
|
|
8405
8350
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8406
8351
|
autoComplete: getAutocompleteString(schema.autocompleteHint),
|
|
8407
8352
|
checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
|
|
8408
8353
|
options,
|
|
8409
|
-
|
|
8354
|
+
initialModel,
|
|
8410
8355
|
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8411
8356
|
onValueChange,
|
|
8412
8357
|
trackEvent
|
|
@@ -8414,6 +8359,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8414
8359
|
updateComponent
|
|
8415
8360
|
);
|
|
8416
8361
|
};
|
|
8362
|
+
var isFormSectionSchema = (schema) => isObjectSchema(schema) || isArrayTupleSchema(schema) || isAllOfSchema(schema);
|
|
8417
8363
|
var supressSchemaTitleAndDescription = (schema) => {
|
|
8418
8364
|
const _a = schema, { title, description } = _a, headlessSchema = __objRest(_a, ["title", "description"]);
|
|
8419
8365
|
return headlessSchema;
|
|
@@ -9916,13 +9862,14 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
|
|
|
9916
9862
|
|
|
9917
9863
|
// src/revamp/domain/mappers/layout/modalLayoutToComponent.ts
|
|
9918
9864
|
var modalLayoutToComponent = (uid, { content, control, margin = "md", trigger }, mapperProps) => {
|
|
9919
|
-
const { components } = content;
|
|
9865
|
+
const { components, title } = content;
|
|
9920
9866
|
return createModalComponent({
|
|
9921
9867
|
uid,
|
|
9922
9868
|
content: {
|
|
9923
9869
|
components: components.map(
|
|
9924
9870
|
(component, index) => mapLayoutToComponent(`${uid}.modal-${index}`, component, mapperProps)
|
|
9925
|
-
)
|
|
9871
|
+
),
|
|
9872
|
+
title
|
|
9926
9873
|
},
|
|
9927
9874
|
control,
|
|
9928
9875
|
margin,
|
|
@@ -11286,7 +11233,7 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
11286
11233
|
// ../renderers/src/DecisionRenderer.tsx
|
|
11287
11234
|
import { NavigationOptionsList, NavigationOption, Header } from "@transferwise/components";
|
|
11288
11235
|
|
|
11289
|
-
// ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.
|
|
11236
|
+
// ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
|
|
11290
11237
|
init_index_93a0c34e_esm();
|
|
11291
11238
|
init_clsx();
|
|
11292
11239
|
import "react";
|
|
@@ -11623,6 +11570,7 @@ var ModalRenderer = {
|
|
|
11623
11570
|
var ModalRenderer_default = ModalRenderer;
|
|
11624
11571
|
function DFModal({ content, margin, trigger }) {
|
|
11625
11572
|
const [visible, setVisible] = useState4(false);
|
|
11573
|
+
const { components, title } = content;
|
|
11626
11574
|
return /* @__PURE__ */ jsxs8("div", { className: getMargin(margin), children: [
|
|
11627
11575
|
/* @__PURE__ */ jsx32(Button2, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
11628
11576
|
/* @__PURE__ */ jsx32(
|
|
@@ -11631,7 +11579,8 @@ function DFModal({ content, margin, trigger }) {
|
|
|
11631
11579
|
scroll: "content",
|
|
11632
11580
|
open: visible,
|
|
11633
11581
|
size: "lg",
|
|
11634
|
-
|
|
11582
|
+
title,
|
|
11583
|
+
body: components,
|
|
11635
11584
|
onClose: () => setVisible(false)
|
|
11636
11585
|
}
|
|
11637
11586
|
)
|
|
@@ -18084,6 +18033,7 @@ function DynamicModal(props) {
|
|
|
18084
18033
|
scroll: "content",
|
|
18085
18034
|
open: visible,
|
|
18086
18035
|
size: "lg",
|
|
18036
|
+
title: component.content.title,
|
|
18087
18037
|
body: /* @__PURE__ */ jsx115(
|
|
18088
18038
|
DynamicLayout_default,
|
|
18089
18039
|
__spreadProps(__spreadValues({}, props), {
|
|
@@ -8,5 +8,6 @@ export type ModalComponent = LayoutComponent & {
|
|
|
8
8
|
};
|
|
9
9
|
export type ModalContent = {
|
|
10
10
|
components: DomainComponent[];
|
|
11
|
+
title?: string;
|
|
11
12
|
};
|
|
12
13
|
export declare const createModalComponent: (modalProps: Pick<ModalComponent, "uid" | "content" | "control" | "margin" | "trigger">) => ModalComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Icon, Image } from '@wise/dynamic-flow-types/build/next';
|
|
1
|
+
import type { Icon, Image, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { InputComponent, LocalValue, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange } from '../types';
|
|
3
3
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
4
4
|
import type { AnalyticsEventDispatcher } from '../features/events';
|
|
@@ -21,7 +21,7 @@ export type SelectInputOption = {
|
|
|
21
21
|
disabled: boolean;
|
|
22
22
|
};
|
|
23
23
|
export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "placeholder" | "required" | "title"> & {
|
|
24
|
-
|
|
24
|
+
initialModel: Model;
|
|
25
25
|
options: (SelectInputOption & {
|
|
26
26
|
component: DomainComponent;
|
|
27
27
|
})[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ModalComponent } from '../../domain/components/ModalComponent';
|
|
3
3
|
import type { ModalRendererProps } from '@wise/dynamic-flow-renderers';
|
|
4
|
-
export declare const modalComponentToProps: ({ control, margin, trigger }: ModalComponent, components: ReactNode) => ModalRendererProps;
|
|
4
|
+
export declare const modalComponentToProps: ({ content, control, margin, trigger }: ModalComponent, components: ReactNode) => ModalRendererProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.1",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@babel/preset-react": "7.24.7",
|
|
35
35
|
"@babel/preset-typescript": "7.24.7",
|
|
36
36
|
"@cfaester/enzyme-adapter-react-18": "0.8.0",
|
|
37
|
-
"@chromatic-com/storybook": "1.
|
|
37
|
+
"@chromatic-com/storybook": "1.8.0",
|
|
38
38
|
"@formatjs/cli": "^6.2.12",
|
|
39
39
|
"@storybook/addon-a11y": "^8.2.9",
|
|
40
40
|
"@storybook/addon-actions": "^8.2.9",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"@storybook/types": "^8.2.9",
|
|
50
50
|
"@testing-library/dom": "10.4.0",
|
|
51
51
|
"@testing-library/jest-dom": "6.5.0",
|
|
52
|
-
"@testing-library/react": "16.0.
|
|
52
|
+
"@testing-library/react": "16.0.1",
|
|
53
53
|
"@testing-library/react-hooks": "8.0.1",
|
|
54
54
|
"@testing-library/user-event": "14.5.2",
|
|
55
|
-
"@transferwise/components": "46.
|
|
55
|
+
"@transferwise/components": "46.70.2",
|
|
56
56
|
"@transferwise/formatting": "^2.13.0",
|
|
57
57
|
"@transferwise/icons": "3.13.0",
|
|
58
|
-
"@transferwise/neptune-css": "14.
|
|
58
|
+
"@transferwise/neptune-css": "14.18.0",
|
|
59
59
|
"@types/enzyme": "^3.10.18",
|
|
60
60
|
"@types/jest": "29.5.12",
|
|
61
|
-
"@types/react": "18.3.
|
|
61
|
+
"@types/react": "18.3.5",
|
|
62
62
|
"@types/react-dom": "18.3.0",
|
|
63
63
|
"@types/react-intl": "3.0.0",
|
|
64
64
|
"@wise/art": "2.14.0",
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"jest-watch-typeahead": "^2.2.2",
|
|
73
73
|
"nanoid": "5.0.7",
|
|
74
74
|
"npm-run-all2": "6.2.2",
|
|
75
|
-
"postcss": "^8.4.
|
|
75
|
+
"postcss": "^8.4.44",
|
|
76
76
|
"postcss-cli": "^11.0.0",
|
|
77
77
|
"postcss-import": "^15.1.0",
|
|
78
78
|
"react": "18.3.1",
|
|
79
79
|
"react-dom": "18.3.1",
|
|
80
80
|
"react-intl": "6.6.8",
|
|
81
81
|
"storybook": "8.2.9",
|
|
82
|
-
"stylelint": "16.
|
|
82
|
+
"stylelint": "16.9.0",
|
|
83
83
|
"stylelint-config-standard": "36.0.1",
|
|
84
84
|
"stylelint-no-unsupported-browser-features": "8.0.1",
|
|
85
85
|
"stylelint-value-no-unknown-custom-properties": "6.0.1",
|
|
86
|
-
"tsx": "4.
|
|
86
|
+
"tsx": "4.19.0",
|
|
87
87
|
"typescript": "5.5.4",
|
|
88
88
|
"webpack": "5.94.0",
|
|
89
89
|
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"nanoid": "5.0.7",
|
|
105
105
|
"react-webcam": "^7.2.0",
|
|
106
106
|
"screenfull": "^5.2.0",
|
|
107
|
-
"@wise/dynamic-flow-types": "2.
|
|
107
|
+
"@wise/dynamic-flow-types": "2.21.0"
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
110
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { DomainComponent } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Returns a component that is a child (or grandchild, etc.) of the given component,
|
|
4
|
-
* which is "responsible" for the value of the given key,
|
|
5
|
-
* or null if there isn't any.
|
|
6
|
-
*/
|
|
7
|
-
export declare const getComponentForLocalValueKey: (key: string, component: DomainComponent) => DomainComponent | null;
|