@wise/dynamic-flow-client 4.3.10 → 4.3.11
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
CHANGED
|
@@ -2448,7 +2448,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
2448
2448
|
return submission;
|
|
2449
2449
|
}
|
|
2450
2450
|
const newAbortController = abortAndResetController(abortController);
|
|
2451
|
-
if (isNullish(currentValue)) {
|
|
2451
|
+
if (isNullish(currentValue) || currentValue === "") {
|
|
2452
2452
|
const resolvedNull = Promise.resolve(null);
|
|
2453
2453
|
update((draft) => {
|
|
2454
2454
|
draft.persistedState.abortController = newAbortController;
|
|
@@ -2609,10 +2609,7 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
2609
2609
|
* the description or set errors when the request completes.
|
|
2610
2610
|
*/
|
|
2611
2611
|
async (validationAsyncState, currentValue) => {
|
|
2612
|
-
const { abortController
|
|
2613
|
-
if (lastSubmitted === currentValue) {
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2612
|
+
const { abortController } = validationAsyncState;
|
|
2616
2613
|
const newAbortController = abortAndResetController(abortController);
|
|
2617
2614
|
if (isNullish(currentValue)) {
|
|
2618
2615
|
update((draft) => {
|
|
@@ -2650,6 +2647,7 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
2650
2647
|
return newSubmission;
|
|
2651
2648
|
}
|
|
2652
2649
|
);
|
|
2650
|
+
var getDebouncedComponentValidationAsync = (update, performValidationAsync) => debounce(getComponentValidationAsync(update, performValidationAsync), 1e3);
|
|
2653
2651
|
|
|
2654
2652
|
// src/revamp/domain/components/NumberInputComponent.ts
|
|
2655
2653
|
var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
@@ -2742,12 +2740,17 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
2742
2740
|
});
|
|
2743
2741
|
}
|
|
2744
2742
|
if (performValidationAsync) {
|
|
2745
|
-
const validateAsync =
|
|
2743
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
2746
2744
|
return __spreadProps(__spreadValues({}, numberComponent), {
|
|
2747
2745
|
onBlur() {
|
|
2748
2746
|
if (this.validate()) {
|
|
2749
|
-
validateAsync
|
|
2750
|
-
|
|
2747
|
+
validateAsync.flush();
|
|
2748
|
+
}
|
|
2749
|
+
},
|
|
2750
|
+
onChange(updatedValue) {
|
|
2751
|
+
numberComponent.onChange.call(this, updatedValue);
|
|
2752
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
2753
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
2751
2754
|
}
|
|
2752
2755
|
}
|
|
2753
2756
|
});
|
|
@@ -2824,7 +2827,7 @@ var getAboveMaxLengthCheck = ({ maxLength }, messageFunctions) => (value) => {
|
|
|
2824
2827
|
return null;
|
|
2825
2828
|
};
|
|
2826
2829
|
var getBelowMinLengthCheck = ({ minLength }, messageFunctions) => (value) => {
|
|
2827
|
-
if (isNumber(minLength) && isString(value) && value.length < minLength) {
|
|
2830
|
+
if (isNumber(minLength) && isString(value) && value && value.length < minLength) {
|
|
2828
2831
|
return messageFunctions.minLength(minLength);
|
|
2829
2832
|
}
|
|
2830
2833
|
return null;
|
|
@@ -2848,7 +2851,7 @@ var getAboveMaximumDateCheck = ({ maximum }, messageFunctions) => (value) => {
|
|
|
2848
2851
|
return null;
|
|
2849
2852
|
};
|
|
2850
2853
|
var getBelowMinimumDateCheck = ({ minimum }, messageFunctions) => (value) => {
|
|
2851
|
-
if (isString(minimum) && isString(value) && value < minimum) {
|
|
2854
|
+
if (isString(minimum) && isString(value) && value && value < minimum) {
|
|
2852
2855
|
return messageFunctions.minimumDate(minimum);
|
|
2853
2856
|
}
|
|
2854
2857
|
return null;
|
|
@@ -2856,7 +2859,7 @@ var getBelowMinimumDateCheck = ({ minimum }, messageFunctions) => (value) => {
|
|
|
2856
2859
|
var getNotAdheringToPatternCheck = ({ pattern }, messageFunctions, options) => {
|
|
2857
2860
|
validateStringPattern(pattern, options == null ? void 0 : options.logEvent);
|
|
2858
2861
|
return (value) => {
|
|
2859
|
-
if (isString(pattern) && isString(value)) {
|
|
2862
|
+
if (isString(pattern) && isString(value) && value) {
|
|
2860
2863
|
return new RegExp(pattern).test(value) ? null : messageFunctions.pattern();
|
|
2861
2864
|
}
|
|
2862
2865
|
return null;
|
|
@@ -3533,12 +3536,17 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
3533
3536
|
});
|
|
3534
3537
|
}
|
|
3535
3538
|
if (performValidationAsync) {
|
|
3536
|
-
const validateAsync =
|
|
3539
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
3537
3540
|
return __spreadProps(__spreadValues({}, integerComponent), {
|
|
3538
3541
|
onBlur() {
|
|
3539
3542
|
if (this.validate()) {
|
|
3540
|
-
validateAsync
|
|
3541
|
-
|
|
3543
|
+
validateAsync.flush();
|
|
3544
|
+
}
|
|
3545
|
+
},
|
|
3546
|
+
onChange(updatedValue) {
|
|
3547
|
+
integerComponent.onChange.call(this, updatedValue);
|
|
3548
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
3549
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
3542
3550
|
}
|
|
3543
3551
|
}
|
|
3544
3552
|
});
|
|
@@ -4164,12 +4172,17 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
4164
4172
|
});
|
|
4165
4173
|
}
|
|
4166
4174
|
if (performValidationAsync) {
|
|
4167
|
-
const validateAsync =
|
|
4175
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
4168
4176
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
4169
4177
|
onBlur() {
|
|
4170
4178
|
if (this.validate()) {
|
|
4171
|
-
validateAsync
|
|
4172
|
-
|
|
4179
|
+
validateAsync.flush();
|
|
4180
|
+
}
|
|
4181
|
+
},
|
|
4182
|
+
onChange(updatedValue) {
|
|
4183
|
+
inputComponent.onChange.call(this, updatedValue);
|
|
4184
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
4185
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
4173
4186
|
}
|
|
4174
4187
|
}
|
|
4175
4188
|
});
|
|
@@ -7106,8 +7119,8 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
7106
7119
|
|
|
7107
7120
|
// src/common/utils/debounce.ts
|
|
7108
7121
|
var debounce2 = (callback, waitMs) => {
|
|
7109
|
-
let timeoutId;
|
|
7110
|
-
let lastArgs;
|
|
7122
|
+
let timeoutId = null;
|
|
7123
|
+
let lastArgs = null;
|
|
7111
7124
|
const clearTimer = () => {
|
|
7112
7125
|
if (timeoutId) {
|
|
7113
7126
|
clearTimeout(timeoutId);
|
package/build/main.mjs
CHANGED
|
@@ -2405,7 +2405,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
2405
2405
|
return submission;
|
|
2406
2406
|
}
|
|
2407
2407
|
const newAbortController = abortAndResetController(abortController);
|
|
2408
|
-
if (isNullish(currentValue)) {
|
|
2408
|
+
if (isNullish(currentValue) || currentValue === "") {
|
|
2409
2409
|
const resolvedNull = Promise.resolve(null);
|
|
2410
2410
|
update((draft) => {
|
|
2411
2411
|
draft.persistedState.abortController = newAbortController;
|
|
@@ -2566,10 +2566,7 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
2566
2566
|
* the description or set errors when the request completes.
|
|
2567
2567
|
*/
|
|
2568
2568
|
async (validationAsyncState, currentValue) => {
|
|
2569
|
-
const { abortController
|
|
2570
|
-
if (lastSubmitted === currentValue) {
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2569
|
+
const { abortController } = validationAsyncState;
|
|
2573
2570
|
const newAbortController = abortAndResetController(abortController);
|
|
2574
2571
|
if (isNullish(currentValue)) {
|
|
2575
2572
|
update((draft) => {
|
|
@@ -2607,6 +2604,7 @@ var getComponentValidationAsync = (update, performValidationAsync) => (
|
|
|
2607
2604
|
return newSubmission;
|
|
2608
2605
|
}
|
|
2609
2606
|
);
|
|
2607
|
+
var getDebouncedComponentValidationAsync = (update, performValidationAsync) => debounce(getComponentValidationAsync(update, performValidationAsync), 1e3);
|
|
2610
2608
|
|
|
2611
2609
|
// src/revamp/domain/components/NumberInputComponent.ts
|
|
2612
2610
|
var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
@@ -2699,12 +2697,17 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
2699
2697
|
});
|
|
2700
2698
|
}
|
|
2701
2699
|
if (performValidationAsync) {
|
|
2702
|
-
const validateAsync =
|
|
2700
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
2703
2701
|
return __spreadProps(__spreadValues({}, numberComponent), {
|
|
2704
2702
|
onBlur() {
|
|
2705
2703
|
if (this.validate()) {
|
|
2706
|
-
validateAsync
|
|
2707
|
-
|
|
2704
|
+
validateAsync.flush();
|
|
2705
|
+
}
|
|
2706
|
+
},
|
|
2707
|
+
onChange(updatedValue) {
|
|
2708
|
+
numberComponent.onChange.call(this, updatedValue);
|
|
2709
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
2710
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
2708
2711
|
}
|
|
2709
2712
|
}
|
|
2710
2713
|
});
|
|
@@ -2781,7 +2784,7 @@ var getAboveMaxLengthCheck = ({ maxLength }, messageFunctions) => (value) => {
|
|
|
2781
2784
|
return null;
|
|
2782
2785
|
};
|
|
2783
2786
|
var getBelowMinLengthCheck = ({ minLength }, messageFunctions) => (value) => {
|
|
2784
|
-
if (isNumber(minLength) && isString(value) && value.length < minLength) {
|
|
2787
|
+
if (isNumber(minLength) && isString(value) && value && value.length < minLength) {
|
|
2785
2788
|
return messageFunctions.minLength(minLength);
|
|
2786
2789
|
}
|
|
2787
2790
|
return null;
|
|
@@ -2805,7 +2808,7 @@ var getAboveMaximumDateCheck = ({ maximum }, messageFunctions) => (value) => {
|
|
|
2805
2808
|
return null;
|
|
2806
2809
|
};
|
|
2807
2810
|
var getBelowMinimumDateCheck = ({ minimum }, messageFunctions) => (value) => {
|
|
2808
|
-
if (isString(minimum) && isString(value) && value < minimum) {
|
|
2811
|
+
if (isString(minimum) && isString(value) && value && value < minimum) {
|
|
2809
2812
|
return messageFunctions.minimumDate(minimum);
|
|
2810
2813
|
}
|
|
2811
2814
|
return null;
|
|
@@ -2813,7 +2816,7 @@ var getBelowMinimumDateCheck = ({ minimum }, messageFunctions) => (value) => {
|
|
|
2813
2816
|
var getNotAdheringToPatternCheck = ({ pattern }, messageFunctions, options) => {
|
|
2814
2817
|
validateStringPattern(pattern, options == null ? void 0 : options.logEvent);
|
|
2815
2818
|
return (value) => {
|
|
2816
|
-
if (isString(pattern) && isString(value)) {
|
|
2819
|
+
if (isString(pattern) && isString(value) && value) {
|
|
2817
2820
|
return new RegExp(pattern).test(value) ? null : messageFunctions.pattern();
|
|
2818
2821
|
}
|
|
2819
2822
|
return null;
|
|
@@ -3490,12 +3493,17 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
3490
3493
|
});
|
|
3491
3494
|
}
|
|
3492
3495
|
if (performValidationAsync) {
|
|
3493
|
-
const validateAsync =
|
|
3496
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
3494
3497
|
return __spreadProps(__spreadValues({}, integerComponent), {
|
|
3495
3498
|
onBlur() {
|
|
3496
3499
|
if (this.validate()) {
|
|
3497
|
-
validateAsync
|
|
3498
|
-
|
|
3500
|
+
validateAsync.flush();
|
|
3501
|
+
}
|
|
3502
|
+
},
|
|
3503
|
+
onChange(updatedValue) {
|
|
3504
|
+
integerComponent.onChange.call(this, updatedValue);
|
|
3505
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
3506
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
3499
3507
|
}
|
|
3500
3508
|
}
|
|
3501
3509
|
});
|
|
@@ -4121,12 +4129,17 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
4121
4129
|
});
|
|
4122
4130
|
}
|
|
4123
4131
|
if (performValidationAsync) {
|
|
4124
|
-
const validateAsync =
|
|
4132
|
+
const validateAsync = getDebouncedComponentValidationAsync(update, performValidationAsync);
|
|
4125
4133
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
4126
4134
|
onBlur() {
|
|
4127
4135
|
if (this.validate()) {
|
|
4128
|
-
validateAsync
|
|
4129
|
-
|
|
4136
|
+
validateAsync.flush();
|
|
4137
|
+
}
|
|
4138
|
+
},
|
|
4139
|
+
onChange(updatedValue) {
|
|
4140
|
+
inputComponent.onChange.call(this, updatedValue);
|
|
4141
|
+
if (getValidationErrors(updatedValue).length === 0) {
|
|
4142
|
+
validateAsync(this.validationAsyncState, updatedValue);
|
|
4130
4143
|
}
|
|
4131
4144
|
}
|
|
4132
4145
|
});
|
|
@@ -7063,8 +7076,8 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
7063
7076
|
|
|
7064
7077
|
// src/common/utils/debounce.ts
|
|
7065
7078
|
var debounce2 = (callback, waitMs) => {
|
|
7066
|
-
let timeoutId;
|
|
7067
|
-
let lastArgs;
|
|
7079
|
+
let timeoutId = null;
|
|
7080
|
+
let lastArgs = null;
|
|
7068
7081
|
const clearTimer = () => {
|
|
7069
7082
|
if (timeoutId) {
|
|
7070
7083
|
clearTimeout(timeoutId);
|
|
@@ -12,4 +12,5 @@ type Validatable = BooleanInputComponent | DateInputComponent | IntegerInputComp
|
|
|
12
12
|
* Creates an onValidateAsync handler for a component.
|
|
13
13
|
*/
|
|
14
14
|
export declare const getComponentValidationAsync: (update: ReturnType<typeof getInputUpdateFunction<Validatable>>, performValidationAsync: PerformValidationAsync) => (validationAsyncState: ValidationAsyncState, currentValue: LocalValue) => Promise<string | null | undefined>;
|
|
15
|
+
export declare const getDebouncedComponentValidationAsync: (update: ReturnType<typeof getInputUpdateFunction<Validatable>>, performValidationAsync: PerformValidationAsync) => import("../../components/utils/debounce").DebouncedFunc<(validationAsyncState: ValidationAsyncState, currentValue: LocalValue) => Promise<string | null | undefined>>;
|
|
15
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.11",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"tsx": "4.19.3",
|
|
86
86
|
"typescript": "5.8.3",
|
|
87
87
|
"webpack": "5.98.0",
|
|
88
|
-
"@wise/dynamic-flow-
|
|
89
|
-
"@wise/dynamic-flow-
|
|
88
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
89
|
+
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@transferwise/components": "^46.92.0",
|