@wise/dynamic-flow-client 3.9.4 → 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 +1251 -950
- package/build/main.min.js +1 -1
- package/build/main.mjs +914 -613
- 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/MultiSelectInputComponent.d.ts +28 -0
- 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.js
CHANGED
|
@@ -1147,7 +1147,7 @@ var translations = {
|
|
|
1147
1147
|
var i18n_default = translations;
|
|
1148
1148
|
|
|
1149
1149
|
// src/revamp/DynamicFlowWise.tsx
|
|
1150
|
-
var
|
|
1150
|
+
var import_react21 = require("react");
|
|
1151
1151
|
|
|
1152
1152
|
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1153
1153
|
var import_react = require("react");
|
|
@@ -1707,6 +1707,17 @@ var textInputComponentToProps = (component) => __spreadProps(__spreadValues({},
|
|
|
1707
1707
|
onChange: component.onChange.bind(component)
|
|
1708
1708
|
});
|
|
1709
1709
|
|
|
1710
|
+
// src/revamp/renderers/mappers/multiSelectComponentToProps.ts
|
|
1711
|
+
var multiSelectInputComponentToProps = (component) => {
|
|
1712
|
+
const { options, selectedIndices, onSelect } = component;
|
|
1713
|
+
const _a = inputComponentToProps(component, "input-multi-select"), { value } = _a, props = __objRest(_a, ["value"]);
|
|
1714
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
1715
|
+
options,
|
|
1716
|
+
selectedIndices,
|
|
1717
|
+
onSelect: onSelect.bind(component)
|
|
1718
|
+
});
|
|
1719
|
+
};
|
|
1720
|
+
|
|
1710
1721
|
// src/revamp/renderers/mappers/uploadInputComponentToProps.ts
|
|
1711
1722
|
var uploadInputComponentToProps = (component) => {
|
|
1712
1723
|
const { accepts, maxSize } = component;
|
|
@@ -1764,6 +1775,8 @@ var componentToRendererProps = (component, nestedContent) => {
|
|
|
1764
1775
|
return markdownComponentToProps(component);
|
|
1765
1776
|
case "modal":
|
|
1766
1777
|
return modalComponentToProps(component, children);
|
|
1778
|
+
case "multi-select":
|
|
1779
|
+
return multiSelectInputComponentToProps(component);
|
|
1767
1780
|
case "multi-upload":
|
|
1768
1781
|
return multiUploadInputComponentToProps(component);
|
|
1769
1782
|
case "number":
|
|
@@ -6724,6 +6737,17 @@ var abortAndResetController = (abortController) => {
|
|
|
6724
6737
|
return new AbortController();
|
|
6725
6738
|
};
|
|
6726
6739
|
|
|
6740
|
+
// src/revamp/domain/components/utils/local-value.ts
|
|
6741
|
+
var compareLocalValue = (valueA, valueB) => {
|
|
6742
|
+
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
6743
|
+
return valueA.length === valueB.length && valueA.every((value, index) => compareLocalValue(value, valueB[index]));
|
|
6744
|
+
}
|
|
6745
|
+
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
6746
|
+
return Object.keys(valueA).every((key) => compareLocalValue(valueA[key], valueB[key]));
|
|
6747
|
+
}
|
|
6748
|
+
return valueA === valueB;
|
|
6749
|
+
};
|
|
6750
|
+
|
|
6727
6751
|
// src/revamp/domain/features/persistAsync/getComponentPersistAsync.ts
|
|
6728
6752
|
var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
6729
6753
|
/**
|
|
@@ -6732,7 +6756,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
6732
6756
|
*/
|
|
6733
6757
|
async (persistedState, currentValue) => {
|
|
6734
6758
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
6735
|
-
if (lastSubmitted
|
|
6759
|
+
if (compareLocalValue(lastSubmitted, currentValue)) {
|
|
6736
6760
|
return submission;
|
|
6737
6761
|
}
|
|
6738
6762
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7791,15 +7815,6 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
7791
7815
|
return compareLocalValue(partialValue, componentValue);
|
|
7792
7816
|
};
|
|
7793
7817
|
var areEquivalentFiles = (fileA, fileB) => fileA.name === fileB.name && fileA.type === fileB.type && fileA.size === fileB.size;
|
|
7794
|
-
var compareLocalValue = (valueA, valueB) => {
|
|
7795
|
-
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7796
|
-
return valueA.length === valueB.length && valueA.every((value, index) => compareLocalValue(value, valueB[index]));
|
|
7797
|
-
}
|
|
7798
|
-
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7799
|
-
return Object.keys(valueA).every((key) => compareLocalValue(valueA[key], valueB[key]));
|
|
7800
|
-
}
|
|
7801
|
-
return valueA === valueB;
|
|
7802
|
-
};
|
|
7803
7818
|
|
|
7804
7819
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
7805
7820
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
@@ -8767,6 +8782,193 @@ var getPersistAsyncConfig = (schema) => {
|
|
|
8767
8782
|
};
|
|
8768
8783
|
var getValueForPersistAsync = (localValue) => isArray(localValue) && localValue.every(isFile) ? localValue : [];
|
|
8769
8784
|
|
|
8785
|
+
// src/revamp/domain/components/MultiSelectInputComponent.ts
|
|
8786
|
+
var createMultiSelectComponent = (multiSelectProps, updateComponent) => {
|
|
8787
|
+
const _a = multiSelectProps, {
|
|
8788
|
+
uid,
|
|
8789
|
+
checks,
|
|
8790
|
+
options,
|
|
8791
|
+
initialValue,
|
|
8792
|
+
performPersistAsync,
|
|
8793
|
+
performValidationAsync,
|
|
8794
|
+
performRefresh,
|
|
8795
|
+
onValueChange
|
|
8796
|
+
} = _a, rest = __objRest(_a, [
|
|
8797
|
+
"uid",
|
|
8798
|
+
"checks",
|
|
8799
|
+
"options",
|
|
8800
|
+
"initialValue",
|
|
8801
|
+
"performPersistAsync",
|
|
8802
|
+
"performValidationAsync",
|
|
8803
|
+
"performRefresh",
|
|
8804
|
+
"onValueChange"
|
|
8805
|
+
]);
|
|
8806
|
+
const update = getInputUpdateFunction(uid, updateComponent);
|
|
8807
|
+
const children = options.map((option) => option.component);
|
|
8808
|
+
const selectedIndices = getInitialModelIndices(initialValue, children);
|
|
8809
|
+
const getValidationErrors = getLocalValueValidator(checks);
|
|
8810
|
+
const getAndSetValidationErrors = (currentValue) => {
|
|
8811
|
+
const messages = getValidationErrors(currentValue);
|
|
8812
|
+
update((draft) => {
|
|
8813
|
+
draft.errors = messages;
|
|
8814
|
+
});
|
|
8815
|
+
return messages;
|
|
8816
|
+
};
|
|
8817
|
+
const inputComponent = __spreadProps(__spreadValues({
|
|
8818
|
+
uid,
|
|
8819
|
+
type: "multi-select",
|
|
8820
|
+
children,
|
|
8821
|
+
options,
|
|
8822
|
+
selectedIndices,
|
|
8823
|
+
value: null
|
|
8824
|
+
}, rest), {
|
|
8825
|
+
onSelect(indices) {
|
|
8826
|
+
update((draft) => {
|
|
8827
|
+
draft.selectedIndices = indices;
|
|
8828
|
+
draft.errors = [];
|
|
8829
|
+
});
|
|
8830
|
+
performRefresh == null ? void 0 : performRefresh();
|
|
8831
|
+
onValueChange();
|
|
8832
|
+
getAndSetValidationErrors(this.getLocalValue());
|
|
8833
|
+
},
|
|
8834
|
+
onBlur() {
|
|
8835
|
+
},
|
|
8836
|
+
// Noop
|
|
8837
|
+
onFocus() {
|
|
8838
|
+
},
|
|
8839
|
+
// Noop
|
|
8840
|
+
getLocalValue() {
|
|
8841
|
+
var _a2, _b;
|
|
8842
|
+
return (_b = (_a2 = this.getSelectedChildren()) == null ? void 0 : _a2.map((child) => child.getLocalValue())) != null ? _b : null;
|
|
8843
|
+
},
|
|
8844
|
+
validate() {
|
|
8845
|
+
const messages = getAndSetValidationErrors(this.getLocalValue());
|
|
8846
|
+
return messages.length === 0;
|
|
8847
|
+
},
|
|
8848
|
+
async getSubmittableValue() {
|
|
8849
|
+
const selected = this.getSelectedChildren();
|
|
8850
|
+
if (selected) {
|
|
8851
|
+
return Promise.all(selected.map(async (child) => child.getSubmittableValue()));
|
|
8852
|
+
}
|
|
8853
|
+
return null;
|
|
8854
|
+
},
|
|
8855
|
+
getSummary: () => ({}),
|
|
8856
|
+
getChildren() {
|
|
8857
|
+
return this.children;
|
|
8858
|
+
},
|
|
8859
|
+
getSelectedChildren() {
|
|
8860
|
+
return this.selectedIndices.map((i) => this.children[i]);
|
|
8861
|
+
}
|
|
8862
|
+
});
|
|
8863
|
+
if (performRefresh) {
|
|
8864
|
+
return inputComponent;
|
|
8865
|
+
}
|
|
8866
|
+
if (performPersistAsync) {
|
|
8867
|
+
const persist = getComponentPersistAsync(update, performPersistAsync);
|
|
8868
|
+
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8869
|
+
isPersisted: true,
|
|
8870
|
+
onSelect(indices) {
|
|
8871
|
+
inputComponent.onSelect.call(this, indices);
|
|
8872
|
+
const isValid2 = getValidationErrors(this.getLocalValue()).length === 0;
|
|
8873
|
+
if (isValid2 && indices != null) {
|
|
8874
|
+
persist(this.persistedState, this.getLocalValue()).catch(() => {
|
|
8875
|
+
});
|
|
8876
|
+
}
|
|
8877
|
+
},
|
|
8878
|
+
async getSubmittableValue() {
|
|
8879
|
+
return persist(this.persistedState, this.getLocalValue());
|
|
8880
|
+
}
|
|
8881
|
+
});
|
|
8882
|
+
}
|
|
8883
|
+
if (performValidationAsync) {
|
|
8884
|
+
const validateAsync = getComponentValidationAsync(update, performValidationAsync);
|
|
8885
|
+
return __spreadProps(__spreadValues({}, inputComponent), {
|
|
8886
|
+
onSelect(indices) {
|
|
8887
|
+
inputComponent.onSelect.call(this, indices);
|
|
8888
|
+
if (this.validate()) {
|
|
8889
|
+
validateAsync(this.validationState, this.getLocalValue()).catch(() => {
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
});
|
|
8894
|
+
}
|
|
8895
|
+
return inputComponent;
|
|
8896
|
+
};
|
|
8897
|
+
var getInitialModelIndices = (model, options) => {
|
|
8898
|
+
if (!isArray(model)) {
|
|
8899
|
+
return [];
|
|
8900
|
+
}
|
|
8901
|
+
return model.map((m) => options.findIndex((o) => o.getLocalValue() === m)).filter((n) => n >= 0);
|
|
8902
|
+
};
|
|
8903
|
+
|
|
8904
|
+
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.ts
|
|
8905
|
+
var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
|
|
8906
|
+
const {
|
|
8907
|
+
uid,
|
|
8908
|
+
localValue,
|
|
8909
|
+
schema,
|
|
8910
|
+
model,
|
|
8911
|
+
required = false,
|
|
8912
|
+
validationErrors: initialError
|
|
8913
|
+
} = schemaMapperProps;
|
|
8914
|
+
const initialModel = model != null ? model : null;
|
|
8915
|
+
const options = schema.items.oneOf.map((childSchema, index) => {
|
|
8916
|
+
const { title: title2 = "", description, image, icon, keywords = [] } = childSchema;
|
|
8917
|
+
return {
|
|
8918
|
+
title: title2,
|
|
8919
|
+
description,
|
|
8920
|
+
image,
|
|
8921
|
+
icon,
|
|
8922
|
+
keywords,
|
|
8923
|
+
disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
|
|
8924
|
+
component: mapSchemaToComponent(
|
|
8925
|
+
{
|
|
8926
|
+
uid: `${uid}.oneOf-${index}`,
|
|
8927
|
+
schema: childSchema,
|
|
8928
|
+
model: initialModel,
|
|
8929
|
+
localValue,
|
|
8930
|
+
validationErrors: initialError,
|
|
8931
|
+
required
|
|
8932
|
+
},
|
|
8933
|
+
mapperProps
|
|
8934
|
+
)
|
|
8935
|
+
};
|
|
8936
|
+
});
|
|
8937
|
+
const { title, validationMessages } = schema;
|
|
8938
|
+
const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
|
|
8939
|
+
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
8940
|
+
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
8941
|
+
schemaMapperProps,
|
|
8942
|
+
mapperProps
|
|
8943
|
+
);
|
|
8944
|
+
const { performValidationAsync, validationState } = getValidationAsyncInitialState(
|
|
8945
|
+
schemaMapperProps,
|
|
8946
|
+
mapperProps
|
|
8947
|
+
);
|
|
8948
|
+
const initialValue = performPersistAsync ? localValue : model != null ? model : null;
|
|
8949
|
+
return createMultiSelectComponent(
|
|
8950
|
+
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
8951
|
+
autoComplete: "off",
|
|
8952
|
+
checks: schema.hidden ? [] : [
|
|
8953
|
+
getRequiredCheck(required, errorMessageFunctions),
|
|
8954
|
+
getAboveMaxItemsCheck(schema, errorMessageFunctions),
|
|
8955
|
+
getBelowMinItemsCheck(schema, errorMessageFunctions)
|
|
8956
|
+
],
|
|
8957
|
+
initialValue,
|
|
8958
|
+
options,
|
|
8959
|
+
required,
|
|
8960
|
+
persistedState,
|
|
8961
|
+
performPersistAsync,
|
|
8962
|
+
title,
|
|
8963
|
+
validationState,
|
|
8964
|
+
performValidationAsync,
|
|
8965
|
+
performRefresh: getPerformRefresh(schema, onRefresh),
|
|
8966
|
+
onValueChange
|
|
8967
|
+
}),
|
|
8968
|
+
updateComponent
|
|
8969
|
+
);
|
|
8970
|
+
};
|
|
8971
|
+
|
|
8770
8972
|
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.ts
|
|
8771
8973
|
var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
8772
8974
|
const { schema, model: originalModel } = schemaMapperProps;
|
|
@@ -8774,6 +8976,9 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8774
8976
|
if (isArraySchemaListWithMultiFileUpload(schema)) {
|
|
8775
8977
|
return arraySchemaToMultiUploadComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8776
8978
|
}
|
|
8979
|
+
if (isArraySchemaListWithMultiSelect(schema)) {
|
|
8980
|
+
return arraySchemaToMultiSelectComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8981
|
+
}
|
|
8777
8982
|
if (isArrayListSchema(schema)) {
|
|
8778
8983
|
return arraySchemaToRepeatableComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8779
8984
|
}
|
|
@@ -8781,6 +8986,7 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8781
8986
|
};
|
|
8782
8987
|
var isArraySchemaListWithMultiFileUpload = (schema) => isArrayListSchema(schema) && (isPersistAsyncWithUploadSchema(schema.items) || isStringSchemaWithUpload(schema.items));
|
|
8783
8988
|
var isPersistAsyncWithUploadSchema = (schema) => isSchemaWithPersistAsync(schema) && (isBlobSchema(schema.persistAsync.schema) || isStringSchemaWithUpload(schema.persistAsync.schema));
|
|
8989
|
+
var isArraySchemaListWithMultiSelect = (schema) => isArrayListSchema(schema) && "oneOf" in schema.items && schema.items.oneOf.every(isConstSchema);
|
|
8784
8990
|
|
|
8785
8991
|
// src/revamp/domain/components/BooleanInputComponent.ts
|
|
8786
8992
|
var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
@@ -10218,7 +10424,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10218
10424
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10219
10425
|
}
|
|
10220
10426
|
|
|
10221
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.
|
|
10427
|
+
// ../../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
|
|
10222
10428
|
var import_components3 = require("@transferwise/components");
|
|
10223
10429
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10224
10430
|
var import_react7 = require("react");
|
|
@@ -11006,79 +11212,197 @@ function DFModal({ content, margin, trigger }) {
|
|
|
11006
11212
|
] });
|
|
11007
11213
|
}
|
|
11008
11214
|
|
|
11009
|
-
// src/revamp/wise/renderers/
|
|
11215
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11010
11216
|
var import_components19 = require("@transferwise/components");
|
|
11011
11217
|
|
|
11012
|
-
// src/revamp/wise/renderers/
|
|
11218
|
+
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11013
11219
|
var import_components18 = require("@transferwise/components");
|
|
11014
|
-
var import_classnames4 = __toESM(require_classnames());
|
|
11015
11220
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
11016
|
-
function
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
return
|
|
11027
|
-
"div",
|
|
11028
|
-
{
|
|
11029
|
-
className: (0, import_classnames4.default)("form-group d-block", {
|
|
11030
|
-
"has-error": !!error
|
|
11031
|
-
}),
|
|
11032
|
-
children: [
|
|
11033
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
11034
|
-
children,
|
|
11035
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components18.InlineAlert, { type: "negative", id: descriptionId, children: error })
|
|
11036
|
-
]
|
|
11037
|
-
}
|
|
11038
|
-
);
|
|
11221
|
+
function OptionMedia({ icon, image }) {
|
|
11222
|
+
if (image == null ? void 0 : image.url) {
|
|
11223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
11224
|
+
}
|
|
11225
|
+
if (icon && "name" in icon) {
|
|
11226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components18.Avatar, { type: import_components18.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DynamicIcon_default, { name: icon.name }) });
|
|
11227
|
+
}
|
|
11228
|
+
if (icon && "text" in icon) {
|
|
11229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components18.Avatar, { type: import_components18.AvatarType.INITIALS, children: icon.text });
|
|
11230
|
+
}
|
|
11231
|
+
return null;
|
|
11039
11232
|
}
|
|
11040
|
-
var UploadFieldInput_default = UploadFieldInput;
|
|
11041
11233
|
|
|
11042
|
-
// src/revamp/wise/renderers/
|
|
11043
|
-
var
|
|
11044
|
-
var toKilobytes = (sizeInBytes) => {
|
|
11045
|
-
const ONE_KB_IN_BYTES = 1024;
|
|
11046
|
-
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
11047
|
-
};
|
|
11048
|
-
var toFile = async (base64Url, name) => {
|
|
11049
|
-
const type = getFileType(base64Url);
|
|
11050
|
-
const blob = await toBlob(base64Url);
|
|
11051
|
-
return new File([blob], name, { type });
|
|
11052
|
-
};
|
|
11053
|
-
var toBlob = async (base64Url) => (await fetch(base64Url)).blob();
|
|
11054
|
-
var getFileType = (base64Url) => {
|
|
11055
|
-
const contentTypeRegex = /^data:(.+);/;
|
|
11056
|
-
const matches = contentTypeRegex.exec(base64Url);
|
|
11057
|
-
if (matches && matches.length > 1) {
|
|
11058
|
-
return matches[1];
|
|
11059
|
-
}
|
|
11060
|
-
return void 0;
|
|
11061
|
-
};
|
|
11234
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11235
|
+
var import_react_intl10 = require("react-intl");
|
|
11062
11236
|
|
|
11063
|
-
//
|
|
11064
|
-
var
|
|
11065
|
-
var
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11237
|
+
// src/common/messages/multi-select.messages.ts
|
|
11238
|
+
var import_react_intl9 = require("react-intl");
|
|
11239
|
+
var multi_select_messages_default = (0, import_react_intl9.defineMessages)({
|
|
11240
|
+
summary: {
|
|
11241
|
+
id: "dynamicFlows.MultiSelect.summary",
|
|
11242
|
+
defaultMessage: "{first} and {count} more",
|
|
11243
|
+
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."
|
|
11070
11244
|
}
|
|
11071
|
-
|
|
11072
|
-
};
|
|
11073
|
-
|
|
11074
|
-
// src/revamp/wise/renderers/utils/getRandomId.ts
|
|
11075
|
-
var getRandomId = () => nanoid(10);
|
|
11245
|
+
});
|
|
11076
11246
|
|
|
11077
|
-
// src/revamp/wise/renderers/
|
|
11247
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11248
|
+
var import_react12 = require("react");
|
|
11078
11249
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
11079
|
-
var
|
|
11080
|
-
canRenderType: "input-
|
|
11081
|
-
render: (props) => {
|
|
11250
|
+
var MultiSelectInputRenderer = {
|
|
11251
|
+
canRenderType: "input-multi-select",
|
|
11252
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
11253
|
+
};
|
|
11254
|
+
function MultiSelectInputRendererComponent(props) {
|
|
11255
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
11256
|
+
const [stagedIndices, setStagedIndices] = (0, import_react12.useState)();
|
|
11257
|
+
const {
|
|
11258
|
+
id,
|
|
11259
|
+
description,
|
|
11260
|
+
disabled,
|
|
11261
|
+
label,
|
|
11262
|
+
help,
|
|
11263
|
+
error,
|
|
11264
|
+
options,
|
|
11265
|
+
placeholder,
|
|
11266
|
+
selectedIndices,
|
|
11267
|
+
onSelect
|
|
11268
|
+
} = props;
|
|
11269
|
+
const mergedIndices = stagedIndices != null ? stagedIndices : selectedIndices;
|
|
11270
|
+
const getFormattedMessage = () => {
|
|
11271
|
+
if (mergedIndices.length > 0) {
|
|
11272
|
+
if (mergedIndices.length > 1) {
|
|
11273
|
+
return formatMessage(multi_select_messages_default.summary, {
|
|
11274
|
+
first: options[mergedIndices[0]].title,
|
|
11275
|
+
count: mergedIndices.length - 1
|
|
11276
|
+
});
|
|
11277
|
+
}
|
|
11278
|
+
return options[mergedIndices[0]].title;
|
|
11279
|
+
}
|
|
11280
|
+
return void 0;
|
|
11281
|
+
};
|
|
11282
|
+
const renderValue = (index, withinTrigger) => {
|
|
11283
|
+
const option = index >= 0 ? options[index] : null;
|
|
11284
|
+
if (option === null) {
|
|
11285
|
+
return null;
|
|
11286
|
+
}
|
|
11287
|
+
if (withinTrigger) {
|
|
11288
|
+
return index === mergedIndices[0] ? getFormattedMessage() : void 0;
|
|
11289
|
+
}
|
|
11290
|
+
const contentProps = {
|
|
11291
|
+
title: option.title,
|
|
11292
|
+
description: option.description,
|
|
11293
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OptionMedia, { icon: option.icon, image: option.image })
|
|
11294
|
+
};
|
|
11295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components19.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
11296
|
+
};
|
|
11297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11298
|
+
import_components19.SelectInput,
|
|
11299
|
+
{
|
|
11300
|
+
id,
|
|
11301
|
+
items: options.map((option, index) => {
|
|
11302
|
+
var _a, _b, _c;
|
|
11303
|
+
return {
|
|
11304
|
+
type: "option",
|
|
11305
|
+
value: index,
|
|
11306
|
+
filterMatchers: [
|
|
11307
|
+
...(_a = option.keywords) != null ? _a : [],
|
|
11308
|
+
(_b = option.title) != null ? _b : "",
|
|
11309
|
+
(_c = option.description) != null ? _c : ""
|
|
11310
|
+
],
|
|
11311
|
+
disabled: option.disabled
|
|
11312
|
+
};
|
|
11313
|
+
}),
|
|
11314
|
+
disabled,
|
|
11315
|
+
placeholder,
|
|
11316
|
+
value: mergedIndices,
|
|
11317
|
+
renderValue,
|
|
11318
|
+
multiple: true,
|
|
11319
|
+
onChange: (values) => {
|
|
11320
|
+
setStagedIndices(values);
|
|
11321
|
+
},
|
|
11322
|
+
onClose: () => {
|
|
11323
|
+
if (stagedIndices) {
|
|
11324
|
+
onSelect(stagedIndices);
|
|
11325
|
+
setStagedIndices(void 0);
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
) });
|
|
11330
|
+
}
|
|
11331
|
+
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
11332
|
+
|
|
11333
|
+
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
11334
|
+
var import_components21 = require("@transferwise/components");
|
|
11335
|
+
|
|
11336
|
+
// src/revamp/wise/renderers/components/UploadFieldInput.tsx
|
|
11337
|
+
var import_components20 = require("@transferwise/components");
|
|
11338
|
+
var import_classnames4 = __toESM(require_classnames());
|
|
11339
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
11340
|
+
function UploadFieldInput({
|
|
11341
|
+
id,
|
|
11342
|
+
children,
|
|
11343
|
+
label,
|
|
11344
|
+
description,
|
|
11345
|
+
error,
|
|
11346
|
+
help
|
|
11347
|
+
}) {
|
|
11348
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
11349
|
+
const descriptionId = description ? `${id}-description` : void 0;
|
|
11350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
11351
|
+
"div",
|
|
11352
|
+
{
|
|
11353
|
+
className: (0, import_classnames4.default)("form-group d-block", {
|
|
11354
|
+
"has-error": !!error
|
|
11355
|
+
}),
|
|
11356
|
+
children: [
|
|
11357
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
11358
|
+
children,
|
|
11359
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_components20.InlineAlert, { type: "negative", id: descriptionId, children: error })
|
|
11360
|
+
]
|
|
11361
|
+
}
|
|
11362
|
+
);
|
|
11363
|
+
}
|
|
11364
|
+
var UploadFieldInput_default = UploadFieldInput;
|
|
11365
|
+
|
|
11366
|
+
// src/revamp/wise/renderers/utils/file-utils.ts
|
|
11367
|
+
var getAcceptsString = (accepts) => Array.isArray(accepts) && accepts.length >= 1 ? accepts.join(",") : "*";
|
|
11368
|
+
var toKilobytes = (sizeInBytes) => {
|
|
11369
|
+
const ONE_KB_IN_BYTES = 1024;
|
|
11370
|
+
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
11371
|
+
};
|
|
11372
|
+
var toFile = async (base64Url, name) => {
|
|
11373
|
+
const type = getFileType(base64Url);
|
|
11374
|
+
const blob = await toBlob(base64Url);
|
|
11375
|
+
return new File([blob], name, { type });
|
|
11376
|
+
};
|
|
11377
|
+
var toBlob = async (base64Url) => (await fetch(base64Url)).blob();
|
|
11378
|
+
var getFileType = (base64Url) => {
|
|
11379
|
+
const contentTypeRegex = /^data:(.+);/;
|
|
11380
|
+
const matches = contentTypeRegex.exec(base64Url);
|
|
11381
|
+
if (matches && matches.length > 1) {
|
|
11382
|
+
return matches[1];
|
|
11383
|
+
}
|
|
11384
|
+
return void 0;
|
|
11385
|
+
};
|
|
11386
|
+
|
|
11387
|
+
// ../../node_modules/.pnpm/nanoid@5.0.7/node_modules/nanoid/non-secure/index.js
|
|
11388
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
11389
|
+
var nanoid = (size = 21) => {
|
|
11390
|
+
let id = "";
|
|
11391
|
+
let i = size;
|
|
11392
|
+
while (i--) {
|
|
11393
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
11394
|
+
}
|
|
11395
|
+
return id;
|
|
11396
|
+
};
|
|
11397
|
+
|
|
11398
|
+
// src/revamp/wise/renderers/utils/getRandomId.ts
|
|
11399
|
+
var getRandomId = () => nanoid(10);
|
|
11400
|
+
|
|
11401
|
+
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
11402
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
11403
|
+
var MultiUploadInputRenderer = {
|
|
11404
|
+
canRenderType: "input-upload-multi",
|
|
11405
|
+
render: (props) => {
|
|
11082
11406
|
const {
|
|
11083
11407
|
id,
|
|
11084
11408
|
accepts,
|
|
@@ -11102,8 +11426,8 @@ var MultiUploadInputRenderer = {
|
|
|
11102
11426
|
};
|
|
11103
11427
|
const onDeleteFile = async (fileId) => onDelete(String(fileId));
|
|
11104
11428
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
11105
|
-
return /* @__PURE__ */ (0,
|
|
11106
|
-
|
|
11429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(UploadFieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11430
|
+
import_components21.UploadInput,
|
|
11107
11431
|
{
|
|
11108
11432
|
id,
|
|
11109
11433
|
"aria-describedby": descriptionId,
|
|
@@ -11124,14 +11448,14 @@ var MultiUploadInputRenderer = {
|
|
|
11124
11448
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
11125
11449
|
|
|
11126
11450
|
// src/revamp/wise/renderers/NumberInputRenderer.tsx
|
|
11127
|
-
var
|
|
11128
|
-
var
|
|
11451
|
+
var import_components22 = require("@transferwise/components");
|
|
11452
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
11129
11453
|
var NumberInputRenderer = {
|
|
11130
11454
|
canRenderType: "input-number",
|
|
11131
11455
|
render: (props) => {
|
|
11132
11456
|
const _a = props, { id, label, error, description, help, type, value, onChange } = _a, rest = __objRest(_a, ["id", "label", "error", "description", "help", "type", "value", "onChange"]);
|
|
11133
|
-
return /* @__PURE__ */ (0,
|
|
11134
|
-
|
|
11457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
11458
|
+
import_components22.Input,
|
|
11135
11459
|
__spreadValues({
|
|
11136
11460
|
id,
|
|
11137
11461
|
name: id,
|
|
@@ -11149,24 +11473,24 @@ var NumberInputRenderer = {
|
|
|
11149
11473
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
11150
11474
|
|
|
11151
11475
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11152
|
-
var
|
|
11476
|
+
var import_react_intl12 = require("react-intl");
|
|
11153
11477
|
|
|
11154
11478
|
// src/revamp/wise/renderers/hooks/useSnackBarIfAvailable.ts
|
|
11155
|
-
var
|
|
11156
|
-
var
|
|
11479
|
+
var import_components23 = require("@transferwise/components");
|
|
11480
|
+
var import_react13 = require("react");
|
|
11157
11481
|
function useSnackBarIfAvailable() {
|
|
11158
|
-
const context = (0,
|
|
11482
|
+
const context = (0, import_react13.useContext)(import_components23.SnackbarContext);
|
|
11159
11483
|
return context ? context.createSnackbar : () => {
|
|
11160
11484
|
};
|
|
11161
11485
|
}
|
|
11162
11486
|
|
|
11163
11487
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11164
|
-
var
|
|
11488
|
+
var import_components24 = require("@transferwise/components");
|
|
11165
11489
|
var import_classnames5 = __toESM(require_classnames());
|
|
11166
11490
|
|
|
11167
11491
|
// src/common/messages/paragraph.messages.ts
|
|
11168
|
-
var
|
|
11169
|
-
var paragraph_messages_default = (0,
|
|
11492
|
+
var import_react_intl11 = require("react-intl");
|
|
11493
|
+
var paragraph_messages_default = (0, import_react_intl11.defineMessages)({
|
|
11170
11494
|
copy: {
|
|
11171
11495
|
id: "dynamicFlows.DynamicParagraph.copy",
|
|
11172
11496
|
defaultMessage: "Copy",
|
|
@@ -11180,33 +11504,33 @@ var paragraph_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
11180
11504
|
});
|
|
11181
11505
|
|
|
11182
11506
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11183
|
-
var
|
|
11507
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
11184
11508
|
var ParagraphRenderer = {
|
|
11185
11509
|
canRenderType: "paragraph",
|
|
11186
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
11510
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Paragraph, __spreadValues({}, props))
|
|
11187
11511
|
};
|
|
11188
11512
|
function Paragraph({ align, control, margin, text }) {
|
|
11189
11513
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
11190
|
-
return control === "copyable" ? /* @__PURE__ */ (0,
|
|
11514
|
+
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StandardParagraph, { className, text });
|
|
11191
11515
|
}
|
|
11192
11516
|
function StandardParagraph({ text, className }) {
|
|
11193
|
-
return /* @__PURE__ */ (0,
|
|
11517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className, children: text });
|
|
11194
11518
|
}
|
|
11195
11519
|
function CopyableParagraph({
|
|
11196
11520
|
text,
|
|
11197
11521
|
align,
|
|
11198
11522
|
className
|
|
11199
11523
|
}) {
|
|
11200
|
-
const { formatMessage } = (0,
|
|
11524
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
11201
11525
|
const createSnackbar = useSnackBarIfAvailable();
|
|
11202
11526
|
const copy = () => {
|
|
11203
11527
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
11204
11528
|
});
|
|
11205
11529
|
};
|
|
11206
11530
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
11207
|
-
return /* @__PURE__ */ (0,
|
|
11208
|
-
/* @__PURE__ */ (0,
|
|
11209
|
-
|
|
11531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className, children: [
|
|
11532
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11533
|
+
import_components24.Input,
|
|
11210
11534
|
{
|
|
11211
11535
|
type: "text",
|
|
11212
11536
|
value: text,
|
|
@@ -11214,20 +11538,20 @@ function CopyableParagraph({
|
|
|
11214
11538
|
className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
|
|
11215
11539
|
}
|
|
11216
11540
|
),
|
|
11217
|
-
/* @__PURE__ */ (0,
|
|
11541
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components24.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
11218
11542
|
] });
|
|
11219
11543
|
}
|
|
11220
11544
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
11221
11545
|
|
|
11222
11546
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11223
|
-
var
|
|
11224
|
-
var
|
|
11547
|
+
var import_components25 = require("@transferwise/components");
|
|
11548
|
+
var import_react14 = require("react");
|
|
11225
11549
|
var import_icons = require("@transferwise/icons");
|
|
11226
|
-
var
|
|
11550
|
+
var import_react_intl14 = require("react-intl");
|
|
11227
11551
|
|
|
11228
11552
|
// src/common/messages/repeatable.messages.ts
|
|
11229
|
-
var
|
|
11230
|
-
var repeatable_messages_default = (0,
|
|
11553
|
+
var import_react_intl13 = require("react-intl");
|
|
11554
|
+
var repeatable_messages_default = (0, import_react_intl13.defineMessages)({
|
|
11231
11555
|
addItemTitle: {
|
|
11232
11556
|
id: "dynamicFlows.ArraySchema.addItemTitle",
|
|
11233
11557
|
defaultMessage: "Add Item",
|
|
@@ -11252,10 +11576,10 @@ var repeatable_messages_default = (0, import_react_intl11.defineMessages)({
|
|
|
11252
11576
|
|
|
11253
11577
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11254
11578
|
var import_classnames6 = __toESM(require_classnames());
|
|
11255
|
-
var
|
|
11579
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
11256
11580
|
var RepeatableRenderer = {
|
|
11257
11581
|
canRenderType: "repeatable",
|
|
11258
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
11582
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Repeatable, __spreadValues({}, props))
|
|
11259
11583
|
};
|
|
11260
11584
|
function Repeatable(props) {
|
|
11261
11585
|
const {
|
|
@@ -11271,8 +11595,8 @@ function Repeatable(props) {
|
|
|
11271
11595
|
onSave,
|
|
11272
11596
|
onRemove
|
|
11273
11597
|
} = props;
|
|
11274
|
-
const { formatMessage } = (0,
|
|
11275
|
-
const [openModalType, setOpenModalType] = (0,
|
|
11598
|
+
const { formatMessage } = (0, import_react_intl14.useIntl)();
|
|
11599
|
+
const [openModalType, setOpenModalType] = (0, import_react14.useState)(null);
|
|
11276
11600
|
const onAddItem = () => {
|
|
11277
11601
|
onAdd();
|
|
11278
11602
|
setOpenModalType("add");
|
|
@@ -11294,40 +11618,40 @@ function Repeatable(props) {
|
|
|
11294
11618
|
const onCancelEdit = () => {
|
|
11295
11619
|
setOpenModalType(null);
|
|
11296
11620
|
};
|
|
11297
|
-
return /* @__PURE__ */ (0,
|
|
11298
|
-
title && /* @__PURE__ */ (0,
|
|
11299
|
-
description && /* @__PURE__ */ (0,
|
|
11300
|
-
/* @__PURE__ */ (0,
|
|
11621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11622
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components25.Header, { title }),
|
|
11623
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: description }),
|
|
11624
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11301
11625
|
"div",
|
|
11302
11626
|
{
|
|
11303
11627
|
className: (0, import_classnames6.default)("form-group", {
|
|
11304
11628
|
"has-error": error
|
|
11305
11629
|
}),
|
|
11306
11630
|
children: [
|
|
11307
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
11308
|
-
/* @__PURE__ */ (0,
|
|
11309
|
-
|
|
11631
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
11632
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11633
|
+
import_components25.NavigationOption,
|
|
11310
11634
|
{
|
|
11311
|
-
media: /* @__PURE__ */ (0,
|
|
11635
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons.Plus, {}),
|
|
11312
11636
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11313
11637
|
showMediaAtAllSizes: true,
|
|
11314
11638
|
onClick: () => onAddItem()
|
|
11315
11639
|
}
|
|
11316
11640
|
),
|
|
11317
|
-
error && /* @__PURE__ */ (0,
|
|
11641
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components25.InlineAlert, { type: "negative", children: error })
|
|
11318
11642
|
]
|
|
11319
11643
|
}
|
|
11320
11644
|
),
|
|
11321
|
-
/* @__PURE__ */ (0,
|
|
11322
|
-
|
|
11645
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11646
|
+
import_components25.Modal,
|
|
11323
11647
|
{
|
|
11324
11648
|
open: openModalType !== null,
|
|
11325
11649
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11326
|
-
body: /* @__PURE__ */ (0,
|
|
11327
|
-
/* @__PURE__ */ (0,
|
|
11328
|
-
/* @__PURE__ */ (0,
|
|
11329
|
-
/* @__PURE__ */ (0,
|
|
11330
|
-
/* @__PURE__ */ (0,
|
|
11650
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11651
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
11652
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
11653
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components25.Button, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
11654
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components25.Button, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
|
|
11331
11655
|
] })
|
|
11332
11656
|
] }),
|
|
11333
11657
|
onClose: () => onCancelEdit()
|
|
@@ -11339,10 +11663,10 @@ function ItemSummaryOption({
|
|
|
11339
11663
|
item,
|
|
11340
11664
|
onClick
|
|
11341
11665
|
}) {
|
|
11342
|
-
return /* @__PURE__ */ (0,
|
|
11343
|
-
|
|
11666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11667
|
+
import_components25.NavigationOption,
|
|
11344
11668
|
{
|
|
11345
|
-
media: /* @__PURE__ */ (0,
|
|
11669
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(NavigationOptionMedia, __spreadValues({}, item)),
|
|
11346
11670
|
title: item.title,
|
|
11347
11671
|
content: item.description,
|
|
11348
11672
|
showMediaAtAllSizes: true,
|
|
@@ -11353,17 +11677,17 @@ function ItemSummaryOption({
|
|
|
11353
11677
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
11354
11678
|
|
|
11355
11679
|
// src/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
11356
|
-
var
|
|
11680
|
+
var import_components26 = require("@transferwise/components");
|
|
11357
11681
|
|
|
11358
11682
|
// src/revamp/wise/renderers/SearchRenderer/ErrorResult.tsx
|
|
11359
|
-
var
|
|
11360
|
-
var
|
|
11683
|
+
var import_react_intl15 = require("react-intl");
|
|
11684
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11361
11685
|
function ErrorResult({ state }) {
|
|
11362
|
-
const intl = (0,
|
|
11363
|
-
return /* @__PURE__ */ (0,
|
|
11686
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
11687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "m-t-2", children: [
|
|
11364
11688
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
11365
11689
|
"\xA0",
|
|
11366
|
-
/* @__PURE__ */ (0,
|
|
11690
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11367
11691
|
"a",
|
|
11368
11692
|
{
|
|
11369
11693
|
href: "/",
|
|
@@ -11378,8 +11702,8 @@ function ErrorResult({ state }) {
|
|
|
11378
11702
|
}
|
|
11379
11703
|
|
|
11380
11704
|
// src/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
11381
|
-
var
|
|
11382
|
-
var
|
|
11705
|
+
var import_react15 = require("react");
|
|
11706
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11383
11707
|
function BlockSearchRendererComponent({
|
|
11384
11708
|
id,
|
|
11385
11709
|
isLoading,
|
|
@@ -11389,11 +11713,11 @@ function BlockSearchRendererComponent({
|
|
|
11389
11713
|
state,
|
|
11390
11714
|
title
|
|
11391
11715
|
}) {
|
|
11392
|
-
const [hasSearched, setHasSearched] = (0,
|
|
11716
|
+
const [hasSearched, setHasSearched] = (0, import_react15.useState)(false);
|
|
11393
11717
|
const trackEvent = useTrackEvent();
|
|
11394
|
-
return /* @__PURE__ */ (0,
|
|
11395
|
-
/* @__PURE__ */ (0,
|
|
11396
|
-
|
|
11718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMargin(margin), children: [
|
|
11719
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FieldInput_default, { id, description: "", error: "", help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11720
|
+
import_components26.Input,
|
|
11397
11721
|
{
|
|
11398
11722
|
id,
|
|
11399
11723
|
name: id,
|
|
@@ -11409,7 +11733,7 @@ function BlockSearchRendererComponent({
|
|
|
11409
11733
|
}
|
|
11410
11734
|
}
|
|
11411
11735
|
) }),
|
|
11412
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
11736
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: "Loading..." }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SearchResultContent, { state, onChange })
|
|
11413
11737
|
] });
|
|
11414
11738
|
}
|
|
11415
11739
|
function SearchResultContent({
|
|
@@ -11418,29 +11742,29 @@ function SearchResultContent({
|
|
|
11418
11742
|
}) {
|
|
11419
11743
|
switch (state.type) {
|
|
11420
11744
|
case "error":
|
|
11421
|
-
return /* @__PURE__ */ (0,
|
|
11745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorResult, { state });
|
|
11422
11746
|
case "results":
|
|
11423
|
-
return /* @__PURE__ */ (0,
|
|
11747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SearchResults, { state, onChange });
|
|
11424
11748
|
case "noResults":
|
|
11425
|
-
return /* @__PURE__ */ (0,
|
|
11749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EmptySearchResult, { state });
|
|
11426
11750
|
case "pending":
|
|
11427
11751
|
default:
|
|
11428
11752
|
return null;
|
|
11429
11753
|
}
|
|
11430
11754
|
}
|
|
11431
11755
|
function EmptySearchResult({ state }) {
|
|
11432
|
-
return /* @__PURE__ */ (0,
|
|
11756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components26.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
11433
11757
|
}
|
|
11434
11758
|
function SearchResults({
|
|
11435
11759
|
state
|
|
11436
11760
|
}) {
|
|
11437
11761
|
const trackEvent = useTrackEvent();
|
|
11438
|
-
return /* @__PURE__ */ (0,
|
|
11439
|
-
|
|
11762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components26.NavigationOptionsList, { children: state.results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11763
|
+
import_components26.NavigationOption,
|
|
11440
11764
|
{
|
|
11441
11765
|
title: result.title,
|
|
11442
11766
|
content: result.description,
|
|
11443
|
-
media: /* @__PURE__ */ (0,
|
|
11767
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(NavigationOptionMedia, __spreadValues({}, result)),
|
|
11444
11768
|
showMediaCircle: false,
|
|
11445
11769
|
showMediaAtAllSizes: true,
|
|
11446
11770
|
onClick: () => {
|
|
@@ -11456,10 +11780,10 @@ function SearchResults({
|
|
|
11456
11780
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
11457
11781
|
|
|
11458
11782
|
// src/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
11459
|
-
var
|
|
11783
|
+
var import_components27 = require("@transferwise/components");
|
|
11460
11784
|
var import_icons2 = require("@transferwise/icons");
|
|
11461
|
-
var
|
|
11462
|
-
var
|
|
11785
|
+
var import_react16 = require("react");
|
|
11786
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11463
11787
|
function InlineSearchRenderer({
|
|
11464
11788
|
id,
|
|
11465
11789
|
isLoading,
|
|
@@ -11468,21 +11792,21 @@ function InlineSearchRenderer({
|
|
|
11468
11792
|
state,
|
|
11469
11793
|
title
|
|
11470
11794
|
}) {
|
|
11471
|
-
const [hasSearched, setHasSearched] = (0,
|
|
11795
|
+
const [hasSearched, setHasSearched] = (0, import_react16.useState)(false);
|
|
11472
11796
|
const trackEvent = useTrackEvent();
|
|
11473
|
-
return /* @__PURE__ */ (0,
|
|
11797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(FieldInput_default, { id, description: "", error: "", help: "", label: title, children: [
|
|
11474
11798
|
id,
|
|
11475
|
-
/* @__PURE__ */ (0,
|
|
11476
|
-
|
|
11799
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11800
|
+
import_components27.Typeahead,
|
|
11477
11801
|
{
|
|
11478
11802
|
id: "typeahead-input-id",
|
|
11479
11803
|
name: "typeahead-input-name",
|
|
11480
11804
|
size: "md",
|
|
11481
11805
|
maxHeight: 100,
|
|
11482
|
-
footer: /* @__PURE__ */ (0,
|
|
11806
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
11483
11807
|
multiple: false,
|
|
11484
11808
|
clearable: false,
|
|
11485
|
-
addon: /* @__PURE__ */ (0,
|
|
11809
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons2.Search, { size: 24 }),
|
|
11486
11810
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
11487
11811
|
minQueryLength: 1,
|
|
11488
11812
|
onChange: (values) => {
|
|
@@ -11519,47 +11843,29 @@ function mapResultToTypeaheadOption(result) {
|
|
|
11519
11843
|
}
|
|
11520
11844
|
function TypeaheadFooter({ state, isLoading }) {
|
|
11521
11845
|
if (state.type === "noResults") {
|
|
11522
|
-
return /* @__PURE__ */ (0,
|
|
11846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components27.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
11523
11847
|
}
|
|
11524
11848
|
if (state.type === "error") {
|
|
11525
|
-
return /* @__PURE__ */ (0,
|
|
11849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorResult, { state }) });
|
|
11526
11850
|
}
|
|
11527
11851
|
if (state.type === "pending" || isLoading) {
|
|
11528
|
-
return /* @__PURE__ */ (0,
|
|
11852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
11529
11853
|
}
|
|
11530
11854
|
return null;
|
|
11531
11855
|
}
|
|
11532
11856
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
11533
11857
|
|
|
11534
11858
|
// src/revamp/wise/renderers/SearchRenderer/SearchRenderer.tsx
|
|
11535
|
-
var
|
|
11859
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11536
11860
|
var SearchRenderer = {
|
|
11537
11861
|
canRenderType: "search",
|
|
11538
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0,
|
|
11862
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
11539
11863
|
};
|
|
11540
11864
|
var SearchRenderer_default = SearchRenderer;
|
|
11541
11865
|
|
|
11542
11866
|
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11543
|
-
var
|
|
11544
|
-
|
|
11545
|
-
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11546
|
-
var import_components26 = require("@transferwise/components");
|
|
11547
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11548
|
-
function OptionMedia({ icon, image }) {
|
|
11549
|
-
if (image == null ? void 0 : image.url) {
|
|
11550
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
11551
|
-
}
|
|
11552
|
-
if (icon && "name" in icon) {
|
|
11553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components26.Avatar, { type: import_components26.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicIcon_default, { name: icon.name }) });
|
|
11554
|
-
}
|
|
11555
|
-
if (icon && "text" in icon) {
|
|
11556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components26.Avatar, { type: import_components26.AvatarType.INITIALS, children: icon.text });
|
|
11557
|
-
}
|
|
11558
|
-
return null;
|
|
11559
|
-
}
|
|
11560
|
-
|
|
11561
|
-
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11562
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11867
|
+
var import_components28 = require("@transferwise/components");
|
|
11868
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11563
11869
|
function RadioInputRendererComponent(props) {
|
|
11564
11870
|
const {
|
|
11565
11871
|
id,
|
|
@@ -11573,9 +11879,9 @@ function RadioInputRendererComponent(props) {
|
|
|
11573
11879
|
selectedIndex,
|
|
11574
11880
|
onSelect
|
|
11575
11881
|
} = props;
|
|
11576
|
-
return /* @__PURE__ */ (0,
|
|
11577
|
-
/* @__PURE__ */ (0,
|
|
11578
|
-
|
|
11882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
11883
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11884
|
+
import_components28.RadioGroup,
|
|
11579
11885
|
{
|
|
11580
11886
|
name: id,
|
|
11581
11887
|
radios: options.map((option, index) => ({
|
|
@@ -11583,20 +11889,21 @@ function RadioInputRendererComponent(props) {
|
|
|
11583
11889
|
value: index,
|
|
11584
11890
|
secondary: option.description,
|
|
11585
11891
|
disabled: option.disabled || disabled,
|
|
11586
|
-
avatar: /* @__PURE__ */ (0,
|
|
11892
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(OptionMedia, { icon: option.icon, image: option.image })
|
|
11587
11893
|
})),
|
|
11588
11894
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
11589
11895
|
onChange: onSelect
|
|
11590
|
-
}
|
|
11896
|
+
},
|
|
11897
|
+
`${id}-${selectedIndex}`
|
|
11591
11898
|
) }) }),
|
|
11592
11899
|
children
|
|
11593
11900
|
] });
|
|
11594
11901
|
}
|
|
11595
11902
|
|
|
11596
11903
|
// src/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
11597
|
-
var
|
|
11598
|
-
var
|
|
11599
|
-
var
|
|
11904
|
+
var import_components29 = require("@transferwise/components");
|
|
11905
|
+
var import_react17 = require("react");
|
|
11906
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11600
11907
|
function TabInputRendererComponent(props) {
|
|
11601
11908
|
const {
|
|
11602
11909
|
id,
|
|
@@ -11610,14 +11917,14 @@ function TabInputRendererComponent(props) {
|
|
|
11610
11917
|
selectedIndex,
|
|
11611
11918
|
onSelect
|
|
11612
11919
|
} = props;
|
|
11613
|
-
(0,
|
|
11920
|
+
(0, import_react17.useEffect)(() => {
|
|
11614
11921
|
if (!isValidIndex(selectedIndex, options.length)) {
|
|
11615
11922
|
onSelect(0);
|
|
11616
11923
|
}
|
|
11617
11924
|
}, [selectedIndex, onSelect, options.length]);
|
|
11618
|
-
return /* @__PURE__ */ (0,
|
|
11619
|
-
/* @__PURE__ */ (0,
|
|
11620
|
-
|
|
11925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
11926
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11927
|
+
import_components29.Tabs,
|
|
11621
11928
|
{
|
|
11622
11929
|
name: id,
|
|
11623
11930
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -11625,7 +11932,7 @@ function TabInputRendererComponent(props) {
|
|
|
11625
11932
|
title: option.title,
|
|
11626
11933
|
// if we pass null, we get some props-types console errors
|
|
11627
11934
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
11628
|
-
content: /* @__PURE__ */ (0,
|
|
11935
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, {}),
|
|
11629
11936
|
disabled: option.disabled || disabled
|
|
11630
11937
|
})),
|
|
11631
11938
|
onTabSelect: onSelect
|
|
@@ -11637,26 +11944,26 @@ function TabInputRendererComponent(props) {
|
|
|
11637
11944
|
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
11638
11945
|
|
|
11639
11946
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11640
|
-
var
|
|
11947
|
+
var import_components31 = require("@transferwise/components");
|
|
11641
11948
|
|
|
11642
11949
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.tsx
|
|
11643
|
-
var
|
|
11644
|
-
var
|
|
11950
|
+
var import_components30 = require("@transferwise/components");
|
|
11951
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11645
11952
|
function SelectTriggerMedia({ icon, image }) {
|
|
11646
11953
|
if (image == null ? void 0 : image.url) {
|
|
11647
11954
|
return null;
|
|
11648
11955
|
}
|
|
11649
11956
|
if (icon && "name" in icon) {
|
|
11650
|
-
return /* @__PURE__ */ (0,
|
|
11957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components30.Avatar, { type: import_components30.AvatarType.ICON, size: 24, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { name: icon.name }) });
|
|
11651
11958
|
}
|
|
11652
11959
|
if (icon && "text" in icon) {
|
|
11653
|
-
return /* @__PURE__ */ (0,
|
|
11960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components30.Avatar, { type: import_components30.AvatarType.ICON, size: 24, children: icon.text });
|
|
11654
11961
|
}
|
|
11655
11962
|
return null;
|
|
11656
11963
|
}
|
|
11657
11964
|
|
|
11658
11965
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11659
|
-
var
|
|
11966
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11660
11967
|
function SelectInputRendererComponent(props) {
|
|
11661
11968
|
const {
|
|
11662
11969
|
id,
|
|
@@ -11691,17 +11998,17 @@ function SelectInputRendererComponent(props) {
|
|
|
11691
11998
|
const contentProps = withinTrigger ? {
|
|
11692
11999
|
title: option.title,
|
|
11693
12000
|
note: option.description,
|
|
11694
|
-
icon: /* @__PURE__ */ (0,
|
|
12001
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectTriggerMedia, { icon: option.icon, image: option.image })
|
|
11695
12002
|
} : {
|
|
11696
12003
|
title: option.title,
|
|
11697
12004
|
description: option.description,
|
|
11698
|
-
icon: /* @__PURE__ */ (0,
|
|
12005
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OptionMedia, { icon: option.icon, image: option.image })
|
|
11699
12006
|
};
|
|
11700
|
-
return /* @__PURE__ */ (0,
|
|
12007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components31.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
11701
12008
|
};
|
|
11702
|
-
return /* @__PURE__ */ (0,
|
|
11703
|
-
/* @__PURE__ */ (0,
|
|
11704
|
-
|
|
12009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
12010
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
12011
|
+
import_components31.SelectInput,
|
|
11705
12012
|
{
|
|
11706
12013
|
name: id,
|
|
11707
12014
|
placeholder,
|
|
@@ -11719,19 +12026,19 @@ function SelectInputRendererComponent(props) {
|
|
|
11719
12026
|
}
|
|
11720
12027
|
|
|
11721
12028
|
// src/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
11722
|
-
var
|
|
11723
|
-
var
|
|
11724
|
-
var
|
|
12029
|
+
var import_react18 = require("react");
|
|
12030
|
+
var import_components32 = require("@transferwise/components");
|
|
12031
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11725
12032
|
function SegmentedInputRendererComponent(props) {
|
|
11726
12033
|
const { id, children, description, error, help, label, options, selectedIndex, onSelect } = props;
|
|
11727
|
-
(0,
|
|
12034
|
+
(0, import_react18.useEffect)(() => {
|
|
11728
12035
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
11729
12036
|
onSelect(0);
|
|
11730
12037
|
}
|
|
11731
12038
|
}, [selectedIndex, onSelect, options.length]);
|
|
11732
|
-
return /* @__PURE__ */ (0,
|
|
11733
|
-
/* @__PURE__ */ (0,
|
|
11734
|
-
|
|
12039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
12040
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12041
|
+
import_components32.SegmentedControl,
|
|
11735
12042
|
{
|
|
11736
12043
|
name: `${id}-segmented-control`,
|
|
11737
12044
|
value: String(selectedIndex),
|
|
@@ -11745,44 +12052,44 @@ function SegmentedInputRendererComponent(props) {
|
|
|
11745
12052
|
onChange: (value) => onSelect(Number(value))
|
|
11746
12053
|
}
|
|
11747
12054
|
) }),
|
|
11748
|
-
/* @__PURE__ */ (0,
|
|
12055
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: `${id}-children`, children })
|
|
11749
12056
|
] });
|
|
11750
12057
|
}
|
|
11751
12058
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
11752
12059
|
|
|
11753
12060
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
11754
|
-
var
|
|
12061
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11755
12062
|
var SelectInputRenderer = {
|
|
11756
12063
|
canRenderType: "input-select",
|
|
11757
12064
|
render: (props) => {
|
|
11758
12065
|
switch (props.control) {
|
|
11759
12066
|
case "radio":
|
|
11760
|
-
return /* @__PURE__ */ (0,
|
|
12067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
11761
12068
|
case "tab":
|
|
11762
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
12069
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
11763
12070
|
case "segmented":
|
|
11764
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
12071
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
11765
12072
|
case "select":
|
|
11766
12073
|
default:
|
|
11767
|
-
return /* @__PURE__ */ (0,
|
|
12074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
11768
12075
|
}
|
|
11769
12076
|
}
|
|
11770
12077
|
};
|
|
11771
12078
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
11772
12079
|
|
|
11773
12080
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
11774
|
-
var
|
|
11775
|
-
var
|
|
12081
|
+
var import_components33 = require("@transferwise/components");
|
|
12082
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11776
12083
|
var StatusListRenderer = {
|
|
11777
12084
|
canRenderType: "status-list",
|
|
11778
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
11779
|
-
title ? /* @__PURE__ */ (0,
|
|
11780
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0,
|
|
11781
|
-
|
|
12085
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getMargin(margin), children: [
|
|
12086
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.Header, { title }) : null,
|
|
12087
|
+
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12088
|
+
import_components33.Summary,
|
|
11782
12089
|
{
|
|
11783
12090
|
title: itemTitle,
|
|
11784
12091
|
description,
|
|
11785
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
12092
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
11786
12093
|
status: mapStatus(status)
|
|
11787
12094
|
},
|
|
11788
12095
|
`${title}/${description || ""}`
|
|
@@ -11798,63 +12105,63 @@ var mapStatus = (status) => {
|
|
|
11798
12105
|
};
|
|
11799
12106
|
|
|
11800
12107
|
// src/revamp/wise/renderers/components/VariableTextInput.tsx
|
|
11801
|
-
var
|
|
11802
|
-
var
|
|
12108
|
+
var import_components34 = require("@transferwise/components");
|
|
12109
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
11803
12110
|
function VariableTextInput({
|
|
11804
12111
|
control,
|
|
11805
12112
|
inputProps
|
|
11806
12113
|
}) {
|
|
11807
12114
|
switch (control) {
|
|
11808
12115
|
case "password":
|
|
11809
|
-
return /* @__PURE__ */ (0,
|
|
12116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
11810
12117
|
case "email":
|
|
11811
|
-
return /* @__PURE__ */ (0,
|
|
12118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
11812
12119
|
case "textarea":
|
|
11813
|
-
return /* @__PURE__ */ (0,
|
|
12120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextAreaInput, __spreadValues({}, inputProps));
|
|
11814
12121
|
case "numeric":
|
|
11815
|
-
return /* @__PURE__ */ (0,
|
|
12122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
11816
12123
|
case "phone-number":
|
|
11817
|
-
return /* @__PURE__ */ (0,
|
|
12124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PhoneNumberInput, __spreadValues({}, inputProps));
|
|
11818
12125
|
default:
|
|
11819
|
-
return /* @__PURE__ */ (0,
|
|
12126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
11820
12127
|
}
|
|
11821
12128
|
}
|
|
11822
12129
|
function TextInput(_a) {
|
|
11823
12130
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11824
12131
|
if (typeof displayFormat === "string") {
|
|
11825
12132
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
11826
|
-
return /* @__PURE__ */ (0,
|
|
11827
|
-
|
|
12133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12134
|
+
import_components34.InputWithDisplayFormat,
|
|
11828
12135
|
__spreadValues({
|
|
11829
12136
|
displayPattern: displayFormat,
|
|
11830
12137
|
onChange: (newValue) => onChange(newValue)
|
|
11831
12138
|
}, inputProps)
|
|
11832
12139
|
);
|
|
11833
12140
|
}
|
|
11834
|
-
return /* @__PURE__ */ (0,
|
|
12141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.Input, __spreadValues({ id, name: id, onChange: (e) => onChange(e.target.value) }, rest));
|
|
11835
12142
|
}
|
|
11836
12143
|
function TextAreaInput(_a) {
|
|
11837
12144
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11838
12145
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
11839
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11840
|
-
|
|
12146
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12147
|
+
import_components34.TextareaWithDisplayFormat,
|
|
11841
12148
|
__spreadValues({
|
|
11842
12149
|
displayPattern: displayFormat,
|
|
11843
12150
|
onChange: (newValue) => onChange(newValue)
|
|
11844
12151
|
}, textAreaProps)
|
|
11845
|
-
) : /* @__PURE__ */ (0,
|
|
12152
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.TextArea, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
11846
12153
|
}
|
|
11847
12154
|
function NumericInput(_a) {
|
|
11848
12155
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11849
12156
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
11850
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11851
|
-
|
|
12157
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12158
|
+
import_components34.InputWithDisplayFormat,
|
|
11852
12159
|
__spreadValues({
|
|
11853
12160
|
displayPattern: displayFormat,
|
|
11854
12161
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
11855
12162
|
}, numericProps)
|
|
11856
|
-
) : /* @__PURE__ */ (0,
|
|
11857
|
-
|
|
12163
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12164
|
+
import_components34.Input,
|
|
11858
12165
|
__spreadValues({
|
|
11859
12166
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
11860
12167
|
}, numericProps)
|
|
@@ -11862,12 +12169,12 @@ function NumericInput(_a) {
|
|
|
11862
12169
|
}
|
|
11863
12170
|
function PhoneNumberInput(_a) {
|
|
11864
12171
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
11865
|
-
return /* @__PURE__ */ (0,
|
|
12172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.PhoneNumberInput, __spreadValues({ initialValue: value }, rest));
|
|
11866
12173
|
}
|
|
11867
12174
|
var VariableTextInput_default = VariableTextInput;
|
|
11868
12175
|
|
|
11869
12176
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
11870
|
-
var
|
|
12177
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
11871
12178
|
var TextInputRenderer = {
|
|
11872
12179
|
canRenderType: "input-text",
|
|
11873
12180
|
render: (props) => {
|
|
@@ -11892,14 +12199,14 @@ var TextInputRenderer = {
|
|
|
11892
12199
|
]);
|
|
11893
12200
|
const value = initialValue != null ? initialValue : "";
|
|
11894
12201
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
11895
|
-
return /* @__PURE__ */ (0,
|
|
12202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(VariableTextInput_default, { control, inputProps }) });
|
|
11896
12203
|
}
|
|
11897
12204
|
};
|
|
11898
12205
|
var TextInputRenderer_default = TextInputRenderer;
|
|
11899
12206
|
|
|
11900
12207
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
11901
|
-
var
|
|
11902
|
-
var
|
|
12208
|
+
var import_components35 = require("@transferwise/components");
|
|
12209
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
11903
12210
|
var UploadInputRenderer = {
|
|
11904
12211
|
canRenderType: "input-upload",
|
|
11905
12212
|
render: (props) => {
|
|
@@ -11915,8 +12222,8 @@ var UploadInputRenderer = {
|
|
|
11915
12222
|
};
|
|
11916
12223
|
return (
|
|
11917
12224
|
// We don't pass help here as there is no sensible place to display it
|
|
11918
|
-
/* @__PURE__ */ (0,
|
|
11919
|
-
|
|
12225
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(UploadFieldInput_default, { id, label: void 0, description: void 0, error, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
12226
|
+
import_components35.UploadInput,
|
|
11920
12227
|
{
|
|
11921
12228
|
id,
|
|
11922
12229
|
description,
|
|
@@ -11970,8 +12277,8 @@ var LargeUploadRenderer = {
|
|
|
11970
12277
|
throw e;
|
|
11971
12278
|
}
|
|
11972
12279
|
};
|
|
11973
|
-
return /* @__PURE__ */ (0,
|
|
11974
|
-
|
|
12280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
12281
|
+
import_components35.Upload,
|
|
11975
12282
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
11976
12283
|
usAccept: getAcceptsString(accepts),
|
|
11977
12284
|
usDisabled: disabled,
|
|
@@ -11984,8 +12291,8 @@ var LargeUploadRenderer = {
|
|
|
11984
12291
|
};
|
|
11985
12292
|
|
|
11986
12293
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
11987
|
-
var
|
|
11988
|
-
var
|
|
12294
|
+
var import_components36 = require("@transferwise/components");
|
|
12295
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
11989
12296
|
var ReviewRenderer = {
|
|
11990
12297
|
canRenderType: "review",
|
|
11991
12298
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -11997,10 +12304,10 @@ var ReviewRenderer = {
|
|
|
11997
12304
|
callToAction.onClick();
|
|
11998
12305
|
}
|
|
11999
12306
|
} : void 0;
|
|
12000
|
-
return /* @__PURE__ */ (0,
|
|
12001
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
12002
|
-
/* @__PURE__ */ (0,
|
|
12003
|
-
|
|
12307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(margin), children: [
|
|
12308
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components36.Header, { title: title != null ? title : "", action }),
|
|
12309
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
12310
|
+
import_components36.DefinitionList,
|
|
12004
12311
|
{
|
|
12005
12312
|
layout: orientation,
|
|
12006
12313
|
definitions: fields.map(({ label, value, help }, index) => ({
|
|
@@ -12016,28 +12323,28 @@ var ReviewRenderer = {
|
|
|
12016
12323
|
var ReviewRenderer_default = ReviewRenderer;
|
|
12017
12324
|
var getFieldValue = (value, help, orientation) => {
|
|
12018
12325
|
if (help) {
|
|
12019
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
12020
|
-
/* @__PURE__ */ (0,
|
|
12326
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
12327
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help }),
|
|
12021
12328
|
" ",
|
|
12022
12329
|
value
|
|
12023
|
-
] }) : /* @__PURE__ */ (0,
|
|
12330
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
12024
12331
|
value,
|
|
12025
12332
|
" ",
|
|
12026
|
-
/* @__PURE__ */ (0,
|
|
12333
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help })
|
|
12027
12334
|
] });
|
|
12028
12335
|
}
|
|
12029
12336
|
return value;
|
|
12030
12337
|
};
|
|
12031
12338
|
|
|
12032
12339
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12033
|
-
var
|
|
12340
|
+
var import_react20 = require("react");
|
|
12034
12341
|
|
|
12035
12342
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12036
|
-
var
|
|
12343
|
+
var import_react_intl17 = require("react-intl");
|
|
12037
12344
|
|
|
12038
12345
|
// src/common/messages/external-confirmation.messages.ts
|
|
12039
|
-
var
|
|
12040
|
-
var external_confirmation_messages_default = (0,
|
|
12346
|
+
var import_react_intl16 = require("react-intl");
|
|
12347
|
+
var external_confirmation_messages_default = (0, import_react_intl16.defineMessages)({
|
|
12041
12348
|
title: {
|
|
12042
12349
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
12043
12350
|
defaultMessage: "Please confirm",
|
|
@@ -12061,19 +12368,19 @@ var external_confirmation_messages_default = (0, import_react_intl14.defineMessa
|
|
|
12061
12368
|
});
|
|
12062
12369
|
|
|
12063
12370
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12064
|
-
var
|
|
12065
|
-
var
|
|
12371
|
+
var import_components37 = require("@transferwise/components");
|
|
12372
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
12066
12373
|
function ExternalConfirmationDialog({
|
|
12067
12374
|
external,
|
|
12068
12375
|
onClose
|
|
12069
12376
|
}) {
|
|
12070
|
-
const { formatMessage } = (0,
|
|
12071
|
-
return /* @__PURE__ */ (0,
|
|
12072
|
-
/* @__PURE__ */ (0,
|
|
12073
|
-
/* @__PURE__ */ (0,
|
|
12074
|
-
/* @__PURE__ */ (0,
|
|
12075
|
-
/* @__PURE__ */ (0,
|
|
12076
|
-
|
|
12377
|
+
const { formatMessage } = (0, import_react_intl17.useIntl)();
|
|
12378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12379
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("h2", { className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.title) }),
|
|
12380
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components37.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(external.url) }) }),
|
|
12381
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12382
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
12383
|
+
import_components37.Button,
|
|
12077
12384
|
{
|
|
12078
12385
|
block: true,
|
|
12079
12386
|
className: "m-b-2",
|
|
@@ -12086,7 +12393,7 @@ function ExternalConfirmationDialog({
|
|
|
12086
12393
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
12087
12394
|
}
|
|
12088
12395
|
),
|
|
12089
|
-
/* @__PURE__ */ (0,
|
|
12396
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components37.Button, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onClose, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
12090
12397
|
] }) })
|
|
12091
12398
|
] }) });
|
|
12092
12399
|
}
|
|
@@ -12099,12 +12406,12 @@ function getOrigin(url) {
|
|
|
12099
12406
|
}
|
|
12100
12407
|
|
|
12101
12408
|
// src/revamp/wise/renderers/step/useExternal.tsx
|
|
12102
|
-
var
|
|
12409
|
+
var import_react19 = require("react");
|
|
12103
12410
|
function useExternal(url) {
|
|
12104
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
12105
|
-
const [hasDismissed, setHasDismissed] = (0,
|
|
12411
|
+
const [externalWindow, setExternalWindow] = (0, import_react19.useState)(null);
|
|
12412
|
+
const [hasDismissed, setHasDismissed] = (0, import_react19.useState)(false);
|
|
12106
12413
|
const dismissConfirmation = () => setHasDismissed(true);
|
|
12107
|
-
(0,
|
|
12414
|
+
(0, import_react19.useEffect)(() => {
|
|
12108
12415
|
if (url) {
|
|
12109
12416
|
setHasDismissed(false);
|
|
12110
12417
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -12115,11 +12422,11 @@ function useExternal(url) {
|
|
|
12115
12422
|
}
|
|
12116
12423
|
|
|
12117
12424
|
// src/revamp/wise/renderers/step/BackButton.tsx
|
|
12118
|
-
var
|
|
12425
|
+
var import_components38 = require("@transferwise/components");
|
|
12119
12426
|
var import_icons3 = require("@transferwise/icons");
|
|
12120
|
-
var
|
|
12427
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
12121
12428
|
function BackButton({ title, onClick }) {
|
|
12122
|
-
return /* @__PURE__ */ (0,
|
|
12429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
12123
12430
|
"a",
|
|
12124
12431
|
{
|
|
12125
12432
|
href: "/",
|
|
@@ -12130,8 +12437,8 @@ function BackButton({ title, onClick }) {
|
|
|
12130
12437
|
onClick();
|
|
12131
12438
|
},
|
|
12132
12439
|
children: [
|
|
12133
|
-
/* @__PURE__ */ (0,
|
|
12134
|
-
/* @__PURE__ */ (0,
|
|
12440
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "sr-only", children: title }),
|
|
12441
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components38.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
12135
12442
|
]
|
|
12136
12443
|
}
|
|
12137
12444
|
);
|
|
@@ -12139,20 +12446,20 @@ function BackButton({ title, onClick }) {
|
|
|
12139
12446
|
var BackButton_default = BackButton;
|
|
12140
12447
|
|
|
12141
12448
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12142
|
-
var
|
|
12449
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
12143
12450
|
var StepRenderer = {
|
|
12144
12451
|
canRenderType: "step",
|
|
12145
12452
|
render: StepRendererComponent
|
|
12146
12453
|
};
|
|
12147
12454
|
function StepRendererComponent(props) {
|
|
12148
12455
|
const { back, loadingState, external, trackEvent, children } = props;
|
|
12149
|
-
const value = (0,
|
|
12456
|
+
const value = (0, import_react20.useMemo)(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12150
12457
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12151
12458
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
12152
|
-
return /* @__PURE__ */ (0,
|
|
12459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ExternalConfirmationDialog, { external, onClose: dismissConfirmation });
|
|
12153
12460
|
}
|
|
12154
|
-
return /* @__PURE__ */ (0,
|
|
12155
|
-
back ? /* @__PURE__ */ (0,
|
|
12461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(StepRendererContextProvider, { value, children: [
|
|
12462
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
12156
12463
|
children
|
|
12157
12464
|
] });
|
|
12158
12465
|
}
|
|
@@ -12177,6 +12484,7 @@ var getWiseRenderers = () => [
|
|
|
12177
12484
|
LoadingIndicatorRenderer_default,
|
|
12178
12485
|
MarkdownRenderer_default,
|
|
12179
12486
|
ModalRenderer_default,
|
|
12487
|
+
MultiSelectInputRenderer_default,
|
|
12180
12488
|
MultiUploadInputRenderer_default,
|
|
12181
12489
|
NumberInputRenderer_default,
|
|
12182
12490
|
ParagraphRenderer_default,
|
|
@@ -12191,24 +12499,24 @@ var getWiseRenderers = () => [
|
|
|
12191
12499
|
];
|
|
12192
12500
|
|
|
12193
12501
|
// src/revamp/DynamicFlowWise.tsx
|
|
12194
|
-
var
|
|
12502
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12195
12503
|
var wiseRenderers = getWiseRenderers();
|
|
12196
12504
|
function DynamicFlowWise(props) {
|
|
12197
12505
|
const { httpClient, renderers } = props;
|
|
12198
|
-
const mergedRenderers = (0,
|
|
12199
|
-
return /* @__PURE__ */ (0,
|
|
12506
|
+
const mergedRenderers = (0, import_react21.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
12507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
|
|
12200
12508
|
}
|
|
12201
12509
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
12202
12510
|
|
|
12203
12511
|
// src/revamp/DynamicFragmentWise.tsx
|
|
12204
|
-
var
|
|
12205
|
-
var
|
|
12512
|
+
var import_react22 = require("react");
|
|
12513
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12206
12514
|
var wiseRenderers2 = getWiseRenderers();
|
|
12207
|
-
var DynamicFragmentWise = (0,
|
|
12515
|
+
var DynamicFragmentWise = (0, import_react22.forwardRef)(function DynamicFragmentWise2(props, ref) {
|
|
12208
12516
|
const { httpClient, onEvent, onError, renderers } = props;
|
|
12209
|
-
const mergedRenderers = (0,
|
|
12517
|
+
const mergedRenderers = (0, import_react22.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
|
|
12210
12518
|
const { stepComponentRef } = useDynamicFlowCore(props);
|
|
12211
|
-
(0,
|
|
12519
|
+
(0, import_react22.useImperativeHandle)(
|
|
12212
12520
|
ref,
|
|
12213
12521
|
() => ({
|
|
12214
12522
|
getValue: async () => {
|
|
@@ -12223,18 +12531,18 @@ var DynamicFragmentWise = (0, import_react21.forwardRef)(function DynamicFragmen
|
|
|
12223
12531
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12224
12532
|
[]
|
|
12225
12533
|
);
|
|
12226
|
-
const render = (0,
|
|
12534
|
+
const render = (0, import_react22.useMemo)(
|
|
12227
12535
|
() => getRenderFunction([CoreContainerRenderer, ...mergedRenderers, StepRenderer]),
|
|
12228
12536
|
[mergedRenderers]
|
|
12229
12537
|
);
|
|
12230
|
-
return /* @__PURE__ */ (0,
|
|
12538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12231
12539
|
ErrorBoundary_default,
|
|
12232
12540
|
{
|
|
12233
12541
|
onError: (error) => {
|
|
12234
12542
|
onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed");
|
|
12235
12543
|
onError(error);
|
|
12236
12544
|
},
|
|
12237
|
-
children: /* @__PURE__ */ (0,
|
|
12545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(HttpClientProvider, { httpClient, children: stepComponentRef.current ? render(stepComponentRef.current) : null })
|
|
12238
12546
|
}
|
|
12239
12547
|
);
|
|
12240
12548
|
});
|
|
@@ -12545,16 +12853,16 @@ function isReference(block) {
|
|
|
12545
12853
|
}
|
|
12546
12854
|
|
|
12547
12855
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12548
|
-
var
|
|
12856
|
+
var import_react66 = require("react");
|
|
12549
12857
|
|
|
12550
12858
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12551
|
-
var
|
|
12859
|
+
var import_react24 = require("react");
|
|
12552
12860
|
|
|
12553
12861
|
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
12554
|
-
var
|
|
12862
|
+
var import_react23 = require("react");
|
|
12555
12863
|
function usePendingPromiseCounter() {
|
|
12556
|
-
const [count, setCount] = (0,
|
|
12557
|
-
const addPendingPromise = (0,
|
|
12864
|
+
const [count, setCount] = (0, import_react23.useState)(0);
|
|
12865
|
+
const addPendingPromise = (0, import_react23.useCallback)(
|
|
12558
12866
|
(promise) => {
|
|
12559
12867
|
setCount((c) => c + 1);
|
|
12560
12868
|
promise.catch(noop2).finally(() => delayUntilNextCycle(() => setCount((c) => Math.max(0, c - 1))));
|
|
@@ -12568,44 +12876,44 @@ var noop2 = () => {
|
|
|
12568
12876
|
};
|
|
12569
12877
|
|
|
12570
12878
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12571
|
-
var
|
|
12879
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12572
12880
|
var defaultContextValue = {
|
|
12573
12881
|
loading: false,
|
|
12574
12882
|
registerPersistAsyncPromise: (promise) => {
|
|
12575
12883
|
}
|
|
12576
12884
|
};
|
|
12577
|
-
var DFContext = (0,
|
|
12885
|
+
var DFContext = (0, import_react24.createContext)(defaultContextValue);
|
|
12578
12886
|
var DynamicFlowProvider = ({ loading, children }) => {
|
|
12579
12887
|
const { pendingPromises, addPendingPromise } = usePendingPromiseCounter();
|
|
12580
|
-
const providerValue = (0,
|
|
12888
|
+
const providerValue = (0, import_react24.useMemo)(() => {
|
|
12581
12889
|
return {
|
|
12582
12890
|
loading: loading || pendingPromises > 0,
|
|
12583
12891
|
registerPersistAsyncPromise: addPendingPromise
|
|
12584
12892
|
};
|
|
12585
12893
|
}, [loading, pendingPromises, addPendingPromise]);
|
|
12586
|
-
return /* @__PURE__ */ (0,
|
|
12894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DFContext.Provider, { value: providerValue, children });
|
|
12587
12895
|
};
|
|
12588
12896
|
var useDynamicFlow = () => {
|
|
12589
|
-
const context = (0,
|
|
12897
|
+
const context = (0, import_react24.useContext)(DFContext);
|
|
12590
12898
|
return context || defaultContextValue;
|
|
12591
12899
|
};
|
|
12592
12900
|
|
|
12593
12901
|
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
12594
|
-
var
|
|
12595
|
-
var
|
|
12596
|
-
var EventsContext = (0,
|
|
12902
|
+
var import_react25 = require("react");
|
|
12903
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
12904
|
+
var EventsContext = (0, import_react25.createContext)({
|
|
12597
12905
|
triggerEvent: () => {
|
|
12598
12906
|
}
|
|
12599
12907
|
});
|
|
12600
12908
|
function EventsContextProvider({ metadata, children, onEvent }) {
|
|
12601
|
-
const value = (0,
|
|
12909
|
+
const value = (0, import_react25.useMemo)(
|
|
12602
12910
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
12603
12911
|
[onEvent, metadata]
|
|
12604
12912
|
);
|
|
12605
|
-
return /* @__PURE__ */ (0,
|
|
12913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(EventsContext.Provider, { value, children });
|
|
12606
12914
|
}
|
|
12607
12915
|
function useEventDispatcher() {
|
|
12608
|
-
const { triggerEvent } = (0,
|
|
12916
|
+
const { triggerEvent } = (0, import_react25.useContext)(EventsContext);
|
|
12609
12917
|
return triggerEvent;
|
|
12610
12918
|
}
|
|
12611
12919
|
var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) => {
|
|
@@ -12616,8 +12924,8 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
12616
12924
|
};
|
|
12617
12925
|
|
|
12618
12926
|
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
12619
|
-
var
|
|
12620
|
-
var
|
|
12927
|
+
var import_react26 = require("react");
|
|
12928
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12621
12929
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
12622
12930
|
try {
|
|
12623
12931
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -12627,9 +12935,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
12627
12935
|
} catch (e) {
|
|
12628
12936
|
}
|
|
12629
12937
|
};
|
|
12630
|
-
var LogContext = (0,
|
|
12938
|
+
var LogContext = (0, import_react26.createContext)(null);
|
|
12631
12939
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
12632
|
-
const value = (0,
|
|
12940
|
+
const value = (0, import_react26.useMemo)(
|
|
12633
12941
|
() => ({
|
|
12634
12942
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
12635
12943
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -12639,10 +12947,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
12639
12947
|
}),
|
|
12640
12948
|
[onLog, flowId, stepId]
|
|
12641
12949
|
);
|
|
12642
|
-
return /* @__PURE__ */ (0,
|
|
12950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(LogContext.Provider, { value, children });
|
|
12643
12951
|
}
|
|
12644
12952
|
var useLogger = () => {
|
|
12645
|
-
const logging = (0,
|
|
12953
|
+
const logging = (0, import_react26.useContext)(LogContext);
|
|
12646
12954
|
if (logging == null) {
|
|
12647
12955
|
throw new Error(
|
|
12648
12956
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -12652,11 +12960,11 @@ var useLogger = () => {
|
|
|
12652
12960
|
};
|
|
12653
12961
|
|
|
12654
12962
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12655
|
-
var
|
|
12656
|
-
var
|
|
12657
|
-
var FeatureContext = (0,
|
|
12963
|
+
var import_react27 = require("react");
|
|
12964
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
12965
|
+
var FeatureContext = (0, import_react27.createContext)([]);
|
|
12658
12966
|
function FeatureContextProvider({ features, children }) {
|
|
12659
|
-
return /* @__PURE__ */ (0,
|
|
12967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FeatureContext.Provider, { value: features, children });
|
|
12660
12968
|
}
|
|
12661
12969
|
|
|
12662
12970
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -13386,18 +13694,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
13386
13694
|
};
|
|
13387
13695
|
|
|
13388
13696
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
13389
|
-
var
|
|
13697
|
+
var import_react28 = require("react");
|
|
13390
13698
|
function useDebouncedFunction(callback, waitMs) {
|
|
13391
|
-
return (0,
|
|
13699
|
+
return (0, import_react28.useCallback)(debounce2(callback, waitMs), [callback, waitMs]);
|
|
13392
13700
|
}
|
|
13393
13701
|
|
|
13394
13702
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
13395
|
-
var
|
|
13703
|
+
var import_react29 = require("react");
|
|
13396
13704
|
function useExternal2(url) {
|
|
13397
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
13398
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
13705
|
+
const [externalWindow, setExternalWindow] = (0, import_react29.useState)(null);
|
|
13706
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react29.useState)(false);
|
|
13399
13707
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
13400
|
-
(0,
|
|
13708
|
+
(0, import_react29.useEffect)(() => {
|
|
13401
13709
|
if (url) {
|
|
13402
13710
|
setHasManuallyTriggered(false);
|
|
13403
13711
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -13408,10 +13716,10 @@ function useExternal2(url) {
|
|
|
13408
13716
|
}
|
|
13409
13717
|
|
|
13410
13718
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
13411
|
-
var
|
|
13719
|
+
var import_react30 = require("react");
|
|
13412
13720
|
function useExternalStepPolling(polling, onAction) {
|
|
13413
13721
|
const httpClient = useHttpClient();
|
|
13414
|
-
const asyncFn = (0,
|
|
13722
|
+
const asyncFn = (0, import_react30.useMemo)(() => {
|
|
13415
13723
|
if (polling) {
|
|
13416
13724
|
return () => httpClient(polling.url).then((response) => {
|
|
13417
13725
|
if (response.ok) {
|
|
@@ -13429,7 +13737,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13429
13737
|
}
|
|
13430
13738
|
return void 0;
|
|
13431
13739
|
}, [polling, httpClient]);
|
|
13432
|
-
const onPollingResponse = (0,
|
|
13740
|
+
const onPollingResponse = (0, import_react30.useCallback)(
|
|
13433
13741
|
(pollingResponse) => {
|
|
13434
13742
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
13435
13743
|
const responseHandler = responseHandlers.find(
|
|
@@ -13456,7 +13764,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13456
13764
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
13457
13765
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
13458
13766
|
onPollingResponse,
|
|
13459
|
-
onFailure: (0,
|
|
13767
|
+
onFailure: (0, import_react30.useCallback)(() => {
|
|
13460
13768
|
if (polling) {
|
|
13461
13769
|
onAction(polling.onError.action);
|
|
13462
13770
|
}
|
|
@@ -13465,12 +13773,12 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13465
13773
|
}
|
|
13466
13774
|
|
|
13467
13775
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
13468
|
-
var
|
|
13469
|
-
var
|
|
13776
|
+
var import_react54 = require("react");
|
|
13777
|
+
var import_react_intl32 = require("react-intl");
|
|
13470
13778
|
|
|
13471
13779
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
13472
|
-
var
|
|
13473
|
-
var
|
|
13780
|
+
var import_react53 = require("react");
|
|
13781
|
+
var import_react_intl31 = require("react-intl");
|
|
13474
13782
|
|
|
13475
13783
|
// src/legacy/common/constants/DateMode.ts
|
|
13476
13784
|
var DateMode = {
|
|
@@ -13518,28 +13826,28 @@ var Size = {
|
|
|
13518
13826
|
|
|
13519
13827
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13520
13828
|
var import_classnames16 = __toESM(require_classnames());
|
|
13521
|
-
var
|
|
13829
|
+
var import_react52 = require("react");
|
|
13522
13830
|
|
|
13523
13831
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13524
|
-
var
|
|
13832
|
+
var import_components40 = require("@transferwise/components");
|
|
13525
13833
|
|
|
13526
13834
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13527
|
-
var
|
|
13835
|
+
var import_components39 = require("@transferwise/components");
|
|
13528
13836
|
|
|
13529
13837
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13530
|
-
var
|
|
13838
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
13531
13839
|
var isFlagIcon2 = (name) => name.startsWith("flag-");
|
|
13532
13840
|
function FlagIcon2({ name }) {
|
|
13533
13841
|
if (!isFlagIcon2(name)) {
|
|
13534
13842
|
return null;
|
|
13535
13843
|
}
|
|
13536
13844
|
const code = name.substring(5);
|
|
13537
|
-
return /* @__PURE__ */ (0,
|
|
13845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Flag, { intrinsicSize: 24, code });
|
|
13538
13846
|
}
|
|
13539
13847
|
|
|
13540
13848
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13541
13849
|
var icons2 = __toESM(require("@transferwise/icons"));
|
|
13542
|
-
var
|
|
13850
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
13543
13851
|
var isNamedIcon2 = (name) => {
|
|
13544
13852
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13545
13853
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -13550,19 +13858,19 @@ function NamedIcon2({ name }) {
|
|
|
13550
13858
|
}
|
|
13551
13859
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13552
13860
|
const Icon = icons2[iconName];
|
|
13553
|
-
return /* @__PURE__ */ (0,
|
|
13861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { size: 24 });
|
|
13554
13862
|
}
|
|
13555
13863
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
13556
13864
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13557
13865
|
|
|
13558
13866
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13559
|
-
var
|
|
13867
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
13560
13868
|
function DynamicIcon2({ type }) {
|
|
13561
13869
|
if (isFlagIcon2(type)) {
|
|
13562
|
-
return /* @__PURE__ */ (0,
|
|
13870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlagIcon2, { name: type });
|
|
13563
13871
|
}
|
|
13564
13872
|
if (isNamedIcon2(type)) {
|
|
13565
|
-
return /* @__PURE__ */ (0,
|
|
13873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(NamedIcon2, { name: type });
|
|
13566
13874
|
}
|
|
13567
13875
|
return null;
|
|
13568
13876
|
}
|
|
@@ -13572,17 +13880,17 @@ function isValidIconName(name) {
|
|
|
13572
13880
|
var DynamicIcon_default2 = DynamicIcon2;
|
|
13573
13881
|
|
|
13574
13882
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13575
|
-
var
|
|
13883
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
13576
13884
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13577
13885
|
if (icon == null ? void 0 : icon.name) {
|
|
13578
|
-
return /* @__PURE__ */ (0,
|
|
13886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components39.Avatar, { type: import_components39.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DynamicIcon_default2, { type: icon.name }) });
|
|
13579
13887
|
}
|
|
13580
13888
|
if (icon == null ? void 0 : icon.text) {
|
|
13581
|
-
return /* @__PURE__ */ (0,
|
|
13889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components39.Avatar, { type: import_components39.AvatarType.INITIALS, children: icon.text });
|
|
13582
13890
|
}
|
|
13583
13891
|
if (image == null ? void 0 : image.url) {
|
|
13584
13892
|
const { url, text } = image;
|
|
13585
|
-
return /* @__PURE__ */ (0,
|
|
13893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { src: url, alt: text });
|
|
13586
13894
|
}
|
|
13587
13895
|
return null;
|
|
13588
13896
|
};
|
|
@@ -13618,11 +13926,11 @@ var getTextAlignment2 = (align) => {
|
|
|
13618
13926
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
13619
13927
|
|
|
13620
13928
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13621
|
-
var
|
|
13929
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
13622
13930
|
var DynamicAlert = (props) => {
|
|
13623
13931
|
const alert = props.component;
|
|
13624
|
-
return /* @__PURE__ */ (0,
|
|
13625
|
-
|
|
13932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13933
|
+
import_components40.Alert,
|
|
13626
13934
|
{
|
|
13627
13935
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
13628
13936
|
className: getMargin2(alert.margin),
|
|
@@ -13654,12 +13962,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13654
13962
|
var DynamicAlert_default = DynamicAlert;
|
|
13655
13963
|
|
|
13656
13964
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13657
|
-
var
|
|
13965
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13658
13966
|
var DynamicBox = (props) => {
|
|
13659
13967
|
const box = props.component;
|
|
13660
13968
|
const margin = getMargin2(box.margin || box.border ? "lg" : "xs");
|
|
13661
13969
|
if (!box.width || box.width === "xl") {
|
|
13662
|
-
return /* @__PURE__ */ (0,
|
|
13970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13663
13971
|
DynamicLayout_default,
|
|
13664
13972
|
{
|
|
13665
13973
|
components: box.components,
|
|
@@ -13672,7 +13980,7 @@ var DynamicBox = (props) => {
|
|
|
13672
13980
|
}
|
|
13673
13981
|
) });
|
|
13674
13982
|
}
|
|
13675
|
-
return /* @__PURE__ */ (0,
|
|
13983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13676
13984
|
DynamicLayout_default,
|
|
13677
13985
|
{
|
|
13678
13986
|
components: box.components,
|
|
@@ -13706,7 +14014,7 @@ var getBoxWidthClasses = (component) => {
|
|
|
13706
14014
|
var DynamicBox_default = DynamicBox;
|
|
13707
14015
|
|
|
13708
14016
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13709
|
-
var
|
|
14017
|
+
var import_components41 = require("@transferwise/components");
|
|
13710
14018
|
|
|
13711
14019
|
// src/legacy/layout/button/utils.ts
|
|
13712
14020
|
var priorities = {
|
|
@@ -13756,7 +14064,7 @@ var getButtonSize = (size) => {
|
|
|
13756
14064
|
};
|
|
13757
14065
|
|
|
13758
14066
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13759
|
-
var
|
|
14067
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13760
14068
|
function DynamicButton(props) {
|
|
13761
14069
|
var _a;
|
|
13762
14070
|
const { component, onAction } = props;
|
|
@@ -13765,8 +14073,8 @@ function DynamicButton(props) {
|
|
|
13765
14073
|
const priority = getButtonPriority(component);
|
|
13766
14074
|
const { loading } = useDynamicFlow();
|
|
13767
14075
|
const className = getMargin2(component.margin || "md");
|
|
13768
|
-
return /* @__PURE__ */ (0,
|
|
13769
|
-
|
|
14076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
14077
|
+
import_components41.Button,
|
|
13770
14078
|
{
|
|
13771
14079
|
size: getButtonSize(component.size),
|
|
13772
14080
|
type: priority === "tertiary" ? void 0 : type,
|
|
@@ -13782,12 +14090,12 @@ function DynamicButton(props) {
|
|
|
13782
14090
|
var DynamicButton_default = DynamicButton;
|
|
13783
14091
|
|
|
13784
14092
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13785
|
-
var
|
|
14093
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13786
14094
|
var DynamicColumns = (props) => {
|
|
13787
14095
|
const columns = props.component;
|
|
13788
14096
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13789
|
-
return /* @__PURE__ */ (0,
|
|
13790
|
-
/* @__PURE__ */ (0,
|
|
14097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: `${getMargin2(columns.margin || "xs")} row`, children: [
|
|
14098
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13791
14099
|
DynamicLayout_default,
|
|
13792
14100
|
{
|
|
13793
14101
|
components: columns.left,
|
|
@@ -13799,7 +14107,7 @@ var DynamicColumns = (props) => {
|
|
|
13799
14107
|
onPersistAsync: props.onPersistAsync
|
|
13800
14108
|
}
|
|
13801
14109
|
) }),
|
|
13802
|
-
/* @__PURE__ */ (0,
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13803
14111
|
DynamicLayout_default,
|
|
13804
14112
|
{
|
|
13805
14113
|
components: columns.right,
|
|
@@ -13834,12 +14142,12 @@ var getWidth = (bias) => {
|
|
|
13834
14142
|
var DynamicColumns_default = DynamicColumns;
|
|
13835
14143
|
|
|
13836
14144
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13837
|
-
var
|
|
13838
|
-
var
|
|
14145
|
+
var import_components42 = require("@transferwise/components");
|
|
14146
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13839
14147
|
function DynamicDecision({ component, onAction }) {
|
|
13840
14148
|
const { loading } = useDynamicFlow();
|
|
13841
|
-
return /* @__PURE__ */ (0,
|
|
13842
|
-
|
|
14149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getMargin2(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components42.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14150
|
+
import_components42.NavigationOption,
|
|
13843
14151
|
{
|
|
13844
14152
|
title: option.title,
|
|
13845
14153
|
content: option.description,
|
|
@@ -13855,22 +14163,22 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13855
14163
|
var DynamicDecision_default = DynamicDecision;
|
|
13856
14164
|
|
|
13857
14165
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13858
|
-
var
|
|
14166
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13859
14167
|
var DynamicDivider = ({ component }) => {
|
|
13860
14168
|
const margin = getMargin2(component.margin);
|
|
13861
14169
|
const className = `m-t-0 ${margin}`;
|
|
13862
|
-
return /* @__PURE__ */ (0,
|
|
14170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("hr", { className });
|
|
13863
14171
|
};
|
|
13864
14172
|
var DynamicDivider_default = DynamicDivider;
|
|
13865
14173
|
|
|
13866
14174
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13867
|
-
var
|
|
13868
|
-
var
|
|
13869
|
-
var
|
|
14175
|
+
var import_components43 = require("@transferwise/components");
|
|
14176
|
+
var import_react31 = require("react");
|
|
14177
|
+
var import_react_intl19 = require("react-intl");
|
|
13870
14178
|
|
|
13871
14179
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
13872
|
-
var
|
|
13873
|
-
var DynamicExternal_messages_default = (0,
|
|
14180
|
+
var import_react_intl18 = require("react-intl");
|
|
14181
|
+
var DynamicExternal_messages_default = (0, import_react_intl18.defineMessages)({
|
|
13874
14182
|
retryTitle: {
|
|
13875
14183
|
id: "dynamicFlows.DynamicExternal.retryTitle",
|
|
13876
14184
|
defaultMessage: "Reopen window",
|
|
@@ -13879,37 +14187,37 @@ var DynamicExternal_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
13879
14187
|
});
|
|
13880
14188
|
|
|
13881
14189
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13882
|
-
var
|
|
14190
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13883
14191
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13884
14192
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13885
|
-
const intl = (0,
|
|
13886
|
-
const openExternalUrl = (0,
|
|
14193
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
14194
|
+
const openExternalUrl = (0, import_react31.useCallback)(
|
|
13887
14195
|
() => window.open(requestUrl, "df-external-window"),
|
|
13888
14196
|
[requestUrl]
|
|
13889
14197
|
);
|
|
13890
|
-
(0,
|
|
14198
|
+
(0, import_react31.useEffect)(() => {
|
|
13891
14199
|
openExternalUrl();
|
|
13892
14200
|
}, [openExternalUrl]);
|
|
13893
14201
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
13894
14202
|
responseHandlers
|
|
13895
14203
|
}) : void 0;
|
|
13896
14204
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13897
|
-
return /* @__PURE__ */ (0,
|
|
13898
|
-
/* @__PURE__ */ (0,
|
|
13899
|
-
/* @__PURE__ */ (0,
|
|
13900
|
-
/* @__PURE__ */ (0,
|
|
14205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
14206
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components43.Loader, { size: import_components43.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
14207
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("br", {}),
|
|
14208
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components43.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
13901
14209
|
] });
|
|
13902
14210
|
};
|
|
13903
14211
|
var DynamicExternal_default = DynamicExternal;
|
|
13904
14212
|
|
|
13905
14213
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
13906
|
-
var
|
|
14214
|
+
var import_react45 = require("react");
|
|
13907
14215
|
|
|
13908
14216
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13909
|
-
var
|
|
14217
|
+
var import_components44 = require("@transferwise/components");
|
|
13910
14218
|
var import_classnames7 = __toESM(require_classnames());
|
|
13911
|
-
var
|
|
13912
|
-
var
|
|
14219
|
+
var import_react32 = require("react");
|
|
14220
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13913
14221
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13914
14222
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13915
14223
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13924,13 +14232,13 @@ function AllOfSchema(props) {
|
|
|
13924
14232
|
setModels(models);
|
|
13925
14233
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13926
14234
|
};
|
|
13927
|
-
const [models, setModels] = (0,
|
|
13928
|
-
return /* @__PURE__ */ (0,
|
|
13929
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
13930
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
13931
|
-
/* @__PURE__ */ (0,
|
|
14235
|
+
const [models, setModels] = (0, import_react32.useState)(splitModel(props.model, props.schema.allOf));
|
|
14236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
14237
|
+
props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components44.Header, { title: props.schema.title }),
|
|
14238
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("p", { children: props.schema.description }),
|
|
14239
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
13932
14240
|
// eslint-disable-next-line react/no-array-index-key
|
|
13933
|
-
/* @__PURE__ */ (0,
|
|
14241
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: (0, import_classnames7.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13934
14242
|
GenericSchema_default,
|
|
13935
14243
|
{
|
|
13936
14244
|
schema,
|
|
@@ -13954,15 +14262,15 @@ AllOfSchema.defaultProps = {
|
|
|
13954
14262
|
var AllOfSchema_default = AllOfSchema;
|
|
13955
14263
|
|
|
13956
14264
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13957
|
-
var
|
|
14265
|
+
var import_components46 = require("@transferwise/components");
|
|
13958
14266
|
var import_classnames8 = __toESM(require_classnames());
|
|
13959
|
-
var
|
|
14267
|
+
var import_react33 = require("react");
|
|
13960
14268
|
|
|
13961
14269
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13962
|
-
var
|
|
14270
|
+
var import_components45 = require("@transferwise/components");
|
|
13963
14271
|
var import_formatting2 = require("@transferwise/formatting");
|
|
13964
|
-
var
|
|
13965
|
-
var
|
|
14272
|
+
var import_react_intl20 = require("react-intl");
|
|
14273
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
13966
14274
|
function ControlFeedback(props) {
|
|
13967
14275
|
var _a;
|
|
13968
14276
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13971,12 +14279,12 @@ function ControlFeedback(props) {
|
|
|
13971
14279
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
|
|
13972
14280
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13973
14281
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13974
|
-
return /* @__PURE__ */ (0,
|
|
13975
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
13976
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
13977
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
13978
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
13979
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
14282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { id: props.id, children: [
|
|
14283
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components45.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
14284
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components45.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
14285
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_components45.InlineAlert, { type: "info", children: [
|
|
14286
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: props.schema.description }),
|
|
14287
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: props.infoMessage })
|
|
13980
14288
|
] })
|
|
13981
14289
|
] });
|
|
13982
14290
|
}
|
|
@@ -13987,7 +14295,7 @@ ControlFeedback.defaultProps = {
|
|
|
13987
14295
|
validationAsyncSuccessMessage: null
|
|
13988
14296
|
};
|
|
13989
14297
|
function useDefaultValidationMessages(schema) {
|
|
13990
|
-
const { formatMessage, locale } = (0,
|
|
14298
|
+
const { formatMessage, locale } = (0, import_react_intl20.useIntl)();
|
|
13991
14299
|
const formattedMessages = {
|
|
13992
14300
|
type: formatMessage(validation_messages_default.type),
|
|
13993
14301
|
minimum: formatMessage(validation_messages_default.minimum, {
|
|
@@ -14074,11 +14382,11 @@ function constructUploadError(response) {
|
|
|
14074
14382
|
}
|
|
14075
14383
|
|
|
14076
14384
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
14077
|
-
var
|
|
14385
|
+
var import_react_intl22 = require("react-intl");
|
|
14078
14386
|
|
|
14079
14387
|
// src/legacy/common/messages.ts
|
|
14080
|
-
var
|
|
14081
|
-
var messages_default = (0,
|
|
14388
|
+
var import_react_intl21 = require("react-intl");
|
|
14389
|
+
var messages_default = (0, import_react_intl21.defineMessages)({
|
|
14082
14390
|
required: {
|
|
14083
14391
|
id: "dynamicFlows.DefaultErrorMessages.required",
|
|
14084
14392
|
defaultMessage: "Please fill out this field.",
|
|
@@ -14091,7 +14399,7 @@ function useFormattedDefaultErrorMessages({
|
|
|
14091
14399
|
maxItems,
|
|
14092
14400
|
minItems
|
|
14093
14401
|
}) {
|
|
14094
|
-
const { formatMessage } = (0,
|
|
14402
|
+
const { formatMessage } = (0, import_react_intl22.useIntl)();
|
|
14095
14403
|
const { maxFileSizeError, maxItemsError, minItemsError } = multi_file_upload_messages_default;
|
|
14096
14404
|
return {
|
|
14097
14405
|
maxFileSizeErrorMessage: formatMessage(maxFileSizeError),
|
|
@@ -14102,15 +14410,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
14102
14410
|
}
|
|
14103
14411
|
|
|
14104
14412
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
14105
|
-
var
|
|
14413
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14106
14414
|
function MultipleFileUploadSchema(props) {
|
|
14107
14415
|
var _a, _b;
|
|
14108
14416
|
const { onChange, schema } = props;
|
|
14109
14417
|
const onEvent = useEventDispatcher();
|
|
14110
14418
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
14111
|
-
const uid = (0,
|
|
14112
|
-
const [inputChanged, setInputChanged] = (0,
|
|
14113
|
-
const [files, setFiles] = (0,
|
|
14419
|
+
const uid = (0, import_react33.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14420
|
+
const [inputChanged, setInputChanged] = (0, import_react33.useState)(false);
|
|
14421
|
+
const [files, setFiles] = (0, import_react33.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
14114
14422
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
14115
14423
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
14116
14424
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -14164,10 +14472,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
14164
14472
|
onDeleteFile: () => Promise.resolve()
|
|
14165
14473
|
});
|
|
14166
14474
|
const feedbackId = `${uid}-feedback`;
|
|
14167
|
-
return /* @__PURE__ */ (0,
|
|
14168
|
-
/* @__PURE__ */ (0,
|
|
14169
|
-
/* @__PURE__ */ (0,
|
|
14170
|
-
/* @__PURE__ */ (0,
|
|
14475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: (0, import_classnames8.default)("form-group", { "has-error": showError }), children: [
|
|
14476
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
14477
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
14478
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14171
14479
|
ControlFeedback_default,
|
|
14172
14480
|
{
|
|
14173
14481
|
id: feedbackId,
|
|
@@ -14197,7 +14505,7 @@ function getSuccessfullyProcessedFiles(allFiles) {
|
|
|
14197
14505
|
return allFiles.filter((file) => !file.error && file.status === "succeeded");
|
|
14198
14506
|
}
|
|
14199
14507
|
function convertFileIdsToComponentFileObjects(fileIds) {
|
|
14200
|
-
return fileIds.map((id) => isValidId(id) ? { id, status:
|
|
14508
|
+
return fileIds.map((id) => isValidId(id) ? { id, status: import_components46.Status.SUCCEEDED } : null).filter((item) => item !== null);
|
|
14201
14509
|
}
|
|
14202
14510
|
function isValidId(id) {
|
|
14203
14511
|
return isNumber3(id) || isString2(id);
|
|
@@ -14208,14 +14516,14 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
14208
14516
|
}
|
|
14209
14517
|
|
|
14210
14518
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14211
|
-
var
|
|
14519
|
+
var import_components48 = require("@transferwise/components");
|
|
14212
14520
|
var import_classnames9 = __toESM(require_classnames());
|
|
14213
|
-
var
|
|
14214
|
-
var
|
|
14521
|
+
var import_react34 = require("react");
|
|
14522
|
+
var import_react_intl23 = require("react-intl");
|
|
14215
14523
|
|
|
14216
14524
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
14217
|
-
var
|
|
14218
|
-
var
|
|
14525
|
+
var import_components47 = require("@transferwise/components");
|
|
14526
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14219
14527
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
14220
14528
|
switch (controlType) {
|
|
14221
14529
|
case "select":
|
|
@@ -14239,7 +14547,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
14239
14547
|
var mapImage = (image) => {
|
|
14240
14548
|
if (image == null ? void 0 : image.url) {
|
|
14241
14549
|
return {
|
|
14242
|
-
icon: /* @__PURE__ */ (0,
|
|
14550
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
14243
14551
|
hideIconInTrigger: true
|
|
14244
14552
|
};
|
|
14245
14553
|
}
|
|
@@ -14248,17 +14556,17 @@ var mapImage = (image) => {
|
|
|
14248
14556
|
var getIconPropertyForSelectOption = (icon) => {
|
|
14249
14557
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon2(icon.name)) {
|
|
14250
14558
|
return {
|
|
14251
|
-
icon: /* @__PURE__ */ (0,
|
|
14559
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
14252
14560
|
};
|
|
14253
14561
|
}
|
|
14254
14562
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14255
14563
|
return {
|
|
14256
|
-
icon: /* @__PURE__ */ (0,
|
|
14564
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DynamicIcon_default2, { type: icon.name })
|
|
14257
14565
|
};
|
|
14258
14566
|
}
|
|
14259
14567
|
if (icon == null ? void 0 : icon.text) {
|
|
14260
14568
|
return {
|
|
14261
|
-
icon: /* @__PURE__ */ (0,
|
|
14569
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { children: icon.text })
|
|
14262
14570
|
};
|
|
14263
14571
|
}
|
|
14264
14572
|
return null;
|
|
@@ -14266,17 +14574,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
14266
14574
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
14267
14575
|
if (image == null ? void 0 : image.url) {
|
|
14268
14576
|
return {
|
|
14269
|
-
avatar: /* @__PURE__ */ (0,
|
|
14577
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.Avatar, { type: import_components47.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("img", { src: image.url, alt: "" }) })
|
|
14270
14578
|
};
|
|
14271
14579
|
}
|
|
14272
14580
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14273
14581
|
return {
|
|
14274
|
-
avatar: /* @__PURE__ */ (0,
|
|
14582
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.Avatar, { type: import_components47.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DynamicIcon_default2, { type: icon.name }) })
|
|
14275
14583
|
};
|
|
14276
14584
|
}
|
|
14277
14585
|
if (icon == null ? void 0 : icon.text) {
|
|
14278
14586
|
return {
|
|
14279
|
-
avatar: /* @__PURE__ */ (0,
|
|
14587
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.Avatar, { type: import_components47.AvatarType.INITIALS, children: icon.text })
|
|
14280
14588
|
};
|
|
14281
14589
|
}
|
|
14282
14590
|
return null;
|
|
@@ -14304,18 +14612,8 @@ var getDisabled = (disabled) => {
|
|
|
14304
14612
|
return void 0;
|
|
14305
14613
|
};
|
|
14306
14614
|
|
|
14307
|
-
// src/common/messages/multi-select.messages.ts
|
|
14308
|
-
var import_react_intl21 = require("react-intl");
|
|
14309
|
-
var multi_select_messages_default = (0, import_react_intl21.defineMessages)({
|
|
14310
|
-
summary: {
|
|
14311
|
-
id: "dynamicFlows.MultiSelect.summary",
|
|
14312
|
-
defaultMessage: "{first} and {count} more",
|
|
14313
|
-
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."
|
|
14314
|
-
}
|
|
14315
|
-
});
|
|
14316
|
-
|
|
14317
14615
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14318
|
-
var
|
|
14616
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14319
14617
|
function MultiSelectSchema({
|
|
14320
14618
|
schema,
|
|
14321
14619
|
model,
|
|
@@ -14324,13 +14622,13 @@ function MultiSelectSchema({
|
|
|
14324
14622
|
errors,
|
|
14325
14623
|
onChange
|
|
14326
14624
|
}) {
|
|
14327
|
-
const { formatMessage, locale } = (0,
|
|
14625
|
+
const { formatMessage, locale } = (0, import_react_intl23.useIntl)();
|
|
14328
14626
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
14329
14627
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
14330
|
-
const id = (0,
|
|
14331
|
-
const [changed, setChanged] = (0,
|
|
14332
|
-
const [selected, setSelected] = (0,
|
|
14333
|
-
(0,
|
|
14628
|
+
const id = (0, import_react34.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14629
|
+
const [changed, setChanged] = (0, import_react34.useState)(false);
|
|
14630
|
+
const [selected, setSelected] = (0, import_react34.useState)(getInitialModelIndices2(model, options));
|
|
14631
|
+
(0, import_react34.useEffect)(
|
|
14334
14632
|
() => {
|
|
14335
14633
|
if (selected) {
|
|
14336
14634
|
broadcastModelChange(selected);
|
|
@@ -14367,10 +14665,10 @@ function MultiSelectSchema({
|
|
|
14367
14665
|
const formGroupClasses = {
|
|
14368
14666
|
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
14369
14667
|
};
|
|
14370
|
-
return /* @__PURE__ */ (0,
|
|
14371
|
-
schema.title ? /* @__PURE__ */ (0,
|
|
14372
|
-
/* @__PURE__ */ (0,
|
|
14373
|
-
|
|
14668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: (0, import_classnames9.default)("d-flex flex-column", formGroupClasses), children: [
|
|
14669
|
+
schema.title ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("label", { htmlFor: id, children: schema.title }) : void 0,
|
|
14670
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14671
|
+
import_components48.SelectInput,
|
|
14374
14672
|
{
|
|
14375
14673
|
id,
|
|
14376
14674
|
multiple: true,
|
|
@@ -14395,12 +14693,12 @@ function MultiSelectSchema({
|
|
|
14395
14693
|
if (withinTrigger) {
|
|
14396
14694
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14397
14695
|
}
|
|
14398
|
-
return /* @__PURE__ */ (0,
|
|
14696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components48.SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
14399
14697
|
},
|
|
14400
14698
|
onChange: broadcastModelChange
|
|
14401
14699
|
}
|
|
14402
14700
|
),
|
|
14403
|
-
/* @__PURE__ */ (0,
|
|
14701
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14404
14702
|
ControlFeedback_default,
|
|
14405
14703
|
{
|
|
14406
14704
|
id: `${id}-feedback`,
|
|
@@ -14417,7 +14715,7 @@ function MultiSelectSchema({
|
|
|
14417
14715
|
)
|
|
14418
14716
|
] });
|
|
14419
14717
|
}
|
|
14420
|
-
var
|
|
14718
|
+
var getInitialModelIndices2 = (model, options) => {
|
|
14421
14719
|
if (model == null) {
|
|
14422
14720
|
return null;
|
|
14423
14721
|
}
|
|
@@ -14425,17 +14723,17 @@ var getInitialModelIndices = (model, options) => {
|
|
|
14425
14723
|
};
|
|
14426
14724
|
|
|
14427
14725
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14428
|
-
var
|
|
14726
|
+
var import_components50 = require("@transferwise/components");
|
|
14429
14727
|
var import_icons4 = require("@transferwise/icons");
|
|
14430
|
-
var
|
|
14431
|
-
var
|
|
14728
|
+
var import_react36 = require("react");
|
|
14729
|
+
var import_react_intl25 = require("react-intl");
|
|
14432
14730
|
|
|
14433
14731
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14434
|
-
var
|
|
14435
|
-
var
|
|
14732
|
+
var import_components49 = require("@transferwise/components");
|
|
14733
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14436
14734
|
function ItemSummaryOption2({ item, onClick }) {
|
|
14437
|
-
return /* @__PURE__ */ (0,
|
|
14438
|
-
|
|
14735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14736
|
+
import_components49.NavigationOption,
|
|
14439
14737
|
{
|
|
14440
14738
|
media: getNavigationOptionMedia(item),
|
|
14441
14739
|
title: item.title,
|
|
@@ -14447,9 +14745,9 @@ function ItemSummaryOption2({ item, onClick }) {
|
|
|
14447
14745
|
}
|
|
14448
14746
|
|
|
14449
14747
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14450
|
-
var
|
|
14451
|
-
var
|
|
14452
|
-
var
|
|
14748
|
+
var import_react35 = require("react");
|
|
14749
|
+
var import_react_intl24 = require("react-intl");
|
|
14750
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14453
14751
|
function RepeatableSchemaStep({
|
|
14454
14752
|
type,
|
|
14455
14753
|
schema,
|
|
@@ -14459,8 +14757,8 @@ function RepeatableSchemaStep({
|
|
|
14459
14757
|
onModelChange,
|
|
14460
14758
|
onAction
|
|
14461
14759
|
}) {
|
|
14462
|
-
const { formatMessage } = (0,
|
|
14463
|
-
const [filename, setFilename] = (0,
|
|
14760
|
+
const { formatMessage } = (0, import_react_intl24.useIntl)();
|
|
14761
|
+
const [filename, setFilename] = (0, import_react35.useState)(void 0);
|
|
14464
14762
|
const step = {
|
|
14465
14763
|
layout: [
|
|
14466
14764
|
{
|
|
@@ -14497,7 +14795,7 @@ function RepeatableSchemaStep({
|
|
|
14497
14795
|
}
|
|
14498
14796
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14499
14797
|
};
|
|
14500
|
-
return /* @__PURE__ */ (0,
|
|
14798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14501
14799
|
DynamicFlowStep,
|
|
14502
14800
|
{
|
|
14503
14801
|
step,
|
|
@@ -14703,7 +15001,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14703
15001
|
|
|
14704
15002
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14705
15003
|
var import_classnames10 = __toESM(require_classnames());
|
|
14706
|
-
var
|
|
15004
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14707
15005
|
function RepeatableSchema({
|
|
14708
15006
|
schema,
|
|
14709
15007
|
model,
|
|
@@ -14713,9 +15011,9 @@ function RepeatableSchema({
|
|
|
14713
15011
|
onChange
|
|
14714
15012
|
}) {
|
|
14715
15013
|
var _a;
|
|
14716
|
-
const [openModalType, setOpenModalType] = (0,
|
|
14717
|
-
const [changed, setChanged] = (0,
|
|
14718
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
15014
|
+
const [openModalType, setOpenModalType] = (0, import_react36.useState)(null);
|
|
15015
|
+
const [changed, setChanged] = (0, import_react36.useState)(false);
|
|
15016
|
+
const [itemSummaries, setItemSummaries] = (0, import_react36.useState)(() => {
|
|
14719
15017
|
if (isObject2(model) && !isArray2(model)) {
|
|
14720
15018
|
throw new Error(
|
|
14721
15019
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14723,8 +15021,8 @@ function RepeatableSchema({
|
|
|
14723
15021
|
}
|
|
14724
15022
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14725
15023
|
});
|
|
14726
|
-
const [editableItem, setEditableItem] = (0,
|
|
14727
|
-
const id = (0,
|
|
15024
|
+
const [editableItem, setEditableItem] = (0, import_react36.useState)({ item: null, model: null });
|
|
15025
|
+
const id = (0, import_react36.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14728
15026
|
const broadcastModelChange = (updatedItems) => {
|
|
14729
15027
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
14730
15028
|
onChange({
|
|
@@ -14766,7 +15064,7 @@ function RepeatableSchema({
|
|
|
14766
15064
|
setEditableItem({ item: null, model: null });
|
|
14767
15065
|
setOpenModalType(null);
|
|
14768
15066
|
};
|
|
14769
|
-
const { formatMessage } = (0,
|
|
15067
|
+
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
14770
15068
|
const validations = getValidationFailures(model, schema, required);
|
|
14771
15069
|
const base64ValidationMessages = useFormattedDefaultErrorMessages({
|
|
14772
15070
|
minItems: schema.minItems,
|
|
@@ -14780,9 +15078,9 @@ function RepeatableSchema({
|
|
|
14780
15078
|
const formGroupClasses = {
|
|
14781
15079
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14782
15080
|
};
|
|
14783
|
-
return /* @__PURE__ */ (0,
|
|
14784
|
-
schema.title && /* @__PURE__ */ (0,
|
|
14785
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
15081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { id, className: (0, import_classnames10.default)(formGroupClasses), children: [
|
|
15082
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components50.Header, { title: schema.title }),
|
|
15083
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14786
15084
|
ItemSummaryOption2,
|
|
14787
15085
|
{
|
|
14788
15086
|
item: itemSummary,
|
|
@@ -14790,21 +15088,21 @@ function RepeatableSchema({
|
|
|
14790
15088
|
},
|
|
14791
15089
|
JSON.stringify(itemSummary)
|
|
14792
15090
|
)),
|
|
14793
|
-
/* @__PURE__ */ (0,
|
|
14794
|
-
|
|
15091
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
15092
|
+
import_components50.NavigationOption,
|
|
14795
15093
|
{
|
|
14796
|
-
media: /* @__PURE__ */ (0,
|
|
15094
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_icons4.Plus, {}),
|
|
14797
15095
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14798
15096
|
showMediaAtAllSizes: true,
|
|
14799
15097
|
onClick: onAddItem
|
|
14800
15098
|
}
|
|
14801
15099
|
),
|
|
14802
|
-
/* @__PURE__ */ (0,
|
|
14803
|
-
|
|
15100
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
15101
|
+
import_components50.Modal,
|
|
14804
15102
|
{
|
|
14805
15103
|
open: openModalType !== null,
|
|
14806
15104
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14807
|
-
body: /* @__PURE__ */ (0,
|
|
15105
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14808
15106
|
RepeatableSchemaStep_default,
|
|
14809
15107
|
{
|
|
14810
15108
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14819,7 +15117,7 @@ function RepeatableSchema({
|
|
|
14819
15117
|
onClose: onCancelEdit
|
|
14820
15118
|
}
|
|
14821
15119
|
),
|
|
14822
|
-
/* @__PURE__ */ (0,
|
|
15120
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14823
15121
|
ControlFeedback_default,
|
|
14824
15122
|
{
|
|
14825
15123
|
id: `${id}-feedback`,
|
|
@@ -14861,17 +15159,17 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14861
15159
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14862
15160
|
|
|
14863
15161
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14864
|
-
var
|
|
15162
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14865
15163
|
function ArrayListSchema(props) {
|
|
14866
15164
|
const { schema } = props;
|
|
14867
15165
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14868
|
-
return /* @__PURE__ */ (0,
|
|
15166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14869
15167
|
}
|
|
14870
15168
|
if (isMultiSelectConstSchema(schema)) {
|
|
14871
|
-
return /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14872
15170
|
}
|
|
14873
15171
|
if (isListArraySchema(schema)) {
|
|
14874
|
-
return /* @__PURE__ */ (0,
|
|
15172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14875
15173
|
}
|
|
14876
15174
|
throw new Error("Invalid array list schema");
|
|
14877
15175
|
}
|
|
@@ -14882,11 +15180,11 @@ ArrayListSchema.defaultProps = {
|
|
|
14882
15180
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14883
15181
|
|
|
14884
15182
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14885
|
-
var
|
|
15183
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
14886
15184
|
var ArraySchema = (props) => {
|
|
14887
15185
|
const { schema } = props;
|
|
14888
15186
|
if (isListArraySchema(schema)) {
|
|
14889
|
-
return /* @__PURE__ */ (0,
|
|
15187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
14890
15188
|
}
|
|
14891
15189
|
throw new Error("Not implemented");
|
|
14892
15190
|
};
|
|
@@ -14896,17 +15194,17 @@ ArraySchema.defaultProps = {
|
|
|
14896
15194
|
var ArraySchema_default = ArraySchema;
|
|
14897
15195
|
|
|
14898
15196
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14899
|
-
var
|
|
15197
|
+
var import_components51 = require("@transferwise/components");
|
|
14900
15198
|
var import_classnames11 = __toESM(require_classnames());
|
|
14901
|
-
var
|
|
14902
|
-
var
|
|
15199
|
+
var import_react37 = require("react");
|
|
15200
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
14903
15201
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14904
15202
|
"col-xs-12": true,
|
|
14905
15203
|
"col-sm-6": width === "md",
|
|
14906
15204
|
"col-sm-4": width === "sm"
|
|
14907
15205
|
});
|
|
14908
15206
|
function ObjectSchema(props) {
|
|
14909
|
-
const [model, setModel] = (0,
|
|
15207
|
+
const [model, setModel] = (0, import_react37.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14910
15208
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14911
15209
|
if (onChangeProps.model !== null) {
|
|
14912
15210
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14917,7 +15215,7 @@ function ObjectSchema(props) {
|
|
|
14917
15215
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
14918
15216
|
};
|
|
14919
15217
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
14920
|
-
(0,
|
|
15218
|
+
(0, import_react37.useEffect)(() => {
|
|
14921
15219
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
14922
15220
|
setModel(newModel);
|
|
14923
15221
|
if (!isEqual(newModel, model)) {
|
|
@@ -14935,22 +15233,22 @@ function ObjectSchema(props) {
|
|
|
14935
15233
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
14936
15234
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14937
15235
|
const propsErrors = props.errors;
|
|
14938
|
-
return /* @__PURE__ */ (0,
|
|
14939
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
14940
|
-
/* @__PURE__ */ (0,
|
|
14941
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14942
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0,
|
|
15236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
15237
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
15238
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("fieldset", { children: [
|
|
15239
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components51.Header, { title: props.schema.title, as: "legend" }),
|
|
15240
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("p", { children: [
|
|
14943
15241
|
" ",
|
|
14944
15242
|
props.schema.description,
|
|
14945
15243
|
" "
|
|
14946
15244
|
] }),
|
|
14947
|
-
/* @__PURE__ */ (0,
|
|
15245
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14948
15246
|
"div",
|
|
14949
15247
|
{
|
|
14950
15248
|
className: (0, import_classnames11.default)(
|
|
14951
15249
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14952
15250
|
),
|
|
14953
|
-
children: /* @__PURE__ */ (0,
|
|
15251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14954
15252
|
GenericSchema_default,
|
|
14955
15253
|
{
|
|
14956
15254
|
schema: props.schema.properties[propertyName],
|
|
@@ -14976,21 +15274,21 @@ ObjectSchema.defaultProps = {
|
|
|
14976
15274
|
var ObjectSchema_default = ObjectSchema;
|
|
14977
15275
|
|
|
14978
15276
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14979
|
-
var
|
|
15277
|
+
var import_components54 = require("@transferwise/components");
|
|
14980
15278
|
var import_classnames12 = __toESM(require_classnames());
|
|
14981
|
-
var
|
|
15279
|
+
var import_react40 = require("react");
|
|
14982
15280
|
|
|
14983
15281
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14984
|
-
var
|
|
14985
|
-
var
|
|
14986
|
-
var
|
|
15282
|
+
var import_components52 = require("@transferwise/components");
|
|
15283
|
+
var import_react_intl26 = require("react-intl");
|
|
15284
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
14987
15285
|
function Help2(props) {
|
|
14988
|
-
const intl = (0,
|
|
14989
|
-
return /* @__PURE__ */ (0,
|
|
14990
|
-
|
|
15286
|
+
const intl = (0, import_react_intl26.useIntl)();
|
|
15287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15288
|
+
import_components52.Info,
|
|
14991
15289
|
{
|
|
14992
15290
|
className: "m-l-1",
|
|
14993
|
-
content: /* @__PURE__ */ (0,
|
|
15291
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components52.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
14994
15292
|
presentation: "POPOVER",
|
|
14995
15293
|
size: "sm",
|
|
14996
15294
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -15000,11 +15298,11 @@ function Help2(props) {
|
|
|
15000
15298
|
var Help_default2 = Help2;
|
|
15001
15299
|
|
|
15002
15300
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15003
|
-
var
|
|
15301
|
+
var import_react39 = require("react");
|
|
15004
15302
|
|
|
15005
15303
|
// src/legacy/formControl/FormControl.tsx
|
|
15006
|
-
var
|
|
15007
|
-
var
|
|
15304
|
+
var import_components53 = require("@transferwise/components");
|
|
15305
|
+
var import_react38 = require("react");
|
|
15008
15306
|
|
|
15009
15307
|
// src/legacy/formControl/utils/value-utils.ts
|
|
15010
15308
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -15190,8 +15488,8 @@ var autocompleteTokenMap2 = {
|
|
|
15190
15488
|
};
|
|
15191
15489
|
|
|
15192
15490
|
// src/legacy/formControl/FormControl.tsx
|
|
15193
|
-
var
|
|
15194
|
-
var _FormControl = class _FormControl extends
|
|
15491
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15492
|
+
var _FormControl = class _FormControl extends import_react38.PureComponent {
|
|
15195
15493
|
constructor(props) {
|
|
15196
15494
|
super(props);
|
|
15197
15495
|
this.getAutocompleteValue = ({ prefix = "", suffix = "" } = {}) => {
|
|
@@ -15278,8 +15576,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15278
15576
|
} = this.props;
|
|
15279
15577
|
switch (type) {
|
|
15280
15578
|
case FormControlType.RADIO:
|
|
15281
|
-
return /* @__PURE__ */ (0,
|
|
15282
|
-
|
|
15579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15580
|
+
import_components53.RadioGroup,
|
|
15283
15581
|
{
|
|
15284
15582
|
radios: options.map(this.mapOption),
|
|
15285
15583
|
name,
|
|
@@ -15288,8 +15586,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15288
15586
|
}
|
|
15289
15587
|
);
|
|
15290
15588
|
case FormControlType.CHECKBOX:
|
|
15291
|
-
return /* @__PURE__ */ (0,
|
|
15292
|
-
|
|
15589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15590
|
+
import_components53.Checkbox,
|
|
15293
15591
|
{
|
|
15294
15592
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
15295
15593
|
disabled,
|
|
@@ -15306,8 +15604,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15306
15604
|
const search = options.length >= 8;
|
|
15307
15605
|
const items = options;
|
|
15308
15606
|
const selected = this.getSelectedOption(options);
|
|
15309
|
-
return /* @__PURE__ */ (0,
|
|
15310
|
-
|
|
15607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "d-flex flex-column", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15608
|
+
import_components53.SelectInput,
|
|
15311
15609
|
{
|
|
15312
15610
|
id,
|
|
15313
15611
|
items: items.map((value2) => ({
|
|
@@ -15316,8 +15614,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15316
15614
|
disabled: value2.disabled
|
|
15317
15615
|
})),
|
|
15318
15616
|
value: selected != null ? selected : null,
|
|
15319
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0,
|
|
15320
|
-
|
|
15617
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15618
|
+
import_components53.SelectInputOptionContent,
|
|
15321
15619
|
{
|
|
15322
15620
|
title: label2,
|
|
15323
15621
|
note: withinTrigger ? note != null ? note : secondary : note,
|
|
@@ -15345,13 +15643,13 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15345
15643
|
) });
|
|
15346
15644
|
}
|
|
15347
15645
|
case FormControlType.TAB:
|
|
15348
|
-
return /* @__PURE__ */ (0,
|
|
15349
|
-
|
|
15646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15647
|
+
import_components53.Tabs,
|
|
15350
15648
|
{
|
|
15351
15649
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15352
15650
|
tabs: options.map((option) => ({
|
|
15353
15651
|
title: option.label,
|
|
15354
|
-
content: /* @__PURE__ */ (0,
|
|
15652
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {}),
|
|
15355
15653
|
disabled: option.disabled || false
|
|
15356
15654
|
})),
|
|
15357
15655
|
name: id,
|
|
@@ -15366,7 +15664,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15366
15664
|
);
|
|
15367
15665
|
case FormControlType.NUMERIC:
|
|
15368
15666
|
case FormControlType.NUMBER: {
|
|
15369
|
-
return /* @__PURE__ */ (0,
|
|
15667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15370
15668
|
"input",
|
|
15371
15669
|
{
|
|
15372
15670
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15400,7 +15698,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15400
15698
|
);
|
|
15401
15699
|
}
|
|
15402
15700
|
case FormControlType.HIDDEN:
|
|
15403
|
-
return /* @__PURE__ */ (0,
|
|
15701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15404
15702
|
"input",
|
|
15405
15703
|
{
|
|
15406
15704
|
type: "hidden",
|
|
@@ -15410,7 +15708,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15410
15708
|
}
|
|
15411
15709
|
);
|
|
15412
15710
|
case FormControlType.PASSWORD:
|
|
15413
|
-
return /* @__PURE__ */ (0,
|
|
15711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15414
15712
|
"input",
|
|
15415
15713
|
{
|
|
15416
15714
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15430,8 +15728,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15430
15728
|
);
|
|
15431
15729
|
case FormControlType.DATE:
|
|
15432
15730
|
case FormControlType.DATETIME:
|
|
15433
|
-
return /* @__PURE__ */ (0,
|
|
15434
|
-
|
|
15731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15732
|
+
import_components53.DateInput,
|
|
15435
15733
|
{
|
|
15436
15734
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
15437
15735
|
yearAutoComplete: this.getAutocompleteValue({ suffix: "-year" }),
|
|
@@ -15446,8 +15744,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15446
15744
|
}
|
|
15447
15745
|
);
|
|
15448
15746
|
case FormControlType.DATELOOKUP: {
|
|
15449
|
-
return /* @__PURE__ */ (0,
|
|
15450
|
-
|
|
15747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15748
|
+
import_components53.DateLookup,
|
|
15451
15749
|
{
|
|
15452
15750
|
value: getSafeDateStringValue(value),
|
|
15453
15751
|
min: minDate,
|
|
@@ -15464,8 +15762,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15464
15762
|
);
|
|
15465
15763
|
}
|
|
15466
15764
|
case FormControlType.TEL:
|
|
15467
|
-
return /* @__PURE__ */ (0,
|
|
15468
|
-
|
|
15765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15766
|
+
import_components53.PhoneNumberInput,
|
|
15469
15767
|
{
|
|
15470
15768
|
disabled,
|
|
15471
15769
|
countryCode,
|
|
@@ -15496,8 +15794,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15496
15794
|
autoComplete: this.getAutocompleteValue()
|
|
15497
15795
|
};
|
|
15498
15796
|
if (this.props.displayPattern) {
|
|
15499
|
-
return /* @__PURE__ */ (0,
|
|
15500
|
-
|
|
15797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15798
|
+
import_components53.TextareaWithDisplayFormat,
|
|
15501
15799
|
__spreadProps(__spreadValues({
|
|
15502
15800
|
displayPattern: this.props.displayPattern
|
|
15503
15801
|
}, textareaProps), {
|
|
@@ -15505,7 +15803,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15505
15803
|
})
|
|
15506
15804
|
);
|
|
15507
15805
|
}
|
|
15508
|
-
return /* @__PURE__ */ (0,
|
|
15806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15509
15807
|
"textarea",
|
|
15510
15808
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15511
15809
|
"aria-describedby": describedBy,
|
|
@@ -15518,8 +15816,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15518
15816
|
return (
|
|
15519
15817
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15520
15818
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
15521
|
-
/* @__PURE__ */ (0,
|
|
15522
|
-
|
|
15819
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15820
|
+
import_components53.Upload,
|
|
15523
15821
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15524
15822
|
usAccept: uploadProps.usAccept || "*",
|
|
15525
15823
|
usDisabled: uploadProps.usDisabled || disabled,
|
|
@@ -15556,8 +15854,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15556
15854
|
autoComplete: this.getAutocompleteValue()
|
|
15557
15855
|
};
|
|
15558
15856
|
if (this.props.displayPattern) {
|
|
15559
|
-
return /* @__PURE__ */ (0,
|
|
15560
|
-
|
|
15857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15858
|
+
import_components53.InputWithDisplayFormat,
|
|
15561
15859
|
__spreadProps(__spreadValues({
|
|
15562
15860
|
displayPattern: this.props.displayPattern
|
|
15563
15861
|
}, inputProps), {
|
|
@@ -15565,7 +15863,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15565
15863
|
})
|
|
15566
15864
|
);
|
|
15567
15865
|
}
|
|
15568
|
-
return /* @__PURE__ */ (0,
|
|
15866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15569
15867
|
"input",
|
|
15570
15868
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15571
15869
|
"aria-describedby": describedBy,
|
|
@@ -15614,7 +15912,7 @@ _FormControl.defaultProps = {
|
|
|
15614
15912
|
var FormControl = _FormControl;
|
|
15615
15913
|
|
|
15616
15914
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15617
|
-
var
|
|
15915
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
15618
15916
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15619
15917
|
var getControlType = (schema) => {
|
|
15620
15918
|
if (isOneOfSchema2(schema)) {
|
|
@@ -15693,7 +15991,7 @@ function SchemaFormControl(props) {
|
|
|
15693
15991
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
15694
15992
|
};
|
|
15695
15993
|
const controlType = getControlType(schema);
|
|
15696
|
-
(0,
|
|
15994
|
+
(0, import_react39.useEffect)(() => {
|
|
15697
15995
|
warnIfInvalidSchema(schema, log, controlType);
|
|
15698
15996
|
}, [JSON.stringify(schema), log, controlType]);
|
|
15699
15997
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -15720,7 +16018,7 @@ function SchemaFormControl(props) {
|
|
|
15720
16018
|
describedBy,
|
|
15721
16019
|
required
|
|
15722
16020
|
};
|
|
15723
|
-
return /* @__PURE__ */ (0,
|
|
16021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
15724
16022
|
}
|
|
15725
16023
|
SchemaFormControl.defaultProps = {
|
|
15726
16024
|
value: null,
|
|
@@ -15749,17 +16047,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15749
16047
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15750
16048
|
|
|
15751
16049
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15752
|
-
var
|
|
16050
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
15753
16051
|
function OneOfSchema(props) {
|
|
15754
16052
|
const onEvent = useEventDispatcher();
|
|
15755
|
-
const [changed, setChanged] = (0,
|
|
15756
|
-
const [focused, setFocused] = (0,
|
|
15757
|
-
const [blurred, setBlurred] = (0,
|
|
15758
|
-
const id = (0,
|
|
15759
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
16053
|
+
const [changed, setChanged] = (0, import_react40.useState)(false);
|
|
16054
|
+
const [focused, setFocused] = (0, import_react40.useState)(false);
|
|
16055
|
+
const [blurred, setBlurred] = (0, import_react40.useState)(false);
|
|
16056
|
+
const id = (0, import_react40.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
16057
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react40.useState)(
|
|
15760
16058
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15761
16059
|
);
|
|
15762
|
-
const [models, setModels] = (0,
|
|
16060
|
+
const [models, setModels] = (0, import_react40.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15763
16061
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15764
16062
|
const onSearchChange = (searchValue) => {
|
|
15765
16063
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15767,7 +16065,7 @@ function OneOfSchema(props) {
|
|
|
15767
16065
|
searchValueLength: searchValue.length
|
|
15768
16066
|
});
|
|
15769
16067
|
};
|
|
15770
|
-
(0,
|
|
16068
|
+
(0, import_react40.useEffect)(() => {
|
|
15771
16069
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
15772
16070
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
15773
16071
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -15825,12 +16123,12 @@ function OneOfSchema(props) {
|
|
|
15825
16123
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
15826
16124
|
};
|
|
15827
16125
|
const feedbackId = `${id}-feedback`;
|
|
15828
|
-
return /* @__PURE__ */ (0,
|
|
15829
|
-
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
15830
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
15831
|
-
/* @__PURE__ */ (0,
|
|
16126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
16127
|
+
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
16128
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
16129
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_classnames12.default)(formGroupClasses), children: [
|
|
15832
16130
|
getTitleAndHelp(props.schema, id),
|
|
15833
|
-
/* @__PURE__ */ (0,
|
|
16131
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15834
16132
|
SchemaFormControl_default,
|
|
15835
16133
|
{
|
|
15836
16134
|
id,
|
|
@@ -15845,7 +16143,7 @@ function OneOfSchema(props) {
|
|
|
15845
16143
|
onSearchChange
|
|
15846
16144
|
}
|
|
15847
16145
|
),
|
|
15848
|
-
/* @__PURE__ */ (0,
|
|
16146
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15849
16147
|
ControlFeedback_default,
|
|
15850
16148
|
{
|
|
15851
16149
|
id: feedbackId,
|
|
@@ -15861,7 +16159,7 @@ function OneOfSchema(props) {
|
|
|
15861
16159
|
)
|
|
15862
16160
|
] })
|
|
15863
16161
|
] }),
|
|
15864
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
16162
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15865
16163
|
GenericSchema_default,
|
|
15866
16164
|
{
|
|
15867
16165
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15878,16 +16176,16 @@ function OneOfSchema(props) {
|
|
|
15878
16176
|
}
|
|
15879
16177
|
function getTitleAndHelp(schema, forId) {
|
|
15880
16178
|
var _a;
|
|
15881
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
15882
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
16179
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Help_default2, { help: schema.help }) : null;
|
|
16180
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
15883
16181
|
schema.title,
|
|
15884
16182
|
" ",
|
|
15885
16183
|
helpElement
|
|
15886
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
16184
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_jsx_runtime90.Fragment, { children: helpElement ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("h4", { className: "m-b-2", children: [
|
|
15887
16185
|
schema.title,
|
|
15888
16186
|
" ",
|
|
15889
16187
|
helpElement
|
|
15890
|
-
] }) : /* @__PURE__ */ (0,
|
|
16188
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_components54.Header, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15891
16189
|
return schema.title ? titleElement : helpElement;
|
|
15892
16190
|
}
|
|
15893
16191
|
function getValidations(props, schemaIndex) {
|
|
@@ -15924,12 +16222,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15924
16222
|
|
|
15925
16223
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15926
16224
|
var import_classnames13 = __toESM(require_classnames());
|
|
15927
|
-
var
|
|
16225
|
+
var import_react42 = require("react");
|
|
15928
16226
|
|
|
15929
16227
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15930
|
-
var
|
|
15931
|
-
var
|
|
15932
|
-
var
|
|
16228
|
+
var import_components55 = require("@transferwise/components");
|
|
16229
|
+
var import_react41 = require("react");
|
|
16230
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
15933
16231
|
function UploadInputAdapter(props) {
|
|
15934
16232
|
const {
|
|
15935
16233
|
id,
|
|
@@ -15945,7 +16243,7 @@ function UploadInputAdapter(props) {
|
|
|
15945
16243
|
onCancel
|
|
15946
16244
|
} = props;
|
|
15947
16245
|
const onEvent = useEventDispatcher();
|
|
15948
|
-
const files = (0,
|
|
16246
|
+
const files = (0, import_react41.useMemo)(() => fileId ? [{ id: fileId, status: import_components55.Status.SUCCEEDED }] : [], [fileId]);
|
|
15949
16247
|
const uploadFile = (formData) => {
|
|
15950
16248
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
15951
16249
|
return httpClient(String(httpOptions.url), {
|
|
@@ -15962,8 +16260,8 @@ function UploadInputAdapter(props) {
|
|
|
15962
16260
|
return Promise.reject();
|
|
15963
16261
|
});
|
|
15964
16262
|
};
|
|
15965
|
-
return /* @__PURE__ */ (0,
|
|
15966
|
-
|
|
16263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16264
|
+
import_components55.UploadInput,
|
|
15967
16265
|
{
|
|
15968
16266
|
id,
|
|
15969
16267
|
fileInputName: httpOptions.fileInputName,
|
|
@@ -15982,16 +16280,16 @@ function UploadInputAdapter(props) {
|
|
|
15982
16280
|
}
|
|
15983
16281
|
|
|
15984
16282
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15985
|
-
var
|
|
16283
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
15986
16284
|
function PersistAsyncBlobSchema(props) {
|
|
15987
16285
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
15988
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
15989
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
15990
|
-
const [validations, setValidations] = (0,
|
|
15991
|
-
const [changed, setChanged] = (0,
|
|
16286
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react42.useState)({});
|
|
16287
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react42.useState)(null);
|
|
16288
|
+
const [validations, setValidations] = (0, import_react42.useState)([]);
|
|
16289
|
+
const [changed, setChanged] = (0, import_react42.useState)(false);
|
|
15992
16290
|
const httpClient = useHttpClient();
|
|
15993
16291
|
const onEvent = useEventDispatcher();
|
|
15994
|
-
(0,
|
|
16292
|
+
(0, import_react42.useEffect)(() => {
|
|
15995
16293
|
if (submitted) {
|
|
15996
16294
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
15997
16295
|
} else {
|
|
@@ -16028,8 +16326,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16028
16326
|
};
|
|
16029
16327
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
16030
16328
|
const feedbackId = `${id}-feedback`;
|
|
16031
|
-
return /* @__PURE__ */ (0,
|
|
16032
|
-
/* @__PURE__ */ (0,
|
|
16329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: (0, import_classnames13.default)(formGroupClasses), children: [
|
|
16330
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16033
16331
|
UploadInputAdapter,
|
|
16034
16332
|
__spreadValues({
|
|
16035
16333
|
id,
|
|
@@ -16046,7 +16344,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16046
16344
|
onCancel
|
|
16047
16345
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
16048
16346
|
) }),
|
|
16049
|
-
/* @__PURE__ */ (0,
|
|
16347
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16050
16348
|
ControlFeedback_default,
|
|
16051
16349
|
{
|
|
16052
16350
|
id: feedbackId,
|
|
@@ -16071,17 +16369,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
16071
16369
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
16072
16370
|
|
|
16073
16371
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
16074
|
-
var
|
|
16372
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
16075
16373
|
function PersistAsyncSchema(props) {
|
|
16076
16374
|
const { schema } = props;
|
|
16077
16375
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
16078
16376
|
if (persistAsyncSchemaType === "blob") {
|
|
16079
|
-
return /* @__PURE__ */ (0,
|
|
16377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
16080
16378
|
PersistAsyncBlobSchema_default,
|
|
16081
16379
|
__spreadValues({}, props)
|
|
16082
16380
|
);
|
|
16083
16381
|
}
|
|
16084
|
-
return /* @__PURE__ */ (0,
|
|
16382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
16085
16383
|
}
|
|
16086
16384
|
PersistAsyncSchema.defaultProps = {
|
|
16087
16385
|
required: false
|
|
@@ -16089,7 +16387,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
16089
16387
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
16090
16388
|
|
|
16091
16389
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16092
|
-
var
|
|
16390
|
+
var import_react43 = require("react");
|
|
16093
16391
|
|
|
16094
16392
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
16095
16393
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -16101,8 +16399,8 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
16101
16399
|
};
|
|
16102
16400
|
|
|
16103
16401
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
16104
|
-
var
|
|
16105
|
-
var
|
|
16402
|
+
var import_components56 = require("@transferwise/components");
|
|
16403
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
16106
16404
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
16107
16405
|
const { id, selection, setSelection } = props;
|
|
16108
16406
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -16113,14 +16411,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
16113
16411
|
const toggleSelection = () => {
|
|
16114
16412
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
16115
16413
|
};
|
|
16116
|
-
return /* @__PURE__ */ (0,
|
|
16414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components56.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
16117
16415
|
};
|
|
16118
16416
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
16119
16417
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
16120
16418
|
|
|
16121
16419
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
16122
|
-
var
|
|
16123
|
-
var
|
|
16420
|
+
var import_components57 = require("@transferwise/components");
|
|
16421
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
16124
16422
|
function PromotedOneOfRadioControl(props) {
|
|
16125
16423
|
var _a, _b;
|
|
16126
16424
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -16137,10 +16435,10 @@ function PromotedOneOfRadioControl(props) {
|
|
|
16137
16435
|
secondary: promotion.other.description
|
|
16138
16436
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
16139
16437
|
];
|
|
16140
|
-
return /* @__PURE__ */ (0,
|
|
16141
|
-
title && /* @__PURE__ */ (0,
|
|
16142
|
-
/* @__PURE__ */ (0,
|
|
16143
|
-
|
|
16438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "form-group", children: [
|
|
16439
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
16440
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
16441
|
+
import_components57.RadioGroup,
|
|
16144
16442
|
{
|
|
16145
16443
|
name: "promoted-selection",
|
|
16146
16444
|
selectedValue: selection,
|
|
@@ -16157,16 +16455,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
16157
16455
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
16158
16456
|
|
|
16159
16457
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
16160
|
-
var
|
|
16458
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16161
16459
|
function PromotedOneOfControl(props) {
|
|
16162
16460
|
const controlType = props.promotion.control || "radio";
|
|
16163
16461
|
switch (controlType) {
|
|
16164
16462
|
case "radio":
|
|
16165
|
-
return /* @__PURE__ */ (0,
|
|
16463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
16166
16464
|
case "checkbox":
|
|
16167
|
-
return /* @__PURE__ */ (0,
|
|
16465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
16168
16466
|
default:
|
|
16169
|
-
return /* @__PURE__ */ (0,
|
|
16467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, {});
|
|
16170
16468
|
}
|
|
16171
16469
|
}
|
|
16172
16470
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -16176,20 +16474,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
16176
16474
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
16177
16475
|
|
|
16178
16476
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16179
|
-
var
|
|
16477
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
16180
16478
|
var isPromoted = (schema) => schema.promoted === true;
|
|
16181
16479
|
var PromotedOneOfSchema = (props) => {
|
|
16182
16480
|
var _a;
|
|
16183
|
-
const [selection, setSelection] = (0,
|
|
16481
|
+
const [selection, setSelection] = (0, import_react43.useState)(
|
|
16184
16482
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
16185
16483
|
);
|
|
16186
16484
|
const promotedAlert = props.schema.alert;
|
|
16187
16485
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
16188
16486
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
16189
16487
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
16190
|
-
return /* @__PURE__ */ (0,
|
|
16191
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
16192
|
-
/* @__PURE__ */ (0,
|
|
16488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
16489
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
16490
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
16193
16491
|
PromotedOneOfControl_default,
|
|
16194
16492
|
{
|
|
16195
16493
|
id: props.schema.$id,
|
|
@@ -16200,8 +16498,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16200
16498
|
setSelection
|
|
16201
16499
|
}
|
|
16202
16500
|
),
|
|
16203
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
16204
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
16501
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
16502
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
16205
16503
|
] });
|
|
16206
16504
|
};
|
|
16207
16505
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -16231,12 +16529,12 @@ function getOtherOneOf(schema) {
|
|
|
16231
16529
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
16232
16530
|
|
|
16233
16531
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16234
|
-
var
|
|
16235
|
-
var
|
|
16532
|
+
var import_components58 = require("@transferwise/components");
|
|
16533
|
+
var import_react_intl28 = require("react-intl");
|
|
16236
16534
|
|
|
16237
16535
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.ts
|
|
16238
|
-
var
|
|
16239
|
-
var ReadOnlySchema_messages_default = (0,
|
|
16536
|
+
var import_react_intl27 = require("react-intl");
|
|
16537
|
+
var ReadOnlySchema_messages_default = (0, import_react_intl27.defineMessages)({
|
|
16240
16538
|
yes: {
|
|
16241
16539
|
id: "dynamicFlows.ReadOnlySchema.yes",
|
|
16242
16540
|
defaultMessage: "Yes",
|
|
@@ -16250,12 +16548,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
16250
16548
|
});
|
|
16251
16549
|
|
|
16252
16550
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16253
|
-
var
|
|
16551
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
16254
16552
|
function ReadOnlySchema({ schema, model }) {
|
|
16255
16553
|
const { title = "" } = schema;
|
|
16256
|
-
const { formatMessage } = (0,
|
|
16554
|
+
const { formatMessage } = (0, import_react_intl28.useIntl)();
|
|
16257
16555
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
16258
|
-
return /* @__PURE__ */ (0,
|
|
16556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_components58.DefinitionList, { layout: import_components58.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
16259
16557
|
}
|
|
16260
16558
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
16261
16559
|
function getValueForSchema({
|
|
@@ -16288,7 +16586,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
16288
16586
|
function getValueFromOption(option) {
|
|
16289
16587
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
16290
16588
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
16291
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
16589
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
16292
16590
|
icon.avatar,
|
|
16293
16591
|
" ",
|
|
16294
16592
|
text
|
|
@@ -16296,22 +16594,22 @@ function getValueFromOption(option) {
|
|
|
16296
16594
|
}
|
|
16297
16595
|
|
|
16298
16596
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
16299
|
-
var
|
|
16300
|
-
var
|
|
16597
|
+
var import_react44 = require("react");
|
|
16598
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
16301
16599
|
function ValidationAsyncSchema(props) {
|
|
16302
16600
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
16303
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
16304
|
-
const previousRequestedModelReference = (0,
|
|
16305
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
16601
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react44.useState)(model);
|
|
16602
|
+
const previousRequestedModelReference = (0, import_react44.useRef)(null);
|
|
16603
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react44.useState)(
|
|
16306
16604
|
null
|
|
16307
16605
|
);
|
|
16308
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
16309
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
16310
|
-
const [abortController, setAbortController] = (0,
|
|
16606
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react44.useState)(null);
|
|
16607
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react44.useState)(false);
|
|
16608
|
+
const [abortController, setAbortController] = (0, import_react44.useState)(null);
|
|
16311
16609
|
const httpClient = useHttpClient();
|
|
16312
16610
|
const onEvent = useEventDispatcher();
|
|
16313
16611
|
const log = useLogger();
|
|
16314
|
-
(0,
|
|
16612
|
+
(0, import_react44.useEffect)(() => {
|
|
16315
16613
|
if (!schema.validationAsync.method) {
|
|
16316
16614
|
log.warning(
|
|
16317
16615
|
"Invalid schema or model",
|
|
@@ -16381,20 +16679,20 @@ function ValidationAsyncSchema(props) {
|
|
|
16381
16679
|
required,
|
|
16382
16680
|
schema
|
|
16383
16681
|
};
|
|
16384
|
-
return /* @__PURE__ */ (0,
|
|
16682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16385
16683
|
}
|
|
16386
16684
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
16387
16685
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16388
16686
|
|
|
16389
16687
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16390
|
-
var
|
|
16391
|
-
var
|
|
16688
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
16689
|
+
var import_react46 = require("react");
|
|
16392
16690
|
function GenericSchemaForm(props) {
|
|
16393
16691
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
16394
16692
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
16395
16693
|
const type = getSchemaType(schema);
|
|
16396
16694
|
const log = useLogger();
|
|
16397
|
-
(0,
|
|
16695
|
+
(0, import_react45.useEffect)(() => {
|
|
16398
16696
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
16399
16697
|
log.error(
|
|
16400
16698
|
"Invalid schema or model",
|
|
@@ -16404,29 +16702,29 @@ function GenericSchemaForm(props) {
|
|
|
16404
16702
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16405
16703
|
switch (type) {
|
|
16406
16704
|
case "readOnly":
|
|
16407
|
-
return /* @__PURE__ */ (0,
|
|
16705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16408
16706
|
case "persistAsync":
|
|
16409
|
-
return /* @__PURE__ */ (0,
|
|
16707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16410
16708
|
case "validationAsync":
|
|
16411
|
-
return /* @__PURE__ */ (0,
|
|
16709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16412
16710
|
case "basic": {
|
|
16413
16711
|
const basicTypeProps = __spreadValues({
|
|
16414
16712
|
infoMessage: null
|
|
16415
16713
|
}, schemaProps);
|
|
16416
|
-
return /* @__PURE__ */ (0,
|
|
16714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16417
16715
|
}
|
|
16418
16716
|
case "object":
|
|
16419
|
-
return /* @__PURE__ */ (0,
|
|
16717
|
+
return /* @__PURE__ */ (0, import_react46.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16420
16718
|
case "array":
|
|
16421
|
-
return /* @__PURE__ */ (0,
|
|
16719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16422
16720
|
case "promotedOneOf":
|
|
16423
|
-
return /* @__PURE__ */ (0,
|
|
16721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16424
16722
|
case "oneOf":
|
|
16425
|
-
return /* @__PURE__ */ (0,
|
|
16723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16426
16724
|
case "allOf":
|
|
16427
|
-
return /* @__PURE__ */ (0,
|
|
16725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16428
16726
|
}
|
|
16429
|
-
return /* @__PURE__ */ (0,
|
|
16727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_jsx_runtime100.Fragment, {});
|
|
16430
16728
|
}
|
|
16431
16729
|
var GenericSchema_default = GenericSchemaForm;
|
|
16432
16730
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16453,7 +16751,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16453
16751
|
};
|
|
16454
16752
|
|
|
16455
16753
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16456
|
-
var
|
|
16754
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
16457
16755
|
function DynamicForm({
|
|
16458
16756
|
component,
|
|
16459
16757
|
model = null,
|
|
@@ -16463,7 +16761,7 @@ function DynamicForm({
|
|
|
16463
16761
|
onPersistAsync
|
|
16464
16762
|
}) {
|
|
16465
16763
|
const formSchema = component.schema;
|
|
16466
|
-
return /* @__PURE__ */ (0,
|
|
16764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: getMargin2(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
16467
16765
|
GenericSchema_default,
|
|
16468
16766
|
{
|
|
16469
16767
|
schema: formSchema,
|
|
@@ -16480,64 +16778,64 @@ function DynamicForm({
|
|
|
16480
16778
|
var DynamicForm_default = DynamicForm;
|
|
16481
16779
|
|
|
16482
16780
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16483
|
-
var
|
|
16781
|
+
var import_components59 = require("@transferwise/components");
|
|
16484
16782
|
var import_classnames14 = __toESM(require_classnames());
|
|
16485
|
-
var
|
|
16783
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
16486
16784
|
var DynamicHeading = (props) => {
|
|
16487
16785
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16488
16786
|
const classes = (0, import_classnames14.default)(getTextAlignmentAndMargin2({ align, margin }));
|
|
16489
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
16787
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(DisplayHeading2, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(StandardHeading2, { size, text, classes });
|
|
16490
16788
|
};
|
|
16491
16789
|
var StandardHeading2 = ({ size, text, classes }) => {
|
|
16492
16790
|
switch (size) {
|
|
16493
16791
|
case "xs":
|
|
16494
|
-
return /* @__PURE__ */ (0,
|
|
16792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h5", { className: classes, children: text });
|
|
16495
16793
|
case "sm":
|
|
16496
|
-
return /* @__PURE__ */ (0,
|
|
16794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h4", { className: classes, children: text });
|
|
16497
16795
|
case "lg":
|
|
16498
|
-
return /* @__PURE__ */ (0,
|
|
16796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h2", { className: classes, children: text });
|
|
16499
16797
|
case "xl":
|
|
16500
|
-
return /* @__PURE__ */ (0,
|
|
16798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h1", { className: classes, children: text });
|
|
16501
16799
|
case "md":
|
|
16502
16800
|
default:
|
|
16503
|
-
return /* @__PURE__ */ (0,
|
|
16801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h3", { className: classes, children: text });
|
|
16504
16802
|
}
|
|
16505
16803
|
};
|
|
16506
16804
|
var DisplayHeading2 = ({ size, text, classes }) => {
|
|
16507
16805
|
switch (size) {
|
|
16508
16806
|
case "xs":
|
|
16509
16807
|
case "sm":
|
|
16510
|
-
return /* @__PURE__ */ (0,
|
|
16808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-small", className: classes, children: text });
|
|
16511
16809
|
case "xl":
|
|
16512
16810
|
case "lg":
|
|
16513
|
-
return /* @__PURE__ */ (0,
|
|
16811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-large", className: classes, children: text });
|
|
16514
16812
|
case "md":
|
|
16515
16813
|
default:
|
|
16516
|
-
return /* @__PURE__ */ (0,
|
|
16814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-medium", className: classes, children: text });
|
|
16517
16815
|
}
|
|
16518
16816
|
};
|
|
16519
16817
|
var DynamicHeading_default = DynamicHeading;
|
|
16520
16818
|
|
|
16521
16819
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16522
|
-
var
|
|
16523
|
-
var
|
|
16820
|
+
var import_components60 = require("@transferwise/components");
|
|
16821
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
16524
16822
|
var DynamicMarkdown = ({ component }) => {
|
|
16525
16823
|
const { content, align, margin } = component;
|
|
16526
|
-
return /* @__PURE__ */ (0,
|
|
16824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: getTextAlignmentAndMargin2({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_components60.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
16527
16825
|
};
|
|
16528
16826
|
var DynamicInfo = ({ component }) => {
|
|
16529
|
-
return /* @__PURE__ */ (0,
|
|
16827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: getTextAlignmentAndMargin2(component), children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_components60.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
16530
16828
|
};
|
|
16531
16829
|
|
|
16532
16830
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16533
|
-
var
|
|
16534
|
-
var
|
|
16535
|
-
var
|
|
16831
|
+
var import_components61 = require("@transferwise/components");
|
|
16832
|
+
var import_react47 = require("react");
|
|
16833
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
16536
16834
|
function DynamicImage({ component: image }) {
|
|
16537
16835
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
16538
16836
|
const httpClient = useHttpClient();
|
|
16539
|
-
const [imageSource, setImageSource] = (0,
|
|
16540
|
-
(0,
|
|
16837
|
+
const [imageSource, setImageSource] = (0, import_react47.useState)("");
|
|
16838
|
+
(0, import_react47.useEffect)(() => {
|
|
16541
16839
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
16542
16840
|
}, [url, httpClient]);
|
|
16543
16841
|
const imageProps = {
|
|
@@ -16549,7 +16847,7 @@ function DynamicImage({ component: image }) {
|
|
|
16549
16847
|
if (!imageSource) {
|
|
16550
16848
|
return null;
|
|
16551
16849
|
}
|
|
16552
|
-
return /* @__PURE__ */ (0,
|
|
16850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components61.Image, __spreadValues({ className: `img-responsive ${getMargin2(margin || "md")}` }, imageProps)) });
|
|
16553
16851
|
}
|
|
16554
16852
|
var readImageBlobAsDataURL2 = (imageBlob) => (
|
|
16555
16853
|
// we can safely assume the type of reader.result is string
|
|
@@ -16585,48 +16883,48 @@ var getImageSource2 = async (httpClient, imageUrl) => {
|
|
|
16585
16883
|
var DynamicImage_default = DynamicImage;
|
|
16586
16884
|
|
|
16587
16885
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16588
|
-
var
|
|
16589
|
-
var
|
|
16886
|
+
var import_components62 = require("@transferwise/components");
|
|
16887
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
16590
16888
|
var doContext2 = ["positive", "neutral"];
|
|
16591
16889
|
var dontContext2 = ["warning", "negative"];
|
|
16592
16890
|
var DynamicInstructions = ({ component }) => {
|
|
16593
16891
|
const { items } = component;
|
|
16594
16892
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
16595
16893
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
16596
|
-
return /* @__PURE__ */ (0,
|
|
16597
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16598
|
-
/* @__PURE__ */ (0,
|
|
16894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16895
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components62.Header, { title: component.title }) : null,
|
|
16896
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components62.InstructionsList, { dos, donts })
|
|
16599
16897
|
] });
|
|
16600
16898
|
};
|
|
16601
16899
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16602
16900
|
|
|
16603
16901
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16604
|
-
var
|
|
16902
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
16605
16903
|
var getKey = (component) => JSON.stringify(component);
|
|
16606
16904
|
function DynamicLayout(props) {
|
|
16607
16905
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16608
16906
|
const renderComponent = (component) => {
|
|
16609
16907
|
switch (component.type) {
|
|
16610
16908
|
case "heading":
|
|
16611
|
-
return /* @__PURE__ */ (0,
|
|
16909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
16612
16910
|
case "paragraph":
|
|
16613
|
-
return /* @__PURE__ */ (0,
|
|
16911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
16614
16912
|
case "image":
|
|
16615
|
-
return /* @__PURE__ */ (0,
|
|
16913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
16616
16914
|
case "alert":
|
|
16617
|
-
return /* @__PURE__ */ (0,
|
|
16915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
16618
16916
|
case "review":
|
|
16619
|
-
return /* @__PURE__ */ (0,
|
|
16917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16620
16918
|
case "divider":
|
|
16621
|
-
return /* @__PURE__ */ (0,
|
|
16919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
16622
16920
|
case "info":
|
|
16623
|
-
return /* @__PURE__ */ (0,
|
|
16921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicInfo, { component }, getKey(component));
|
|
16624
16922
|
case "instructions":
|
|
16625
|
-
return /* @__PURE__ */ (0,
|
|
16923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
16626
16924
|
case "markdown":
|
|
16627
|
-
return /* @__PURE__ */ (0,
|
|
16925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
16628
16926
|
case "columns":
|
|
16629
|
-
return /* @__PURE__ */ (0,
|
|
16927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16630
16928
|
DynamicColumns_default,
|
|
16631
16929
|
{
|
|
16632
16930
|
component,
|
|
@@ -16640,7 +16938,7 @@ function DynamicLayout(props) {
|
|
|
16640
16938
|
getKey(component)
|
|
16641
16939
|
);
|
|
16642
16940
|
case "form":
|
|
16643
|
-
return /* @__PURE__ */ (0,
|
|
16941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16644
16942
|
DynamicForm_default,
|
|
16645
16943
|
{
|
|
16646
16944
|
component,
|
|
@@ -16653,9 +16951,9 @@ function DynamicLayout(props) {
|
|
|
16653
16951
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16654
16952
|
);
|
|
16655
16953
|
case "button":
|
|
16656
|
-
return /* @__PURE__ */ (0,
|
|
16954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16657
16955
|
case "box":
|
|
16658
|
-
return /* @__PURE__ */ (0,
|
|
16956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16659
16957
|
DynamicBox_default,
|
|
16660
16958
|
{
|
|
16661
16959
|
component,
|
|
@@ -16669,18 +16967,18 @@ function DynamicLayout(props) {
|
|
|
16669
16967
|
getKey(component)
|
|
16670
16968
|
);
|
|
16671
16969
|
case "decision":
|
|
16672
|
-
return /* @__PURE__ */ (0,
|
|
16970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16673
16971
|
case "external":
|
|
16674
|
-
return /* @__PURE__ */ (0,
|
|
16972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16675
16973
|
case "list":
|
|
16676
16974
|
case "status-list":
|
|
16677
|
-
return /* @__PURE__ */ (0,
|
|
16975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16678
16976
|
case "loading-indicator":
|
|
16679
|
-
return /* @__PURE__ */ (0,
|
|
16977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16680
16978
|
case "search":
|
|
16681
|
-
return /* @__PURE__ */ (0,
|
|
16979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16682
16980
|
case "modal":
|
|
16683
|
-
return /* @__PURE__ */ (0,
|
|
16981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16684
16982
|
DynamicModal_default,
|
|
16685
16983
|
{
|
|
16686
16984
|
component,
|
|
@@ -16694,22 +16992,22 @@ function DynamicLayout(props) {
|
|
|
16694
16992
|
getKey(component)
|
|
16695
16993
|
);
|
|
16696
16994
|
default:
|
|
16697
|
-
return /* @__PURE__ */ (0,
|
|
16995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", {}, getKey(component));
|
|
16698
16996
|
}
|
|
16699
16997
|
};
|
|
16700
16998
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16701
|
-
return /* @__PURE__ */ (0,
|
|
16999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_jsx_runtime106.Fragment, { children: components.map(renderComponent) });
|
|
16702
17000
|
}
|
|
16703
|
-
return /* @__PURE__ */ (0,
|
|
17001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16704
17002
|
}
|
|
16705
17003
|
var DynamicLayout_default = DynamicLayout;
|
|
16706
17004
|
|
|
16707
17005
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16708
|
-
var
|
|
16709
|
-
var
|
|
17006
|
+
var import_components63 = require("@transferwise/components");
|
|
17007
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
16710
17008
|
var DynamicStatusList = ({ component }) => {
|
|
16711
|
-
return /* @__PURE__ */ (0,
|
|
16712
|
-
component.title ? /* @__PURE__ */ (0,
|
|
17009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
17010
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_components63.Header, { title: component.title }) : null,
|
|
16713
17011
|
component.items.map(mapListItemToSummary)
|
|
16714
17012
|
] });
|
|
16715
17013
|
};
|
|
@@ -16718,8 +17016,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
16718
17016
|
key: `${title}/${description || ""}`,
|
|
16719
17017
|
title,
|
|
16720
17018
|
description
|
|
16721
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
16722
|
-
return /* @__PURE__ */ (0,
|
|
17019
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
17020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_components63.Summary, __spreadValues({}, props));
|
|
16723
17021
|
};
|
|
16724
17022
|
var statusListMap = {
|
|
16725
17023
|
done: "done",
|
|
@@ -16735,12 +17033,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
|
|
|
16735
17033
|
var DynamicStatusList_default = DynamicStatusList;
|
|
16736
17034
|
|
|
16737
17035
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16738
|
-
var
|
|
16739
|
-
var
|
|
17036
|
+
var import_components64 = require("@transferwise/components");
|
|
17037
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
16740
17038
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16741
17039
|
const { margin = "md", size = "md" } = component;
|
|
16742
|
-
return /* @__PURE__ */ (0,
|
|
16743
|
-
|
|
17040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
17041
|
+
import_components64.Loader,
|
|
16744
17042
|
{
|
|
16745
17043
|
size,
|
|
16746
17044
|
classNames: {
|
|
@@ -16753,33 +17051,33 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
16753
17051
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
16754
17052
|
|
|
16755
17053
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16756
|
-
var
|
|
16757
|
-
var
|
|
17054
|
+
var import_components66 = require("@transferwise/components");
|
|
17055
|
+
var import_react_intl29 = require("react-intl");
|
|
16758
17056
|
|
|
16759
17057
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16760
|
-
var
|
|
16761
|
-
var
|
|
17058
|
+
var import_components65 = require("@transferwise/components");
|
|
17059
|
+
var import_react48 = require("react");
|
|
16762
17060
|
function useSnackBarIfAvailable2() {
|
|
16763
|
-
const context = (0,
|
|
17061
|
+
const context = (0, import_react48.useContext)(import_components65.SnackbarContext);
|
|
16764
17062
|
return context ? context.createSnackbar : noop3;
|
|
16765
17063
|
}
|
|
16766
17064
|
function noop3() {
|
|
16767
17065
|
}
|
|
16768
17066
|
|
|
16769
17067
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16770
|
-
var
|
|
17068
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
16771
17069
|
function DynamicParagraph({ component }) {
|
|
16772
|
-
return component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
17070
|
+
return component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(BasicDynamicParagraph, { component });
|
|
16773
17071
|
}
|
|
16774
17072
|
function BasicDynamicParagraph({ component }) {
|
|
16775
|
-
return /* @__PURE__ */ (0,
|
|
17073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("p", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16776
17074
|
" ",
|
|
16777
17075
|
component.text,
|
|
16778
17076
|
" "
|
|
16779
17077
|
] });
|
|
16780
17078
|
}
|
|
16781
17079
|
function CopyableDynamicParagraph({ component }) {
|
|
16782
|
-
const { formatMessage } = (0,
|
|
17080
|
+
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
16783
17081
|
const createSnackbar = useSnackBarIfAvailable2();
|
|
16784
17082
|
const { text } = component;
|
|
16785
17083
|
const copy = () => {
|
|
@@ -16790,8 +17088,8 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16790
17088
|
align: component.align,
|
|
16791
17089
|
margin: "sm"
|
|
16792
17090
|
})} form-control`;
|
|
16793
|
-
return /* @__PURE__ */ (0,
|
|
16794
|
-
/* @__PURE__ */ (0,
|
|
17091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: getTextAlignmentAndMargin2(component), children: [
|
|
17092
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
16795
17093
|
"input",
|
|
16796
17094
|
{
|
|
16797
17095
|
type: "text",
|
|
@@ -16801,7 +17099,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16801
17099
|
style: { textOverflow: "ellipsis" }
|
|
16802
17100
|
}
|
|
16803
17101
|
),
|
|
16804
|
-
/* @__PURE__ */ (0,
|
|
17102
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16805
17103
|
] });
|
|
16806
17104
|
}
|
|
16807
17105
|
function noop4() {
|
|
@@ -16809,8 +17107,8 @@ function noop4() {
|
|
|
16809
17107
|
var DynamicParagraph_default = DynamicParagraph;
|
|
16810
17108
|
|
|
16811
17109
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16812
|
-
var
|
|
16813
|
-
var
|
|
17110
|
+
var import_components67 = require("@transferwise/components");
|
|
17111
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
16814
17112
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16815
17113
|
key: String(index),
|
|
16816
17114
|
title: label,
|
|
@@ -16818,14 +17116,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16818
17116
|
}));
|
|
16819
17117
|
var getFieldValue2 = (value, help, orientation) => {
|
|
16820
17118
|
if (help) {
|
|
16821
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
16822
|
-
/* @__PURE__ */ (0,
|
|
17119
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
17120
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Help_default2, { help }),
|
|
16823
17121
|
" ",
|
|
16824
17122
|
value
|
|
16825
|
-
] }) : /* @__PURE__ */ (0,
|
|
17123
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
16826
17124
|
value,
|
|
16827
17125
|
" ",
|
|
16828
|
-
/* @__PURE__ */ (0,
|
|
17126
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Help_default2, { help })
|
|
16829
17127
|
] });
|
|
16830
17128
|
}
|
|
16831
17129
|
return value;
|
|
@@ -16850,25 +17148,25 @@ function DynamicReview(props) {
|
|
|
16850
17148
|
const orientation = getReviewLayout(review);
|
|
16851
17149
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
16852
17150
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
16853
|
-
return /* @__PURE__ */ (0,
|
|
16854
|
-
review.title && /* @__PURE__ */ (0,
|
|
16855
|
-
/* @__PURE__ */ (0,
|
|
17151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: margin, children: [
|
|
17152
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_components67.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
17153
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_components67.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
16856
17154
|
] });
|
|
16857
17155
|
}
|
|
16858
17156
|
var DynamicReview_default = DynamicReview;
|
|
16859
17157
|
|
|
16860
17158
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16861
|
-
var
|
|
17159
|
+
var import_react50 = require("react");
|
|
16862
17160
|
var import_icons5 = require("@transferwise/icons");
|
|
16863
17161
|
|
|
16864
17162
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16865
|
-
var
|
|
16866
|
-
var
|
|
17163
|
+
var import_components68 = require("@transferwise/components");
|
|
17164
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16867
17165
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16868
|
-
return /* @__PURE__ */ (0,
|
|
17166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16869
17167
|
title,
|
|
16870
|
-
/* @__PURE__ */ (0,
|
|
16871
|
-
|
|
17168
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
17169
|
+
import_components68.Input,
|
|
16872
17170
|
{
|
|
16873
17171
|
type: "text",
|
|
16874
17172
|
value,
|
|
@@ -16881,15 +17179,15 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16881
17179
|
};
|
|
16882
17180
|
|
|
16883
17181
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16884
|
-
var
|
|
16885
|
-
var
|
|
16886
|
-
var
|
|
17182
|
+
var import_components69 = require("@transferwise/components");
|
|
17183
|
+
var import_react_intl30 = require("react-intl");
|
|
17184
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16887
17185
|
function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
16888
17186
|
if (results.length === 0) {
|
|
16889
|
-
return /* @__PURE__ */ (0,
|
|
17187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
16890
17188
|
}
|
|
16891
|
-
return /* @__PURE__ */ (0,
|
|
16892
|
-
|
|
17189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.NavigationOptionsList, { children: results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
17190
|
+
import_components69.NavigationOption,
|
|
16893
17191
|
{
|
|
16894
17192
|
title: result.title,
|
|
16895
17193
|
content: result.description,
|
|
@@ -16902,11 +17200,11 @@ function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
|
16902
17200
|
)) });
|
|
16903
17201
|
}
|
|
16904
17202
|
function ErrorResult2({ onRetrySearch }) {
|
|
16905
|
-
const intl = (0,
|
|
16906
|
-
return /* @__PURE__ */ (0,
|
|
17203
|
+
const intl = (0, import_react_intl30.useIntl)();
|
|
17204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("p", { className: "m-t-2", children: [
|
|
16907
17205
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16908
17206
|
"\xA0",
|
|
16909
|
-
/* @__PURE__ */ (0,
|
|
17207
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16910
17208
|
"a",
|
|
16911
17209
|
{
|
|
16912
17210
|
href: "/",
|
|
@@ -16921,15 +17219,15 @@ function ErrorResult2({ onRetrySearch }) {
|
|
|
16921
17219
|
}
|
|
16922
17220
|
|
|
16923
17221
|
// src/legacy/layout/search/useSearch.tsx
|
|
16924
|
-
var
|
|
17222
|
+
var import_react49 = require("react");
|
|
16925
17223
|
var headers = { "Content-Type": "application/json" };
|
|
16926
17224
|
var useSearch = (defaultSearchConfig) => {
|
|
16927
|
-
const [state, setState] = (0,
|
|
17225
|
+
const [state, setState] = (0, import_react49.useState)({
|
|
16928
17226
|
status: "idle"
|
|
16929
17227
|
});
|
|
16930
|
-
const abortControllerRef = (0,
|
|
17228
|
+
const abortControllerRef = (0, import_react49.useRef)(null);
|
|
16931
17229
|
const httpClient = useHttpClient();
|
|
16932
|
-
const search = (0,
|
|
17230
|
+
const search = (0, import_react49.useCallback)(
|
|
16933
17231
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
16934
17232
|
var _a;
|
|
16935
17233
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -16990,16 +17288,16 @@ var addQueryParameter2 = (url, key, value) => {
|
|
|
16990
17288
|
};
|
|
16991
17289
|
|
|
16992
17290
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16993
|
-
var
|
|
17291
|
+
var import_components70 = require("@transferwise/components");
|
|
16994
17292
|
var import_classnames15 = __toESM(require_classnames());
|
|
16995
|
-
var
|
|
17293
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
16996
17294
|
var DEBOUNCE_TIME2 = 400;
|
|
16997
17295
|
function DynamicSearch({ component, onAction }) {
|
|
16998
|
-
const [query, setQuery] = (0,
|
|
17296
|
+
const [query, setQuery] = (0, import_react50.useState)("");
|
|
16999
17297
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
17000
17298
|
const { status, results, search } = useSearch({ url, method, param });
|
|
17001
17299
|
const onEvent = useEventDispatcher();
|
|
17002
|
-
const debouncedSearch = (0,
|
|
17300
|
+
const debouncedSearch = (0, import_react50.useMemo)(() => debounce2(search, DEBOUNCE_TIME2), [search]);
|
|
17003
17301
|
const onSearchStart = () => {
|
|
17004
17302
|
onEvent("Dynamic Flow - Search Started", {});
|
|
17005
17303
|
};
|
|
@@ -17028,16 +17326,16 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17028
17326
|
void search(query);
|
|
17029
17327
|
};
|
|
17030
17328
|
if (control === "inline") {
|
|
17031
|
-
return /* @__PURE__ */ (0,
|
|
17329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: (0, import_classnames15.default)(getMargin2(margin != null ? margin : "md"), "df-search-typeahead"), children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("label", { className: "control-label d-inline", children: [
|
|
17032
17330
|
title,
|
|
17033
|
-
/* @__PURE__ */ (0,
|
|
17034
|
-
|
|
17331
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "m-t-1", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17332
|
+
import_components70.Typeahead,
|
|
17035
17333
|
{
|
|
17036
17334
|
id: "typeahead-input-id",
|
|
17037
17335
|
name: "typeahead-input-name",
|
|
17038
17336
|
size: "md",
|
|
17039
17337
|
maxHeight: 100,
|
|
17040
|
-
footer: /* @__PURE__ */ (0,
|
|
17338
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17041
17339
|
TypeaheadFooter2,
|
|
17042
17340
|
{
|
|
17043
17341
|
state: status,
|
|
@@ -17048,7 +17346,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17048
17346
|
),
|
|
17049
17347
|
multiple: false,
|
|
17050
17348
|
clearable: false,
|
|
17051
|
-
addon: /* @__PURE__ */ (0,
|
|
17349
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_icons5.Search, { size: 24 }),
|
|
17052
17350
|
options: results.map(mapResultToTypeaheadOption2),
|
|
17053
17351
|
onChange: (values) => {
|
|
17054
17352
|
if (values.length > 0) {
|
|
@@ -17063,11 +17361,11 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17063
17361
|
) })
|
|
17064
17362
|
] }) });
|
|
17065
17363
|
}
|
|
17066
|
-
return /* @__PURE__ */ (0,
|
|
17067
|
-
/* @__PURE__ */ (0,
|
|
17068
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
17069
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
17070
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
17364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: getMargin2(margin != null ? margin : "md"), children: [
|
|
17365
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
17366
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
17367
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ErrorResult2, { onRetrySearch }),
|
|
17368
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(SearchResults2, { results, emptyMessage, onSelect: onResultSelected })
|
|
17071
17369
|
] });
|
|
17072
17370
|
}
|
|
17073
17371
|
function mapResultToTypeaheadOption2(result) {
|
|
@@ -17086,35 +17384,35 @@ function TypeaheadFooter2({
|
|
|
17086
17384
|
emptyMessage
|
|
17087
17385
|
}) {
|
|
17088
17386
|
if (state === "success" && results.length === 0) {
|
|
17089
|
-
return /* @__PURE__ */ (0,
|
|
17387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components70.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: emptyMessage });
|
|
17090
17388
|
}
|
|
17091
17389
|
if (state === "error" && results.length === 0) {
|
|
17092
|
-
return /* @__PURE__ */ (0,
|
|
17390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ErrorResult2, { onRetrySearch }) });
|
|
17093
17391
|
}
|
|
17094
17392
|
if (state === "loading" || results.length === 0) {
|
|
17095
|
-
return /* @__PURE__ */ (0,
|
|
17393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
17096
17394
|
}
|
|
17097
17395
|
return null;
|
|
17098
17396
|
}
|
|
17099
17397
|
var DynamicSearch_default = DynamicSearch;
|
|
17100
17398
|
|
|
17101
17399
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
17102
|
-
var
|
|
17103
|
-
var
|
|
17104
|
-
var
|
|
17400
|
+
var import_components71 = require("@transferwise/components");
|
|
17401
|
+
var import_react51 = require("react");
|
|
17402
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
17105
17403
|
function DynamicModal(props) {
|
|
17106
|
-
const [visible, isVisible] = (0,
|
|
17404
|
+
const [visible, isVisible] = (0, import_react51.useState)(false);
|
|
17107
17405
|
const { component, onAction } = props;
|
|
17108
17406
|
const { margin = "md" } = component;
|
|
17109
|
-
return /* @__PURE__ */ (0,
|
|
17110
|
-
/* @__PURE__ */ (0,
|
|
17111
|
-
/* @__PURE__ */ (0,
|
|
17112
|
-
|
|
17407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: getTextAlignmentAndMargin2({ margin }), children: [
|
|
17408
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_components71.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
17409
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17410
|
+
import_components71.Modal,
|
|
17113
17411
|
{
|
|
17114
17412
|
scroll: "content",
|
|
17115
17413
|
open: visible,
|
|
17116
17414
|
size: "lg",
|
|
17117
|
-
body: /* @__PURE__ */ (0,
|
|
17415
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17118
17416
|
DynamicLayout_default,
|
|
17119
17417
|
__spreadProps(__spreadValues({}, props), {
|
|
17120
17418
|
components: component.content.components,
|
|
@@ -17132,7 +17430,7 @@ function DynamicModal(props) {
|
|
|
17132
17430
|
var DynamicModal_default = DynamicModal;
|
|
17133
17431
|
|
|
17134
17432
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
17135
|
-
var
|
|
17433
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
17136
17434
|
var isNullish3 = (value) => isNull3(value) || isUndefined3(value);
|
|
17137
17435
|
var getDefaultValue = (schema) => {
|
|
17138
17436
|
return schema.type === "boolean" && isNullish3(schema.default) ? false : schema.default;
|
|
@@ -17170,13 +17468,13 @@ var BasicTypeSchema = (props) => {
|
|
|
17170
17468
|
props.onBlur();
|
|
17171
17469
|
}
|
|
17172
17470
|
};
|
|
17173
|
-
const [model, setModel] = (0,
|
|
17174
|
-
const [lastModel, setLastModel] = (0,
|
|
17175
|
-
const [changed, setChanged] = (0,
|
|
17176
|
-
const [focused, setFocused] = (0,
|
|
17177
|
-
const [blurred, setBlurred] = (0,
|
|
17178
|
-
const [validations, setValidations] = (0,
|
|
17179
|
-
const id = (0,
|
|
17471
|
+
const [model, setModel] = (0, import_react52.useState)((_a = props.model) != null ? _a : null);
|
|
17472
|
+
const [lastModel, setLastModel] = (0, import_react52.useState)((_b = props.model) != null ? _b : null);
|
|
17473
|
+
const [changed, setChanged] = (0, import_react52.useState)(false);
|
|
17474
|
+
const [focused, setFocused] = (0, import_react52.useState)(false);
|
|
17475
|
+
const [blurred, setBlurred] = (0, import_react52.useState)(false);
|
|
17476
|
+
const [validations, setValidations] = (0, import_react52.useState)([]);
|
|
17477
|
+
const id = (0, import_react52.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
17180
17478
|
const onSchemaChange = () => {
|
|
17181
17479
|
const defaultValue = getDefaultValue(props.schema);
|
|
17182
17480
|
if (isNullish3(model) && !isNullish3(defaultValue)) {
|
|
@@ -17191,9 +17489,9 @@ var BasicTypeSchema = (props) => {
|
|
|
17191
17489
|
};
|
|
17192
17490
|
const isConst = props.schema.const;
|
|
17193
17491
|
const isHidden = props.schema.hidden || isConst;
|
|
17194
|
-
(0,
|
|
17195
|
-
(0,
|
|
17196
|
-
(0,
|
|
17492
|
+
(0, import_react52.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
17493
|
+
(0, import_react52.useEffect)(onSchemaChange, [props.schema]);
|
|
17494
|
+
(0, import_react52.useEffect)(() => {
|
|
17197
17495
|
var _a2;
|
|
17198
17496
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
17199
17497
|
if (newModel !== model) {
|
|
@@ -17208,15 +17506,15 @@ var BasicTypeSchema = (props) => {
|
|
|
17208
17506
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
17209
17507
|
const schemaHelp = props.schema.help;
|
|
17210
17508
|
const feedbackId = `${id}-feedback`;
|
|
17211
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
17212
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
17213
|
-
/* @__PURE__ */ (0,
|
|
17214
|
-
showLabel && /* @__PURE__ */ (0,
|
|
17215
|
-
/* @__PURE__ */ (0,
|
|
17216
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
17509
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(import_jsx_runtime115.Fragment, { children: [
|
|
17510
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
17511
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: (0, import_classnames16.default)(formGroupClasses), children: [
|
|
17512
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
17513
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
17514
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Help_default2, { help: schemaHelp })
|
|
17217
17515
|
] }),
|
|
17218
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
17219
|
-
/* @__PURE__ */ (0,
|
|
17516
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Help_default2, { help: schemaHelp }),
|
|
17517
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17220
17518
|
SchemaFormControl_default,
|
|
17221
17519
|
{
|
|
17222
17520
|
id,
|
|
@@ -17229,7 +17527,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17229
17527
|
describedBy: feedbackId
|
|
17230
17528
|
}
|
|
17231
17529
|
),
|
|
17232
|
-
/* @__PURE__ */ (0,
|
|
17530
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17233
17531
|
ControlFeedback_default,
|
|
17234
17532
|
{
|
|
17235
17533
|
id: feedbackId,
|
|
@@ -17254,7 +17552,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
17254
17552
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17255
17553
|
|
|
17256
17554
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17257
|
-
var
|
|
17555
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17258
17556
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17259
17557
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17260
17558
|
var _a;
|
|
@@ -17269,15 +17567,15 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
17269
17567
|
]);
|
|
17270
17568
|
function PersistAsyncBasicSchema(props) {
|
|
17271
17569
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
17272
|
-
const intl = (0,
|
|
17570
|
+
const intl = (0, import_react_intl31.useIntl)();
|
|
17273
17571
|
const httpClient = useHttpClient();
|
|
17274
17572
|
const onEvent = useEventDispatcher();
|
|
17275
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
17573
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react53.useState)(null);
|
|
17276
17574
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17277
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
17278
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
17279
|
-
const [abortController, setAbortController] = (0,
|
|
17280
|
-
(0,
|
|
17575
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react53.useState)(null);
|
|
17576
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react53.useState)(false);
|
|
17577
|
+
const [abortController, setAbortController] = (0, import_react53.useState)(null);
|
|
17578
|
+
(0, import_react53.useEffect)(() => {
|
|
17281
17579
|
if (controlTypesWithPersistOnChange.has(
|
|
17282
17580
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
17283
17581
|
getControlType(schema.persistAsync.schema)
|
|
@@ -17344,7 +17642,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17344
17642
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17345
17643
|
}
|
|
17346
17644
|
};
|
|
17347
|
-
return /* @__PURE__ */ (0,
|
|
17645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17348
17646
|
BasicTypeSchema_default,
|
|
17349
17647
|
{
|
|
17350
17648
|
required,
|
|
@@ -17365,9 +17663,9 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17365
17663
|
|
|
17366
17664
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17367
17665
|
var usePersistAsync = (persistAsync) => {
|
|
17368
|
-
const [abortController, setAbortController] = (0,
|
|
17666
|
+
const [abortController, setAbortController] = (0, import_react54.useState)(null);
|
|
17369
17667
|
const httpClient = useHttpClient();
|
|
17370
|
-
const intl = (0,
|
|
17668
|
+
const intl = (0, import_react_intl32.useIntl)();
|
|
17371
17669
|
const { schema } = persistAsync;
|
|
17372
17670
|
async function handlePersistAsync(model) {
|
|
17373
17671
|
const isInvalidSchema = model instanceof Blob ? !isBlobSchema2(schema) : !isValidSchema(model, schema);
|
|
@@ -17444,7 +17742,7 @@ function hasStringMessage(value) {
|
|
|
17444
17742
|
}
|
|
17445
17743
|
|
|
17446
17744
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
17447
|
-
var
|
|
17745
|
+
var import_react55 = require("react");
|
|
17448
17746
|
function usePolling({
|
|
17449
17747
|
asyncFn,
|
|
17450
17748
|
interval,
|
|
@@ -17453,9 +17751,9 @@ function usePolling({
|
|
|
17453
17751
|
onPollingResponse,
|
|
17454
17752
|
onFailure
|
|
17455
17753
|
}) {
|
|
17456
|
-
const onPollingResponseReference = (0,
|
|
17457
|
-
const onFailureReference = (0,
|
|
17458
|
-
const poll = (0,
|
|
17754
|
+
const onPollingResponseReference = (0, import_react55.useRef)(onPollingResponse);
|
|
17755
|
+
const onFailureReference = (0, import_react55.useRef)(onFailure);
|
|
17756
|
+
const poll = (0, import_react55.useMemo)(
|
|
17459
17757
|
() => createPollingClosure(
|
|
17460
17758
|
asyncFn,
|
|
17461
17759
|
maxAttempts,
|
|
@@ -17465,7 +17763,7 @@ function usePolling({
|
|
|
17465
17763
|
),
|
|
17466
17764
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
17467
17765
|
);
|
|
17468
|
-
(0,
|
|
17766
|
+
(0, import_react55.useEffect)(() => {
|
|
17469
17767
|
if (interval > 0) {
|
|
17470
17768
|
const intervalReference = setInterval(() => {
|
|
17471
17769
|
poll();
|
|
@@ -17473,7 +17771,7 @@ function usePolling({
|
|
|
17473
17771
|
return () => clearInterval(intervalReference);
|
|
17474
17772
|
}
|
|
17475
17773
|
}, [poll, interval]);
|
|
17476
|
-
(0,
|
|
17774
|
+
(0, import_react55.useEffect)(() => {
|
|
17477
17775
|
onPollingResponseReference.current = onPollingResponse;
|
|
17478
17776
|
onFailureReference.current = onFailure;
|
|
17479
17777
|
}, [onPollingResponse, onFailure]);
|
|
@@ -17504,20 +17802,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
17504
17802
|
}
|
|
17505
17803
|
|
|
17506
17804
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
17507
|
-
var
|
|
17805
|
+
var import_react56 = require("react");
|
|
17508
17806
|
var usePrevious = (value) => {
|
|
17509
|
-
const reference = (0,
|
|
17510
|
-
(0,
|
|
17807
|
+
const reference = (0, import_react56.useRef)();
|
|
17808
|
+
(0, import_react56.useEffect)(() => {
|
|
17511
17809
|
reference.current = value;
|
|
17512
17810
|
}, [value]);
|
|
17513
17811
|
return reference.current;
|
|
17514
17812
|
};
|
|
17515
17813
|
|
|
17516
17814
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
17517
|
-
var
|
|
17815
|
+
var import_react57 = require("react");
|
|
17518
17816
|
function useStepPolling(polling, onAction) {
|
|
17519
17817
|
const httpClient = useHttpClient();
|
|
17520
|
-
const asyncFn = (0,
|
|
17818
|
+
const asyncFn = (0, import_react57.useMemo)(() => {
|
|
17521
17819
|
if (polling) {
|
|
17522
17820
|
return () => httpClient(polling.url).then((response) => {
|
|
17523
17821
|
if (response.ok) {
|
|
@@ -17530,7 +17828,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17530
17828
|
}
|
|
17531
17829
|
return void 0;
|
|
17532
17830
|
}, [polling, httpClient]);
|
|
17533
|
-
const onPollingResponse = (0,
|
|
17831
|
+
const onPollingResponse = (0, import_react57.useCallback)(
|
|
17534
17832
|
(pollingResponse) => {
|
|
17535
17833
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
17536
17834
|
onAction(pollingResponse.action);
|
|
@@ -17546,7 +17844,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17546
17844
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
17547
17845
|
maxConsecutiveFails: 1,
|
|
17548
17846
|
onPollingResponse,
|
|
17549
|
-
onFailure: (0,
|
|
17847
|
+
onFailure: (0, import_react57.useCallback)(() => {
|
|
17550
17848
|
if (polling) {
|
|
17551
17849
|
onAction(polling.onError.action);
|
|
17552
17850
|
}
|
|
@@ -17555,7 +17853,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17555
17853
|
}
|
|
17556
17854
|
|
|
17557
17855
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17558
|
-
var
|
|
17856
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
17559
17857
|
var getComponents = (step, options) => {
|
|
17560
17858
|
var _a;
|
|
17561
17859
|
if (isEmpty(step)) {
|
|
@@ -17578,7 +17876,7 @@ var LayoutStep = (props) => {
|
|
|
17578
17876
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17579
17877
|
};
|
|
17580
17878
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17581
|
-
return /* @__PURE__ */ (0,
|
|
17879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17582
17880
|
DynamicLayout_default,
|
|
17583
17881
|
{
|
|
17584
17882
|
components,
|
|
@@ -17594,16 +17892,16 @@ var LayoutStep = (props) => {
|
|
|
17594
17892
|
var LayoutStep_default = LayoutStep;
|
|
17595
17893
|
|
|
17596
17894
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17597
|
-
var
|
|
17895
|
+
var import_react62 = require("react");
|
|
17598
17896
|
|
|
17599
17897
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17600
|
-
var
|
|
17601
|
-
var
|
|
17898
|
+
var import_react61 = require("react");
|
|
17899
|
+
var import_react_intl37 = require("react-intl");
|
|
17602
17900
|
var import_react_webcam = __toESM(require("react-webcam"));
|
|
17603
17901
|
|
|
17604
17902
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
17605
|
-
var
|
|
17606
|
-
var CameraCapture_messages_default = (0,
|
|
17903
|
+
var import_react_intl33 = require("react-intl");
|
|
17904
|
+
var CameraCapture_messages_default = (0, import_react_intl33.defineMessages)({
|
|
17607
17905
|
reviewSubmit: {
|
|
17608
17906
|
id: "dynamicFlows.CameraCapture.reviewSubmit",
|
|
17609
17907
|
defaultMessage: "Yes, submit",
|
|
@@ -17662,58 +17960,58 @@ var CameraCapture_messages_default = (0, import_react_intl32.defineMessages)({
|
|
|
17662
17960
|
});
|
|
17663
17961
|
|
|
17664
17962
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17665
|
-
var
|
|
17666
|
-
var
|
|
17667
|
-
var
|
|
17668
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
17963
|
+
var import_components72 = require("@transferwise/components");
|
|
17964
|
+
var import_react_intl34 = require("react-intl");
|
|
17965
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
17966
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
17669
17967
|
var ReviewBottomBar = ({
|
|
17670
17968
|
onSubmit,
|
|
17671
17969
|
onRetry
|
|
17672
17970
|
}) => {
|
|
17673
|
-
const intl = (0,
|
|
17674
|
-
return /* @__PURE__ */ (0,
|
|
17675
|
-
/* @__PURE__ */ (0,
|
|
17676
|
-
|
|
17971
|
+
const intl = (0, import_react_intl34.useIntl)();
|
|
17972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
17973
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17974
|
+
import_components72.Button,
|
|
17677
17975
|
{
|
|
17678
17976
|
className: "m-b-1",
|
|
17679
17977
|
block: true,
|
|
17680
|
-
size:
|
|
17681
|
-
type:
|
|
17978
|
+
size: import_components72.Size.MEDIUM,
|
|
17979
|
+
type: import_components72.ControlType.ACCENT,
|
|
17682
17980
|
onClick: onSubmit,
|
|
17683
17981
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17684
17982
|
}
|
|
17685
17983
|
),
|
|
17686
|
-
/* @__PURE__ */ (0,
|
|
17687
|
-
|
|
17984
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17985
|
+
import_components72.Button,
|
|
17688
17986
|
{
|
|
17689
17987
|
className: "m-b-2",
|
|
17690
17988
|
block: true,
|
|
17691
|
-
size:
|
|
17692
|
-
type:
|
|
17693
|
-
priority:
|
|
17989
|
+
size: import_components72.Size.MEDIUM,
|
|
17990
|
+
type: import_components72.ControlType.ACCENT,
|
|
17991
|
+
priority: import_components72.Priority.SECONDARY,
|
|
17694
17992
|
onClick: onRetry,
|
|
17695
17993
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
17696
17994
|
}
|
|
17697
17995
|
)
|
|
17698
17996
|
] }) }) });
|
|
17699
17997
|
};
|
|
17700
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
17998
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17701
17999
|
"button",
|
|
17702
18000
|
{
|
|
17703
18001
|
type: "button",
|
|
17704
18002
|
className: "camera-capture-btn m-b-2",
|
|
17705
18003
|
"data-testid": "camera-capture-button",
|
|
17706
18004
|
onClick,
|
|
17707
|
-
children: /* @__PURE__ */ (0,
|
|
18005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
17708
18006
|
}
|
|
17709
18007
|
);
|
|
17710
18008
|
|
|
17711
18009
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17712
|
-
var
|
|
18010
|
+
var import_react_intl36 = require("react-intl");
|
|
17713
18011
|
|
|
17714
18012
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
17715
|
-
var
|
|
17716
|
-
var OrientationLockOverlay_messages_default = (0,
|
|
18013
|
+
var import_react_intl35 = require("react-intl");
|
|
18014
|
+
var OrientationLockOverlay_messages_default = (0, import_react_intl35.defineMessages)({
|
|
17717
18015
|
text: {
|
|
17718
18016
|
id: "dynamicFlows.CameraCapture.rotatePhone.text",
|
|
17719
18017
|
defaultMessage: "Rotate your phone to portrait view to take a photo",
|
|
@@ -17722,11 +18020,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl34.defineMess
|
|
|
17722
18020
|
});
|
|
17723
18021
|
|
|
17724
18022
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17725
|
-
var
|
|
18023
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
17726
18024
|
function OrientationLockOverlay() {
|
|
17727
|
-
const intl = (0,
|
|
17728
|
-
return /* @__PURE__ */ (0,
|
|
17729
|
-
/* @__PURE__ */ (0,
|
|
18025
|
+
const intl = (0, import_react_intl36.useIntl)();
|
|
18026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
18027
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
17730
18028
|
"img",
|
|
17731
18029
|
{
|
|
17732
18030
|
className: "m-b-3",
|
|
@@ -17736,25 +18034,25 @@ function OrientationLockOverlay() {
|
|
|
17736
18034
|
alt: ""
|
|
17737
18035
|
}
|
|
17738
18036
|
),
|
|
17739
|
-
/* @__PURE__ */ (0,
|
|
18037
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17740
18038
|
] });
|
|
17741
18039
|
}
|
|
17742
18040
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17743
18041
|
|
|
17744
18042
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17745
|
-
var
|
|
17746
|
-
var
|
|
18043
|
+
var import_components73 = require("@transferwise/components");
|
|
18044
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
17747
18045
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17748
|
-
return /* @__PURE__ */ (0,
|
|
17749
|
-
/* @__PURE__ */ (0,
|
|
17750
|
-
/* @__PURE__ */ (0,
|
|
17751
|
-
onAction && actionButton && /* @__PURE__ */ (0,
|
|
18046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
18047
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
18048
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
|
|
18049
|
+
onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_components73.Button, { block: true, onClick: onAction, children: actionButton })
|
|
17752
18050
|
] }) }) });
|
|
17753
18051
|
}
|
|
17754
18052
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
17755
18053
|
|
|
17756
18054
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17757
|
-
var
|
|
18055
|
+
var import_react58 = require("react");
|
|
17758
18056
|
var import_screenfull = __toESM(require_screenfull());
|
|
17759
18057
|
|
|
17760
18058
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
@@ -17833,16 +18131,19 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17833
18131
|
|
|
17834
18132
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17835
18133
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17836
|
-
const lockOrientation = (0,
|
|
18134
|
+
const lockOrientation = (0, import_react58.useCallback)(() => {
|
|
17837
18135
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17838
|
-
window.screen.orientation.lock("portrait")
|
|
18136
|
+
const lockPromise = window.screen.orientation.lock("portrait");
|
|
18137
|
+
if (lockPromise instanceof Promise) {
|
|
18138
|
+
lockPromise.then(() => trackCameraOrientationLocked(onEvent)).catch(noop5);
|
|
18139
|
+
}
|
|
17839
18140
|
}
|
|
17840
18141
|
}, [onEvent]);
|
|
17841
|
-
const unlockOrientation = (0,
|
|
18142
|
+
const unlockOrientation = (0, import_react58.useCallback)(() => {
|
|
17842
18143
|
var _a, _b, _c;
|
|
17843
18144
|
return (_c = (_b = (_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) == null ? void 0 : _c.call(_b);
|
|
17844
18145
|
}, []);
|
|
17845
|
-
const enterFullScreen = (0,
|
|
18146
|
+
const enterFullScreen = (0, import_react58.useCallback)(() => {
|
|
17846
18147
|
setTimeout(() => {
|
|
17847
18148
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
17848
18149
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -17851,13 +18152,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17851
18152
|
}
|
|
17852
18153
|
}, 100);
|
|
17853
18154
|
}, [shouldLockOrientation, lockOrientation]);
|
|
17854
|
-
const exitFullScreen = (0,
|
|
18155
|
+
const exitFullScreen = (0, import_react58.useCallback)(() => {
|
|
17855
18156
|
if (import_screenfull.default.isFullscreen) {
|
|
17856
18157
|
import_screenfull.default.exit().catch(noop5);
|
|
17857
18158
|
}
|
|
17858
18159
|
unlockOrientation();
|
|
17859
18160
|
}, [unlockOrientation]);
|
|
17860
|
-
const handleOrientationChange = (0,
|
|
18161
|
+
const handleOrientationChange = (0, import_react58.useCallback)(
|
|
17861
18162
|
(event) => {
|
|
17862
18163
|
var _a, _b;
|
|
17863
18164
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -17868,7 +18169,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17868
18169
|
},
|
|
17869
18170
|
[onEvent]
|
|
17870
18171
|
);
|
|
17871
|
-
(0,
|
|
18172
|
+
(0, import_react58.useEffect)(() => {
|
|
17872
18173
|
var _a, _b;
|
|
17873
18174
|
if (shouldLockOrientation) {
|
|
17874
18175
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -17891,9 +18192,9 @@ var noop5 = () => {
|
|
|
17891
18192
|
};
|
|
17892
18193
|
|
|
17893
18194
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
17894
|
-
var
|
|
18195
|
+
var import_react59 = require("react");
|
|
17895
18196
|
var useVideoConstraints = (direction) => {
|
|
17896
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
18197
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react59.useState)();
|
|
17897
18198
|
const defaultVideoConstraints = {
|
|
17898
18199
|
facingMode: direction === "front" ? "user" : "environment",
|
|
17899
18200
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -17901,7 +18202,7 @@ var useVideoConstraints = (direction) => {
|
|
|
17901
18202
|
frameRate: 30,
|
|
17902
18203
|
aspectRatio: 16 / 9
|
|
17903
18204
|
};
|
|
17904
|
-
(0,
|
|
18205
|
+
(0, import_react59.useEffect)(() => {
|
|
17905
18206
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
17906
18207
|
}, [direction]);
|
|
17907
18208
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -17919,8 +18220,8 @@ var useVideoConstraints = (direction) => {
|
|
|
17919
18220
|
};
|
|
17920
18221
|
|
|
17921
18222
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
17922
|
-
var
|
|
17923
|
-
var
|
|
18223
|
+
var import_react60 = require("react");
|
|
18224
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
17924
18225
|
var captureButtonHeight = 92;
|
|
17925
18226
|
var reviewButtonsHeight = 120;
|
|
17926
18227
|
var imageHeight = 40;
|
|
@@ -17929,8 +18230,8 @@ var instructionsHeight = 48;
|
|
|
17929
18230
|
var reviewInstructionsHeight = 40;
|
|
17930
18231
|
var overlayMaxWidth = 800;
|
|
17931
18232
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
17932
|
-
const svgReference = (0,
|
|
17933
|
-
(0,
|
|
18233
|
+
const svgReference = (0, import_react60.useRef)(null);
|
|
18234
|
+
(0, import_react60.useEffect)(() => {
|
|
17934
18235
|
const listener = debounce2(() => {
|
|
17935
18236
|
var _a;
|
|
17936
18237
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -17942,18 +18243,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17942
18243
|
return () => window.removeEventListener("resize", listener);
|
|
17943
18244
|
});
|
|
17944
18245
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17945
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
17946
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
17947
|
-
title && /* @__PURE__ */ (0,
|
|
17948
|
-
instructions && /* @__PURE__ */ (0,
|
|
18246
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
|
|
18247
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
18248
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
18249
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
17949
18250
|
] });
|
|
17950
18251
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17951
18252
|
if (reviewInstructions) {
|
|
17952
18253
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17953
|
-
helperBox = /* @__PURE__ */ (0,
|
|
18254
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17954
18255
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17955
18256
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17956
|
-
helperBox = /* @__PURE__ */ (0,
|
|
18257
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_jsx_runtime121.Fragment, {});
|
|
17957
18258
|
}
|
|
17958
18259
|
}
|
|
17959
18260
|
const framePosition = {
|
|
@@ -17971,20 +18272,20 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17971
18272
|
width: "90%"
|
|
17972
18273
|
}
|
|
17973
18274
|
};
|
|
17974
|
-
return /* @__PURE__ */ (0,
|
|
17975
|
-
/* @__PURE__ */ (0,
|
|
17976
|
-
/* @__PURE__ */ (0,
|
|
17977
|
-
/* @__PURE__ */ (0,
|
|
18275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
18276
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("mask", { id: "mask", children: [
|
|
18277
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
18278
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
17978
18279
|
] }) }),
|
|
17979
|
-
overlay && /* @__PURE__ */ (0,
|
|
17980
|
-
outline && /* @__PURE__ */ (0,
|
|
17981
|
-
/* @__PURE__ */ (0,
|
|
18280
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
18281
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
18282
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
17982
18283
|
] });
|
|
17983
18284
|
}
|
|
17984
18285
|
var Overlay_default = Overlay;
|
|
17985
18286
|
|
|
17986
18287
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17987
|
-
var
|
|
18288
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
17988
18289
|
function CameraCapture({
|
|
17989
18290
|
direction = "back",
|
|
17990
18291
|
overlay = "",
|
|
@@ -17996,14 +18297,14 @@ function CameraCapture({
|
|
|
17996
18297
|
onCapture,
|
|
17997
18298
|
onEvent
|
|
17998
18299
|
}) {
|
|
17999
|
-
const [mode, setMode] = (0,
|
|
18000
|
-
const [cameraError, setCameraError] = (0,
|
|
18001
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
18002
|
-
const [ready, setReady] = (0,
|
|
18003
|
-
const [reviewImage, setReviewImage] = (0,
|
|
18004
|
-
const webcamReference = (0,
|
|
18300
|
+
const [mode, setMode] = (0, import_react61.useState)("CAPTURE" /* CAPTURE */);
|
|
18301
|
+
const [cameraError, setCameraError] = (0, import_react61.useState)();
|
|
18302
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react61.useState)(false);
|
|
18303
|
+
const [ready, setReady] = (0, import_react61.useState)(false);
|
|
18304
|
+
const [reviewImage, setReviewImage] = (0, import_react61.useState)();
|
|
18305
|
+
const webcamReference = (0, import_react61.useRef)(null);
|
|
18005
18306
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
18006
|
-
const shouldLockOrientation = (0,
|
|
18307
|
+
const shouldLockOrientation = (0, import_react61.useMemo)(
|
|
18007
18308
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
18008
18309
|
[mode]
|
|
18009
18310
|
);
|
|
@@ -18011,8 +18312,8 @@ function CameraCapture({
|
|
|
18011
18312
|
shouldLockOrientation,
|
|
18012
18313
|
onEvent
|
|
18013
18314
|
);
|
|
18014
|
-
const intl = (0,
|
|
18015
|
-
const handleCapture = (0,
|
|
18315
|
+
const intl = (0, import_react_intl37.useIntl)();
|
|
18316
|
+
const handleCapture = (0, import_react61.useCallback)(async () => {
|
|
18016
18317
|
var _a, _b, _c, _d, _e, _f;
|
|
18017
18318
|
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) {
|
|
18018
18319
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -18034,7 +18335,7 @@ function CameraCapture({
|
|
|
18034
18335
|
);
|
|
18035
18336
|
}
|
|
18036
18337
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
18037
|
-
const handleUserMediaError = (0,
|
|
18338
|
+
const handleUserMediaError = (0, import_react61.useCallback)(
|
|
18038
18339
|
(error) => {
|
|
18039
18340
|
setMode("ERROR" /* ERROR */);
|
|
18040
18341
|
if (error instanceof DOMException) {
|
|
@@ -18070,7 +18371,7 @@ function CameraCapture({
|
|
|
18070
18371
|
},
|
|
18071
18372
|
[intl, onEvent]
|
|
18072
18373
|
);
|
|
18073
|
-
const handleUserMedia = (0,
|
|
18374
|
+
const handleUserMedia = (0, import_react61.useCallback)(
|
|
18074
18375
|
(stream) => {
|
|
18075
18376
|
enterFullScreen();
|
|
18076
18377
|
setReady(true);
|
|
@@ -18087,13 +18388,13 @@ function CameraCapture({
|
|
|
18087
18388
|
setReviewImage(void 0);
|
|
18088
18389
|
};
|
|
18089
18390
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
18090
|
-
(0,
|
|
18391
|
+
(0, import_react61.useEffect)(() => {
|
|
18091
18392
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
18092
18393
|
exitFullScreen();
|
|
18093
18394
|
}
|
|
18094
18395
|
}, [mode, exitFullScreen]);
|
|
18095
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
18096
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
18396
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "camera-capture", children: [
|
|
18397
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18097
18398
|
import_react_webcam.default,
|
|
18098
18399
|
{
|
|
18099
18400
|
ref: webcamReference,
|
|
@@ -18104,7 +18405,7 @@ function CameraCapture({
|
|
|
18104
18405
|
onUserMedia: handleUserMedia
|
|
18105
18406
|
}
|
|
18106
18407
|
),
|
|
18107
|
-
/* @__PURE__ */ (0,
|
|
18408
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18108
18409
|
Overlay_default,
|
|
18109
18410
|
{
|
|
18110
18411
|
overlay,
|
|
@@ -18114,8 +18415,8 @@ function CameraCapture({
|
|
|
18114
18415
|
instructions
|
|
18115
18416
|
}
|
|
18116
18417
|
),
|
|
18117
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
18118
|
-
ready && /* @__PURE__ */ (0,
|
|
18418
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(OrientationLockOverlay_default, {}),
|
|
18419
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18119
18420
|
CaptureBottomBar,
|
|
18120
18421
|
{
|
|
18121
18422
|
onCapture: () => {
|
|
@@ -18124,9 +18425,9 @@ function CameraCapture({
|
|
|
18124
18425
|
}
|
|
18125
18426
|
)
|
|
18126
18427
|
] });
|
|
18127
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
18128
|
-
/* @__PURE__ */ (0,
|
|
18129
|
-
/* @__PURE__ */ (0,
|
|
18428
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { className: "camera-capture", children: [
|
|
18429
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
18430
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18130
18431
|
Overlay_default,
|
|
18131
18432
|
{
|
|
18132
18433
|
overlay,
|
|
@@ -18136,18 +18437,18 @@ function CameraCapture({
|
|
|
18136
18437
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
18137
18438
|
}
|
|
18138
18439
|
),
|
|
18139
|
-
/* @__PURE__ */ (0,
|
|
18440
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
18140
18441
|
] });
|
|
18141
|
-
return /* @__PURE__ */ (0,
|
|
18442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("section", { children: [
|
|
18142
18443
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
18143
18444
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
18144
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0,
|
|
18445
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
18145
18446
|
] });
|
|
18146
18447
|
}
|
|
18147
18448
|
var CameraCapture_default = CameraCapture;
|
|
18148
18449
|
|
|
18149
18450
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
18150
|
-
var
|
|
18451
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
18151
18452
|
function blobToBase64(blob) {
|
|
18152
18453
|
return new Promise((resolve, _) => {
|
|
18153
18454
|
const reader = new FileReader();
|
|
@@ -18165,8 +18466,8 @@ function CameraStep(props) {
|
|
|
18165
18466
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
18166
18467
|
const { overlay, outline } = assets || {};
|
|
18167
18468
|
const { url: imageUrl } = image || {};
|
|
18168
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
18169
|
-
(0,
|
|
18469
|
+
const [captureClicked, setCaptureClicked] = (0, import_react62.useState)(false);
|
|
18470
|
+
(0, import_react62.useEffect)(() => {
|
|
18170
18471
|
if (captureClicked) {
|
|
18171
18472
|
onAction(action);
|
|
18172
18473
|
}
|
|
@@ -18185,7 +18486,7 @@ function CameraStep(props) {
|
|
|
18185
18486
|
});
|
|
18186
18487
|
}
|
|
18187
18488
|
};
|
|
18188
|
-
return /* @__PURE__ */ (0,
|
|
18489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
18189
18490
|
CameraCapture_default,
|
|
18190
18491
|
{
|
|
18191
18492
|
overlay,
|
|
@@ -18234,13 +18535,13 @@ function getFirstAction(step) {
|
|
|
18234
18535
|
}
|
|
18235
18536
|
|
|
18236
18537
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18237
|
-
var
|
|
18238
|
-
var
|
|
18538
|
+
var import_react_intl38 = require("react-intl");
|
|
18539
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
18239
18540
|
var noop6 = () => {
|
|
18240
18541
|
};
|
|
18241
18542
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18242
|
-
const { formatMessage } = (0,
|
|
18243
|
-
return /* @__PURE__ */ (0,
|
|
18543
|
+
const { formatMessage } = (0, import_react_intl38.useIntl)();
|
|
18544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
18244
18545
|
DynamicLayout_default,
|
|
18245
18546
|
{
|
|
18246
18547
|
components: [
|
|
@@ -18305,11 +18606,11 @@ function getOrigin2(url) {
|
|
|
18305
18606
|
}
|
|
18306
18607
|
|
|
18307
18608
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18308
|
-
var
|
|
18609
|
+
var import_components75 = require("@transferwise/components");
|
|
18309
18610
|
var import_icons6 = require("@transferwise/icons");
|
|
18310
|
-
var
|
|
18611
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
18311
18612
|
function BackButton2({ title, action, onAction }) {
|
|
18312
|
-
return /* @__PURE__ */ (0,
|
|
18613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
18313
18614
|
"a",
|
|
18314
18615
|
{
|
|
18315
18616
|
href: "/",
|
|
@@ -18320,8 +18621,8 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18320
18621
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18321
18622
|
},
|
|
18322
18623
|
children: [
|
|
18323
|
-
/* @__PURE__ */ (0,
|
|
18324
|
-
/* @__PURE__ */ (0,
|
|
18624
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "sr-only", children: title }),
|
|
18625
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components75.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_icons6.ArrowLeft, { size: "24" }) })
|
|
18325
18626
|
]
|
|
18326
18627
|
}
|
|
18327
18628
|
);
|
|
@@ -18329,7 +18630,7 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18329
18630
|
var BackButton_default2 = BackButton2;
|
|
18330
18631
|
|
|
18331
18632
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18332
|
-
var
|
|
18633
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
18333
18634
|
function DynamicFlowStep(props) {
|
|
18334
18635
|
var _a, _b, _c;
|
|
18335
18636
|
const { step, globalError, onAction } = props;
|
|
@@ -18338,28 +18639,28 @@ function DynamicFlowStep(props) {
|
|
|
18338
18639
|
const { requiresManualTrigger, dismissConfirmation } = useExternal2(externalUrl);
|
|
18339
18640
|
if (step === void 0) {
|
|
18340
18641
|
if (globalError) {
|
|
18341
|
-
return /* @__PURE__ */ (0,
|
|
18642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18342
18643
|
}
|
|
18343
18644
|
return null;
|
|
18344
18645
|
}
|
|
18345
18646
|
if (externalUrl && requiresManualTrigger) {
|
|
18346
|
-
return /* @__PURE__ */ (0,
|
|
18647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18347
18648
|
}
|
|
18348
18649
|
if (isCameraStep(step)) {
|
|
18349
|
-
return /* @__PURE__ */ (0,
|
|
18650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18350
18651
|
}
|
|
18351
|
-
return /* @__PURE__ */ (0,
|
|
18352
|
-
backButton && /* @__PURE__ */ (0,
|
|
18353
|
-
globalError ? /* @__PURE__ */ (0,
|
|
18354
|
-
/* @__PURE__ */ (0,
|
|
18652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_jsx_runtime126.Fragment, { children: [
|
|
18653
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(BackButton_default2, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
18654
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
18655
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
18355
18656
|
] });
|
|
18356
18657
|
}
|
|
18357
18658
|
|
|
18358
18659
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
18359
|
-
var
|
|
18660
|
+
var import_react63 = require("react");
|
|
18360
18661
|
var DEBOUNCE_DELAY = 1e3;
|
|
18361
18662
|
function useDebouncedRefresh(fetchRefresh) {
|
|
18362
|
-
const map = (0,
|
|
18663
|
+
const map = (0, import_react63.useRef)(/* @__PURE__ */ new Map());
|
|
18363
18664
|
const retrieveOrCreate = (key) => {
|
|
18364
18665
|
if (map.current.has(key)) {
|
|
18365
18666
|
return map.current.get(key);
|
|
@@ -18391,12 +18692,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18391
18692
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18392
18693
|
|
|
18393
18694
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18394
|
-
var
|
|
18695
|
+
var import_react64 = require("react");
|
|
18395
18696
|
var useDynamicFlowState = (initialStep) => {
|
|
18396
18697
|
var _a, _b;
|
|
18397
|
-
const [formErrors, setFormErrors] = (0,
|
|
18398
|
-
const [globalError, setGlobalError] = (0,
|
|
18399
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
18698
|
+
const [formErrors, setFormErrors] = (0, import_react64.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
18699
|
+
const [globalError, setGlobalError] = (0, import_react64.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
18700
|
+
const [stepAndModels, setStepAndModels] = (0, import_react64.useState)({
|
|
18400
18701
|
step: initialStep || void 0,
|
|
18401
18702
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18402
18703
|
etag: void 0
|
|
@@ -18426,7 +18727,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
18426
18727
|
return updatedState;
|
|
18427
18728
|
});
|
|
18428
18729
|
};
|
|
18429
|
-
const modelIsValid = (0,
|
|
18730
|
+
const modelIsValid = (0, import_react64.useMemo)(
|
|
18430
18731
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
18431
18732
|
[models, step]
|
|
18432
18733
|
);
|
|
@@ -18498,19 +18799,19 @@ var getSchemaReference = (component) => {
|
|
|
18498
18799
|
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwnProperty.call(schema, "$ref");
|
|
18499
18800
|
|
|
18500
18801
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18501
|
-
var
|
|
18502
|
-
var
|
|
18503
|
-
var
|
|
18802
|
+
var import_components76 = require("@transferwise/components");
|
|
18803
|
+
var import_react65 = require("react");
|
|
18804
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
18504
18805
|
function useLoader(loaderConfig, initialState) {
|
|
18505
18806
|
const config = __spreadValues({
|
|
18506
|
-
size:
|
|
18807
|
+
size: import_components76.Size.EXTRA_LARGE,
|
|
18507
18808
|
initial: true,
|
|
18508
18809
|
submission: false
|
|
18509
18810
|
}, loaderConfig);
|
|
18510
|
-
const [loadingState, setLoadingState] = (0,
|
|
18811
|
+
const [loadingState, setLoadingState] = (0, import_react65.useState)(initialState);
|
|
18511
18812
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18512
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
18513
|
-
|
|
18813
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
18814
|
+
import_components76.Loader,
|
|
18514
18815
|
{
|
|
18515
18816
|
size: config.size,
|
|
18516
18817
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -18612,9 +18913,9 @@ var assertResponseIsValid2 = (response) => {
|
|
|
18612
18913
|
var isResponse2 = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
18613
18914
|
|
|
18614
18915
|
// src/legacy/dynamicFlow/utils/useErrorResponse.tsx
|
|
18615
|
-
var
|
|
18916
|
+
var import_react_intl39 = require("react-intl");
|
|
18616
18917
|
var useErrorResponse = () => {
|
|
18617
|
-
const { formatMessage } = (0,
|
|
18918
|
+
const { formatMessage } = (0, import_react_intl39.useIntl)();
|
|
18618
18919
|
return async (response, fetchType) => {
|
|
18619
18920
|
try {
|
|
18620
18921
|
const errorResponse = await parseErrorResponse(response);
|
|
@@ -18629,7 +18930,7 @@ var useErrorResponse = () => {
|
|
|
18629
18930
|
};
|
|
18630
18931
|
|
|
18631
18932
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18632
|
-
var
|
|
18933
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
18633
18934
|
var noop7 = () => {
|
|
18634
18935
|
};
|
|
18635
18936
|
var DynamicFlowComponent = ({
|
|
@@ -18657,7 +18958,7 @@ var DynamicFlowComponent = ({
|
|
|
18657
18958
|
setStepAndEtag,
|
|
18658
18959
|
setSchemaModel
|
|
18659
18960
|
} = useDynamicFlowState(initialStep);
|
|
18660
|
-
const [submitted, setSubmitted] = (0,
|
|
18961
|
+
const [submitted, setSubmitted] = (0, import_react66.useState)(false);
|
|
18661
18962
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18662
18963
|
loaderConfig,
|
|
18663
18964
|
initialStep ? "idle" : "initial"
|
|
@@ -18675,18 +18976,18 @@ var DynamicFlowComponent = ({
|
|
|
18675
18976
|
);
|
|
18676
18977
|
}
|
|
18677
18978
|
};
|
|
18678
|
-
const analyticsMetadata = (0,
|
|
18979
|
+
const analyticsMetadata = (0, import_react66.useMemo)(
|
|
18679
18980
|
() => {
|
|
18680
18981
|
var _a;
|
|
18681
18982
|
return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
|
|
18682
18983
|
},
|
|
18683
18984
|
[flowId, step]
|
|
18684
18985
|
);
|
|
18685
|
-
const dispatchEvent = (0,
|
|
18986
|
+
const dispatchEvent = (0, import_react66.useMemo)(
|
|
18686
18987
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
18687
18988
|
[onEvent, analyticsMetadata]
|
|
18688
18989
|
);
|
|
18689
|
-
const dfHttpClient = (0,
|
|
18990
|
+
const dfHttpClient = (0, import_react66.useCallback)(
|
|
18690
18991
|
({
|
|
18691
18992
|
action,
|
|
18692
18993
|
data,
|
|
@@ -18737,17 +19038,17 @@ var DynamicFlowComponent = ({
|
|
|
18737
19038
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
18738
19039
|
};
|
|
18739
19040
|
const { debouncedRefresh, isDebouncing, cancelPendingRefreshes } = useDebouncedRefresh(performRefresh);
|
|
18740
|
-
const dispatchEventAndComplete = (0,
|
|
19041
|
+
const dispatchEventAndComplete = (0, import_react66.useCallback)(
|
|
18741
19042
|
(result) => {
|
|
18742
19043
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
18743
19044
|
onCompletion(result);
|
|
18744
19045
|
},
|
|
18745
19046
|
[onCompletion, dispatchEvent]
|
|
18746
19047
|
);
|
|
18747
|
-
(0,
|
|
19048
|
+
(0, import_react66.useEffect)(() => {
|
|
18748
19049
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
18749
19050
|
}, []);
|
|
18750
|
-
(0,
|
|
19051
|
+
(0, import_react66.useEffect)(() => {
|
|
18751
19052
|
if (!initialStep) {
|
|
18752
19053
|
const action = __spreadValues({
|
|
18753
19054
|
id: "#initial-step-request",
|
|
@@ -18868,7 +19169,7 @@ var DynamicFlowComponent = ({
|
|
|
18868
19169
|
await performAction(action);
|
|
18869
19170
|
}
|
|
18870
19171
|
};
|
|
18871
|
-
return /* @__PURE__ */ (0,
|
|
19172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(DynamicFlowProvider, { loading: isLoading || isDebouncing, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
18872
19173
|
DynamicFlowStep,
|
|
18873
19174
|
{
|
|
18874
19175
|
step,
|
|
@@ -18885,7 +19186,7 @@ var DynamicFlowComponent = ({
|
|
|
18885
19186
|
) }) }) }) }) });
|
|
18886
19187
|
};
|
|
18887
19188
|
function DynamicFlow(props) {
|
|
18888
|
-
return /* @__PURE__ */ (0,
|
|
19189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
18889
19190
|
}
|
|
18890
19191
|
var DynamicFlow_default = DynamicFlow;
|
|
18891
19192
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18902,19 +19203,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18902
19203
|
};
|
|
18903
19204
|
|
|
18904
19205
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18905
|
-
var
|
|
19206
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
18906
19207
|
function JsonSchemaForm(props) {
|
|
18907
19208
|
const schemaProps = __spreadValues({
|
|
18908
19209
|
model: null,
|
|
18909
19210
|
errors: null
|
|
18910
19211
|
}, props);
|
|
18911
19212
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18912
|
-
return /* @__PURE__ */ (0,
|
|
19213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
18913
19214
|
EventsContextProvider,
|
|
18914
19215
|
{
|
|
18915
19216
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18916
19217
|
onEvent,
|
|
18917
|
-
children: /* @__PURE__ */ (0,
|
|
19218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18918
19219
|
}
|
|
18919
19220
|
) });
|
|
18920
19221
|
}
|