@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.js
CHANGED
|
@@ -6246,7 +6246,9 @@ var reviewLayoutSchema = z.object({
|
|
|
6246
6246
|
var searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
|
|
6247
6247
|
var pollingSchema = z.object({
|
|
6248
6248
|
url: z.string(),
|
|
6249
|
-
interval: z.number(),
|
|
6249
|
+
interval: z.number().optional(),
|
|
6250
|
+
delay: z.number().optional(),
|
|
6251
|
+
timeout: z.number().optional(),
|
|
6250
6252
|
maxAttempts: z.number(),
|
|
6251
6253
|
onError: pollingOnErrorSchema
|
|
6252
6254
|
});
|
|
@@ -6358,6 +6360,7 @@ var modalLayoutSchema = z.lazy(
|
|
|
6358
6360
|
);
|
|
6359
6361
|
var modalLayoutContentSchema = z.lazy(
|
|
6360
6362
|
() => z.object({
|
|
6363
|
+
title: z.string().optional(),
|
|
6361
6364
|
components: z.array(layoutSchema)
|
|
6362
6365
|
})
|
|
6363
6366
|
);
|
|
@@ -6693,6 +6696,7 @@ var import_react_intl6 = require("react-intl");
|
|
|
6693
6696
|
var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
|
|
6694
6697
|
(values) => values.reduce((acc, value) => mergeModels(acc, value), null)
|
|
6695
6698
|
);
|
|
6699
|
+
var getSubmittableDataSync = (components) => components.map((component) => component.getSubmittableValueSync()).reduce((acc, value) => mergeModels(acc, value), null);
|
|
6696
6700
|
var getLocalValues = (components) => components.map((component) => component.getLocalValue()).reduce((acc, value) => mergeLocalValues(acc, value), null);
|
|
6697
6701
|
var mergeLocalValues = (valueA, valueB) => {
|
|
6698
6702
|
if (valueA === null) {
|
|
@@ -6781,6 +6785,9 @@ var createStepComponent = (stepProps) => {
|
|
|
6781
6785
|
async getSubmittableValue() {
|
|
6782
6786
|
return getSubmittableData(this.components);
|
|
6783
6787
|
},
|
|
6788
|
+
getSubmittableValueSync() {
|
|
6789
|
+
return getSubmittableDataSync(this.components);
|
|
6790
|
+
},
|
|
6784
6791
|
getSummary() {
|
|
6785
6792
|
return summariseFromChildren(this.getChildren());
|
|
6786
6793
|
},
|
|
@@ -6847,8 +6854,11 @@ var getStepPolling = ({
|
|
|
6847
6854
|
pollingConfig,
|
|
6848
6855
|
onAction
|
|
6849
6856
|
}) => {
|
|
6850
|
-
const { interval, maxAttempts, url, onError } = pollingConfig;
|
|
6857
|
+
const { interval, delay = interval, maxAttempts, url, onError } = pollingConfig;
|
|
6851
6858
|
let abortController = new AbortController();
|
|
6859
|
+
if (delay == null) {
|
|
6860
|
+
throw new Error("Polling configuration must include delay or interval");
|
|
6861
|
+
}
|
|
6852
6862
|
const onFailure = () => {
|
|
6853
6863
|
stop();
|
|
6854
6864
|
void onAction(onError.action);
|
|
@@ -6877,10 +6887,11 @@ var getStepPolling = ({
|
|
|
6877
6887
|
onFailure();
|
|
6878
6888
|
}
|
|
6879
6889
|
};
|
|
6880
|
-
|
|
6890
|
+
poll();
|
|
6891
|
+
const intervalRef = setInterval(poll, delay * 1e3);
|
|
6881
6892
|
const stop = () => {
|
|
6882
|
-
abortController.abort();
|
|
6883
6893
|
clearTimeout(intervalRef);
|
|
6894
|
+
abortController.abort();
|
|
6884
6895
|
};
|
|
6885
6896
|
return { stop };
|
|
6886
6897
|
};
|
|
@@ -6890,6 +6901,7 @@ var createAlertComponent = (alertProps) => __spreadProps(__spreadValues({
|
|
|
6890
6901
|
type: "alert"
|
|
6891
6902
|
}, alertProps), {
|
|
6892
6903
|
getSubmittableValue: async () => null,
|
|
6904
|
+
getSubmittableValueSync: () => null,
|
|
6893
6905
|
getLocalValue: () => null,
|
|
6894
6906
|
getSummary: () => ({}),
|
|
6895
6907
|
// Noop
|
|
@@ -6991,6 +7003,9 @@ var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps
|
|
|
6991
7003
|
async getSubmittableValue() {
|
|
6992
7004
|
return getSubmittableData(this.components);
|
|
6993
7005
|
},
|
|
7006
|
+
getSubmittableValueSync() {
|
|
7007
|
+
return getSubmittableDataSync(this.components);
|
|
7008
|
+
},
|
|
6994
7009
|
getSummary() {
|
|
6995
7010
|
return summariseFromChildren(this.getChildren());
|
|
6996
7011
|
},
|
|
@@ -7019,6 +7034,7 @@ var createButtonComponent = (buttonProps) => __spreadProps(__spreadValues({
|
|
|
7019
7034
|
type: "button"
|
|
7020
7035
|
}, buttonProps), {
|
|
7021
7036
|
getSubmittableValue: async () => null,
|
|
7037
|
+
getSubmittableValueSync: () => null,
|
|
7022
7038
|
getLocalValue: () => null,
|
|
7023
7039
|
getSummary: () => ({}),
|
|
7024
7040
|
// Noop
|
|
@@ -7086,6 +7102,9 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
|
|
|
7086
7102
|
async getSubmittableValue() {
|
|
7087
7103
|
return getSubmittableData(this.getChildren());
|
|
7088
7104
|
},
|
|
7105
|
+
getSubmittableValueSync() {
|
|
7106
|
+
return getSubmittableDataSync(this.getChildren());
|
|
7107
|
+
},
|
|
7089
7108
|
getSummary() {
|
|
7090
7109
|
return summariseFromChildren(this.getChildren());
|
|
7091
7110
|
},
|
|
@@ -7116,6 +7135,7 @@ var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
|
|
|
7116
7135
|
type: "decision"
|
|
7117
7136
|
}, decisionProps), {
|
|
7118
7137
|
getSubmittableValue: async () => null,
|
|
7138
|
+
getSubmittableValueSync: () => null,
|
|
7119
7139
|
getLocalValue: () => null,
|
|
7120
7140
|
getSummary: () => ({}),
|
|
7121
7141
|
// Noop
|
|
@@ -7144,6 +7164,7 @@ var createDividerComponent = (props) => __spreadProps(__spreadValues({
|
|
|
7144
7164
|
type: "divider"
|
|
7145
7165
|
}, props), {
|
|
7146
7166
|
getSubmittableValue: async () => null,
|
|
7167
|
+
getSubmittableValueSync: () => null,
|
|
7147
7168
|
getLocalValue: () => null,
|
|
7148
7169
|
getSummary: () => ({}),
|
|
7149
7170
|
// Noop
|
|
@@ -7180,15 +7201,15 @@ var abortAndResetController = (abortController) => {
|
|
|
7180
7201
|
return new AbortController();
|
|
7181
7202
|
};
|
|
7182
7203
|
|
|
7183
|
-
// src/revamp/domain/components/utils/
|
|
7184
|
-
var
|
|
7204
|
+
// src/revamp/domain/components/utils/isExactLocalValueMatch.ts
|
|
7205
|
+
var isExactLocalValueMatch = (valueA, valueB) => {
|
|
7185
7206
|
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7186
|
-
return valueA.length === valueB.length && valueA.every((value, index) =>
|
|
7207
|
+
return valueA.length === valueB.length && valueA.every((value, index) => isExactLocalValueMatch(value, valueB[index]));
|
|
7187
7208
|
}
|
|
7188
7209
|
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7189
7210
|
const keysA = Object.keys(valueA);
|
|
7190
7211
|
const keysB = Object.keys(valueB);
|
|
7191
|
-
return keysA.length === keysB.length && keysA.every((key) =>
|
|
7212
|
+
return keysA.length === keysB.length && keysA.every((key) => isExactLocalValueMatch(valueA[key], valueB[key]));
|
|
7192
7213
|
}
|
|
7193
7214
|
return valueA === valueB;
|
|
7194
7215
|
};
|
|
@@ -7201,7 +7222,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7201
7222
|
*/
|
|
7202
7223
|
async (persistedState, currentValue) => {
|
|
7203
7224
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
7204
|
-
if (
|
|
7225
|
+
if (isExactLocalValueMatch(lastSubmitted, currentValue)) {
|
|
7205
7226
|
return submission;
|
|
7206
7227
|
}
|
|
7207
7228
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7209,27 +7230,33 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7209
7230
|
const resolvedNull = Promise.resolve(null);
|
|
7210
7231
|
update((draft) => {
|
|
7211
7232
|
draft.persistedState.abortController = newAbortController;
|
|
7233
|
+
draft.persistedState.lastResponse = null;
|
|
7212
7234
|
draft.persistedState.lastSubmitted = currentValue;
|
|
7213
7235
|
draft.persistedState.submission = resolvedNull;
|
|
7214
7236
|
});
|
|
7215
7237
|
return resolvedNull;
|
|
7216
7238
|
}
|
|
7217
7239
|
const { signal } = newAbortController;
|
|
7218
|
-
const newSubmission = performPersistAsync({ value: currentValue, signal }).
|
|
7219
|
-
(
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
});
|
|
7227
|
-
throw error;
|
|
7240
|
+
const newSubmission = performPersistAsync({ value: currentValue, signal }).then((newValue) => {
|
|
7241
|
+
update((draft) => {
|
|
7242
|
+
draft.persistedState.lastResponse = newValue;
|
|
7243
|
+
});
|
|
7244
|
+
return newValue;
|
|
7245
|
+
}).catch((error) => {
|
|
7246
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
7247
|
+
return null;
|
|
7228
7248
|
}
|
|
7229
|
-
|
|
7249
|
+
update((draft) => {
|
|
7250
|
+
draft.errors = [error.message];
|
|
7251
|
+
draft.persistedState.lastResponse = null;
|
|
7252
|
+
draft.persistedState.lastSubmitted = null;
|
|
7253
|
+
});
|
|
7254
|
+
throw error;
|
|
7255
|
+
});
|
|
7230
7256
|
update((draft) => {
|
|
7231
7257
|
draft.persistedState = {
|
|
7232
7258
|
abortController: newAbortController,
|
|
7259
|
+
lastResponse: null,
|
|
7233
7260
|
lastSubmitted: currentValue,
|
|
7234
7261
|
submission: newSubmission
|
|
7235
7262
|
};
|
|
@@ -7248,7 +7275,13 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7248
7275
|
}
|
|
7249
7276
|
const newAbortController = new AbortController();
|
|
7250
7277
|
const { signal } = newAbortController;
|
|
7251
|
-
const newSubmission = performPersistAsync({ value, signal }).
|
|
7278
|
+
const newSubmission = performPersistAsync({ value, signal }).then((newValue) => {
|
|
7279
|
+
update((draft) => {
|
|
7280
|
+
const index = draft.persistedState.findIndex((state) => state.id === id);
|
|
7281
|
+
draft.persistedState[index].lastResponse = newValue;
|
|
7282
|
+
});
|
|
7283
|
+
return newValue;
|
|
7284
|
+
}).catch((error) => {
|
|
7252
7285
|
update((draft) => {
|
|
7253
7286
|
draft.persistedState = draft.persistedState.filter((state) => state.id !== id);
|
|
7254
7287
|
});
|
|
@@ -7260,6 +7293,7 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7260
7293
|
{
|
|
7261
7294
|
id,
|
|
7262
7295
|
abortController: newAbortController,
|
|
7296
|
+
lastResponse: null,
|
|
7263
7297
|
lastSubmitted: null,
|
|
7264
7298
|
submission: newSubmission
|
|
7265
7299
|
}
|
|
@@ -7420,6 +7454,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7420
7454
|
onValueChange();
|
|
7421
7455
|
},
|
|
7422
7456
|
async getSubmittableValue() {
|
|
7457
|
+
return this.getSubmittableValueSync();
|
|
7458
|
+
},
|
|
7459
|
+
getSubmittableValueSync() {
|
|
7423
7460
|
var _a2;
|
|
7424
7461
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
7425
7462
|
},
|
|
@@ -7440,7 +7477,6 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7440
7477
|
if (performPersistAsync) {
|
|
7441
7478
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
7442
7479
|
return __spreadProps(__spreadValues({}, numberComponent), {
|
|
7443
|
-
isPersisted: true,
|
|
7444
7480
|
onBlur() {
|
|
7445
7481
|
if (this.validate()) {
|
|
7446
7482
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -7449,6 +7485,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7449
7485
|
},
|
|
7450
7486
|
async getSubmittableValue() {
|
|
7451
7487
|
return persist(this.persistedState, this.getLocalValue());
|
|
7488
|
+
},
|
|
7489
|
+
getSubmittableValueSync() {
|
|
7490
|
+
return this.persistedState.lastResponse;
|
|
7452
7491
|
}
|
|
7453
7492
|
});
|
|
7454
7493
|
}
|
|
@@ -7684,6 +7723,7 @@ var getValidationError = (param, response) => {
|
|
|
7684
7723
|
var getInitialPersistedState = (lastSubmitted, model) => ({
|
|
7685
7724
|
abortController: new AbortController(),
|
|
7686
7725
|
lastSubmitted: !isNullish(model) ? lastSubmitted != null ? lastSubmitted : null : null,
|
|
7726
|
+
lastResponse: model != null ? model : null,
|
|
7687
7727
|
submission: Promise.resolve(model != null ? model : null)
|
|
7688
7728
|
});
|
|
7689
7729
|
|
|
@@ -7893,6 +7933,12 @@ var createObjectComponent = (objectProps) => {
|
|
|
7893
7933
|
)
|
|
7894
7934
|
);
|
|
7895
7935
|
},
|
|
7936
|
+
getSubmittableValueSync() {
|
|
7937
|
+
return mergeChildrenValues(
|
|
7938
|
+
displayOrder,
|
|
7939
|
+
(propName) => this.componentMap[propName].getSubmittableValueSync()
|
|
7940
|
+
);
|
|
7941
|
+
},
|
|
7896
7942
|
getSummary() {
|
|
7897
7943
|
const summary = summariser(this.getLocalValue());
|
|
7898
7944
|
const childSummary = summariseFromChildren(this.getChildren());
|
|
@@ -7989,6 +8035,9 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
7989
8035
|
async getSubmittableValue() {
|
|
7990
8036
|
return getSubmittableData(this.components);
|
|
7991
8037
|
},
|
|
8038
|
+
getSubmittableValueSync() {
|
|
8039
|
+
return getSubmittableDataSync(this.components);
|
|
8040
|
+
},
|
|
7992
8041
|
getLocalValue() {
|
|
7993
8042
|
return getLocalValues(this.components);
|
|
7994
8043
|
},
|
|
@@ -8029,6 +8078,7 @@ var createConstComponent = (hiddenProps) => {
|
|
|
8029
8078
|
analyticsId,
|
|
8030
8079
|
getLocalValue: () => value,
|
|
8031
8080
|
getSubmittableValue: async () => value,
|
|
8081
|
+
getSubmittableValueSync: () => value,
|
|
8032
8082
|
getSummary: () => summary,
|
|
8033
8083
|
validate: () => true
|
|
8034
8084
|
};
|
|
@@ -8103,6 +8153,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8103
8153
|
onValueChange();
|
|
8104
8154
|
},
|
|
8105
8155
|
async getSubmittableValue() {
|
|
8156
|
+
return this.getSubmittableValueSync();
|
|
8157
|
+
},
|
|
8158
|
+
getSubmittableValueSync() {
|
|
8106
8159
|
var _a2;
|
|
8107
8160
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8108
8161
|
},
|
|
@@ -8123,7 +8176,6 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8123
8176
|
if (performPersistAsync) {
|
|
8124
8177
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8125
8178
|
return __spreadProps(__spreadValues({}, integerComponent), {
|
|
8126
|
-
isPersisted: true,
|
|
8127
8179
|
onBlur() {
|
|
8128
8180
|
if (this.validate()) {
|
|
8129
8181
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8132,6 +8184,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8132
8184
|
},
|
|
8133
8185
|
async getSubmittableValue() {
|
|
8134
8186
|
return persist(this.persistedState, this.getLocalValue());
|
|
8187
|
+
},
|
|
8188
|
+
getSubmittableValueSync() {
|
|
8189
|
+
return this.persistedState.lastResponse;
|
|
8135
8190
|
}
|
|
8136
8191
|
});
|
|
8137
8192
|
}
|
|
@@ -8210,7 +8265,7 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
8210
8265
|
}
|
|
8211
8266
|
const componentValue = component.getLocalValue();
|
|
8212
8267
|
if (component.type === "const") {
|
|
8213
|
-
return
|
|
8268
|
+
return isExactLocalValueMatch(partialValue, componentValue);
|
|
8214
8269
|
}
|
|
8215
8270
|
if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
|
|
8216
8271
|
return isPartialObjectMatch(partialValue, componentValue, component);
|
|
@@ -8257,25 +8312,7 @@ var getMatchingKeys = (a, b) => {
|
|
|
8257
8312
|
|
|
8258
8313
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
8259
8314
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
8260
|
-
const _a = selectProps, {
|
|
8261
|
-
uid,
|
|
8262
|
-
checks,
|
|
8263
|
-
initialValue,
|
|
8264
|
-
options,
|
|
8265
|
-
performPersistAsync,
|
|
8266
|
-
performRefresh,
|
|
8267
|
-
onValueChange,
|
|
8268
|
-
summariser
|
|
8269
|
-
} = _a, rest = __objRest(_a, [
|
|
8270
|
-
"uid",
|
|
8271
|
-
"checks",
|
|
8272
|
-
"initialValue",
|
|
8273
|
-
"options",
|
|
8274
|
-
"performPersistAsync",
|
|
8275
|
-
"performRefresh",
|
|
8276
|
-
"onValueChange",
|
|
8277
|
-
"summariser"
|
|
8278
|
-
]);
|
|
8315
|
+
const _a = selectProps, { uid, checks, initialValue, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialValue", "options", "performRefresh", "onValueChange", "summariser"]);
|
|
8279
8316
|
const children = options.map((option) => option.component);
|
|
8280
8317
|
const matchingOptions = options.map(
|
|
8281
8318
|
(option) => isPartialLocalValueMatch(selectProps.initialValue, option.component)
|
|
@@ -8290,7 +8327,7 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8290
8327
|
});
|
|
8291
8328
|
return messages;
|
|
8292
8329
|
};
|
|
8293
|
-
|
|
8330
|
+
return __spreadProps(__spreadValues({
|
|
8294
8331
|
uid,
|
|
8295
8332
|
type: "select",
|
|
8296
8333
|
children,
|
|
@@ -8308,6 +8345,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8308
8345
|
var _a2, _b;
|
|
8309
8346
|
return (_b = await ((_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValue())) != null ? _b : null;
|
|
8310
8347
|
},
|
|
8348
|
+
getSubmittableValueSync() {
|
|
8349
|
+
var _a2, _b;
|
|
8350
|
+
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValueSync()) != null ? _b : null;
|
|
8351
|
+
},
|
|
8311
8352
|
getSummary() {
|
|
8312
8353
|
var _a2, _b;
|
|
8313
8354
|
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSummary()) != null ? _b : {};
|
|
@@ -8343,25 +8384,6 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8343
8384
|
return messages.length === 0 && validChild;
|
|
8344
8385
|
}
|
|
8345
8386
|
});
|
|
8346
|
-
if (!performPersistAsync) {
|
|
8347
|
-
return selectComponent;
|
|
8348
|
-
}
|
|
8349
|
-
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8350
|
-
return __spreadProps(__spreadValues({}, selectComponent), {
|
|
8351
|
-
isPersisted: true,
|
|
8352
|
-
onSelect(updatedIndex) {
|
|
8353
|
-
selectComponent.onSelect.call(this, updatedIndex);
|
|
8354
|
-
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
8355
|
-
if (isValid2 && updatedIndex !== null) {
|
|
8356
|
-
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
8357
|
-
});
|
|
8358
|
-
onValueChange();
|
|
8359
|
-
}
|
|
8360
|
-
},
|
|
8361
|
-
async getSubmittableValue() {
|
|
8362
|
-
return persist(this.persistedState, this.getLocalValue());
|
|
8363
|
-
}
|
|
8364
|
-
});
|
|
8365
8387
|
};
|
|
8366
8388
|
var isTrue = (value) => value === true;
|
|
8367
8389
|
|
|
@@ -8402,19 +8424,13 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8402
8424
|
const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
|
|
8403
8425
|
const { default: defaultValue, validationMessages } = schema;
|
|
8404
8426
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8405
|
-
const
|
|
8406
|
-
schemaMapperProps,
|
|
8407
|
-
mapperProps
|
|
8408
|
-
);
|
|
8409
|
-
const initialValue = performPersistAsync ? localValue : (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8427
|
+
const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8410
8428
|
return createSelectInputComponent(
|
|
8411
8429
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8412
8430
|
autoComplete: getAutocompleteString(schema.autocompleteHint),
|
|
8413
8431
|
checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
|
|
8414
8432
|
options,
|
|
8415
8433
|
initialValue,
|
|
8416
|
-
persistedState,
|
|
8417
|
-
performPersistAsync,
|
|
8418
8434
|
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8419
8435
|
onValueChange,
|
|
8420
8436
|
trackEvent
|
|
@@ -8480,6 +8496,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8480
8496
|
onValueChange();
|
|
8481
8497
|
},
|
|
8482
8498
|
async getSubmittableValue() {
|
|
8499
|
+
return this.getSubmittableValueSync();
|
|
8500
|
+
},
|
|
8501
|
+
getSubmittableValueSync() {
|
|
8483
8502
|
var _a2;
|
|
8484
8503
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8485
8504
|
},
|
|
@@ -8500,7 +8519,6 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8500
8519
|
if (performPersistAsync) {
|
|
8501
8520
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8502
8521
|
return __spreadProps(__spreadValues({}, dateInputComponent), {
|
|
8503
|
-
isPersisted: true,
|
|
8504
8522
|
onChange(updatedValue) {
|
|
8505
8523
|
dateInputComponent.onChange.call(this, updatedValue);
|
|
8506
8524
|
const isValid2 = getValidationErrors(updatedValue).length === 0;
|
|
@@ -8511,6 +8529,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8511
8529
|
},
|
|
8512
8530
|
async getSubmittableValue() {
|
|
8513
8531
|
return persist(this.persistedState, this.getLocalValue());
|
|
8532
|
+
},
|
|
8533
|
+
getSubmittableValueSync() {
|
|
8534
|
+
return this.persistedState.lastResponse;
|
|
8514
8535
|
}
|
|
8515
8536
|
});
|
|
8516
8537
|
}
|
|
@@ -8649,6 +8670,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8649
8670
|
const file = this.getLocalValue();
|
|
8650
8671
|
return file ? toBase64(file) : null;
|
|
8651
8672
|
},
|
|
8673
|
+
getSubmittableValueSync() {
|
|
8674
|
+
return null;
|
|
8675
|
+
},
|
|
8652
8676
|
getSummary() {
|
|
8653
8677
|
var _a2, _b;
|
|
8654
8678
|
return summariser((_b = (_a2 = this.getLocalValue()) == null ? void 0 : _a2.name) != null ? _b : null);
|
|
@@ -8667,7 +8691,6 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8667
8691
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8668
8692
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
8669
8693
|
format,
|
|
8670
|
-
isPersisted: true,
|
|
8671
8694
|
async onUpload(file) {
|
|
8672
8695
|
update((draft) => {
|
|
8673
8696
|
draft.errors = [];
|
|
@@ -8677,6 +8700,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8677
8700
|
const submission = format === "base64" && file ? await toBase64(file) : file;
|
|
8678
8701
|
await persist(this.persistedState, submission).catch((error) => {
|
|
8679
8702
|
update((draft) => {
|
|
8703
|
+
draft.persistedState.lastResponse = null;
|
|
8680
8704
|
draft.persistedState.lastSubmitted = null;
|
|
8681
8705
|
draft.persistedState.submission = Promise.resolve(null);
|
|
8682
8706
|
draft.errors = [];
|
|
@@ -8687,6 +8711,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8687
8711
|
},
|
|
8688
8712
|
async getSubmittableValue() {
|
|
8689
8713
|
return this.persistedState.submission;
|
|
8714
|
+
},
|
|
8715
|
+
getSubmittableValueSync() {
|
|
8716
|
+
return this.persistedState.lastResponse;
|
|
8690
8717
|
}
|
|
8691
8718
|
});
|
|
8692
8719
|
};
|
|
@@ -8775,6 +8802,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8775
8802
|
onValueChange();
|
|
8776
8803
|
},
|
|
8777
8804
|
async getSubmittableValue() {
|
|
8805
|
+
return this.getSubmittableValueSync();
|
|
8806
|
+
},
|
|
8807
|
+
getSubmittableValueSync() {
|
|
8778
8808
|
var _a2;
|
|
8779
8809
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8780
8810
|
},
|
|
@@ -8795,7 +8825,6 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8795
8825
|
if (performPersistAsync) {
|
|
8796
8826
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8797
8827
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8798
|
-
isPersisted: true,
|
|
8799
8828
|
onBlur() {
|
|
8800
8829
|
if (this.validate()) {
|
|
8801
8830
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8804,6 +8833,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8804
8833
|
},
|
|
8805
8834
|
async getSubmittableValue() {
|
|
8806
8835
|
return persist(this.persistedState, this.getLocalValue());
|
|
8836
|
+
},
|
|
8837
|
+
getSubmittableValueSync() {
|
|
8838
|
+
return this.persistedState.lastResponse;
|
|
8807
8839
|
}
|
|
8808
8840
|
});
|
|
8809
8841
|
}
|
|
@@ -8897,6 +8929,9 @@ var createContainerComponent = (containerProps) => __spreadProps(__spreadValues(
|
|
|
8897
8929
|
async getSubmittableValue() {
|
|
8898
8930
|
return getSubmittableData(this.components);
|
|
8899
8931
|
},
|
|
8932
|
+
getSubmittableValueSync() {
|
|
8933
|
+
return getSubmittableDataSync(this.components);
|
|
8934
|
+
},
|
|
8900
8935
|
getSummary() {
|
|
8901
8936
|
return summariseFromChildren(this.getChildren());
|
|
8902
8937
|
},
|
|
@@ -9001,6 +9036,9 @@ var createRepeatableComponent = (repeatableProps, updateComponent) => {
|
|
|
9001
9036
|
async getSubmittableValue() {
|
|
9002
9037
|
return Promise.all(this.components.map(async (component) => component.getSubmittableValue()));
|
|
9003
9038
|
},
|
|
9039
|
+
getSubmittableValueSync() {
|
|
9040
|
+
return this.components.map((component) => component.getSubmittableValueSync());
|
|
9041
|
+
},
|
|
9004
9042
|
getSummary() {
|
|
9005
9043
|
return summariser(null);
|
|
9006
9044
|
},
|
|
@@ -9136,6 +9174,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9136
9174
|
const files = this.getLocalValue();
|
|
9137
9175
|
return files ? Promise.all(files.map(toBase64)) : null;
|
|
9138
9176
|
},
|
|
9177
|
+
getSubmittableValueSync() {
|
|
9178
|
+
return null;
|
|
9179
|
+
},
|
|
9139
9180
|
getSummary() {
|
|
9140
9181
|
return summariser(this.getLocalValue().map(({ name }) => name));
|
|
9141
9182
|
},
|
|
@@ -9153,7 +9194,6 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9153
9194
|
const persist = getComponentMultiPersistAsync(update, performPersistAsync);
|
|
9154
9195
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
9155
9196
|
format,
|
|
9156
|
-
isPersisted: true,
|
|
9157
9197
|
async onUpload(file, fileId) {
|
|
9158
9198
|
await uploadComponent.onUpload.call(this, file, fileId);
|
|
9159
9199
|
const submission = format === "blob" ? file : await toBase64(file);
|
|
@@ -9170,6 +9210,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9170
9210
|
},
|
|
9171
9211
|
async getSubmittableValue() {
|
|
9172
9212
|
return Promise.all(this.persistedState.map(async ({ submission }) => submission));
|
|
9213
|
+
},
|
|
9214
|
+
getSubmittableValueSync() {
|
|
9215
|
+
return this.persistedState.map(({ lastResponse }) => lastResponse);
|
|
9173
9216
|
}
|
|
9174
9217
|
});
|
|
9175
9218
|
};
|
|
@@ -9243,7 +9286,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9243
9286
|
checks,
|
|
9244
9287
|
options,
|
|
9245
9288
|
initialValue,
|
|
9246
|
-
performPersistAsync,
|
|
9247
9289
|
performValidationAsync,
|
|
9248
9290
|
performRefresh,
|
|
9249
9291
|
onValueChange
|
|
@@ -9252,7 +9294,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9252
9294
|
"checks",
|
|
9253
9295
|
"options",
|
|
9254
9296
|
"initialValue",
|
|
9255
|
-
"performPersistAsync",
|
|
9256
9297
|
"performValidationAsync",
|
|
9257
9298
|
"performRefresh",
|
|
9258
9299
|
"onValueChange"
|
|
@@ -9306,6 +9347,10 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9306
9347
|
}
|
|
9307
9348
|
return null;
|
|
9308
9349
|
},
|
|
9350
|
+
getSubmittableValueSync() {
|
|
9351
|
+
var _a2, _b;
|
|
9352
|
+
return (_b = (_a2 = this.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getSubmittableValueSync())) != null ? _b : null;
|
|
9353
|
+
},
|
|
9309
9354
|
getSummary: () => ({}),
|
|
9310
9355
|
getChildren() {
|
|
9311
9356
|
return this.children;
|
|
@@ -9317,23 +9362,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9317
9362
|
if (performRefresh) {
|
|
9318
9363
|
return inputComponent;
|
|
9319
9364
|
}
|
|
9320
|
-
if (performPersistAsync) {
|
|
9321
|
-
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
9322
|
-
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
9323
|
-
isPersisted: true,
|
|
9324
|
-
onSelect(indices) {
|
|
9325
|
-
inputComponent.onSelect.call(this, indices);
|
|
9326
|
-
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
9327
|
-
if (isValid2 && indices != null) {
|
|
9328
|
-
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
9329
|
-
});
|
|
9330
|
-
}
|
|
9331
|
-
},
|
|
9332
|
-
async getSubmittableValue() {
|
|
9333
|
-
return persist(this.persistedState, this.getLocalValue());
|
|
9334
|
-
}
|
|
9335
|
-
});
|
|
9336
|
-
}
|
|
9337
9365
|
if (performValidationAsync) {
|
|
9338
9366
|
const validateAsync = getComponentValidationAsync(update, performValidationAsync);
|
|
9339
9367
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
@@ -9391,15 +9419,11 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9391
9419
|
const { title, validationMessages } = schema;
|
|
9392
9420
|
const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
|
|
9393
9421
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
9394
|
-
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
9395
|
-
schemaMapperProps,
|
|
9396
|
-
mapperProps
|
|
9397
|
-
);
|
|
9398
9422
|
const { performValidationAsync, validationState } = getValidationAsyncInitialState(
|
|
9399
9423
|
schemaMapperProps,
|
|
9400
9424
|
mapperProps
|
|
9401
9425
|
);
|
|
9402
|
-
const initialValue =
|
|
9426
|
+
const initialValue = model != null ? model : null;
|
|
9403
9427
|
return createMultiSelectComponent(
|
|
9404
9428
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
9405
9429
|
autoComplete: "off",
|
|
@@ -9411,8 +9435,6 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9411
9435
|
initialValue,
|
|
9412
9436
|
options,
|
|
9413
9437
|
required,
|
|
9414
|
-
persistedState,
|
|
9415
|
-
performPersistAsync,
|
|
9416
9438
|
title,
|
|
9417
9439
|
validationState,
|
|
9418
9440
|
performValidationAsync,
|
|
@@ -9440,7 +9462,10 @@ var createTupleComponent = (tupleProps) => {
|
|
|
9440
9462
|
return this.components;
|
|
9441
9463
|
},
|
|
9442
9464
|
async getSubmittableValue() {
|
|
9443
|
-
return Promise.all(this.components.map((child) => child.getSubmittableValue()));
|
|
9465
|
+
return Promise.all(this.components.map(async (child) => child.getSubmittableValue()));
|
|
9466
|
+
},
|
|
9467
|
+
getSubmittableValueSync() {
|
|
9468
|
+
return this.components.map((child) => child.getSubmittableValueSync());
|
|
9444
9469
|
},
|
|
9445
9470
|
getSummary() {
|
|
9446
9471
|
const summary = summariser(this.getLocalValue());
|
|
@@ -9550,6 +9575,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9550
9575
|
onValueChange();
|
|
9551
9576
|
},
|
|
9552
9577
|
async getSubmittableValue() {
|
|
9578
|
+
return this.getSubmittableValueSync();
|
|
9579
|
+
},
|
|
9580
|
+
getSubmittableValueSync() {
|
|
9553
9581
|
return this.getLocalValue();
|
|
9554
9582
|
},
|
|
9555
9583
|
getSummary() {
|
|
@@ -9566,7 +9594,6 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9566
9594
|
if (performPersistAsync) {
|
|
9567
9595
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
9568
9596
|
return __spreadProps(__spreadValues({}, booleanComponent), {
|
|
9569
|
-
isPersisted: true,
|
|
9570
9597
|
onChange(updatedValue) {
|
|
9571
9598
|
booleanComponent.onChange.call(this, updatedValue);
|
|
9572
9599
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -9574,6 +9601,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9574
9601
|
},
|
|
9575
9602
|
async getSubmittableValue() {
|
|
9576
9603
|
return persist(this.persistedState, this.getLocalValue());
|
|
9604
|
+
},
|
|
9605
|
+
getSubmittableValueSync() {
|
|
9606
|
+
return this.persistedState.lastResponse;
|
|
9577
9607
|
}
|
|
9578
9608
|
});
|
|
9579
9609
|
}
|
|
@@ -9729,6 +9759,9 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
|
|
|
9729
9759
|
async getSubmittableValue() {
|
|
9730
9760
|
return getSubmittableData(this.getChildren());
|
|
9731
9761
|
},
|
|
9762
|
+
getSubmittableValueSync() {
|
|
9763
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9764
|
+
},
|
|
9732
9765
|
getSummary() {
|
|
9733
9766
|
return summariseFromChildren(this.getChildren());
|
|
9734
9767
|
},
|
|
@@ -9774,6 +9807,7 @@ var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
|
|
|
9774
9807
|
type: "heading"
|
|
9775
9808
|
}, headingProps), {
|
|
9776
9809
|
getSubmittableValue: async () => null,
|
|
9810
|
+
getSubmittableValueSync: () => null,
|
|
9777
9811
|
getSummary: () => ({}),
|
|
9778
9812
|
// Noop
|
|
9779
9813
|
getLocalValue: () => null,
|
|
@@ -9795,6 +9829,7 @@ var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
|
|
|
9795
9829
|
type: "image"
|
|
9796
9830
|
}, imageProps), {
|
|
9797
9831
|
getSubmittableValue: async () => null,
|
|
9832
|
+
getSubmittableValueSync: () => null,
|
|
9798
9833
|
getLocalValue: () => null,
|
|
9799
9834
|
getSummary: () => ({}),
|
|
9800
9835
|
// Noop
|
|
@@ -9816,6 +9851,7 @@ var createMarkdownComponent = (markdownProps) => __spreadProps(__spreadValues({
|
|
|
9816
9851
|
type: "markdown"
|
|
9817
9852
|
}, markdownProps), {
|
|
9818
9853
|
getSubmittableValue: async () => null,
|
|
9854
|
+
getSubmittableValueSync: () => null,
|
|
9819
9855
|
getLocalValue: () => null,
|
|
9820
9856
|
getSummary: () => ({}),
|
|
9821
9857
|
validate: () => true
|
|
@@ -9836,6 +9872,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadProps(__spreadV
|
|
|
9836
9872
|
}, instructionsProps), {
|
|
9837
9873
|
getLocalValue: () => null,
|
|
9838
9874
|
getSubmittableValue: async () => null,
|
|
9875
|
+
getSubmittableValueSync: () => null,
|
|
9839
9876
|
getSummary: () => ({}),
|
|
9840
9877
|
// Noop
|
|
9841
9878
|
validate: () => true
|
|
@@ -9858,6 +9895,7 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadProps(_
|
|
|
9858
9895
|
type: "loading-indicator"
|
|
9859
9896
|
}, loadingIndicatorProps), {
|
|
9860
9897
|
getSubmittableValue: async () => null,
|
|
9898
|
+
getSubmittableValueSync: () => null,
|
|
9861
9899
|
getLocalValue: () => null,
|
|
9862
9900
|
getSummary: () => ({}),
|
|
9863
9901
|
// Noop
|
|
@@ -9889,6 +9927,9 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
|
|
|
9889
9927
|
async getSubmittableValue() {
|
|
9890
9928
|
return getSubmittableData(this.getChildren());
|
|
9891
9929
|
},
|
|
9930
|
+
getSubmittableValueSync() {
|
|
9931
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9932
|
+
},
|
|
9892
9933
|
getSummary() {
|
|
9893
9934
|
return summariseFromChildren(this.getChildren());
|
|
9894
9935
|
},
|
|
@@ -9918,6 +9959,7 @@ var createParagraphComponent = (paragraphProps) => __spreadProps(__spreadValues(
|
|
|
9918
9959
|
type: "paragraph"
|
|
9919
9960
|
}, paragraphProps), {
|
|
9920
9961
|
getSubmittableValue: async () => null,
|
|
9962
|
+
getSubmittableValueSync: () => null,
|
|
9921
9963
|
getSummary: () => ({}),
|
|
9922
9964
|
// Noop
|
|
9923
9965
|
getLocalValue: () => null,
|
|
@@ -9939,6 +9981,7 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
9939
9981
|
}, reviewProps), {
|
|
9940
9982
|
getLocalValue: () => null,
|
|
9941
9983
|
getSubmittableValue: async () => null,
|
|
9984
|
+
getSubmittableValueSync: () => null,
|
|
9942
9985
|
getSummary: () => ({}),
|
|
9943
9986
|
// Noop
|
|
9944
9987
|
validate: () => true
|
|
@@ -10049,6 +10092,7 @@ var createSearchComponent = (searchProps, performSearch, onAction, updateCompone
|
|
|
10049
10092
|
query: "",
|
|
10050
10093
|
results: [],
|
|
10051
10094
|
getSubmittableValue: async () => null,
|
|
10095
|
+
getSubmittableValueSync: () => null,
|
|
10052
10096
|
getLocalValue: () => null,
|
|
10053
10097
|
getSummary: () => ({}),
|
|
10054
10098
|
// Noop
|
|
@@ -10124,6 +10168,7 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
|
|
|
10124
10168
|
}, statusListProps), {
|
|
10125
10169
|
getLocalValue: () => null,
|
|
10126
10170
|
getSubmittableValue: async () => null,
|
|
10171
|
+
getSubmittableValueSync: () => null,
|
|
10127
10172
|
getSummary: () => ({}),
|
|
10128
10173
|
// Noop,
|
|
10129
10174
|
validate: () => true
|
|
@@ -14220,6 +14265,7 @@ function useExternal2(url) {
|
|
|
14220
14265
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
14221
14266
|
var import_react31 = require("react");
|
|
14222
14267
|
function useExternalStepPolling(polling, onAction) {
|
|
14268
|
+
var _a, _b;
|
|
14223
14269
|
const httpClient = useHttpClient();
|
|
14224
14270
|
const asyncFn = (0, import_react31.useMemo)(() => {
|
|
14225
14271
|
if (polling) {
|
|
@@ -14262,7 +14308,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
14262
14308
|
);
|
|
14263
14309
|
usePolling({
|
|
14264
14310
|
asyncFn,
|
|
14265
|
-
|
|
14311
|
+
delay: (_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0,
|
|
14266
14312
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
14267
14313
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
14268
14314
|
onPollingResponse,
|
|
@@ -18376,7 +18422,7 @@ function hasStringMessage(value) {
|
|
|
18376
18422
|
var import_react56 = require("react");
|
|
18377
18423
|
function usePolling({
|
|
18378
18424
|
asyncFn,
|
|
18379
|
-
|
|
18425
|
+
delay,
|
|
18380
18426
|
maxAttempts,
|
|
18381
18427
|
maxConsecutiveFails,
|
|
18382
18428
|
onPollingResponse,
|
|
@@ -18395,13 +18441,14 @@ function usePolling({
|
|
|
18395
18441
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
18396
18442
|
);
|
|
18397
18443
|
(0, import_react56.useEffect)(() => {
|
|
18398
|
-
if (
|
|
18444
|
+
if (delay > 0) {
|
|
18445
|
+
poll();
|
|
18399
18446
|
const intervalReference = setInterval(() => {
|
|
18400
18447
|
poll();
|
|
18401
|
-
},
|
|
18448
|
+
}, delay);
|
|
18402
18449
|
return () => clearInterval(intervalReference);
|
|
18403
18450
|
}
|
|
18404
|
-
}, [poll,
|
|
18451
|
+
}, [poll, delay]);
|
|
18405
18452
|
(0, import_react56.useEffect)(() => {
|
|
18406
18453
|
onPollingResponseReference.current = onPollingResponse;
|
|
18407
18454
|
onFailureReference.current = onFailure;
|
|
@@ -18445,6 +18492,7 @@ var usePrevious = (value) => {
|
|
|
18445
18492
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
18446
18493
|
var import_react58 = require("react");
|
|
18447
18494
|
function useStepPolling(polling, onAction) {
|
|
18495
|
+
var _a, _b;
|
|
18448
18496
|
const httpClient = useHttpClient();
|
|
18449
18497
|
const asyncFn = (0, import_react58.useMemo)(() => {
|
|
18450
18498
|
if (polling) {
|
|
@@ -18471,7 +18519,7 @@ function useStepPolling(polling, onAction) {
|
|
|
18471
18519
|
);
|
|
18472
18520
|
usePolling({
|
|
18473
18521
|
asyncFn,
|
|
18474
|
-
|
|
18522
|
+
delay: 1e3 * ((_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0),
|
|
18475
18523
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
18476
18524
|
maxConsecutiveFails: 1,
|
|
18477
18525
|
onPollingResponse,
|