@wise/dynamic-flow-client 2.8.12 → 2.8.15
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 +101 -100
- package/build/main.min.js +1 -1
- package/build/types/{legacy/common/contexts → common}/httpClientContext/HttpClientContext.d.ts +1 -1
- package/build/types/common/httpClientContext/index.d.ts +1 -0
- package/build/types/common/messages/persist-async.messages.d.ts +8 -0
- package/build/types/common/utils/api-utils.d.ts +1 -0
- package/build/types/legacy/common/contexts/index.d.ts +0 -1
- package/build/types/legacy/common/utils/api-utils.d.ts +0 -1
- package/build/types/revamp/domain/components/AllOfComponent.d.ts +16 -0
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/DecisionComponent.d.ts +15 -0
- package/build/types/revamp/domain/components/DividerComponent.d.ts +5 -0
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ImageComponent.d.ts +9 -0
- package/build/types/revamp/domain/components/InstructionsComponent.d.ts +11 -0
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/LoadingIndicatorComponent.d.ts +8 -0
- package/build/types/revamp/domain/components/MarkdownComponent.d.ts +7 -0
- package/build/types/revamp/domain/components/ModalComponent.d.ts +12 -0
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +0 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +5 -5
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +15 -0
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +22 -0
- package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +2 -0
- package/build/types/revamp/domain/features/validation/spec-utils.d.ts +1 -0
- package/build/types/revamp/domain/features/validation/validation-functions.d.ts +7 -0
- package/build/types/revamp/domain/features/validation/value-checks.d.ts +3 -3
- package/build/types/revamp/domain/mappers/layout/decisionLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/dividerLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/imageLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/infoLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/instructionsLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/markdownLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/modalLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/reviewLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/schema/allOfSchemaToComponent.d.ts +5 -0
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.d.ts +2 -2
- package/build/types/revamp/domain/mappers/schema/hiddenSchemaToComponent.d.ts +7 -0
- package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +3 -2
- package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +27 -0
- package/build/types/revamp/domain/mappers/types.d.ts +3 -0
- package/build/types/revamp/domain/types.d.ts +24 -8
- package/build/types/revamp/renderers/mappers/allOfComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/decisionComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/dividerComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/imageComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/instructionsComponentToProps.d.ts +8 -0
- package/build/types/revamp/renderers/mappers/loadingIndicatorComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/markdownComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/modalComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/reviewComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/utils/inputComponentToProps.d.ts +1 -3
- package/build/types/revamp/renderers/types.d.ts +59 -4
- package/build/types/revamp/utils/{getSubmittableData.d.ts → component-utils.d.ts} +1 -0
- package/build/types/revamp/utils/type-utils.d.ts +16 -5
- package/build/types/revamp/wise/renderers/DecisionRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/DividerRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/FormSectionRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ImageRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/InstructionsRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/LoadingIndicatorRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/MarkdownRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ModalRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ReviewRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/SearchRenderer.d.ts +2 -1
- package/build/types/revamp/wise/renderers/components/Help.d.ts +4 -0
- package/build/types/test-utils/fetch-utils.d.ts +2 -2
- package/package.json +2 -2
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +0 -6
- package/build/types/revamp/domain/features/validation/validateComponents.d.ts +0 -2
- package/build/types/revamp/domain/validation/validation-functions.d.ts +0 -8
- package/build/types/revamp/stories/visual-tests/array.d.ts +0 -3
- package/build/types/revamp/wise/renderers/ObjectRenderer.d.ts +0 -3
- /package/build/types/revamp/{domain/mappers/utils → utils}/type-validators.d.ts +0 -0
package/build/main.js
CHANGED
|
@@ -1092,57 +1092,9 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
1092
1092
|
}
|
|
1093
1093
|
};
|
|
1094
1094
|
|
|
1095
|
-
// src/legacy/common/contexts/
|
|
1095
|
+
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
1096
1096
|
var import_react4 = require("react");
|
|
1097
|
-
|
|
1098
|
-
// src/common/makeHttpClient/makeHttpClient.ts
|
|
1099
|
-
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
1100
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1101
|
-
(input, init) => {
|
|
1102
|
-
const resource = applyBaseUrl(input, baseUrl || "");
|
|
1103
|
-
const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
|
|
1104
|
-
return fetch(resource, __spreadProps(__spreadValues({}, init != null ? init : {}), { headers: headers2 }));
|
|
1105
|
-
}
|
|
1106
|
-
);
|
|
1107
|
-
var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
|
|
1108
|
-
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
1109
|
-
if (!initHeaders && !additionalHeaders) {
|
|
1110
|
-
return {};
|
|
1111
|
-
}
|
|
1112
|
-
const headers2 = new Headers(initHeaders);
|
|
1113
|
-
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
1114
|
-
headers2.set(key, value);
|
|
1115
|
-
}
|
|
1116
|
-
return headers2;
|
|
1117
|
-
};
|
|
1118
|
-
function isRelativePath(url = "") {
|
|
1119
|
-
return !["https://", "http://", "data:"].some(
|
|
1120
|
-
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1121
|
-
);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// src/legacy/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
1125
1097
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1126
|
-
var HttpClientContext = (0, import_react4.createContext)(void 0);
|
|
1127
|
-
function HttpClientProvider({ httpClient, children }) {
|
|
1128
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1129
|
-
}
|
|
1130
|
-
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
1131
|
-
const httpClient = (0, import_react4.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
1132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1133
|
-
}
|
|
1134
|
-
var useHttpClient = () => {
|
|
1135
|
-
const contextFetch = (0, import_react4.useContext)(HttpClientContext);
|
|
1136
|
-
return contextFetch != null ? contextFetch : fetch;
|
|
1137
|
-
};
|
|
1138
|
-
var useHasHttpClientProvider = () => {
|
|
1139
|
-
const context = (0, import_react4.useContext)(HttpClientContext);
|
|
1140
|
-
return Boolean(context);
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
1144
|
-
var import_react5 = require("react");
|
|
1145
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1146
1098
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
1147
1099
|
try {
|
|
1148
1100
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -1152,9 +1104,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
1152
1104
|
} catch (e) {
|
|
1153
1105
|
}
|
|
1154
1106
|
};
|
|
1155
|
-
var LogContext = (0,
|
|
1107
|
+
var LogContext = (0, import_react4.createContext)(null);
|
|
1156
1108
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
1157
|
-
const value = (0,
|
|
1109
|
+
const value = (0, import_react4.useMemo)(
|
|
1158
1110
|
() => ({
|
|
1159
1111
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
1160
1112
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -1164,10 +1116,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
1164
1116
|
}),
|
|
1165
1117
|
[onLog, flowId, stepId]
|
|
1166
1118
|
);
|
|
1167
|
-
return /* @__PURE__ */ (0,
|
|
1119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LogContext.Provider, { value, children });
|
|
1168
1120
|
}
|
|
1169
1121
|
var useLogger = () => {
|
|
1170
|
-
const logging = (0,
|
|
1122
|
+
const logging = (0, import_react4.useContext)(LogContext);
|
|
1171
1123
|
if (logging == null) {
|
|
1172
1124
|
throw new Error(
|
|
1173
1125
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -1177,11 +1129,11 @@ var useLogger = () => {
|
|
|
1177
1129
|
};
|
|
1178
1130
|
|
|
1179
1131
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
1180
|
-
var
|
|
1181
|
-
var
|
|
1182
|
-
var FeatureContext = (0,
|
|
1132
|
+
var import_react5 = require("react");
|
|
1133
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1134
|
+
var FeatureContext = (0, import_react5.createContext)([]);
|
|
1183
1135
|
function FeatureContextProvider({ features, children }) {
|
|
1184
|
-
return /* @__PURE__ */ (0,
|
|
1136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FeatureContext.Provider, { value: features, children });
|
|
1185
1137
|
}
|
|
1186
1138
|
|
|
1187
1139
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -1191,11 +1143,6 @@ function isStatus2xx(status) {
|
|
|
1191
1143
|
function isStatus422(status) {
|
|
1192
1144
|
return status === 422;
|
|
1193
1145
|
}
|
|
1194
|
-
function isRelativePath2(url = "") {
|
|
1195
|
-
return !["https://", "http://", "data:"].some(
|
|
1196
|
-
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1197
|
-
);
|
|
1198
|
-
}
|
|
1199
1146
|
|
|
1200
1147
|
// src/legacy/common/validators/types/type-validators.ts
|
|
1201
1148
|
var isString = (value) => typeof value === "string";
|
|
@@ -1902,18 +1849,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
1902
1849
|
};
|
|
1903
1850
|
|
|
1904
1851
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1905
|
-
var
|
|
1852
|
+
var import_react6 = require("react");
|
|
1906
1853
|
function useDebouncedFunction(callback, waitMs) {
|
|
1907
|
-
return (0,
|
|
1854
|
+
return (0, import_react6.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
1908
1855
|
}
|
|
1909
1856
|
|
|
1910
1857
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
1911
|
-
var
|
|
1858
|
+
var import_react7 = require("react");
|
|
1912
1859
|
function useExternal(url) {
|
|
1913
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
1914
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
1860
|
+
const [externalWindow, setExternalWindow] = (0, import_react7.useState)(null);
|
|
1861
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react7.useState)(false);
|
|
1915
1862
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
1916
|
-
(0,
|
|
1863
|
+
(0, import_react7.useEffect)(() => {
|
|
1917
1864
|
if (url) {
|
|
1918
1865
|
setHasManuallyTriggered(false);
|
|
1919
1866
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -1925,6 +1872,58 @@ function useExternal(url) {
|
|
|
1925
1872
|
|
|
1926
1873
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1927
1874
|
var import_react9 = require("react");
|
|
1875
|
+
|
|
1876
|
+
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1877
|
+
var import_react8 = require("react");
|
|
1878
|
+
|
|
1879
|
+
// src/common/utils/api-utils.ts
|
|
1880
|
+
function isRelativePath(url = "") {
|
|
1881
|
+
return !["https://", "http://", "data:"].some(
|
|
1882
|
+
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
// src/common/makeHttpClient/makeHttpClient.ts
|
|
1887
|
+
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
1888
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1889
|
+
(input, init) => {
|
|
1890
|
+
const resource = applyBaseUrl(input, baseUrl || "");
|
|
1891
|
+
const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
|
|
1892
|
+
return fetch(resource, __spreadProps(__spreadValues({}, init != null ? init : {}), { headers: headers2 }));
|
|
1893
|
+
}
|
|
1894
|
+
);
|
|
1895
|
+
var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
|
|
1896
|
+
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
1897
|
+
if (!initHeaders && !additionalHeaders) {
|
|
1898
|
+
return {};
|
|
1899
|
+
}
|
|
1900
|
+
const headers2 = new Headers(initHeaders);
|
|
1901
|
+
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
1902
|
+
headers2.set(key, value);
|
|
1903
|
+
}
|
|
1904
|
+
return headers2;
|
|
1905
|
+
};
|
|
1906
|
+
|
|
1907
|
+
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1908
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1909
|
+
var HttpClientContext = (0, import_react8.createContext)(void 0);
|
|
1910
|
+
function HttpClientProvider({ httpClient, children }) {
|
|
1911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1912
|
+
}
|
|
1913
|
+
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
1914
|
+
const httpClient = (0, import_react8.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
1915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1916
|
+
}
|
|
1917
|
+
var useHttpClient = () => {
|
|
1918
|
+
const contextFetch = (0, import_react8.useContext)(HttpClientContext);
|
|
1919
|
+
return contextFetch != null ? contextFetch : fetch;
|
|
1920
|
+
};
|
|
1921
|
+
var useHasHttpClientProvider = () => {
|
|
1922
|
+
const context = (0, import_react8.useContext)(HttpClientContext);
|
|
1923
|
+
return Boolean(context);
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1928
1927
|
function useExternalStepPolling(polling, onAction) {
|
|
1929
1928
|
const httpClient = useHttpClient();
|
|
1930
1929
|
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
@@ -1984,9 +1983,9 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1984
1983
|
var import_react31 = require("react");
|
|
1985
1984
|
var import_react_intl21 = require("react-intl");
|
|
1986
1985
|
|
|
1987
|
-
// src/
|
|
1986
|
+
// src/common/messages/persist-async.messages.ts
|
|
1988
1987
|
var import_react_intl = require("react-intl");
|
|
1989
|
-
var
|
|
1988
|
+
var persist_async_messages_default = (0, import_react_intl.defineMessages)({
|
|
1990
1989
|
genericError: {
|
|
1991
1990
|
id: "dynamicFlows.PersistAsyncSchema.genericError",
|
|
1992
1991
|
defaultMessage: "Something went wrong, please try again later!",
|
|
@@ -3544,7 +3543,7 @@ function Help(props) {
|
|
|
3544
3543
|
import_components12.Info,
|
|
3545
3544
|
{
|
|
3546
3545
|
className: "m-l-1",
|
|
3547
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components12.Markdown, { children: props.help.markdown }),
|
|
3546
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components12.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
3548
3547
|
presentation: "POPOVER",
|
|
3549
3548
|
size: "sm",
|
|
3550
3549
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -4588,65 +4587,67 @@ function UploadInputAdapter(props) {
|
|
|
4588
4587
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4589
4588
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4590
4589
|
function PersistAsyncBlobSchema(props) {
|
|
4590
|
+
const { model, schema, submitted, required, errors, onChange } = props;
|
|
4591
4591
|
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4592
4592
|
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4593
4593
|
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
4594
4594
|
const [changed, setChanged] = (0, import_react19.useState)(false);
|
|
4595
4595
|
const httpClient = useHttpClient();
|
|
4596
4596
|
const onEvent = useEventDispatcher();
|
|
4597
|
-
|
|
4598
|
-
if (
|
|
4599
|
-
setValidations(getValidationFailures(
|
|
4597
|
+
(0, import_react19.useEffect)(() => {
|
|
4598
|
+
if (submitted) {
|
|
4599
|
+
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
4600
|
+
} else {
|
|
4601
|
+
setValidations([]);
|
|
4600
4602
|
}
|
|
4601
|
-
};
|
|
4602
|
-
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4603
|
+
}, [model, schema, submitted, required]);
|
|
4603
4604
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4604
4605
|
const jsonResponse = await httpResponse.json();
|
|
4605
|
-
const id2 = getIdFromResponse(
|
|
4606
|
-
|
|
4606
|
+
const id2 = getIdFromResponse(schema.persistAsync.idProperty, jsonResponse);
|
|
4607
|
+
onChange({ model: id2, triggerSchema: schema, triggerModel: id2 });
|
|
4607
4608
|
setChanged(true);
|
|
4608
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId:
|
|
4609
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId: schema.$id });
|
|
4609
4610
|
};
|
|
4610
4611
|
const onFailure = async (errorResponse) => {
|
|
4611
4612
|
if (errorResponse.response && isStatus422(errorResponse.response.status)) {
|
|
4612
4613
|
const jsonResponse = await errorResponse.response.json();
|
|
4613
4614
|
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
4614
|
-
setPersistAsyncValidations([
|
|
4615
|
+
setPersistAsyncValidations([schema.persistAsync.param]);
|
|
4615
4616
|
}
|
|
4616
|
-
|
|
4617
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
4617
4618
|
setChanged(true);
|
|
4618
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId:
|
|
4619
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId: schema.$id });
|
|
4619
4620
|
};
|
|
4620
4621
|
const onCancel = () => {
|
|
4621
4622
|
setPersistAsyncValidations(null);
|
|
4622
|
-
|
|
4623
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
4623
4624
|
setChanged(true);
|
|
4624
4625
|
};
|
|
4625
|
-
const { url, method } =
|
|
4626
|
+
const { url, method } = schema.persistAsync;
|
|
4626
4627
|
const combinedValidations = persistAsyncValidations || validations;
|
|
4627
4628
|
const formGroupClasses = {
|
|
4628
4629
|
"form-group": true,
|
|
4629
|
-
"has-error": (
|
|
4630
|
+
"has-error": (submitted || changed) && Boolean(combinedValidations.length)
|
|
4630
4631
|
};
|
|
4631
|
-
const id =
|
|
4632
|
+
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
4632
4633
|
const feedbackId = `${id}-feedback`;
|
|
4633
4634
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4634
4635
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4635
4636
|
UploadInputAdapter,
|
|
4636
4637
|
__spreadValues({
|
|
4637
4638
|
id,
|
|
4638
|
-
fileId:
|
|
4639
|
-
idProperty:
|
|
4639
|
+
fileId: model,
|
|
4640
|
+
idProperty: schema.persistAsync.idProperty,
|
|
4640
4641
|
animationDelay: 0,
|
|
4641
|
-
maxSize:
|
|
4642
|
-
usLabel:
|
|
4643
|
-
usPlaceholder:
|
|
4644
|
-
httpOptions: { url, method, fileInputName:
|
|
4642
|
+
maxSize: schema.persistAsync.schema.maxSize,
|
|
4643
|
+
usLabel: schema.title || schema.persistAsync.schema.title,
|
|
4644
|
+
usPlaceholder: schema.description || schema.persistAsync.schema.description,
|
|
4645
|
+
httpOptions: { url, method, fileInputName: schema.persistAsync.param },
|
|
4645
4646
|
httpClient,
|
|
4646
4647
|
onSuccess,
|
|
4647
4648
|
onFailure,
|
|
4648
4649
|
onCancel
|
|
4649
|
-
}, mapSchemaToUploadOptions(
|
|
4650
|
+
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
4650
4651
|
) }),
|
|
4651
4652
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4652
4653
|
ControlFeedback_default,
|
|
@@ -4655,9 +4656,9 @@ function PersistAsyncBlobSchema(props) {
|
|
|
4655
4656
|
blurred: true,
|
|
4656
4657
|
focused: false,
|
|
4657
4658
|
changed,
|
|
4658
|
-
submitted
|
|
4659
|
-
errors
|
|
4660
|
-
schema
|
|
4659
|
+
submitted,
|
|
4660
|
+
errors,
|
|
4661
|
+
schema,
|
|
4661
4662
|
validations: combinedValidations,
|
|
4662
4663
|
validationMessages: __spreadValues({
|
|
4663
4664
|
required: "Value is required..."
|
|
@@ -5167,7 +5168,7 @@ var readImageBlobAsDataURL = (imageBlob) => (
|
|
|
5167
5168
|
var getImageSource = async (httpClient, imageUrl) => {
|
|
5168
5169
|
var _a;
|
|
5169
5170
|
try {
|
|
5170
|
-
if (
|
|
5171
|
+
if (isRelativePath(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
5171
5172
|
return httpClient(imageUrl, {
|
|
5172
5173
|
method: "GET",
|
|
5173
5174
|
headers: { "Content-Type": "image/image" },
|
|
@@ -5845,7 +5846,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
5845
5846
|
persistAsyncIfValid();
|
|
5846
5847
|
}
|
|
5847
5848
|
}, [persistAsyncModel]);
|
|
5848
|
-
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(
|
|
5849
|
+
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(persist_async_messages_default.genericError));
|
|
5849
5850
|
const getPersistAsyncResponse = async (currentPersistAsyncModel, persistAsyncSpec) => {
|
|
5850
5851
|
const signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
5851
5852
|
const requestBody = { [persistAsyncSpec.param]: currentPersistAsyncModel };
|
|
@@ -5984,10 +5985,10 @@ var usePersistAsync = (persistAsync) => {
|
|
|
5984
5985
|
}
|
|
5985
5986
|
}
|
|
5986
5987
|
}
|
|
5987
|
-
throw new Error(intl.formatMessage(
|
|
5988
|
+
throw new Error(intl.formatMessage(persist_async_messages_default.genericError));
|
|
5988
5989
|
}
|
|
5989
5990
|
const handleError = (error) => {
|
|
5990
|
-
const message = hasStringMessage(error) ? error.message : intl.formatMessage(
|
|
5991
|
+
const message = hasStringMessage(error) ? error.message : intl.formatMessage(persist_async_messages_default.genericError);
|
|
5991
5992
|
throw new Error(message);
|
|
5992
5993
|
};
|
|
5993
5994
|
return handlePersistAsync;
|