@wise/dynamic-flow-client 3.18.0 → 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 +23 -77
- package/build/main.min.js +1 -1
- package/build/main.mjs +23 -77
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/utils/isPartialModelMatch.d.ts +2 -0
- package/package.json +7 -7
- 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.18.0_@types+react@18.3.
|
|
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.18.0_@types+react@18.3.
|
|
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";
|
|
@@ -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;
|
|
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]));
|
|
8261
8225
|
}
|
|
8262
|
-
if (
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
var isPartialTupleMatch = (partialValue, component) => {
|
|
8268
|
-
const children = component.getChildren();
|
|
8269
|
-
const shortest = partialValue.length < children.length ? partialValue : children;
|
|
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;
|
|
@@ -11287,7 +11233,7 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
11287
11233
|
// ../renderers/src/DecisionRenderer.tsx
|
|
11288
11234
|
import { NavigationOptionsList, NavigationOption, Header } from "@transferwise/components";
|
|
11289
11235
|
|
|
11290
|
-
// ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.
|
|
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
|
|
11291
11237
|
init_index_93a0c34e_esm();
|
|
11292
11238
|
init_clsx();
|
|
11293
11239
|
import "react";
|
|
@@ -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
|
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "3.18.
|
|
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,7 +49,7 @@
|
|
|
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
55
|
"@transferwise/components": "46.70.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
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",
|
|
@@ -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;
|