@wise/dynamic-flow-client 3.11.0 → 3.11.1
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.mjs
CHANGED
|
@@ -7743,38 +7743,32 @@ var getComponentForLocalValueKey = (key, component) => {
|
|
|
7743
7743
|
|
|
7744
7744
|
// src/revamp/domain/components/utils/isPartialLocalValueMatch.ts
|
|
7745
7745
|
var isPartialLocalValueMatch = (partialValue, component) => {
|
|
7746
|
-
if (
|
|
7747
|
-
|
|
7748
|
-
return partialValue.every((value, index) => {
|
|
7749
|
-
const childComponent = children[index];
|
|
7750
|
-
return childComponent ? isPartialLocalValueMatch(value, childComponent) : false;
|
|
7751
|
-
});
|
|
7746
|
+
if (!component) {
|
|
7747
|
+
return false;
|
|
7752
7748
|
}
|
|
7753
7749
|
const componentValue = component.getLocalValue();
|
|
7754
7750
|
if (component.type === "const") {
|
|
7755
7751
|
return compareLocalValue(partialValue, componentValue);
|
|
7756
7752
|
}
|
|
7757
7753
|
if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
|
|
7758
|
-
|
|
7759
|
-
/* @__PURE__ */ new Set([...Object.keys(partialValue), ...Object.keys(componentValue)])
|
|
7760
|
-
);
|
|
7761
|
-
const matchingKeys = allKeys.filter(
|
|
7762
|
-
(key) => !isNullish(partialValue[key]) && !isNullish(componentValue[key])
|
|
7763
|
-
);
|
|
7764
|
-
return matchingKeys.length > 0 && matchingKeys.every((key) => {
|
|
7765
|
-
const componentForKey = getComponentForLocalValueKey(key, component);
|
|
7766
|
-
return componentForKey ? isPartialLocalValueMatch(partialValue[key], componentForKey) : false;
|
|
7767
|
-
});
|
|
7754
|
+
return isPartialObjectMatch(partialValue, componentValue, component);
|
|
7768
7755
|
}
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7756
|
+
return true;
|
|
7757
|
+
};
|
|
7758
|
+
var isPartialObjectMatch = (partialValue, componentValue, component) => {
|
|
7759
|
+
const resultByKey = getMatchingKeys(partialValue, componentValue).map((key) => {
|
|
7760
|
+
const componentForKey = getComponentForLocalValueKey(key, component);
|
|
7761
|
+
if (componentForKey && componentForKey.type === "const") {
|
|
7762
|
+
return isPartialLocalValueMatch(partialValue[key], componentForKey);
|
|
7763
|
+
}
|
|
7764
|
+
return null;
|
|
7765
|
+
});
|
|
7766
|
+
return resultByKey.includes(true) && !resultByKey.includes(false);
|
|
7767
|
+
};
|
|
7768
|
+
var getMatchingKeys = (a, b) => {
|
|
7769
|
+
const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]));
|
|
7770
|
+
return allKeys.filter((key) => !isNullish(a[key]) && !isNullish(b[key]));
|
|
7776
7771
|
};
|
|
7777
|
-
var areEquivalentFiles = (fileA, fileB) => fileA.name === fileB.name && fileA.type === fileB.type && fileA.size === fileB.size;
|
|
7778
7772
|
|
|
7779
7773
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
7780
7774
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
@@ -8100,6 +8094,19 @@ var toBase64 = async (file) => new Promise((resolve, reject) => {
|
|
|
8100
8094
|
reader.addEventListener("error", reject);
|
|
8101
8095
|
reader.readAsDataURL(file);
|
|
8102
8096
|
});
|
|
8097
|
+
var base64dataUrltoFile = (dataurl, filename) => {
|
|
8098
|
+
if (!isBase64DataUrl(dataurl)) {
|
|
8099
|
+
return null;
|
|
8100
|
+
}
|
|
8101
|
+
const [, base64data] = dataurl.split(",");
|
|
8102
|
+
return new File([base64ToBytes(base64data)], filename, { type: getMimeType(dataurl) });
|
|
8103
|
+
};
|
|
8104
|
+
var isBase64DataUrl = (dataurl) => dataurl.startsWith("data:") && dataurl.includes("base64") && dataurl.includes(",");
|
|
8105
|
+
var getMimeType = (base64dataUrl) => base64dataUrl.substring("data:".length).split(";")[0];
|
|
8106
|
+
var base64ToBytes = (base64) => {
|
|
8107
|
+
const charCodes = atob(base64).split("").map((m) => m.charCodeAt(0));
|
|
8108
|
+
return Uint8Array.from(charCodes);
|
|
8109
|
+
};
|
|
8103
8110
|
|
|
8104
8111
|
// src/revamp/domain/components/UploadInputComponent.ts
|
|
8105
8112
|
var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
@@ -8201,6 +8208,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
|
|
|
8201
8208
|
|
|
8202
8209
|
// src/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.ts
|
|
8203
8210
|
var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
8211
|
+
var _a;
|
|
8204
8212
|
const { schema, localValue, model, required = false } = schemaMapperProps;
|
|
8205
8213
|
const { accepts, autocompleteHint, maxSize, validationMessages } = schema;
|
|
8206
8214
|
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
|
|
@@ -8208,7 +8216,7 @@ var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8208
8216
|
const { performPersistAsync } = getPersistAsyncInitialState(schemaMapperProps, mapperProps);
|
|
8209
8217
|
const persistedState = performPersistAsync ? getInitialPersistedState(null, model) : getInitialPersistedState();
|
|
8210
8218
|
const validLocalValue = isFile(localValue) ? localValue : null;
|
|
8211
|
-
const value =
|
|
8219
|
+
const value = (_a = getFileFromModel(model)) != null ? _a : validLocalValue;
|
|
8212
8220
|
return createUploadInputComponent(
|
|
8213
8221
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8214
8222
|
accepts,
|
|
@@ -8225,6 +8233,7 @@ var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8225
8233
|
updateComponent
|
|
8226
8234
|
);
|
|
8227
8235
|
};
|
|
8236
|
+
var getFileFromModel = (model) => isString(model) ? base64dataUrltoFile(model, "") : null;
|
|
8228
8237
|
|
|
8229
8238
|
// src/revamp/domain/components/TextInputComponent.ts
|
|
8230
8239
|
var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DomainComponent, LocalValue } from '../../types';
|
|
2
|
-
export declare const isPartialLocalValueMatch: (partialValue: LocalValue, component: DomainComponent) => boolean;
|
|
2
|
+
export declare const isPartialLocalValueMatch: (partialValue: LocalValue, component: DomainComponent | null) => boolean;
|