@wise/dynamic-flow-client 3.9.3 → 3.10.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 +1252 -957
- package/build/main.min.js +1 -1
- package/build/main.mjs +919 -624
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.InitialAction.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.InitialStep.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.LoaderConfig.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.legacy.spec.d.ts +1 -0
- package/build/types/legacy/formControl/FormControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArrayTypeSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/genericSchema/GenericSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/help/Help.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.spec.d.ts +1 -0
- package/build/types/legacy/layout/DynamicLayout.end-to-end.spec.d.ts +1 -0
- package/build/types/legacy/layout/DynamicLayout.spec.d.ts +1 -0
- package/build/types/legacy/layout/alert/DynamicAlert.spec.d.ts +1 -0
- package/build/types/legacy/layout/box/DynamicBox.spec.d.ts +1 -0
- package/build/types/legacy/layout/columns/DynamicColumns.spec.d.ts +1 -0
- package/build/types/legacy/layout/decision/DynamicDecision.spec.d.ts +1 -0
- package/build/types/legacy/layout/divider/DynamicDivider.spec.d.ts +1 -0
- package/build/types/legacy/layout/external/DynamicExternal.spec.d.ts +1 -0
- package/build/types/legacy/layout/form/DynamicForm.spec.d.ts +1 -0
- package/build/types/legacy/layout/heading/DynamicHeading.spec.d.ts +1 -0
- package/build/types/legacy/layout/paragraph/DynamicParagraph.spec.d.ts +1 -0
- package/build/types/legacy/step/layoutStep/LayoutStep.spec.d.ts +1 -0
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +28 -0
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/utils/local-value.d.ts +2 -0
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +2 -1
- package/build/types/revamp/domain/features/validationAsync/getComponentValidationAsync.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.d.ts +8 -0
- package/build/types/revamp/domain/types.d.ts +4 -3
- package/build/types/revamp/renderers/mappers/multiSelectComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/types.d.ts +9 -1
- package/build/types/revamp/types.d.ts +2 -2
- package/build/types/revamp/wise/renderers/MultiSelectInputRenderer.d.ts +4 -0
- package/build/types/revamp/wise/renderers/getWiseRenderers.d.ts +1 -1
- package/package.json +4 -4
package/build/main.mjs
CHANGED
|
@@ -297,16 +297,10 @@ var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePa
|
|
|
297
297
|
var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
|
|
298
298
|
headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
|
|
299
299
|
});
|
|
300
|
-
var mergeHeaders = (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const headers2 = new Headers(initHeaders);
|
|
305
|
-
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
306
|
-
headers2.set(key, value);
|
|
307
|
-
}
|
|
308
|
-
return headers2;
|
|
309
|
-
};
|
|
300
|
+
var mergeHeaders = (...headersInits) => headersInits.reduce(
|
|
301
|
+
(acc, headers2) => __spreadValues(__spreadValues({}, acc), Object.fromEntries(new Headers(headers2).entries())),
|
|
302
|
+
{}
|
|
303
|
+
);
|
|
310
304
|
|
|
311
305
|
// src/i18n/de.json
|
|
312
306
|
var de_default = {
|
|
@@ -1691,6 +1685,17 @@ var textInputComponentToProps = (component) => __spreadProps(__spreadValues({},
|
|
|
1691
1685
|
onChange: component.onChange.bind(component)
|
|
1692
1686
|
});
|
|
1693
1687
|
|
|
1688
|
+
// src/revamp/renderers/mappers/multiSelectComponentToProps.ts
|
|
1689
|
+
var multiSelectInputComponentToProps = (component) => {
|
|
1690
|
+
const { options, selectedIndices, onSelect } = component;
|
|
1691
|
+
const _a = inputComponentToProps(component, "input-multi-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
1692
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
1693
|
+
options,
|
|
1694
|
+
selectedIndices,
|
|
1695
|
+
onSelect: onSelect.bind(component)
|
|
1696
|
+
});
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1694
1699
|
// src/revamp/renderers/mappers/uploadInputComponentToProps.ts
|
|
1695
1700
|
var uploadInputComponentToProps = (component) => {
|
|
1696
1701
|
const { accepts, maxSize } = component;
|
|
@@ -1748,6 +1753,8 @@ var componentToRendererProps = (component, nestedContent) => {
|
|
|
1748
1753
|
return markdownComponentToProps(component);
|
|
1749
1754
|
case "modal":
|
|
1750
1755
|
return modalComponentToProps(component, children);
|
|
1756
|
+
case "multi-select":
|
|
1757
|
+
return multiSelectInputComponentToProps(component);
|
|
1751
1758
|
case "multi-upload":
|
|
1752
1759
|
return multiUploadInputComponentToProps(component);
|
|
1753
1760
|
case "number":
|
|
@@ -6708,6 +6715,17 @@ var abortAndResetController = (abortController) => {
|
|
|
6708
6715
|
return new AbortController();
|
|
6709
6716
|
};
|
|
6710
6717
|
|
|
6718
|
+
// src/revamp/domain/components/utils/local-value.ts
|
|
6719
|
+
var compareLocalValue = (valueA, valueB) => {
|
|
6720
|
+
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
6721
|
+
return valueA.length === valueB.length && valueA.every((value, index) => compareLocalValue(value, valueB[index]));
|
|
6722
|
+
}
|
|
6723
|
+
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
6724
|
+
return Object.keys(valueA).every((key) => compareLocalValue(valueA[key], valueB[key]));
|
|
6725
|
+
}
|
|
6726
|
+
return valueA === valueB;
|
|
6727
|
+
};
|
|
6728
|
+
|
|
6711
6729
|
// src/revamp/domain/features/persistAsync/getComponentPersistAsync.ts
|
|
6712
6730
|
var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
6713
6731
|
/**
|
|
@@ -6716,7 +6734,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
6716
6734
|
*/
|
|
6717
6735
|
async (persistedState, currentValue) => {
|
|
6718
6736
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
6719
|
-
if (lastSubmitted
|
|
6737
|
+
if (compareLocalValue(lastSubmitted, currentValue)) {
|
|
6720
6738
|
return submission;
|
|
6721
6739
|
}
|
|
6722
6740
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7761,7 +7779,7 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
7761
7779
|
const matchingKeys = allKeys.filter(
|
|
7762
7780
|
(key) => !isNullish(partialValue[key]) && !isNullish(componentValue[key])
|
|
7763
7781
|
);
|
|
7764
|
-
return matchingKeys.every((key) => {
|
|
7782
|
+
return matchingKeys.length > 0 && matchingKeys.every((key) => {
|
|
7765
7783
|
const componentForKey = getComponentForLocalValueKey(key, component);
|
|
7766
7784
|
return componentForKey ? isPartialLocalValueMatch(partialValue[key], componentForKey) : false;
|
|
7767
7785
|
});
|
|
@@ -7775,15 +7793,6 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
7775
7793
|
return compareLocalValue(partialValue, componentValue);
|
|
7776
7794
|
};
|
|
7777
7795
|
var areEquivalentFiles = (fileA, fileB) => fileA.name === fileB.name && fileA.type === fileB.type && fileA.size === fileB.size;
|
|
7778
|
-
var compareLocalValue = (valueA, valueB) => {
|
|
7779
|
-
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7780
|
-
return valueA.length === valueB.length && valueA.every((value, index) => compareLocalValue(value, valueB[index]));
|
|
7781
|
-
}
|
|
7782
|
-
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7783
|
-
return Object.keys(valueA).every((key) => compareLocalValue(valueA[key], valueB[key]));
|
|
7784
|
-
}
|
|
7785
|
-
return valueA === valueB;
|
|
7786
|
-
};
|
|
7787
7796
|
|
|
7788
7797
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
7789
7798
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
@@ -8751,6 +8760,193 @@ var getPersistAsyncConfig = (schema) => {
|
|
|
8751
8760
|
};
|
|
8752
8761
|
var getValueForPersistAsync = (localValue) => isArray(localValue) && localValue.every(isFile) ? localValue : [];
|
|
8753
8762
|
|
|
8763
|
+
// src/revamp/domain/components/MultiSelectInputComponent.ts
|
|
8764
|
+
var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
8765
|
+
const _a = multiSelectProps, {
|
|
8766
|
+
uid,
|
|
8767
|
+
checks,
|
|
8768
|
+
options,
|
|
8769
|
+
initialValue,
|
|
8770
|
+
performPersistAsync,
|
|
8771
|
+
performValidationAsync,
|
|
8772
|
+
performRefresh,
|
|
8773
|
+
onValueChange
|
|
8774
|
+
} = _a, rest = __objRest(_a, [
|
|
8775
|
+
"uid",
|
|
8776
|
+
"checks",
|
|
8777
|
+
"options",
|
|
8778
|
+
"initialValue",
|
|
8779
|
+
"performPersistAsync",
|
|
8780
|
+
"performValidationAsync",
|
|
8781
|
+
"performRefresh",
|
|
8782
|
+
"onValueChange"
|
|
8783
|
+
]);
|
|
8784
|
+
const update = getInputUpdateFunction(uid, updateComponent);
|
|
8785
|
+
const children = options.map((option) => option.component);
|
|
8786
|
+
const selectedIndices = getInitialModelIndices(initialValue, children);
|
|
8787
|
+
const getValidationErrors = getLocalValueValidator(checks);
|
|
8788
|
+
const getAndSetValidationErrors = (currentValue) => {
|
|
8789
|
+
const messages = getValidationErrors(currentValue);
|
|
8790
|
+
update((draft) => {
|
|
8791
|
+
draft.errors = messages;
|
|
8792
|
+
});
|
|
8793
|
+
return messages;
|
|
8794
|
+
};
|
|
8795
|
+
const inputComponent = __spreadProps(__spreadValues({
|
|
8796
|
+
uid,
|
|
8797
|
+
type: "multi-select",
|
|
8798
|
+
children,
|
|
8799
|
+
options,
|
|
8800
|
+
selectedIndices,
|
|
8801
|
+
value: null
|
|
8802
|
+
}, rest), {
|
|
8803
|
+
onSelect(indices) {
|
|
8804
|
+
update((draft) => {
|
|
8805
|
+
draft.selectedIndices = indices;
|
|
8806
|
+
draft.errors = [];
|
|
8807
|
+
});
|
|
8808
|
+
performRefresh == null ? void 0 : performRefresh();
|
|
8809
|
+
onValueChange();
|
|
8810
|
+
getAndSetValidationErrors(this.getLocalValue());
|
|
8811
|
+
},
|
|
8812
|
+
onBlur() {
|
|
8813
|
+
},
|
|
8814
|
+
// Noop
|
|
8815
|
+
onFocus() {
|
|
8816
|
+
},
|
|
8817
|
+
// Noop
|
|
8818
|
+
getLocalValue() {
|
|
8819
|
+
var _a2, _b;
|
|
8820
|
+
return (_b = (_a2 = this.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getLocalValue())) != null ? _b : null;
|
|
8821
|
+
},
|
|
8822
|
+
validate() {
|
|
8823
|
+
const messages = getAndSetValidationErrors(this.getLocalValue());
|
|
8824
|
+
return messages.length === 0;
|
|
8825
|
+
},
|
|
8826
|
+
async getSubmittableValue() {
|
|
8827
|
+
const selected = this.getSelectedChildren();
|
|
8828
|
+
if (selected) {
|
|
8829
|
+
return Promise.all(selected.map(async (child) => child.getSubmittableValue()));
|
|
8830
|
+
}
|
|
8831
|
+
return null;
|
|
8832
|
+
},
|
|
8833
|
+
getSummary: () => ({}),
|
|
8834
|
+
getChildren() {
|
|
8835
|
+
return this.children;
|
|
8836
|
+
},
|
|
8837
|
+
getSelectedChildren() {
|
|
8838
|
+
return this.selectedIndices.map((i) => this.children[i]);
|
|
8839
|
+
}
|
|
8840
|
+
});
|
|
8841
|
+
if (performRefresh) {
|
|
8842
|
+
return inputComponent;
|
|
8843
|
+
}
|
|
8844
|
+
if (performPersistAsync) {
|
|
8845
|
+
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8846
|
+
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8847
|
+
isPersisted: true,
|
|
8848
|
+
onSelect(indices) {
|
|
8849
|
+
inputComponent.onSelect.call(this, indices);
|
|
8850
|
+
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
8851
|
+
if (isValid2 && indices != null) {
|
|
8852
|
+
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
8853
|
+
});
|
|
8854
|
+
}
|
|
8855
|
+
},
|
|
8856
|
+
async getSubmittableValue() {
|
|
8857
|
+
return persist(this.persistedState, this.getLocalValue());
|
|
8858
|
+
}
|
|
8859
|
+
});
|
|
8860
|
+
}
|
|
8861
|
+
if (performValidationAsync) {
|
|
8862
|
+
const validateAsync = getComponentValidationAsync(update, performValidationAsync);
|
|
8863
|
+
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8864
|
+
onSelect(indices) {
|
|
8865
|
+
inputComponent.onSelect.call(this, indices);
|
|
8866
|
+
if (this.validate()) {
|
|
8867
|
+
validateAsync(this.validationState, this.getLocalValue()).catch(() => {
|
|
8868
|
+
});
|
|
8869
|
+
}
|
|
8870
|
+
}
|
|
8871
|
+
});
|
|
8872
|
+
}
|
|
8873
|
+
return inputComponent;
|
|
8874
|
+
};
|
|
8875
|
+
var getInitialModelIndices = (model, options) => {
|
|
8876
|
+
if (!isArray(model)) {
|
|
8877
|
+
return [];
|
|
8878
|
+
}
|
|
8879
|
+
return model.map((m) => options.findIndex((o) => o.getLocalValue() === m)).filter((n) => n >= 0);
|
|
8880
|
+
};
|
|
8881
|
+
|
|
8882
|
+
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.ts
|
|
8883
|
+
var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
8884
|
+
const {
|
|
8885
|
+
uid,
|
|
8886
|
+
localValue,
|
|
8887
|
+
schema,
|
|
8888
|
+
model,
|
|
8889
|
+
required = false,
|
|
8890
|
+
validationErrors: initialError
|
|
8891
|
+
} = schemaMapperProps;
|
|
8892
|
+
const initialModel = model != null ? model : null;
|
|
8893
|
+
const options = schema.items.oneOf.map((childSchema, index) => {
|
|
8894
|
+
const { title: title2 = "", description, image, icon, keywords = [] } = childSchema;
|
|
8895
|
+
return {
|
|
8896
|
+
title: title2,
|
|
8897
|
+
description,
|
|
8898
|
+
image,
|
|
8899
|
+
icon,
|
|
8900
|
+
keywords,
|
|
8901
|
+
disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
|
|
8902
|
+
component: mapSchemaToComponent(
|
|
8903
|
+
{
|
|
8904
|
+
uid: `${uid}.oneOf-${index}`,
|
|
8905
|
+
schema: childSchema,
|
|
8906
|
+
model: initialModel,
|
|
8907
|
+
localValue,
|
|
8908
|
+
validationErrors: initialError,
|
|
8909
|
+
required
|
|
8910
|
+
},
|
|
8911
|
+
mapperProps
|
|
8912
|
+
)
|
|
8913
|
+
};
|
|
8914
|
+
});
|
|
8915
|
+
const { title, validationMessages } = schema;
|
|
8916
|
+
const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
|
|
8917
|
+
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8918
|
+
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
8919
|
+
schemaMapperProps,
|
|
8920
|
+
mapperProps
|
|
8921
|
+
);
|
|
8922
|
+
const { performValidationAsync, validationState } = getValidationAsyncInitialState(
|
|
8923
|
+
schemaMapperProps,
|
|
8924
|
+
mapperProps
|
|
8925
|
+
);
|
|
8926
|
+
const initialValue = performPersistAsync ? localValue : model != null ? model : null;
|
|
8927
|
+
return createMultiSelectComponent(
|
|
8928
|
+
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8929
|
+
autoComplete: "off",
|
|
8930
|
+
checks: schema.hidden ? [] : [
|
|
8931
|
+
getRequiredCheck(required, errorMessageFunctions),
|
|
8932
|
+
getAboveMaxItemsCheck(schema, errorMessageFunctions),
|
|
8933
|
+
getBelowMinItemsCheck(schema, errorMessageFunctions)
|
|
8934
|
+
],
|
|
8935
|
+
initialValue,
|
|
8936
|
+
options,
|
|
8937
|
+
required,
|
|
8938
|
+
persistedState,
|
|
8939
|
+
performPersistAsync,
|
|
8940
|
+
title,
|
|
8941
|
+
validationState,
|
|
8942
|
+
performValidationAsync,
|
|
8943
|
+
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8944
|
+
onValueChange
|
|
8945
|
+
}),
|
|
8946
|
+
updateComponent
|
|
8947
|
+
);
|
|
8948
|
+
};
|
|
8949
|
+
|
|
8754
8950
|
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.ts
|
|
8755
8951
|
var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
8756
8952
|
const { schema, model: originalModel } = schemaMapperProps;
|
|
@@ -8758,6 +8954,9 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8758
8954
|
if (isArraySchemaListWithMultiFileUpload(schema)) {
|
|
8759
8955
|
return arraySchemaToMultiUploadComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8760
8956
|
}
|
|
8957
|
+
if (isArraySchemaListWithMultiSelect(schema)) {
|
|
8958
|
+
return arraySchemaToMultiSelectComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8959
|
+
}
|
|
8761
8960
|
if (isArrayListSchema(schema)) {
|
|
8762
8961
|
return arraySchemaToRepeatableComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8763
8962
|
}
|
|
@@ -8765,6 +8964,7 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8765
8964
|
};
|
|
8766
8965
|
var isArraySchemaListWithMultiFileUpload = (schema) => isArrayListSchema(schema) && (isPersistAsyncWithUploadSchema(schema.items) || isStringSchemaWithUpload(schema.items));
|
|
8767
8966
|
var isPersistAsyncWithUploadSchema = (schema) => isSchemaWithPersistAsync(schema) && (isBlobSchema(schema.persistAsync.schema) || isStringSchemaWithUpload(schema.persistAsync.schema));
|
|
8967
|
+
var isArraySchemaListWithMultiSelect = (schema) => isArrayListSchema(schema) && "oneOf" in schema.items && schema.items.oneOf.every(isConstSchema);
|
|
8768
8968
|
|
|
8769
8969
|
// src/revamp/domain/components/BooleanInputComponent.ts
|
|
8770
8970
|
var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
@@ -10202,7 +10402,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10202
10402
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10203
10403
|
}
|
|
10204
10404
|
|
|
10205
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.
|
|
10405
|
+
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.35.0_@types+react@18.0.29_react@18.2.0/node_modules/@wise/forms/dist/index.mjs
|
|
10206
10406
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10207
10407
|
import { InlineAlert, Sentiment as Sentiment2, Input, TextArea } from "@transferwise/components";
|
|
10208
10408
|
import { createContext as createContext2, useContext as useContext2, forwardRef } from "react";
|
|
@@ -10990,13 +11190,131 @@ function DFModal({ content, margin, trigger }) {
|
|
|
10990
11190
|
] });
|
|
10991
11191
|
}
|
|
10992
11192
|
|
|
11193
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11194
|
+
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
11195
|
+
|
|
11196
|
+
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11197
|
+
import { Avatar as Avatar2, AvatarType as AvatarType2 } from "@transferwise/components";
|
|
11198
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
11199
|
+
function OptionMedia({ icon, image }) {
|
|
11200
|
+
if (image == null ? void 0 : image.url) {
|
|
11201
|
+
return /* @__PURE__ */ jsx34("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
11202
|
+
}
|
|
11203
|
+
if (icon && "name" in icon) {
|
|
11204
|
+
return /* @__PURE__ */ jsx34(Avatar2, { type: AvatarType2.ICON, children: /* @__PURE__ */ jsx34(DynamicIcon_default, { name: icon.name }) });
|
|
11205
|
+
}
|
|
11206
|
+
if (icon && "text" in icon) {
|
|
11207
|
+
return /* @__PURE__ */ jsx34(Avatar2, { type: AvatarType2.INITIALS, children: icon.text });
|
|
11208
|
+
}
|
|
11209
|
+
return null;
|
|
11210
|
+
}
|
|
11211
|
+
|
|
11212
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11213
|
+
import { useIntl as useIntl4 } from "react-intl";
|
|
11214
|
+
|
|
11215
|
+
// src/common/messages/multi-select.messages.ts
|
|
11216
|
+
import { defineMessages as defineMessages6 } from "react-intl";
|
|
11217
|
+
var multi_select_messages_default = defineMessages6({
|
|
11218
|
+
summary: {
|
|
11219
|
+
id: "dynamicFlows.MultiSelect.summary",
|
|
11220
|
+
defaultMessage: "{first} and {count} more",
|
|
11221
|
+
description: "A summary of the multiple items selected. Showing the title of the first selected item, and the number of other items that have been selected."
|
|
11222
|
+
}
|
|
11223
|
+
});
|
|
11224
|
+
|
|
11225
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11226
|
+
import { useState as useState6 } from "react";
|
|
11227
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
11228
|
+
var MultiSelectInputRenderer = {
|
|
11229
|
+
canRenderType: "input-multi-select",
|
|
11230
|
+
render: (props) => /* @__PURE__ */ jsx35(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
11231
|
+
};
|
|
11232
|
+
function MultiSelectInputRendererComponent(props) {
|
|
11233
|
+
const { formatMessage } = useIntl4();
|
|
11234
|
+
const [stagedIndices, setStagedIndices] = useState6();
|
|
11235
|
+
const {
|
|
11236
|
+
id,
|
|
11237
|
+
description,
|
|
11238
|
+
disabled,
|
|
11239
|
+
label,
|
|
11240
|
+
help,
|
|
11241
|
+
error,
|
|
11242
|
+
options,
|
|
11243
|
+
placeholder,
|
|
11244
|
+
selectedIndices,
|
|
11245
|
+
onSelect
|
|
11246
|
+
} = props;
|
|
11247
|
+
const mergedIndices = stagedIndices != null ? stagedIndices : selectedIndices;
|
|
11248
|
+
const getFormattedMessage = () => {
|
|
11249
|
+
if (mergedIndices.length > 0) {
|
|
11250
|
+
if (mergedIndices.length > 1) {
|
|
11251
|
+
return formatMessage(multi_select_messages_default.summary, {
|
|
11252
|
+
first: options[mergedIndices[0]].title,
|
|
11253
|
+
count: mergedIndices.length - 1
|
|
11254
|
+
});
|
|
11255
|
+
}
|
|
11256
|
+
return options[mergedIndices[0]].title;
|
|
11257
|
+
}
|
|
11258
|
+
return void 0;
|
|
11259
|
+
};
|
|
11260
|
+
const renderValue = (index, withinTrigger) => {
|
|
11261
|
+
const option = index >= 0 ? options[index] : null;
|
|
11262
|
+
if (option === null) {
|
|
11263
|
+
return null;
|
|
11264
|
+
}
|
|
11265
|
+
if (withinTrigger) {
|
|
11266
|
+
return index === mergedIndices[0] ? getFormattedMessage() : void 0;
|
|
11267
|
+
}
|
|
11268
|
+
const contentProps = {
|
|
11269
|
+
title: option.title,
|
|
11270
|
+
description: option.description,
|
|
11271
|
+
icon: /* @__PURE__ */ jsx35(OptionMedia, { icon: option.icon, image: option.image })
|
|
11272
|
+
};
|
|
11273
|
+
return /* @__PURE__ */ jsx35(SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
11274
|
+
};
|
|
11275
|
+
return /* @__PURE__ */ jsx35(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx35(
|
|
11276
|
+
SelectInput,
|
|
11277
|
+
{
|
|
11278
|
+
id,
|
|
11279
|
+
items: options.map((option, index) => {
|
|
11280
|
+
var _a, _b, _c;
|
|
11281
|
+
return {
|
|
11282
|
+
type: "option",
|
|
11283
|
+
value: index,
|
|
11284
|
+
filterMatchers: [
|
|
11285
|
+
...(_a = option.keywords) != null ? _a : [],
|
|
11286
|
+
(_b = option.title) != null ? _b : "",
|
|
11287
|
+
(_c = option.description) != null ? _c : ""
|
|
11288
|
+
],
|
|
11289
|
+
disabled: option.disabled
|
|
11290
|
+
};
|
|
11291
|
+
}),
|
|
11292
|
+
disabled,
|
|
11293
|
+
placeholder,
|
|
11294
|
+
value: mergedIndices,
|
|
11295
|
+
renderValue,
|
|
11296
|
+
multiple: true,
|
|
11297
|
+
onChange: (values) => {
|
|
11298
|
+
setStagedIndices(values);
|
|
11299
|
+
},
|
|
11300
|
+
onClose: () => {
|
|
11301
|
+
if (stagedIndices) {
|
|
11302
|
+
onSelect(stagedIndices);
|
|
11303
|
+
setStagedIndices(void 0);
|
|
11304
|
+
}
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
) });
|
|
11308
|
+
}
|
|
11309
|
+
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
11310
|
+
|
|
10993
11311
|
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
10994
11312
|
import { UploadInput } from "@transferwise/components";
|
|
10995
11313
|
|
|
10996
11314
|
// src/revamp/wise/renderers/components/UploadFieldInput.tsx
|
|
10997
11315
|
var import_classnames4 = __toESM(require_classnames());
|
|
10998
11316
|
import { InlineAlert as InlineAlert2 } from "@transferwise/components";
|
|
10999
|
-
import { jsx as
|
|
11317
|
+
import { jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
11000
11318
|
function UploadFieldInput({
|
|
11001
11319
|
id,
|
|
11002
11320
|
children,
|
|
@@ -11005,7 +11323,7 @@ function UploadFieldInput({
|
|
|
11005
11323
|
error,
|
|
11006
11324
|
help
|
|
11007
11325
|
}) {
|
|
11008
|
-
const labelContent = label && help ? /* @__PURE__ */
|
|
11326
|
+
const labelContent = label && help ? /* @__PURE__ */ jsx36(LabelContentWithHelp, { text: label, help }) : label;
|
|
11009
11327
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
11010
11328
|
return /* @__PURE__ */ jsxs9(
|
|
11011
11329
|
"div",
|
|
@@ -11014,9 +11332,9 @@ function UploadFieldInput({
|
|
|
11014
11332
|
"has-error": !!error
|
|
11015
11333
|
}),
|
|
11016
11334
|
children: [
|
|
11017
|
-
/* @__PURE__ */
|
|
11335
|
+
/* @__PURE__ */ jsx36("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
11018
11336
|
children,
|
|
11019
|
-
error && /* @__PURE__ */
|
|
11337
|
+
error && /* @__PURE__ */ jsx36(InlineAlert2, { type: "negative", id: descriptionId, children: error })
|
|
11020
11338
|
]
|
|
11021
11339
|
}
|
|
11022
11340
|
);
|
|
@@ -11059,7 +11377,7 @@ var nanoid = (size = 21) => {
|
|
|
11059
11377
|
var getRandomId = () => nanoid(10);
|
|
11060
11378
|
|
|
11061
11379
|
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
11062
|
-
import { jsx as
|
|
11380
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
11063
11381
|
var MultiUploadInputRenderer = {
|
|
11064
11382
|
canRenderType: "input-upload-multi",
|
|
11065
11383
|
render: (props) => {
|
|
@@ -11086,7 +11404,7 @@ var MultiUploadInputRenderer = {
|
|
|
11086
11404
|
};
|
|
11087
11405
|
const onDeleteFile = async (fileId) => onDelete(String(fileId));
|
|
11088
11406
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
11089
|
-
return /* @__PURE__ */
|
|
11407
|
+
return /* @__PURE__ */ jsx37(UploadFieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx37(
|
|
11090
11408
|
UploadInput,
|
|
11091
11409
|
{
|
|
11092
11410
|
id,
|
|
@@ -11109,12 +11427,12 @@ var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
|
11109
11427
|
|
|
11110
11428
|
// src/revamp/wise/renderers/NumberInputRenderer.tsx
|
|
11111
11429
|
import { Input as Input3 } from "@transferwise/components";
|
|
11112
|
-
import { jsx as
|
|
11430
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
11113
11431
|
var NumberInputRenderer = {
|
|
11114
11432
|
canRenderType: "input-number",
|
|
11115
11433
|
render: (props) => {
|
|
11116
11434
|
const _a = props, { id, label, error, description, help, type, value, onChange } = _a, rest = __objRest(_a, ["id", "label", "error", "description", "help", "type", "value", "onChange"]);
|
|
11117
|
-
return /* @__PURE__ */
|
|
11435
|
+
return /* @__PURE__ */ jsx38(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx38(
|
|
11118
11436
|
Input3,
|
|
11119
11437
|
__spreadValues({
|
|
11120
11438
|
id,
|
|
@@ -11133,7 +11451,7 @@ var NumberInputRenderer = {
|
|
|
11133
11451
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
11134
11452
|
|
|
11135
11453
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11136
|
-
import { useIntl as
|
|
11454
|
+
import { useIntl as useIntl5 } from "react-intl";
|
|
11137
11455
|
|
|
11138
11456
|
// src/revamp/wise/renderers/hooks/useSnackBarIfAvailable.ts
|
|
11139
11457
|
import { SnackbarContext } from "@transferwise/components";
|
|
@@ -11149,8 +11467,8 @@ var import_classnames5 = __toESM(require_classnames());
|
|
|
11149
11467
|
import { Button as Button3, Input as Input4 } from "@transferwise/components";
|
|
11150
11468
|
|
|
11151
11469
|
// src/common/messages/paragraph.messages.ts
|
|
11152
|
-
import { defineMessages as
|
|
11153
|
-
var paragraph_messages_default =
|
|
11470
|
+
import { defineMessages as defineMessages7 } from "react-intl";
|
|
11471
|
+
var paragraph_messages_default = defineMessages7({
|
|
11154
11472
|
copy: {
|
|
11155
11473
|
id: "dynamicFlows.DynamicParagraph.copy",
|
|
11156
11474
|
defaultMessage: "Copy",
|
|
@@ -11164,24 +11482,24 @@ var paragraph_messages_default = defineMessages6({
|
|
|
11164
11482
|
});
|
|
11165
11483
|
|
|
11166
11484
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11167
|
-
import { jsx as
|
|
11485
|
+
import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
11168
11486
|
var ParagraphRenderer = {
|
|
11169
11487
|
canRenderType: "paragraph",
|
|
11170
|
-
render: (props) => /* @__PURE__ */
|
|
11488
|
+
render: (props) => /* @__PURE__ */ jsx39(Paragraph, __spreadValues({}, props))
|
|
11171
11489
|
};
|
|
11172
11490
|
function Paragraph({ align, control, margin, text }) {
|
|
11173
11491
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
11174
|
-
return control === "copyable" ? /* @__PURE__ */
|
|
11492
|
+
return control === "copyable" ? /* @__PURE__ */ jsx39(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ jsx39(StandardParagraph, { className, text });
|
|
11175
11493
|
}
|
|
11176
11494
|
function StandardParagraph({ text, className }) {
|
|
11177
|
-
return /* @__PURE__ */
|
|
11495
|
+
return /* @__PURE__ */ jsx39("p", { className, children: text });
|
|
11178
11496
|
}
|
|
11179
11497
|
function CopyableParagraph({
|
|
11180
11498
|
text,
|
|
11181
11499
|
align,
|
|
11182
11500
|
className
|
|
11183
11501
|
}) {
|
|
11184
|
-
const { formatMessage } =
|
|
11502
|
+
const { formatMessage } = useIntl5();
|
|
11185
11503
|
const createSnackbar = useSnackBarIfAvailable();
|
|
11186
11504
|
const copy = () => {
|
|
11187
11505
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
@@ -11189,7 +11507,7 @@ function CopyableParagraph({
|
|
|
11189
11507
|
};
|
|
11190
11508
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
11191
11509
|
return /* @__PURE__ */ jsxs10("div", { className, children: [
|
|
11192
|
-
/* @__PURE__ */
|
|
11510
|
+
/* @__PURE__ */ jsx39(
|
|
11193
11511
|
Input4,
|
|
11194
11512
|
{
|
|
11195
11513
|
type: "text",
|
|
@@ -11198,20 +11516,20 @@ function CopyableParagraph({
|
|
|
11198
11516
|
className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
|
|
11199
11517
|
}
|
|
11200
11518
|
),
|
|
11201
|
-
/* @__PURE__ */
|
|
11519
|
+
/* @__PURE__ */ jsx39(Button3, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
11202
11520
|
] });
|
|
11203
11521
|
}
|
|
11204
11522
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
11205
11523
|
|
|
11206
11524
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11207
11525
|
import { Button as Button4, Header as Header3, Modal as Modal2, NavigationOption as NavigationOption2, InlineAlert as InlineAlert3 } from "@transferwise/components";
|
|
11208
|
-
import { useState as
|
|
11526
|
+
import { useState as useState7 } from "react";
|
|
11209
11527
|
import { Plus } from "@transferwise/icons";
|
|
11210
|
-
import { useIntl as
|
|
11528
|
+
import { useIntl as useIntl6 } from "react-intl";
|
|
11211
11529
|
|
|
11212
11530
|
// src/common/messages/repeatable.messages.ts
|
|
11213
|
-
import { defineMessages as
|
|
11214
|
-
var repeatable_messages_default =
|
|
11531
|
+
import { defineMessages as defineMessages8 } from "react-intl";
|
|
11532
|
+
var repeatable_messages_default = defineMessages8({
|
|
11215
11533
|
addItemTitle: {
|
|
11216
11534
|
id: "dynamicFlows.ArraySchema.addItemTitle",
|
|
11217
11535
|
defaultMessage: "Add Item",
|
|
@@ -11236,10 +11554,10 @@ var repeatable_messages_default = defineMessages7({
|
|
|
11236
11554
|
|
|
11237
11555
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11238
11556
|
var import_classnames6 = __toESM(require_classnames());
|
|
11239
|
-
import { Fragment as Fragment4, jsx as
|
|
11557
|
+
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
11240
11558
|
var RepeatableRenderer = {
|
|
11241
11559
|
canRenderType: "repeatable",
|
|
11242
|
-
render: (props) => /* @__PURE__ */
|
|
11560
|
+
render: (props) => /* @__PURE__ */ jsx40(Repeatable, __spreadValues({}, props))
|
|
11243
11561
|
};
|
|
11244
11562
|
function Repeatable(props) {
|
|
11245
11563
|
const {
|
|
@@ -11255,8 +11573,8 @@ function Repeatable(props) {
|
|
|
11255
11573
|
onSave,
|
|
11256
11574
|
onRemove
|
|
11257
11575
|
} = props;
|
|
11258
|
-
const { formatMessage } =
|
|
11259
|
-
const [openModalType, setOpenModalType] =
|
|
11576
|
+
const { formatMessage } = useIntl6();
|
|
11577
|
+
const [openModalType, setOpenModalType] = useState7(null);
|
|
11260
11578
|
const onAddItem = () => {
|
|
11261
11579
|
onAdd();
|
|
11262
11580
|
setOpenModalType("add");
|
|
@@ -11279,8 +11597,8 @@ function Repeatable(props) {
|
|
|
11279
11597
|
setOpenModalType(null);
|
|
11280
11598
|
};
|
|
11281
11599
|
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
11282
|
-
title && /* @__PURE__ */
|
|
11283
|
-
description && /* @__PURE__ */
|
|
11600
|
+
title && /* @__PURE__ */ jsx40(Header3, { title }),
|
|
11601
|
+
description && /* @__PURE__ */ jsx40("p", { children: description }),
|
|
11284
11602
|
/* @__PURE__ */ jsxs11(
|
|
11285
11603
|
"div",
|
|
11286
11604
|
{
|
|
@@ -11288,30 +11606,30 @@ function Repeatable(props) {
|
|
|
11288
11606
|
"has-error": error
|
|
11289
11607
|
}),
|
|
11290
11608
|
children: [
|
|
11291
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */
|
|
11292
|
-
/* @__PURE__ */
|
|
11609
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx40(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
11610
|
+
/* @__PURE__ */ jsx40(
|
|
11293
11611
|
NavigationOption2,
|
|
11294
11612
|
{
|
|
11295
|
-
media: /* @__PURE__ */
|
|
11613
|
+
media: /* @__PURE__ */ jsx40(Plus, {}),
|
|
11296
11614
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11297
11615
|
showMediaAtAllSizes: true,
|
|
11298
11616
|
onClick: () => onAddItem()
|
|
11299
11617
|
}
|
|
11300
11618
|
),
|
|
11301
|
-
error && /* @__PURE__ */
|
|
11619
|
+
error && /* @__PURE__ */ jsx40(InlineAlert3, { type: "negative", children: error })
|
|
11302
11620
|
]
|
|
11303
11621
|
}
|
|
11304
11622
|
),
|
|
11305
|
-
/* @__PURE__ */
|
|
11623
|
+
/* @__PURE__ */ jsx40(
|
|
11306
11624
|
Modal2,
|
|
11307
11625
|
{
|
|
11308
11626
|
open: openModalType !== null,
|
|
11309
11627
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11310
11628
|
body: /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
11311
|
-
/* @__PURE__ */
|
|
11629
|
+
/* @__PURE__ */ jsx40("div", { className: "m-b-2", children: editableItem }),
|
|
11312
11630
|
/* @__PURE__ */ jsxs11("div", { children: [
|
|
11313
|
-
/* @__PURE__ */
|
|
11314
|
-
/* @__PURE__ */
|
|
11631
|
+
/* @__PURE__ */ jsx40(Button4, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
11632
|
+
/* @__PURE__ */ jsx40(Button4, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
|
|
11315
11633
|
] })
|
|
11316
11634
|
] }),
|
|
11317
11635
|
onClose: () => onCancelEdit()
|
|
@@ -11323,10 +11641,10 @@ function ItemSummaryOption({
|
|
|
11323
11641
|
item,
|
|
11324
11642
|
onClick
|
|
11325
11643
|
}) {
|
|
11326
|
-
return /* @__PURE__ */
|
|
11644
|
+
return /* @__PURE__ */ jsx40(
|
|
11327
11645
|
NavigationOption2,
|
|
11328
11646
|
{
|
|
11329
|
-
media: /* @__PURE__ */
|
|
11647
|
+
media: /* @__PURE__ */ jsx40(NavigationOptionMedia, __spreadValues({}, item)),
|
|
11330
11648
|
title: item.title,
|
|
11331
11649
|
content: item.description,
|
|
11332
11650
|
showMediaAtAllSizes: true,
|
|
@@ -11340,14 +11658,14 @@ var RepeatableRenderer_default = RepeatableRenderer;
|
|
|
11340
11658
|
import { Input as Input5, Markdown as Markdown3, NavigationOption as NavigationOption3, NavigationOptionsList as NavigationOptionsList2 } from "@transferwise/components";
|
|
11341
11659
|
|
|
11342
11660
|
// src/revamp/wise/renderers/SearchRenderer/ErrorResult.tsx
|
|
11343
|
-
import { useIntl as
|
|
11344
|
-
import { jsx as
|
|
11661
|
+
import { useIntl as useIntl7 } from "react-intl";
|
|
11662
|
+
import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
11345
11663
|
function ErrorResult({ state }) {
|
|
11346
|
-
const intl =
|
|
11664
|
+
const intl = useIntl7();
|
|
11347
11665
|
return /* @__PURE__ */ jsxs12("p", { className: "m-t-2", children: [
|
|
11348
11666
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
11349
11667
|
"\xA0",
|
|
11350
|
-
/* @__PURE__ */
|
|
11668
|
+
/* @__PURE__ */ jsx41(
|
|
11351
11669
|
"a",
|
|
11352
11670
|
{
|
|
11353
11671
|
href: "/",
|
|
@@ -11362,8 +11680,8 @@ function ErrorResult({ state }) {
|
|
|
11362
11680
|
}
|
|
11363
11681
|
|
|
11364
11682
|
// src/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
11365
|
-
import { useState as
|
|
11366
|
-
import { Fragment as Fragment5, jsx as
|
|
11683
|
+
import { useState as useState8 } from "react";
|
|
11684
|
+
import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
11367
11685
|
function BlockSearchRendererComponent({
|
|
11368
11686
|
id,
|
|
11369
11687
|
isLoading,
|
|
@@ -11373,10 +11691,10 @@ function BlockSearchRendererComponent({
|
|
|
11373
11691
|
state,
|
|
11374
11692
|
title
|
|
11375
11693
|
}) {
|
|
11376
|
-
const [hasSearched, setHasSearched] =
|
|
11694
|
+
const [hasSearched, setHasSearched] = useState8(false);
|
|
11377
11695
|
const trackEvent = useTrackEvent();
|
|
11378
11696
|
return /* @__PURE__ */ jsxs13("div", { className: getMargin(margin), children: [
|
|
11379
|
-
/* @__PURE__ */
|
|
11697
|
+
/* @__PURE__ */ jsx42(FieldInput_default, { id, description: "", error: "", help: "", label: title, children: /* @__PURE__ */ jsx42(
|
|
11380
11698
|
Input5,
|
|
11381
11699
|
{
|
|
11382
11700
|
id,
|
|
@@ -11393,7 +11711,7 @@ function BlockSearchRendererComponent({
|
|
|
11393
11711
|
}
|
|
11394
11712
|
}
|
|
11395
11713
|
) }),
|
|
11396
|
-
isLoading ? /* @__PURE__ */
|
|
11714
|
+
isLoading ? /* @__PURE__ */ jsx42(Fragment5, { children: "Loading..." }) : /* @__PURE__ */ jsx42(SearchResultContent, { state, onChange })
|
|
11397
11715
|
] });
|
|
11398
11716
|
}
|
|
11399
11717
|
function SearchResultContent({
|
|
@@ -11402,29 +11720,29 @@ function SearchResultContent({
|
|
|
11402
11720
|
}) {
|
|
11403
11721
|
switch (state.type) {
|
|
11404
11722
|
case "error":
|
|
11405
|
-
return /* @__PURE__ */
|
|
11723
|
+
return /* @__PURE__ */ jsx42(ErrorResult, { state });
|
|
11406
11724
|
case "results":
|
|
11407
|
-
return /* @__PURE__ */
|
|
11725
|
+
return /* @__PURE__ */ jsx42(SearchResults, { state, onChange });
|
|
11408
11726
|
case "noResults":
|
|
11409
|
-
return /* @__PURE__ */
|
|
11727
|
+
return /* @__PURE__ */ jsx42(EmptySearchResult, { state });
|
|
11410
11728
|
case "pending":
|
|
11411
11729
|
default:
|
|
11412
11730
|
return null;
|
|
11413
11731
|
}
|
|
11414
11732
|
}
|
|
11415
11733
|
function EmptySearchResult({ state }) {
|
|
11416
|
-
return /* @__PURE__ */
|
|
11734
|
+
return /* @__PURE__ */ jsx42(Markdown3, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
11417
11735
|
}
|
|
11418
11736
|
function SearchResults({
|
|
11419
11737
|
state
|
|
11420
11738
|
}) {
|
|
11421
11739
|
const trackEvent = useTrackEvent();
|
|
11422
|
-
return /* @__PURE__ */
|
|
11740
|
+
return /* @__PURE__ */ jsx42(NavigationOptionsList2, { children: state.results.map((result) => /* @__PURE__ */ jsx42(
|
|
11423
11741
|
NavigationOption3,
|
|
11424
11742
|
{
|
|
11425
11743
|
title: result.title,
|
|
11426
11744
|
content: result.description,
|
|
11427
|
-
media: /* @__PURE__ */
|
|
11745
|
+
media: /* @__PURE__ */ jsx42(NavigationOptionMedia, __spreadValues({}, result)),
|
|
11428
11746
|
showMediaCircle: false,
|
|
11429
11747
|
showMediaAtAllSizes: true,
|
|
11430
11748
|
onClick: () => {
|
|
@@ -11442,8 +11760,8 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
|
11442
11760
|
// src/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
11443
11761
|
import { Markdown as Markdown4, Typeahead } from "@transferwise/components";
|
|
11444
11762
|
import { Search } from "@transferwise/icons";
|
|
11445
|
-
import { useState as
|
|
11446
|
-
import { jsx as
|
|
11763
|
+
import { useState as useState9 } from "react";
|
|
11764
|
+
import { jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
11447
11765
|
function InlineSearchRenderer({
|
|
11448
11766
|
id,
|
|
11449
11767
|
isLoading,
|
|
@@ -11452,21 +11770,21 @@ function InlineSearchRenderer({
|
|
|
11452
11770
|
state,
|
|
11453
11771
|
title
|
|
11454
11772
|
}) {
|
|
11455
|
-
const [hasSearched, setHasSearched] =
|
|
11773
|
+
const [hasSearched, setHasSearched] = useState9(false);
|
|
11456
11774
|
const trackEvent = useTrackEvent();
|
|
11457
|
-
return /* @__PURE__ */
|
|
11775
|
+
return /* @__PURE__ */ jsx43("div", { className: getMargin(margin), children: /* @__PURE__ */ jsxs14(FieldInput_default, { id, description: "", error: "", help: "", label: title, children: [
|
|
11458
11776
|
id,
|
|
11459
|
-
/* @__PURE__ */
|
|
11777
|
+
/* @__PURE__ */ jsx43(
|
|
11460
11778
|
Typeahead,
|
|
11461
11779
|
{
|
|
11462
11780
|
id: "typeahead-input-id",
|
|
11463
11781
|
name: "typeahead-input-name",
|
|
11464
11782
|
size: "md",
|
|
11465
11783
|
maxHeight: 100,
|
|
11466
|
-
footer: /* @__PURE__ */
|
|
11784
|
+
footer: /* @__PURE__ */ jsx43(TypeaheadFooter, { state, isLoading }),
|
|
11467
11785
|
multiple: false,
|
|
11468
11786
|
clearable: false,
|
|
11469
|
-
addon: /* @__PURE__ */
|
|
11787
|
+
addon: /* @__PURE__ */ jsx43(Search, { size: 24 }),
|
|
11470
11788
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
11471
11789
|
minQueryLength: 1,
|
|
11472
11790
|
onChange: (values) => {
|
|
@@ -11503,47 +11821,29 @@ function mapResultToTypeaheadOption(result) {
|
|
|
11503
11821
|
}
|
|
11504
11822
|
function TypeaheadFooter({ state, isLoading }) {
|
|
11505
11823
|
if (state.type === "noResults") {
|
|
11506
|
-
return /* @__PURE__ */
|
|
11824
|
+
return /* @__PURE__ */ jsx43(Markdown4, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
11507
11825
|
}
|
|
11508
11826
|
if (state.type === "error") {
|
|
11509
|
-
return /* @__PURE__ */
|
|
11827
|
+
return /* @__PURE__ */ jsx43("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ jsx43(ErrorResult, { state }) });
|
|
11510
11828
|
}
|
|
11511
11829
|
if (state.type === "pending" || isLoading) {
|
|
11512
|
-
return /* @__PURE__ */
|
|
11830
|
+
return /* @__PURE__ */ jsx43("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
11513
11831
|
}
|
|
11514
11832
|
return null;
|
|
11515
11833
|
}
|
|
11516
11834
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
11517
11835
|
|
|
11518
11836
|
// src/revamp/wise/renderers/SearchRenderer/SearchRenderer.tsx
|
|
11519
|
-
import { jsx as
|
|
11837
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
11520
11838
|
var SearchRenderer = {
|
|
11521
11839
|
canRenderType: "search",
|
|
11522
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */
|
|
11840
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ jsx44(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx44(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
11523
11841
|
};
|
|
11524
11842
|
var SearchRenderer_default = SearchRenderer;
|
|
11525
11843
|
|
|
11526
11844
|
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11527
11845
|
import { RadioGroup } from "@transferwise/components";
|
|
11528
|
-
|
|
11529
|
-
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11530
|
-
import { Avatar as Avatar2, AvatarType as AvatarType2 } from "@transferwise/components";
|
|
11531
|
-
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
11532
|
-
function OptionMedia({ icon, image }) {
|
|
11533
|
-
if (image == null ? void 0 : image.url) {
|
|
11534
|
-
return /* @__PURE__ */ jsx43("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
11535
|
-
}
|
|
11536
|
-
if (icon && "name" in icon) {
|
|
11537
|
-
return /* @__PURE__ */ jsx43(Avatar2, { type: AvatarType2.ICON, children: /* @__PURE__ */ jsx43(DynamicIcon_default, { name: icon.name }) });
|
|
11538
|
-
}
|
|
11539
|
-
if (icon && "text" in icon) {
|
|
11540
|
-
return /* @__PURE__ */ jsx43(Avatar2, { type: AvatarType2.INITIALS, children: icon.text });
|
|
11541
|
-
}
|
|
11542
|
-
return null;
|
|
11543
|
-
}
|
|
11544
|
-
|
|
11545
|
-
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11546
|
-
import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
11846
|
+
import { Fragment as Fragment6, jsx as jsx45, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
11547
11847
|
function RadioInputRendererComponent(props) {
|
|
11548
11848
|
const {
|
|
11549
11849
|
id,
|
|
@@ -11558,7 +11858,7 @@ function RadioInputRendererComponent(props) {
|
|
|
11558
11858
|
onSelect
|
|
11559
11859
|
} = props;
|
|
11560
11860
|
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
11561
|
-
/* @__PURE__ */
|
|
11861
|
+
/* @__PURE__ */ jsx45(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx45("span", { children: /* @__PURE__ */ jsx45(
|
|
11562
11862
|
RadioGroup,
|
|
11563
11863
|
{
|
|
11564
11864
|
name: id,
|
|
@@ -11567,11 +11867,12 @@ function RadioInputRendererComponent(props) {
|
|
|
11567
11867
|
value: index,
|
|
11568
11868
|
secondary: option.description,
|
|
11569
11869
|
disabled: option.disabled || disabled,
|
|
11570
|
-
avatar: /* @__PURE__ */
|
|
11870
|
+
avatar: /* @__PURE__ */ jsx45(OptionMedia, { icon: option.icon, image: option.image })
|
|
11571
11871
|
})),
|
|
11572
11872
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
11573
11873
|
onChange: onSelect
|
|
11574
|
-
}
|
|
11874
|
+
},
|
|
11875
|
+
`${id}-${selectedIndex}`
|
|
11575
11876
|
) }) }),
|
|
11576
11877
|
children
|
|
11577
11878
|
] });
|
|
@@ -11580,7 +11881,7 @@ function RadioInputRendererComponent(props) {
|
|
|
11580
11881
|
// src/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
11581
11882
|
import { Tabs } from "@transferwise/components";
|
|
11582
11883
|
import { useEffect as useEffect4 } from "react";
|
|
11583
|
-
import { Fragment as Fragment7, jsx as
|
|
11884
|
+
import { Fragment as Fragment7, jsx as jsx46, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
11584
11885
|
function TabInputRendererComponent(props) {
|
|
11585
11886
|
const {
|
|
11586
11887
|
id,
|
|
@@ -11600,7 +11901,7 @@ function TabInputRendererComponent(props) {
|
|
|
11600
11901
|
}
|
|
11601
11902
|
}, [selectedIndex, onSelect, options.length]);
|
|
11602
11903
|
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
11603
|
-
/* @__PURE__ */
|
|
11904
|
+
/* @__PURE__ */ jsx46(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx46(
|
|
11604
11905
|
Tabs,
|
|
11605
11906
|
{
|
|
11606
11907
|
name: id,
|
|
@@ -11609,7 +11910,7 @@ function TabInputRendererComponent(props) {
|
|
|
11609
11910
|
title: option.title,
|
|
11610
11911
|
// if we pass null, we get some props-types console errors
|
|
11611
11912
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
11612
|
-
content: /* @__PURE__ */
|
|
11913
|
+
content: /* @__PURE__ */ jsx46(Fragment7, {}),
|
|
11613
11914
|
disabled: option.disabled || disabled
|
|
11614
11915
|
})),
|
|
11615
11916
|
onTabSelect: onSelect
|
|
@@ -11621,26 +11922,26 @@ function TabInputRendererComponent(props) {
|
|
|
11621
11922
|
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
11622
11923
|
|
|
11623
11924
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11624
|
-
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
11925
|
+
import { SelectInput as SelectInput2, SelectInputOptionContent as SelectInputOptionContent2 } from "@transferwise/components";
|
|
11625
11926
|
|
|
11626
11927
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.tsx
|
|
11627
11928
|
import { Avatar as Avatar3, AvatarType as AvatarType3 } from "@transferwise/components";
|
|
11628
|
-
import { jsx as
|
|
11929
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
11629
11930
|
function SelectTriggerMedia({ icon, image }) {
|
|
11630
11931
|
if (image == null ? void 0 : image.url) {
|
|
11631
11932
|
return null;
|
|
11632
11933
|
}
|
|
11633
11934
|
if (icon && "name" in icon) {
|
|
11634
|
-
return /* @__PURE__ */
|
|
11935
|
+
return /* @__PURE__ */ jsx47(Avatar3, { type: AvatarType3.ICON, size: 24, children: /* @__PURE__ */ jsx47(DynamicIcon_default, { name: icon.name }) });
|
|
11635
11936
|
}
|
|
11636
11937
|
if (icon && "text" in icon) {
|
|
11637
|
-
return /* @__PURE__ */
|
|
11938
|
+
return /* @__PURE__ */ jsx47(Avatar3, { type: AvatarType3.ICON, size: 24, children: icon.text });
|
|
11638
11939
|
}
|
|
11639
11940
|
return null;
|
|
11640
11941
|
}
|
|
11641
11942
|
|
|
11642
11943
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11643
|
-
import { Fragment as Fragment8, jsx as
|
|
11944
|
+
import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
11644
11945
|
function SelectInputRendererComponent(props) {
|
|
11645
11946
|
const {
|
|
11646
11947
|
id,
|
|
@@ -11675,17 +11976,17 @@ function SelectInputRendererComponent(props) {
|
|
|
11675
11976
|
const contentProps = withinTrigger ? {
|
|
11676
11977
|
title: option.title,
|
|
11677
11978
|
note: option.description,
|
|
11678
|
-
icon: /* @__PURE__ */
|
|
11979
|
+
icon: /* @__PURE__ */ jsx48(SelectTriggerMedia, { icon: option.icon, image: option.image })
|
|
11679
11980
|
} : {
|
|
11680
11981
|
title: option.title,
|
|
11681
11982
|
description: option.description,
|
|
11682
|
-
icon: /* @__PURE__ */
|
|
11983
|
+
icon: /* @__PURE__ */ jsx48(OptionMedia, { icon: option.icon, image: option.image })
|
|
11683
11984
|
};
|
|
11684
|
-
return /* @__PURE__ */
|
|
11985
|
+
return /* @__PURE__ */ jsx48(SelectInputOptionContent2, __spreadValues({}, contentProps));
|
|
11685
11986
|
};
|
|
11686
11987
|
return /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
11687
|
-
/* @__PURE__ */
|
|
11688
|
-
|
|
11988
|
+
/* @__PURE__ */ jsx48(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx48(
|
|
11989
|
+
SelectInput2,
|
|
11689
11990
|
{
|
|
11690
11991
|
name: id,
|
|
11691
11992
|
placeholder,
|
|
@@ -11705,7 +12006,7 @@ function SelectInputRendererComponent(props) {
|
|
|
11705
12006
|
// src/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
11706
12007
|
import { useEffect as useEffect5 } from "react";
|
|
11707
12008
|
import { SegmentedControl } from "@transferwise/components";
|
|
11708
|
-
import { Fragment as Fragment9, jsx as
|
|
12009
|
+
import { Fragment as Fragment9, jsx as jsx49, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
11709
12010
|
function SegmentedInputRendererComponent(props) {
|
|
11710
12011
|
const { id, children, description, error, help, label, options, selectedIndex, onSelect } = props;
|
|
11711
12012
|
useEffect5(() => {
|
|
@@ -11714,7 +12015,7 @@ function SegmentedInputRendererComponent(props) {
|
|
|
11714
12015
|
}
|
|
11715
12016
|
}, [selectedIndex, onSelect, options.length]);
|
|
11716
12017
|
return /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
11717
|
-
/* @__PURE__ */
|
|
12018
|
+
/* @__PURE__ */ jsx49(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx49(
|
|
11718
12019
|
SegmentedControl,
|
|
11719
12020
|
{
|
|
11720
12021
|
name: `${id}-segmented-control`,
|
|
@@ -11729,26 +12030,26 @@ function SegmentedInputRendererComponent(props) {
|
|
|
11729
12030
|
onChange: (value) => onSelect(Number(value))
|
|
11730
12031
|
}
|
|
11731
12032
|
) }),
|
|
11732
|
-
/* @__PURE__ */
|
|
12033
|
+
/* @__PURE__ */ jsx49("div", { id: `${id}-children`, children })
|
|
11733
12034
|
] });
|
|
11734
12035
|
}
|
|
11735
12036
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
11736
12037
|
|
|
11737
12038
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
11738
|
-
import { jsx as
|
|
12039
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
11739
12040
|
var SelectInputRenderer = {
|
|
11740
12041
|
canRenderType: "input-select",
|
|
11741
12042
|
render: (props) => {
|
|
11742
12043
|
switch (props.control) {
|
|
11743
12044
|
case "radio":
|
|
11744
|
-
return /* @__PURE__ */
|
|
12045
|
+
return /* @__PURE__ */ jsx50(RadioInputRendererComponent, __spreadValues({}, props));
|
|
11745
12046
|
case "tab":
|
|
11746
|
-
return props.options.length > 3 ? /* @__PURE__ */
|
|
12047
|
+
return props.options.length > 3 ? /* @__PURE__ */ jsx50(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx50(TabInputRendererComponent, __spreadValues({}, props));
|
|
11747
12048
|
case "segmented":
|
|
11748
|
-
return props.options.length > 3 ? /* @__PURE__ */
|
|
12049
|
+
return props.options.length > 3 ? /* @__PURE__ */ jsx50(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx50(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
11749
12050
|
case "select":
|
|
11750
12051
|
default:
|
|
11751
|
-
return /* @__PURE__ */
|
|
12052
|
+
return /* @__PURE__ */ jsx50(SelectInputRendererComponent, __spreadValues({}, props));
|
|
11752
12053
|
}
|
|
11753
12054
|
}
|
|
11754
12055
|
};
|
|
@@ -11756,17 +12057,17 @@ var SelectInputRenderer_default = SelectInputRenderer;
|
|
|
11756
12057
|
|
|
11757
12058
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
11758
12059
|
import { Header as Header4, Summary } from "@transferwise/components";
|
|
11759
|
-
import { jsx as
|
|
12060
|
+
import { jsx as jsx51, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
11760
12061
|
var StatusListRenderer = {
|
|
11761
12062
|
canRenderType: "status-list",
|
|
11762
12063
|
render: ({ margin, items, title }) => /* @__PURE__ */ jsxs19("div", { className: getMargin(margin), children: [
|
|
11763
|
-
title ? /* @__PURE__ */
|
|
11764
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */
|
|
12064
|
+
title ? /* @__PURE__ */ jsx51(Header4, { title }) : null,
|
|
12065
|
+
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ jsx51(
|
|
11765
12066
|
Summary,
|
|
11766
12067
|
{
|
|
11767
12068
|
title: itemTitle,
|
|
11768
12069
|
description,
|
|
11769
|
-
icon: icon && "name" in icon ? /* @__PURE__ */
|
|
12070
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ jsx51(DynamicIcon_default, { name: icon.name }) : null,
|
|
11770
12071
|
status: mapStatus(status)
|
|
11771
12072
|
},
|
|
11772
12073
|
`${title}/${description || ""}`
|
|
@@ -11789,31 +12090,31 @@ import {
|
|
|
11789
12090
|
TextArea as TextArea2,
|
|
11790
12091
|
TextareaWithDisplayFormat
|
|
11791
12092
|
} from "@transferwise/components";
|
|
11792
|
-
import { jsx as
|
|
12093
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
11793
12094
|
function VariableTextInput({
|
|
11794
12095
|
control,
|
|
11795
12096
|
inputProps
|
|
11796
12097
|
}) {
|
|
11797
12098
|
switch (control) {
|
|
11798
12099
|
case "password":
|
|
11799
|
-
return /* @__PURE__ */
|
|
12100
|
+
return /* @__PURE__ */ jsx52(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
11800
12101
|
case "email":
|
|
11801
|
-
return /* @__PURE__ */
|
|
12102
|
+
return /* @__PURE__ */ jsx52(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
11802
12103
|
case "textarea":
|
|
11803
|
-
return /* @__PURE__ */
|
|
12104
|
+
return /* @__PURE__ */ jsx52(TextAreaInput, __spreadValues({}, inputProps));
|
|
11804
12105
|
case "numeric":
|
|
11805
|
-
return /* @__PURE__ */
|
|
12106
|
+
return /* @__PURE__ */ jsx52(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
11806
12107
|
case "phone-number":
|
|
11807
|
-
return /* @__PURE__ */
|
|
12108
|
+
return /* @__PURE__ */ jsx52(PhoneNumberInput, __spreadValues({}, inputProps));
|
|
11808
12109
|
default:
|
|
11809
|
-
return /* @__PURE__ */
|
|
12110
|
+
return /* @__PURE__ */ jsx52(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
11810
12111
|
}
|
|
11811
12112
|
}
|
|
11812
12113
|
function TextInput(_a) {
|
|
11813
12114
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11814
12115
|
if (typeof displayFormat === "string") {
|
|
11815
12116
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
11816
|
-
return /* @__PURE__ */
|
|
12117
|
+
return /* @__PURE__ */ jsx52(
|
|
11817
12118
|
InputWithDisplayFormat,
|
|
11818
12119
|
__spreadValues({
|
|
11819
12120
|
displayPattern: displayFormat,
|
|
@@ -11821,29 +12122,29 @@ function TextInput(_a) {
|
|
|
11821
12122
|
}, inputProps)
|
|
11822
12123
|
);
|
|
11823
12124
|
}
|
|
11824
|
-
return /* @__PURE__ */
|
|
12125
|
+
return /* @__PURE__ */ jsx52(Input6, __spreadValues({ id, name: id, onChange: (e) => onChange(e.target.value) }, rest));
|
|
11825
12126
|
}
|
|
11826
12127
|
function TextAreaInput(_a) {
|
|
11827
12128
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11828
12129
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
11829
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */
|
|
12130
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ jsx52(
|
|
11830
12131
|
TextareaWithDisplayFormat,
|
|
11831
12132
|
__spreadValues({
|
|
11832
12133
|
displayPattern: displayFormat,
|
|
11833
12134
|
onChange: (newValue) => onChange(newValue)
|
|
11834
12135
|
}, textAreaProps)
|
|
11835
|
-
) : /* @__PURE__ */
|
|
12136
|
+
) : /* @__PURE__ */ jsx52(TextArea2, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
11836
12137
|
}
|
|
11837
12138
|
function NumericInput(_a) {
|
|
11838
12139
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11839
12140
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
11840
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */
|
|
12141
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ jsx52(
|
|
11841
12142
|
InputWithDisplayFormat,
|
|
11842
12143
|
__spreadValues({
|
|
11843
12144
|
displayPattern: displayFormat,
|
|
11844
12145
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
11845
12146
|
}, numericProps)
|
|
11846
|
-
) : /* @__PURE__ */
|
|
12147
|
+
) : /* @__PURE__ */ jsx52(
|
|
11847
12148
|
Input6,
|
|
11848
12149
|
__spreadValues({
|
|
11849
12150
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
@@ -11852,12 +12153,12 @@ function NumericInput(_a) {
|
|
|
11852
12153
|
}
|
|
11853
12154
|
function PhoneNumberInput(_a) {
|
|
11854
12155
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
11855
|
-
return /* @__PURE__ */
|
|
12156
|
+
return /* @__PURE__ */ jsx52(PhoneNumber, __spreadValues({ initialValue: value }, rest));
|
|
11856
12157
|
}
|
|
11857
12158
|
var VariableTextInput_default = VariableTextInput;
|
|
11858
12159
|
|
|
11859
12160
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
11860
|
-
import { jsx as
|
|
12161
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
11861
12162
|
var TextInputRenderer = {
|
|
11862
12163
|
canRenderType: "input-text",
|
|
11863
12164
|
render: (props) => {
|
|
@@ -11882,14 +12183,14 @@ var TextInputRenderer = {
|
|
|
11882
12183
|
]);
|
|
11883
12184
|
const value = initialValue != null ? initialValue : "";
|
|
11884
12185
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
11885
|
-
return /* @__PURE__ */
|
|
12186
|
+
return /* @__PURE__ */ jsx53(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx53(VariableTextInput_default, { control, inputProps }) });
|
|
11886
12187
|
}
|
|
11887
12188
|
};
|
|
11888
12189
|
var TextInputRenderer_default = TextInputRenderer;
|
|
11889
12190
|
|
|
11890
12191
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
11891
12192
|
import { Upload, UploadInput as UploadInput2 } from "@transferwise/components";
|
|
11892
|
-
import { jsx as
|
|
12193
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
11893
12194
|
var UploadInputRenderer = {
|
|
11894
12195
|
canRenderType: "input-upload",
|
|
11895
12196
|
render: (props) => {
|
|
@@ -11905,7 +12206,7 @@ var UploadInputRenderer = {
|
|
|
11905
12206
|
};
|
|
11906
12207
|
return (
|
|
11907
12208
|
// We don't pass help here as there is no sensible place to display it
|
|
11908
|
-
/* @__PURE__ */
|
|
12209
|
+
/* @__PURE__ */ jsx54(UploadFieldInput_default, { id, label: void 0, description: void 0, error, children: /* @__PURE__ */ jsx54(
|
|
11909
12210
|
UploadInput2,
|
|
11910
12211
|
{
|
|
11911
12212
|
id,
|
|
@@ -11960,7 +12261,7 @@ var LargeUploadRenderer = {
|
|
|
11960
12261
|
throw e;
|
|
11961
12262
|
}
|
|
11962
12263
|
};
|
|
11963
|
-
return /* @__PURE__ */
|
|
12264
|
+
return /* @__PURE__ */ jsx54(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx54(
|
|
11964
12265
|
Upload,
|
|
11965
12266
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
11966
12267
|
usAccept: getAcceptsString(accepts),
|
|
@@ -11975,7 +12276,7 @@ var LargeUploadRenderer = {
|
|
|
11975
12276
|
|
|
11976
12277
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
11977
12278
|
import { DefinitionList, Header as Header5 } from "@transferwise/components";
|
|
11978
|
-
import { Fragment as Fragment10, jsx as
|
|
12279
|
+
import { Fragment as Fragment10, jsx as jsx55, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
11979
12280
|
var ReviewRenderer = {
|
|
11980
12281
|
canRenderType: "review",
|
|
11981
12282
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -11988,8 +12289,8 @@ var ReviewRenderer = {
|
|
|
11988
12289
|
}
|
|
11989
12290
|
} : void 0;
|
|
11990
12291
|
return /* @__PURE__ */ jsxs20("div", { className: getMargin(margin), children: [
|
|
11991
|
-
(title || callToAction) && /* @__PURE__ */
|
|
11992
|
-
/* @__PURE__ */
|
|
12292
|
+
(title || callToAction) && /* @__PURE__ */ jsx55(Header5, { title: title != null ? title : "", action }),
|
|
12293
|
+
/* @__PURE__ */ jsx55("div", { className: margin, children: /* @__PURE__ */ jsx55(
|
|
11993
12294
|
DefinitionList,
|
|
11994
12295
|
{
|
|
11995
12296
|
layout: orientation,
|
|
@@ -12007,13 +12308,13 @@ var ReviewRenderer_default = ReviewRenderer;
|
|
|
12007
12308
|
var getFieldValue = (value, help, orientation) => {
|
|
12008
12309
|
if (help) {
|
|
12009
12310
|
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
12010
|
-
/* @__PURE__ */
|
|
12311
|
+
/* @__PURE__ */ jsx55(Help_default, { help }),
|
|
12011
12312
|
" ",
|
|
12012
12313
|
value
|
|
12013
12314
|
] }) : /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
12014
12315
|
value,
|
|
12015
12316
|
" ",
|
|
12016
|
-
/* @__PURE__ */
|
|
12317
|
+
/* @__PURE__ */ jsx55(Help_default, { help })
|
|
12017
12318
|
] });
|
|
12018
12319
|
}
|
|
12019
12320
|
return value;
|
|
@@ -12023,11 +12324,11 @@ var getFieldValue = (value, help, orientation) => {
|
|
|
12023
12324
|
import { useMemo as useMemo4 } from "react";
|
|
12024
12325
|
|
|
12025
12326
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12026
|
-
import { useIntl as
|
|
12327
|
+
import { useIntl as useIntl8 } from "react-intl";
|
|
12027
12328
|
|
|
12028
12329
|
// src/common/messages/external-confirmation.messages.ts
|
|
12029
|
-
import { defineMessages as
|
|
12030
|
-
var external_confirmation_messages_default =
|
|
12330
|
+
import { defineMessages as defineMessages9 } from "react-intl";
|
|
12331
|
+
var external_confirmation_messages_default = defineMessages9({
|
|
12031
12332
|
title: {
|
|
12032
12333
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
12033
12334
|
defaultMessage: "Please confirm",
|
|
@@ -12052,17 +12353,17 @@ var external_confirmation_messages_default = defineMessages8({
|
|
|
12052
12353
|
|
|
12053
12354
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12054
12355
|
import { Button as Button5, Markdown as Markdown5 } from "@transferwise/components";
|
|
12055
|
-
import { jsx as
|
|
12356
|
+
import { jsx as jsx56, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
12056
12357
|
function ExternalConfirmationDialog({
|
|
12057
12358
|
external,
|
|
12058
12359
|
onClose
|
|
12059
12360
|
}) {
|
|
12060
|
-
const { formatMessage } =
|
|
12061
|
-
return /* @__PURE__ */
|
|
12062
|
-
/* @__PURE__ */
|
|
12063
|
-
/* @__PURE__ */
|
|
12064
|
-
/* @__PURE__ */
|
|
12065
|
-
/* @__PURE__ */
|
|
12361
|
+
const { formatMessage } = useIntl8();
|
|
12362
|
+
return /* @__PURE__ */ jsx56("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs21("div", { className: "df-box-renderer-width-lg", children: [
|
|
12363
|
+
/* @__PURE__ */ jsx56("h2", { className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.title) }),
|
|
12364
|
+
/* @__PURE__ */ jsx56(Markdown5, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(external.url) }) }),
|
|
12365
|
+
/* @__PURE__ */ jsx56("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs21("div", { className: "df-box-renderer-width-lg", children: [
|
|
12366
|
+
/* @__PURE__ */ jsx56(
|
|
12066
12367
|
Button5,
|
|
12067
12368
|
{
|
|
12068
12369
|
block: true,
|
|
@@ -12076,7 +12377,7 @@ function ExternalConfirmationDialog({
|
|
|
12076
12377
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
12077
12378
|
}
|
|
12078
12379
|
),
|
|
12079
|
-
/* @__PURE__ */
|
|
12380
|
+
/* @__PURE__ */ jsx56(Button5, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onClose, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
12080
12381
|
] }) })
|
|
12081
12382
|
] }) });
|
|
12082
12383
|
}
|
|
@@ -12089,10 +12390,10 @@ function getOrigin(url) {
|
|
|
12089
12390
|
}
|
|
12090
12391
|
|
|
12091
12392
|
// src/revamp/wise/renderers/step/useExternal.tsx
|
|
12092
|
-
import { useEffect as useEffect6, useState as
|
|
12393
|
+
import { useEffect as useEffect6, useState as useState10 } from "react";
|
|
12093
12394
|
function useExternal(url) {
|
|
12094
|
-
const [externalWindow, setExternalWindow] =
|
|
12095
|
-
const [hasDismissed, setHasDismissed] =
|
|
12395
|
+
const [externalWindow, setExternalWindow] = useState10(null);
|
|
12396
|
+
const [hasDismissed, setHasDismissed] = useState10(false);
|
|
12096
12397
|
const dismissConfirmation = () => setHasDismissed(true);
|
|
12097
12398
|
useEffect6(() => {
|
|
12098
12399
|
if (url) {
|
|
@@ -12107,7 +12408,7 @@ function useExternal(url) {
|
|
|
12107
12408
|
// src/revamp/wise/renderers/step/BackButton.tsx
|
|
12108
12409
|
import { Avatar as Avatar4 } from "@transferwise/components";
|
|
12109
12410
|
import { ArrowLeft } from "@transferwise/icons";
|
|
12110
|
-
import { jsx as
|
|
12411
|
+
import { jsx as jsx57, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
12111
12412
|
function BackButton({ title, onClick }) {
|
|
12112
12413
|
return /* @__PURE__ */ jsxs22(
|
|
12113
12414
|
"a",
|
|
@@ -12120,8 +12421,8 @@ function BackButton({ title, onClick }) {
|
|
|
12120
12421
|
onClick();
|
|
12121
12422
|
},
|
|
12122
12423
|
children: [
|
|
12123
|
-
/* @__PURE__ */
|
|
12124
|
-
/* @__PURE__ */
|
|
12424
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: title }),
|
|
12425
|
+
/* @__PURE__ */ jsx57(Avatar4, { type: "icon", children: /* @__PURE__ */ jsx57(ArrowLeft, { size: "24" }) })
|
|
12125
12426
|
]
|
|
12126
12427
|
}
|
|
12127
12428
|
);
|
|
@@ -12129,7 +12430,7 @@ function BackButton({ title, onClick }) {
|
|
|
12129
12430
|
var BackButton_default = BackButton;
|
|
12130
12431
|
|
|
12131
12432
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12132
|
-
import { jsx as
|
|
12433
|
+
import { jsx as jsx58, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
12133
12434
|
var StepRenderer = {
|
|
12134
12435
|
canRenderType: "step",
|
|
12135
12436
|
render: StepRendererComponent
|
|
@@ -12139,10 +12440,10 @@ function StepRendererComponent(props) {
|
|
|
12139
12440
|
const value = useMemo4(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12140
12441
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12141
12442
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
12142
|
-
return /* @__PURE__ */
|
|
12443
|
+
return /* @__PURE__ */ jsx58(ExternalConfirmationDialog, { external, onClose: dismissConfirmation });
|
|
12143
12444
|
}
|
|
12144
12445
|
return /* @__PURE__ */ jsxs23(StepRendererContextProvider, { value, children: [
|
|
12145
|
-
back ? /* @__PURE__ */
|
|
12446
|
+
back ? /* @__PURE__ */ jsx58(BackButton_default, __spreadValues({}, back)) : null,
|
|
12146
12447
|
children
|
|
12147
12448
|
] });
|
|
12148
12449
|
}
|
|
@@ -12167,6 +12468,7 @@ var getWiseRenderers = () => [
|
|
|
12167
12468
|
LoadingIndicatorRenderer_default,
|
|
12168
12469
|
MarkdownRenderer_default,
|
|
12169
12470
|
ModalRenderer_default,
|
|
12471
|
+
MultiSelectInputRenderer_default,
|
|
12170
12472
|
MultiUploadInputRenderer_default,
|
|
12171
12473
|
NumberInputRenderer_default,
|
|
12172
12474
|
ParagraphRenderer_default,
|
|
@@ -12181,18 +12483,18 @@ var getWiseRenderers = () => [
|
|
|
12181
12483
|
];
|
|
12182
12484
|
|
|
12183
12485
|
// src/revamp/DynamicFlowWise.tsx
|
|
12184
|
-
import { jsx as
|
|
12486
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
12185
12487
|
var wiseRenderers = getWiseRenderers();
|
|
12186
12488
|
function DynamicFlowWise(props) {
|
|
12187
12489
|
const { httpClient, renderers } = props;
|
|
12188
12490
|
const mergedRenderers = useMemo5(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
12189
|
-
return /* @__PURE__ */
|
|
12491
|
+
return /* @__PURE__ */ jsx59(HttpClientProvider, { httpClient, children: /* @__PURE__ */ jsx59(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
|
|
12190
12492
|
}
|
|
12191
12493
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
12192
12494
|
|
|
12193
12495
|
// src/revamp/DynamicFragmentWise.tsx
|
|
12194
12496
|
import { forwardRef as forwardRef3, useImperativeHandle, useMemo as useMemo6 } from "react";
|
|
12195
|
-
import { jsx as
|
|
12497
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
12196
12498
|
var wiseRenderers2 = getWiseRenderers();
|
|
12197
12499
|
var DynamicFragmentWise = forwardRef3(function DynamicFragmentWise2(props, ref) {
|
|
12198
12500
|
const { httpClient, onEvent, onError, renderers } = props;
|
|
@@ -12217,14 +12519,14 @@ var DynamicFragmentWise = forwardRef3(function DynamicFragmentWise2(props, ref)
|
|
|
12217
12519
|
() => getRenderFunction([CoreContainerRenderer, ...mergedRenderers, StepRenderer]),
|
|
12218
12520
|
[mergedRenderers]
|
|
12219
12521
|
);
|
|
12220
|
-
return /* @__PURE__ */
|
|
12522
|
+
return /* @__PURE__ */ jsx60(
|
|
12221
12523
|
ErrorBoundary_default,
|
|
12222
12524
|
{
|
|
12223
12525
|
onError: (error) => {
|
|
12224
12526
|
onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed");
|
|
12225
12527
|
onError(error);
|
|
12226
12528
|
},
|
|
12227
|
-
children: /* @__PURE__ */
|
|
12529
|
+
children: /* @__PURE__ */ jsx60(HttpClientProvider, { httpClient, children: stepComponentRef.current ? render(stepComponentRef.current) : null })
|
|
12228
12530
|
}
|
|
12229
12531
|
);
|
|
12230
12532
|
});
|
|
@@ -12535,15 +12837,15 @@ function isReference(block) {
|
|
|
12535
12837
|
}
|
|
12536
12838
|
|
|
12537
12839
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12538
|
-
import { useCallback as useCallback11, useEffect as useEffect26, useMemo as useMemo22, useState as
|
|
12840
|
+
import { useCallback as useCallback11, useEffect as useEffect26, useMemo as useMemo22, useState as useState35 } from "react";
|
|
12539
12841
|
|
|
12540
12842
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12541
12843
|
import { createContext as createContext4, useContext as useContext5, useMemo as useMemo7 } from "react";
|
|
12542
12844
|
|
|
12543
12845
|
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
12544
|
-
import { useCallback as useCallback3, useState as
|
|
12846
|
+
import { useCallback as useCallback3, useState as useState11 } from "react";
|
|
12545
12847
|
function usePendingPromiseCounter() {
|
|
12546
|
-
const [count, setCount] =
|
|
12848
|
+
const [count, setCount] = useState11(0);
|
|
12547
12849
|
const addPendingPromise = useCallback3(
|
|
12548
12850
|
(promise) => {
|
|
12549
12851
|
setCount((c) => c + 1);
|
|
@@ -12558,7 +12860,7 @@ var noop2 = () => {
|
|
|
12558
12860
|
};
|
|
12559
12861
|
|
|
12560
12862
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12561
|
-
import { jsx as
|
|
12863
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
12562
12864
|
var defaultContextValue = {
|
|
12563
12865
|
loading: false,
|
|
12564
12866
|
registerPersistAsyncPromise: (promise) => {
|
|
@@ -12573,7 +12875,7 @@ var DynamicFlowProvider = ({ loading, children }) => {
|
|
|
12573
12875
|
registerPersistAsyncPromise: addPendingPromise
|
|
12574
12876
|
};
|
|
12575
12877
|
}, [loading, pendingPromises, addPendingPromise]);
|
|
12576
|
-
return /* @__PURE__ */
|
|
12878
|
+
return /* @__PURE__ */ jsx61(DFContext.Provider, { value: providerValue, children });
|
|
12577
12879
|
};
|
|
12578
12880
|
var useDynamicFlow = () => {
|
|
12579
12881
|
const context = useContext5(DFContext);
|
|
@@ -12582,7 +12884,7 @@ var useDynamicFlow = () => {
|
|
|
12582
12884
|
|
|
12583
12885
|
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
12584
12886
|
import { createContext as createContext5, useContext as useContext6, useMemo as useMemo8 } from "react";
|
|
12585
|
-
import { jsx as
|
|
12887
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
12586
12888
|
var EventsContext = createContext5({
|
|
12587
12889
|
triggerEvent: () => {
|
|
12588
12890
|
}
|
|
@@ -12592,7 +12894,7 @@ function EventsContextProvider({ metadata, children, onEvent }) {
|
|
|
12592
12894
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
12593
12895
|
[onEvent, metadata]
|
|
12594
12896
|
);
|
|
12595
|
-
return /* @__PURE__ */
|
|
12897
|
+
return /* @__PURE__ */ jsx62(EventsContext.Provider, { value, children });
|
|
12596
12898
|
}
|
|
12597
12899
|
function useEventDispatcher() {
|
|
12598
12900
|
const { triggerEvent } = useContext6(EventsContext);
|
|
@@ -12607,7 +12909,7 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
12607
12909
|
|
|
12608
12910
|
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
12609
12911
|
import { createContext as createContext6, useContext as useContext7, useMemo as useMemo9 } from "react";
|
|
12610
|
-
import { jsx as
|
|
12912
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
12611
12913
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
12612
12914
|
try {
|
|
12613
12915
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -12629,7 +12931,7 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
12629
12931
|
}),
|
|
12630
12932
|
[onLog, flowId, stepId]
|
|
12631
12933
|
);
|
|
12632
|
-
return /* @__PURE__ */
|
|
12934
|
+
return /* @__PURE__ */ jsx63(LogContext.Provider, { value, children });
|
|
12633
12935
|
}
|
|
12634
12936
|
var useLogger = () => {
|
|
12635
12937
|
const logging = useContext7(LogContext);
|
|
@@ -12643,10 +12945,10 @@ var useLogger = () => {
|
|
|
12643
12945
|
|
|
12644
12946
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12645
12947
|
import { createContext as createContext7, useContext as useContext8 } from "react";
|
|
12646
|
-
import { jsx as
|
|
12948
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
12647
12949
|
var FeatureContext = createContext7([]);
|
|
12648
12950
|
function FeatureContextProvider({ features, children }) {
|
|
12649
|
-
return /* @__PURE__ */
|
|
12951
|
+
return /* @__PURE__ */ jsx64(FeatureContext.Provider, { value: features, children });
|
|
12650
12952
|
}
|
|
12651
12953
|
|
|
12652
12954
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -13382,10 +13684,10 @@ function useDebouncedFunction(callback, waitMs) {
|
|
|
13382
13684
|
}
|
|
13383
13685
|
|
|
13384
13686
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
13385
|
-
import { useEffect as useEffect7, useState as
|
|
13687
|
+
import { useEffect as useEffect7, useState as useState12 } from "react";
|
|
13386
13688
|
function useExternal2(url) {
|
|
13387
|
-
const [externalWindow, setExternalWindow] =
|
|
13388
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] =
|
|
13689
|
+
const [externalWindow, setExternalWindow] = useState12(null);
|
|
13690
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = useState12(false);
|
|
13389
13691
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
13390
13692
|
useEffect7(() => {
|
|
13391
13693
|
if (url) {
|
|
@@ -13455,12 +13757,12 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13455
13757
|
}
|
|
13456
13758
|
|
|
13457
13759
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
13458
|
-
import { useState as
|
|
13459
|
-
import { useIntl as
|
|
13760
|
+
import { useState as useState29 } from "react";
|
|
13761
|
+
import { useIntl as useIntl20 } from "react-intl";
|
|
13460
13762
|
|
|
13461
13763
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
13462
|
-
import { useEffect as useEffect18, useState as
|
|
13463
|
-
import { useIntl as
|
|
13764
|
+
import { useEffect as useEffect18, useState as useState28 } from "react";
|
|
13765
|
+
import { useIntl as useIntl19 } from "react-intl";
|
|
13464
13766
|
|
|
13465
13767
|
// src/legacy/common/constants/DateMode.ts
|
|
13466
13768
|
var DateMode = {
|
|
@@ -13508,7 +13810,7 @@ var Size = {
|
|
|
13508
13810
|
|
|
13509
13811
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13510
13812
|
var import_classnames16 = __toESM(require_classnames());
|
|
13511
|
-
import { useEffect as useEffect17, useMemo as useMemo17, useState as
|
|
13813
|
+
import { useEffect as useEffect17, useMemo as useMemo17, useState as useState27 } from "react";
|
|
13512
13814
|
|
|
13513
13815
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13514
13816
|
import { Alert as Alert3 } from "@transferwise/components";
|
|
@@ -13517,19 +13819,19 @@ import { Alert as Alert3 } from "@transferwise/components";
|
|
|
13517
13819
|
import { Avatar as Avatar5, AvatarType as AvatarType4 } from "@transferwise/components";
|
|
13518
13820
|
|
|
13519
13821
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13520
|
-
import { jsx as
|
|
13822
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
13521
13823
|
var isFlagIcon2 = (name) => name.startsWith("flag-");
|
|
13522
13824
|
function FlagIcon2({ name }) {
|
|
13523
13825
|
if (!isFlagIcon2(name)) {
|
|
13524
13826
|
return null;
|
|
13525
13827
|
}
|
|
13526
13828
|
const code = name.substring(5);
|
|
13527
|
-
return /* @__PURE__ */
|
|
13829
|
+
return /* @__PURE__ */ jsx65(Flag, { intrinsicSize: 24, code });
|
|
13528
13830
|
}
|
|
13529
13831
|
|
|
13530
13832
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13531
13833
|
import * as icons2 from "@transferwise/icons";
|
|
13532
|
-
import { jsx as
|
|
13834
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
13533
13835
|
var isNamedIcon2 = (name) => {
|
|
13534
13836
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13535
13837
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -13540,19 +13842,19 @@ function NamedIcon2({ name }) {
|
|
|
13540
13842
|
}
|
|
13541
13843
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13542
13844
|
const Icon = icons2[iconName];
|
|
13543
|
-
return /* @__PURE__ */
|
|
13845
|
+
return /* @__PURE__ */ jsx66(Icon, { size: 24 });
|
|
13544
13846
|
}
|
|
13545
13847
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
13546
13848
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13547
13849
|
|
|
13548
13850
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13549
|
-
import { jsx as
|
|
13851
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
13550
13852
|
function DynamicIcon2({ type }) {
|
|
13551
13853
|
if (isFlagIcon2(type)) {
|
|
13552
|
-
return /* @__PURE__ */
|
|
13854
|
+
return /* @__PURE__ */ jsx67(FlagIcon2, { name: type });
|
|
13553
13855
|
}
|
|
13554
13856
|
if (isNamedIcon2(type)) {
|
|
13555
|
-
return /* @__PURE__ */
|
|
13857
|
+
return /* @__PURE__ */ jsx67(NamedIcon2, { name: type });
|
|
13556
13858
|
}
|
|
13557
13859
|
return null;
|
|
13558
13860
|
}
|
|
@@ -13562,17 +13864,17 @@ function isValidIconName(name) {
|
|
|
13562
13864
|
var DynamicIcon_default2 = DynamicIcon2;
|
|
13563
13865
|
|
|
13564
13866
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13565
|
-
import { jsx as
|
|
13867
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
13566
13868
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13567
13869
|
if (icon == null ? void 0 : icon.name) {
|
|
13568
|
-
return /* @__PURE__ */
|
|
13870
|
+
return /* @__PURE__ */ jsx68(Avatar5, { type: AvatarType4.ICON, children: /* @__PURE__ */ jsx68(DynamicIcon_default2, { type: icon.name }) });
|
|
13569
13871
|
}
|
|
13570
13872
|
if (icon == null ? void 0 : icon.text) {
|
|
13571
|
-
return /* @__PURE__ */
|
|
13873
|
+
return /* @__PURE__ */ jsx68(Avatar5, { type: AvatarType4.INITIALS, children: icon.text });
|
|
13572
13874
|
}
|
|
13573
13875
|
if (image == null ? void 0 : image.url) {
|
|
13574
13876
|
const { url, text } = image;
|
|
13575
|
-
return /* @__PURE__ */
|
|
13877
|
+
return /* @__PURE__ */ jsx68("img", { src: url, alt: text });
|
|
13576
13878
|
}
|
|
13577
13879
|
return null;
|
|
13578
13880
|
};
|
|
@@ -13608,10 +13910,10 @@ var getTextAlignment2 = (align) => {
|
|
|
13608
13910
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
13609
13911
|
|
|
13610
13912
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13611
|
-
import { jsx as
|
|
13913
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
13612
13914
|
var DynamicAlert = (props) => {
|
|
13613
13915
|
const alert = props.component;
|
|
13614
|
-
return /* @__PURE__ */
|
|
13916
|
+
return /* @__PURE__ */ jsx69(
|
|
13615
13917
|
Alert3,
|
|
13616
13918
|
{
|
|
13617
13919
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
@@ -13644,12 +13946,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13644
13946
|
var DynamicAlert_default = DynamicAlert;
|
|
13645
13947
|
|
|
13646
13948
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13647
|
-
import { jsx as
|
|
13949
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
13648
13950
|
var DynamicBox = (props) => {
|
|
13649
13951
|
const box = props.component;
|
|
13650
13952
|
const margin = getMargin2(box.margin || box.border ? "lg" : "xs");
|
|
13651
13953
|
if (!box.width || box.width === "xl") {
|
|
13652
|
-
return /* @__PURE__ */
|
|
13954
|
+
return /* @__PURE__ */ jsx70("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ jsx70(
|
|
13653
13955
|
DynamicLayout_default,
|
|
13654
13956
|
{
|
|
13655
13957
|
components: box.components,
|
|
@@ -13662,7 +13964,7 @@ var DynamicBox = (props) => {
|
|
|
13662
13964
|
}
|
|
13663
13965
|
) });
|
|
13664
13966
|
}
|
|
13665
|
-
return /* @__PURE__ */
|
|
13967
|
+
return /* @__PURE__ */ jsx70("div", { className: "row", children: /* @__PURE__ */ jsx70("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ jsx70("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ jsx70(
|
|
13666
13968
|
DynamicLayout_default,
|
|
13667
13969
|
{
|
|
13668
13970
|
components: box.components,
|
|
@@ -13746,7 +14048,7 @@ var getButtonSize = (size) => {
|
|
|
13746
14048
|
};
|
|
13747
14049
|
|
|
13748
14050
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13749
|
-
import { jsx as
|
|
14051
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
13750
14052
|
function DynamicButton(props) {
|
|
13751
14053
|
var _a;
|
|
13752
14054
|
const { component, onAction } = props;
|
|
@@ -13755,7 +14057,7 @@ function DynamicButton(props) {
|
|
|
13755
14057
|
const priority = getButtonPriority(component);
|
|
13756
14058
|
const { loading } = useDynamicFlow();
|
|
13757
14059
|
const className = getMargin2(component.margin || "md");
|
|
13758
|
-
return /* @__PURE__ */
|
|
14060
|
+
return /* @__PURE__ */ jsx71(
|
|
13759
14061
|
Button6,
|
|
13760
14062
|
{
|
|
13761
14063
|
size: getButtonSize(component.size),
|
|
@@ -13772,12 +14074,12 @@ function DynamicButton(props) {
|
|
|
13772
14074
|
var DynamicButton_default = DynamicButton;
|
|
13773
14075
|
|
|
13774
14076
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13775
|
-
import { jsx as
|
|
14077
|
+
import { jsx as jsx72, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
13776
14078
|
var DynamicColumns = (props) => {
|
|
13777
14079
|
const columns = props.component;
|
|
13778
14080
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13779
14081
|
return /* @__PURE__ */ jsxs24("div", { className: `${getMargin2(columns.margin || "xs")} row`, children: [
|
|
13780
|
-
/* @__PURE__ */
|
|
14082
|
+
/* @__PURE__ */ jsx72("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ jsx72(
|
|
13781
14083
|
DynamicLayout_default,
|
|
13782
14084
|
{
|
|
13783
14085
|
components: columns.left,
|
|
@@ -13789,7 +14091,7 @@ var DynamicColumns = (props) => {
|
|
|
13789
14091
|
onPersistAsync: props.onPersistAsync
|
|
13790
14092
|
}
|
|
13791
14093
|
) }),
|
|
13792
|
-
/* @__PURE__ */
|
|
14094
|
+
/* @__PURE__ */ jsx72("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ jsx72(
|
|
13793
14095
|
DynamicLayout_default,
|
|
13794
14096
|
{
|
|
13795
14097
|
components: columns.right,
|
|
@@ -13825,10 +14127,10 @@ var DynamicColumns_default = DynamicColumns;
|
|
|
13825
14127
|
|
|
13826
14128
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13827
14129
|
import { NavigationOption as NavigationOption4, NavigationOptionsList as NavigationOptionsList3 } from "@transferwise/components";
|
|
13828
|
-
import { jsx as
|
|
14130
|
+
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
13829
14131
|
function DynamicDecision({ component, onAction }) {
|
|
13830
14132
|
const { loading } = useDynamicFlow();
|
|
13831
|
-
return /* @__PURE__ */
|
|
14133
|
+
return /* @__PURE__ */ jsx73("div", { className: getMargin2(component.margin), children: /* @__PURE__ */ jsx73(NavigationOptionsList3, { children: component.options.map((option) => /* @__PURE__ */ jsx73(
|
|
13832
14134
|
NavigationOption4,
|
|
13833
14135
|
{
|
|
13834
14136
|
title: option.title,
|
|
@@ -13845,22 +14147,22 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13845
14147
|
var DynamicDecision_default = DynamicDecision;
|
|
13846
14148
|
|
|
13847
14149
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13848
|
-
import { jsx as
|
|
14150
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
13849
14151
|
var DynamicDivider = ({ component }) => {
|
|
13850
14152
|
const margin = getMargin2(component.margin);
|
|
13851
14153
|
const className = `m-t-0 ${margin}`;
|
|
13852
|
-
return /* @__PURE__ */
|
|
14154
|
+
return /* @__PURE__ */ jsx74("hr", { className });
|
|
13853
14155
|
};
|
|
13854
14156
|
var DynamicDivider_default = DynamicDivider;
|
|
13855
14157
|
|
|
13856
14158
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13857
14159
|
import { Button as Button7, Loader as Loader2, Size as Size2 } from "@transferwise/components";
|
|
13858
14160
|
import { useCallback as useCallback6, useEffect as useEffect8 } from "react";
|
|
13859
|
-
import { useIntl as
|
|
14161
|
+
import { useIntl as useIntl9 } from "react-intl";
|
|
13860
14162
|
|
|
13861
14163
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
13862
|
-
import { defineMessages as
|
|
13863
|
-
var DynamicExternal_messages_default =
|
|
14164
|
+
import { defineMessages as defineMessages10 } from "react-intl";
|
|
14165
|
+
var DynamicExternal_messages_default = defineMessages10({
|
|
13864
14166
|
retryTitle: {
|
|
13865
14167
|
id: "dynamicFlows.DynamicExternal.retryTitle",
|
|
13866
14168
|
defaultMessage: "Reopen window",
|
|
@@ -13869,10 +14171,10 @@ var DynamicExternal_messages_default = defineMessages9({
|
|
|
13869
14171
|
});
|
|
13870
14172
|
|
|
13871
14173
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13872
|
-
import { Fragment as Fragment11, jsx as
|
|
14174
|
+
import { Fragment as Fragment11, jsx as jsx75, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13873
14175
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13874
14176
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13875
|
-
const intl =
|
|
14177
|
+
const intl = useIntl9();
|
|
13876
14178
|
const openExternalUrl = useCallback6(
|
|
13877
14179
|
() => window.open(requestUrl, "df-external-window"),
|
|
13878
14180
|
[requestUrl]
|
|
@@ -13885,9 +14187,9 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
13885
14187
|
}) : void 0;
|
|
13886
14188
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13887
14189
|
return /* @__PURE__ */ jsxs25(Fragment11, { children: [
|
|
13888
|
-
/* @__PURE__ */
|
|
13889
|
-
/* @__PURE__ */
|
|
13890
|
-
/* @__PURE__ */
|
|
14190
|
+
/* @__PURE__ */ jsx75(Loader2, { size: Size2.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
14191
|
+
/* @__PURE__ */ jsx75("br", {}),
|
|
14192
|
+
/* @__PURE__ */ jsx75(Button7, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
13891
14193
|
] });
|
|
13892
14194
|
};
|
|
13893
14195
|
var DynamicExternal_default = DynamicExternal;
|
|
@@ -13898,8 +14200,8 @@ import { useEffect as useEffect15 } from "react";
|
|
|
13898
14200
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13899
14201
|
var import_classnames7 = __toESM(require_classnames());
|
|
13900
14202
|
import { Header as Header6 } from "@transferwise/components";
|
|
13901
|
-
import { useState as
|
|
13902
|
-
import { Fragment as Fragment12, jsx as
|
|
14203
|
+
import { useState as useState13 } from "react";
|
|
14204
|
+
import { Fragment as Fragment12, jsx as jsx76, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
13903
14205
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13904
14206
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13905
14207
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13914,13 +14216,13 @@ function AllOfSchema(props) {
|
|
|
13914
14216
|
setModels(models);
|
|
13915
14217
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13916
14218
|
};
|
|
13917
|
-
const [models, setModels] =
|
|
14219
|
+
const [models, setModels] = useState13(splitModel(props.model, props.schema.allOf));
|
|
13918
14220
|
return /* @__PURE__ */ jsxs26(Fragment12, { children: [
|
|
13919
|
-
props.schema.title && /* @__PURE__ */
|
|
13920
|
-
props.schema.description && /* @__PURE__ */
|
|
13921
|
-
/* @__PURE__ */
|
|
14221
|
+
props.schema.title && /* @__PURE__ */ jsx76(Header6, { title: props.schema.title }),
|
|
14222
|
+
props.schema.description && /* @__PURE__ */ jsx76("p", { children: props.schema.description }),
|
|
14223
|
+
/* @__PURE__ */ jsx76("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
13922
14224
|
// eslint-disable-next-line react/no-array-index-key
|
|
13923
|
-
/* @__PURE__ */
|
|
14225
|
+
/* @__PURE__ */ jsx76("div", { className: (0, import_classnames7.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ jsx76(
|
|
13924
14226
|
GenericSchema_default,
|
|
13925
14227
|
{
|
|
13926
14228
|
schema,
|
|
@@ -13949,13 +14251,13 @@ import {
|
|
|
13949
14251
|
Status,
|
|
13950
14252
|
UploadInput as UploadInput3
|
|
13951
14253
|
} from "@transferwise/components";
|
|
13952
|
-
import { useMemo as useMemo11, useState as
|
|
14254
|
+
import { useMemo as useMemo11, useState as useState14 } from "react";
|
|
13953
14255
|
|
|
13954
14256
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13955
14257
|
import { InlineAlert as InlineAlert4 } from "@transferwise/components";
|
|
13956
14258
|
import { formatDate as formatDate3 } from "@transferwise/formatting";
|
|
13957
|
-
import { useIntl as
|
|
13958
|
-
import { jsx as
|
|
14259
|
+
import { useIntl as useIntl10 } from "react-intl";
|
|
14260
|
+
import { jsx as jsx77, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
13959
14261
|
function ControlFeedback(props) {
|
|
13960
14262
|
var _a;
|
|
13961
14263
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13965,11 +14267,11 @@ function ControlFeedback(props) {
|
|
|
13965
14267
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13966
14268
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13967
14269
|
return /* @__PURE__ */ jsxs27("div", { id: props.id, children: [
|
|
13968
|
-
isErrorVisible ? /* @__PURE__ */
|
|
13969
|
-
isValidationVisible ? /* @__PURE__ */
|
|
14270
|
+
isErrorVisible ? /* @__PURE__ */ jsx77(InlineAlert4, { type: "error", children: props.errors }) : null,
|
|
14271
|
+
isValidationVisible ? /* @__PURE__ */ jsx77(InlineAlert4, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ jsx77("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
13970
14272
|
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ jsxs27(InlineAlert4, { type: "info", children: [
|
|
13971
|
-
isDescriptionVisible && /* @__PURE__ */
|
|
13972
|
-
hasInfoMessage && /* @__PURE__ */
|
|
14273
|
+
isDescriptionVisible && /* @__PURE__ */ jsx77("div", { children: props.schema.description }),
|
|
14274
|
+
hasInfoMessage && /* @__PURE__ */ jsx77("div", { children: props.infoMessage })
|
|
13973
14275
|
] })
|
|
13974
14276
|
] });
|
|
13975
14277
|
}
|
|
@@ -13980,7 +14282,7 @@ ControlFeedback.defaultProps = {
|
|
|
13980
14282
|
validationAsyncSuccessMessage: null
|
|
13981
14283
|
};
|
|
13982
14284
|
function useDefaultValidationMessages(schema) {
|
|
13983
|
-
const { formatMessage, locale } =
|
|
14285
|
+
const { formatMessage, locale } = useIntl10();
|
|
13984
14286
|
const formattedMessages = {
|
|
13985
14287
|
type: formatMessage(validation_messages_default.type),
|
|
13986
14288
|
minimum: formatMessage(validation_messages_default.minimum, {
|
|
@@ -14067,11 +14369,11 @@ function constructUploadError(response) {
|
|
|
14067
14369
|
}
|
|
14068
14370
|
|
|
14069
14371
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
14070
|
-
import { useIntl as
|
|
14372
|
+
import { useIntl as useIntl11 } from "react-intl";
|
|
14071
14373
|
|
|
14072
14374
|
// src/legacy/common/messages.ts
|
|
14073
|
-
import { defineMessages as
|
|
14074
|
-
var messages_default =
|
|
14375
|
+
import { defineMessages as defineMessages11 } from "react-intl";
|
|
14376
|
+
var messages_default = defineMessages11({
|
|
14075
14377
|
required: {
|
|
14076
14378
|
id: "dynamicFlows.DefaultErrorMessages.required",
|
|
14077
14379
|
defaultMessage: "Please fill out this field.",
|
|
@@ -14084,7 +14386,7 @@ function useFormattedDefaultErrorMessages({
|
|
|
14084
14386
|
maxItems,
|
|
14085
14387
|
minItems
|
|
14086
14388
|
}) {
|
|
14087
|
-
const { formatMessage } =
|
|
14389
|
+
const { formatMessage } = useIntl11();
|
|
14088
14390
|
const { maxFileSizeError, maxItemsError, minItemsError } = multi_file_upload_messages_default;
|
|
14089
14391
|
return {
|
|
14090
14392
|
maxFileSizeErrorMessage: formatMessage(maxFileSizeError),
|
|
@@ -14095,15 +14397,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
14095
14397
|
}
|
|
14096
14398
|
|
|
14097
14399
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
14098
|
-
import { jsx as
|
|
14400
|
+
import { jsx as jsx78, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14099
14401
|
function MultipleFileUploadSchema(props) {
|
|
14100
14402
|
var _a, _b;
|
|
14101
14403
|
const { onChange, schema } = props;
|
|
14102
14404
|
const onEvent = useEventDispatcher();
|
|
14103
14405
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
14104
14406
|
const uid = useMemo11(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14105
|
-
const [inputChanged, setInputChanged] =
|
|
14106
|
-
const [files, setFiles] =
|
|
14407
|
+
const [inputChanged, setInputChanged] = useState14(false);
|
|
14408
|
+
const [files, setFiles] = useState14(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
14107
14409
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
14108
14410
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
14109
14411
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -14158,9 +14460,9 @@ function MultipleFileUploadSchema(props) {
|
|
|
14158
14460
|
});
|
|
14159
14461
|
const feedbackId = `${uid}-feedback`;
|
|
14160
14462
|
return /* @__PURE__ */ jsxs28("div", { className: (0, import_classnames8.default)("form-group", { "has-error": showError }), children: [
|
|
14161
|
-
/* @__PURE__ */
|
|
14162
|
-
/* @__PURE__ */
|
|
14163
|
-
/* @__PURE__ */
|
|
14463
|
+
/* @__PURE__ */ jsx78("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
14464
|
+
/* @__PURE__ */ jsx78("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ jsx78(UploadInput3, __spreadValues({}, uploadInputProps)) }),
|
|
14465
|
+
/* @__PURE__ */ jsx78(
|
|
14164
14466
|
ControlFeedback_default,
|
|
14165
14467
|
{
|
|
14166
14468
|
id: feedbackId,
|
|
@@ -14202,13 +14504,13 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
14202
14504
|
|
|
14203
14505
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14204
14506
|
var import_classnames9 = __toESM(require_classnames());
|
|
14205
|
-
import { SelectInput as
|
|
14206
|
-
import { useEffect as useEffect9, useMemo as useMemo12, useState as
|
|
14207
|
-
import { useIntl as
|
|
14507
|
+
import { SelectInput as SelectInput3, SelectInputOptionContent as SelectInputOptionContent3 } from "@transferwise/components";
|
|
14508
|
+
import { useEffect as useEffect9, useMemo as useMemo12, useState as useState15 } from "react";
|
|
14509
|
+
import { useIntl as useIntl12 } from "react-intl";
|
|
14208
14510
|
|
|
14209
14511
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
14210
14512
|
import { Avatar as Avatar6, AvatarType as AvatarType5 } from "@transferwise/components";
|
|
14211
|
-
import { jsx as
|
|
14513
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
14212
14514
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
14213
14515
|
switch (controlType) {
|
|
14214
14516
|
case "select":
|
|
@@ -14232,7 +14534,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
14232
14534
|
var mapImage = (image) => {
|
|
14233
14535
|
if (image == null ? void 0 : image.url) {
|
|
14234
14536
|
return {
|
|
14235
|
-
icon: /* @__PURE__ */
|
|
14537
|
+
icon: /* @__PURE__ */ jsx79("div", { className: "media", children: /* @__PURE__ */ jsx79("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx79("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
14236
14538
|
hideIconInTrigger: true
|
|
14237
14539
|
};
|
|
14238
14540
|
}
|
|
@@ -14241,17 +14543,17 @@ var mapImage = (image) => {
|
|
|
14241
14543
|
var getIconPropertyForSelectOption = (icon) => {
|
|
14242
14544
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon2(icon.name)) {
|
|
14243
14545
|
return {
|
|
14244
|
-
icon: /* @__PURE__ */
|
|
14546
|
+
icon: /* @__PURE__ */ jsx79(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
14245
14547
|
};
|
|
14246
14548
|
}
|
|
14247
14549
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14248
14550
|
return {
|
|
14249
|
-
icon: /* @__PURE__ */
|
|
14551
|
+
icon: /* @__PURE__ */ jsx79(DynamicIcon_default2, { type: icon.name })
|
|
14250
14552
|
};
|
|
14251
14553
|
}
|
|
14252
14554
|
if (icon == null ? void 0 : icon.text) {
|
|
14253
14555
|
return {
|
|
14254
|
-
icon: /* @__PURE__ */
|
|
14556
|
+
icon: /* @__PURE__ */ jsx79("span", { children: icon.text })
|
|
14255
14557
|
};
|
|
14256
14558
|
}
|
|
14257
14559
|
return null;
|
|
@@ -14259,17 +14561,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
14259
14561
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
14260
14562
|
if (image == null ? void 0 : image.url) {
|
|
14261
14563
|
return {
|
|
14262
|
-
avatar: /* @__PURE__ */
|
|
14564
|
+
avatar: /* @__PURE__ */ jsx79(Avatar6, { type: AvatarType5.THUMBNAIL, children: /* @__PURE__ */ jsx79("img", { src: image.url, alt: "" }) })
|
|
14263
14565
|
};
|
|
14264
14566
|
}
|
|
14265
14567
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14266
14568
|
return {
|
|
14267
|
-
avatar: /* @__PURE__ */
|
|
14569
|
+
avatar: /* @__PURE__ */ jsx79(Avatar6, { type: AvatarType5.ICON, children: /* @__PURE__ */ jsx79(DynamicIcon_default2, { type: icon.name }) })
|
|
14268
14570
|
};
|
|
14269
14571
|
}
|
|
14270
14572
|
if (icon == null ? void 0 : icon.text) {
|
|
14271
14573
|
return {
|
|
14272
|
-
avatar: /* @__PURE__ */
|
|
14574
|
+
avatar: /* @__PURE__ */ jsx79(Avatar6, { type: AvatarType5.INITIALS, children: icon.text })
|
|
14273
14575
|
};
|
|
14274
14576
|
}
|
|
14275
14577
|
return null;
|
|
@@ -14297,18 +14599,8 @@ var getDisabled = (disabled) => {
|
|
|
14297
14599
|
return void 0;
|
|
14298
14600
|
};
|
|
14299
14601
|
|
|
14300
|
-
// src/common/messages/multi-select.messages.ts
|
|
14301
|
-
import { defineMessages as defineMessages11 } from "react-intl";
|
|
14302
|
-
var multi_select_messages_default = defineMessages11({
|
|
14303
|
-
summary: {
|
|
14304
|
-
id: "dynamicFlows.MultiSelect.summary",
|
|
14305
|
-
defaultMessage: "{first} and {count} more",
|
|
14306
|
-
description: "A summary of the multiple items selected. Showing the title of the first selected item, and the number of other items that have been selected."
|
|
14307
|
-
}
|
|
14308
|
-
});
|
|
14309
|
-
|
|
14310
14602
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14311
|
-
import { jsx as
|
|
14603
|
+
import { jsx as jsx80, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
14312
14604
|
function MultiSelectSchema({
|
|
14313
14605
|
schema,
|
|
14314
14606
|
model,
|
|
@@ -14317,12 +14609,12 @@ function MultiSelectSchema({
|
|
|
14317
14609
|
errors,
|
|
14318
14610
|
onChange
|
|
14319
14611
|
}) {
|
|
14320
|
-
const { formatMessage, locale } =
|
|
14612
|
+
const { formatMessage, locale } = useIntl12();
|
|
14321
14613
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
14322
14614
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
14323
14615
|
const id = useMemo12(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14324
|
-
const [changed, setChanged] =
|
|
14325
|
-
const [selected, setSelected] =
|
|
14616
|
+
const [changed, setChanged] = useState15(false);
|
|
14617
|
+
const [selected, setSelected] = useState15(getInitialModelIndices2(model, options));
|
|
14326
14618
|
useEffect9(
|
|
14327
14619
|
() => {
|
|
14328
14620
|
if (selected) {
|
|
@@ -14361,9 +14653,9 @@ function MultiSelectSchema({
|
|
|
14361
14653
|
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
14362
14654
|
};
|
|
14363
14655
|
return /* @__PURE__ */ jsxs29("div", { className: (0, import_classnames9.default)("d-flex flex-column", formGroupClasses), children: [
|
|
14364
|
-
schema.title ? /* @__PURE__ */
|
|
14365
|
-
/* @__PURE__ */
|
|
14366
|
-
|
|
14656
|
+
schema.title ? /* @__PURE__ */ jsx80("label", { htmlFor: id, children: schema.title }) : void 0,
|
|
14657
|
+
/* @__PURE__ */ jsx80(
|
|
14658
|
+
SelectInput3,
|
|
14367
14659
|
{
|
|
14368
14660
|
id,
|
|
14369
14661
|
multiple: true,
|
|
@@ -14388,12 +14680,12 @@ function MultiSelectSchema({
|
|
|
14388
14680
|
if (withinTrigger) {
|
|
14389
14681
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14390
14682
|
}
|
|
14391
|
-
return /* @__PURE__ */
|
|
14683
|
+
return /* @__PURE__ */ jsx80(SelectInputOptionContent3, { title: label, note: note != null ? note : secondary, icon });
|
|
14392
14684
|
},
|
|
14393
14685
|
onChange: broadcastModelChange
|
|
14394
14686
|
}
|
|
14395
14687
|
),
|
|
14396
|
-
/* @__PURE__ */
|
|
14688
|
+
/* @__PURE__ */ jsx80(
|
|
14397
14689
|
ControlFeedback_default,
|
|
14398
14690
|
{
|
|
14399
14691
|
id: `${id}-feedback`,
|
|
@@ -14410,7 +14702,7 @@ function MultiSelectSchema({
|
|
|
14410
14702
|
)
|
|
14411
14703
|
] });
|
|
14412
14704
|
}
|
|
14413
|
-
var
|
|
14705
|
+
var getInitialModelIndices2 = (model, options) => {
|
|
14414
14706
|
if (model == null) {
|
|
14415
14707
|
return null;
|
|
14416
14708
|
}
|
|
@@ -14420,14 +14712,14 @@ var getInitialModelIndices = (model, options) => {
|
|
|
14420
14712
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14421
14713
|
import { Header as Header7, Modal as Modal3, NavigationOption as NavigationOption6 } from "@transferwise/components";
|
|
14422
14714
|
import { Plus as Plus2 } from "@transferwise/icons";
|
|
14423
|
-
import { useMemo as useMemo13, useState as
|
|
14424
|
-
import { useIntl as
|
|
14715
|
+
import { useMemo as useMemo13, useState as useState17 } from "react";
|
|
14716
|
+
import { useIntl as useIntl14 } from "react-intl";
|
|
14425
14717
|
|
|
14426
14718
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14427
14719
|
import { NavigationOption as NavigationOption5 } from "@transferwise/components";
|
|
14428
|
-
import { jsx as
|
|
14720
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
14429
14721
|
function ItemSummaryOption2({ item, onClick }) {
|
|
14430
|
-
return /* @__PURE__ */
|
|
14722
|
+
return /* @__PURE__ */ jsx81(
|
|
14431
14723
|
NavigationOption5,
|
|
14432
14724
|
{
|
|
14433
14725
|
media: getNavigationOptionMedia(item),
|
|
@@ -14440,9 +14732,9 @@ function ItemSummaryOption2({ item, onClick }) {
|
|
|
14440
14732
|
}
|
|
14441
14733
|
|
|
14442
14734
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14443
|
-
import { useState as
|
|
14444
|
-
import { useIntl as
|
|
14445
|
-
import { jsx as
|
|
14735
|
+
import { useState as useState16 } from "react";
|
|
14736
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
14737
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
14446
14738
|
function RepeatableSchemaStep({
|
|
14447
14739
|
type,
|
|
14448
14740
|
schema,
|
|
@@ -14452,8 +14744,8 @@ function RepeatableSchemaStep({
|
|
|
14452
14744
|
onModelChange,
|
|
14453
14745
|
onAction
|
|
14454
14746
|
}) {
|
|
14455
|
-
const { formatMessage } =
|
|
14456
|
-
const [filename, setFilename] =
|
|
14747
|
+
const { formatMessage } = useIntl13();
|
|
14748
|
+
const [filename, setFilename] = useState16(void 0);
|
|
14457
14749
|
const step = {
|
|
14458
14750
|
layout: [
|
|
14459
14751
|
{
|
|
@@ -14490,7 +14782,7 @@ function RepeatableSchemaStep({
|
|
|
14490
14782
|
}
|
|
14491
14783
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14492
14784
|
};
|
|
14493
|
-
return /* @__PURE__ */
|
|
14785
|
+
return /* @__PURE__ */ jsx82(
|
|
14494
14786
|
DynamicFlowStep,
|
|
14495
14787
|
{
|
|
14496
14788
|
step,
|
|
@@ -14696,7 +14988,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14696
14988
|
|
|
14697
14989
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14698
14990
|
var import_classnames10 = __toESM(require_classnames());
|
|
14699
|
-
import { jsx as
|
|
14991
|
+
import { jsx as jsx83, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
14700
14992
|
function RepeatableSchema({
|
|
14701
14993
|
schema,
|
|
14702
14994
|
model,
|
|
@@ -14706,9 +14998,9 @@ function RepeatableSchema({
|
|
|
14706
14998
|
onChange
|
|
14707
14999
|
}) {
|
|
14708
15000
|
var _a;
|
|
14709
|
-
const [openModalType, setOpenModalType] =
|
|
14710
|
-
const [changed, setChanged] =
|
|
14711
|
-
const [itemSummaries, setItemSummaries] =
|
|
15001
|
+
const [openModalType, setOpenModalType] = useState17(null);
|
|
15002
|
+
const [changed, setChanged] = useState17(false);
|
|
15003
|
+
const [itemSummaries, setItemSummaries] = useState17(() => {
|
|
14712
15004
|
if (isObject2(model) && !isArray2(model)) {
|
|
14713
15005
|
throw new Error(
|
|
14714
15006
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14716,7 +15008,7 @@ function RepeatableSchema({
|
|
|
14716
15008
|
}
|
|
14717
15009
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14718
15010
|
});
|
|
14719
|
-
const [editableItem, setEditableItem] =
|
|
15011
|
+
const [editableItem, setEditableItem] = useState17({ item: null, model: null });
|
|
14720
15012
|
const id = useMemo13(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14721
15013
|
const broadcastModelChange = (updatedItems) => {
|
|
14722
15014
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
@@ -14759,7 +15051,7 @@ function RepeatableSchema({
|
|
|
14759
15051
|
setEditableItem({ item: null, model: null });
|
|
14760
15052
|
setOpenModalType(null);
|
|
14761
15053
|
};
|
|
14762
|
-
const { formatMessage } =
|
|
15054
|
+
const { formatMessage } = useIntl14();
|
|
14763
15055
|
const validations = getValidationFailures(model, schema, required);
|
|
14764
15056
|
const base64ValidationMessages = useFormattedDefaultErrorMessages({
|
|
14765
15057
|
minItems: schema.minItems,
|
|
@@ -14774,8 +15066,8 @@ function RepeatableSchema({
|
|
|
14774
15066
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14775
15067
|
};
|
|
14776
15068
|
return /* @__PURE__ */ jsxs30("div", { id, className: (0, import_classnames10.default)(formGroupClasses), children: [
|
|
14777
|
-
schema.title && /* @__PURE__ */
|
|
14778
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */
|
|
15069
|
+
schema.title && /* @__PURE__ */ jsx83(Header7, { title: schema.title }),
|
|
15070
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ jsx83(
|
|
14779
15071
|
ItemSummaryOption2,
|
|
14780
15072
|
{
|
|
14781
15073
|
item: itemSummary,
|
|
@@ -14783,21 +15075,21 @@ function RepeatableSchema({
|
|
|
14783
15075
|
},
|
|
14784
15076
|
JSON.stringify(itemSummary)
|
|
14785
15077
|
)),
|
|
14786
|
-
/* @__PURE__ */
|
|
15078
|
+
/* @__PURE__ */ jsx83(
|
|
14787
15079
|
NavigationOption6,
|
|
14788
15080
|
{
|
|
14789
|
-
media: /* @__PURE__ */
|
|
15081
|
+
media: /* @__PURE__ */ jsx83(Plus2, {}),
|
|
14790
15082
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14791
15083
|
showMediaAtAllSizes: true,
|
|
14792
15084
|
onClick: onAddItem
|
|
14793
15085
|
}
|
|
14794
15086
|
),
|
|
14795
|
-
/* @__PURE__ */
|
|
15087
|
+
/* @__PURE__ */ jsx83(
|
|
14796
15088
|
Modal3,
|
|
14797
15089
|
{
|
|
14798
15090
|
open: openModalType !== null,
|
|
14799
15091
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14800
|
-
body: /* @__PURE__ */
|
|
15092
|
+
body: /* @__PURE__ */ jsx83(
|
|
14801
15093
|
RepeatableSchemaStep_default,
|
|
14802
15094
|
{
|
|
14803
15095
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14812,7 +15104,7 @@ function RepeatableSchema({
|
|
|
14812
15104
|
onClose: onCancelEdit
|
|
14813
15105
|
}
|
|
14814
15106
|
),
|
|
14815
|
-
/* @__PURE__ */
|
|
15107
|
+
/* @__PURE__ */ jsx83(
|
|
14816
15108
|
ControlFeedback_default,
|
|
14817
15109
|
{
|
|
14818
15110
|
id: `${id}-feedback`,
|
|
@@ -14854,17 +15146,17 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14854
15146
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14855
15147
|
|
|
14856
15148
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14857
|
-
import { jsx as
|
|
15149
|
+
import { jsx as jsx84 } from "react/jsx-runtime";
|
|
14858
15150
|
function ArrayListSchema(props) {
|
|
14859
15151
|
const { schema } = props;
|
|
14860
15152
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14861
|
-
return /* @__PURE__ */
|
|
15153
|
+
return /* @__PURE__ */ jsx84(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14862
15154
|
}
|
|
14863
15155
|
if (isMultiSelectConstSchema(schema)) {
|
|
14864
|
-
return /* @__PURE__ */
|
|
15156
|
+
return /* @__PURE__ */ jsx84(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14865
15157
|
}
|
|
14866
15158
|
if (isListArraySchema(schema)) {
|
|
14867
|
-
return /* @__PURE__ */
|
|
15159
|
+
return /* @__PURE__ */ jsx84(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14868
15160
|
}
|
|
14869
15161
|
throw new Error("Invalid array list schema");
|
|
14870
15162
|
}
|
|
@@ -14875,11 +15167,11 @@ ArrayListSchema.defaultProps = {
|
|
|
14875
15167
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14876
15168
|
|
|
14877
15169
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14878
|
-
import { jsx as
|
|
15170
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
14879
15171
|
var ArraySchema = (props) => {
|
|
14880
15172
|
const { schema } = props;
|
|
14881
15173
|
if (isListArraySchema(schema)) {
|
|
14882
|
-
return /* @__PURE__ */
|
|
15174
|
+
return /* @__PURE__ */ jsx85(ArrayListSchema_default, __spreadValues({}, props));
|
|
14883
15175
|
}
|
|
14884
15176
|
throw new Error("Not implemented");
|
|
14885
15177
|
};
|
|
@@ -14891,15 +15183,15 @@ var ArraySchema_default = ArraySchema;
|
|
|
14891
15183
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14892
15184
|
var import_classnames11 = __toESM(require_classnames());
|
|
14893
15185
|
import { Header as Header8 } from "@transferwise/components";
|
|
14894
|
-
import { useState as
|
|
14895
|
-
import { Fragment as Fragment13, jsx as
|
|
15186
|
+
import { useState as useState18, useEffect as useEffect10 } from "react";
|
|
15187
|
+
import { Fragment as Fragment13, jsx as jsx86, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
14896
15188
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14897
15189
|
"col-xs-12": true,
|
|
14898
15190
|
"col-sm-6": width === "md",
|
|
14899
15191
|
"col-sm-4": width === "sm"
|
|
14900
15192
|
});
|
|
14901
15193
|
function ObjectSchema(props) {
|
|
14902
|
-
const [model, setModel] =
|
|
15194
|
+
const [model, setModel] = useState18(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14903
15195
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14904
15196
|
if (onChangeProps.model !== null) {
|
|
14905
15197
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14929,21 +15221,21 @@ function ObjectSchema(props) {
|
|
|
14929
15221
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14930
15222
|
const propsErrors = props.errors;
|
|
14931
15223
|
return /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
14932
|
-
props.schema.alert && /* @__PURE__ */
|
|
15224
|
+
props.schema.alert && /* @__PURE__ */ jsx86(DynamicAlert_default, { component: props.schema.alert }),
|
|
14933
15225
|
/* @__PURE__ */ jsxs31("fieldset", { children: [
|
|
14934
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */
|
|
15226
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ jsx86(Header8, { title: props.schema.title, as: "legend" }),
|
|
14935
15227
|
props.schema.description && !props.hideTitle && /* @__PURE__ */ jsxs31("p", { children: [
|
|
14936
15228
|
" ",
|
|
14937
15229
|
props.schema.description,
|
|
14938
15230
|
" "
|
|
14939
15231
|
] }),
|
|
14940
|
-
/* @__PURE__ */
|
|
15232
|
+
/* @__PURE__ */ jsx86("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ jsx86(
|
|
14941
15233
|
"div",
|
|
14942
15234
|
{
|
|
14943
15235
|
className: (0, import_classnames11.default)(
|
|
14944
15236
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14945
15237
|
),
|
|
14946
|
-
children: /* @__PURE__ */
|
|
15238
|
+
children: /* @__PURE__ */ jsx86(
|
|
14947
15239
|
GenericSchema_default,
|
|
14948
15240
|
{
|
|
14949
15241
|
schema: props.schema.properties[propertyName],
|
|
@@ -14971,19 +15263,19 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
14971
15263
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14972
15264
|
var import_classnames12 = __toESM(require_classnames());
|
|
14973
15265
|
import { Header as Header9 } from "@transferwise/components";
|
|
14974
|
-
import { useEffect as useEffect12, useMemo as useMemo14, useState as
|
|
15266
|
+
import { useEffect as useEffect12, useMemo as useMemo14, useState as useState19 } from "react";
|
|
14975
15267
|
|
|
14976
15268
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14977
15269
|
import { Markdown as Markdown6, Info as Info2 } from "@transferwise/components";
|
|
14978
|
-
import { useIntl as
|
|
14979
|
-
import { jsx as
|
|
15270
|
+
import { useIntl as useIntl15 } from "react-intl";
|
|
15271
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
14980
15272
|
function Help2(props) {
|
|
14981
|
-
const intl =
|
|
14982
|
-
return /* @__PURE__ */
|
|
15273
|
+
const intl = useIntl15();
|
|
15274
|
+
return /* @__PURE__ */ jsx87(
|
|
14983
15275
|
Info2,
|
|
14984
15276
|
{
|
|
14985
15277
|
className: "m-l-1",
|
|
14986
|
-
content: /* @__PURE__ */
|
|
15278
|
+
content: /* @__PURE__ */ jsx87(Markdown6, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
14987
15279
|
presentation: "POPOVER",
|
|
14988
15280
|
size: "sm",
|
|
14989
15281
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -15003,8 +15295,8 @@ import {
|
|
|
15003
15295
|
InputWithDisplayFormat as InputWithDisplayFormat2,
|
|
15004
15296
|
PhoneNumberInput as PhoneNumberInput2,
|
|
15005
15297
|
RadioGroup as RadioGroup2,
|
|
15006
|
-
SelectInput as
|
|
15007
|
-
SelectInputOptionContent as
|
|
15298
|
+
SelectInput as SelectInput4,
|
|
15299
|
+
SelectInputOptionContent as SelectInputOptionContent4,
|
|
15008
15300
|
Tabs as Tabs2,
|
|
15009
15301
|
TextareaWithDisplayFormat as TextareaWithDisplayFormat2,
|
|
15010
15302
|
Upload as Upload2
|
|
@@ -15195,7 +15487,7 @@ var autocompleteTokenMap2 = {
|
|
|
15195
15487
|
};
|
|
15196
15488
|
|
|
15197
15489
|
// src/legacy/formControl/FormControl.tsx
|
|
15198
|
-
import { Fragment as Fragment14, jsx as
|
|
15490
|
+
import { Fragment as Fragment14, jsx as jsx88 } from "react/jsx-runtime";
|
|
15199
15491
|
var _FormControl = class _FormControl extends PureComponent {
|
|
15200
15492
|
constructor(props) {
|
|
15201
15493
|
super(props);
|
|
@@ -15283,7 +15575,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15283
15575
|
} = this.props;
|
|
15284
15576
|
switch (type) {
|
|
15285
15577
|
case FormControlType.RADIO:
|
|
15286
|
-
return /* @__PURE__ */
|
|
15578
|
+
return /* @__PURE__ */ jsx88(
|
|
15287
15579
|
RadioGroup2,
|
|
15288
15580
|
{
|
|
15289
15581
|
radios: options.map(this.mapOption),
|
|
@@ -15293,7 +15585,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15293
15585
|
}
|
|
15294
15586
|
);
|
|
15295
15587
|
case FormControlType.CHECKBOX:
|
|
15296
|
-
return /* @__PURE__ */
|
|
15588
|
+
return /* @__PURE__ */ jsx88(
|
|
15297
15589
|
Checkbox2,
|
|
15298
15590
|
{
|
|
15299
15591
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
@@ -15311,8 +15603,8 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15311
15603
|
const search = options.length >= 8;
|
|
15312
15604
|
const items = options;
|
|
15313
15605
|
const selected = this.getSelectedOption(options);
|
|
15314
|
-
return /* @__PURE__ */
|
|
15315
|
-
|
|
15606
|
+
return /* @__PURE__ */ jsx88("div", { className: "d-flex flex-column", children: /* @__PURE__ */ jsx88(
|
|
15607
|
+
SelectInput4,
|
|
15316
15608
|
{
|
|
15317
15609
|
id,
|
|
15318
15610
|
items: items.map((value2) => ({
|
|
@@ -15321,8 +15613,8 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15321
15613
|
disabled: value2.disabled
|
|
15322
15614
|
})),
|
|
15323
15615
|
value: selected != null ? selected : null,
|
|
15324
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */
|
|
15325
|
-
|
|
15616
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ jsx88(
|
|
15617
|
+
SelectInputOptionContent4,
|
|
15326
15618
|
{
|
|
15327
15619
|
title: label2,
|
|
15328
15620
|
note: withinTrigger ? note != null ? note : secondary : note,
|
|
@@ -15350,13 +15642,13 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15350
15642
|
) });
|
|
15351
15643
|
}
|
|
15352
15644
|
case FormControlType.TAB:
|
|
15353
|
-
return /* @__PURE__ */
|
|
15645
|
+
return /* @__PURE__ */ jsx88(
|
|
15354
15646
|
Tabs2,
|
|
15355
15647
|
{
|
|
15356
15648
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15357
15649
|
tabs: options.map((option) => ({
|
|
15358
15650
|
title: option.label,
|
|
15359
|
-
content: /* @__PURE__ */
|
|
15651
|
+
content: /* @__PURE__ */ jsx88(Fragment14, {}),
|
|
15360
15652
|
disabled: option.disabled || false
|
|
15361
15653
|
})),
|
|
15362
15654
|
name: id,
|
|
@@ -15371,7 +15663,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15371
15663
|
);
|
|
15372
15664
|
case FormControlType.NUMERIC:
|
|
15373
15665
|
case FormControlType.NUMBER: {
|
|
15374
|
-
return /* @__PURE__ */
|
|
15666
|
+
return /* @__PURE__ */ jsx88(
|
|
15375
15667
|
"input",
|
|
15376
15668
|
{
|
|
15377
15669
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15405,7 +15697,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15405
15697
|
);
|
|
15406
15698
|
}
|
|
15407
15699
|
case FormControlType.HIDDEN:
|
|
15408
|
-
return /* @__PURE__ */
|
|
15700
|
+
return /* @__PURE__ */ jsx88(
|
|
15409
15701
|
"input",
|
|
15410
15702
|
{
|
|
15411
15703
|
type: "hidden",
|
|
@@ -15415,7 +15707,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15415
15707
|
}
|
|
15416
15708
|
);
|
|
15417
15709
|
case FormControlType.PASSWORD:
|
|
15418
|
-
return /* @__PURE__ */
|
|
15710
|
+
return /* @__PURE__ */ jsx88(
|
|
15419
15711
|
"input",
|
|
15420
15712
|
{
|
|
15421
15713
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15435,7 +15727,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15435
15727
|
);
|
|
15436
15728
|
case FormControlType.DATE:
|
|
15437
15729
|
case FormControlType.DATETIME:
|
|
15438
|
-
return /* @__PURE__ */
|
|
15730
|
+
return /* @__PURE__ */ jsx88(
|
|
15439
15731
|
DateInput2,
|
|
15440
15732
|
{
|
|
15441
15733
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
@@ -15451,7 +15743,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15451
15743
|
}
|
|
15452
15744
|
);
|
|
15453
15745
|
case FormControlType.DATELOOKUP: {
|
|
15454
|
-
return /* @__PURE__ */
|
|
15746
|
+
return /* @__PURE__ */ jsx88(
|
|
15455
15747
|
DateLookup2,
|
|
15456
15748
|
{
|
|
15457
15749
|
value: getSafeDateStringValue(value),
|
|
@@ -15469,7 +15761,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15469
15761
|
);
|
|
15470
15762
|
}
|
|
15471
15763
|
case FormControlType.TEL:
|
|
15472
|
-
return /* @__PURE__ */
|
|
15764
|
+
return /* @__PURE__ */ jsx88(
|
|
15473
15765
|
PhoneNumberInput2,
|
|
15474
15766
|
{
|
|
15475
15767
|
disabled,
|
|
@@ -15501,7 +15793,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15501
15793
|
autoComplete: this.getAutocompleteValue()
|
|
15502
15794
|
};
|
|
15503
15795
|
if (this.props.displayPattern) {
|
|
15504
|
-
return /* @__PURE__ */
|
|
15796
|
+
return /* @__PURE__ */ jsx88(
|
|
15505
15797
|
TextareaWithDisplayFormat2,
|
|
15506
15798
|
__spreadProps(__spreadValues({
|
|
15507
15799
|
displayPattern: this.props.displayPattern
|
|
@@ -15510,7 +15802,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15510
15802
|
})
|
|
15511
15803
|
);
|
|
15512
15804
|
}
|
|
15513
|
-
return /* @__PURE__ */
|
|
15805
|
+
return /* @__PURE__ */ jsx88(
|
|
15514
15806
|
"textarea",
|
|
15515
15807
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15516
15808
|
"aria-describedby": describedBy,
|
|
@@ -15523,7 +15815,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15523
15815
|
return (
|
|
15524
15816
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15525
15817
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
15526
|
-
/* @__PURE__ */
|
|
15818
|
+
/* @__PURE__ */ jsx88(
|
|
15527
15819
|
Upload2,
|
|
15528
15820
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15529
15821
|
usAccept: uploadProps.usAccept || "*",
|
|
@@ -15561,7 +15853,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15561
15853
|
autoComplete: this.getAutocompleteValue()
|
|
15562
15854
|
};
|
|
15563
15855
|
if (this.props.displayPattern) {
|
|
15564
|
-
return /* @__PURE__ */
|
|
15856
|
+
return /* @__PURE__ */ jsx88(
|
|
15565
15857
|
InputWithDisplayFormat2,
|
|
15566
15858
|
__spreadProps(__spreadValues({
|
|
15567
15859
|
displayPattern: this.props.displayPattern
|
|
@@ -15570,7 +15862,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
15570
15862
|
})
|
|
15571
15863
|
);
|
|
15572
15864
|
}
|
|
15573
|
-
return /* @__PURE__ */
|
|
15865
|
+
return /* @__PURE__ */ jsx88(
|
|
15574
15866
|
"input",
|
|
15575
15867
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15576
15868
|
"aria-describedby": describedBy,
|
|
@@ -15619,7 +15911,7 @@ _FormControl.defaultProps = {
|
|
|
15619
15911
|
var FormControl = _FormControl;
|
|
15620
15912
|
|
|
15621
15913
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15622
|
-
import { jsx as
|
|
15914
|
+
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
15623
15915
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15624
15916
|
var getControlType = (schema) => {
|
|
15625
15917
|
if (isOneOfSchema2(schema)) {
|
|
@@ -15725,7 +16017,7 @@ function SchemaFormControl(props) {
|
|
|
15725
16017
|
describedBy,
|
|
15726
16018
|
required
|
|
15727
16019
|
};
|
|
15728
|
-
return /* @__PURE__ */
|
|
16020
|
+
return /* @__PURE__ */ jsx89("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ jsx89(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
15729
16021
|
}
|
|
15730
16022
|
SchemaFormControl.defaultProps = {
|
|
15731
16023
|
value: null,
|
|
@@ -15754,17 +16046,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15754
16046
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15755
16047
|
|
|
15756
16048
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15757
|
-
import { Fragment as Fragment15, jsx as
|
|
16049
|
+
import { Fragment as Fragment15, jsx as jsx90, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
15758
16050
|
function OneOfSchema(props) {
|
|
15759
16051
|
const onEvent = useEventDispatcher();
|
|
15760
|
-
const [changed, setChanged] =
|
|
15761
|
-
const [focused, setFocused] =
|
|
15762
|
-
const [blurred, setBlurred] =
|
|
16052
|
+
const [changed, setChanged] = useState19(false);
|
|
16053
|
+
const [focused, setFocused] = useState19(false);
|
|
16054
|
+
const [blurred, setBlurred] = useState19(false);
|
|
15763
16055
|
const id = useMemo14(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
15764
|
-
const [schemaIndex, setSchemaIndex] =
|
|
16056
|
+
const [schemaIndex, setSchemaIndex] = useState19(
|
|
15765
16057
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15766
16058
|
);
|
|
15767
|
-
const [models, setModels] =
|
|
16059
|
+
const [models, setModels] = useState19(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15768
16060
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15769
16061
|
const onSearchChange = (searchValue) => {
|
|
15770
16062
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15832,10 +16124,10 @@ function OneOfSchema(props) {
|
|
|
15832
16124
|
const feedbackId = `${id}-feedback`;
|
|
15833
16125
|
return /* @__PURE__ */ jsxs32(Fragment15, { children: [
|
|
15834
16126
|
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ jsxs32(Fragment15, { children: [
|
|
15835
|
-
props.schema.alert && /* @__PURE__ */
|
|
16127
|
+
props.schema.alert && /* @__PURE__ */ jsx90(DynamicAlert_default, { component: props.schema.alert }),
|
|
15836
16128
|
/* @__PURE__ */ jsxs32("div", { className: (0, import_classnames12.default)(formGroupClasses), children: [
|
|
15837
16129
|
getTitleAndHelp(props.schema, id),
|
|
15838
|
-
/* @__PURE__ */
|
|
16130
|
+
/* @__PURE__ */ jsx90(
|
|
15839
16131
|
SchemaFormControl_default,
|
|
15840
16132
|
{
|
|
15841
16133
|
id,
|
|
@@ -15850,7 +16142,7 @@ function OneOfSchema(props) {
|
|
|
15850
16142
|
onSearchChange
|
|
15851
16143
|
}
|
|
15852
16144
|
),
|
|
15853
|
-
/* @__PURE__ */
|
|
16145
|
+
/* @__PURE__ */ jsx90(
|
|
15854
16146
|
ControlFeedback_default,
|
|
15855
16147
|
{
|
|
15856
16148
|
id: feedbackId,
|
|
@@ -15866,7 +16158,7 @@ function OneOfSchema(props) {
|
|
|
15866
16158
|
)
|
|
15867
16159
|
] })
|
|
15868
16160
|
] }),
|
|
15869
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */
|
|
16161
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ jsx90(
|
|
15870
16162
|
GenericSchema_default,
|
|
15871
16163
|
{
|
|
15872
16164
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15883,16 +16175,16 @@ function OneOfSchema(props) {
|
|
|
15883
16175
|
}
|
|
15884
16176
|
function getTitleAndHelp(schema, forId) {
|
|
15885
16177
|
var _a;
|
|
15886
|
-
const helpElement = schema.help ? /* @__PURE__ */
|
|
15887
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */
|
|
16178
|
+
const helpElement = schema.help ? /* @__PURE__ */ jsx90(Help_default2, { help: schema.help }) : null;
|
|
16179
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ jsx90("div", { className: "m-b-1", children: /* @__PURE__ */ jsxs32("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
15888
16180
|
schema.title,
|
|
15889
16181
|
" ",
|
|
15890
16182
|
helpElement
|
|
15891
|
-
] }) }) : /* @__PURE__ */
|
|
16183
|
+
] }) }) : /* @__PURE__ */ jsx90(Fragment15, { children: helpElement ? /* @__PURE__ */ jsxs32("h4", { className: "m-b-2", children: [
|
|
15892
16184
|
schema.title,
|
|
15893
16185
|
" ",
|
|
15894
16186
|
helpElement
|
|
15895
|
-
] }) : /* @__PURE__ */
|
|
16187
|
+
] }) : /* @__PURE__ */ jsx90(Header9, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15896
16188
|
return schema.title ? titleElement : helpElement;
|
|
15897
16189
|
}
|
|
15898
16190
|
function getValidations(props, schemaIndex) {
|
|
@@ -15929,12 +16221,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15929
16221
|
|
|
15930
16222
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15931
16223
|
var import_classnames13 = __toESM(require_classnames());
|
|
15932
|
-
import { useEffect as useEffect13, useState as
|
|
16224
|
+
import { useEffect as useEffect13, useState as useState20 } from "react";
|
|
15933
16225
|
|
|
15934
16226
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15935
16227
|
import { Status as Status2, UploadInput as UploadInput4 } from "@transferwise/components";
|
|
15936
16228
|
import { useMemo as useMemo15 } from "react";
|
|
15937
|
-
import { jsx as
|
|
16229
|
+
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
15938
16230
|
function UploadInputAdapter(props) {
|
|
15939
16231
|
const {
|
|
15940
16232
|
id,
|
|
@@ -15967,7 +16259,7 @@ function UploadInputAdapter(props) {
|
|
|
15967
16259
|
return Promise.reject();
|
|
15968
16260
|
});
|
|
15969
16261
|
};
|
|
15970
|
-
return /* @__PURE__ */
|
|
16262
|
+
return /* @__PURE__ */ jsx91(
|
|
15971
16263
|
UploadInput4,
|
|
15972
16264
|
{
|
|
15973
16265
|
id,
|
|
@@ -15987,13 +16279,13 @@ function UploadInputAdapter(props) {
|
|
|
15987
16279
|
}
|
|
15988
16280
|
|
|
15989
16281
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15990
|
-
import { jsx as
|
|
16282
|
+
import { jsx as jsx92, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15991
16283
|
function PersistAsyncBlobSchema(props) {
|
|
15992
16284
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
15993
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] =
|
|
15994
|
-
const [persistAsyncValidations, setPersistAsyncValidations] =
|
|
15995
|
-
const [validations, setValidations] =
|
|
15996
|
-
const [changed, setChanged] =
|
|
16285
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = useState20({});
|
|
16286
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = useState20(null);
|
|
16287
|
+
const [validations, setValidations] = useState20([]);
|
|
16288
|
+
const [changed, setChanged] = useState20(false);
|
|
15997
16289
|
const httpClient = useHttpClient();
|
|
15998
16290
|
const onEvent = useEventDispatcher();
|
|
15999
16291
|
useEffect13(() => {
|
|
@@ -16034,7 +16326,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16034
16326
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
16035
16327
|
const feedbackId = `${id}-feedback`;
|
|
16036
16328
|
return /* @__PURE__ */ jsxs33("div", { className: (0, import_classnames13.default)(formGroupClasses), children: [
|
|
16037
|
-
/* @__PURE__ */
|
|
16329
|
+
/* @__PURE__ */ jsx92("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ jsx92(
|
|
16038
16330
|
UploadInputAdapter,
|
|
16039
16331
|
__spreadValues({
|
|
16040
16332
|
id,
|
|
@@ -16051,7 +16343,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16051
16343
|
onCancel
|
|
16052
16344
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
16053
16345
|
) }),
|
|
16054
|
-
/* @__PURE__ */
|
|
16346
|
+
/* @__PURE__ */ jsx92(
|
|
16055
16347
|
ControlFeedback_default,
|
|
16056
16348
|
{
|
|
16057
16349
|
id: feedbackId,
|
|
@@ -16076,17 +16368,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
16076
16368
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
16077
16369
|
|
|
16078
16370
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
16079
|
-
import { jsx as
|
|
16371
|
+
import { jsx as jsx93 } from "react/jsx-runtime";
|
|
16080
16372
|
function PersistAsyncSchema(props) {
|
|
16081
16373
|
const { schema } = props;
|
|
16082
16374
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
16083
16375
|
if (persistAsyncSchemaType === "blob") {
|
|
16084
|
-
return /* @__PURE__ */
|
|
16376
|
+
return /* @__PURE__ */ jsx93(
|
|
16085
16377
|
PersistAsyncBlobSchema_default,
|
|
16086
16378
|
__spreadValues({}, props)
|
|
16087
16379
|
);
|
|
16088
16380
|
}
|
|
16089
|
-
return /* @__PURE__ */
|
|
16381
|
+
return /* @__PURE__ */ jsx93(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
16090
16382
|
}
|
|
16091
16383
|
PersistAsyncSchema.defaultProps = {
|
|
16092
16384
|
required: false
|
|
@@ -16094,7 +16386,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
16094
16386
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
16095
16387
|
|
|
16096
16388
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16097
|
-
import { useState as
|
|
16389
|
+
import { useState as useState21 } from "react";
|
|
16098
16390
|
|
|
16099
16391
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
16100
16392
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -16107,7 +16399,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
16107
16399
|
|
|
16108
16400
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
16109
16401
|
import { Checkbox as Checkbox3 } from "@transferwise/components";
|
|
16110
|
-
import { jsx as
|
|
16402
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
16111
16403
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
16112
16404
|
const { id, selection, setSelection } = props;
|
|
16113
16405
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -16118,14 +16410,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
16118
16410
|
const toggleSelection = () => {
|
|
16119
16411
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
16120
16412
|
};
|
|
16121
|
-
return /* @__PURE__ */
|
|
16413
|
+
return /* @__PURE__ */ jsx94("div", { className: "form-group", children: /* @__PURE__ */ jsx94(Checkbox3, { id, label: title, checked, onChange: toggleSelection }) });
|
|
16122
16414
|
};
|
|
16123
16415
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
16124
16416
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
16125
16417
|
|
|
16126
16418
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
16127
16419
|
import { RadioGroup as RadioGroup3 } from "@transferwise/components";
|
|
16128
|
-
import { jsx as
|
|
16420
|
+
import { jsx as jsx95, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
16129
16421
|
function PromotedOneOfRadioControl(props) {
|
|
16130
16422
|
var _a, _b;
|
|
16131
16423
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -16143,8 +16435,8 @@ function PromotedOneOfRadioControl(props) {
|
|
|
16143
16435
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
16144
16436
|
];
|
|
16145
16437
|
return /* @__PURE__ */ jsxs34("div", { className: "form-group", children: [
|
|
16146
|
-
title && /* @__PURE__ */
|
|
16147
|
-
/* @__PURE__ */
|
|
16438
|
+
title && /* @__PURE__ */ jsx95("label", { className: "control-label", htmlFor: id, children: title }),
|
|
16439
|
+
/* @__PURE__ */ jsx95(
|
|
16148
16440
|
RadioGroup3,
|
|
16149
16441
|
{
|
|
16150
16442
|
name: "promoted-selection",
|
|
@@ -16162,16 +16454,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
16162
16454
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
16163
16455
|
|
|
16164
16456
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
16165
|
-
import { Fragment as Fragment16, jsx as
|
|
16457
|
+
import { Fragment as Fragment16, jsx as jsx96 } from "react/jsx-runtime";
|
|
16166
16458
|
function PromotedOneOfControl(props) {
|
|
16167
16459
|
const controlType = props.promotion.control || "radio";
|
|
16168
16460
|
switch (controlType) {
|
|
16169
16461
|
case "radio":
|
|
16170
|
-
return /* @__PURE__ */
|
|
16462
|
+
return /* @__PURE__ */ jsx96(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
16171
16463
|
case "checkbox":
|
|
16172
|
-
return /* @__PURE__ */
|
|
16464
|
+
return /* @__PURE__ */ jsx96(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
16173
16465
|
default:
|
|
16174
|
-
return /* @__PURE__ */
|
|
16466
|
+
return /* @__PURE__ */ jsx96(Fragment16, {});
|
|
16175
16467
|
}
|
|
16176
16468
|
}
|
|
16177
16469
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -16181,11 +16473,11 @@ PromotedOneOfControl.defaultProps = {
|
|
|
16181
16473
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
16182
16474
|
|
|
16183
16475
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16184
|
-
import { Fragment as Fragment17, jsx as
|
|
16476
|
+
import { Fragment as Fragment17, jsx as jsx97, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
16185
16477
|
var isPromoted = (schema) => schema.promoted === true;
|
|
16186
16478
|
var PromotedOneOfSchema = (props) => {
|
|
16187
16479
|
var _a;
|
|
16188
|
-
const [selection, setSelection] =
|
|
16480
|
+
const [selection, setSelection] = useState21(
|
|
16189
16481
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
16190
16482
|
);
|
|
16191
16483
|
const promotedAlert = props.schema.alert;
|
|
@@ -16193,8 +16485,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16193
16485
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
16194
16486
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
16195
16487
|
return /* @__PURE__ */ jsxs35(Fragment17, { children: [
|
|
16196
|
-
promotedAlert && /* @__PURE__ */
|
|
16197
|
-
/* @__PURE__ */
|
|
16488
|
+
promotedAlert && /* @__PURE__ */ jsx97(DynamicAlert_default, { component: promotedAlert }),
|
|
16489
|
+
/* @__PURE__ */ jsx97(
|
|
16198
16490
|
PromotedOneOfControl_default,
|
|
16199
16491
|
{
|
|
16200
16492
|
id: props.schema.$id,
|
|
@@ -16205,8 +16497,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16205
16497
|
setSelection
|
|
16206
16498
|
}
|
|
16207
16499
|
),
|
|
16208
|
-
selection === "promoted" && /* @__PURE__ */
|
|
16209
|
-
selection === "other" && /* @__PURE__ */
|
|
16500
|
+
selection === "promoted" && /* @__PURE__ */ jsx97(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
16501
|
+
selection === "other" && /* @__PURE__ */ jsx97(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
16210
16502
|
] });
|
|
16211
16503
|
};
|
|
16212
16504
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -16237,7 +16529,7 @@ var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
|
16237
16529
|
|
|
16238
16530
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16239
16531
|
import { DefinitionList as DefinitionList2, Layout } from "@transferwise/components";
|
|
16240
|
-
import { useIntl as
|
|
16532
|
+
import { useIntl as useIntl16 } from "react-intl";
|
|
16241
16533
|
|
|
16242
16534
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.ts
|
|
16243
16535
|
import { defineMessages as defineMessages12 } from "react-intl";
|
|
@@ -16255,12 +16547,12 @@ var ReadOnlySchema_messages_default = defineMessages12({
|
|
|
16255
16547
|
});
|
|
16256
16548
|
|
|
16257
16549
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16258
|
-
import { Fragment as Fragment18, jsx as
|
|
16550
|
+
import { Fragment as Fragment18, jsx as jsx98, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
16259
16551
|
function ReadOnlySchema({ schema, model }) {
|
|
16260
16552
|
const { title = "" } = schema;
|
|
16261
|
-
const { formatMessage } =
|
|
16553
|
+
const { formatMessage } = useIntl16();
|
|
16262
16554
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
16263
|
-
return /* @__PURE__ */
|
|
16555
|
+
return /* @__PURE__ */ jsx98(DefinitionList2, { layout: Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
16264
16556
|
}
|
|
16265
16557
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
16266
16558
|
function getValueForSchema({
|
|
@@ -16301,18 +16593,18 @@ function getValueFromOption(option) {
|
|
|
16301
16593
|
}
|
|
16302
16594
|
|
|
16303
16595
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
16304
|
-
import { useEffect as useEffect14, useRef as useRef3, useState as
|
|
16305
|
-
import { jsx as
|
|
16596
|
+
import { useEffect as useEffect14, useRef as useRef3, useState as useState22 } from "react";
|
|
16597
|
+
import { jsx as jsx99 } from "react/jsx-runtime";
|
|
16306
16598
|
function ValidationAsyncSchema(props) {
|
|
16307
16599
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
16308
|
-
const [validationAsyncModel, setValidationAsyncModel] =
|
|
16600
|
+
const [validationAsyncModel, setValidationAsyncModel] = useState22(model);
|
|
16309
16601
|
const previousRequestedModelReference = useRef3(null);
|
|
16310
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] =
|
|
16602
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = useState22(
|
|
16311
16603
|
null
|
|
16312
16604
|
);
|
|
16313
|
-
const [validationAsyncErrors, setValidationAsyncErrors] =
|
|
16314
|
-
const [fieldSubmitted, setFieldSubmitted] =
|
|
16315
|
-
const [abortController, setAbortController] =
|
|
16605
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = useState22(null);
|
|
16606
|
+
const [fieldSubmitted, setFieldSubmitted] = useState22(false);
|
|
16607
|
+
const [abortController, setAbortController] = useState22(null);
|
|
16316
16608
|
const httpClient = useHttpClient();
|
|
16317
16609
|
const onEvent = useEventDispatcher();
|
|
16318
16610
|
const log = useLogger();
|
|
@@ -16386,13 +16678,13 @@ function ValidationAsyncSchema(props) {
|
|
|
16386
16678
|
required,
|
|
16387
16679
|
schema
|
|
16388
16680
|
};
|
|
16389
|
-
return /* @__PURE__ */
|
|
16681
|
+
return /* @__PURE__ */ jsx99(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16390
16682
|
}
|
|
16391
16683
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
16392
16684
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16393
16685
|
|
|
16394
16686
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16395
|
-
import { Fragment as Fragment19, jsx as
|
|
16687
|
+
import { Fragment as Fragment19, jsx as jsx100 } from "react/jsx-runtime";
|
|
16396
16688
|
import { createElement } from "react";
|
|
16397
16689
|
function GenericSchemaForm(props) {
|
|
16398
16690
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
@@ -16409,29 +16701,29 @@ function GenericSchemaForm(props) {
|
|
|
16409
16701
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16410
16702
|
switch (type) {
|
|
16411
16703
|
case "readOnly":
|
|
16412
|
-
return /* @__PURE__ */
|
|
16704
|
+
return /* @__PURE__ */ jsx100(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16413
16705
|
case "persistAsync":
|
|
16414
|
-
return /* @__PURE__ */
|
|
16706
|
+
return /* @__PURE__ */ jsx100(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16415
16707
|
case "validationAsync":
|
|
16416
|
-
return /* @__PURE__ */
|
|
16708
|
+
return /* @__PURE__ */ jsx100(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16417
16709
|
case "basic": {
|
|
16418
16710
|
const basicTypeProps = __spreadValues({
|
|
16419
16711
|
infoMessage: null
|
|
16420
16712
|
}, schemaProps);
|
|
16421
|
-
return /* @__PURE__ */
|
|
16713
|
+
return /* @__PURE__ */ jsx100(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16422
16714
|
}
|
|
16423
16715
|
case "object":
|
|
16424
16716
|
return /* @__PURE__ */ createElement(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16425
16717
|
case "array":
|
|
16426
|
-
return /* @__PURE__ */
|
|
16718
|
+
return /* @__PURE__ */ jsx100(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16427
16719
|
case "promotedOneOf":
|
|
16428
|
-
return /* @__PURE__ */
|
|
16720
|
+
return /* @__PURE__ */ jsx100(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16429
16721
|
case "oneOf":
|
|
16430
|
-
return /* @__PURE__ */
|
|
16722
|
+
return /* @__PURE__ */ jsx100(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16431
16723
|
case "allOf":
|
|
16432
|
-
return /* @__PURE__ */
|
|
16724
|
+
return /* @__PURE__ */ jsx100(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16433
16725
|
}
|
|
16434
|
-
return /* @__PURE__ */
|
|
16726
|
+
return /* @__PURE__ */ jsx100(Fragment19, {});
|
|
16435
16727
|
}
|
|
16436
16728
|
var GenericSchema_default = GenericSchemaForm;
|
|
16437
16729
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16458,7 +16750,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16458
16750
|
};
|
|
16459
16751
|
|
|
16460
16752
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16461
|
-
import { jsx as
|
|
16753
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
16462
16754
|
function DynamicForm({
|
|
16463
16755
|
component,
|
|
16464
16756
|
model = null,
|
|
@@ -16468,7 +16760,7 @@ function DynamicForm({
|
|
|
16468
16760
|
onPersistAsync
|
|
16469
16761
|
}) {
|
|
16470
16762
|
const formSchema = component.schema;
|
|
16471
|
-
return /* @__PURE__ */
|
|
16763
|
+
return /* @__PURE__ */ jsx101("div", { className: getMargin2(component.margin || "md"), children: /* @__PURE__ */ jsx101(
|
|
16472
16764
|
GenericSchema_default,
|
|
16473
16765
|
{
|
|
16474
16766
|
schema: formSchema,
|
|
@@ -16487,61 +16779,61 @@ var DynamicForm_default = DynamicForm;
|
|
|
16487
16779
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16488
16780
|
var import_classnames14 = __toESM(require_classnames());
|
|
16489
16781
|
import { Display as Display2 } from "@transferwise/components";
|
|
16490
|
-
import { jsx as
|
|
16782
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
16491
16783
|
var DynamicHeading = (props) => {
|
|
16492
16784
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16493
16785
|
const classes = (0, import_classnames14.default)(getTextAlignmentAndMargin2({ align, margin }));
|
|
16494
|
-
return control === "display" ? /* @__PURE__ */
|
|
16786
|
+
return control === "display" ? /* @__PURE__ */ jsx102(DisplayHeading2, { size, text, classes }) : /* @__PURE__ */ jsx102(StandardHeading2, { size, text, classes });
|
|
16495
16787
|
};
|
|
16496
16788
|
var StandardHeading2 = ({ size, text, classes }) => {
|
|
16497
16789
|
switch (size) {
|
|
16498
16790
|
case "xs":
|
|
16499
|
-
return /* @__PURE__ */
|
|
16791
|
+
return /* @__PURE__ */ jsx102("h5", { className: classes, children: text });
|
|
16500
16792
|
case "sm":
|
|
16501
|
-
return /* @__PURE__ */
|
|
16793
|
+
return /* @__PURE__ */ jsx102("h4", { className: classes, children: text });
|
|
16502
16794
|
case "lg":
|
|
16503
|
-
return /* @__PURE__ */
|
|
16795
|
+
return /* @__PURE__ */ jsx102("h2", { className: classes, children: text });
|
|
16504
16796
|
case "xl":
|
|
16505
|
-
return /* @__PURE__ */
|
|
16797
|
+
return /* @__PURE__ */ jsx102("h1", { className: classes, children: text });
|
|
16506
16798
|
case "md":
|
|
16507
16799
|
default:
|
|
16508
|
-
return /* @__PURE__ */
|
|
16800
|
+
return /* @__PURE__ */ jsx102("h3", { className: classes, children: text });
|
|
16509
16801
|
}
|
|
16510
16802
|
};
|
|
16511
16803
|
var DisplayHeading2 = ({ size, text, classes }) => {
|
|
16512
16804
|
switch (size) {
|
|
16513
16805
|
case "xs":
|
|
16514
16806
|
case "sm":
|
|
16515
|
-
return /* @__PURE__ */
|
|
16807
|
+
return /* @__PURE__ */ jsx102(Display2, { type: "display-small", className: classes, children: text });
|
|
16516
16808
|
case "xl":
|
|
16517
16809
|
case "lg":
|
|
16518
|
-
return /* @__PURE__ */
|
|
16810
|
+
return /* @__PURE__ */ jsx102(Display2, { type: "display-large", className: classes, children: text });
|
|
16519
16811
|
case "md":
|
|
16520
16812
|
default:
|
|
16521
|
-
return /* @__PURE__ */
|
|
16813
|
+
return /* @__PURE__ */ jsx102(Display2, { type: "display-medium", className: classes, children: text });
|
|
16522
16814
|
}
|
|
16523
16815
|
};
|
|
16524
16816
|
var DynamicHeading_default = DynamicHeading;
|
|
16525
16817
|
|
|
16526
16818
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16527
16819
|
import { Markdown as Markdown7 } from "@transferwise/components";
|
|
16528
|
-
import { jsx as
|
|
16820
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
16529
16821
|
var DynamicMarkdown = ({ component }) => {
|
|
16530
16822
|
const { content, align, margin } = component;
|
|
16531
|
-
return /* @__PURE__ */
|
|
16823
|
+
return /* @__PURE__ */ jsx103("div", { className: getTextAlignmentAndMargin2({ align, margin }), children: /* @__PURE__ */ jsx103(Markdown7, { config: { link: { target: "_blank" } }, children: content }) });
|
|
16532
16824
|
};
|
|
16533
16825
|
var DynamicInfo = ({ component }) => {
|
|
16534
|
-
return /* @__PURE__ */
|
|
16826
|
+
return /* @__PURE__ */ jsx103("div", { className: getTextAlignmentAndMargin2(component), children: /* @__PURE__ */ jsx103(Markdown7, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
16535
16827
|
};
|
|
16536
16828
|
|
|
16537
16829
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16538
16830
|
import { Image as Image2 } from "@transferwise/components";
|
|
16539
|
-
import { useEffect as useEffect16, useState as
|
|
16540
|
-
import { jsx as
|
|
16831
|
+
import { useEffect as useEffect16, useState as useState23 } from "react";
|
|
16832
|
+
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
16541
16833
|
function DynamicImage({ component: image }) {
|
|
16542
16834
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
16543
16835
|
const httpClient = useHttpClient();
|
|
16544
|
-
const [imageSource, setImageSource] =
|
|
16836
|
+
const [imageSource, setImageSource] = useState23("");
|
|
16545
16837
|
useEffect16(() => {
|
|
16546
16838
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
16547
16839
|
}, [url, httpClient]);
|
|
@@ -16554,7 +16846,7 @@ function DynamicImage({ component: image }) {
|
|
|
16554
16846
|
if (!imageSource) {
|
|
16555
16847
|
return null;
|
|
16556
16848
|
}
|
|
16557
|
-
return /* @__PURE__ */
|
|
16849
|
+
return /* @__PURE__ */ jsx104("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ jsx104(Image2, __spreadValues({ className: `img-responsive ${getMargin2(margin || "md")}` }, imageProps)) });
|
|
16558
16850
|
}
|
|
16559
16851
|
var readImageBlobAsDataURL2 = (imageBlob) => (
|
|
16560
16852
|
// we can safely assume the type of reader.result is string
|
|
@@ -16591,7 +16883,7 @@ var DynamicImage_default = DynamicImage;
|
|
|
16591
16883
|
|
|
16592
16884
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16593
16885
|
import { Header as Header10, InstructionsList as InstructionsList2 } from "@transferwise/components";
|
|
16594
|
-
import { jsx as
|
|
16886
|
+
import { jsx as jsx105, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
16595
16887
|
var doContext2 = ["positive", "neutral"];
|
|
16596
16888
|
var dontContext2 = ["warning", "negative"];
|
|
16597
16889
|
var DynamicInstructions = ({ component }) => {
|
|
@@ -16599,39 +16891,39 @@ var DynamicInstructions = ({ component }) => {
|
|
|
16599
16891
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
16600
16892
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
16601
16893
|
return /* @__PURE__ */ jsxs37("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16602
|
-
component.title ? /* @__PURE__ */
|
|
16603
|
-
/* @__PURE__ */
|
|
16894
|
+
component.title ? /* @__PURE__ */ jsx105(Header10, { title: component.title }) : null,
|
|
16895
|
+
/* @__PURE__ */ jsx105(InstructionsList2, { dos, donts })
|
|
16604
16896
|
] });
|
|
16605
16897
|
};
|
|
16606
16898
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16607
16899
|
|
|
16608
16900
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16609
|
-
import { Fragment as Fragment20, jsx as
|
|
16901
|
+
import { Fragment as Fragment20, jsx as jsx106 } from "react/jsx-runtime";
|
|
16610
16902
|
var getKey = (component) => JSON.stringify(component);
|
|
16611
16903
|
function DynamicLayout(props) {
|
|
16612
16904
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16613
16905
|
const renderComponent = (component) => {
|
|
16614
16906
|
switch (component.type) {
|
|
16615
16907
|
case "heading":
|
|
16616
|
-
return /* @__PURE__ */
|
|
16908
|
+
return /* @__PURE__ */ jsx106(DynamicHeading_default, { component }, getKey(component));
|
|
16617
16909
|
case "paragraph":
|
|
16618
|
-
return /* @__PURE__ */
|
|
16910
|
+
return /* @__PURE__ */ jsx106(DynamicParagraph_default, { component }, getKey(component));
|
|
16619
16911
|
case "image":
|
|
16620
|
-
return /* @__PURE__ */
|
|
16912
|
+
return /* @__PURE__ */ jsx106(DynamicImage_default, { component }, getKey(component));
|
|
16621
16913
|
case "alert":
|
|
16622
|
-
return /* @__PURE__ */
|
|
16914
|
+
return /* @__PURE__ */ jsx106(DynamicAlert_default, { component }, getKey(component));
|
|
16623
16915
|
case "review":
|
|
16624
|
-
return /* @__PURE__ */
|
|
16916
|
+
return /* @__PURE__ */ jsx106(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16625
16917
|
case "divider":
|
|
16626
|
-
return /* @__PURE__ */
|
|
16918
|
+
return /* @__PURE__ */ jsx106(DynamicDivider_default, { component }, getKey(component));
|
|
16627
16919
|
case "info":
|
|
16628
|
-
return /* @__PURE__ */
|
|
16920
|
+
return /* @__PURE__ */ jsx106(DynamicInfo, { component }, getKey(component));
|
|
16629
16921
|
case "instructions":
|
|
16630
|
-
return /* @__PURE__ */
|
|
16922
|
+
return /* @__PURE__ */ jsx106(DynamicInstructions_default, { component }, getKey(component));
|
|
16631
16923
|
case "markdown":
|
|
16632
|
-
return /* @__PURE__ */
|
|
16924
|
+
return /* @__PURE__ */ jsx106(DynamicMarkdown, { component }, getKey(component));
|
|
16633
16925
|
case "columns":
|
|
16634
|
-
return /* @__PURE__ */
|
|
16926
|
+
return /* @__PURE__ */ jsx106(
|
|
16635
16927
|
DynamicColumns_default,
|
|
16636
16928
|
{
|
|
16637
16929
|
component,
|
|
@@ -16645,7 +16937,7 @@ function DynamicLayout(props) {
|
|
|
16645
16937
|
getKey(component)
|
|
16646
16938
|
);
|
|
16647
16939
|
case "form":
|
|
16648
|
-
return /* @__PURE__ */
|
|
16940
|
+
return /* @__PURE__ */ jsx106(
|
|
16649
16941
|
DynamicForm_default,
|
|
16650
16942
|
{
|
|
16651
16943
|
component,
|
|
@@ -16658,9 +16950,9 @@ function DynamicLayout(props) {
|
|
|
16658
16950
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16659
16951
|
);
|
|
16660
16952
|
case "button":
|
|
16661
|
-
return /* @__PURE__ */
|
|
16953
|
+
return /* @__PURE__ */ jsx106(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16662
16954
|
case "box":
|
|
16663
|
-
return /* @__PURE__ */
|
|
16955
|
+
return /* @__PURE__ */ jsx106(
|
|
16664
16956
|
DynamicBox_default,
|
|
16665
16957
|
{
|
|
16666
16958
|
component,
|
|
@@ -16674,18 +16966,18 @@ function DynamicLayout(props) {
|
|
|
16674
16966
|
getKey(component)
|
|
16675
16967
|
);
|
|
16676
16968
|
case "decision":
|
|
16677
|
-
return /* @__PURE__ */
|
|
16969
|
+
return /* @__PURE__ */ jsx106(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16678
16970
|
case "external":
|
|
16679
|
-
return /* @__PURE__ */
|
|
16971
|
+
return /* @__PURE__ */ jsx106(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16680
16972
|
case "list":
|
|
16681
16973
|
case "status-list":
|
|
16682
|
-
return /* @__PURE__ */
|
|
16974
|
+
return /* @__PURE__ */ jsx106(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16683
16975
|
case "loading-indicator":
|
|
16684
|
-
return /* @__PURE__ */
|
|
16976
|
+
return /* @__PURE__ */ jsx106(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16685
16977
|
case "search":
|
|
16686
|
-
return /* @__PURE__ */
|
|
16978
|
+
return /* @__PURE__ */ jsx106(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16687
16979
|
case "modal":
|
|
16688
|
-
return /* @__PURE__ */
|
|
16980
|
+
return /* @__PURE__ */ jsx106(
|
|
16689
16981
|
DynamicModal_default,
|
|
16690
16982
|
{
|
|
16691
16983
|
component,
|
|
@@ -16699,22 +16991,22 @@ function DynamicLayout(props) {
|
|
|
16699
16991
|
getKey(component)
|
|
16700
16992
|
);
|
|
16701
16993
|
default:
|
|
16702
|
-
return /* @__PURE__ */
|
|
16994
|
+
return /* @__PURE__ */ jsx106("div", {}, getKey(component));
|
|
16703
16995
|
}
|
|
16704
16996
|
};
|
|
16705
16997
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16706
|
-
return /* @__PURE__ */
|
|
16998
|
+
return /* @__PURE__ */ jsx106(Fragment20, { children: components.map(renderComponent) });
|
|
16707
16999
|
}
|
|
16708
|
-
return /* @__PURE__ */
|
|
17000
|
+
return /* @__PURE__ */ jsx106(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16709
17001
|
}
|
|
16710
17002
|
var DynamicLayout_default = DynamicLayout;
|
|
16711
17003
|
|
|
16712
17004
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16713
17005
|
import { Header as Header11, Summary as Summary2 } from "@transferwise/components";
|
|
16714
|
-
import { jsx as
|
|
17006
|
+
import { jsx as jsx107, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
16715
17007
|
var DynamicStatusList = ({ component }) => {
|
|
16716
17008
|
return /* @__PURE__ */ jsxs38("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16717
|
-
component.title ? /* @__PURE__ */
|
|
17009
|
+
component.title ? /* @__PURE__ */ jsx107(Header11, { title: component.title }) : null,
|
|
16718
17010
|
component.items.map(mapListItemToSummary)
|
|
16719
17011
|
] });
|
|
16720
17012
|
};
|
|
@@ -16723,8 +17015,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
16723
17015
|
key: `${title}/${description || ""}`,
|
|
16724
17016
|
title,
|
|
16725
17017
|
description
|
|
16726
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */
|
|
16727
|
-
return /* @__PURE__ */
|
|
17018
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ jsx107(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
17019
|
+
return /* @__PURE__ */ jsx107(Summary2, __spreadValues({}, props));
|
|
16728
17020
|
};
|
|
16729
17021
|
var statusListMap = {
|
|
16730
17022
|
done: "done",
|
|
@@ -16741,10 +17033,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
16741
17033
|
|
|
16742
17034
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16743
17035
|
import { Loader as Loader3 } from "@transferwise/components";
|
|
16744
|
-
import { jsx as
|
|
17036
|
+
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
16745
17037
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16746
17038
|
const { margin = "md", size = "md" } = component;
|
|
16747
|
-
return /* @__PURE__ */
|
|
17039
|
+
return /* @__PURE__ */ jsx108(
|
|
16748
17040
|
Loader3,
|
|
16749
17041
|
{
|
|
16750
17042
|
size,
|
|
@@ -16759,7 +17051,7 @@ var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
|
16759
17051
|
|
|
16760
17052
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16761
17053
|
import { Button as Button8 } from "@transferwise/components";
|
|
16762
|
-
import { useIntl as
|
|
17054
|
+
import { useIntl as useIntl17 } from "react-intl";
|
|
16763
17055
|
|
|
16764
17056
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16765
17057
|
import { SnackbarContext as SnackbarContext2 } from "@transferwise/components";
|
|
@@ -16772,9 +17064,9 @@ function noop3() {
|
|
|
16772
17064
|
}
|
|
16773
17065
|
|
|
16774
17066
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16775
|
-
import { jsx as
|
|
17067
|
+
import { jsx as jsx109, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16776
17068
|
function DynamicParagraph({ component }) {
|
|
16777
|
-
return component.control === "copyable" ? /* @__PURE__ */
|
|
17069
|
+
return component.control === "copyable" ? /* @__PURE__ */ jsx109(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ jsx109(BasicDynamicParagraph, { component });
|
|
16778
17070
|
}
|
|
16779
17071
|
function BasicDynamicParagraph({ component }) {
|
|
16780
17072
|
return /* @__PURE__ */ jsxs39("p", { className: getTextAlignmentAndMargin2(component), children: [
|
|
@@ -16784,7 +17076,7 @@ function BasicDynamicParagraph({ component }) {
|
|
|
16784
17076
|
] });
|
|
16785
17077
|
}
|
|
16786
17078
|
function CopyableDynamicParagraph({ component }) {
|
|
16787
|
-
const { formatMessage } =
|
|
17079
|
+
const { formatMessage } = useIntl17();
|
|
16788
17080
|
const createSnackbar = useSnackBarIfAvailable2();
|
|
16789
17081
|
const { text } = component;
|
|
16790
17082
|
const copy = () => {
|
|
@@ -16796,7 +17088,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16796
17088
|
margin: "sm"
|
|
16797
17089
|
})} form-control`;
|
|
16798
17090
|
return /* @__PURE__ */ jsxs39("div", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16799
|
-
/* @__PURE__ */
|
|
17091
|
+
/* @__PURE__ */ jsx109(
|
|
16800
17092
|
"input",
|
|
16801
17093
|
{
|
|
16802
17094
|
type: "text",
|
|
@@ -16806,7 +17098,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16806
17098
|
style: { textOverflow: "ellipsis" }
|
|
16807
17099
|
}
|
|
16808
17100
|
),
|
|
16809
|
-
/* @__PURE__ */
|
|
17101
|
+
/* @__PURE__ */ jsx109(Button8, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16810
17102
|
] });
|
|
16811
17103
|
}
|
|
16812
17104
|
function noop4() {
|
|
@@ -16815,7 +17107,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
16815
17107
|
|
|
16816
17108
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16817
17109
|
import { DefinitionList as DefinitionList3, Header as Header12 } from "@transferwise/components";
|
|
16818
|
-
import { Fragment as Fragment21, jsx as
|
|
17110
|
+
import { Fragment as Fragment21, jsx as jsx110, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
16819
17111
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16820
17112
|
key: String(index),
|
|
16821
17113
|
title: label,
|
|
@@ -16824,13 +17116,13 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16824
17116
|
var getFieldValue2 = (value, help, orientation) => {
|
|
16825
17117
|
if (help) {
|
|
16826
17118
|
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs40(Fragment21, { children: [
|
|
16827
|
-
/* @__PURE__ */
|
|
17119
|
+
/* @__PURE__ */ jsx110(Help_default2, { help }),
|
|
16828
17120
|
" ",
|
|
16829
17121
|
value
|
|
16830
17122
|
] }) : /* @__PURE__ */ jsxs40(Fragment21, { children: [
|
|
16831
17123
|
value,
|
|
16832
17124
|
" ",
|
|
16833
|
-
/* @__PURE__ */
|
|
17125
|
+
/* @__PURE__ */ jsx110(Help_default2, { help })
|
|
16834
17126
|
] });
|
|
16835
17127
|
}
|
|
16836
17128
|
return value;
|
|
@@ -16856,23 +17148,23 @@ function DynamicReview(props) {
|
|
|
16856
17148
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
16857
17149
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
16858
17150
|
return /* @__PURE__ */ jsxs40("div", { className: margin, children: [
|
|
16859
|
-
review.title && /* @__PURE__ */
|
|
16860
|
-
/* @__PURE__ */
|
|
17151
|
+
review.title && /* @__PURE__ */ jsx110(Header12, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
17152
|
+
/* @__PURE__ */ jsx110("div", { className: margin, children: /* @__PURE__ */ jsx110(DefinitionList3, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
16861
17153
|
] });
|
|
16862
17154
|
}
|
|
16863
17155
|
var DynamicReview_default = DynamicReview;
|
|
16864
17156
|
|
|
16865
17157
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16866
|
-
import { useMemo as useMemo16, useState as
|
|
17158
|
+
import { useMemo as useMemo16, useState as useState25 } from "react";
|
|
16867
17159
|
import { Search as Search2 } from "@transferwise/icons";
|
|
16868
17160
|
|
|
16869
17161
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16870
17162
|
import { Input as Input7 } from "@transferwise/components";
|
|
16871
|
-
import { jsx as
|
|
17163
|
+
import { jsx as jsx111, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
16872
17164
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16873
17165
|
return /* @__PURE__ */ jsxs41("label", { className: "control-label d-inline", children: [
|
|
16874
17166
|
title,
|
|
16875
|
-
/* @__PURE__ */
|
|
17167
|
+
/* @__PURE__ */ jsx111(
|
|
16876
17168
|
Input7,
|
|
16877
17169
|
{
|
|
16878
17170
|
type: "text",
|
|
@@ -16887,13 +17179,13 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16887
17179
|
|
|
16888
17180
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16889
17181
|
import { NavigationOption as NavigationOption7, NavigationOptionsList as NavigationOptionsList4 } from "@transferwise/components";
|
|
16890
|
-
import { useIntl as
|
|
16891
|
-
import { jsx as
|
|
17182
|
+
import { useIntl as useIntl18 } from "react-intl";
|
|
17183
|
+
import { jsx as jsx112, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
16892
17184
|
function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
16893
17185
|
if (results.length === 0) {
|
|
16894
|
-
return /* @__PURE__ */
|
|
17186
|
+
return /* @__PURE__ */ jsx112("p", { className: "m-t-2", children: emptyMessage });
|
|
16895
17187
|
}
|
|
16896
|
-
return /* @__PURE__ */
|
|
17188
|
+
return /* @__PURE__ */ jsx112(NavigationOptionsList4, { children: results.map((result) => /* @__PURE__ */ jsx112(
|
|
16897
17189
|
NavigationOption7,
|
|
16898
17190
|
{
|
|
16899
17191
|
title: result.title,
|
|
@@ -16907,11 +17199,11 @@ function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
|
16907
17199
|
)) });
|
|
16908
17200
|
}
|
|
16909
17201
|
function ErrorResult2({ onRetrySearch }) {
|
|
16910
|
-
const intl =
|
|
17202
|
+
const intl = useIntl18();
|
|
16911
17203
|
return /* @__PURE__ */ jsxs42("p", { className: "m-t-2", children: [
|
|
16912
17204
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16913
17205
|
"\xA0",
|
|
16914
|
-
/* @__PURE__ */
|
|
17206
|
+
/* @__PURE__ */ jsx112(
|
|
16915
17207
|
"a",
|
|
16916
17208
|
{
|
|
16917
17209
|
href: "/",
|
|
@@ -16926,10 +17218,10 @@ function ErrorResult2({ onRetrySearch }) {
|
|
|
16926
17218
|
}
|
|
16927
17219
|
|
|
16928
17220
|
// src/legacy/layout/search/useSearch.tsx
|
|
16929
|
-
import { useCallback as useCallback7, useRef as useRef4, useState as
|
|
17221
|
+
import { useCallback as useCallback7, useRef as useRef4, useState as useState24 } from "react";
|
|
16930
17222
|
var headers = { "Content-Type": "application/json" };
|
|
16931
17223
|
var useSearch = (defaultSearchConfig) => {
|
|
16932
|
-
const [state, setState] =
|
|
17224
|
+
const [state, setState] = useState24({
|
|
16933
17225
|
status: "idle"
|
|
16934
17226
|
});
|
|
16935
17227
|
const abortControllerRef = useRef4(null);
|
|
@@ -16997,10 +17289,10 @@ var addQueryParameter2 = (url, key, value) => {
|
|
|
16997
17289
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16998
17290
|
var import_classnames15 = __toESM(require_classnames());
|
|
16999
17291
|
import { Markdown as Markdown8, Typeahead as Typeahead2 } from "@transferwise/components";
|
|
17000
|
-
import { jsx as
|
|
17292
|
+
import { jsx as jsx113, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
17001
17293
|
var DEBOUNCE_TIME2 = 400;
|
|
17002
17294
|
function DynamicSearch({ component, onAction }) {
|
|
17003
|
-
const [query, setQuery] =
|
|
17295
|
+
const [query, setQuery] = useState25("");
|
|
17004
17296
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
17005
17297
|
const { status, results, search } = useSearch({ url, method, param });
|
|
17006
17298
|
const onEvent = useEventDispatcher();
|
|
@@ -17033,16 +17325,16 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17033
17325
|
void search(query);
|
|
17034
17326
|
};
|
|
17035
17327
|
if (control === "inline") {
|
|
17036
|
-
return /* @__PURE__ */
|
|
17328
|
+
return /* @__PURE__ */ jsx113("div", { className: (0, import_classnames15.default)(getMargin2(margin != null ? margin : "md"), "df-search-typeahead"), children: /* @__PURE__ */ jsxs43("label", { className: "control-label d-inline", children: [
|
|
17037
17329
|
title,
|
|
17038
|
-
/* @__PURE__ */
|
|
17330
|
+
/* @__PURE__ */ jsx113("div", { className: "m-t-1", children: /* @__PURE__ */ jsx113(
|
|
17039
17331
|
Typeahead2,
|
|
17040
17332
|
{
|
|
17041
17333
|
id: "typeahead-input-id",
|
|
17042
17334
|
name: "typeahead-input-name",
|
|
17043
17335
|
size: "md",
|
|
17044
17336
|
maxHeight: 100,
|
|
17045
|
-
footer: /* @__PURE__ */
|
|
17337
|
+
footer: /* @__PURE__ */ jsx113(
|
|
17046
17338
|
TypeaheadFooter2,
|
|
17047
17339
|
{
|
|
17048
17340
|
state: status,
|
|
@@ -17053,7 +17345,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17053
17345
|
),
|
|
17054
17346
|
multiple: false,
|
|
17055
17347
|
clearable: false,
|
|
17056
|
-
addon: /* @__PURE__ */
|
|
17348
|
+
addon: /* @__PURE__ */ jsx113(Search2, { size: 24 }),
|
|
17057
17349
|
options: results.map(mapResultToTypeaheadOption2),
|
|
17058
17350
|
onChange: (values) => {
|
|
17059
17351
|
if (values.length > 0) {
|
|
@@ -17069,10 +17361,10 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17069
17361
|
] }) });
|
|
17070
17362
|
}
|
|
17071
17363
|
return /* @__PURE__ */ jsxs43("div", { className: getMargin2(margin != null ? margin : "md"), children: [
|
|
17072
|
-
/* @__PURE__ */
|
|
17073
|
-
status === "loading" && /* @__PURE__ */
|
|
17074
|
-
status === "error" && /* @__PURE__ */
|
|
17075
|
-
status === "success" && /* @__PURE__ */
|
|
17364
|
+
/* @__PURE__ */ jsx113(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
17365
|
+
status === "loading" && /* @__PURE__ */ jsx113(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
17366
|
+
status === "error" && /* @__PURE__ */ jsx113(ErrorResult2, { onRetrySearch }),
|
|
17367
|
+
status === "success" && /* @__PURE__ */ jsx113(SearchResults2, { results, emptyMessage, onSelect: onResultSelected })
|
|
17076
17368
|
] });
|
|
17077
17369
|
}
|
|
17078
17370
|
function mapResultToTypeaheadOption2(result) {
|
|
@@ -17091,13 +17383,13 @@ function TypeaheadFooter2({
|
|
|
17091
17383
|
emptyMessage
|
|
17092
17384
|
}) {
|
|
17093
17385
|
if (state === "success" && results.length === 0) {
|
|
17094
|
-
return /* @__PURE__ */
|
|
17386
|
+
return /* @__PURE__ */ jsx113(Markdown8, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: emptyMessage });
|
|
17095
17387
|
}
|
|
17096
17388
|
if (state === "error" && results.length === 0) {
|
|
17097
|
-
return /* @__PURE__ */
|
|
17389
|
+
return /* @__PURE__ */ jsx113("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ jsx113(ErrorResult2, { onRetrySearch }) });
|
|
17098
17390
|
}
|
|
17099
17391
|
if (state === "loading" || results.length === 0) {
|
|
17100
|
-
return /* @__PURE__ */
|
|
17392
|
+
return /* @__PURE__ */ jsx113("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
17101
17393
|
}
|
|
17102
17394
|
return null;
|
|
17103
17395
|
}
|
|
@@ -17105,21 +17397,21 @@ var DynamicSearch_default = DynamicSearch;
|
|
|
17105
17397
|
|
|
17106
17398
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
17107
17399
|
import { Button as Button9, Modal as Modal4 } from "@transferwise/components";
|
|
17108
|
-
import { useState as
|
|
17109
|
-
import { jsx as
|
|
17400
|
+
import { useState as useState26 } from "react";
|
|
17401
|
+
import { jsx as jsx114, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
17110
17402
|
function DynamicModal(props) {
|
|
17111
|
-
const [visible, isVisible] =
|
|
17403
|
+
const [visible, isVisible] = useState26(false);
|
|
17112
17404
|
const { component, onAction } = props;
|
|
17113
17405
|
const { margin = "md" } = component;
|
|
17114
17406
|
return /* @__PURE__ */ jsxs44("div", { className: getTextAlignmentAndMargin2({ margin }), children: [
|
|
17115
|
-
/* @__PURE__ */
|
|
17116
|
-
/* @__PURE__ */
|
|
17407
|
+
/* @__PURE__ */ jsx114(Button9, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
17408
|
+
/* @__PURE__ */ jsx114(
|
|
17117
17409
|
Modal4,
|
|
17118
17410
|
{
|
|
17119
17411
|
scroll: "content",
|
|
17120
17412
|
open: visible,
|
|
17121
17413
|
size: "lg",
|
|
17122
|
-
body: /* @__PURE__ */
|
|
17414
|
+
body: /* @__PURE__ */ jsx114(
|
|
17123
17415
|
DynamicLayout_default,
|
|
17124
17416
|
__spreadProps(__spreadValues({}, props), {
|
|
17125
17417
|
components: component.content.components,
|
|
@@ -17137,7 +17429,7 @@ function DynamicModal(props) {
|
|
|
17137
17429
|
var DynamicModal_default = DynamicModal;
|
|
17138
17430
|
|
|
17139
17431
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
17140
|
-
import { Fragment as Fragment22, jsx as
|
|
17432
|
+
import { Fragment as Fragment22, jsx as jsx115, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
17141
17433
|
var isNullish3 = (value) => isNull3(value) || isUndefined3(value);
|
|
17142
17434
|
var getDefaultValue = (schema) => {
|
|
17143
17435
|
return schema.type === "boolean" && isNullish3(schema.default) ? false : schema.default;
|
|
@@ -17175,12 +17467,12 @@ var BasicTypeSchema = (props) => {
|
|
|
17175
17467
|
props.onBlur();
|
|
17176
17468
|
}
|
|
17177
17469
|
};
|
|
17178
|
-
const [model, setModel] =
|
|
17179
|
-
const [lastModel, setLastModel] =
|
|
17180
|
-
const [changed, setChanged] =
|
|
17181
|
-
const [focused, setFocused] =
|
|
17182
|
-
const [blurred, setBlurred] =
|
|
17183
|
-
const [validations, setValidations] =
|
|
17470
|
+
const [model, setModel] = useState27((_a = props.model) != null ? _a : null);
|
|
17471
|
+
const [lastModel, setLastModel] = useState27((_b = props.model) != null ? _b : null);
|
|
17472
|
+
const [changed, setChanged] = useState27(false);
|
|
17473
|
+
const [focused, setFocused] = useState27(false);
|
|
17474
|
+
const [blurred, setBlurred] = useState27(false);
|
|
17475
|
+
const [validations, setValidations] = useState27([]);
|
|
17184
17476
|
const id = useMemo17(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
17185
17477
|
const onSchemaChange = () => {
|
|
17186
17478
|
const defaultValue = getDefaultValue(props.schema);
|
|
@@ -17214,14 +17506,14 @@ var BasicTypeSchema = (props) => {
|
|
|
17214
17506
|
const schemaHelp = props.schema.help;
|
|
17215
17507
|
const feedbackId = `${id}-feedback`;
|
|
17216
17508
|
return !isHidden ? /* @__PURE__ */ jsxs45(Fragment22, { children: [
|
|
17217
|
-
props.schema.alert && /* @__PURE__ */
|
|
17509
|
+
props.schema.alert && /* @__PURE__ */ jsx115(DynamicAlert_default, { component: props.schema.alert }),
|
|
17218
17510
|
/* @__PURE__ */ jsxs45("div", { className: (0, import_classnames16.default)(formGroupClasses), children: [
|
|
17219
17511
|
showLabel && /* @__PURE__ */ jsxs45("div", { className: "d-inline-block m-b-1", children: [
|
|
17220
|
-
/* @__PURE__ */
|
|
17221
|
-
!!schemaHelp && /* @__PURE__ */
|
|
17512
|
+
/* @__PURE__ */ jsx115("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
17513
|
+
!!schemaHelp && /* @__PURE__ */ jsx115(Help_default2, { help: schemaHelp })
|
|
17222
17514
|
] }),
|
|
17223
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */
|
|
17224
|
-
/* @__PURE__ */
|
|
17515
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ jsx115(Help_default2, { help: schemaHelp }),
|
|
17516
|
+
/* @__PURE__ */ jsx115(
|
|
17225
17517
|
SchemaFormControl_default,
|
|
17226
17518
|
{
|
|
17227
17519
|
id,
|
|
@@ -17234,7 +17526,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17234
17526
|
describedBy: feedbackId
|
|
17235
17527
|
}
|
|
17236
17528
|
),
|
|
17237
|
-
/* @__PURE__ */
|
|
17529
|
+
/* @__PURE__ */ jsx115(
|
|
17238
17530
|
ControlFeedback_default,
|
|
17239
17531
|
{
|
|
17240
17532
|
id: feedbackId,
|
|
@@ -17259,7 +17551,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
17259
17551
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17260
17552
|
|
|
17261
17553
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17262
|
-
import { jsx as
|
|
17554
|
+
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
17263
17555
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17264
17556
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17265
17557
|
var _a;
|
|
@@ -17274,14 +17566,14 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
17274
17566
|
]);
|
|
17275
17567
|
function PersistAsyncBasicSchema(props) {
|
|
17276
17568
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
17277
|
-
const intl =
|
|
17569
|
+
const intl = useIntl19();
|
|
17278
17570
|
const httpClient = useHttpClient();
|
|
17279
17571
|
const onEvent = useEventDispatcher();
|
|
17280
|
-
const [persistAsyncModel, setPersistAsyncModel] =
|
|
17572
|
+
const [persistAsyncModel, setPersistAsyncModel] = useState28(null);
|
|
17281
17573
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17282
|
-
const [persistAsyncError, setPersistAsyncError] =
|
|
17283
|
-
const [fieldSubmitted, setFieldSubmitted] =
|
|
17284
|
-
const [abortController, setAbortController] =
|
|
17574
|
+
const [persistAsyncError, setPersistAsyncError] = useState28(null);
|
|
17575
|
+
const [fieldSubmitted, setFieldSubmitted] = useState28(false);
|
|
17576
|
+
const [abortController, setAbortController] = useState28(null);
|
|
17285
17577
|
useEffect18(() => {
|
|
17286
17578
|
if (controlTypesWithPersistOnChange.has(
|
|
17287
17579
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
@@ -17349,7 +17641,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17349
17641
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17350
17642
|
}
|
|
17351
17643
|
};
|
|
17352
|
-
return /* @__PURE__ */
|
|
17644
|
+
return /* @__PURE__ */ jsx116(
|
|
17353
17645
|
BasicTypeSchema_default,
|
|
17354
17646
|
{
|
|
17355
17647
|
required,
|
|
@@ -17370,9 +17662,9 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17370
17662
|
|
|
17371
17663
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17372
17664
|
var usePersistAsync = (persistAsync) => {
|
|
17373
|
-
const [abortController, setAbortController] =
|
|
17665
|
+
const [abortController, setAbortController] = useState29(null);
|
|
17374
17666
|
const httpClient = useHttpClient();
|
|
17375
|
-
const intl =
|
|
17667
|
+
const intl = useIntl20();
|
|
17376
17668
|
const { schema } = persistAsync;
|
|
17377
17669
|
async function handlePersistAsync(model) {
|
|
17378
17670
|
const isInvalidSchema = model instanceof Blob ? !isBlobSchema2(schema) : !isValidSchema(model, schema);
|
|
@@ -17560,7 +17852,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17560
17852
|
}
|
|
17561
17853
|
|
|
17562
17854
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17563
|
-
import { jsx as
|
|
17855
|
+
import { jsx as jsx117 } from "react/jsx-runtime";
|
|
17564
17856
|
var getComponents = (step, options) => {
|
|
17565
17857
|
var _a;
|
|
17566
17858
|
if (isEmpty(step)) {
|
|
@@ -17583,7 +17875,7 @@ var LayoutStep = (props) => {
|
|
|
17583
17875
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17584
17876
|
};
|
|
17585
17877
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17586
|
-
return /* @__PURE__ */
|
|
17878
|
+
return /* @__PURE__ */ jsx117(
|
|
17587
17879
|
DynamicLayout_default,
|
|
17588
17880
|
{
|
|
17589
17881
|
components,
|
|
@@ -17599,11 +17891,11 @@ var LayoutStep = (props) => {
|
|
|
17599
17891
|
var LayoutStep_default = LayoutStep;
|
|
17600
17892
|
|
|
17601
17893
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17602
|
-
import { useEffect as useEffect25, useState as
|
|
17894
|
+
import { useEffect as useEffect25, useState as useState32 } from "react";
|
|
17603
17895
|
|
|
17604
17896
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17605
|
-
import { useCallback as useCallback10, useEffect as useEffect24, useMemo as useMemo20, useRef as useRef8, useState as
|
|
17606
|
-
import { useIntl as
|
|
17897
|
+
import { useCallback as useCallback10, useEffect as useEffect24, useMemo as useMemo20, useRef as useRef8, useState as useState31 } from "react";
|
|
17898
|
+
import { useIntl as useIntl23 } from "react-intl";
|
|
17607
17899
|
import Webcam from "react-webcam";
|
|
17608
17900
|
|
|
17609
17901
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
@@ -17668,16 +17960,16 @@ var CameraCapture_messages_default = defineMessages13({
|
|
|
17668
17960
|
|
|
17669
17961
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17670
17962
|
import { Button as Button10, ControlType, Priority, Size as Size3 } from "@transferwise/components";
|
|
17671
|
-
import { useIntl as
|
|
17672
|
-
import { jsx as
|
|
17673
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */
|
|
17963
|
+
import { useIntl as useIntl21 } from "react-intl";
|
|
17964
|
+
import { jsx as jsx118, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
17965
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ jsx118("div", { className: "bottom-bar", children: /* @__PURE__ */ jsx118(CaptureButton, { onClick: onCapture }) });
|
|
17674
17966
|
var ReviewBottomBar = ({
|
|
17675
17967
|
onSubmit,
|
|
17676
17968
|
onRetry
|
|
17677
17969
|
}) => {
|
|
17678
|
-
const intl =
|
|
17679
|
-
return /* @__PURE__ */
|
|
17680
|
-
/* @__PURE__ */
|
|
17970
|
+
const intl = useIntl21();
|
|
17971
|
+
return /* @__PURE__ */ jsx118("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ jsx118("div", { className: "row", children: /* @__PURE__ */ jsxs46("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
17972
|
+
/* @__PURE__ */ jsx118(
|
|
17681
17973
|
Button10,
|
|
17682
17974
|
{
|
|
17683
17975
|
className: "m-b-1",
|
|
@@ -17688,7 +17980,7 @@ var ReviewBottomBar = ({
|
|
|
17688
17980
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17689
17981
|
}
|
|
17690
17982
|
),
|
|
17691
|
-
/* @__PURE__ */
|
|
17983
|
+
/* @__PURE__ */ jsx118(
|
|
17692
17984
|
Button10,
|
|
17693
17985
|
{
|
|
17694
17986
|
className: "m-b-2",
|
|
@@ -17702,19 +17994,19 @@ var ReviewBottomBar = ({
|
|
|
17702
17994
|
)
|
|
17703
17995
|
] }) }) });
|
|
17704
17996
|
};
|
|
17705
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */
|
|
17997
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ jsx118(
|
|
17706
17998
|
"button",
|
|
17707
17999
|
{
|
|
17708
18000
|
type: "button",
|
|
17709
18001
|
className: "camera-capture-btn m-b-2",
|
|
17710
18002
|
"data-testid": "camera-capture-button",
|
|
17711
18003
|
onClick,
|
|
17712
|
-
children: /* @__PURE__ */
|
|
18004
|
+
children: /* @__PURE__ */ jsx118("span", { className: "camera-capture-btn-inner" })
|
|
17713
18005
|
}
|
|
17714
18006
|
);
|
|
17715
18007
|
|
|
17716
18008
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17717
|
-
import { useIntl as
|
|
18009
|
+
import { useIntl as useIntl22 } from "react-intl";
|
|
17718
18010
|
|
|
17719
18011
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
17720
18012
|
import { defineMessages as defineMessages14 } from "react-intl";
|
|
@@ -17727,11 +18019,11 @@ var OrientationLockOverlay_messages_default = defineMessages14({
|
|
|
17727
18019
|
});
|
|
17728
18020
|
|
|
17729
18021
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17730
|
-
import { jsx as
|
|
18022
|
+
import { jsx as jsx119, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
17731
18023
|
function OrientationLockOverlay() {
|
|
17732
|
-
const intl =
|
|
18024
|
+
const intl = useIntl22();
|
|
17733
18025
|
return /* @__PURE__ */ jsxs47("div", { className: "orientation-lock-overlay", children: [
|
|
17734
|
-
/* @__PURE__ */
|
|
18026
|
+
/* @__PURE__ */ jsx119(
|
|
17735
18027
|
"img",
|
|
17736
18028
|
{
|
|
17737
18029
|
className: "m-b-3",
|
|
@@ -17741,19 +18033,19 @@ function OrientationLockOverlay() {
|
|
|
17741
18033
|
alt: ""
|
|
17742
18034
|
}
|
|
17743
18035
|
),
|
|
17744
|
-
/* @__PURE__ */
|
|
18036
|
+
/* @__PURE__ */ jsx119("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17745
18037
|
] });
|
|
17746
18038
|
}
|
|
17747
18039
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17748
18040
|
|
|
17749
18041
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17750
18042
|
import { Button as Button11 } from "@transferwise/components";
|
|
17751
|
-
import { jsx as
|
|
18043
|
+
import { jsx as jsx120, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
17752
18044
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17753
|
-
return /* @__PURE__ */
|
|
17754
|
-
/* @__PURE__ */
|
|
17755
|
-
/* @__PURE__ */
|
|
17756
|
-
onAction && actionButton && /* @__PURE__ */
|
|
18045
|
+
return /* @__PURE__ */ jsx120("div", { className: "container p-t-5", children: /* @__PURE__ */ jsx120("div", { className: "row", children: /* @__PURE__ */ jsxs48("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
18046
|
+
/* @__PURE__ */ jsx120("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
18047
|
+
/* @__PURE__ */ jsx120("p", { className: "text-xs-center m-b-5", children: description }),
|
|
18048
|
+
onAction && actionButton && /* @__PURE__ */ jsx120(Button11, { block: true, onClick: onAction, children: actionButton })
|
|
17757
18049
|
] }) }) });
|
|
17758
18050
|
}
|
|
17759
18051
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
@@ -17840,7 +18132,10 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17840
18132
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17841
18133
|
const lockOrientation = useCallback9(() => {
|
|
17842
18134
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17843
|
-
window.screen.orientation.lock("portrait")
|
|
18135
|
+
const lockPromise = window.screen.orientation.lock("portrait");
|
|
18136
|
+
if (lockPromise instanceof Promise) {
|
|
18137
|
+
lockPromise.then(() => trackCameraOrientationLocked(onEvent)).catch(noop5);
|
|
18138
|
+
}
|
|
17844
18139
|
}
|
|
17845
18140
|
}, [onEvent]);
|
|
17846
18141
|
const unlockOrientation = useCallback9(() => {
|
|
@@ -17896,9 +18191,9 @@ var noop5 = () => {
|
|
|
17896
18191
|
};
|
|
17897
18192
|
|
|
17898
18193
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
17899
|
-
import { useEffect as useEffect22, useState as
|
|
18194
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
17900
18195
|
var useVideoConstraints = (direction) => {
|
|
17901
|
-
const [videoConstraints, setVideoConstraints] =
|
|
18196
|
+
const [videoConstraints, setVideoConstraints] = useState30();
|
|
17902
18197
|
const defaultVideoConstraints = {
|
|
17903
18198
|
facingMode: direction === "front" ? "user" : "environment",
|
|
17904
18199
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -17925,7 +18220,7 @@ var useVideoConstraints = (direction) => {
|
|
|
17925
18220
|
|
|
17926
18221
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
17927
18222
|
import { useEffect as useEffect23, useRef as useRef7 } from "react";
|
|
17928
|
-
import { Fragment as Fragment23, jsx as
|
|
18223
|
+
import { Fragment as Fragment23, jsx as jsx121, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
17929
18224
|
var captureButtonHeight = 92;
|
|
17930
18225
|
var reviewButtonsHeight = 120;
|
|
17931
18226
|
var imageHeight = 40;
|
|
@@ -17948,17 +18243,17 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17948
18243
|
});
|
|
17949
18244
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17950
18245
|
let helperBox = /* @__PURE__ */ jsxs49(Fragment23, { children: [
|
|
17951
|
-
imageUrl && /* @__PURE__ */
|
|
17952
|
-
title && /* @__PURE__ */
|
|
17953
|
-
instructions && /* @__PURE__ */
|
|
18246
|
+
imageUrl && /* @__PURE__ */ jsx121("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
18247
|
+
title && /* @__PURE__ */ jsx121("h4", { className: "camera-capture-title", children: title }),
|
|
18248
|
+
instructions && /* @__PURE__ */ jsx121("small", { className: "camera-capture-instructions", children: instructions })
|
|
17954
18249
|
] });
|
|
17955
18250
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17956
18251
|
if (reviewInstructions) {
|
|
17957
18252
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17958
|
-
helperBox = /* @__PURE__ */
|
|
18253
|
+
helperBox = /* @__PURE__ */ jsx121("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17959
18254
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17960
18255
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17961
|
-
helperBox = /* @__PURE__ */
|
|
18256
|
+
helperBox = /* @__PURE__ */ jsx121(Fragment23, {});
|
|
17962
18257
|
}
|
|
17963
18258
|
}
|
|
17964
18259
|
const framePosition = {
|
|
@@ -17977,19 +18272,19 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17977
18272
|
}
|
|
17978
18273
|
};
|
|
17979
18274
|
return /* @__PURE__ */ jsxs49("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
17980
|
-
/* @__PURE__ */
|
|
17981
|
-
/* @__PURE__ */
|
|
17982
|
-
/* @__PURE__ */
|
|
18275
|
+
/* @__PURE__ */ jsx121("defs", { children: /* @__PURE__ */ jsxs49("mask", { id: "mask", children: [
|
|
18276
|
+
/* @__PURE__ */ jsx121("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
18277
|
+
/* @__PURE__ */ jsx121("image", __spreadValues({ href: overlay }, framePosition))
|
|
17983
18278
|
] }) }),
|
|
17984
|
-
overlay && /* @__PURE__ */
|
|
17985
|
-
outline && /* @__PURE__ */
|
|
17986
|
-
/* @__PURE__ */
|
|
18279
|
+
overlay && /* @__PURE__ */ jsx121("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
18280
|
+
outline && /* @__PURE__ */ jsx121("image", __spreadValues({ href: outline }, framePosition)),
|
|
18281
|
+
/* @__PURE__ */ jsx121("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ jsx121("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
17987
18282
|
] });
|
|
17988
18283
|
}
|
|
17989
18284
|
var Overlay_default = Overlay;
|
|
17990
18285
|
|
|
17991
18286
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17992
|
-
import { jsx as
|
|
18287
|
+
import { jsx as jsx122, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
17993
18288
|
function CameraCapture({
|
|
17994
18289
|
direction = "back",
|
|
17995
18290
|
overlay = "",
|
|
@@ -18001,11 +18296,11 @@ function CameraCapture({
|
|
|
18001
18296
|
onCapture,
|
|
18002
18297
|
onEvent
|
|
18003
18298
|
}) {
|
|
18004
|
-
const [mode, setMode] =
|
|
18005
|
-
const [cameraError, setCameraError] =
|
|
18006
|
-
const [isVideoMirrored, setIsVideoMirrored] =
|
|
18007
|
-
const [ready, setReady] =
|
|
18008
|
-
const [reviewImage, setReviewImage] =
|
|
18299
|
+
const [mode, setMode] = useState31("CAPTURE" /* CAPTURE */);
|
|
18300
|
+
const [cameraError, setCameraError] = useState31();
|
|
18301
|
+
const [isVideoMirrored, setIsVideoMirrored] = useState31(false);
|
|
18302
|
+
const [ready, setReady] = useState31(false);
|
|
18303
|
+
const [reviewImage, setReviewImage] = useState31();
|
|
18009
18304
|
const webcamReference = useRef8(null);
|
|
18010
18305
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
18011
18306
|
const shouldLockOrientation = useMemo20(
|
|
@@ -18016,7 +18311,7 @@ function CameraCapture({
|
|
|
18016
18311
|
shouldLockOrientation,
|
|
18017
18312
|
onEvent
|
|
18018
18313
|
);
|
|
18019
|
-
const intl =
|
|
18314
|
+
const intl = useIntl23();
|
|
18020
18315
|
const handleCapture = useCallback10(async () => {
|
|
18021
18316
|
var _a, _b, _c, _d, _e, _f;
|
|
18022
18317
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
@@ -18098,7 +18393,7 @@ function CameraCapture({
|
|
|
18098
18393
|
}
|
|
18099
18394
|
}, [mode, exitFullScreen]);
|
|
18100
18395
|
const captureScreen = /* @__PURE__ */ jsxs50("div", { className: "camera-capture", children: [
|
|
18101
|
-
videoConstraints && /* @__PURE__ */
|
|
18396
|
+
videoConstraints && /* @__PURE__ */ jsx122(
|
|
18102
18397
|
Webcam,
|
|
18103
18398
|
{
|
|
18104
18399
|
ref: webcamReference,
|
|
@@ -18109,7 +18404,7 @@ function CameraCapture({
|
|
|
18109
18404
|
onUserMedia: handleUserMedia
|
|
18110
18405
|
}
|
|
18111
18406
|
),
|
|
18112
|
-
/* @__PURE__ */
|
|
18407
|
+
/* @__PURE__ */ jsx122(
|
|
18113
18408
|
Overlay_default,
|
|
18114
18409
|
{
|
|
18115
18410
|
overlay,
|
|
@@ -18119,8 +18414,8 @@ function CameraCapture({
|
|
|
18119
18414
|
instructions
|
|
18120
18415
|
}
|
|
18121
18416
|
),
|
|
18122
|
-
shouldLockOrientation && /* @__PURE__ */
|
|
18123
|
-
ready && /* @__PURE__ */
|
|
18417
|
+
shouldLockOrientation && /* @__PURE__ */ jsx122(OrientationLockOverlay_default, {}),
|
|
18418
|
+
ready && /* @__PURE__ */ jsx122(
|
|
18124
18419
|
CaptureBottomBar,
|
|
18125
18420
|
{
|
|
18126
18421
|
onCapture: () => {
|
|
@@ -18130,8 +18425,8 @@ function CameraCapture({
|
|
|
18130
18425
|
)
|
|
18131
18426
|
] });
|
|
18132
18427
|
const reviewScreen = /* @__PURE__ */ jsxs50("div", { className: "camera-capture", children: [
|
|
18133
|
-
/* @__PURE__ */
|
|
18134
|
-
/* @__PURE__ */
|
|
18428
|
+
/* @__PURE__ */ jsx122("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
18429
|
+
/* @__PURE__ */ jsx122(
|
|
18135
18430
|
Overlay_default,
|
|
18136
18431
|
{
|
|
18137
18432
|
overlay,
|
|
@@ -18141,18 +18436,18 @@ function CameraCapture({
|
|
|
18141
18436
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
18142
18437
|
}
|
|
18143
18438
|
),
|
|
18144
|
-
/* @__PURE__ */
|
|
18439
|
+
/* @__PURE__ */ jsx122(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
18145
18440
|
] });
|
|
18146
18441
|
return /* @__PURE__ */ jsxs50("section", { children: [
|
|
18147
18442
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
18148
18443
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
18149
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */
|
|
18444
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ jsx122(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
18150
18445
|
] });
|
|
18151
18446
|
}
|
|
18152
18447
|
var CameraCapture_default = CameraCapture;
|
|
18153
18448
|
|
|
18154
18449
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
18155
|
-
import { jsx as
|
|
18450
|
+
import { jsx as jsx123 } from "react/jsx-runtime";
|
|
18156
18451
|
function blobToBase64(blob) {
|
|
18157
18452
|
return new Promise((resolve, _) => {
|
|
18158
18453
|
const reader = new FileReader();
|
|
@@ -18170,7 +18465,7 @@ function CameraStep(props) {
|
|
|
18170
18465
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
18171
18466
|
const { overlay, outline } = assets || {};
|
|
18172
18467
|
const { url: imageUrl } = image || {};
|
|
18173
|
-
const [captureClicked, setCaptureClicked] =
|
|
18468
|
+
const [captureClicked, setCaptureClicked] = useState32(false);
|
|
18174
18469
|
useEffect25(() => {
|
|
18175
18470
|
if (captureClicked) {
|
|
18176
18471
|
onAction(action);
|
|
@@ -18190,7 +18485,7 @@ function CameraStep(props) {
|
|
|
18190
18485
|
});
|
|
18191
18486
|
}
|
|
18192
18487
|
};
|
|
18193
|
-
return /* @__PURE__ */
|
|
18488
|
+
return /* @__PURE__ */ jsx123(
|
|
18194
18489
|
CameraCapture_default,
|
|
18195
18490
|
{
|
|
18196
18491
|
overlay,
|
|
@@ -18239,13 +18534,13 @@ function getFirstAction(step) {
|
|
|
18239
18534
|
}
|
|
18240
18535
|
|
|
18241
18536
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18242
|
-
import { useIntl as
|
|
18243
|
-
import { jsx as
|
|
18537
|
+
import { useIntl as useIntl24 } from "react-intl";
|
|
18538
|
+
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
18244
18539
|
var noop6 = () => {
|
|
18245
18540
|
};
|
|
18246
18541
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18247
|
-
const { formatMessage } =
|
|
18248
|
-
return /* @__PURE__ */
|
|
18542
|
+
const { formatMessage } = useIntl24();
|
|
18543
|
+
return /* @__PURE__ */ jsx124(
|
|
18249
18544
|
DynamicLayout_default,
|
|
18250
18545
|
{
|
|
18251
18546
|
components: [
|
|
@@ -18312,7 +18607,7 @@ function getOrigin2(url) {
|
|
|
18312
18607
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18313
18608
|
import { Avatar as Avatar7 } from "@transferwise/components";
|
|
18314
18609
|
import { ArrowLeft as ArrowLeft2 } from "@transferwise/icons";
|
|
18315
|
-
import { jsx as
|
|
18610
|
+
import { jsx as jsx125, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
18316
18611
|
function BackButton2({ title, action, onAction }) {
|
|
18317
18612
|
return /* @__PURE__ */ jsxs51(
|
|
18318
18613
|
"a",
|
|
@@ -18325,8 +18620,8 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18325
18620
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18326
18621
|
},
|
|
18327
18622
|
children: [
|
|
18328
|
-
/* @__PURE__ */
|
|
18329
|
-
/* @__PURE__ */
|
|
18623
|
+
/* @__PURE__ */ jsx125("span", { className: "sr-only", children: title }),
|
|
18624
|
+
/* @__PURE__ */ jsx125(Avatar7, { type: "icon", children: /* @__PURE__ */ jsx125(ArrowLeft2, { size: "24" }) })
|
|
18330
18625
|
]
|
|
18331
18626
|
}
|
|
18332
18627
|
);
|
|
@@ -18334,7 +18629,7 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18334
18629
|
var BackButton_default2 = BackButton2;
|
|
18335
18630
|
|
|
18336
18631
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18337
|
-
import { Fragment as Fragment24, jsx as
|
|
18632
|
+
import { Fragment as Fragment24, jsx as jsx126, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
18338
18633
|
function DynamicFlowStep(props) {
|
|
18339
18634
|
var _a, _b, _c;
|
|
18340
18635
|
const { step, globalError, onAction } = props;
|
|
@@ -18343,20 +18638,20 @@ function DynamicFlowStep(props) {
|
|
|
18343
18638
|
const { requiresManualTrigger, dismissConfirmation } = useExternal2(externalUrl);
|
|
18344
18639
|
if (step === void 0) {
|
|
18345
18640
|
if (globalError) {
|
|
18346
|
-
return /* @__PURE__ */
|
|
18641
|
+
return /* @__PURE__ */ jsx126(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18347
18642
|
}
|
|
18348
18643
|
return null;
|
|
18349
18644
|
}
|
|
18350
18645
|
if (externalUrl && requiresManualTrigger) {
|
|
18351
|
-
return /* @__PURE__ */
|
|
18646
|
+
return /* @__PURE__ */ jsx126(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18352
18647
|
}
|
|
18353
18648
|
if (isCameraStep(step)) {
|
|
18354
|
-
return /* @__PURE__ */
|
|
18649
|
+
return /* @__PURE__ */ jsx126(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18355
18650
|
}
|
|
18356
18651
|
return /* @__PURE__ */ jsxs52(Fragment24, { children: [
|
|
18357
|
-
backButton && /* @__PURE__ */
|
|
18358
|
-
globalError ? /* @__PURE__ */
|
|
18359
|
-
/* @__PURE__ */
|
|
18652
|
+
backButton && /* @__PURE__ */ jsx126(BackButton_default2, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
18653
|
+
globalError ? /* @__PURE__ */ jsx126(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
18654
|
+
/* @__PURE__ */ jsx126(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
18360
18655
|
] });
|
|
18361
18656
|
}
|
|
18362
18657
|
|
|
@@ -18396,12 +18691,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18396
18691
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18397
18692
|
|
|
18398
18693
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18399
|
-
import { useMemo as useMemo21, useState as
|
|
18694
|
+
import { useMemo as useMemo21, useState as useState33 } from "react";
|
|
18400
18695
|
var useDynamicFlowState = (initialStep) => {
|
|
18401
18696
|
var _a, _b;
|
|
18402
|
-
const [formErrors, setFormErrors] =
|
|
18403
|
-
const [globalError, setGlobalError] =
|
|
18404
|
-
const [stepAndModels, setStepAndModels] =
|
|
18697
|
+
const [formErrors, setFormErrors] = useState33((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
18698
|
+
const [globalError, setGlobalError] = useState33((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
18699
|
+
const [stepAndModels, setStepAndModels] = useState33({
|
|
18405
18700
|
step: initialStep || void 0,
|
|
18406
18701
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18407
18702
|
etag: void 0
|
|
@@ -18504,17 +18799,17 @@ var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object"
|
|
|
18504
18799
|
|
|
18505
18800
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18506
18801
|
import { Loader as Loader4, Size as Size4 } from "@transferwise/components";
|
|
18507
|
-
import { useState as
|
|
18508
|
-
import { jsx as
|
|
18802
|
+
import { useState as useState34 } from "react";
|
|
18803
|
+
import { jsx as jsx127 } from "react/jsx-runtime";
|
|
18509
18804
|
function useLoader(loaderConfig, initialState) {
|
|
18510
18805
|
const config = __spreadValues({
|
|
18511
18806
|
size: Size4.EXTRA_LARGE,
|
|
18512
18807
|
initial: true,
|
|
18513
18808
|
submission: false
|
|
18514
18809
|
}, loaderConfig);
|
|
18515
|
-
const [loadingState, setLoadingState] =
|
|
18810
|
+
const [loadingState, setLoadingState] = useState34(initialState);
|
|
18516
18811
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18517
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */
|
|
18812
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ jsx127(
|
|
18518
18813
|
Loader4,
|
|
18519
18814
|
{
|
|
18520
18815
|
size: config.size,
|
|
@@ -18617,9 +18912,9 @@ var assertResponseIsValid2 = (response) => {
|
|
|
18617
18912
|
var isResponse2 = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
18618
18913
|
|
|
18619
18914
|
// src/legacy/dynamicFlow/utils/useErrorResponse.tsx
|
|
18620
|
-
import { useIntl as
|
|
18915
|
+
import { useIntl as useIntl25 } from "react-intl";
|
|
18621
18916
|
var useErrorResponse = () => {
|
|
18622
|
-
const { formatMessage } =
|
|
18917
|
+
const { formatMessage } = useIntl25();
|
|
18623
18918
|
return async (response, fetchType) => {
|
|
18624
18919
|
try {
|
|
18625
18920
|
const errorResponse = await parseErrorResponse(response);
|
|
@@ -18634,7 +18929,7 @@ var useErrorResponse = () => {
|
|
|
18634
18929
|
};
|
|
18635
18930
|
|
|
18636
18931
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18637
|
-
import { jsx as
|
|
18932
|
+
import { jsx as jsx128 } from "react/jsx-runtime";
|
|
18638
18933
|
var noop7 = () => {
|
|
18639
18934
|
};
|
|
18640
18935
|
var DynamicFlowComponent = ({
|
|
@@ -18662,7 +18957,7 @@ var DynamicFlowComponent = ({
|
|
|
18662
18957
|
setStepAndEtag,
|
|
18663
18958
|
setSchemaModel
|
|
18664
18959
|
} = useDynamicFlowState(initialStep);
|
|
18665
|
-
const [submitted, setSubmitted] =
|
|
18960
|
+
const [submitted, setSubmitted] = useState35(false);
|
|
18666
18961
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18667
18962
|
loaderConfig,
|
|
18668
18963
|
initialStep ? "idle" : "initial"
|
|
@@ -18873,7 +19168,7 @@ var DynamicFlowComponent = ({
|
|
|
18873
19168
|
await performAction(action);
|
|
18874
19169
|
}
|
|
18875
19170
|
};
|
|
18876
|
-
return /* @__PURE__ */
|
|
19171
|
+
return /* @__PURE__ */ jsx128(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ jsx128(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ jsx128(DynamicFlowProvider, { loading: isLoading || isDebouncing, children: /* @__PURE__ */ jsx128(HttpClientProvider, { httpClient, children: /* @__PURE__ */ jsx128(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ jsx128(
|
|
18877
19172
|
DynamicFlowStep,
|
|
18878
19173
|
{
|
|
18879
19174
|
step,
|
|
@@ -18890,7 +19185,7 @@ var DynamicFlowComponent = ({
|
|
|
18890
19185
|
) }) }) }) }) });
|
|
18891
19186
|
};
|
|
18892
19187
|
function DynamicFlow(props) {
|
|
18893
|
-
return /* @__PURE__ */
|
|
19188
|
+
return /* @__PURE__ */ jsx128(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ jsx128(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
18894
19189
|
}
|
|
18895
19190
|
var DynamicFlow_default = DynamicFlow;
|
|
18896
19191
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18907,19 +19202,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18907
19202
|
};
|
|
18908
19203
|
|
|
18909
19204
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18910
|
-
import { jsx as
|
|
19205
|
+
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
18911
19206
|
function JsonSchemaForm(props) {
|
|
18912
19207
|
const schemaProps = __spreadValues({
|
|
18913
19208
|
model: null,
|
|
18914
19209
|
errors: null
|
|
18915
19210
|
}, props);
|
|
18916
19211
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18917
|
-
return /* @__PURE__ */
|
|
19212
|
+
return /* @__PURE__ */ jsx129(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ jsx129(
|
|
18918
19213
|
EventsContextProvider,
|
|
18919
19214
|
{
|
|
18920
19215
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18921
19216
|
onEvent,
|
|
18922
|
-
children: /* @__PURE__ */
|
|
19217
|
+
children: /* @__PURE__ */ jsx129(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ jsx129(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18923
19218
|
}
|
|
18924
19219
|
) });
|
|
18925
19220
|
}
|