@wise/dynamic-flow-client 3.16.6 → 3.16.7
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 +146 -102
- package/build/main.min.js +1 -1
- package/build/main.mjs +146 -102
- 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/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,7 +6863,7 @@ var getStepPolling = ({
|
|
|
6853
6863
|
onFailure();
|
|
6854
6864
|
}
|
|
6855
6865
|
};
|
|
6856
|
-
const intervalRef = setInterval(poll,
|
|
6866
|
+
const intervalRef = setInterval(poll, delay * 1e3);
|
|
6857
6867
|
const stop = () => {
|
|
6858
6868
|
abortController.abort();
|
|
6859
6869
|
clearTimeout(intervalRef);
|
|
@@ -6866,6 +6876,7 @@ var createAlertComponent = (alertProps) => __spreadProps(__spreadValues({
|
|
|
6866
6876
|
type: "alert"
|
|
6867
6877
|
}, alertProps), {
|
|
6868
6878
|
getSubmittableValue: async () => null,
|
|
6879
|
+
getSubmittableValueSync: () => null,
|
|
6869
6880
|
getLocalValue: () => null,
|
|
6870
6881
|
getSummary: () => ({}),
|
|
6871
6882
|
// Noop
|
|
@@ -6967,6 +6978,9 @@ var createBoxComponent = (boxProps) => __spreadProps(__spreadValues({}, boxProps
|
|
|
6967
6978
|
async getSubmittableValue() {
|
|
6968
6979
|
return getSubmittableData(this.components);
|
|
6969
6980
|
},
|
|
6981
|
+
getSubmittableValueSync() {
|
|
6982
|
+
return getSubmittableDataSync(this.components);
|
|
6983
|
+
},
|
|
6970
6984
|
getSummary() {
|
|
6971
6985
|
return summariseFromChildren(this.getChildren());
|
|
6972
6986
|
},
|
|
@@ -6995,6 +7009,7 @@ var createButtonComponent = (buttonProps) => __spreadProps(__spreadValues({
|
|
|
6995
7009
|
type: "button"
|
|
6996
7010
|
}, buttonProps), {
|
|
6997
7011
|
getSubmittableValue: async () => null,
|
|
7012
|
+
getSubmittableValueSync: () => null,
|
|
6998
7013
|
getLocalValue: () => null,
|
|
6999
7014
|
getSummary: () => ({}),
|
|
7000
7015
|
// Noop
|
|
@@ -7062,6 +7077,9 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
|
|
|
7062
7077
|
async getSubmittableValue() {
|
|
7063
7078
|
return getSubmittableData(this.getChildren());
|
|
7064
7079
|
},
|
|
7080
|
+
getSubmittableValueSync() {
|
|
7081
|
+
return getSubmittableDataSync(this.getChildren());
|
|
7082
|
+
},
|
|
7065
7083
|
getSummary() {
|
|
7066
7084
|
return summariseFromChildren(this.getChildren());
|
|
7067
7085
|
},
|
|
@@ -7092,6 +7110,7 @@ var createDecisionComponent = (decisionProps) => __spreadProps(__spreadValues({
|
|
|
7092
7110
|
type: "decision"
|
|
7093
7111
|
}, decisionProps), {
|
|
7094
7112
|
getSubmittableValue: async () => null,
|
|
7113
|
+
getSubmittableValueSync: () => null,
|
|
7095
7114
|
getLocalValue: () => null,
|
|
7096
7115
|
getSummary: () => ({}),
|
|
7097
7116
|
// Noop
|
|
@@ -7120,6 +7139,7 @@ var createDividerComponent = (props) => __spreadProps(__spreadValues({
|
|
|
7120
7139
|
type: "divider"
|
|
7121
7140
|
}, props), {
|
|
7122
7141
|
getSubmittableValue: async () => null,
|
|
7142
|
+
getSubmittableValueSync: () => null,
|
|
7123
7143
|
getLocalValue: () => null,
|
|
7124
7144
|
getSummary: () => ({}),
|
|
7125
7145
|
// Noop
|
|
@@ -7156,15 +7176,15 @@ var abortAndResetController = (abortController) => {
|
|
|
7156
7176
|
return new AbortController();
|
|
7157
7177
|
};
|
|
7158
7178
|
|
|
7159
|
-
// src/revamp/domain/components/utils/
|
|
7160
|
-
var
|
|
7179
|
+
// src/revamp/domain/components/utils/isExactLocalValueMatch.ts
|
|
7180
|
+
var isExactLocalValueMatch = (valueA, valueB) => {
|
|
7161
7181
|
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7162
|
-
return valueA.length === valueB.length && valueA.every((value, index) =>
|
|
7182
|
+
return valueA.length === valueB.length && valueA.every((value, index) => isExactLocalValueMatch(value, valueB[index]));
|
|
7163
7183
|
}
|
|
7164
7184
|
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7165
7185
|
const keysA = Object.keys(valueA);
|
|
7166
7186
|
const keysB = Object.keys(valueB);
|
|
7167
|
-
return keysA.length === keysB.length && keysA.every((key) =>
|
|
7187
|
+
return keysA.length === keysB.length && keysA.every((key) => isExactLocalValueMatch(valueA[key], valueB[key]));
|
|
7168
7188
|
}
|
|
7169
7189
|
return valueA === valueB;
|
|
7170
7190
|
};
|
|
@@ -7177,7 +7197,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7177
7197
|
*/
|
|
7178
7198
|
async (persistedState, currentValue) => {
|
|
7179
7199
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
7180
|
-
if (
|
|
7200
|
+
if (isExactLocalValueMatch(lastSubmitted, currentValue)) {
|
|
7181
7201
|
return submission;
|
|
7182
7202
|
}
|
|
7183
7203
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7185,27 +7205,33 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
7185
7205
|
const resolvedNull = Promise.resolve(null);
|
|
7186
7206
|
update((draft) => {
|
|
7187
7207
|
draft.persistedState.abortController = newAbortController;
|
|
7208
|
+
draft.persistedState.lastResponse = null;
|
|
7188
7209
|
draft.persistedState.lastSubmitted = currentValue;
|
|
7189
7210
|
draft.persistedState.submission = resolvedNull;
|
|
7190
7211
|
});
|
|
7191
7212
|
return resolvedNull;
|
|
7192
7213
|
}
|
|
7193
7214
|
const { signal } = newAbortController;
|
|
7194
|
-
const newSubmission = performPersistAsync({ value: currentValue, signal }).
|
|
7195
|
-
(
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
});
|
|
7203
|
-
throw error;
|
|
7215
|
+
const newSubmission = performPersistAsync({ value: currentValue, signal }).then((newValue) => {
|
|
7216
|
+
update((draft) => {
|
|
7217
|
+
draft.persistedState.lastResponse = newValue;
|
|
7218
|
+
});
|
|
7219
|
+
return newValue;
|
|
7220
|
+
}).catch((error) => {
|
|
7221
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
7222
|
+
return null;
|
|
7204
7223
|
}
|
|
7205
|
-
|
|
7224
|
+
update((draft) => {
|
|
7225
|
+
draft.errors = [error.message];
|
|
7226
|
+
draft.persistedState.lastResponse = null;
|
|
7227
|
+
draft.persistedState.lastSubmitted = null;
|
|
7228
|
+
});
|
|
7229
|
+
throw error;
|
|
7230
|
+
});
|
|
7206
7231
|
update((draft) => {
|
|
7207
7232
|
draft.persistedState = {
|
|
7208
7233
|
abortController: newAbortController,
|
|
7234
|
+
lastResponse: null,
|
|
7209
7235
|
lastSubmitted: currentValue,
|
|
7210
7236
|
submission: newSubmission
|
|
7211
7237
|
};
|
|
@@ -7224,7 +7250,13 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7224
7250
|
}
|
|
7225
7251
|
const newAbortController = new AbortController();
|
|
7226
7252
|
const { signal } = newAbortController;
|
|
7227
|
-
const newSubmission = performPersistAsync({ value, signal }).
|
|
7253
|
+
const newSubmission = performPersistAsync({ value, signal }).then((newValue) => {
|
|
7254
|
+
update((draft) => {
|
|
7255
|
+
const index = draft.persistedState.findIndex((state) => state.id === id);
|
|
7256
|
+
draft.persistedState[index].lastResponse = newValue;
|
|
7257
|
+
});
|
|
7258
|
+
return newValue;
|
|
7259
|
+
}).catch((error) => {
|
|
7228
7260
|
update((draft) => {
|
|
7229
7261
|
draft.persistedState = draft.persistedState.filter((state) => state.id !== id);
|
|
7230
7262
|
});
|
|
@@ -7236,6 +7268,7 @@ var getComponentMultiPersistAsync = (update, performPersistAsync) => (
|
|
|
7236
7268
|
{
|
|
7237
7269
|
id,
|
|
7238
7270
|
abortController: newAbortController,
|
|
7271
|
+
lastResponse: null,
|
|
7239
7272
|
lastSubmitted: null,
|
|
7240
7273
|
submission: newSubmission
|
|
7241
7274
|
}
|
|
@@ -7396,6 +7429,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7396
7429
|
onValueChange();
|
|
7397
7430
|
},
|
|
7398
7431
|
async getSubmittableValue() {
|
|
7432
|
+
return this.getSubmittableValueSync();
|
|
7433
|
+
},
|
|
7434
|
+
getSubmittableValueSync() {
|
|
7399
7435
|
var _a2;
|
|
7400
7436
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
7401
7437
|
},
|
|
@@ -7416,7 +7452,6 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7416
7452
|
if (performPersistAsync) {
|
|
7417
7453
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
7418
7454
|
return __spreadProps(__spreadValues({}, numberComponent), {
|
|
7419
|
-
isPersisted: true,
|
|
7420
7455
|
onBlur() {
|
|
7421
7456
|
if (this.validate()) {
|
|
7422
7457
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -7425,6 +7460,9 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7425
7460
|
},
|
|
7426
7461
|
async getSubmittableValue() {
|
|
7427
7462
|
return persist(this.persistedState, this.getLocalValue());
|
|
7463
|
+
},
|
|
7464
|
+
getSubmittableValueSync() {
|
|
7465
|
+
return this.persistedState.lastResponse;
|
|
7428
7466
|
}
|
|
7429
7467
|
});
|
|
7430
7468
|
}
|
|
@@ -7660,6 +7698,7 @@ var getValidationError = (param, response) => {
|
|
|
7660
7698
|
var getInitialPersistedState = (lastSubmitted, model) => ({
|
|
7661
7699
|
abortController: new AbortController(),
|
|
7662
7700
|
lastSubmitted: !isNullish(model) ? lastSubmitted != null ? lastSubmitted : null : null,
|
|
7701
|
+
lastResponse: model != null ? model : null,
|
|
7663
7702
|
submission: Promise.resolve(model != null ? model : null)
|
|
7664
7703
|
});
|
|
7665
7704
|
|
|
@@ -7869,6 +7908,12 @@ var createObjectComponent = (objectProps) => {
|
|
|
7869
7908
|
)
|
|
7870
7909
|
);
|
|
7871
7910
|
},
|
|
7911
|
+
getSubmittableValueSync() {
|
|
7912
|
+
return mergeChildrenValues(
|
|
7913
|
+
displayOrder,
|
|
7914
|
+
(propName) => this.componentMap[propName].getSubmittableValueSync()
|
|
7915
|
+
);
|
|
7916
|
+
},
|
|
7872
7917
|
getSummary() {
|
|
7873
7918
|
const summary = summariser(this.getLocalValue());
|
|
7874
7919
|
const childSummary = summariseFromChildren(this.getChildren());
|
|
@@ -7965,6 +8010,9 @@ var createAllOfComponent = (allOfProps) => {
|
|
|
7965
8010
|
async getSubmittableValue() {
|
|
7966
8011
|
return getSubmittableData(this.components);
|
|
7967
8012
|
},
|
|
8013
|
+
getSubmittableValueSync() {
|
|
8014
|
+
return getSubmittableDataSync(this.components);
|
|
8015
|
+
},
|
|
7968
8016
|
getLocalValue() {
|
|
7969
8017
|
return getLocalValues(this.components);
|
|
7970
8018
|
},
|
|
@@ -8005,6 +8053,7 @@ var createConstComponent = (hiddenProps) => {
|
|
|
8005
8053
|
analyticsId,
|
|
8006
8054
|
getLocalValue: () => value,
|
|
8007
8055
|
getSubmittableValue: async () => value,
|
|
8056
|
+
getSubmittableValueSync: () => value,
|
|
8008
8057
|
getSummary: () => summary,
|
|
8009
8058
|
validate: () => true
|
|
8010
8059
|
};
|
|
@@ -8079,6 +8128,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8079
8128
|
onValueChange();
|
|
8080
8129
|
},
|
|
8081
8130
|
async getSubmittableValue() {
|
|
8131
|
+
return this.getSubmittableValueSync();
|
|
8132
|
+
},
|
|
8133
|
+
getSubmittableValueSync() {
|
|
8082
8134
|
var _a2;
|
|
8083
8135
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8084
8136
|
},
|
|
@@ -8099,7 +8151,6 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8099
8151
|
if (performPersistAsync) {
|
|
8100
8152
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8101
8153
|
return __spreadProps(__spreadValues({}, integerComponent), {
|
|
8102
|
-
isPersisted: true,
|
|
8103
8154
|
onBlur() {
|
|
8104
8155
|
if (this.validate()) {
|
|
8105
8156
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8108,6 +8159,9 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
|
|
|
8108
8159
|
},
|
|
8109
8160
|
async getSubmittableValue() {
|
|
8110
8161
|
return persist(this.persistedState, this.getLocalValue());
|
|
8162
|
+
},
|
|
8163
|
+
getSubmittableValueSync() {
|
|
8164
|
+
return this.persistedState.lastResponse;
|
|
8111
8165
|
}
|
|
8112
8166
|
});
|
|
8113
8167
|
}
|
|
@@ -8186,7 +8240,7 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
8186
8240
|
}
|
|
8187
8241
|
const componentValue = component.getLocalValue();
|
|
8188
8242
|
if (component.type === "const") {
|
|
8189
|
-
return
|
|
8243
|
+
return isExactLocalValueMatch(partialValue, componentValue);
|
|
8190
8244
|
}
|
|
8191
8245
|
if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
|
|
8192
8246
|
return isPartialObjectMatch(partialValue, componentValue, component);
|
|
@@ -8233,25 +8287,7 @@ var getMatchingKeys = (a, b) => {
|
|
|
8233
8287
|
|
|
8234
8288
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
8235
8289
|
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
|
-
]);
|
|
8290
|
+
const _a = selectProps, { uid, checks, initialValue, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialValue", "options", "performRefresh", "onValueChange", "summariser"]);
|
|
8255
8291
|
const children = options.map((option) => option.component);
|
|
8256
8292
|
const matchingOptions = options.map(
|
|
8257
8293
|
(option) => isPartialLocalValueMatch(selectProps.initialValue, option.component)
|
|
@@ -8266,7 +8302,7 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8266
8302
|
});
|
|
8267
8303
|
return messages;
|
|
8268
8304
|
};
|
|
8269
|
-
|
|
8305
|
+
return __spreadProps(__spreadValues({
|
|
8270
8306
|
uid,
|
|
8271
8307
|
type: "select",
|
|
8272
8308
|
children,
|
|
@@ -8284,6 +8320,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8284
8320
|
var _a2, _b;
|
|
8285
8321
|
return (_b = await ((_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValue())) != null ? _b : null;
|
|
8286
8322
|
},
|
|
8323
|
+
getSubmittableValueSync() {
|
|
8324
|
+
var _a2, _b;
|
|
8325
|
+
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSubmittableValueSync()) != null ? _b : null;
|
|
8326
|
+
},
|
|
8287
8327
|
getSummary() {
|
|
8288
8328
|
var _a2, _b;
|
|
8289
8329
|
return (_b = (_a2 = this.getSelectedChild()) == null ? void 0 : _a2.getSummary()) != null ? _b : {};
|
|
@@ -8319,25 +8359,6 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
|
8319
8359
|
return messages.length === 0 && validChild;
|
|
8320
8360
|
}
|
|
8321
8361
|
});
|
|
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
8362
|
};
|
|
8342
8363
|
var isTrue = (value) => value === true;
|
|
8343
8364
|
|
|
@@ -8378,19 +8399,13 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8378
8399
|
const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
|
|
8379
8400
|
const { default: defaultValue, validationMessages } = schema;
|
|
8380
8401
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8381
|
-
const
|
|
8382
|
-
schemaMapperProps,
|
|
8383
|
-
mapperProps
|
|
8384
|
-
);
|
|
8385
|
-
const initialValue = performPersistAsync ? localValue : (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8402
|
+
const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
|
|
8386
8403
|
return createSelectInputComponent(
|
|
8387
8404
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8388
8405
|
autoComplete: getAutocompleteString(schema.autocompleteHint),
|
|
8389
8406
|
checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
|
|
8390
8407
|
options,
|
|
8391
8408
|
initialValue,
|
|
8392
|
-
persistedState,
|
|
8393
|
-
performPersistAsync,
|
|
8394
8409
|
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8395
8410
|
onValueChange,
|
|
8396
8411
|
trackEvent
|
|
@@ -8456,6 +8471,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8456
8471
|
onValueChange();
|
|
8457
8472
|
},
|
|
8458
8473
|
async getSubmittableValue() {
|
|
8474
|
+
return this.getSubmittableValueSync();
|
|
8475
|
+
},
|
|
8476
|
+
getSubmittableValueSync() {
|
|
8459
8477
|
var _a2;
|
|
8460
8478
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8461
8479
|
},
|
|
@@ -8476,7 +8494,6 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8476
8494
|
if (performPersistAsync) {
|
|
8477
8495
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8478
8496
|
return __spreadProps(__spreadValues({}, dateInputComponent), {
|
|
8479
|
-
isPersisted: true,
|
|
8480
8497
|
onChange(updatedValue) {
|
|
8481
8498
|
dateInputComponent.onChange.call(this, updatedValue);
|
|
8482
8499
|
const isValid2 = getValidationErrors(updatedValue).length === 0;
|
|
@@ -8487,6 +8504,9 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
|
|
|
8487
8504
|
},
|
|
8488
8505
|
async getSubmittableValue() {
|
|
8489
8506
|
return persist(this.persistedState, this.getLocalValue());
|
|
8507
|
+
},
|
|
8508
|
+
getSubmittableValueSync() {
|
|
8509
|
+
return this.persistedState.lastResponse;
|
|
8490
8510
|
}
|
|
8491
8511
|
});
|
|
8492
8512
|
}
|
|
@@ -8625,6 +8645,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8625
8645
|
const file = this.getLocalValue();
|
|
8626
8646
|
return file ? toBase64(file) : null;
|
|
8627
8647
|
},
|
|
8648
|
+
getSubmittableValueSync() {
|
|
8649
|
+
return null;
|
|
8650
|
+
},
|
|
8628
8651
|
getSummary() {
|
|
8629
8652
|
var _a2, _b;
|
|
8630
8653
|
return summariser((_b = (_a2 = this.getLocalValue()) == null ? void 0 : _a2.name) != null ? _b : null);
|
|
@@ -8643,7 +8666,6 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8643
8666
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8644
8667
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
8645
8668
|
format,
|
|
8646
|
-
isPersisted: true,
|
|
8647
8669
|
async onUpload(file) {
|
|
8648
8670
|
update((draft) => {
|
|
8649
8671
|
draft.errors = [];
|
|
@@ -8653,6 +8675,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8653
8675
|
const submission = format === "base64" && file ? await toBase64(file) : file;
|
|
8654
8676
|
await persist(this.persistedState, submission).catch((error) => {
|
|
8655
8677
|
update((draft) => {
|
|
8678
|
+
draft.persistedState.lastResponse = null;
|
|
8656
8679
|
draft.persistedState.lastSubmitted = null;
|
|
8657
8680
|
draft.persistedState.submission = Promise.resolve(null);
|
|
8658
8681
|
draft.errors = [];
|
|
@@ -8663,6 +8686,9 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8663
8686
|
},
|
|
8664
8687
|
async getSubmittableValue() {
|
|
8665
8688
|
return this.persistedState.submission;
|
|
8689
|
+
},
|
|
8690
|
+
getSubmittableValueSync() {
|
|
8691
|
+
return this.persistedState.lastResponse;
|
|
8666
8692
|
}
|
|
8667
8693
|
});
|
|
8668
8694
|
};
|
|
@@ -8751,6 +8777,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8751
8777
|
onValueChange();
|
|
8752
8778
|
},
|
|
8753
8779
|
async getSubmittableValue() {
|
|
8780
|
+
return this.getSubmittableValueSync();
|
|
8781
|
+
},
|
|
8782
|
+
getSubmittableValueSync() {
|
|
8754
8783
|
var _a2;
|
|
8755
8784
|
return (_a2 = this.getLocalValue()) != null ? _a2 : null;
|
|
8756
8785
|
},
|
|
@@ -8771,7 +8800,6 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8771
8800
|
if (performPersistAsync) {
|
|
8772
8801
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8773
8802
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8774
|
-
isPersisted: true,
|
|
8775
8803
|
onBlur() {
|
|
8776
8804
|
if (this.validate()) {
|
|
8777
8805
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -8780,6 +8808,9 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
8780
8808
|
},
|
|
8781
8809
|
async getSubmittableValue() {
|
|
8782
8810
|
return persist(this.persistedState, this.getLocalValue());
|
|
8811
|
+
},
|
|
8812
|
+
getSubmittableValueSync() {
|
|
8813
|
+
return this.persistedState.lastResponse;
|
|
8783
8814
|
}
|
|
8784
8815
|
});
|
|
8785
8816
|
}
|
|
@@ -8873,6 +8904,9 @@ var createContainerComponent = (containerProps) => __spreadProps(__spreadValues(
|
|
|
8873
8904
|
async getSubmittableValue() {
|
|
8874
8905
|
return getSubmittableData(this.components);
|
|
8875
8906
|
},
|
|
8907
|
+
getSubmittableValueSync() {
|
|
8908
|
+
return getSubmittableDataSync(this.components);
|
|
8909
|
+
},
|
|
8876
8910
|
getSummary() {
|
|
8877
8911
|
return summariseFromChildren(this.getChildren());
|
|
8878
8912
|
},
|
|
@@ -8977,6 +9011,9 @@ var createRepeatableComponent = (repeatableProps, updateComponent) => {
|
|
|
8977
9011
|
async getSubmittableValue() {
|
|
8978
9012
|
return Promise.all(this.components.map(async (component) => component.getSubmittableValue()));
|
|
8979
9013
|
},
|
|
9014
|
+
getSubmittableValueSync() {
|
|
9015
|
+
return this.components.map((component) => component.getSubmittableValueSync());
|
|
9016
|
+
},
|
|
8980
9017
|
getSummary() {
|
|
8981
9018
|
return summariser(null);
|
|
8982
9019
|
},
|
|
@@ -9112,6 +9149,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9112
9149
|
const files = this.getLocalValue();
|
|
9113
9150
|
return files ? Promise.all(files.map(toBase64)) : null;
|
|
9114
9151
|
},
|
|
9152
|
+
getSubmittableValueSync() {
|
|
9153
|
+
return null;
|
|
9154
|
+
},
|
|
9115
9155
|
getSummary() {
|
|
9116
9156
|
return summariser(this.getLocalValue().map(({ name }) => name));
|
|
9117
9157
|
},
|
|
@@ -9129,7 +9169,6 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9129
9169
|
const persist = getComponentMultiPersistAsync(update, performPersistAsync);
|
|
9130
9170
|
return __spreadProps(__spreadValues({}, uploadComponent), {
|
|
9131
9171
|
format,
|
|
9132
|
-
isPersisted: true,
|
|
9133
9172
|
async onUpload(file, fileId) {
|
|
9134
9173
|
await uploadComponent.onUpload.call(this, file, fileId);
|
|
9135
9174
|
const submission = format === "blob" ? file : await toBase64(file);
|
|
@@ -9146,6 +9185,9 @@ var createMultiUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
9146
9185
|
},
|
|
9147
9186
|
async getSubmittableValue() {
|
|
9148
9187
|
return Promise.all(this.persistedState.map(async ({ submission }) => submission));
|
|
9188
|
+
},
|
|
9189
|
+
getSubmittableValueSync() {
|
|
9190
|
+
return this.persistedState.map(({ lastResponse }) => lastResponse);
|
|
9149
9191
|
}
|
|
9150
9192
|
});
|
|
9151
9193
|
};
|
|
@@ -9219,7 +9261,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9219
9261
|
checks,
|
|
9220
9262
|
options,
|
|
9221
9263
|
initialValue,
|
|
9222
|
-
performPersistAsync,
|
|
9223
9264
|
performValidationAsync,
|
|
9224
9265
|
performRefresh,
|
|
9225
9266
|
onValueChange
|
|
@@ -9228,7 +9269,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9228
9269
|
"checks",
|
|
9229
9270
|
"options",
|
|
9230
9271
|
"initialValue",
|
|
9231
|
-
"performPersistAsync",
|
|
9232
9272
|
"performValidationAsync",
|
|
9233
9273
|
"performRefresh",
|
|
9234
9274
|
"onValueChange"
|
|
@@ -9282,6 +9322,10 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9282
9322
|
}
|
|
9283
9323
|
return null;
|
|
9284
9324
|
},
|
|
9325
|
+
getSubmittableValueSync() {
|
|
9326
|
+
var _a2, _b;
|
|
9327
|
+
return (_b = (_a2 = this.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getSubmittableValueSync())) != null ? _b : null;
|
|
9328
|
+
},
|
|
9285
9329
|
getSummary: () => ({}),
|
|
9286
9330
|
getChildren() {
|
|
9287
9331
|
return this.children;
|
|
@@ -9293,23 +9337,6 @@ var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
|
9293
9337
|
if (performRefresh) {
|
|
9294
9338
|
return inputComponent;
|
|
9295
9339
|
}
|
|
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
9340
|
if (performValidationAsync) {
|
|
9314
9341
|
const validateAsync = getComponentValidationAsync(update, performValidationAsync);
|
|
9315
9342
|
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
@@ -9367,15 +9394,11 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9367
9394
|
const { title, validationMessages } = schema;
|
|
9368
9395
|
const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
|
|
9369
9396
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
9370
|
-
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
9371
|
-
schemaMapperProps,
|
|
9372
|
-
mapperProps
|
|
9373
|
-
);
|
|
9374
9397
|
const { performValidationAsync, validationState } = getValidationAsyncInitialState(
|
|
9375
9398
|
schemaMapperProps,
|
|
9376
9399
|
mapperProps
|
|
9377
9400
|
);
|
|
9378
|
-
const initialValue =
|
|
9401
|
+
const initialValue = model != null ? model : null;
|
|
9379
9402
|
return createMultiSelectComponent(
|
|
9380
9403
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
9381
9404
|
autoComplete: "off",
|
|
@@ -9387,8 +9410,6 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9387
9410
|
initialValue,
|
|
9388
9411
|
options,
|
|
9389
9412
|
required,
|
|
9390
|
-
persistedState,
|
|
9391
|
-
performPersistAsync,
|
|
9392
9413
|
title,
|
|
9393
9414
|
validationState,
|
|
9394
9415
|
performValidationAsync,
|
|
@@ -9416,7 +9437,10 @@ var createTupleComponent = (tupleProps) => {
|
|
|
9416
9437
|
return this.components;
|
|
9417
9438
|
},
|
|
9418
9439
|
async getSubmittableValue() {
|
|
9419
|
-
return Promise.all(this.components.map((child) => child.getSubmittableValue()));
|
|
9440
|
+
return Promise.all(this.components.map(async (child) => child.getSubmittableValue()));
|
|
9441
|
+
},
|
|
9442
|
+
getSubmittableValueSync() {
|
|
9443
|
+
return this.components.map((child) => child.getSubmittableValueSync());
|
|
9420
9444
|
},
|
|
9421
9445
|
getSummary() {
|
|
9422
9446
|
const summary = summariser(this.getLocalValue());
|
|
@@ -9526,6 +9550,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9526
9550
|
onValueChange();
|
|
9527
9551
|
},
|
|
9528
9552
|
async getSubmittableValue() {
|
|
9553
|
+
return this.getSubmittableValueSync();
|
|
9554
|
+
},
|
|
9555
|
+
getSubmittableValueSync() {
|
|
9529
9556
|
return this.getLocalValue();
|
|
9530
9557
|
},
|
|
9531
9558
|
getSummary() {
|
|
@@ -9542,7 +9569,6 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9542
9569
|
if (performPersistAsync) {
|
|
9543
9570
|
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
9544
9571
|
return __spreadProps(__spreadValues({}, booleanComponent), {
|
|
9545
|
-
isPersisted: true,
|
|
9546
9572
|
onChange(updatedValue) {
|
|
9547
9573
|
booleanComponent.onChange.call(this, updatedValue);
|
|
9548
9574
|
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
@@ -9550,6 +9576,9 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
|
9550
9576
|
},
|
|
9551
9577
|
async getSubmittableValue() {
|
|
9552
9578
|
return persist(this.persistedState, this.getLocalValue());
|
|
9579
|
+
},
|
|
9580
|
+
getSubmittableValueSync() {
|
|
9581
|
+
return this.persistedState.lastResponse;
|
|
9553
9582
|
}
|
|
9554
9583
|
});
|
|
9555
9584
|
}
|
|
@@ -9705,6 +9734,9 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
|
|
|
9705
9734
|
async getSubmittableValue() {
|
|
9706
9735
|
return getSubmittableData(this.getChildren());
|
|
9707
9736
|
},
|
|
9737
|
+
getSubmittableValueSync() {
|
|
9738
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9739
|
+
},
|
|
9708
9740
|
getSummary() {
|
|
9709
9741
|
return summariseFromChildren(this.getChildren());
|
|
9710
9742
|
},
|
|
@@ -9750,6 +9782,7 @@ var createHeadingComponent = (headingProps) => __spreadProps(__spreadValues({
|
|
|
9750
9782
|
type: "heading"
|
|
9751
9783
|
}, headingProps), {
|
|
9752
9784
|
getSubmittableValue: async () => null,
|
|
9785
|
+
getSubmittableValueSync: () => null,
|
|
9753
9786
|
getSummary: () => ({}),
|
|
9754
9787
|
// Noop
|
|
9755
9788
|
getLocalValue: () => null,
|
|
@@ -9771,6 +9804,7 @@ var createImageComponent = (imageProps) => __spreadProps(__spreadValues({
|
|
|
9771
9804
|
type: "image"
|
|
9772
9805
|
}, imageProps), {
|
|
9773
9806
|
getSubmittableValue: async () => null,
|
|
9807
|
+
getSubmittableValueSync: () => null,
|
|
9774
9808
|
getLocalValue: () => null,
|
|
9775
9809
|
getSummary: () => ({}),
|
|
9776
9810
|
// Noop
|
|
@@ -9792,6 +9826,7 @@ var createMarkdownComponent = (markdownProps) => __spreadProps(__spreadValues({
|
|
|
9792
9826
|
type: "markdown"
|
|
9793
9827
|
}, markdownProps), {
|
|
9794
9828
|
getSubmittableValue: async () => null,
|
|
9829
|
+
getSubmittableValueSync: () => null,
|
|
9795
9830
|
getLocalValue: () => null,
|
|
9796
9831
|
getSummary: () => ({}),
|
|
9797
9832
|
validate: () => true
|
|
@@ -9812,6 +9847,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadProps(__spreadV
|
|
|
9812
9847
|
}, instructionsProps), {
|
|
9813
9848
|
getLocalValue: () => null,
|
|
9814
9849
|
getSubmittableValue: async () => null,
|
|
9850
|
+
getSubmittableValueSync: () => null,
|
|
9815
9851
|
getSummary: () => ({}),
|
|
9816
9852
|
// Noop
|
|
9817
9853
|
validate: () => true
|
|
@@ -9834,6 +9870,7 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadProps(_
|
|
|
9834
9870
|
type: "loading-indicator"
|
|
9835
9871
|
}, loadingIndicatorProps), {
|
|
9836
9872
|
getSubmittableValue: async () => null,
|
|
9873
|
+
getSubmittableValueSync: () => null,
|
|
9837
9874
|
getLocalValue: () => null,
|
|
9838
9875
|
getSummary: () => ({}),
|
|
9839
9876
|
// Noop
|
|
@@ -9865,6 +9902,9 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
|
|
|
9865
9902
|
async getSubmittableValue() {
|
|
9866
9903
|
return getSubmittableData(this.getChildren());
|
|
9867
9904
|
},
|
|
9905
|
+
getSubmittableValueSync() {
|
|
9906
|
+
return getSubmittableDataSync(this.getChildren());
|
|
9907
|
+
},
|
|
9868
9908
|
getSummary() {
|
|
9869
9909
|
return summariseFromChildren(this.getChildren());
|
|
9870
9910
|
},
|
|
@@ -9894,6 +9934,7 @@ var createParagraphComponent = (paragraphProps) => __spreadProps(__spreadValues(
|
|
|
9894
9934
|
type: "paragraph"
|
|
9895
9935
|
}, paragraphProps), {
|
|
9896
9936
|
getSubmittableValue: async () => null,
|
|
9937
|
+
getSubmittableValueSync: () => null,
|
|
9897
9938
|
getSummary: () => ({}),
|
|
9898
9939
|
// Noop
|
|
9899
9940
|
getLocalValue: () => null,
|
|
@@ -9915,6 +9956,7 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
9915
9956
|
}, reviewProps), {
|
|
9916
9957
|
getLocalValue: () => null,
|
|
9917
9958
|
getSubmittableValue: async () => null,
|
|
9959
|
+
getSubmittableValueSync: () => null,
|
|
9918
9960
|
getSummary: () => ({}),
|
|
9919
9961
|
// Noop
|
|
9920
9962
|
validate: () => true
|
|
@@ -10025,6 +10067,7 @@ var createSearchComponent = (searchProps, performSearch, onAction, updateCompone
|
|
|
10025
10067
|
query: "",
|
|
10026
10068
|
results: [],
|
|
10027
10069
|
getSubmittableValue: async () => null,
|
|
10070
|
+
getSubmittableValueSync: () => null,
|
|
10028
10071
|
getLocalValue: () => null,
|
|
10029
10072
|
getSummary: () => ({}),
|
|
10030
10073
|
// Noop
|
|
@@ -10100,6 +10143,7 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
|
|
|
10100
10143
|
}, statusListProps), {
|
|
10101
10144
|
getLocalValue: () => null,
|
|
10102
10145
|
getSubmittableValue: async () => null,
|
|
10146
|
+
getSubmittableValueSync: () => null,
|
|
10103
10147
|
getSummary: () => ({}),
|
|
10104
10148
|
// Noop,
|
|
10105
10149
|
validate: () => true
|
|
@@ -14244,7 +14288,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
14244
14288
|
);
|
|
14245
14289
|
usePolling({
|
|
14246
14290
|
asyncFn,
|
|
14247
|
-
interval: (polling == null ? void 0 : polling.interval) || 0,
|
|
14291
|
+
interval: (polling == null ? void 0 : polling.delay) || (polling == null ? void 0 : polling.interval) || 0,
|
|
14248
14292
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
14249
14293
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
14250
14294
|
onPollingResponse,
|