@wise/dynamic-flow-client 2.8.11 → 2.8.14
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 +69 -70
- 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/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/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/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/ObjectComponent.d.ts +0 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +5 -5
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +1 -2
- 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 +2 -2
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +26 -0
- package/build/types/revamp/domain/types.d.ts +14 -6
- package/build/types/revamp/domain/validation/validation-functions.d.ts +1 -2
- 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/type-utils.d.ts +10 -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/package.json +19 -19
- 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/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)(() => {
|
|
@@ -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)
|
|
@@ -5167,7 +5166,7 @@ var readImageBlobAsDataURL = (imageBlob) => (
|
|
|
5167
5166
|
var getImageSource = async (httpClient, imageUrl) => {
|
|
5168
5167
|
var _a;
|
|
5169
5168
|
try {
|
|
5170
|
-
if (
|
|
5169
|
+
if (isRelativePath(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
5171
5170
|
return httpClient(imageUrl, {
|
|
5172
5171
|
method: "GET",
|
|
5173
5172
|
headers: { "Content-Type": "image/image" },
|