@wise/dynamic-flow-client 3.16.6 → 3.17.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 +156 -108
- package/build/main.min.js +1 -1
- package/build/main.mjs +156 -108
- package/build/types/legacy/common/hooks/usePolling/usePolling.d.ts +2 -2
- package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +2 -5
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -5
- package/build/types/revamp/domain/components/utils/isExactLocalValueMatch.d.ts +2 -0
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +2 -4
- package/build/types/revamp/domain/types.d.ts +4 -1
- package/build/types/revamp/utils/component-utils.d.ts +1 -0
- package/build/types/test-utils/index.d.ts +2 -0
- package/package.json +4 -4
- package/build/types/revamp/domain/components/utils/local-value.d.ts +0 -2
package/build/main.mjs
CHANGED
|
@@ -6222,7 +6222,9 @@ var reviewLayoutSchema = z.object({
|
|
|
6222
6222
|
var searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
|
|
6223
6223
|
var pollingSchema = z.object({
|
|
6224
6224
|
url: z.string(),
|
|
6225
|
-
interval: z.number(),
|
|
6225
|
+
interval: z.number().optional(),
|
|
6226
|
+
delay: z.number().optional(),
|
|
6227
|
+
timeout: z.number().optional(),
|
|
6226
6228
|
maxAttempts: z.number(),
|
|
6227
6229
|
onError: pollingOnErrorSchema
|
|
6228
6230
|
});
|
|
@@ -6334,6 +6336,7 @@ var modalLayoutSchema = z.lazy(
|
|
|
6334
6336
|
);
|
|
6335
6337
|
var modalLayoutContentSchema = z.lazy(
|
|
6336
6338
|
() => z.object({
|
|
6339
|
+
title: z.string().optional(),
|
|
6337
6340
|
components: z.array(layoutSchema)
|
|
6338
6341
|
})
|
|
6339
6342
|
);
|
|
@@ -6669,6 +6672,7 @@ import { useIntl as useIntl2 } from "react-intl";
|
|
|
6669
6672
|
var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
|
|
6670
6673
|
(values) => values.reduce((acc, value) => mergeModels(acc, value), null)
|
|
6671
6674
|
);
|
|
6675
|
+
var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
|
|
6672
6676
|
var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
|
|
6673
6677
|
var mergeLocalValues = (valueA, valueB) => {
|
|
6674
6678
|
if (valueA === null) {
|
|
@@ -6757,6 +6761,9 @@ var createStepComponent = (stepProps) => {
|
|
|
6757
6761
|
async getSubmittableValue() {
|
|
6758
6762
|
return getSubmittableData(this.components);
|
|
6759
6763
|
},
|
|
6764
|
+
getSubmittableValueSync() {
|
|
6765
|
+
return getSubmittableDataSync(this.components);
|
|
6766
|
+
},
|
|
6760
6767
|
getSummary() {
|
|
6761
6768
|
return summariseFromChildren(this.getChildren());
|
|
6762
6769
|
},
|
|
@@ -6823,8 +6830,11 @@ var getStepPolling = ({
|
|
|
6823
6830
|
pollingConfig,
|
|
6824
6831
|
onAction
|
|
6825
6832
|
}) => {
|
|
6826
|
-
const { interval, maxAttempts, url, onError } = pollingConfig;
|
|
6833
|
+
const { interval, delay = interval, maxAttempts, url, onError } = pollingConfig;
|
|
6827
6834
|
let abortController = new AbortController();
|
|
6835
|
+
if (delay == null) {
|
|
6836
|
+
throw new Error("Polling configuration must include delay or interval");
|
|
6837
|
+
}
|
|
6828
6838
|
const onFailure = () => {
|
|
6829
6839
|
stop();
|
|
6830
6840
|
void onAction(onError.action);
|
|
@@ -6853,10 +6863,11 @@ var getStepPolling = ({
|
|
|
6853
6863
|
onFailure();
|
|
6854
6864
|
}
|
|
6855
6865
|
};
|
|
6856
|
-
|
|
6866
|
+
poll();
|
|
6867
|
+
const intervalRef = setInterval(poll, delay * 1e3);
|
|
6857
6868
|
const stop = () => {
|
|
6858
|
-
abortController.abort();
|
|
6859
6869
|
clearTimeout(intervalRef);
|
|
6870
|
+
abortController.abort();
|
|
6860
6871
|
};
|
|
6861
6872
|
return { stop };
|
|
6862
6873
|
};
|
|
@@ -6866,6 +6877,7 @@ var createAlertComponent = (alertProps) => __spreadProps(__spreadValues({
|
|
|
6866
6877
|
type: "alert"
|
|
6867
6878
|
}, alertProps), {
|
|
6868
6879
|
getSubmittableValue: async () => null,
|
|
6880
|
+
getSubmittableValueSync: () => null,
|
|
6869
6881
|
getLocalValue: () => null,
|
|
6870
6882
|
getSummary: () => ({}),
|
|
6871
6883
|
// Noop
|
|
@@ -6967,6 +6979,9 @@ var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps
|
|
|
6967
6979
|
async getSubmittableValue() {
|
|
6968
6980
|
return getSubmittableData(this.components);
|
|
6969
6981
|
},
|
|
6982
|
+
getSubmittableValueSync() {
|
|
6983
|
+
return getSubmittableDataSync(this.components);
|
|
6984
|
+
},
|
|
6970
6985
|
getSummary() {
|
|
6971
6986
|
return summariseFromChildren(this.getChildren());
|
|
6972
6987
|
},
|
|
@@ -6995,6 +7010,7 @@ var createButtonComponent = (buttonProps) => __spreadProps(__spreadValues({
|
|
|
6995
7010
|
type: "button"
|
|
6996
7011
|
}, buttonProps), {
|
|
6997
7012
|
getSubmittableValue: async () => null,
|
|
7013
|
+
getSubmittableValueSync: () => null,
|
|
6998
7014
|
getLocalValue: () => null,
|
|
6999
7015
|
getSummary: () => ({}),
|
|
7000
7016
|
// Noop
|
|
@@ -7062,6 +7078,9 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
|
|
|
7062
7078
|
async getSubmittableValue() {
|
|
7063
7079
|
return getSubmittableData(this.getChildren());
|
|
7064
7080
|
},
|
|
7081
|
+
getSubmittableValueSync() {
|
|
7082
|
+
return getSubmittableDataSync(this.getChildren());
|
|
7083
|
+
},
|
|
7065
7084
|
getSummary() {
|
|
7066
7085
|
return summariseFromChildren(this.getChildren());
|
|
7067
7086
|
},
|
|
@@ -7092,6 +7111,7 @@ var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
|
|
|
7092
7111
|
type: "decision"
|
|
7093
7112
|
}, decisionProps), {
|
|
7094
7113
|
getSubmittableValue: async () => null,
|
|
7114
|
+
getSubmittableValueSync: () => null,
|
|
7095
7115
|
getLocalValue: () => null,
|
|
7096
7116
|
getSummary: () => ({}),
|
|
7097
7117
|
// Noop
|
|
@@ -7120,6 +7140,7 @@ var createDividerComponent = (props) => __spreadProps(__spreadValues({
|
|
|
7120
7140
|
type: "divider"
|
|
7121
7141
|
}, props), {
|
|
7122
7142
|
getSubmittableValue: async () => null,
|
|
7143
|
+
getSubmittableValueSync: () => null,
|
|
7123
7144
|
getLocalValue: () => null,
|
|
7124
7145
|
getSummary: () => ({}),
|
|
7125
7146
|
// Noop
|
|
@@ -7156,15 +7177,15 @@ var abortAndResetController = (abortController) => {
|
|
|
7156
7177
|
return new AbortController();
|
|
7157
7178
|
};
|
|
7158
7179
|
|
|
7159
|
-
// src/revamp/domain/components/utils/
|
|
7160
|
-
var
|
|
7180
|
+
// src/revamp/domain/components/utils/isExactLocalValueMatch.ts
|
|
7181
|
+
var isExactLocalValueMatch = (valueA, valueB) => {
|
|
7161
7182
|
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7162
|
-
return valueA.length === valueB.length && valueA.every((value, index) =>
|
|
7183
|
+
return valueA.length === valueB.length && valueA.every((value, index) => isExactLocalValueMatch(value, valueB[index]));
|
|
7163
7184
|
}
|
|
7164
7185
|
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7165
7186
|
const keysA = Object.keys(valueA);
|
|
7166
7187
|
const keysB = Object.keys(valueB);
|
|
7167
|
-
return keysA.length === keysB.length && keysA.every((key) =>
|
|
7188
|
+
return keysA.length === keysB.length && keysA.every((key) => isExactLocalValueMatch(valueA[key], valueB[key]));
|
|
7168
7189
|
}
|
|
7169
7190
|
return valueA === valueB;
|
|
7170
7191
|
};
|
|
@@ -7177,7 +7198,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7177
7198
|
*/
|
|
7178
7199
|
async (persistedState, currentValue) => {
|
|
7179
7200
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
7180
|
-
if (
|
|
7201
|
+
if (isExactLocalValueMatch(lastSubmitted, currentValue)) {
|
|
7181
7202
|
return submission;
|
|
7182
7203
|
}
|
|
7183
7204
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7185,27 +7206,33 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7185
7206
|
const resolvedNull = Promise.resolve(null);
|
|
7186
7207
|
update((draft) => {
|
|
7187
7208
|
draft.persistedState.abortController = newAbortController;
|
|
7209
|
+
draft.persistedState.lastResponse = null;
|
|
7188
7210
|
draft.persistedState.lastSubmitted = currentValue;
|
|
7189
7211
|
draft.persistedState.submission = resolvedNull;
|
|
7190
7212
|
});
|
|
7191
7213
|
return resolvedNull;
|
|
7192
7214
|
}
|
|
7193
7215
|
const { signal } = newAbortController;
|
|
7194
|
-
const newSubmission = performPersistAsync({ value: currentValue, signal }).
|
|
7195
|
-
(
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
});
|
|
7203
|
-
throw error;
|
|
7216
|
+
const newSubmission = performPersistAsync({ value: currentValue, signal }).then((newValue) => {
|
|
7217
|
+
update((draft) => {
|
|
7218
|
+
draft.persistedState.lastResponse = newValue;
|
|
7219
|
+
});
|
|
7220
|
+
return newValue;
|
|
7221
|
+
}).catch((error) => {
|
|
7222
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
7223
|
+
return null;
|
|
7204
7224
|
}
|
|
7205
|
-
|
|
7225
|
+
update((draft) => {
|
|
7226
|
+
draft.errors = [error.message];
|
|
7227
|
+
draft.persistedState.lastResponse = null;
|
|
7228
|
+
draft.persistedState.lastSubmitted = null;
|
|
7229
|
+
});
|
|
7230
|
+
throw error;
|
|
7231
|
+
});
|
|
7206
7232
|
update((draft) => {
|
|
7207
7233
|
draft.persistedState = {
|
|
7208
7234
|
abortController: newAbortController,
|
|
7235
|
+
lastResponse: null,
|
|
7209
7236
|
lastSubmitted: currentValue,
|
|
7210
7237
|
submission: newSubmission
|
|
7211
7238
|
};
|
|
@@ -7224,7 +7251,13 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7224
7251
|
}
|
|
7225
7252
|
const newAbortController = new AbortController();
|
|
7226
7253
|
const { signal } = newAbortController;
|
|
7227
|
-
const newSubmission = performPersistAsync({ value, signal }).
|
|
7254
|
+
const newSubmission = performPersistAsync({ value, signal }).then((newValue) => {
|
|
7255
|
+
update((draft) => {
|
|
7256
|
+
const index = draft.persistedState.findIndex((state) => state.id === id);
|
|
7257
|
+
draft.persistedState[index].lastResponse = newValue;
|
|
7258
|
+
});
|
|
7259
|
+
return newValue;
|
|
7260
|
+
}).catch((error) => {
|
|
7228
7261
|
update((draft) => {
|
|
7229
7262
|
draft.persistedState = draft.persistedState.filter((state) => state.id !== id);
|
|
7230
7263
|
});
|
|
@@ -7236,6 +7269,7 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7236
7269
|
{
|
|
7237
7270
|
id,
|
|
7238
7271
|
abortController: newAbortController,
|
|
7272
|
+
lastResponse: null,
|
|
7239
7273
|
lastSubmitted: null,
|
|
7240
7274
|
submission: newSubmission
|
|
7241
7275
|
}
|
|
@@ -7396,6 +7430,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7396
7430
|
onValueChange();
|
|
7397
7431
|
},
|
|
7398
7432
|
async getSubmittableValue() {
|
|
7433
|
+
return this.getSubmittableValueSync();
|
|
7434
|
+
},
|
|
7435
|
+
getSubmittableValueSync() {
|
|
7399
7436
|
var _a2;
|
|
7400
7437
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
7401
7438
|
},
|
|
@@ -7416,7 +7453,6 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7416
7453
|
if (performPersistAsync) {
|
|
7417
7454
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
7418
7455
|
return __spreadProps(__spreadValues({}, numberComponent), {
|
|
7419
|
-
isPersisted: true,
|
|
7420
7456
|
onBlur() {
|
|
7421
7457
|
if (this.validate()) {
|
|
7422
7458
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -7425,6 +7461,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7425
7461
|
},
|
|
7426
7462
|
async getSubmittableValue() {
|
|
7427
7463
|
return persist(this.persistedState, this.getLocalValue());
|
|
7464
|
+
},
|
|
7465
|
+
getSubmittableValueSync() {
|
|
7466
|
+
return this.persistedState.lastResponse;
|
|
7428
7467
|
}
|
|
7429
7468
|
});
|
|
7430
7469
|
}
|
|
@@ -7660,6 +7699,7 @@ var getValidationError = (param, response) => {
|
|
|
7660
7699
|
var getInitialPersistedState = (lastSubmitted, model) => ({
|
|
7661
7700
|
abortController: new AbortController(),
|
|
7662
7701
|
lastSubmitted: !isNullish(model) ? lastSubmitted != null ? lastSubmitted : null : null,
|
|
7702
|
+
lastResponse: model != null ? model : null,
|
|
7663
7703
|
submission: Promise.resolve(model != null ? model : null)
|
|
7664
7704
|
});
|
|
7665
7705
|
|
|
@@ -7869,6 +7909,12 @@ var createObjectComponent = (objectProps) => {
|
|
|
7869
7909
|
)
|
|
7870
7910
|
);
|
|
7871
7911
|
},
|
|
7912
|
+
getSubmittableValueSync() {
|
|
7913
|
+
return mergeChildrenValues(
|
|
7914
|
+
displayOrder,
|
|
7915
|
+
(propName) => this.componentMap[propName].getSubmittableValueSync()
|
|
7916
|
+
);
|
|
7917
|
+
},
|
|
7872
7918
|
getSummary() {
|
|
7873
7919
|
const summary = summariser(this.getLocalValue());
|
|
7874
7920
|
const childSummary = summariseFromChildren(this.getChildren());
|
|
@@ -7965,6 +8011,9 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
7965
8011
|
async getSubmittableValue() {
|
|
7966
8012
|
return getSubmittableData(this.components);
|
|
7967
8013
|
},
|
|
8014
|
+
getSubmittableValueSync() {
|
|
8015
|
+
return getSubmittableDataSync(this.components);
|
|
8016
|
+
},
|
|
7968
8017
|
getLocalValue() {
|
|
7969
8018
|
return getLocalValues(this.components);
|
|
7970
8019
|
},
|
|
@@ -8005,6 +8054,7 @@ var createConstComponent = (hiddenProps) => {
|
|
|
8005
8054
|
analyticsId,
|
|
8006
8055
|
getLocalValue: () => value,
|
|
8007
8056
|
getSubmittableValue: async () => value,
|
|
8057
|
+
getSubmittableValueSync: () => value,
|
|
8008
8058
|
getSummary: () => summary,
|
|
8009
8059
|
validate: () => true
|
|
8010
8060
|
};
|
|
@@ -8079,6 +8129,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8079
8129
|
onValueChange();
|
|
8080
8130
|
},
|
|
8081
8131
|
async getSubmittableValue() {
|
|
8132
|
+
return this.getSubmittableValueSync();
|
|
8133
|
+
},
|
|
8134
|
+
getSubmittableValueSync() {
|
|
8082
8135
|
var _a2;
|
|
8083
8136
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8084
8137
|
},
|
|
@@ -8099,7 +8152,6 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8099
8152
|
if (performPersistAsync) {
|
|
8100
8153
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8101
8154
|
return __spreadProps(__spreadValues({}, integerComponent), {
|
|
8102
|
-
isPersisted: true,
|
|
8103
8155
|
onBlur() {
|
|
8104
8156
|
if (this.validate()) {
|
|
8105
8157
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8108,6 +8160,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8108
8160
|
},
|
|
8109
8161
|
async getSubmittableValue() {
|
|
8110
8162
|
return persist(this.persistedState, this.getLocalValue());
|
|
8163
|
+
},
|
|
8164
|
+
getSubmittableValueSync() {
|
|
8165
|
+
return this.persistedState.lastResponse;
|
|
8111
8166
|
}
|
|
8112
8167
|
});
|
|
8113
8168
|
}
|
|
@@ -8186,7 +8241,7 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
8186
8241
|
}
|
|
8187
8242
|
const componentValue = component.getLocalValue();
|
|
8188
8243
|
if (component.type === "const") {
|
|
8189
|
-
return
|
|
8244
|
+
return isExactLocalValueMatch(partialValue, componentValue);
|
|
8190
8245
|
}
|
|
8191
8246
|
if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
|
|
8192
8247
|
return isPartialObjectMatch(partialValue, componentValue, component);
|
|
@@ -8233,25 +8288,7 @@ var getMatchingKeys = (a, b) => {
|
|
|
8233
8288
|
|
|
8234
8289
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
8235
8290
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
8236
|
-
const _a = selectProps, {
|
|
8237
|
-
uid,
|
|
8238
|
-
checks,
|
|
8239
|
-
initialValue,
|
|
8240
|
-
options,
|
|
8241
|
-
performPersistAsync,
|
|
8242
|
-
performRefresh,
|
|
8243
|
-
onValueChange,
|
|
8244
|
-
summariser
|
|
8245
|
-
} = _a, rest = __objRest(_a, [
|
|
8246
|
-
"uid",
|
|
8247
|
-
"checks",
|
|
8248
|
-
"initialValue",
|
|
8249
|
-
"options",
|
|
8250
|
-
"performPersistAsync",
|
|
8251
|
-
"performRefresh",
|
|
8252
|
-
"onValueChange",
|
|
8253
|
-
"summariser"
|
|
8254
|
-
]);
|
|
8291
|
+
const _a = selectProps, { uid, checks, initialValue, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialValue", "options", "performRefresh", "onValueChange", "summariser"]);
|
|
8255
8292
|
const children = options.map((option) => option.component);
|
|
8256
8293
|
const matchingOptions = options.map(
|
|
8257
8294
|
(option) => isPartialLocalValueMatch(selectProps.initialValue, option.component)
|
|
@@ -8266,7 +8303,7 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8266
8303
|
});
|
|
8267
8304
|
return messages;
|
|
8268
8305
|
};
|
|
8269
|
-
|
|
8306
|
+
return __spreadProps(__spreadValues({
|
|
8270
8307
|
uid,
|
|
8271
8308
|
type: "select",
|
|
8272
8309
|
children,
|
|
@@ -8284,6 +8321,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8284
8321
|
var _a2, _b;
|
|
8285
8322
|
return (_b = await ((_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValue())) != null ? _b : null;
|
|
8286
8323
|
},
|
|
8324
|
+
getSubmittableValueSync() {
|
|
8325
|
+
var _a2, _b;
|
|
8326
|
+
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValueSync()) != null ? _b : null;
|
|
8327
|
+
},
|
|
8287
8328
|
getSummary() {
|
|
8288
8329
|
var _a2, _b;
|
|
8289
8330
|
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSummary()) != null ? _b : {};
|
|
@@ -8319,25 +8360,6 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8319
8360
|
return messages.length === 0 && validChild;
|
|
8320
8361
|
}
|
|
8321
8362
|
});
|
|
8322
|
-
if (!performPersistAsync) {
|
|
8323
|
-
return selectComponent;
|
|
8324
|
-
}
|
|
8325
|
-
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8326
|
-
return __spreadProps(__spreadValues({}, selectComponent), {
|
|
8327
|
-
isPersisted: true,
|
|
8328
|
-
onSelect(updatedIndex) {
|
|
8329
|
-
selectComponent.onSelect.call(this, updatedIndex);
|
|
8330
|
-
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
8331
|
-
if (isValid2 && updatedIndex !== null) {
|
|
8332
|
-
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
8333
|
-
});
|
|
8334
|
-
onValueChange();
|
|
8335
|
-
}
|
|
8336
|
-
},
|
|
8337
|
-
async getSubmittableValue() {
|
|
8338
|
-
return persist(this.persistedState, this.getLocalValue());
|
|
8339
|
-
}
|
|
8340
|
-
});
|
|
8341
8363
|
};
|
|
8342
8364
|
var isTrue = (value) => value === true;
|
|
8343
8365
|
|
|
@@ -8378,19 +8400,13 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8378
8400
|
const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
|
|
8379
8401
|
const { default: defaultValue, validationMessages } = schema;
|
|
8380
8402
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8381
|
-
const
|
|
8382
|
-
schemaMapperProps,
|
|
8383
|
-
mapperProps
|
|
8384
|
-
);
|
|
8385
|
-
const initialValue = performPersistAsync ? localValue : (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8403
|
+
const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8386
8404
|
return createSelectInputComponent(
|
|
8387
8405
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8388
8406
|
autoComplete: getAutocompleteString(schema.autocompleteHint),
|
|
8389
8407
|
checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
|
|
8390
8408
|
options,
|
|
8391
8409
|
initialValue,
|
|
8392
|
-
persistedState,
|
|
8393
|
-
performPersistAsync,
|
|
8394
8410
|
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8395
8411
|
onValueChange,
|
|
8396
8412
|
trackEvent
|
|
@@ -8456,6 +8472,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8456
8472
|
onValueChange();
|
|
8457
8473
|
},
|
|
8458
8474
|
async getSubmittableValue() {
|
|
8475
|
+
return this.getSubmittableValueSync();
|
|
8476
|
+
},
|
|
8477
|
+
getSubmittableValueSync() {
|
|
8459
8478
|
var _a2;
|
|
8460
8479
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8461
8480
|
},
|
|
@@ -8476,7 +8495,6 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8476
8495
|
if (performPersistAsync) {
|
|
8477
8496
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8478
8497
|
return __spreadProps(__spreadValues({}, dateInputComponent), {
|
|
8479
|
-
isPersisted: true,
|
|
8480
8498
|
onChange(updatedValue) {
|
|
8481
8499
|
dateInputComponent.onChange.call(this, updatedValue);
|
|
8482
8500
|
const isValid2 = getValidationErrors(updatedValue).length === 0;
|
|
@@ -8487,6 +8505,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8487
8505
|
},
|
|
8488
8506
|
async getSubmittableValue() {
|
|
8489
8507
|
return persist(this.persistedState, this.getLocalValue());
|
|
8508
|
+
},
|
|
8509
|
+
getSubmittableValueSync() {
|
|
8510
|
+
return this.persistedState.lastResponse;
|
|
8490
8511
|
}
|
|
8491
8512
|
});
|
|
8492
8513
|
}
|
|
@@ -8625,6 +8646,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8625
8646
|
const file = this.getLocalValue();
|
|
8626
8647
|
return file ? toBase64(file) : null;
|
|
8627
8648
|
},
|
|
8649
|
+
getSubmittableValueSync() {
|
|
8650
|
+
return null;
|
|
8651
|
+
},
|
|
8628
8652
|
getSummary() {
|
|
8629
8653
|
var _a2, _b;
|
|
8630
8654
|
return summariser((_b = (_a2 = this.getLocalValue()) == null ? void 0 : _a2.name) != null ? _b : null);
|
|
@@ -8643,7 +8667,6 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8643
8667
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8644
8668
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
8645
8669
|
format,
|
|
8646
|
-
isPersisted: true,
|
|
8647
8670
|
async onUpload(file) {
|
|
8648
8671
|
update((draft) => {
|
|
8649
8672
|
draft.errors = [];
|
|
@@ -8653,6 +8676,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8653
8676
|
const submission = format === "base64" && file ? await toBase64(file) : file;
|
|
8654
8677
|
await persist(this.persistedState, submission).catch((error) => {
|
|
8655
8678
|
update((draft) => {
|
|
8679
|
+
draft.persistedState.lastResponse = null;
|
|
8656
8680
|
draft.persistedState.lastSubmitted = null;
|
|
8657
8681
|
draft.persistedState.submission = Promise.resolve(null);
|
|
8658
8682
|
draft.errors = [];
|
|
@@ -8663,6 +8687,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8663
8687
|
},
|
|
8664
8688
|
async getSubmittableValue() {
|
|
8665
8689
|
return this.persistedState.submission;
|
|
8690
|
+
},
|
|
8691
|
+
getSubmittableValueSync() {
|
|
8692
|
+
return this.persistedState.lastResponse;
|
|
8666
8693
|
}
|
|
8667
8694
|
});
|
|
8668
8695
|
};
|
|
@@ -8751,6 +8778,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8751
8778
|
onValueChange();
|
|
8752
8779
|
},
|
|
8753
8780
|
async getSubmittableValue() {
|
|
8781
|
+
return this.getSubmittableValueSync();
|
|
8782
|
+
},
|
|
8783
|
+
getSubmittableValueSync() {
|
|
8754
8784
|
var _a2;
|
|
8755
8785
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8756
8786
|
},
|
|
@@ -8771,7 +8801,6 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8771
8801
|
if (performPersistAsync) {
|
|
8772
8802
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8773
8803
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8774
|
-
isPersisted: true,
|
|
8775
8804
|
onBlur() {
|
|
8776
8805
|
if (this.validate()) {
|
|
8777
8806
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8780,6 +8809,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8780
8809
|
},
|
|
8781
8810
|
async getSubmittableValue() {
|
|
8782
8811
|
return persist(this.persistedState, this.getLocalValue());
|
|
8812
|
+
},
|
|
8813
|
+
getSubmittableValueSync() {
|
|
8814
|
+
return this.persistedState.lastResponse;
|
|
8783
8815
|
}
|
|
8784
8816
|
});
|
|
8785
8817
|
}
|
|
@@ -8873,6 +8905,9 @@ var createContainerComponent = (containerProps) => __spreadProps(__spreadValues(
|
|
|
8873
8905
|
async getSubmittableValue() {
|
|
8874
8906
|
return getSubmittableData(this.components);
|
|
8875
8907
|
},
|
|
8908
|
+
getSubmittableValueSync() {
|
|
8909
|
+
return getSubmittableDataSync(this.components);
|
|
8910
|
+
},
|
|
8876
8911
|
getSummary() {
|
|
8877
8912
|
return summariseFromChildren(this.getChildren());
|
|
8878
8913
|
},
|
|
@@ -8977,6 +9012,9 @@ var createRepeatableComponent = (repeatableProps, updateComponent) => {
|
|
|
8977
9012
|
async getSubmittableValue() {
|
|
8978
9013
|
return Promise.all(this.components.map(async (component) => component.getSubmittableValue()));
|
|
8979
9014
|
},
|
|
9015
|
+
getSubmittableValueSync() {
|
|
9016
|
+
return this.components.map((component) => component.getSubmittableValueSync());
|
|
9017
|
+
},
|
|
8980
9018
|
getSummary() {
|
|
8981
9019
|
return summariser(null);
|
|
8982
9020
|
},
|
|
@@ -9112,6 +9150,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9112
9150
|
const files = this.getLocalValue();
|
|
9113
9151
|
return files ? Promise.all(files.map(toBase64)) : null;
|
|
9114
9152
|
},
|
|
9153
|
+
getSubmittableValueSync() {
|
|
9154
|
+
return null;
|
|
9155
|
+
},
|
|
9115
9156
|
getSummary() {
|
|
9116
9157
|
return summariser(this.getLocalValue().map(({ name }) => name));
|
|
9117
9158
|
},
|
|
@@ -9129,7 +9170,6 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9129
9170
|
const persist = getComponentMultiPersistAsync(update, performPersistAsync);
|
|
9130
9171
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
9131
9172
|
format,
|
|
9132
|
-
isPersisted: true,
|
|
9133
9173
|
async onUpload(file, fileId) {
|
|
9134
9174
|
await uploadComponent.onUpload.call(this, file, fileId);
|
|
9135
9175
|
const submission = format === "blob" ? file : await toBase64(file);
|
|
@@ -9146,6 +9186,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9146
9186
|
},
|
|
9147
9187
|
async getSubmittableValue() {
|
|
9148
9188
|
return Promise.all(this.persistedState.map(async ({ submission }) => submission));
|
|
9189
|
+
},
|
|
9190
|
+
getSubmittableValueSync() {
|
|
9191
|
+
return this.persistedState.map(({ lastResponse }) => lastResponse);
|
|
9149
9192
|
}
|
|
9150
9193
|
});
|
|
9151
9194
|
};
|
|
@@ -9219,7 +9262,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9219
9262
|
checks,
|
|
9220
9263
|
options,
|
|
9221
9264
|
initialValue,
|
|
9222
|
-
performPersistAsync,
|
|
9223
9265
|
performValidationAsync,
|
|
9224
9266
|
performRefresh,
|
|
9225
9267
|
onValueChange
|
|
@@ -9228,7 +9270,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9228
9270
|
"checks",
|
|
9229
9271
|
"options",
|
|
9230
9272
|
"initialValue",
|
|
9231
|
-
"performPersistAsync",
|
|
9232
9273
|
"performValidationAsync",
|
|
9233
9274
|
"performRefresh",
|
|
9234
9275
|
"onValueChange"
|
|
@@ -9282,6 +9323,10 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9282
9323
|
}
|
|
9283
9324
|
return null;
|
|
9284
9325
|
},
|
|
9326
|
+
getSubmittableValueSync() {
|
|
9327
|
+
var _a2, _b;
|
|
9328
|
+
return (_b = (_a2 = this.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getSubmittableValueSync())) != null ? _b : null;
|
|
9329
|
+
},
|
|
9285
9330
|
getSummary: () => ({}),
|
|
9286
9331
|
getChildren() {
|
|
9287
9332
|
return this.children;
|
|
@@ -9293,23 +9338,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9293
9338
|
if (performRefresh) {
|
|
9294
9339
|
return inputComponent;
|
|
9295
9340
|
}
|
|
9296
|
-
if (performPersistAsync) {
|
|
9297
|
-
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
9298
|
-
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
9299
|
-
isPersisted: true,
|
|
9300
|
-
onSelect(indices) {
|
|
9301
|
-
inputComponent.onSelect.call(this, indices);
|
|
9302
|
-
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
9303
|
-
if (isValid2 && indices != null) {
|
|
9304
|
-
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
9305
|
-
});
|
|
9306
|
-
}
|
|
9307
|
-
},
|
|
9308
|
-
async getSubmittableValue() {
|
|
9309
|
-
return persist(this.persistedState, this.getLocalValue());
|
|
9310
|
-
}
|
|
9311
|
-
});
|
|
9312
|
-
}
|
|
9313
9341
|
if (performValidationAsync) {
|
|
9314
9342
|
const validateAsync = getComponentValidationAsync(update, performValidationAsync);
|
|
9315
9343
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
@@ -9367,15 +9395,11 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9367
9395
|
const { title, validationMessages } = schema;
|
|
9368
9396
|
const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
|
|
9369
9397
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
9370
|
-
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
9371
|
-
schemaMapperProps,
|
|
9372
|
-
mapperProps
|
|
9373
|
-
);
|
|
9374
9398
|
const { performValidationAsync, validationState } = getValidationAsyncInitialState(
|
|
9375
9399
|
schemaMapperProps,
|
|
9376
9400
|
mapperProps
|
|
9377
9401
|
);
|
|
9378
|
-
const initialValue =
|
|
9402
|
+
const initialValue = model != null ? model : null;
|
|
9379
9403
|
return createMultiSelectComponent(
|
|
9380
9404
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
9381
9405
|
autoComplete: "off",
|
|
@@ -9387,8 +9411,6 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9387
9411
|
initialValue,
|
|
9388
9412
|
options,
|
|
9389
9413
|
required,
|
|
9390
|
-
persistedState,
|
|
9391
|
-
performPersistAsync,
|
|
9392
9414
|
title,
|
|
9393
9415
|
validationState,
|
|
9394
9416
|
performValidationAsync,
|
|
@@ -9416,7 +9438,10 @@ var createTupleComponent = (tupleProps) => {
|
|
|
9416
9438
|
return this.components;
|
|
9417
9439
|
},
|
|
9418
9440
|
async getSubmittableValue() {
|
|
9419
|
-
return Promise.all(this.components.map((child) => child.getSubmittableValue()));
|
|
9441
|
+
return Promise.all(this.components.map(async (child) => child.getSubmittableValue()));
|
|
9442
|
+
},
|
|
9443
|
+
getSubmittableValueSync() {
|
|
9444
|
+
return this.components.map((child) => child.getSubmittableValueSync());
|
|
9420
9445
|
},
|
|
9421
9446
|
getSummary() {
|
|
9422
9447
|
const summary = summariser(this.getLocalValue());
|
|
@@ -9526,6 +9551,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9526
9551
|
onValueChange();
|
|
9527
9552
|
},
|
|
9528
9553
|
async getSubmittableValue() {
|
|
9554
|
+
return this.getSubmittableValueSync();
|
|
9555
|
+
},
|
|
9556
|
+
getSubmittableValueSync() {
|
|
9529
9557
|
return this.getLocalValue();
|
|
9530
9558
|
},
|
|
9531
9559
|
getSummary() {
|
|
@@ -9542,7 +9570,6 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9542
9570
|
if (performPersistAsync) {
|
|
9543
9571
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
9544
9572
|
return __spreadProps(__spreadValues({}, booleanComponent), {
|
|
9545
|
-
isPersisted: true,
|
|
9546
9573
|
onChange(updatedValue) {
|
|
9547
9574
|
booleanComponent.onChange.call(this, updatedValue);
|
|
9548
9575
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -9550,6 +9577,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9550
9577
|
},
|
|
9551
9578
|
async getSubmittableValue() {
|
|
9552
9579
|
return persist(this.persistedState, this.getLocalValue());
|
|
9580
|
+
},
|
|
9581
|
+
getSubmittableValueSync() {
|
|
9582
|
+
return this.persistedState.lastResponse;
|
|
9553
9583
|
}
|
|
9554
9584
|
});
|
|
9555
9585
|
}
|
|
@@ -9705,6 +9735,9 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
|
|
|
9705
9735
|
async getSubmittableValue() {
|
|
9706
9736
|
return getSubmittableData(this.getChildren());
|
|
9707
9737
|
},
|
|
9738
|
+
getSubmittableValueSync() {
|
|
9739
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9740
|
+
},
|
|
9708
9741
|
getSummary() {
|
|
9709
9742
|
return summariseFromChildren(this.getChildren());
|
|
9710
9743
|
},
|
|
@@ -9750,6 +9783,7 @@ var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
|
|
|
9750
9783
|
type: "heading"
|
|
9751
9784
|
}, headingProps), {
|
|
9752
9785
|
getSubmittableValue: async () => null,
|
|
9786
|
+
getSubmittableValueSync: () => null,
|
|
9753
9787
|
getSummary: () => ({}),
|
|
9754
9788
|
// Noop
|
|
9755
9789
|
getLocalValue: () => null,
|
|
@@ -9771,6 +9805,7 @@ var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
|
|
|
9771
9805
|
type: "image"
|
|
9772
9806
|
}, imageProps), {
|
|
9773
9807
|
getSubmittableValue: async () => null,
|
|
9808
|
+
getSubmittableValueSync: () => null,
|
|
9774
9809
|
getLocalValue: () => null,
|
|
9775
9810
|
getSummary: () => ({}),
|
|
9776
9811
|
// Noop
|
|
@@ -9792,6 +9827,7 @@ var createMarkdownComponent = (markdownProps) => __spreadProps(__spreadValues({
|
|
|
9792
9827
|
type: "markdown"
|
|
9793
9828
|
}, markdownProps), {
|
|
9794
9829
|
getSubmittableValue: async () => null,
|
|
9830
|
+
getSubmittableValueSync: () => null,
|
|
9795
9831
|
getLocalValue: () => null,
|
|
9796
9832
|
getSummary: () => ({}),
|
|
9797
9833
|
validate: () => true
|
|
@@ -9812,6 +9848,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadProps(__spreadV
|
|
|
9812
9848
|
}, instructionsProps), {
|
|
9813
9849
|
getLocalValue: () => null,
|
|
9814
9850
|
getSubmittableValue: async () => null,
|
|
9851
|
+
getSubmittableValueSync: () => null,
|
|
9815
9852
|
getSummary: () => ({}),
|
|
9816
9853
|
// Noop
|
|
9817
9854
|
validate: () => true
|
|
@@ -9834,6 +9871,7 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadProps(_
|
|
|
9834
9871
|
type: "loading-indicator"
|
|
9835
9872
|
}, loadingIndicatorProps), {
|
|
9836
9873
|
getSubmittableValue: async () => null,
|
|
9874
|
+
getSubmittableValueSync: () => null,
|
|
9837
9875
|
getLocalValue: () => null,
|
|
9838
9876
|
getSummary: () => ({}),
|
|
9839
9877
|
// Noop
|
|
@@ -9865,6 +9903,9 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
|
|
|
9865
9903
|
async getSubmittableValue() {
|
|
9866
9904
|
return getSubmittableData(this.getChildren());
|
|
9867
9905
|
},
|
|
9906
|
+
getSubmittableValueSync() {
|
|
9907
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9908
|
+
},
|
|
9868
9909
|
getSummary() {
|
|
9869
9910
|
return summariseFromChildren(this.getChildren());
|
|
9870
9911
|
},
|
|
@@ -9894,6 +9935,7 @@ var createParagraphComponent = (paragraphProps) => __spreadProps(__spreadValues(
|
|
|
9894
9935
|
type: "paragraph"
|
|
9895
9936
|
}, paragraphProps), {
|
|
9896
9937
|
getSubmittableValue: async () => null,
|
|
9938
|
+
getSubmittableValueSync: () => null,
|
|
9897
9939
|
getSummary: () => ({}),
|
|
9898
9940
|
// Noop
|
|
9899
9941
|
getLocalValue: () => null,
|
|
@@ -9915,6 +9957,7 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
9915
9957
|
}, reviewProps), {
|
|
9916
9958
|
getLocalValue: () => null,
|
|
9917
9959
|
getSubmittableValue: async () => null,
|
|
9960
|
+
getSubmittableValueSync: () => null,
|
|
9918
9961
|
getSummary: () => ({}),
|
|
9919
9962
|
// Noop
|
|
9920
9963
|
validate: () => true
|
|
@@ -10025,6 +10068,7 @@ var createSearchComponent = (searchProps, performSearch, onAction, updateCompone
|
|
|
10025
10068
|
query: "",
|
|
10026
10069
|
results: [],
|
|
10027
10070
|
getSubmittableValue: async () => null,
|
|
10071
|
+
getSubmittableValueSync: () => null,
|
|
10028
10072
|
getLocalValue: () => null,
|
|
10029
10073
|
getSummary: () => ({}),
|
|
10030
10074
|
// Noop
|
|
@@ -10100,6 +10144,7 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
|
|
|
10100
10144
|
}, statusListProps), {
|
|
10101
10145
|
getLocalValue: () => null,
|
|
10102
10146
|
getSubmittableValue: async () => null,
|
|
10147
|
+
getSubmittableValueSync: () => null,
|
|
10103
10148
|
getSummary: () => ({}),
|
|
10104
10149
|
// Noop,
|
|
10105
10150
|
validate: () => true
|
|
@@ -14202,6 +14247,7 @@ function useExternal2(url) {
|
|
|
14202
14247
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
14203
14248
|
import { useCallback as useCallback5, useMemo as useMemo11 } from "react";
|
|
14204
14249
|
function useExternalStepPolling(polling, onAction) {
|
|
14250
|
+
var _a, _b;
|
|
14205
14251
|
const httpClient = useHttpClient();
|
|
14206
14252
|
const asyncFn = useMemo11(() => {
|
|
14207
14253
|
if (polling) {
|
|
@@ -14244,7 +14290,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
14244
14290
|
);
|
|
14245
14291
|
usePolling({
|
|
14246
14292
|
asyncFn,
|
|
14247
|
-
|
|
14293
|
+
delay: (_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0,
|
|
14248
14294
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
14249
14295
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
14250
14296
|
onPollingResponse,
|
|
@@ -18373,7 +18419,7 @@ function hasStringMessage(value) {
|
|
|
18373
18419
|
import { useEffect as useEffect19, useMemo as useMemo19, useRef as useRef5 } from "react";
|
|
18374
18420
|
function usePolling({
|
|
18375
18421
|
asyncFn,
|
|
18376
|
-
|
|
18422
|
+
delay,
|
|
18377
18423
|
maxAttempts,
|
|
18378
18424
|
maxConsecutiveFails,
|
|
18379
18425
|
onPollingResponse,
|
|
@@ -18392,13 +18438,14 @@ function usePolling({
|
|
|
18392
18438
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
18393
18439
|
);
|
|
18394
18440
|
useEffect19(() => {
|
|
18395
|
-
if (
|
|
18441
|
+
if (delay > 0) {
|
|
18442
|
+
poll();
|
|
18396
18443
|
const intervalReference = setInterval(() => {
|
|
18397
18444
|
poll();
|
|
18398
|
-
},
|
|
18445
|
+
}, delay);
|
|
18399
18446
|
return () => clearInterval(intervalReference);
|
|
18400
18447
|
}
|
|
18401
|
-
}, [poll,
|
|
18448
|
+
}, [poll, delay]);
|
|
18402
18449
|
useEffect19(() => {
|
|
18403
18450
|
onPollingResponseReference.current = onPollingResponse;
|
|
18404
18451
|
onFailureReference.current = onFailure;
|
|
@@ -18442,6 +18489,7 @@ var usePrevious = (value) => {
|
|
|
18442
18489
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
18443
18490
|
import { useCallback as useCallback8, useMemo as useMemo20 } from "react";
|
|
18444
18491
|
function useStepPolling(polling, onAction) {
|
|
18492
|
+
var _a, _b;
|
|
18445
18493
|
const httpClient = useHttpClient();
|
|
18446
18494
|
const asyncFn = useMemo20(() => {
|
|
18447
18495
|
if (polling) {
|
|
@@ -18468,7 +18516,7 @@ function useStepPolling(polling, onAction) {
|
|
|
18468
18516
|
);
|
|
18469
18517
|
usePolling({
|
|
18470
18518
|
asyncFn,
|
|
18471
|
-
|
|
18519
|
+
delay: 1e3 * ((_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0),
|
|
18472
18520
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
18473
18521
|
maxConsecutiveFails: 1,
|
|
18474
18522
|
onPollingResponse,
|