@wise/dynamic-flow-client 3.9.3 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +1252 -957
- package/build/main.min.js +1 -1
- package/build/main.mjs +919 -624
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.InitialAction.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.InitialStep.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.LoaderConfig.spec.d.ts +1 -0
- package/build/types/legacy/dynamicFlow/tests/DynamicFlow.legacy.spec.d.ts +1 -0
- package/build/types/legacy/formControl/FormControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArrayTypeSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/genericSchema/GenericSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/help/Help.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.spec.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.spec.d.ts +1 -0
- package/build/types/legacy/layout/DynamicLayout.end-to-end.spec.d.ts +1 -0
- package/build/types/legacy/layout/DynamicLayout.spec.d.ts +1 -0
- package/build/types/legacy/layout/alert/DynamicAlert.spec.d.ts +1 -0
- package/build/types/legacy/layout/box/DynamicBox.spec.d.ts +1 -0
- package/build/types/legacy/layout/columns/DynamicColumns.spec.d.ts +1 -0
- package/build/types/legacy/layout/decision/DynamicDecision.spec.d.ts +1 -0
- package/build/types/legacy/layout/divider/DynamicDivider.spec.d.ts +1 -0
- package/build/types/legacy/layout/external/DynamicExternal.spec.d.ts +1 -0
- package/build/types/legacy/layout/form/DynamicForm.spec.d.ts +1 -0
- package/build/types/legacy/layout/heading/DynamicHeading.spec.d.ts +1 -0
- package/build/types/legacy/layout/paragraph/DynamicParagraph.spec.d.ts +1 -0
- package/build/types/legacy/step/layoutStep/LayoutStep.spec.d.ts +1 -0
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +28 -0
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/utils/local-value.d.ts +2 -0
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +2 -1
- package/build/types/revamp/domain/features/validationAsync/getComponentValidationAsync.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.d.ts +8 -0
- package/build/types/revamp/domain/types.d.ts +4 -3
- package/build/types/revamp/renderers/mappers/multiSelectComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/types.d.ts +9 -1
- package/build/types/revamp/types.d.ts +2 -2
- package/build/types/revamp/wise/renderers/MultiSelectInputRenderer.d.ts +4 -0
- package/build/types/revamp/wise/renderers/getWiseRenderers.d.ts +1 -1
- package/package.json +4 -4
package/build/main.js
CHANGED
|
@@ -319,16 +319,10 @@ var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePa
|
|
|
319
319
|
var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
|
|
320
320
|
headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
|
|
321
321
|
});
|
|
322
|
-
var mergeHeaders = (
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const headers2 = new Headers(initHeaders);
|
|
327
|
-
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
328
|
-
headers2.set(key, value);
|
|
329
|
-
}
|
|
330
|
-
return headers2;
|
|
331
|
-
};
|
|
322
|
+
var mergeHeaders = (...headersInits) => headersInits.reduce(
|
|
323
|
+
(acc, headers2) => __spreadValues(__spreadValues({}, acc), Object.fromEntries(new Headers(headers2).entries())),
|
|
324
|
+
{}
|
|
325
|
+
);
|
|
332
326
|
|
|
333
327
|
// src/i18n/de.json
|
|
334
328
|
var de_default = {
|
|
@@ -1153,7 +1147,7 @@ var translations = {
|
|
|
1153
1147
|
var i18n_default = translations;
|
|
1154
1148
|
|
|
1155
1149
|
// src/revamp/DynamicFlowWise.tsx
|
|
1156
|
-
var
|
|
1150
|
+
var import_react21 = require("react");
|
|
1157
1151
|
|
|
1158
1152
|
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1159
1153
|
var import_react = require("react");
|
|
@@ -1713,6 +1707,17 @@ var textInputComponentToProps = (component) => __spreadProps(__spreadValues({},
|
|
|
1713
1707
|
onChange: component.onChange.bind(component)
|
|
1714
1708
|
});
|
|
1715
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
|
+
|
|
1716
1721
|
// src/revamp/renderers/mappers/uploadInputComponentToProps.ts
|
|
1717
1722
|
var uploadInputComponentToProps = (component) => {
|
|
1718
1723
|
const { accepts, maxSize } = component;
|
|
@@ -1770,6 +1775,8 @@ var componentToRendererProps = (component, nestedContent) => {
|
|
|
1770
1775
|
return markdownComponentToProps(component);
|
|
1771
1776
|
case "modal":
|
|
1772
1777
|
return modalComponentToProps(component, children);
|
|
1778
|
+
case "multi-select":
|
|
1779
|
+
return multiSelectInputComponentToProps(component);
|
|
1773
1780
|
case "multi-upload":
|
|
1774
1781
|
return multiUploadInputComponentToProps(component);
|
|
1775
1782
|
case "number":
|
|
@@ -6730,6 +6737,17 @@ var abortAndResetController = (abortController) => {
|
|
|
6730
6737
|
return new AbortController();
|
|
6731
6738
|
};
|
|
6732
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
|
+
|
|
6733
6751
|
// src/revamp/domain/features/persistAsync/getComponentPersistAsync.ts
|
|
6734
6752
|
var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
6735
6753
|
/**
|
|
@@ -6738,7 +6756,7 @@ var getComponentPersistAsync = (update, performPersistAsync) => (
|
|
|
6738
6756
|
*/
|
|
6739
6757
|
async (persistedState, currentValue) => {
|
|
6740
6758
|
const { abortController, lastSubmitted, submission } = persistedState;
|
|
6741
|
-
if (lastSubmitted
|
|
6759
|
+
if (compareLocalValue(lastSubmitted, currentValue)) {
|
|
6742
6760
|
return submission;
|
|
6743
6761
|
}
|
|
6744
6762
|
const newAbortController = abortAndResetController(abortController);
|
|
@@ -7783,7 +7801,7 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
7783
7801
|
const matchingKeys = allKeys.filter(
|
|
7784
7802
|
(key) => !isNullish(partialValue[key]) && !isNullish(componentValue[key])
|
|
7785
7803
|
);
|
|
7786
|
-
return matchingKeys.every((key) => {
|
|
7804
|
+
return matchingKeys.length > 0 && matchingKeys.every((key) => {
|
|
7787
7805
|
const componentForKey = getComponentForLocalValueKey(key, component);
|
|
7788
7806
|
return componentForKey ? isPartialLocalValueMatch(partialValue[key], componentForKey) : false;
|
|
7789
7807
|
});
|
|
@@ -7797,15 +7815,6 @@ var isPartialLocalValueMatch = (partialValue, component) => {
|
|
|
7797
7815
|
return compareLocalValue(partialValue, componentValue);
|
|
7798
7816
|
};
|
|
7799
7817
|
var areEquivalentFiles = (fileA, fileB) => fileA.name === fileB.name && fileA.type === fileB.type && fileA.size === fileB.size;
|
|
7800
|
-
var compareLocalValue = (valueA, valueB) => {
|
|
7801
|
-
if (isArrayLocalValue(valueA) && isArrayLocalValue(valueB)) {
|
|
7802
|
-
return valueA.length === valueB.length && valueA.every((value, index) => compareLocalValue(value, valueB[index]));
|
|
7803
|
-
}
|
|
7804
|
-
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
7805
|
-
return Object.keys(valueA).every((key) => compareLocalValue(valueA[key], valueB[key]));
|
|
7806
|
-
}
|
|
7807
|
-
return valueA === valueB;
|
|
7808
|
-
};
|
|
7809
7818
|
|
|
7810
7819
|
// src/revamp/domain/components/SelectInputComponent.ts
|
|
7811
7820
|
var createSelectInputComponent = (selectProps, updateComponent) => {
|
|
@@ -8773,6 +8782,193 @@ var getPersistAsyncConfig = (schema) => {
|
|
|
8773
8782
|
};
|
|
8774
8783
|
var getValueForPersistAsync = (localValue) => isArray(localValue) && localValue.every(isFile) ? localValue : [];
|
|
8775
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
|
+
|
|
8776
8972
|
// src/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.ts
|
|
8777
8973
|
var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
8778
8974
|
const { schema, model: originalModel } = schemaMapperProps;
|
|
@@ -8780,6 +8976,9 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8780
8976
|
if (isArraySchemaListWithMultiFileUpload(schema)) {
|
|
8781
8977
|
return arraySchemaToMultiUploadComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8782
8978
|
}
|
|
8979
|
+
if (isArraySchemaListWithMultiSelect(schema)) {
|
|
8980
|
+
return arraySchemaToMultiSelectComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8981
|
+
}
|
|
8783
8982
|
if (isArrayListSchema(schema)) {
|
|
8784
8983
|
return arraySchemaToRepeatableComponent(__spreadProps(__spreadValues({}, schemaMapperProps), { schema, model }), mapperProps);
|
|
8785
8984
|
}
|
|
@@ -8787,6 +8986,7 @@ var arraySchemaToComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8787
8986
|
};
|
|
8788
8987
|
var isArraySchemaListWithMultiFileUpload = (schema) => isArrayListSchema(schema) && (isPersistAsyncWithUploadSchema(schema.items) || isStringSchemaWithUpload(schema.items));
|
|
8789
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);
|
|
8790
8990
|
|
|
8791
8991
|
// src/revamp/domain/components/BooleanInputComponent.ts
|
|
8792
8992
|
var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
|
|
@@ -10224,7 +10424,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10224
10424
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10225
10425
|
}
|
|
10226
10426
|
|
|
10227
|
-
// ../../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
|
|
10228
10428
|
var import_components3 = require("@transferwise/components");
|
|
10229
10429
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10230
10430
|
var import_react7 = require("react");
|
|
@@ -11012,76 +11212,194 @@ function DFModal({ content, margin, trigger }) {
|
|
|
11012
11212
|
] });
|
|
11013
11213
|
}
|
|
11014
11214
|
|
|
11015
|
-
// src/revamp/wise/renderers/
|
|
11215
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11016
11216
|
var import_components19 = require("@transferwise/components");
|
|
11017
11217
|
|
|
11018
|
-
// src/revamp/wise/renderers/
|
|
11218
|
+
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11019
11219
|
var import_components18 = require("@transferwise/components");
|
|
11020
|
-
var import_classnames4 = __toESM(require_classnames());
|
|
11021
11220
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
11022
|
-
function
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
return
|
|
11033
|
-
"div",
|
|
11034
|
-
{
|
|
11035
|
-
className: (0, import_classnames4.default)("form-group d-block", {
|
|
11036
|
-
"has-error": !!error
|
|
11037
|
-
}),
|
|
11038
|
-
children: [
|
|
11039
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
11040
|
-
children,
|
|
11041
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components18.InlineAlert, { type: "negative", id: descriptionId, children: error })
|
|
11042
|
-
]
|
|
11043
|
-
}
|
|
11044
|
-
);
|
|
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;
|
|
11045
11232
|
}
|
|
11046
|
-
var UploadFieldInput_default = UploadFieldInput;
|
|
11047
11233
|
|
|
11048
|
-
// src/revamp/wise/renderers/
|
|
11049
|
-
var
|
|
11050
|
-
var toKilobytes = (sizeInBytes) => {
|
|
11051
|
-
const ONE_KB_IN_BYTES = 1024;
|
|
11052
|
-
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
11053
|
-
};
|
|
11054
|
-
var toFile = async (base64Url, name) => {
|
|
11055
|
-
const type = getFileType(base64Url);
|
|
11056
|
-
const blob = await toBlob(base64Url);
|
|
11057
|
-
return new File([blob], name, { type });
|
|
11058
|
-
};
|
|
11059
|
-
var toBlob = async (base64Url) => (await fetch(base64Url)).blob();
|
|
11060
|
-
var getFileType = (base64Url) => {
|
|
11061
|
-
const contentTypeRegex = /^data:(.+);/;
|
|
11062
|
-
const matches = contentTypeRegex.exec(base64Url);
|
|
11063
|
-
if (matches && matches.length > 1) {
|
|
11064
|
-
return matches[1];
|
|
11065
|
-
}
|
|
11066
|
-
return void 0;
|
|
11067
|
-
};
|
|
11234
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11235
|
+
var import_react_intl10 = require("react-intl");
|
|
11068
11236
|
|
|
11069
|
-
//
|
|
11070
|
-
var
|
|
11071
|
-
var
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
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."
|
|
11076
11244
|
}
|
|
11077
|
-
|
|
11078
|
-
};
|
|
11245
|
+
});
|
|
11079
11246
|
|
|
11080
|
-
// src/revamp/wise/renderers/
|
|
11081
|
-
var
|
|
11247
|
+
// src/revamp/wise/renderers/MultiSelectInputRenderer.tsx
|
|
11248
|
+
var import_react12 = require("react");
|
|
11249
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
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;
|
|
11082
11332
|
|
|
11083
11333
|
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
11084
|
-
var
|
|
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");
|
|
11085
11403
|
var MultiUploadInputRenderer = {
|
|
11086
11404
|
canRenderType: "input-upload-multi",
|
|
11087
11405
|
render: (props) => {
|
|
@@ -11108,8 +11426,8 @@ var MultiUploadInputRenderer = {
|
|
|
11108
11426
|
};
|
|
11109
11427
|
const onDeleteFile = async (fileId) => onDelete(String(fileId));
|
|
11110
11428
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
11111
|
-
return /* @__PURE__ */ (0,
|
|
11112
|
-
|
|
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,
|
|
11113
11431
|
{
|
|
11114
11432
|
id,
|
|
11115
11433
|
"aria-describedby": descriptionId,
|
|
@@ -11130,14 +11448,14 @@ var MultiUploadInputRenderer = {
|
|
|
11130
11448
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
11131
11449
|
|
|
11132
11450
|
// src/revamp/wise/renderers/NumberInputRenderer.tsx
|
|
11133
|
-
var
|
|
11134
|
-
var
|
|
11451
|
+
var import_components22 = require("@transferwise/components");
|
|
11452
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
11135
11453
|
var NumberInputRenderer = {
|
|
11136
11454
|
canRenderType: "input-number",
|
|
11137
11455
|
render: (props) => {
|
|
11138
11456
|
const _a = props, { id, label, error, description, help, type, value, onChange } = _a, rest = __objRest(_a, ["id", "label", "error", "description", "help", "type", "value", "onChange"]);
|
|
11139
|
-
return /* @__PURE__ */ (0,
|
|
11140
|
-
|
|
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,
|
|
11141
11459
|
__spreadValues({
|
|
11142
11460
|
id,
|
|
11143
11461
|
name: id,
|
|
@@ -11155,24 +11473,24 @@ var NumberInputRenderer = {
|
|
|
11155
11473
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
11156
11474
|
|
|
11157
11475
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11158
|
-
var
|
|
11476
|
+
var import_react_intl12 = require("react-intl");
|
|
11159
11477
|
|
|
11160
11478
|
// src/revamp/wise/renderers/hooks/useSnackBarIfAvailable.ts
|
|
11161
|
-
var
|
|
11162
|
-
var
|
|
11479
|
+
var import_components23 = require("@transferwise/components");
|
|
11480
|
+
var import_react13 = require("react");
|
|
11163
11481
|
function useSnackBarIfAvailable() {
|
|
11164
|
-
const context = (0,
|
|
11482
|
+
const context = (0, import_react13.useContext)(import_components23.SnackbarContext);
|
|
11165
11483
|
return context ? context.createSnackbar : () => {
|
|
11166
11484
|
};
|
|
11167
11485
|
}
|
|
11168
11486
|
|
|
11169
11487
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11170
|
-
var
|
|
11488
|
+
var import_components24 = require("@transferwise/components");
|
|
11171
11489
|
var import_classnames5 = __toESM(require_classnames());
|
|
11172
11490
|
|
|
11173
11491
|
// src/common/messages/paragraph.messages.ts
|
|
11174
|
-
var
|
|
11175
|
-
var paragraph_messages_default = (0,
|
|
11492
|
+
var import_react_intl11 = require("react-intl");
|
|
11493
|
+
var paragraph_messages_default = (0, import_react_intl11.defineMessages)({
|
|
11176
11494
|
copy: {
|
|
11177
11495
|
id: "dynamicFlows.DynamicParagraph.copy",
|
|
11178
11496
|
defaultMessage: "Copy",
|
|
@@ -11186,33 +11504,33 @@ var paragraph_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
11186
11504
|
});
|
|
11187
11505
|
|
|
11188
11506
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
11189
|
-
var
|
|
11507
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
11190
11508
|
var ParagraphRenderer = {
|
|
11191
11509
|
canRenderType: "paragraph",
|
|
11192
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
11510
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Paragraph, __spreadValues({}, props))
|
|
11193
11511
|
};
|
|
11194
11512
|
function Paragraph({ align, control, margin, text }) {
|
|
11195
11513
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
11196
|
-
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 });
|
|
11197
11515
|
}
|
|
11198
11516
|
function StandardParagraph({ text, className }) {
|
|
11199
|
-
return /* @__PURE__ */ (0,
|
|
11517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className, children: text });
|
|
11200
11518
|
}
|
|
11201
11519
|
function CopyableParagraph({
|
|
11202
11520
|
text,
|
|
11203
11521
|
align,
|
|
11204
11522
|
className
|
|
11205
11523
|
}) {
|
|
11206
|
-
const { formatMessage } = (0,
|
|
11524
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
11207
11525
|
const createSnackbar = useSnackBarIfAvailable();
|
|
11208
11526
|
const copy = () => {
|
|
11209
11527
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
11210
11528
|
});
|
|
11211
11529
|
};
|
|
11212
11530
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
11213
|
-
return /* @__PURE__ */ (0,
|
|
11214
|
-
/* @__PURE__ */ (0,
|
|
11215
|
-
|
|
11531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className, children: [
|
|
11532
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11533
|
+
import_components24.Input,
|
|
11216
11534
|
{
|
|
11217
11535
|
type: "text",
|
|
11218
11536
|
value: text,
|
|
@@ -11220,20 +11538,20 @@ function CopyableParagraph({
|
|
|
11220
11538
|
className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
|
|
11221
11539
|
}
|
|
11222
11540
|
),
|
|
11223
|
-
/* @__PURE__ */ (0,
|
|
11541
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components24.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
11224
11542
|
] });
|
|
11225
11543
|
}
|
|
11226
11544
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
11227
11545
|
|
|
11228
11546
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11229
|
-
var
|
|
11230
|
-
var
|
|
11547
|
+
var import_components25 = require("@transferwise/components");
|
|
11548
|
+
var import_react14 = require("react");
|
|
11231
11549
|
var import_icons = require("@transferwise/icons");
|
|
11232
|
-
var
|
|
11550
|
+
var import_react_intl14 = require("react-intl");
|
|
11233
11551
|
|
|
11234
11552
|
// src/common/messages/repeatable.messages.ts
|
|
11235
|
-
var
|
|
11236
|
-
var repeatable_messages_default = (0,
|
|
11553
|
+
var import_react_intl13 = require("react-intl");
|
|
11554
|
+
var repeatable_messages_default = (0, import_react_intl13.defineMessages)({
|
|
11237
11555
|
addItemTitle: {
|
|
11238
11556
|
id: "dynamicFlows.ArraySchema.addItemTitle",
|
|
11239
11557
|
defaultMessage: "Add Item",
|
|
@@ -11258,10 +11576,10 @@ var repeatable_messages_default = (0, import_react_intl11.defineMessages)({
|
|
|
11258
11576
|
|
|
11259
11577
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
11260
11578
|
var import_classnames6 = __toESM(require_classnames());
|
|
11261
|
-
var
|
|
11579
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
11262
11580
|
var RepeatableRenderer = {
|
|
11263
11581
|
canRenderType: "repeatable",
|
|
11264
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
11582
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Repeatable, __spreadValues({}, props))
|
|
11265
11583
|
};
|
|
11266
11584
|
function Repeatable(props) {
|
|
11267
11585
|
const {
|
|
@@ -11277,8 +11595,8 @@ function Repeatable(props) {
|
|
|
11277
11595
|
onSave,
|
|
11278
11596
|
onRemove
|
|
11279
11597
|
} = props;
|
|
11280
|
-
const { formatMessage } = (0,
|
|
11281
|
-
const [openModalType, setOpenModalType] = (0,
|
|
11598
|
+
const { formatMessage } = (0, import_react_intl14.useIntl)();
|
|
11599
|
+
const [openModalType, setOpenModalType] = (0, import_react14.useState)(null);
|
|
11282
11600
|
const onAddItem = () => {
|
|
11283
11601
|
onAdd();
|
|
11284
11602
|
setOpenModalType("add");
|
|
@@ -11300,40 +11618,40 @@ function Repeatable(props) {
|
|
|
11300
11618
|
const onCancelEdit = () => {
|
|
11301
11619
|
setOpenModalType(null);
|
|
11302
11620
|
};
|
|
11303
|
-
return /* @__PURE__ */ (0,
|
|
11304
|
-
title && /* @__PURE__ */ (0,
|
|
11305
|
-
description && /* @__PURE__ */ (0,
|
|
11306
|
-
/* @__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)(
|
|
11307
11625
|
"div",
|
|
11308
11626
|
{
|
|
11309
11627
|
className: (0, import_classnames6.default)("form-group", {
|
|
11310
11628
|
"has-error": error
|
|
11311
11629
|
}),
|
|
11312
11630
|
children: [
|
|
11313
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
11314
|
-
/* @__PURE__ */ (0,
|
|
11315
|
-
|
|
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,
|
|
11316
11634
|
{
|
|
11317
|
-
media: /* @__PURE__ */ (0,
|
|
11635
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons.Plus, {}),
|
|
11318
11636
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11319
11637
|
showMediaAtAllSizes: true,
|
|
11320
11638
|
onClick: () => onAddItem()
|
|
11321
11639
|
}
|
|
11322
11640
|
),
|
|
11323
|
-
error && /* @__PURE__ */ (0,
|
|
11641
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components25.InlineAlert, { type: "negative", children: error })
|
|
11324
11642
|
]
|
|
11325
11643
|
}
|
|
11326
11644
|
),
|
|
11327
|
-
/* @__PURE__ */ (0,
|
|
11328
|
-
|
|
11645
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11646
|
+
import_components25.Modal,
|
|
11329
11647
|
{
|
|
11330
11648
|
open: openModalType !== null,
|
|
11331
11649
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
11332
|
-
body: /* @__PURE__ */ (0,
|
|
11333
|
-
/* @__PURE__ */ (0,
|
|
11334
|
-
/* @__PURE__ */ (0,
|
|
11335
|
-
/* @__PURE__ */ (0,
|
|
11336
|
-
/* @__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) })
|
|
11337
11655
|
] })
|
|
11338
11656
|
] }),
|
|
11339
11657
|
onClose: () => onCancelEdit()
|
|
@@ -11345,10 +11663,10 @@ function ItemSummaryOption({
|
|
|
11345
11663
|
item,
|
|
11346
11664
|
onClick
|
|
11347
11665
|
}) {
|
|
11348
|
-
return /* @__PURE__ */ (0,
|
|
11349
|
-
|
|
11666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11667
|
+
import_components25.NavigationOption,
|
|
11350
11668
|
{
|
|
11351
|
-
media: /* @__PURE__ */ (0,
|
|
11669
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(NavigationOptionMedia, __spreadValues({}, item)),
|
|
11352
11670
|
title: item.title,
|
|
11353
11671
|
content: item.description,
|
|
11354
11672
|
showMediaAtAllSizes: true,
|
|
@@ -11359,17 +11677,17 @@ function ItemSummaryOption({
|
|
|
11359
11677
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
11360
11678
|
|
|
11361
11679
|
// src/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
11362
|
-
var
|
|
11680
|
+
var import_components26 = require("@transferwise/components");
|
|
11363
11681
|
|
|
11364
11682
|
// src/revamp/wise/renderers/SearchRenderer/ErrorResult.tsx
|
|
11365
|
-
var
|
|
11366
|
-
var
|
|
11683
|
+
var import_react_intl15 = require("react-intl");
|
|
11684
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11367
11685
|
function ErrorResult({ state }) {
|
|
11368
|
-
const intl = (0,
|
|
11369
|
-
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: [
|
|
11370
11688
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
11371
11689
|
"\xA0",
|
|
11372
|
-
/* @__PURE__ */ (0,
|
|
11690
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11373
11691
|
"a",
|
|
11374
11692
|
{
|
|
11375
11693
|
href: "/",
|
|
@@ -11384,8 +11702,8 @@ function ErrorResult({ state }) {
|
|
|
11384
11702
|
}
|
|
11385
11703
|
|
|
11386
11704
|
// src/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
11387
|
-
var
|
|
11388
|
-
var
|
|
11705
|
+
var import_react15 = require("react");
|
|
11706
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11389
11707
|
function BlockSearchRendererComponent({
|
|
11390
11708
|
id,
|
|
11391
11709
|
isLoading,
|
|
@@ -11395,11 +11713,11 @@ function BlockSearchRendererComponent({
|
|
|
11395
11713
|
state,
|
|
11396
11714
|
title
|
|
11397
11715
|
}) {
|
|
11398
|
-
const [hasSearched, setHasSearched] = (0,
|
|
11716
|
+
const [hasSearched, setHasSearched] = (0, import_react15.useState)(false);
|
|
11399
11717
|
const trackEvent = useTrackEvent();
|
|
11400
|
-
return /* @__PURE__ */ (0,
|
|
11401
|
-
/* @__PURE__ */ (0,
|
|
11402
|
-
|
|
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,
|
|
11403
11721
|
{
|
|
11404
11722
|
id,
|
|
11405
11723
|
name: id,
|
|
@@ -11415,7 +11733,7 @@ function BlockSearchRendererComponent({
|
|
|
11415
11733
|
}
|
|
11416
11734
|
}
|
|
11417
11735
|
) }),
|
|
11418
|
-
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 })
|
|
11419
11737
|
] });
|
|
11420
11738
|
}
|
|
11421
11739
|
function SearchResultContent({
|
|
@@ -11424,29 +11742,29 @@ function SearchResultContent({
|
|
|
11424
11742
|
}) {
|
|
11425
11743
|
switch (state.type) {
|
|
11426
11744
|
case "error":
|
|
11427
|
-
return /* @__PURE__ */ (0,
|
|
11745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorResult, { state });
|
|
11428
11746
|
case "results":
|
|
11429
|
-
return /* @__PURE__ */ (0,
|
|
11747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SearchResults, { state, onChange });
|
|
11430
11748
|
case "noResults":
|
|
11431
|
-
return /* @__PURE__ */ (0,
|
|
11749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EmptySearchResult, { state });
|
|
11432
11750
|
case "pending":
|
|
11433
11751
|
default:
|
|
11434
11752
|
return null;
|
|
11435
11753
|
}
|
|
11436
11754
|
}
|
|
11437
11755
|
function EmptySearchResult({ state }) {
|
|
11438
|
-
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 });
|
|
11439
11757
|
}
|
|
11440
11758
|
function SearchResults({
|
|
11441
11759
|
state
|
|
11442
11760
|
}) {
|
|
11443
11761
|
const trackEvent = useTrackEvent();
|
|
11444
|
-
return /* @__PURE__ */ (0,
|
|
11445
|
-
|
|
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,
|
|
11446
11764
|
{
|
|
11447
11765
|
title: result.title,
|
|
11448
11766
|
content: result.description,
|
|
11449
|
-
media: /* @__PURE__ */ (0,
|
|
11767
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(NavigationOptionMedia, __spreadValues({}, result)),
|
|
11450
11768
|
showMediaCircle: false,
|
|
11451
11769
|
showMediaAtAllSizes: true,
|
|
11452
11770
|
onClick: () => {
|
|
@@ -11462,10 +11780,10 @@ function SearchResults({
|
|
|
11462
11780
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
11463
11781
|
|
|
11464
11782
|
// src/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
11465
|
-
var
|
|
11783
|
+
var import_components27 = require("@transferwise/components");
|
|
11466
11784
|
var import_icons2 = require("@transferwise/icons");
|
|
11467
|
-
var
|
|
11468
|
-
var
|
|
11785
|
+
var import_react16 = require("react");
|
|
11786
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11469
11787
|
function InlineSearchRenderer({
|
|
11470
11788
|
id,
|
|
11471
11789
|
isLoading,
|
|
@@ -11474,21 +11792,21 @@ function InlineSearchRenderer({
|
|
|
11474
11792
|
state,
|
|
11475
11793
|
title
|
|
11476
11794
|
}) {
|
|
11477
|
-
const [hasSearched, setHasSearched] = (0,
|
|
11795
|
+
const [hasSearched, setHasSearched] = (0, import_react16.useState)(false);
|
|
11478
11796
|
const trackEvent = useTrackEvent();
|
|
11479
|
-
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: [
|
|
11480
11798
|
id,
|
|
11481
|
-
/* @__PURE__ */ (0,
|
|
11482
|
-
|
|
11799
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11800
|
+
import_components27.Typeahead,
|
|
11483
11801
|
{
|
|
11484
11802
|
id: "typeahead-input-id",
|
|
11485
11803
|
name: "typeahead-input-name",
|
|
11486
11804
|
size: "md",
|
|
11487
11805
|
maxHeight: 100,
|
|
11488
|
-
footer: /* @__PURE__ */ (0,
|
|
11806
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
11489
11807
|
multiple: false,
|
|
11490
11808
|
clearable: false,
|
|
11491
|
-
addon: /* @__PURE__ */ (0,
|
|
11809
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_icons2.Search, { size: 24 }),
|
|
11492
11810
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
11493
11811
|
minQueryLength: 1,
|
|
11494
11812
|
onChange: (values) => {
|
|
@@ -11525,47 +11843,29 @@ function mapResultToTypeaheadOption(result) {
|
|
|
11525
11843
|
}
|
|
11526
11844
|
function TypeaheadFooter({ state, isLoading }) {
|
|
11527
11845
|
if (state.type === "noResults") {
|
|
11528
|
-
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 });
|
|
11529
11847
|
}
|
|
11530
11848
|
if (state.type === "error") {
|
|
11531
|
-
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 }) });
|
|
11532
11850
|
}
|
|
11533
11851
|
if (state.type === "pending" || isLoading) {
|
|
11534
|
-
return /* @__PURE__ */ (0,
|
|
11852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
11535
11853
|
}
|
|
11536
11854
|
return null;
|
|
11537
11855
|
}
|
|
11538
11856
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
11539
11857
|
|
|
11540
11858
|
// src/revamp/wise/renderers/SearchRenderer/SearchRenderer.tsx
|
|
11541
|
-
var
|
|
11859
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11542
11860
|
var SearchRenderer = {
|
|
11543
11861
|
canRenderType: "search",
|
|
11544
|
-
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))
|
|
11545
11863
|
};
|
|
11546
11864
|
var SearchRenderer_default = SearchRenderer;
|
|
11547
11865
|
|
|
11548
11866
|
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11549
|
-
var
|
|
11550
|
-
|
|
11551
|
-
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
11552
|
-
var import_components26 = require("@transferwise/components");
|
|
11553
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11554
|
-
function OptionMedia({ icon, image }) {
|
|
11555
|
-
if (image == null ? void 0 : image.url) {
|
|
11556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
11557
|
-
}
|
|
11558
|
-
if (icon && "name" in icon) {
|
|
11559
|
-
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 }) });
|
|
11560
|
-
}
|
|
11561
|
-
if (icon && "text" in icon) {
|
|
11562
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components26.Avatar, { type: import_components26.AvatarType.INITIALS, children: icon.text });
|
|
11563
|
-
}
|
|
11564
|
-
return null;
|
|
11565
|
-
}
|
|
11566
|
-
|
|
11567
|
-
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
11568
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11867
|
+
var import_components28 = require("@transferwise/components");
|
|
11868
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11569
11869
|
function RadioInputRendererComponent(props) {
|
|
11570
11870
|
const {
|
|
11571
11871
|
id,
|
|
@@ -11579,9 +11879,9 @@ function RadioInputRendererComponent(props) {
|
|
|
11579
11879
|
selectedIndex,
|
|
11580
11880
|
onSelect
|
|
11581
11881
|
} = props;
|
|
11582
|
-
return /* @__PURE__ */ (0,
|
|
11583
|
-
/* @__PURE__ */ (0,
|
|
11584
|
-
|
|
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,
|
|
11585
11885
|
{
|
|
11586
11886
|
name: id,
|
|
11587
11887
|
radios: options.map((option, index) => ({
|
|
@@ -11589,20 +11889,21 @@ function RadioInputRendererComponent(props) {
|
|
|
11589
11889
|
value: index,
|
|
11590
11890
|
secondary: option.description,
|
|
11591
11891
|
disabled: option.disabled || disabled,
|
|
11592
|
-
avatar: /* @__PURE__ */ (0,
|
|
11892
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(OptionMedia, { icon: option.icon, image: option.image })
|
|
11593
11893
|
})),
|
|
11594
11894
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
11595
11895
|
onChange: onSelect
|
|
11596
|
-
}
|
|
11896
|
+
},
|
|
11897
|
+
`${id}-${selectedIndex}`
|
|
11597
11898
|
) }) }),
|
|
11598
11899
|
children
|
|
11599
11900
|
] });
|
|
11600
11901
|
}
|
|
11601
11902
|
|
|
11602
11903
|
// src/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
11603
|
-
var
|
|
11604
|
-
var
|
|
11605
|
-
var
|
|
11904
|
+
var import_components29 = require("@transferwise/components");
|
|
11905
|
+
var import_react17 = require("react");
|
|
11906
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11606
11907
|
function TabInputRendererComponent(props) {
|
|
11607
11908
|
const {
|
|
11608
11909
|
id,
|
|
@@ -11616,14 +11917,14 @@ function TabInputRendererComponent(props) {
|
|
|
11616
11917
|
selectedIndex,
|
|
11617
11918
|
onSelect
|
|
11618
11919
|
} = props;
|
|
11619
|
-
(0,
|
|
11920
|
+
(0, import_react17.useEffect)(() => {
|
|
11620
11921
|
if (!isValidIndex(selectedIndex, options.length)) {
|
|
11621
11922
|
onSelect(0);
|
|
11622
11923
|
}
|
|
11623
11924
|
}, [selectedIndex, onSelect, options.length]);
|
|
11624
|
-
return /* @__PURE__ */ (0,
|
|
11625
|
-
/* @__PURE__ */ (0,
|
|
11626
|
-
|
|
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,
|
|
11627
11928
|
{
|
|
11628
11929
|
name: id,
|
|
11629
11930
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -11631,7 +11932,7 @@ function TabInputRendererComponent(props) {
|
|
|
11631
11932
|
title: option.title,
|
|
11632
11933
|
// if we pass null, we get some props-types console errors
|
|
11633
11934
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
11634
|
-
content: /* @__PURE__ */ (0,
|
|
11935
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, {}),
|
|
11635
11936
|
disabled: option.disabled || disabled
|
|
11636
11937
|
})),
|
|
11637
11938
|
onTabSelect: onSelect
|
|
@@ -11643,26 +11944,26 @@ function TabInputRendererComponent(props) {
|
|
|
11643
11944
|
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
11644
11945
|
|
|
11645
11946
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11646
|
-
var
|
|
11947
|
+
var import_components31 = require("@transferwise/components");
|
|
11647
11948
|
|
|
11648
11949
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.tsx
|
|
11649
|
-
var
|
|
11650
|
-
var
|
|
11950
|
+
var import_components30 = require("@transferwise/components");
|
|
11951
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11651
11952
|
function SelectTriggerMedia({ icon, image }) {
|
|
11652
11953
|
if (image == null ? void 0 : image.url) {
|
|
11653
11954
|
return null;
|
|
11654
11955
|
}
|
|
11655
11956
|
if (icon && "name" in icon) {
|
|
11656
|
-
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 }) });
|
|
11657
11958
|
}
|
|
11658
11959
|
if (icon && "text" in icon) {
|
|
11659
|
-
return /* @__PURE__ */ (0,
|
|
11960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components30.Avatar, { type: import_components30.AvatarType.ICON, size: 24, children: icon.text });
|
|
11660
11961
|
}
|
|
11661
11962
|
return null;
|
|
11662
11963
|
}
|
|
11663
11964
|
|
|
11664
11965
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
11665
|
-
var
|
|
11966
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11666
11967
|
function SelectInputRendererComponent(props) {
|
|
11667
11968
|
const {
|
|
11668
11969
|
id,
|
|
@@ -11697,17 +11998,17 @@ function SelectInputRendererComponent(props) {
|
|
|
11697
11998
|
const contentProps = withinTrigger ? {
|
|
11698
11999
|
title: option.title,
|
|
11699
12000
|
note: option.description,
|
|
11700
|
-
icon: /* @__PURE__ */ (0,
|
|
12001
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectTriggerMedia, { icon: option.icon, image: option.image })
|
|
11701
12002
|
} : {
|
|
11702
12003
|
title: option.title,
|
|
11703
12004
|
description: option.description,
|
|
11704
|
-
icon: /* @__PURE__ */ (0,
|
|
12005
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OptionMedia, { icon: option.icon, image: option.image })
|
|
11705
12006
|
};
|
|
11706
|
-
return /* @__PURE__ */ (0,
|
|
12007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components31.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
11707
12008
|
};
|
|
11708
|
-
return /* @__PURE__ */ (0,
|
|
11709
|
-
/* @__PURE__ */ (0,
|
|
11710
|
-
|
|
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,
|
|
11711
12012
|
{
|
|
11712
12013
|
name: id,
|
|
11713
12014
|
placeholder,
|
|
@@ -11725,19 +12026,19 @@ function SelectInputRendererComponent(props) {
|
|
|
11725
12026
|
}
|
|
11726
12027
|
|
|
11727
12028
|
// src/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
11728
|
-
var
|
|
11729
|
-
var
|
|
11730
|
-
var
|
|
12029
|
+
var import_react18 = require("react");
|
|
12030
|
+
var import_components32 = require("@transferwise/components");
|
|
12031
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11731
12032
|
function SegmentedInputRendererComponent(props) {
|
|
11732
12033
|
const { id, children, description, error, help, label, options, selectedIndex, onSelect } = props;
|
|
11733
|
-
(0,
|
|
12034
|
+
(0, import_react18.useEffect)(() => {
|
|
11734
12035
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
11735
12036
|
onSelect(0);
|
|
11736
12037
|
}
|
|
11737
12038
|
}, [selectedIndex, onSelect, options.length]);
|
|
11738
|
-
return /* @__PURE__ */ (0,
|
|
11739
|
-
/* @__PURE__ */ (0,
|
|
11740
|
-
|
|
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,
|
|
11741
12042
|
{
|
|
11742
12043
|
name: `${id}-segmented-control`,
|
|
11743
12044
|
value: String(selectedIndex),
|
|
@@ -11751,44 +12052,44 @@ function SegmentedInputRendererComponent(props) {
|
|
|
11751
12052
|
onChange: (value) => onSelect(Number(value))
|
|
11752
12053
|
}
|
|
11753
12054
|
) }),
|
|
11754
|
-
/* @__PURE__ */ (0,
|
|
12055
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: `${id}-children`, children })
|
|
11755
12056
|
] });
|
|
11756
12057
|
}
|
|
11757
12058
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
11758
12059
|
|
|
11759
12060
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
11760
|
-
var
|
|
12061
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11761
12062
|
var SelectInputRenderer = {
|
|
11762
12063
|
canRenderType: "input-select",
|
|
11763
12064
|
render: (props) => {
|
|
11764
12065
|
switch (props.control) {
|
|
11765
12066
|
case "radio":
|
|
11766
|
-
return /* @__PURE__ */ (0,
|
|
12067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
11767
12068
|
case "tab":
|
|
11768
|
-
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));
|
|
11769
12070
|
case "segmented":
|
|
11770
|
-
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));
|
|
11771
12072
|
case "select":
|
|
11772
12073
|
default:
|
|
11773
|
-
return /* @__PURE__ */ (0,
|
|
12074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
11774
12075
|
}
|
|
11775
12076
|
}
|
|
11776
12077
|
};
|
|
11777
12078
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
11778
12079
|
|
|
11779
12080
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
11780
|
-
var
|
|
11781
|
-
var
|
|
12081
|
+
var import_components33 = require("@transferwise/components");
|
|
12082
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11782
12083
|
var StatusListRenderer = {
|
|
11783
12084
|
canRenderType: "status-list",
|
|
11784
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
11785
|
-
title ? /* @__PURE__ */ (0,
|
|
11786
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0,
|
|
11787
|
-
|
|
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,
|
|
11788
12089
|
{
|
|
11789
12090
|
title: itemTitle,
|
|
11790
12091
|
description,
|
|
11791
|
-
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,
|
|
11792
12093
|
status: mapStatus(status)
|
|
11793
12094
|
},
|
|
11794
12095
|
`${title}/${description || ""}`
|
|
@@ -11804,63 +12105,63 @@ var mapStatus = (status) => {
|
|
|
11804
12105
|
};
|
|
11805
12106
|
|
|
11806
12107
|
// src/revamp/wise/renderers/components/VariableTextInput.tsx
|
|
11807
|
-
var
|
|
11808
|
-
var
|
|
12108
|
+
var import_components34 = require("@transferwise/components");
|
|
12109
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
11809
12110
|
function VariableTextInput({
|
|
11810
12111
|
control,
|
|
11811
12112
|
inputProps
|
|
11812
12113
|
}) {
|
|
11813
12114
|
switch (control) {
|
|
11814
12115
|
case "password":
|
|
11815
|
-
return /* @__PURE__ */ (0,
|
|
12116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
11816
12117
|
case "email":
|
|
11817
|
-
return /* @__PURE__ */ (0,
|
|
12118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
11818
12119
|
case "textarea":
|
|
11819
|
-
return /* @__PURE__ */ (0,
|
|
12120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextAreaInput, __spreadValues({}, inputProps));
|
|
11820
12121
|
case "numeric":
|
|
11821
|
-
return /* @__PURE__ */ (0,
|
|
12122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
11822
12123
|
case "phone-number":
|
|
11823
|
-
return /* @__PURE__ */ (0,
|
|
12124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PhoneNumberInput, __spreadValues({}, inputProps));
|
|
11824
12125
|
default:
|
|
11825
|
-
return /* @__PURE__ */ (0,
|
|
12126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
11826
12127
|
}
|
|
11827
12128
|
}
|
|
11828
12129
|
function TextInput(_a) {
|
|
11829
12130
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11830
12131
|
if (typeof displayFormat === "string") {
|
|
11831
12132
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
11832
|
-
return /* @__PURE__ */ (0,
|
|
11833
|
-
|
|
12133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12134
|
+
import_components34.InputWithDisplayFormat,
|
|
11834
12135
|
__spreadValues({
|
|
11835
12136
|
displayPattern: displayFormat,
|
|
11836
12137
|
onChange: (newValue) => onChange(newValue)
|
|
11837
12138
|
}, inputProps)
|
|
11838
12139
|
);
|
|
11839
12140
|
}
|
|
11840
|
-
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));
|
|
11841
12142
|
}
|
|
11842
12143
|
function TextAreaInput(_a) {
|
|
11843
12144
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11844
12145
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
11845
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11846
|
-
|
|
12146
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12147
|
+
import_components34.TextareaWithDisplayFormat,
|
|
11847
12148
|
__spreadValues({
|
|
11848
12149
|
displayPattern: displayFormat,
|
|
11849
12150
|
onChange: (newValue) => onChange(newValue)
|
|
11850
12151
|
}, textAreaProps)
|
|
11851
|
-
) : /* @__PURE__ */ (0,
|
|
12152
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.TextArea, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
11852
12153
|
}
|
|
11853
12154
|
function NumericInput(_a) {
|
|
11854
12155
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11855
12156
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
11856
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11857
|
-
|
|
12157
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12158
|
+
import_components34.InputWithDisplayFormat,
|
|
11858
12159
|
__spreadValues({
|
|
11859
12160
|
displayPattern: displayFormat,
|
|
11860
12161
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
11861
12162
|
}, numericProps)
|
|
11862
|
-
) : /* @__PURE__ */ (0,
|
|
11863
|
-
|
|
12163
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
12164
|
+
import_components34.Input,
|
|
11864
12165
|
__spreadValues({
|
|
11865
12166
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
11866
12167
|
}, numericProps)
|
|
@@ -11868,12 +12169,12 @@ function NumericInput(_a) {
|
|
|
11868
12169
|
}
|
|
11869
12170
|
function PhoneNumberInput(_a) {
|
|
11870
12171
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
11871
|
-
return /* @__PURE__ */ (0,
|
|
12172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.PhoneNumberInput, __spreadValues({ initialValue: value }, rest));
|
|
11872
12173
|
}
|
|
11873
12174
|
var VariableTextInput_default = VariableTextInput;
|
|
11874
12175
|
|
|
11875
12176
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
11876
|
-
var
|
|
12177
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
11877
12178
|
var TextInputRenderer = {
|
|
11878
12179
|
canRenderType: "input-text",
|
|
11879
12180
|
render: (props) => {
|
|
@@ -11898,14 +12199,14 @@ var TextInputRenderer = {
|
|
|
11898
12199
|
]);
|
|
11899
12200
|
const value = initialValue != null ? initialValue : "";
|
|
11900
12201
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
11901
|
-
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 }) });
|
|
11902
12203
|
}
|
|
11903
12204
|
};
|
|
11904
12205
|
var TextInputRenderer_default = TextInputRenderer;
|
|
11905
12206
|
|
|
11906
12207
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
11907
|
-
var
|
|
11908
|
-
var
|
|
12208
|
+
var import_components35 = require("@transferwise/components");
|
|
12209
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
11909
12210
|
var UploadInputRenderer = {
|
|
11910
12211
|
canRenderType: "input-upload",
|
|
11911
12212
|
render: (props) => {
|
|
@@ -11921,8 +12222,8 @@ var UploadInputRenderer = {
|
|
|
11921
12222
|
};
|
|
11922
12223
|
return (
|
|
11923
12224
|
// We don't pass help here as there is no sensible place to display it
|
|
11924
|
-
/* @__PURE__ */ (0,
|
|
11925
|
-
|
|
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,
|
|
11926
12227
|
{
|
|
11927
12228
|
id,
|
|
11928
12229
|
description,
|
|
@@ -11976,8 +12277,8 @@ var LargeUploadRenderer = {
|
|
|
11976
12277
|
throw e;
|
|
11977
12278
|
}
|
|
11978
12279
|
};
|
|
11979
|
-
return /* @__PURE__ */ (0,
|
|
11980
|
-
|
|
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,
|
|
11981
12282
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
11982
12283
|
usAccept: getAcceptsString(accepts),
|
|
11983
12284
|
usDisabled: disabled,
|
|
@@ -11990,8 +12291,8 @@ var LargeUploadRenderer = {
|
|
|
11990
12291
|
};
|
|
11991
12292
|
|
|
11992
12293
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
11993
|
-
var
|
|
11994
|
-
var
|
|
12294
|
+
var import_components36 = require("@transferwise/components");
|
|
12295
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
11995
12296
|
var ReviewRenderer = {
|
|
11996
12297
|
canRenderType: "review",
|
|
11997
12298
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -12003,10 +12304,10 @@ var ReviewRenderer = {
|
|
|
12003
12304
|
callToAction.onClick();
|
|
12004
12305
|
}
|
|
12005
12306
|
} : void 0;
|
|
12006
|
-
return /* @__PURE__ */ (0,
|
|
12007
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
12008
|
-
/* @__PURE__ */ (0,
|
|
12009
|
-
|
|
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,
|
|
12010
12311
|
{
|
|
12011
12312
|
layout: orientation,
|
|
12012
12313
|
definitions: fields.map(({ label, value, help }, index) => ({
|
|
@@ -12022,28 +12323,28 @@ var ReviewRenderer = {
|
|
|
12022
12323
|
var ReviewRenderer_default = ReviewRenderer;
|
|
12023
12324
|
var getFieldValue = (value, help, orientation) => {
|
|
12024
12325
|
if (help) {
|
|
12025
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
12026
|
-
/* @__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 }),
|
|
12027
12328
|
" ",
|
|
12028
12329
|
value
|
|
12029
|
-
] }) : /* @__PURE__ */ (0,
|
|
12330
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
12030
12331
|
value,
|
|
12031
12332
|
" ",
|
|
12032
|
-
/* @__PURE__ */ (0,
|
|
12333
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help })
|
|
12033
12334
|
] });
|
|
12034
12335
|
}
|
|
12035
12336
|
return value;
|
|
12036
12337
|
};
|
|
12037
12338
|
|
|
12038
12339
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12039
|
-
var
|
|
12340
|
+
var import_react20 = require("react");
|
|
12040
12341
|
|
|
12041
12342
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12042
|
-
var
|
|
12343
|
+
var import_react_intl17 = require("react-intl");
|
|
12043
12344
|
|
|
12044
12345
|
// src/common/messages/external-confirmation.messages.ts
|
|
12045
|
-
var
|
|
12046
|
-
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)({
|
|
12047
12348
|
title: {
|
|
12048
12349
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
12049
12350
|
defaultMessage: "Please confirm",
|
|
@@ -12067,19 +12368,19 @@ var external_confirmation_messages_default = (0, import_react_intl14.defineMessa
|
|
|
12067
12368
|
});
|
|
12068
12369
|
|
|
12069
12370
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12070
|
-
var
|
|
12071
|
-
var
|
|
12371
|
+
var import_components37 = require("@transferwise/components");
|
|
12372
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
12072
12373
|
function ExternalConfirmationDialog({
|
|
12073
12374
|
external,
|
|
12074
12375
|
onClose
|
|
12075
12376
|
}) {
|
|
12076
|
-
const { formatMessage } = (0,
|
|
12077
|
-
return /* @__PURE__ */ (0,
|
|
12078
|
-
/* @__PURE__ */ (0,
|
|
12079
|
-
/* @__PURE__ */ (0,
|
|
12080
|
-
/* @__PURE__ */ (0,
|
|
12081
|
-
/* @__PURE__ */ (0,
|
|
12082
|
-
|
|
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,
|
|
12083
12384
|
{
|
|
12084
12385
|
block: true,
|
|
12085
12386
|
className: "m-b-2",
|
|
@@ -12092,7 +12393,7 @@ function ExternalConfirmationDialog({
|
|
|
12092
12393
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
12093
12394
|
}
|
|
12094
12395
|
),
|
|
12095
|
-
/* @__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) })
|
|
12096
12397
|
] }) })
|
|
12097
12398
|
] }) });
|
|
12098
12399
|
}
|
|
@@ -12105,12 +12406,12 @@ function getOrigin(url) {
|
|
|
12105
12406
|
}
|
|
12106
12407
|
|
|
12107
12408
|
// src/revamp/wise/renderers/step/useExternal.tsx
|
|
12108
|
-
var
|
|
12409
|
+
var import_react19 = require("react");
|
|
12109
12410
|
function useExternal(url) {
|
|
12110
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
12111
|
-
const [hasDismissed, setHasDismissed] = (0,
|
|
12411
|
+
const [externalWindow, setExternalWindow] = (0, import_react19.useState)(null);
|
|
12412
|
+
const [hasDismissed, setHasDismissed] = (0, import_react19.useState)(false);
|
|
12112
12413
|
const dismissConfirmation = () => setHasDismissed(true);
|
|
12113
|
-
(0,
|
|
12414
|
+
(0, import_react19.useEffect)(() => {
|
|
12114
12415
|
if (url) {
|
|
12115
12416
|
setHasDismissed(false);
|
|
12116
12417
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -12121,11 +12422,11 @@ function useExternal(url) {
|
|
|
12121
12422
|
}
|
|
12122
12423
|
|
|
12123
12424
|
// src/revamp/wise/renderers/step/BackButton.tsx
|
|
12124
|
-
var
|
|
12425
|
+
var import_components38 = require("@transferwise/components");
|
|
12125
12426
|
var import_icons3 = require("@transferwise/icons");
|
|
12126
|
-
var
|
|
12427
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
12127
12428
|
function BackButton({ title, onClick }) {
|
|
12128
|
-
return /* @__PURE__ */ (0,
|
|
12429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
12129
12430
|
"a",
|
|
12130
12431
|
{
|
|
12131
12432
|
href: "/",
|
|
@@ -12136,8 +12437,8 @@ function BackButton({ title, onClick }) {
|
|
|
12136
12437
|
onClick();
|
|
12137
12438
|
},
|
|
12138
12439
|
children: [
|
|
12139
|
-
/* @__PURE__ */ (0,
|
|
12140
|
-
/* @__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" }) })
|
|
12141
12442
|
]
|
|
12142
12443
|
}
|
|
12143
12444
|
);
|
|
@@ -12145,20 +12446,20 @@ function BackButton({ title, onClick }) {
|
|
|
12145
12446
|
var BackButton_default = BackButton;
|
|
12146
12447
|
|
|
12147
12448
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12148
|
-
var
|
|
12449
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
12149
12450
|
var StepRenderer = {
|
|
12150
12451
|
canRenderType: "step",
|
|
12151
12452
|
render: StepRendererComponent
|
|
12152
12453
|
};
|
|
12153
12454
|
function StepRendererComponent(props) {
|
|
12154
12455
|
const { back, loadingState, external, trackEvent, children } = props;
|
|
12155
|
-
const value = (0,
|
|
12456
|
+
const value = (0, import_react20.useMemo)(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12156
12457
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12157
12458
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
12158
|
-
return /* @__PURE__ */ (0,
|
|
12459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ExternalConfirmationDialog, { external, onClose: dismissConfirmation });
|
|
12159
12460
|
}
|
|
12160
|
-
return /* @__PURE__ */ (0,
|
|
12161
|
-
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,
|
|
12162
12463
|
children
|
|
12163
12464
|
] });
|
|
12164
12465
|
}
|
|
@@ -12183,6 +12484,7 @@ var getWiseRenderers = () => [
|
|
|
12183
12484
|
LoadingIndicatorRenderer_default,
|
|
12184
12485
|
MarkdownRenderer_default,
|
|
12185
12486
|
ModalRenderer_default,
|
|
12487
|
+
MultiSelectInputRenderer_default,
|
|
12186
12488
|
MultiUploadInputRenderer_default,
|
|
12187
12489
|
NumberInputRenderer_default,
|
|
12188
12490
|
ParagraphRenderer_default,
|
|
@@ -12197,24 +12499,24 @@ var getWiseRenderers = () => [
|
|
|
12197
12499
|
];
|
|
12198
12500
|
|
|
12199
12501
|
// src/revamp/DynamicFlowWise.tsx
|
|
12200
|
-
var
|
|
12502
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12201
12503
|
var wiseRenderers = getWiseRenderers();
|
|
12202
12504
|
function DynamicFlowWise(props) {
|
|
12203
12505
|
const { httpClient, renderers } = props;
|
|
12204
|
-
const mergedRenderers = (0,
|
|
12205
|
-
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 })) });
|
|
12206
12508
|
}
|
|
12207
12509
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
12208
12510
|
|
|
12209
12511
|
// src/revamp/DynamicFragmentWise.tsx
|
|
12210
|
-
var
|
|
12211
|
-
var
|
|
12512
|
+
var import_react22 = require("react");
|
|
12513
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12212
12514
|
var wiseRenderers2 = getWiseRenderers();
|
|
12213
|
-
var DynamicFragmentWise = (0,
|
|
12515
|
+
var DynamicFragmentWise = (0, import_react22.forwardRef)(function DynamicFragmentWise2(props, ref) {
|
|
12214
12516
|
const { httpClient, onEvent, onError, renderers } = props;
|
|
12215
|
-
const mergedRenderers = (0,
|
|
12517
|
+
const mergedRenderers = (0, import_react22.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
|
|
12216
12518
|
const { stepComponentRef } = useDynamicFlowCore(props);
|
|
12217
|
-
(0,
|
|
12519
|
+
(0, import_react22.useImperativeHandle)(
|
|
12218
12520
|
ref,
|
|
12219
12521
|
() => ({
|
|
12220
12522
|
getValue: async () => {
|
|
@@ -12229,18 +12531,18 @@ var DynamicFragmentWise = (0, import_react21.forwardRef)(function DynamicFragmen
|
|
|
12229
12531
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12230
12532
|
[]
|
|
12231
12533
|
);
|
|
12232
|
-
const render = (0,
|
|
12534
|
+
const render = (0, import_react22.useMemo)(
|
|
12233
12535
|
() => getRenderFunction([CoreContainerRenderer, ...mergedRenderers, StepRenderer]),
|
|
12234
12536
|
[mergedRenderers]
|
|
12235
12537
|
);
|
|
12236
|
-
return /* @__PURE__ */ (0,
|
|
12538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12237
12539
|
ErrorBoundary_default,
|
|
12238
12540
|
{
|
|
12239
12541
|
onError: (error) => {
|
|
12240
12542
|
onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed");
|
|
12241
12543
|
onError(error);
|
|
12242
12544
|
},
|
|
12243
|
-
children: /* @__PURE__ */ (0,
|
|
12545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(HttpClientProvider, { httpClient, children: stepComponentRef.current ? render(stepComponentRef.current) : null })
|
|
12244
12546
|
}
|
|
12245
12547
|
);
|
|
12246
12548
|
});
|
|
@@ -12551,16 +12853,16 @@ function isReference(block) {
|
|
|
12551
12853
|
}
|
|
12552
12854
|
|
|
12553
12855
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12554
|
-
var
|
|
12856
|
+
var import_react66 = require("react");
|
|
12555
12857
|
|
|
12556
12858
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12557
|
-
var
|
|
12859
|
+
var import_react24 = require("react");
|
|
12558
12860
|
|
|
12559
12861
|
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
12560
|
-
var
|
|
12862
|
+
var import_react23 = require("react");
|
|
12561
12863
|
function usePendingPromiseCounter() {
|
|
12562
|
-
const [count, setCount] = (0,
|
|
12563
|
-
const addPendingPromise = (0,
|
|
12864
|
+
const [count, setCount] = (0, import_react23.useState)(0);
|
|
12865
|
+
const addPendingPromise = (0, import_react23.useCallback)(
|
|
12564
12866
|
(promise) => {
|
|
12565
12867
|
setCount((c) => c + 1);
|
|
12566
12868
|
promise.catch(noop2).finally(() => delayUntilNextCycle(() => setCount((c) => Math.max(0, c - 1))));
|
|
@@ -12574,44 +12876,44 @@ var noop2 = () => {
|
|
|
12574
12876
|
};
|
|
12575
12877
|
|
|
12576
12878
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12577
|
-
var
|
|
12879
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12578
12880
|
var defaultContextValue = {
|
|
12579
12881
|
loading: false,
|
|
12580
12882
|
registerPersistAsyncPromise: (promise) => {
|
|
12581
12883
|
}
|
|
12582
12884
|
};
|
|
12583
|
-
var DFContext = (0,
|
|
12885
|
+
var DFContext = (0, import_react24.createContext)(defaultContextValue);
|
|
12584
12886
|
var DynamicFlowProvider = ({ loading, children }) => {
|
|
12585
12887
|
const { pendingPromises, addPendingPromise } = usePendingPromiseCounter();
|
|
12586
|
-
const providerValue = (0,
|
|
12888
|
+
const providerValue = (0, import_react24.useMemo)(() => {
|
|
12587
12889
|
return {
|
|
12588
12890
|
loading: loading || pendingPromises > 0,
|
|
12589
12891
|
registerPersistAsyncPromise: addPendingPromise
|
|
12590
12892
|
};
|
|
12591
12893
|
}, [loading, pendingPromises, addPendingPromise]);
|
|
12592
|
-
return /* @__PURE__ */ (0,
|
|
12894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DFContext.Provider, { value: providerValue, children });
|
|
12593
12895
|
};
|
|
12594
12896
|
var useDynamicFlow = () => {
|
|
12595
|
-
const context = (0,
|
|
12897
|
+
const context = (0, import_react24.useContext)(DFContext);
|
|
12596
12898
|
return context || defaultContextValue;
|
|
12597
12899
|
};
|
|
12598
12900
|
|
|
12599
12901
|
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
12600
|
-
var
|
|
12601
|
-
var
|
|
12602
|
-
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)({
|
|
12603
12905
|
triggerEvent: () => {
|
|
12604
12906
|
}
|
|
12605
12907
|
});
|
|
12606
12908
|
function EventsContextProvider({ metadata, children, onEvent }) {
|
|
12607
|
-
const value = (0,
|
|
12909
|
+
const value = (0, import_react25.useMemo)(
|
|
12608
12910
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
12609
12911
|
[onEvent, metadata]
|
|
12610
12912
|
);
|
|
12611
|
-
return /* @__PURE__ */ (0,
|
|
12913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(EventsContext.Provider, { value, children });
|
|
12612
12914
|
}
|
|
12613
12915
|
function useEventDispatcher() {
|
|
12614
|
-
const { triggerEvent } = (0,
|
|
12916
|
+
const { triggerEvent } = (0, import_react25.useContext)(EventsContext);
|
|
12615
12917
|
return triggerEvent;
|
|
12616
12918
|
}
|
|
12617
12919
|
var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) => {
|
|
@@ -12622,8 +12924,8 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
12622
12924
|
};
|
|
12623
12925
|
|
|
12624
12926
|
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
12625
|
-
var
|
|
12626
|
-
var
|
|
12927
|
+
var import_react26 = require("react");
|
|
12928
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12627
12929
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
12628
12930
|
try {
|
|
12629
12931
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -12633,9 +12935,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
12633
12935
|
} catch (e) {
|
|
12634
12936
|
}
|
|
12635
12937
|
};
|
|
12636
|
-
var LogContext = (0,
|
|
12938
|
+
var LogContext = (0, import_react26.createContext)(null);
|
|
12637
12939
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
12638
|
-
const value = (0,
|
|
12940
|
+
const value = (0, import_react26.useMemo)(
|
|
12639
12941
|
() => ({
|
|
12640
12942
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
12641
12943
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -12645,10 +12947,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
12645
12947
|
}),
|
|
12646
12948
|
[onLog, flowId, stepId]
|
|
12647
12949
|
);
|
|
12648
|
-
return /* @__PURE__ */ (0,
|
|
12950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(LogContext.Provider, { value, children });
|
|
12649
12951
|
}
|
|
12650
12952
|
var useLogger = () => {
|
|
12651
|
-
const logging = (0,
|
|
12953
|
+
const logging = (0, import_react26.useContext)(LogContext);
|
|
12652
12954
|
if (logging == null) {
|
|
12653
12955
|
throw new Error(
|
|
12654
12956
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -12658,11 +12960,11 @@ var useLogger = () => {
|
|
|
12658
12960
|
};
|
|
12659
12961
|
|
|
12660
12962
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12661
|
-
var
|
|
12662
|
-
var
|
|
12663
|
-
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)([]);
|
|
12664
12966
|
function FeatureContextProvider({ features, children }) {
|
|
12665
|
-
return /* @__PURE__ */ (0,
|
|
12967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FeatureContext.Provider, { value: features, children });
|
|
12666
12968
|
}
|
|
12667
12969
|
|
|
12668
12970
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -13392,18 +13694,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
13392
13694
|
};
|
|
13393
13695
|
|
|
13394
13696
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
13395
|
-
var
|
|
13697
|
+
var import_react28 = require("react");
|
|
13396
13698
|
function useDebouncedFunction(callback, waitMs) {
|
|
13397
|
-
return (0,
|
|
13699
|
+
return (0, import_react28.useCallback)(debounce2(callback, waitMs), [callback, waitMs]);
|
|
13398
13700
|
}
|
|
13399
13701
|
|
|
13400
13702
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
13401
|
-
var
|
|
13703
|
+
var import_react29 = require("react");
|
|
13402
13704
|
function useExternal2(url) {
|
|
13403
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
13404
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
13705
|
+
const [externalWindow, setExternalWindow] = (0, import_react29.useState)(null);
|
|
13706
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react29.useState)(false);
|
|
13405
13707
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
13406
|
-
(0,
|
|
13708
|
+
(0, import_react29.useEffect)(() => {
|
|
13407
13709
|
if (url) {
|
|
13408
13710
|
setHasManuallyTriggered(false);
|
|
13409
13711
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -13414,10 +13716,10 @@ function useExternal2(url) {
|
|
|
13414
13716
|
}
|
|
13415
13717
|
|
|
13416
13718
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
13417
|
-
var
|
|
13719
|
+
var import_react30 = require("react");
|
|
13418
13720
|
function useExternalStepPolling(polling, onAction) {
|
|
13419
13721
|
const httpClient = useHttpClient();
|
|
13420
|
-
const asyncFn = (0,
|
|
13722
|
+
const asyncFn = (0, import_react30.useMemo)(() => {
|
|
13421
13723
|
if (polling) {
|
|
13422
13724
|
return () => httpClient(polling.url).then((response) => {
|
|
13423
13725
|
if (response.ok) {
|
|
@@ -13435,7 +13737,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13435
13737
|
}
|
|
13436
13738
|
return void 0;
|
|
13437
13739
|
}, [polling, httpClient]);
|
|
13438
|
-
const onPollingResponse = (0,
|
|
13740
|
+
const onPollingResponse = (0, import_react30.useCallback)(
|
|
13439
13741
|
(pollingResponse) => {
|
|
13440
13742
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
13441
13743
|
const responseHandler = responseHandlers.find(
|
|
@@ -13462,7 +13764,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13462
13764
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
13463
13765
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
13464
13766
|
onPollingResponse,
|
|
13465
|
-
onFailure: (0,
|
|
13767
|
+
onFailure: (0, import_react30.useCallback)(() => {
|
|
13466
13768
|
if (polling) {
|
|
13467
13769
|
onAction(polling.onError.action);
|
|
13468
13770
|
}
|
|
@@ -13471,12 +13773,12 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13471
13773
|
}
|
|
13472
13774
|
|
|
13473
13775
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
13474
|
-
var
|
|
13475
|
-
var
|
|
13776
|
+
var import_react54 = require("react");
|
|
13777
|
+
var import_react_intl32 = require("react-intl");
|
|
13476
13778
|
|
|
13477
13779
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
13478
|
-
var
|
|
13479
|
-
var
|
|
13780
|
+
var import_react53 = require("react");
|
|
13781
|
+
var import_react_intl31 = require("react-intl");
|
|
13480
13782
|
|
|
13481
13783
|
// src/legacy/common/constants/DateMode.ts
|
|
13482
13784
|
var DateMode = {
|
|
@@ -13524,28 +13826,28 @@ var Size = {
|
|
|
13524
13826
|
|
|
13525
13827
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13526
13828
|
var import_classnames16 = __toESM(require_classnames());
|
|
13527
|
-
var
|
|
13829
|
+
var import_react52 = require("react");
|
|
13528
13830
|
|
|
13529
13831
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13530
|
-
var
|
|
13832
|
+
var import_components40 = require("@transferwise/components");
|
|
13531
13833
|
|
|
13532
13834
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13533
|
-
var
|
|
13835
|
+
var import_components39 = require("@transferwise/components");
|
|
13534
13836
|
|
|
13535
13837
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13536
|
-
var
|
|
13838
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
13537
13839
|
var isFlagIcon2 = (name) => name.startsWith("flag-");
|
|
13538
13840
|
function FlagIcon2({ name }) {
|
|
13539
13841
|
if (!isFlagIcon2(name)) {
|
|
13540
13842
|
return null;
|
|
13541
13843
|
}
|
|
13542
13844
|
const code = name.substring(5);
|
|
13543
|
-
return /* @__PURE__ */ (0,
|
|
13845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Flag, { intrinsicSize: 24, code });
|
|
13544
13846
|
}
|
|
13545
13847
|
|
|
13546
13848
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13547
13849
|
var icons2 = __toESM(require("@transferwise/icons"));
|
|
13548
|
-
var
|
|
13850
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
13549
13851
|
var isNamedIcon2 = (name) => {
|
|
13550
13852
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13551
13853
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -13556,19 +13858,19 @@ function NamedIcon2({ name }) {
|
|
|
13556
13858
|
}
|
|
13557
13859
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13558
13860
|
const Icon = icons2[iconName];
|
|
13559
|
-
return /* @__PURE__ */ (0,
|
|
13861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { size: 24 });
|
|
13560
13862
|
}
|
|
13561
13863
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
13562
13864
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13563
13865
|
|
|
13564
13866
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13565
|
-
var
|
|
13867
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
13566
13868
|
function DynamicIcon2({ type }) {
|
|
13567
13869
|
if (isFlagIcon2(type)) {
|
|
13568
|
-
return /* @__PURE__ */ (0,
|
|
13870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlagIcon2, { name: type });
|
|
13569
13871
|
}
|
|
13570
13872
|
if (isNamedIcon2(type)) {
|
|
13571
|
-
return /* @__PURE__ */ (0,
|
|
13873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(NamedIcon2, { name: type });
|
|
13572
13874
|
}
|
|
13573
13875
|
return null;
|
|
13574
13876
|
}
|
|
@@ -13578,17 +13880,17 @@ function isValidIconName(name) {
|
|
|
13578
13880
|
var DynamicIcon_default2 = DynamicIcon2;
|
|
13579
13881
|
|
|
13580
13882
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13581
|
-
var
|
|
13883
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
13582
13884
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13583
13885
|
if (icon == null ? void 0 : icon.name) {
|
|
13584
|
-
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 }) });
|
|
13585
13887
|
}
|
|
13586
13888
|
if (icon == null ? void 0 : icon.text) {
|
|
13587
|
-
return /* @__PURE__ */ (0,
|
|
13889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components39.Avatar, { type: import_components39.AvatarType.INITIALS, children: icon.text });
|
|
13588
13890
|
}
|
|
13589
13891
|
if (image == null ? void 0 : image.url) {
|
|
13590
13892
|
const { url, text } = image;
|
|
13591
|
-
return /* @__PURE__ */ (0,
|
|
13893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { src: url, alt: text });
|
|
13592
13894
|
}
|
|
13593
13895
|
return null;
|
|
13594
13896
|
};
|
|
@@ -13624,11 +13926,11 @@ var getTextAlignment2 = (align) => {
|
|
|
13624
13926
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
13625
13927
|
|
|
13626
13928
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13627
|
-
var
|
|
13929
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
13628
13930
|
var DynamicAlert = (props) => {
|
|
13629
13931
|
const alert = props.component;
|
|
13630
|
-
return /* @__PURE__ */ (0,
|
|
13631
|
-
|
|
13932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13933
|
+
import_components40.Alert,
|
|
13632
13934
|
{
|
|
13633
13935
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
13634
13936
|
className: getMargin2(alert.margin),
|
|
@@ -13660,12 +13962,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13660
13962
|
var DynamicAlert_default = DynamicAlert;
|
|
13661
13963
|
|
|
13662
13964
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13663
|
-
var
|
|
13965
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13664
13966
|
var DynamicBox = (props) => {
|
|
13665
13967
|
const box = props.component;
|
|
13666
13968
|
const margin = getMargin2(box.margin || box.border ? "lg" : "xs");
|
|
13667
13969
|
if (!box.width || box.width === "xl") {
|
|
13668
|
-
return /* @__PURE__ */ (0,
|
|
13970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13669
13971
|
DynamicLayout_default,
|
|
13670
13972
|
{
|
|
13671
13973
|
components: box.components,
|
|
@@ -13678,7 +13980,7 @@ var DynamicBox = (props) => {
|
|
|
13678
13980
|
}
|
|
13679
13981
|
) });
|
|
13680
13982
|
}
|
|
13681
|
-
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)(
|
|
13682
13984
|
DynamicLayout_default,
|
|
13683
13985
|
{
|
|
13684
13986
|
components: box.components,
|
|
@@ -13712,7 +14014,7 @@ var getBoxWidthClasses = (component) => {
|
|
|
13712
14014
|
var DynamicBox_default = DynamicBox;
|
|
13713
14015
|
|
|
13714
14016
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13715
|
-
var
|
|
14017
|
+
var import_components41 = require("@transferwise/components");
|
|
13716
14018
|
|
|
13717
14019
|
// src/legacy/layout/button/utils.ts
|
|
13718
14020
|
var priorities = {
|
|
@@ -13762,7 +14064,7 @@ var getButtonSize = (size) => {
|
|
|
13762
14064
|
};
|
|
13763
14065
|
|
|
13764
14066
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13765
|
-
var
|
|
14067
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13766
14068
|
function DynamicButton(props) {
|
|
13767
14069
|
var _a;
|
|
13768
14070
|
const { component, onAction } = props;
|
|
@@ -13771,8 +14073,8 @@ function DynamicButton(props) {
|
|
|
13771
14073
|
const priority = getButtonPriority(component);
|
|
13772
14074
|
const { loading } = useDynamicFlow();
|
|
13773
14075
|
const className = getMargin2(component.margin || "md");
|
|
13774
|
-
return /* @__PURE__ */ (0,
|
|
13775
|
-
|
|
14076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
14077
|
+
import_components41.Button,
|
|
13776
14078
|
{
|
|
13777
14079
|
size: getButtonSize(component.size),
|
|
13778
14080
|
type: priority === "tertiary" ? void 0 : type,
|
|
@@ -13788,12 +14090,12 @@ function DynamicButton(props) {
|
|
|
13788
14090
|
var DynamicButton_default = DynamicButton;
|
|
13789
14091
|
|
|
13790
14092
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13791
|
-
var
|
|
14093
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13792
14094
|
var DynamicColumns = (props) => {
|
|
13793
14095
|
const columns = props.component;
|
|
13794
14096
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13795
|
-
return /* @__PURE__ */ (0,
|
|
13796
|
-
/* @__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)(
|
|
13797
14099
|
DynamicLayout_default,
|
|
13798
14100
|
{
|
|
13799
14101
|
components: columns.left,
|
|
@@ -13805,7 +14107,7 @@ var DynamicColumns = (props) => {
|
|
|
13805
14107
|
onPersistAsync: props.onPersistAsync
|
|
13806
14108
|
}
|
|
13807
14109
|
) }),
|
|
13808
|
-
/* @__PURE__ */ (0,
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13809
14111
|
DynamicLayout_default,
|
|
13810
14112
|
{
|
|
13811
14113
|
components: columns.right,
|
|
@@ -13840,12 +14142,12 @@ var getWidth = (bias) => {
|
|
|
13840
14142
|
var DynamicColumns_default = DynamicColumns;
|
|
13841
14143
|
|
|
13842
14144
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13843
|
-
var
|
|
13844
|
-
var
|
|
14145
|
+
var import_components42 = require("@transferwise/components");
|
|
14146
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13845
14147
|
function DynamicDecision({ component, onAction }) {
|
|
13846
14148
|
const { loading } = useDynamicFlow();
|
|
13847
|
-
return /* @__PURE__ */ (0,
|
|
13848
|
-
|
|
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,
|
|
13849
14151
|
{
|
|
13850
14152
|
title: option.title,
|
|
13851
14153
|
content: option.description,
|
|
@@ -13861,22 +14163,22 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13861
14163
|
var DynamicDecision_default = DynamicDecision;
|
|
13862
14164
|
|
|
13863
14165
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13864
|
-
var
|
|
14166
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13865
14167
|
var DynamicDivider = ({ component }) => {
|
|
13866
14168
|
const margin = getMargin2(component.margin);
|
|
13867
14169
|
const className = `m-t-0 ${margin}`;
|
|
13868
|
-
return /* @__PURE__ */ (0,
|
|
14170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("hr", { className });
|
|
13869
14171
|
};
|
|
13870
14172
|
var DynamicDivider_default = DynamicDivider;
|
|
13871
14173
|
|
|
13872
14174
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13873
|
-
var
|
|
13874
|
-
var
|
|
13875
|
-
var
|
|
14175
|
+
var import_components43 = require("@transferwise/components");
|
|
14176
|
+
var import_react31 = require("react");
|
|
14177
|
+
var import_react_intl19 = require("react-intl");
|
|
13876
14178
|
|
|
13877
14179
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
13878
|
-
var
|
|
13879
|
-
var DynamicExternal_messages_default = (0,
|
|
14180
|
+
var import_react_intl18 = require("react-intl");
|
|
14181
|
+
var DynamicExternal_messages_default = (0, import_react_intl18.defineMessages)({
|
|
13880
14182
|
retryTitle: {
|
|
13881
14183
|
id: "dynamicFlows.DynamicExternal.retryTitle",
|
|
13882
14184
|
defaultMessage: "Reopen window",
|
|
@@ -13885,37 +14187,37 @@ var DynamicExternal_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
13885
14187
|
});
|
|
13886
14188
|
|
|
13887
14189
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13888
|
-
var
|
|
14190
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13889
14191
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13890
14192
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13891
|
-
const intl = (0,
|
|
13892
|
-
const openExternalUrl = (0,
|
|
14193
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
14194
|
+
const openExternalUrl = (0, import_react31.useCallback)(
|
|
13893
14195
|
() => window.open(requestUrl, "df-external-window"),
|
|
13894
14196
|
[requestUrl]
|
|
13895
14197
|
);
|
|
13896
|
-
(0,
|
|
14198
|
+
(0, import_react31.useEffect)(() => {
|
|
13897
14199
|
openExternalUrl();
|
|
13898
14200
|
}, [openExternalUrl]);
|
|
13899
14201
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
13900
14202
|
responseHandlers
|
|
13901
14203
|
}) : void 0;
|
|
13902
14204
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13903
|
-
return /* @__PURE__ */ (0,
|
|
13904
|
-
/* @__PURE__ */ (0,
|
|
13905
|
-
/* @__PURE__ */ (0,
|
|
13906
|
-
/* @__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) })
|
|
13907
14209
|
] });
|
|
13908
14210
|
};
|
|
13909
14211
|
var DynamicExternal_default = DynamicExternal;
|
|
13910
14212
|
|
|
13911
14213
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
13912
|
-
var
|
|
14214
|
+
var import_react45 = require("react");
|
|
13913
14215
|
|
|
13914
14216
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13915
|
-
var
|
|
14217
|
+
var import_components44 = require("@transferwise/components");
|
|
13916
14218
|
var import_classnames7 = __toESM(require_classnames());
|
|
13917
|
-
var
|
|
13918
|
-
var
|
|
14219
|
+
var import_react32 = require("react");
|
|
14220
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13919
14221
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13920
14222
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13921
14223
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13930,13 +14232,13 @@ function AllOfSchema(props) {
|
|
|
13930
14232
|
setModels(models);
|
|
13931
14233
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13932
14234
|
};
|
|
13933
|
-
const [models, setModels] = (0,
|
|
13934
|
-
return /* @__PURE__ */ (0,
|
|
13935
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
13936
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
13937
|
-
/* @__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) => (
|
|
13938
14240
|
// eslint-disable-next-line react/no-array-index-key
|
|
13939
|
-
/* @__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)(
|
|
13940
14242
|
GenericSchema_default,
|
|
13941
14243
|
{
|
|
13942
14244
|
schema,
|
|
@@ -13960,15 +14262,15 @@ AllOfSchema.defaultProps = {
|
|
|
13960
14262
|
var AllOfSchema_default = AllOfSchema;
|
|
13961
14263
|
|
|
13962
14264
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13963
|
-
var
|
|
14265
|
+
var import_components46 = require("@transferwise/components");
|
|
13964
14266
|
var import_classnames8 = __toESM(require_classnames());
|
|
13965
|
-
var
|
|
14267
|
+
var import_react33 = require("react");
|
|
13966
14268
|
|
|
13967
14269
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13968
|
-
var
|
|
14270
|
+
var import_components45 = require("@transferwise/components");
|
|
13969
14271
|
var import_formatting2 = require("@transferwise/formatting");
|
|
13970
|
-
var
|
|
13971
|
-
var
|
|
14272
|
+
var import_react_intl20 = require("react-intl");
|
|
14273
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
13972
14274
|
function ControlFeedback(props) {
|
|
13973
14275
|
var _a;
|
|
13974
14276
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13977,12 +14279,12 @@ function ControlFeedback(props) {
|
|
|
13977
14279
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
|
|
13978
14280
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13979
14281
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13980
|
-
return /* @__PURE__ */ (0,
|
|
13981
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
13982
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
13983
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
13984
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
13985
|
-
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 })
|
|
13986
14288
|
] })
|
|
13987
14289
|
] });
|
|
13988
14290
|
}
|
|
@@ -13993,7 +14295,7 @@ ControlFeedback.defaultProps = {
|
|
|
13993
14295
|
validationAsyncSuccessMessage: null
|
|
13994
14296
|
};
|
|
13995
14297
|
function useDefaultValidationMessages(schema) {
|
|
13996
|
-
const { formatMessage, locale } = (0,
|
|
14298
|
+
const { formatMessage, locale } = (0, import_react_intl20.useIntl)();
|
|
13997
14299
|
const formattedMessages = {
|
|
13998
14300
|
type: formatMessage(validation_messages_default.type),
|
|
13999
14301
|
minimum: formatMessage(validation_messages_default.minimum, {
|
|
@@ -14080,11 +14382,11 @@ function constructUploadError(response) {
|
|
|
14080
14382
|
}
|
|
14081
14383
|
|
|
14082
14384
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
14083
|
-
var
|
|
14385
|
+
var import_react_intl22 = require("react-intl");
|
|
14084
14386
|
|
|
14085
14387
|
// src/legacy/common/messages.ts
|
|
14086
|
-
var
|
|
14087
|
-
var messages_default = (0,
|
|
14388
|
+
var import_react_intl21 = require("react-intl");
|
|
14389
|
+
var messages_default = (0, import_react_intl21.defineMessages)({
|
|
14088
14390
|
required: {
|
|
14089
14391
|
id: "dynamicFlows.DefaultErrorMessages.required",
|
|
14090
14392
|
defaultMessage: "Please fill out this field.",
|
|
@@ -14097,7 +14399,7 @@ function useFormattedDefaultErrorMessages({
|
|
|
14097
14399
|
maxItems,
|
|
14098
14400
|
minItems
|
|
14099
14401
|
}) {
|
|
14100
|
-
const { formatMessage } = (0,
|
|
14402
|
+
const { formatMessage } = (0, import_react_intl22.useIntl)();
|
|
14101
14403
|
const { maxFileSizeError, maxItemsError, minItemsError } = multi_file_upload_messages_default;
|
|
14102
14404
|
return {
|
|
14103
14405
|
maxFileSizeErrorMessage: formatMessage(maxFileSizeError),
|
|
@@ -14108,15 +14410,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
14108
14410
|
}
|
|
14109
14411
|
|
|
14110
14412
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
14111
|
-
var
|
|
14413
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14112
14414
|
function MultipleFileUploadSchema(props) {
|
|
14113
14415
|
var _a, _b;
|
|
14114
14416
|
const { onChange, schema } = props;
|
|
14115
14417
|
const onEvent = useEventDispatcher();
|
|
14116
14418
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
14117
|
-
const uid = (0,
|
|
14118
|
-
const [inputChanged, setInputChanged] = (0,
|
|
14119
|
-
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 || []));
|
|
14120
14422
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
14121
14423
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
14122
14424
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -14170,10 +14472,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
14170
14472
|
onDeleteFile: () => Promise.resolve()
|
|
14171
14473
|
});
|
|
14172
14474
|
const feedbackId = `${uid}-feedback`;
|
|
14173
|
-
return /* @__PURE__ */ (0,
|
|
14174
|
-
/* @__PURE__ */ (0,
|
|
14175
|
-
/* @__PURE__ */ (0,
|
|
14176
|
-
/* @__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)(
|
|
14177
14479
|
ControlFeedback_default,
|
|
14178
14480
|
{
|
|
14179
14481
|
id: feedbackId,
|
|
@@ -14203,7 +14505,7 @@ function getSuccessfullyProcessedFiles(allFiles) {
|
|
|
14203
14505
|
return allFiles.filter((file) => !file.error && file.status === "succeeded");
|
|
14204
14506
|
}
|
|
14205
14507
|
function convertFileIdsToComponentFileObjects(fileIds) {
|
|
14206
|
-
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);
|
|
14207
14509
|
}
|
|
14208
14510
|
function isValidId(id) {
|
|
14209
14511
|
return isNumber3(id) || isString2(id);
|
|
@@ -14214,14 +14516,14 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
14214
14516
|
}
|
|
14215
14517
|
|
|
14216
14518
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14217
|
-
var
|
|
14519
|
+
var import_components48 = require("@transferwise/components");
|
|
14218
14520
|
var import_classnames9 = __toESM(require_classnames());
|
|
14219
|
-
var
|
|
14220
|
-
var
|
|
14521
|
+
var import_react34 = require("react");
|
|
14522
|
+
var import_react_intl23 = require("react-intl");
|
|
14221
14523
|
|
|
14222
14524
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
14223
|
-
var
|
|
14224
|
-
var
|
|
14525
|
+
var import_components47 = require("@transferwise/components");
|
|
14526
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14225
14527
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
14226
14528
|
switch (controlType) {
|
|
14227
14529
|
case "select":
|
|
@@ -14245,7 +14547,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
14245
14547
|
var mapImage = (image) => {
|
|
14246
14548
|
if (image == null ? void 0 : image.url) {
|
|
14247
14549
|
return {
|
|
14248
|
-
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 || "" }) }) }),
|
|
14249
14551
|
hideIconInTrigger: true
|
|
14250
14552
|
};
|
|
14251
14553
|
}
|
|
@@ -14254,17 +14556,17 @@ var mapImage = (image) => {
|
|
|
14254
14556
|
var getIconPropertyForSelectOption = (icon) => {
|
|
14255
14557
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon2(icon.name)) {
|
|
14256
14558
|
return {
|
|
14257
|
-
icon: /* @__PURE__ */ (0,
|
|
14559
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
14258
14560
|
};
|
|
14259
14561
|
}
|
|
14260
14562
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14261
14563
|
return {
|
|
14262
|
-
icon: /* @__PURE__ */ (0,
|
|
14564
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DynamicIcon_default2, { type: icon.name })
|
|
14263
14565
|
};
|
|
14264
14566
|
}
|
|
14265
14567
|
if (icon == null ? void 0 : icon.text) {
|
|
14266
14568
|
return {
|
|
14267
|
-
icon: /* @__PURE__ */ (0,
|
|
14569
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { children: icon.text })
|
|
14268
14570
|
};
|
|
14269
14571
|
}
|
|
14270
14572
|
return null;
|
|
@@ -14272,17 +14574,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
14272
14574
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
14273
14575
|
if (image == null ? void 0 : image.url) {
|
|
14274
14576
|
return {
|
|
14275
|
-
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: "" }) })
|
|
14276
14578
|
};
|
|
14277
14579
|
}
|
|
14278
14580
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14279
14581
|
return {
|
|
14280
|
-
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 }) })
|
|
14281
14583
|
};
|
|
14282
14584
|
}
|
|
14283
14585
|
if (icon == null ? void 0 : icon.text) {
|
|
14284
14586
|
return {
|
|
14285
|
-
avatar: /* @__PURE__ */ (0,
|
|
14587
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.Avatar, { type: import_components47.AvatarType.INITIALS, children: icon.text })
|
|
14286
14588
|
};
|
|
14287
14589
|
}
|
|
14288
14590
|
return null;
|
|
@@ -14310,18 +14612,8 @@ var getDisabled = (disabled) => {
|
|
|
14310
14612
|
return void 0;
|
|
14311
14613
|
};
|
|
14312
14614
|
|
|
14313
|
-
// src/common/messages/multi-select.messages.ts
|
|
14314
|
-
var import_react_intl21 = require("react-intl");
|
|
14315
|
-
var multi_select_messages_default = (0, import_react_intl21.defineMessages)({
|
|
14316
|
-
summary: {
|
|
14317
|
-
id: "dynamicFlows.MultiSelect.summary",
|
|
14318
|
-
defaultMessage: "{first} and {count} more",
|
|
14319
|
-
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."
|
|
14320
|
-
}
|
|
14321
|
-
});
|
|
14322
|
-
|
|
14323
14615
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14324
|
-
var
|
|
14616
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14325
14617
|
function MultiSelectSchema({
|
|
14326
14618
|
schema,
|
|
14327
14619
|
model,
|
|
@@ -14330,13 +14622,13 @@ function MultiSelectSchema({
|
|
|
14330
14622
|
errors,
|
|
14331
14623
|
onChange
|
|
14332
14624
|
}) {
|
|
14333
|
-
const { formatMessage, locale } = (0,
|
|
14625
|
+
const { formatMessage, locale } = (0, import_react_intl23.useIntl)();
|
|
14334
14626
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
14335
14627
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
14336
|
-
const id = (0,
|
|
14337
|
-
const [changed, setChanged] = (0,
|
|
14338
|
-
const [selected, setSelected] = (0,
|
|
14339
|
-
(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)(
|
|
14340
14632
|
() => {
|
|
14341
14633
|
if (selected) {
|
|
14342
14634
|
broadcastModelChange(selected);
|
|
@@ -14373,10 +14665,10 @@ function MultiSelectSchema({
|
|
|
14373
14665
|
const formGroupClasses = {
|
|
14374
14666
|
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
14375
14667
|
};
|
|
14376
|
-
return /* @__PURE__ */ (0,
|
|
14377
|
-
schema.title ? /* @__PURE__ */ (0,
|
|
14378
|
-
/* @__PURE__ */ (0,
|
|
14379
|
-
|
|
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,
|
|
14380
14672
|
{
|
|
14381
14673
|
id,
|
|
14382
14674
|
multiple: true,
|
|
@@ -14401,12 +14693,12 @@ function MultiSelectSchema({
|
|
|
14401
14693
|
if (withinTrigger) {
|
|
14402
14694
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14403
14695
|
}
|
|
14404
|
-
return /* @__PURE__ */ (0,
|
|
14696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components48.SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
14405
14697
|
},
|
|
14406
14698
|
onChange: broadcastModelChange
|
|
14407
14699
|
}
|
|
14408
14700
|
),
|
|
14409
|
-
/* @__PURE__ */ (0,
|
|
14701
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14410
14702
|
ControlFeedback_default,
|
|
14411
14703
|
{
|
|
14412
14704
|
id: `${id}-feedback`,
|
|
@@ -14423,7 +14715,7 @@ function MultiSelectSchema({
|
|
|
14423
14715
|
)
|
|
14424
14716
|
] });
|
|
14425
14717
|
}
|
|
14426
|
-
var
|
|
14718
|
+
var getInitialModelIndices2 = (model, options) => {
|
|
14427
14719
|
if (model == null) {
|
|
14428
14720
|
return null;
|
|
14429
14721
|
}
|
|
@@ -14431,17 +14723,17 @@ var getInitialModelIndices = (model, options) => {
|
|
|
14431
14723
|
};
|
|
14432
14724
|
|
|
14433
14725
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14434
|
-
var
|
|
14726
|
+
var import_components50 = require("@transferwise/components");
|
|
14435
14727
|
var import_icons4 = require("@transferwise/icons");
|
|
14436
|
-
var
|
|
14437
|
-
var
|
|
14728
|
+
var import_react36 = require("react");
|
|
14729
|
+
var import_react_intl25 = require("react-intl");
|
|
14438
14730
|
|
|
14439
14731
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14440
|
-
var
|
|
14441
|
-
var
|
|
14732
|
+
var import_components49 = require("@transferwise/components");
|
|
14733
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14442
14734
|
function ItemSummaryOption2({ item, onClick }) {
|
|
14443
|
-
return /* @__PURE__ */ (0,
|
|
14444
|
-
|
|
14735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14736
|
+
import_components49.NavigationOption,
|
|
14445
14737
|
{
|
|
14446
14738
|
media: getNavigationOptionMedia(item),
|
|
14447
14739
|
title: item.title,
|
|
@@ -14453,9 +14745,9 @@ function ItemSummaryOption2({ item, onClick }) {
|
|
|
14453
14745
|
}
|
|
14454
14746
|
|
|
14455
14747
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14456
|
-
var
|
|
14457
|
-
var
|
|
14458
|
-
var
|
|
14748
|
+
var import_react35 = require("react");
|
|
14749
|
+
var import_react_intl24 = require("react-intl");
|
|
14750
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14459
14751
|
function RepeatableSchemaStep({
|
|
14460
14752
|
type,
|
|
14461
14753
|
schema,
|
|
@@ -14465,8 +14757,8 @@ function RepeatableSchemaStep({
|
|
|
14465
14757
|
onModelChange,
|
|
14466
14758
|
onAction
|
|
14467
14759
|
}) {
|
|
14468
|
-
const { formatMessage } = (0,
|
|
14469
|
-
const [filename, setFilename] = (0,
|
|
14760
|
+
const { formatMessage } = (0, import_react_intl24.useIntl)();
|
|
14761
|
+
const [filename, setFilename] = (0, import_react35.useState)(void 0);
|
|
14470
14762
|
const step = {
|
|
14471
14763
|
layout: [
|
|
14472
14764
|
{
|
|
@@ -14503,7 +14795,7 @@ function RepeatableSchemaStep({
|
|
|
14503
14795
|
}
|
|
14504
14796
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14505
14797
|
};
|
|
14506
|
-
return /* @__PURE__ */ (0,
|
|
14798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14507
14799
|
DynamicFlowStep,
|
|
14508
14800
|
{
|
|
14509
14801
|
step,
|
|
@@ -14709,7 +15001,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14709
15001
|
|
|
14710
15002
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14711
15003
|
var import_classnames10 = __toESM(require_classnames());
|
|
14712
|
-
var
|
|
15004
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14713
15005
|
function RepeatableSchema({
|
|
14714
15006
|
schema,
|
|
14715
15007
|
model,
|
|
@@ -14719,9 +15011,9 @@ function RepeatableSchema({
|
|
|
14719
15011
|
onChange
|
|
14720
15012
|
}) {
|
|
14721
15013
|
var _a;
|
|
14722
|
-
const [openModalType, setOpenModalType] = (0,
|
|
14723
|
-
const [changed, setChanged] = (0,
|
|
14724
|
-
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)(() => {
|
|
14725
15017
|
if (isObject2(model) && !isArray2(model)) {
|
|
14726
15018
|
throw new Error(
|
|
14727
15019
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14729,8 +15021,8 @@ function RepeatableSchema({
|
|
|
14729
15021
|
}
|
|
14730
15022
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14731
15023
|
});
|
|
14732
|
-
const [editableItem, setEditableItem] = (0,
|
|
14733
|
-
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]);
|
|
14734
15026
|
const broadcastModelChange = (updatedItems) => {
|
|
14735
15027
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
14736
15028
|
onChange({
|
|
@@ -14772,7 +15064,7 @@ function RepeatableSchema({
|
|
|
14772
15064
|
setEditableItem({ item: null, model: null });
|
|
14773
15065
|
setOpenModalType(null);
|
|
14774
15066
|
};
|
|
14775
|
-
const { formatMessage } = (0,
|
|
15067
|
+
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
14776
15068
|
const validations = getValidationFailures(model, schema, required);
|
|
14777
15069
|
const base64ValidationMessages = useFormattedDefaultErrorMessages({
|
|
14778
15070
|
minItems: schema.minItems,
|
|
@@ -14786,9 +15078,9 @@ function RepeatableSchema({
|
|
|
14786
15078
|
const formGroupClasses = {
|
|
14787
15079
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14788
15080
|
};
|
|
14789
|
-
return /* @__PURE__ */ (0,
|
|
14790
|
-
schema.title && /* @__PURE__ */ (0,
|
|
14791
|
-
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)(
|
|
14792
15084
|
ItemSummaryOption2,
|
|
14793
15085
|
{
|
|
14794
15086
|
item: itemSummary,
|
|
@@ -14796,21 +15088,21 @@ function RepeatableSchema({
|
|
|
14796
15088
|
},
|
|
14797
15089
|
JSON.stringify(itemSummary)
|
|
14798
15090
|
)),
|
|
14799
|
-
/* @__PURE__ */ (0,
|
|
14800
|
-
|
|
15091
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
15092
|
+
import_components50.NavigationOption,
|
|
14801
15093
|
{
|
|
14802
|
-
media: /* @__PURE__ */ (0,
|
|
15094
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_icons4.Plus, {}),
|
|
14803
15095
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14804
15096
|
showMediaAtAllSizes: true,
|
|
14805
15097
|
onClick: onAddItem
|
|
14806
15098
|
}
|
|
14807
15099
|
),
|
|
14808
|
-
/* @__PURE__ */ (0,
|
|
14809
|
-
|
|
15100
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
15101
|
+
import_components50.Modal,
|
|
14810
15102
|
{
|
|
14811
15103
|
open: openModalType !== null,
|
|
14812
15104
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14813
|
-
body: /* @__PURE__ */ (0,
|
|
15105
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14814
15106
|
RepeatableSchemaStep_default,
|
|
14815
15107
|
{
|
|
14816
15108
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14825,7 +15117,7 @@ function RepeatableSchema({
|
|
|
14825
15117
|
onClose: onCancelEdit
|
|
14826
15118
|
}
|
|
14827
15119
|
),
|
|
14828
|
-
/* @__PURE__ */ (0,
|
|
15120
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14829
15121
|
ControlFeedback_default,
|
|
14830
15122
|
{
|
|
14831
15123
|
id: `${id}-feedback`,
|
|
@@ -14867,17 +15159,17 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14867
15159
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14868
15160
|
|
|
14869
15161
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14870
|
-
var
|
|
15162
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14871
15163
|
function ArrayListSchema(props) {
|
|
14872
15164
|
const { schema } = props;
|
|
14873
15165
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14874
|
-
return /* @__PURE__ */ (0,
|
|
15166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14875
15167
|
}
|
|
14876
15168
|
if (isMultiSelectConstSchema(schema)) {
|
|
14877
|
-
return /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14878
15170
|
}
|
|
14879
15171
|
if (isListArraySchema(schema)) {
|
|
14880
|
-
return /* @__PURE__ */ (0,
|
|
15172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14881
15173
|
}
|
|
14882
15174
|
throw new Error("Invalid array list schema");
|
|
14883
15175
|
}
|
|
@@ -14888,11 +15180,11 @@ ArrayListSchema.defaultProps = {
|
|
|
14888
15180
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14889
15181
|
|
|
14890
15182
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14891
|
-
var
|
|
15183
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
14892
15184
|
var ArraySchema = (props) => {
|
|
14893
15185
|
const { schema } = props;
|
|
14894
15186
|
if (isListArraySchema(schema)) {
|
|
14895
|
-
return /* @__PURE__ */ (0,
|
|
15187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
14896
15188
|
}
|
|
14897
15189
|
throw new Error("Not implemented");
|
|
14898
15190
|
};
|
|
@@ -14902,17 +15194,17 @@ ArraySchema.defaultProps = {
|
|
|
14902
15194
|
var ArraySchema_default = ArraySchema;
|
|
14903
15195
|
|
|
14904
15196
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14905
|
-
var
|
|
15197
|
+
var import_components51 = require("@transferwise/components");
|
|
14906
15198
|
var import_classnames11 = __toESM(require_classnames());
|
|
14907
|
-
var
|
|
14908
|
-
var
|
|
15199
|
+
var import_react37 = require("react");
|
|
15200
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
14909
15201
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14910
15202
|
"col-xs-12": true,
|
|
14911
15203
|
"col-sm-6": width === "md",
|
|
14912
15204
|
"col-sm-4": width === "sm"
|
|
14913
15205
|
});
|
|
14914
15206
|
function ObjectSchema(props) {
|
|
14915
|
-
const [model, setModel] = (0,
|
|
15207
|
+
const [model, setModel] = (0, import_react37.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14916
15208
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14917
15209
|
if (onChangeProps.model !== null) {
|
|
14918
15210
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14923,7 +15215,7 @@ function ObjectSchema(props) {
|
|
|
14923
15215
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
14924
15216
|
};
|
|
14925
15217
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
14926
|
-
(0,
|
|
15218
|
+
(0, import_react37.useEffect)(() => {
|
|
14927
15219
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
14928
15220
|
setModel(newModel);
|
|
14929
15221
|
if (!isEqual(newModel, model)) {
|
|
@@ -14941,22 +15233,22 @@ function ObjectSchema(props) {
|
|
|
14941
15233
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
14942
15234
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14943
15235
|
const propsErrors = props.errors;
|
|
14944
|
-
return /* @__PURE__ */ (0,
|
|
14945
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
14946
|
-
/* @__PURE__ */ (0,
|
|
14947
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14948
|
-
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: [
|
|
14949
15241
|
" ",
|
|
14950
15242
|
props.schema.description,
|
|
14951
15243
|
" "
|
|
14952
15244
|
] }),
|
|
14953
|
-
/* @__PURE__ */ (0,
|
|
15245
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14954
15246
|
"div",
|
|
14955
15247
|
{
|
|
14956
15248
|
className: (0, import_classnames11.default)(
|
|
14957
15249
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14958
15250
|
),
|
|
14959
|
-
children: /* @__PURE__ */ (0,
|
|
15251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14960
15252
|
GenericSchema_default,
|
|
14961
15253
|
{
|
|
14962
15254
|
schema: props.schema.properties[propertyName],
|
|
@@ -14982,21 +15274,21 @@ ObjectSchema.defaultProps = {
|
|
|
14982
15274
|
var ObjectSchema_default = ObjectSchema;
|
|
14983
15275
|
|
|
14984
15276
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14985
|
-
var
|
|
15277
|
+
var import_components54 = require("@transferwise/components");
|
|
14986
15278
|
var import_classnames12 = __toESM(require_classnames());
|
|
14987
|
-
var
|
|
15279
|
+
var import_react40 = require("react");
|
|
14988
15280
|
|
|
14989
15281
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14990
|
-
var
|
|
14991
|
-
var
|
|
14992
|
-
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");
|
|
14993
15285
|
function Help2(props) {
|
|
14994
|
-
const intl = (0,
|
|
14995
|
-
return /* @__PURE__ */ (0,
|
|
14996
|
-
|
|
15286
|
+
const intl = (0, import_react_intl26.useIntl)();
|
|
15287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15288
|
+
import_components52.Info,
|
|
14997
15289
|
{
|
|
14998
15290
|
className: "m-l-1",
|
|
14999
|
-
content: /* @__PURE__ */ (0,
|
|
15291
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components52.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
15000
15292
|
presentation: "POPOVER",
|
|
15001
15293
|
size: "sm",
|
|
15002
15294
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -15006,11 +15298,11 @@ function Help2(props) {
|
|
|
15006
15298
|
var Help_default2 = Help2;
|
|
15007
15299
|
|
|
15008
15300
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15009
|
-
var
|
|
15301
|
+
var import_react39 = require("react");
|
|
15010
15302
|
|
|
15011
15303
|
// src/legacy/formControl/FormControl.tsx
|
|
15012
|
-
var
|
|
15013
|
-
var
|
|
15304
|
+
var import_components53 = require("@transferwise/components");
|
|
15305
|
+
var import_react38 = require("react");
|
|
15014
15306
|
|
|
15015
15307
|
// src/legacy/formControl/utils/value-utils.ts
|
|
15016
15308
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -15196,8 +15488,8 @@ var autocompleteTokenMap2 = {
|
|
|
15196
15488
|
};
|
|
15197
15489
|
|
|
15198
15490
|
// src/legacy/formControl/FormControl.tsx
|
|
15199
|
-
var
|
|
15200
|
-
var _FormControl = class _FormControl extends
|
|
15491
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15492
|
+
var _FormControl = class _FormControl extends import_react38.PureComponent {
|
|
15201
15493
|
constructor(props) {
|
|
15202
15494
|
super(props);
|
|
15203
15495
|
this.getAutocompleteValue = ({ prefix = "", suffix = "" } = {}) => {
|
|
@@ -15284,8 +15576,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15284
15576
|
} = this.props;
|
|
15285
15577
|
switch (type) {
|
|
15286
15578
|
case FormControlType.RADIO:
|
|
15287
|
-
return /* @__PURE__ */ (0,
|
|
15288
|
-
|
|
15579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15580
|
+
import_components53.RadioGroup,
|
|
15289
15581
|
{
|
|
15290
15582
|
radios: options.map(this.mapOption),
|
|
15291
15583
|
name,
|
|
@@ -15294,8 +15586,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15294
15586
|
}
|
|
15295
15587
|
);
|
|
15296
15588
|
case FormControlType.CHECKBOX:
|
|
15297
|
-
return /* @__PURE__ */ (0,
|
|
15298
|
-
|
|
15589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15590
|
+
import_components53.Checkbox,
|
|
15299
15591
|
{
|
|
15300
15592
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
15301
15593
|
disabled,
|
|
@@ -15312,8 +15604,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15312
15604
|
const search = options.length >= 8;
|
|
15313
15605
|
const items = options;
|
|
15314
15606
|
const selected = this.getSelectedOption(options);
|
|
15315
|
-
return /* @__PURE__ */ (0,
|
|
15316
|
-
|
|
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,
|
|
15317
15609
|
{
|
|
15318
15610
|
id,
|
|
15319
15611
|
items: items.map((value2) => ({
|
|
@@ -15322,8 +15614,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15322
15614
|
disabled: value2.disabled
|
|
15323
15615
|
})),
|
|
15324
15616
|
value: selected != null ? selected : null,
|
|
15325
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0,
|
|
15326
|
-
|
|
15617
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15618
|
+
import_components53.SelectInputOptionContent,
|
|
15327
15619
|
{
|
|
15328
15620
|
title: label2,
|
|
15329
15621
|
note: withinTrigger ? note != null ? note : secondary : note,
|
|
@@ -15351,13 +15643,13 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15351
15643
|
) });
|
|
15352
15644
|
}
|
|
15353
15645
|
case FormControlType.TAB:
|
|
15354
|
-
return /* @__PURE__ */ (0,
|
|
15355
|
-
|
|
15646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15647
|
+
import_components53.Tabs,
|
|
15356
15648
|
{
|
|
15357
15649
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15358
15650
|
tabs: options.map((option) => ({
|
|
15359
15651
|
title: option.label,
|
|
15360
|
-
content: /* @__PURE__ */ (0,
|
|
15652
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {}),
|
|
15361
15653
|
disabled: option.disabled || false
|
|
15362
15654
|
})),
|
|
15363
15655
|
name: id,
|
|
@@ -15372,7 +15664,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15372
15664
|
);
|
|
15373
15665
|
case FormControlType.NUMERIC:
|
|
15374
15666
|
case FormControlType.NUMBER: {
|
|
15375
|
-
return /* @__PURE__ */ (0,
|
|
15667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15376
15668
|
"input",
|
|
15377
15669
|
{
|
|
15378
15670
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15406,7 +15698,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15406
15698
|
);
|
|
15407
15699
|
}
|
|
15408
15700
|
case FormControlType.HIDDEN:
|
|
15409
|
-
return /* @__PURE__ */ (0,
|
|
15701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15410
15702
|
"input",
|
|
15411
15703
|
{
|
|
15412
15704
|
type: "hidden",
|
|
@@ -15416,7 +15708,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15416
15708
|
}
|
|
15417
15709
|
);
|
|
15418
15710
|
case FormControlType.PASSWORD:
|
|
15419
|
-
return /* @__PURE__ */ (0,
|
|
15711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15420
15712
|
"input",
|
|
15421
15713
|
{
|
|
15422
15714
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15436,8 +15728,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15436
15728
|
);
|
|
15437
15729
|
case FormControlType.DATE:
|
|
15438
15730
|
case FormControlType.DATETIME:
|
|
15439
|
-
return /* @__PURE__ */ (0,
|
|
15440
|
-
|
|
15731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15732
|
+
import_components53.DateInput,
|
|
15441
15733
|
{
|
|
15442
15734
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
15443
15735
|
yearAutoComplete: this.getAutocompleteValue({ suffix: "-year" }),
|
|
@@ -15452,8 +15744,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15452
15744
|
}
|
|
15453
15745
|
);
|
|
15454
15746
|
case FormControlType.DATELOOKUP: {
|
|
15455
|
-
return /* @__PURE__ */ (0,
|
|
15456
|
-
|
|
15747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15748
|
+
import_components53.DateLookup,
|
|
15457
15749
|
{
|
|
15458
15750
|
value: getSafeDateStringValue(value),
|
|
15459
15751
|
min: minDate,
|
|
@@ -15470,8 +15762,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15470
15762
|
);
|
|
15471
15763
|
}
|
|
15472
15764
|
case FormControlType.TEL:
|
|
15473
|
-
return /* @__PURE__ */ (0,
|
|
15474
|
-
|
|
15765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15766
|
+
import_components53.PhoneNumberInput,
|
|
15475
15767
|
{
|
|
15476
15768
|
disabled,
|
|
15477
15769
|
countryCode,
|
|
@@ -15502,8 +15794,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15502
15794
|
autoComplete: this.getAutocompleteValue()
|
|
15503
15795
|
};
|
|
15504
15796
|
if (this.props.displayPattern) {
|
|
15505
|
-
return /* @__PURE__ */ (0,
|
|
15506
|
-
|
|
15797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15798
|
+
import_components53.TextareaWithDisplayFormat,
|
|
15507
15799
|
__spreadProps(__spreadValues({
|
|
15508
15800
|
displayPattern: this.props.displayPattern
|
|
15509
15801
|
}, textareaProps), {
|
|
@@ -15511,7 +15803,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15511
15803
|
})
|
|
15512
15804
|
);
|
|
15513
15805
|
}
|
|
15514
|
-
return /* @__PURE__ */ (0,
|
|
15806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15515
15807
|
"textarea",
|
|
15516
15808
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15517
15809
|
"aria-describedby": describedBy,
|
|
@@ -15524,8 +15816,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15524
15816
|
return (
|
|
15525
15817
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15526
15818
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
15527
|
-
/* @__PURE__ */ (0,
|
|
15528
|
-
|
|
15819
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15820
|
+
import_components53.Upload,
|
|
15529
15821
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15530
15822
|
usAccept: uploadProps.usAccept || "*",
|
|
15531
15823
|
usDisabled: uploadProps.usDisabled || disabled,
|
|
@@ -15562,8 +15854,8 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15562
15854
|
autoComplete: this.getAutocompleteValue()
|
|
15563
15855
|
};
|
|
15564
15856
|
if (this.props.displayPattern) {
|
|
15565
|
-
return /* @__PURE__ */ (0,
|
|
15566
|
-
|
|
15857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15858
|
+
import_components53.InputWithDisplayFormat,
|
|
15567
15859
|
__spreadProps(__spreadValues({
|
|
15568
15860
|
displayPattern: this.props.displayPattern
|
|
15569
15861
|
}, inputProps), {
|
|
@@ -15571,7 +15863,7 @@ var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
|
15571
15863
|
})
|
|
15572
15864
|
);
|
|
15573
15865
|
}
|
|
15574
|
-
return /* @__PURE__ */ (0,
|
|
15866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15575
15867
|
"input",
|
|
15576
15868
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15577
15869
|
"aria-describedby": describedBy,
|
|
@@ -15620,7 +15912,7 @@ _FormControl.defaultProps = {
|
|
|
15620
15912
|
var FormControl = _FormControl;
|
|
15621
15913
|
|
|
15622
15914
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15623
|
-
var
|
|
15915
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
15624
15916
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15625
15917
|
var getControlType = (schema) => {
|
|
15626
15918
|
if (isOneOfSchema2(schema)) {
|
|
@@ -15699,7 +15991,7 @@ function SchemaFormControl(props) {
|
|
|
15699
15991
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
15700
15992
|
};
|
|
15701
15993
|
const controlType = getControlType(schema);
|
|
15702
|
-
(0,
|
|
15994
|
+
(0, import_react39.useEffect)(() => {
|
|
15703
15995
|
warnIfInvalidSchema(schema, log, controlType);
|
|
15704
15996
|
}, [JSON.stringify(schema), log, controlType]);
|
|
15705
15997
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -15726,7 +16018,7 @@ function SchemaFormControl(props) {
|
|
|
15726
16018
|
describedBy,
|
|
15727
16019
|
required
|
|
15728
16020
|
};
|
|
15729
|
-
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)) });
|
|
15730
16022
|
}
|
|
15731
16023
|
SchemaFormControl.defaultProps = {
|
|
15732
16024
|
value: null,
|
|
@@ -15755,17 +16047,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15755
16047
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15756
16048
|
|
|
15757
16049
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15758
|
-
var
|
|
16050
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
15759
16051
|
function OneOfSchema(props) {
|
|
15760
16052
|
const onEvent = useEventDispatcher();
|
|
15761
|
-
const [changed, setChanged] = (0,
|
|
15762
|
-
const [focused, setFocused] = (0,
|
|
15763
|
-
const [blurred, setBlurred] = (0,
|
|
15764
|
-
const id = (0,
|
|
15765
|
-
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)(
|
|
15766
16058
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15767
16059
|
);
|
|
15768
|
-
const [models, setModels] = (0,
|
|
16060
|
+
const [models, setModels] = (0, import_react40.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15769
16061
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15770
16062
|
const onSearchChange = (searchValue) => {
|
|
15771
16063
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15773,7 +16065,7 @@ function OneOfSchema(props) {
|
|
|
15773
16065
|
searchValueLength: searchValue.length
|
|
15774
16066
|
});
|
|
15775
16067
|
};
|
|
15776
|
-
(0,
|
|
16068
|
+
(0, import_react40.useEffect)(() => {
|
|
15777
16069
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
15778
16070
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
15779
16071
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -15831,12 +16123,12 @@ function OneOfSchema(props) {
|
|
|
15831
16123
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
15832
16124
|
};
|
|
15833
16125
|
const feedbackId = `${id}-feedback`;
|
|
15834
|
-
return /* @__PURE__ */ (0,
|
|
15835
|
-
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
15836
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
15837
|
-
/* @__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: [
|
|
15838
16130
|
getTitleAndHelp(props.schema, id),
|
|
15839
|
-
/* @__PURE__ */ (0,
|
|
16131
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15840
16132
|
SchemaFormControl_default,
|
|
15841
16133
|
{
|
|
15842
16134
|
id,
|
|
@@ -15851,7 +16143,7 @@ function OneOfSchema(props) {
|
|
|
15851
16143
|
onSearchChange
|
|
15852
16144
|
}
|
|
15853
16145
|
),
|
|
15854
|
-
/* @__PURE__ */ (0,
|
|
16146
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15855
16147
|
ControlFeedback_default,
|
|
15856
16148
|
{
|
|
15857
16149
|
id: feedbackId,
|
|
@@ -15867,7 +16159,7 @@ function OneOfSchema(props) {
|
|
|
15867
16159
|
)
|
|
15868
16160
|
] })
|
|
15869
16161
|
] }),
|
|
15870
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
16162
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15871
16163
|
GenericSchema_default,
|
|
15872
16164
|
{
|
|
15873
16165
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15884,16 +16176,16 @@ function OneOfSchema(props) {
|
|
|
15884
16176
|
}
|
|
15885
16177
|
function getTitleAndHelp(schema, forId) {
|
|
15886
16178
|
var _a;
|
|
15887
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
15888
|
-
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: [
|
|
15889
16181
|
schema.title,
|
|
15890
16182
|
" ",
|
|
15891
16183
|
helpElement
|
|
15892
|
-
] }) }) : /* @__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: [
|
|
15893
16185
|
schema.title,
|
|
15894
16186
|
" ",
|
|
15895
16187
|
helpElement
|
|
15896
|
-
] }) : /* @__PURE__ */ (0,
|
|
16188
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_components54.Header, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15897
16189
|
return schema.title ? titleElement : helpElement;
|
|
15898
16190
|
}
|
|
15899
16191
|
function getValidations(props, schemaIndex) {
|
|
@@ -15930,12 +16222,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15930
16222
|
|
|
15931
16223
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15932
16224
|
var import_classnames13 = __toESM(require_classnames());
|
|
15933
|
-
var
|
|
16225
|
+
var import_react42 = require("react");
|
|
15934
16226
|
|
|
15935
16227
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15936
|
-
var
|
|
15937
|
-
var
|
|
15938
|
-
var
|
|
16228
|
+
var import_components55 = require("@transferwise/components");
|
|
16229
|
+
var import_react41 = require("react");
|
|
16230
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
15939
16231
|
function UploadInputAdapter(props) {
|
|
15940
16232
|
const {
|
|
15941
16233
|
id,
|
|
@@ -15951,7 +16243,7 @@ function UploadInputAdapter(props) {
|
|
|
15951
16243
|
onCancel
|
|
15952
16244
|
} = props;
|
|
15953
16245
|
const onEvent = useEventDispatcher();
|
|
15954
|
-
const files = (0,
|
|
16246
|
+
const files = (0, import_react41.useMemo)(() => fileId ? [{ id: fileId, status: import_components55.Status.SUCCEEDED }] : [], [fileId]);
|
|
15955
16247
|
const uploadFile = (formData) => {
|
|
15956
16248
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
15957
16249
|
return httpClient(String(httpOptions.url), {
|
|
@@ -15968,8 +16260,8 @@ function UploadInputAdapter(props) {
|
|
|
15968
16260
|
return Promise.reject();
|
|
15969
16261
|
});
|
|
15970
16262
|
};
|
|
15971
|
-
return /* @__PURE__ */ (0,
|
|
15972
|
-
|
|
16263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16264
|
+
import_components55.UploadInput,
|
|
15973
16265
|
{
|
|
15974
16266
|
id,
|
|
15975
16267
|
fileInputName: httpOptions.fileInputName,
|
|
@@ -15988,16 +16280,16 @@ function UploadInputAdapter(props) {
|
|
|
15988
16280
|
}
|
|
15989
16281
|
|
|
15990
16282
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15991
|
-
var
|
|
16283
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
15992
16284
|
function PersistAsyncBlobSchema(props) {
|
|
15993
16285
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
15994
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
15995
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
15996
|
-
const [validations, setValidations] = (0,
|
|
15997
|
-
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);
|
|
15998
16290
|
const httpClient = useHttpClient();
|
|
15999
16291
|
const onEvent = useEventDispatcher();
|
|
16000
|
-
(0,
|
|
16292
|
+
(0, import_react42.useEffect)(() => {
|
|
16001
16293
|
if (submitted) {
|
|
16002
16294
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
16003
16295
|
} else {
|
|
@@ -16034,8 +16326,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16034
16326
|
};
|
|
16035
16327
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
16036
16328
|
const feedbackId = `${id}-feedback`;
|
|
16037
|
-
return /* @__PURE__ */ (0,
|
|
16038
|
-
/* @__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)(
|
|
16039
16331
|
UploadInputAdapter,
|
|
16040
16332
|
__spreadValues({
|
|
16041
16333
|
id,
|
|
@@ -16052,7 +16344,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
16052
16344
|
onCancel
|
|
16053
16345
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
16054
16346
|
) }),
|
|
16055
|
-
/* @__PURE__ */ (0,
|
|
16347
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16056
16348
|
ControlFeedback_default,
|
|
16057
16349
|
{
|
|
16058
16350
|
id: feedbackId,
|
|
@@ -16077,17 +16369,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
16077
16369
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
16078
16370
|
|
|
16079
16371
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
16080
|
-
var
|
|
16372
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
16081
16373
|
function PersistAsyncSchema(props) {
|
|
16082
16374
|
const { schema } = props;
|
|
16083
16375
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
16084
16376
|
if (persistAsyncSchemaType === "blob") {
|
|
16085
|
-
return /* @__PURE__ */ (0,
|
|
16377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
16086
16378
|
PersistAsyncBlobSchema_default,
|
|
16087
16379
|
__spreadValues({}, props)
|
|
16088
16380
|
);
|
|
16089
16381
|
}
|
|
16090
|
-
return /* @__PURE__ */ (0,
|
|
16382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
16091
16383
|
}
|
|
16092
16384
|
PersistAsyncSchema.defaultProps = {
|
|
16093
16385
|
required: false
|
|
@@ -16095,7 +16387,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
16095
16387
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
16096
16388
|
|
|
16097
16389
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16098
|
-
var
|
|
16390
|
+
var import_react43 = require("react");
|
|
16099
16391
|
|
|
16100
16392
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
16101
16393
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -16107,8 +16399,8 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
16107
16399
|
};
|
|
16108
16400
|
|
|
16109
16401
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
16110
|
-
var
|
|
16111
|
-
var
|
|
16402
|
+
var import_components56 = require("@transferwise/components");
|
|
16403
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
16112
16404
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
16113
16405
|
const { id, selection, setSelection } = props;
|
|
16114
16406
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -16119,14 +16411,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
16119
16411
|
const toggleSelection = () => {
|
|
16120
16412
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
16121
16413
|
};
|
|
16122
|
-
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 }) });
|
|
16123
16415
|
};
|
|
16124
16416
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
16125
16417
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
16126
16418
|
|
|
16127
16419
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
16128
|
-
var
|
|
16129
|
-
var
|
|
16420
|
+
var import_components57 = require("@transferwise/components");
|
|
16421
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
16130
16422
|
function PromotedOneOfRadioControl(props) {
|
|
16131
16423
|
var _a, _b;
|
|
16132
16424
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -16143,10 +16435,10 @@ function PromotedOneOfRadioControl(props) {
|
|
|
16143
16435
|
secondary: promotion.other.description
|
|
16144
16436
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
16145
16437
|
];
|
|
16146
|
-
return /* @__PURE__ */ (0,
|
|
16147
|
-
title && /* @__PURE__ */ (0,
|
|
16148
|
-
/* @__PURE__ */ (0,
|
|
16149
|
-
|
|
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,
|
|
16150
16442
|
{
|
|
16151
16443
|
name: "promoted-selection",
|
|
16152
16444
|
selectedValue: selection,
|
|
@@ -16163,16 +16455,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
16163
16455
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
16164
16456
|
|
|
16165
16457
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
16166
|
-
var
|
|
16458
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16167
16459
|
function PromotedOneOfControl(props) {
|
|
16168
16460
|
const controlType = props.promotion.control || "radio";
|
|
16169
16461
|
switch (controlType) {
|
|
16170
16462
|
case "radio":
|
|
16171
|
-
return /* @__PURE__ */ (0,
|
|
16463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
16172
16464
|
case "checkbox":
|
|
16173
|
-
return /* @__PURE__ */ (0,
|
|
16465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
16174
16466
|
default:
|
|
16175
|
-
return /* @__PURE__ */ (0,
|
|
16467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, {});
|
|
16176
16468
|
}
|
|
16177
16469
|
}
|
|
16178
16470
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -16182,20 +16474,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
16182
16474
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
16183
16475
|
|
|
16184
16476
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16185
|
-
var
|
|
16477
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
16186
16478
|
var isPromoted = (schema) => schema.promoted === true;
|
|
16187
16479
|
var PromotedOneOfSchema = (props) => {
|
|
16188
16480
|
var _a;
|
|
16189
|
-
const [selection, setSelection] = (0,
|
|
16481
|
+
const [selection, setSelection] = (0, import_react43.useState)(
|
|
16190
16482
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
16191
16483
|
);
|
|
16192
16484
|
const promotedAlert = props.schema.alert;
|
|
16193
16485
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
16194
16486
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
16195
16487
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
16196
|
-
return /* @__PURE__ */ (0,
|
|
16197
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
16198
|
-
/* @__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)(
|
|
16199
16491
|
PromotedOneOfControl_default,
|
|
16200
16492
|
{
|
|
16201
16493
|
id: props.schema.$id,
|
|
@@ -16206,8 +16498,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16206
16498
|
setSelection
|
|
16207
16499
|
}
|
|
16208
16500
|
),
|
|
16209
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
16210
|
-
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 }))
|
|
16211
16503
|
] });
|
|
16212
16504
|
};
|
|
16213
16505
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -16237,12 +16529,12 @@ function getOtherOneOf(schema) {
|
|
|
16237
16529
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
16238
16530
|
|
|
16239
16531
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16240
|
-
var
|
|
16241
|
-
var
|
|
16532
|
+
var import_components58 = require("@transferwise/components");
|
|
16533
|
+
var import_react_intl28 = require("react-intl");
|
|
16242
16534
|
|
|
16243
16535
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.ts
|
|
16244
|
-
var
|
|
16245
|
-
var ReadOnlySchema_messages_default = (0,
|
|
16536
|
+
var import_react_intl27 = require("react-intl");
|
|
16537
|
+
var ReadOnlySchema_messages_default = (0, import_react_intl27.defineMessages)({
|
|
16246
16538
|
yes: {
|
|
16247
16539
|
id: "dynamicFlows.ReadOnlySchema.yes",
|
|
16248
16540
|
defaultMessage: "Yes",
|
|
@@ -16256,12 +16548,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
16256
16548
|
});
|
|
16257
16549
|
|
|
16258
16550
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16259
|
-
var
|
|
16551
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
16260
16552
|
function ReadOnlySchema({ schema, model }) {
|
|
16261
16553
|
const { title = "" } = schema;
|
|
16262
|
-
const { formatMessage } = (0,
|
|
16554
|
+
const { formatMessage } = (0, import_react_intl28.useIntl)();
|
|
16263
16555
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
16264
|
-
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: "" }] });
|
|
16265
16557
|
}
|
|
16266
16558
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
16267
16559
|
function getValueForSchema({
|
|
@@ -16294,7 +16586,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
16294
16586
|
function getValueFromOption(option) {
|
|
16295
16587
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
16296
16588
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
16297
|
-
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: [
|
|
16298
16590
|
icon.avatar,
|
|
16299
16591
|
" ",
|
|
16300
16592
|
text
|
|
@@ -16302,22 +16594,22 @@ function getValueFromOption(option) {
|
|
|
16302
16594
|
}
|
|
16303
16595
|
|
|
16304
16596
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
16305
|
-
var
|
|
16306
|
-
var
|
|
16597
|
+
var import_react44 = require("react");
|
|
16598
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
16307
16599
|
function ValidationAsyncSchema(props) {
|
|
16308
16600
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
16309
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
16310
|
-
const previousRequestedModelReference = (0,
|
|
16311
|
-
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)(
|
|
16312
16604
|
null
|
|
16313
16605
|
);
|
|
16314
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
16315
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
16316
|
-
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);
|
|
16317
16609
|
const httpClient = useHttpClient();
|
|
16318
16610
|
const onEvent = useEventDispatcher();
|
|
16319
16611
|
const log = useLogger();
|
|
16320
|
-
(0,
|
|
16612
|
+
(0, import_react44.useEffect)(() => {
|
|
16321
16613
|
if (!schema.validationAsync.method) {
|
|
16322
16614
|
log.warning(
|
|
16323
16615
|
"Invalid schema or model",
|
|
@@ -16387,20 +16679,20 @@ function ValidationAsyncSchema(props) {
|
|
|
16387
16679
|
required,
|
|
16388
16680
|
schema
|
|
16389
16681
|
};
|
|
16390
|
-
return /* @__PURE__ */ (0,
|
|
16682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16391
16683
|
}
|
|
16392
16684
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
16393
16685
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16394
16686
|
|
|
16395
16687
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16396
|
-
var
|
|
16397
|
-
var
|
|
16688
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
16689
|
+
var import_react46 = require("react");
|
|
16398
16690
|
function GenericSchemaForm(props) {
|
|
16399
16691
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
16400
16692
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
16401
16693
|
const type = getSchemaType(schema);
|
|
16402
16694
|
const log = useLogger();
|
|
16403
|
-
(0,
|
|
16695
|
+
(0, import_react45.useEffect)(() => {
|
|
16404
16696
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
16405
16697
|
log.error(
|
|
16406
16698
|
"Invalid schema or model",
|
|
@@ -16410,29 +16702,29 @@ function GenericSchemaForm(props) {
|
|
|
16410
16702
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16411
16703
|
switch (type) {
|
|
16412
16704
|
case "readOnly":
|
|
16413
|
-
return /* @__PURE__ */ (0,
|
|
16705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16414
16706
|
case "persistAsync":
|
|
16415
|
-
return /* @__PURE__ */ (0,
|
|
16707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16416
16708
|
case "validationAsync":
|
|
16417
|
-
return /* @__PURE__ */ (0,
|
|
16709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16418
16710
|
case "basic": {
|
|
16419
16711
|
const basicTypeProps = __spreadValues({
|
|
16420
16712
|
infoMessage: null
|
|
16421
16713
|
}, schemaProps);
|
|
16422
|
-
return /* @__PURE__ */ (0,
|
|
16714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16423
16715
|
}
|
|
16424
16716
|
case "object":
|
|
16425
|
-
return /* @__PURE__ */ (0,
|
|
16717
|
+
return /* @__PURE__ */ (0, import_react46.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16426
16718
|
case "array":
|
|
16427
|
-
return /* @__PURE__ */ (0,
|
|
16719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16428
16720
|
case "promotedOneOf":
|
|
16429
|
-
return /* @__PURE__ */ (0,
|
|
16721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16430
16722
|
case "oneOf":
|
|
16431
|
-
return /* @__PURE__ */ (0,
|
|
16723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16432
16724
|
case "allOf":
|
|
16433
|
-
return /* @__PURE__ */ (0,
|
|
16725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16434
16726
|
}
|
|
16435
|
-
return /* @__PURE__ */ (0,
|
|
16727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_jsx_runtime100.Fragment, {});
|
|
16436
16728
|
}
|
|
16437
16729
|
var GenericSchema_default = GenericSchemaForm;
|
|
16438
16730
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16459,7 +16751,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16459
16751
|
};
|
|
16460
16752
|
|
|
16461
16753
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16462
|
-
var
|
|
16754
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
16463
16755
|
function DynamicForm({
|
|
16464
16756
|
component,
|
|
16465
16757
|
model = null,
|
|
@@ -16469,7 +16761,7 @@ function DynamicForm({
|
|
|
16469
16761
|
onPersistAsync
|
|
16470
16762
|
}) {
|
|
16471
16763
|
const formSchema = component.schema;
|
|
16472
|
-
return /* @__PURE__ */ (0,
|
|
16764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: getMargin2(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
16473
16765
|
GenericSchema_default,
|
|
16474
16766
|
{
|
|
16475
16767
|
schema: formSchema,
|
|
@@ -16486,64 +16778,64 @@ function DynamicForm({
|
|
|
16486
16778
|
var DynamicForm_default = DynamicForm;
|
|
16487
16779
|
|
|
16488
16780
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16489
|
-
var
|
|
16781
|
+
var import_components59 = require("@transferwise/components");
|
|
16490
16782
|
var import_classnames14 = __toESM(require_classnames());
|
|
16491
|
-
var
|
|
16783
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
16492
16784
|
var DynamicHeading = (props) => {
|
|
16493
16785
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16494
16786
|
const classes = (0, import_classnames14.default)(getTextAlignmentAndMargin2({ align, margin }));
|
|
16495
|
-
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 });
|
|
16496
16788
|
};
|
|
16497
16789
|
var StandardHeading2 = ({ size, text, classes }) => {
|
|
16498
16790
|
switch (size) {
|
|
16499
16791
|
case "xs":
|
|
16500
|
-
return /* @__PURE__ */ (0,
|
|
16792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h5", { className: classes, children: text });
|
|
16501
16793
|
case "sm":
|
|
16502
|
-
return /* @__PURE__ */ (0,
|
|
16794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h4", { className: classes, children: text });
|
|
16503
16795
|
case "lg":
|
|
16504
|
-
return /* @__PURE__ */ (0,
|
|
16796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h2", { className: classes, children: text });
|
|
16505
16797
|
case "xl":
|
|
16506
|
-
return /* @__PURE__ */ (0,
|
|
16798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h1", { className: classes, children: text });
|
|
16507
16799
|
case "md":
|
|
16508
16800
|
default:
|
|
16509
|
-
return /* @__PURE__ */ (0,
|
|
16801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h3", { className: classes, children: text });
|
|
16510
16802
|
}
|
|
16511
16803
|
};
|
|
16512
16804
|
var DisplayHeading2 = ({ size, text, classes }) => {
|
|
16513
16805
|
switch (size) {
|
|
16514
16806
|
case "xs":
|
|
16515
16807
|
case "sm":
|
|
16516
|
-
return /* @__PURE__ */ (0,
|
|
16808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-small", className: classes, children: text });
|
|
16517
16809
|
case "xl":
|
|
16518
16810
|
case "lg":
|
|
16519
|
-
return /* @__PURE__ */ (0,
|
|
16811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-large", className: classes, children: text });
|
|
16520
16812
|
case "md":
|
|
16521
16813
|
default:
|
|
16522
|
-
return /* @__PURE__ */ (0,
|
|
16814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Display, { type: "display-medium", className: classes, children: text });
|
|
16523
16815
|
}
|
|
16524
16816
|
};
|
|
16525
16817
|
var DynamicHeading_default = DynamicHeading;
|
|
16526
16818
|
|
|
16527
16819
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16528
|
-
var
|
|
16529
|
-
var
|
|
16820
|
+
var import_components60 = require("@transferwise/components");
|
|
16821
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
16530
16822
|
var DynamicMarkdown = ({ component }) => {
|
|
16531
16823
|
const { content, align, margin } = component;
|
|
16532
|
-
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 }) });
|
|
16533
16825
|
};
|
|
16534
16826
|
var DynamicInfo = ({ component }) => {
|
|
16535
|
-
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 }) });
|
|
16536
16828
|
};
|
|
16537
16829
|
|
|
16538
16830
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16539
|
-
var
|
|
16540
|
-
var
|
|
16541
|
-
var
|
|
16831
|
+
var import_components61 = require("@transferwise/components");
|
|
16832
|
+
var import_react47 = require("react");
|
|
16833
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
16542
16834
|
function DynamicImage({ component: image }) {
|
|
16543
16835
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
16544
16836
|
const httpClient = useHttpClient();
|
|
16545
|
-
const [imageSource, setImageSource] = (0,
|
|
16546
|
-
(0,
|
|
16837
|
+
const [imageSource, setImageSource] = (0, import_react47.useState)("");
|
|
16838
|
+
(0, import_react47.useEffect)(() => {
|
|
16547
16839
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
16548
16840
|
}, [url, httpClient]);
|
|
16549
16841
|
const imageProps = {
|
|
@@ -16555,7 +16847,7 @@ function DynamicImage({ component: image }) {
|
|
|
16555
16847
|
if (!imageSource) {
|
|
16556
16848
|
return null;
|
|
16557
16849
|
}
|
|
16558
|
-
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)) });
|
|
16559
16851
|
}
|
|
16560
16852
|
var readImageBlobAsDataURL2 = (imageBlob) => (
|
|
16561
16853
|
// we can safely assume the type of reader.result is string
|
|
@@ -16591,48 +16883,48 @@ var getImageSource2 = async (httpClient, imageUrl) => {
|
|
|
16591
16883
|
var DynamicImage_default = DynamicImage;
|
|
16592
16884
|
|
|
16593
16885
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16594
|
-
var
|
|
16595
|
-
var
|
|
16886
|
+
var import_components62 = require("@transferwise/components");
|
|
16887
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
16596
16888
|
var doContext2 = ["positive", "neutral"];
|
|
16597
16889
|
var dontContext2 = ["warning", "negative"];
|
|
16598
16890
|
var DynamicInstructions = ({ component }) => {
|
|
16599
16891
|
const { items } = component;
|
|
16600
16892
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
16601
16893
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
16602
|
-
return /* @__PURE__ */ (0,
|
|
16603
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16604
|
-
/* @__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 })
|
|
16605
16897
|
] });
|
|
16606
16898
|
};
|
|
16607
16899
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16608
16900
|
|
|
16609
16901
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16610
|
-
var
|
|
16902
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
16611
16903
|
var getKey = (component) => JSON.stringify(component);
|
|
16612
16904
|
function DynamicLayout(props) {
|
|
16613
16905
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16614
16906
|
const renderComponent = (component) => {
|
|
16615
16907
|
switch (component.type) {
|
|
16616
16908
|
case "heading":
|
|
16617
|
-
return /* @__PURE__ */ (0,
|
|
16909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
16618
16910
|
case "paragraph":
|
|
16619
|
-
return /* @__PURE__ */ (0,
|
|
16911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
16620
16912
|
case "image":
|
|
16621
|
-
return /* @__PURE__ */ (0,
|
|
16913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
16622
16914
|
case "alert":
|
|
16623
|
-
return /* @__PURE__ */ (0,
|
|
16915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
16624
16916
|
case "review":
|
|
16625
|
-
return /* @__PURE__ */ (0,
|
|
16917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16626
16918
|
case "divider":
|
|
16627
|
-
return /* @__PURE__ */ (0,
|
|
16919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
16628
16920
|
case "info":
|
|
16629
|
-
return /* @__PURE__ */ (0,
|
|
16921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicInfo, { component }, getKey(component));
|
|
16630
16922
|
case "instructions":
|
|
16631
|
-
return /* @__PURE__ */ (0,
|
|
16923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
16632
16924
|
case "markdown":
|
|
16633
|
-
return /* @__PURE__ */ (0,
|
|
16925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
16634
16926
|
case "columns":
|
|
16635
|
-
return /* @__PURE__ */ (0,
|
|
16927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16636
16928
|
DynamicColumns_default,
|
|
16637
16929
|
{
|
|
16638
16930
|
component,
|
|
@@ -16646,7 +16938,7 @@ function DynamicLayout(props) {
|
|
|
16646
16938
|
getKey(component)
|
|
16647
16939
|
);
|
|
16648
16940
|
case "form":
|
|
16649
|
-
return /* @__PURE__ */ (0,
|
|
16941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16650
16942
|
DynamicForm_default,
|
|
16651
16943
|
{
|
|
16652
16944
|
component,
|
|
@@ -16659,9 +16951,9 @@ function DynamicLayout(props) {
|
|
|
16659
16951
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16660
16952
|
);
|
|
16661
16953
|
case "button":
|
|
16662
|
-
return /* @__PURE__ */ (0,
|
|
16954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16663
16955
|
case "box":
|
|
16664
|
-
return /* @__PURE__ */ (0,
|
|
16956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16665
16957
|
DynamicBox_default,
|
|
16666
16958
|
{
|
|
16667
16959
|
component,
|
|
@@ -16675,18 +16967,18 @@ function DynamicLayout(props) {
|
|
|
16675
16967
|
getKey(component)
|
|
16676
16968
|
);
|
|
16677
16969
|
case "decision":
|
|
16678
|
-
return /* @__PURE__ */ (0,
|
|
16970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16679
16971
|
case "external":
|
|
16680
|
-
return /* @__PURE__ */ (0,
|
|
16972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16681
16973
|
case "list":
|
|
16682
16974
|
case "status-list":
|
|
16683
|
-
return /* @__PURE__ */ (0,
|
|
16975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16684
16976
|
case "loading-indicator":
|
|
16685
|
-
return /* @__PURE__ */ (0,
|
|
16977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16686
16978
|
case "search":
|
|
16687
|
-
return /* @__PURE__ */ (0,
|
|
16979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16688
16980
|
case "modal":
|
|
16689
|
-
return /* @__PURE__ */ (0,
|
|
16981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
16690
16982
|
DynamicModal_default,
|
|
16691
16983
|
{
|
|
16692
16984
|
component,
|
|
@@ -16700,22 +16992,22 @@ function DynamicLayout(props) {
|
|
|
16700
16992
|
getKey(component)
|
|
16701
16993
|
);
|
|
16702
16994
|
default:
|
|
16703
|
-
return /* @__PURE__ */ (0,
|
|
16995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", {}, getKey(component));
|
|
16704
16996
|
}
|
|
16705
16997
|
};
|
|
16706
16998
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16707
|
-
return /* @__PURE__ */ (0,
|
|
16999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_jsx_runtime106.Fragment, { children: components.map(renderComponent) });
|
|
16708
17000
|
}
|
|
16709
|
-
return /* @__PURE__ */ (0,
|
|
17001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16710
17002
|
}
|
|
16711
17003
|
var DynamicLayout_default = DynamicLayout;
|
|
16712
17004
|
|
|
16713
17005
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16714
|
-
var
|
|
16715
|
-
var
|
|
17006
|
+
var import_components63 = require("@transferwise/components");
|
|
17007
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
16716
17008
|
var DynamicStatusList = ({ component }) => {
|
|
16717
|
-
return /* @__PURE__ */ (0,
|
|
16718
|
-
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,
|
|
16719
17011
|
component.items.map(mapListItemToSummary)
|
|
16720
17012
|
] });
|
|
16721
17013
|
};
|
|
@@ -16724,8 +17016,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
16724
17016
|
key: `${title}/${description || ""}`,
|
|
16725
17017
|
title,
|
|
16726
17018
|
description
|
|
16727
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
16728
|
-
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));
|
|
16729
17021
|
};
|
|
16730
17022
|
var statusListMap = {
|
|
16731
17023
|
done: "done",
|
|
@@ -16741,12 +17033,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
|
|
|
16741
17033
|
var DynamicStatusList_default = DynamicStatusList;
|
|
16742
17034
|
|
|
16743
17035
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16744
|
-
var
|
|
16745
|
-
var
|
|
17036
|
+
var import_components64 = require("@transferwise/components");
|
|
17037
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
16746
17038
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16747
17039
|
const { margin = "md", size = "md" } = component;
|
|
16748
|
-
return /* @__PURE__ */ (0,
|
|
16749
|
-
|
|
17040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
17041
|
+
import_components64.Loader,
|
|
16750
17042
|
{
|
|
16751
17043
|
size,
|
|
16752
17044
|
classNames: {
|
|
@@ -16759,33 +17051,33 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
16759
17051
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
16760
17052
|
|
|
16761
17053
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16762
|
-
var
|
|
16763
|
-
var
|
|
17054
|
+
var import_components66 = require("@transferwise/components");
|
|
17055
|
+
var import_react_intl29 = require("react-intl");
|
|
16764
17056
|
|
|
16765
17057
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16766
|
-
var
|
|
16767
|
-
var
|
|
17058
|
+
var import_components65 = require("@transferwise/components");
|
|
17059
|
+
var import_react48 = require("react");
|
|
16768
17060
|
function useSnackBarIfAvailable2() {
|
|
16769
|
-
const context = (0,
|
|
17061
|
+
const context = (0, import_react48.useContext)(import_components65.SnackbarContext);
|
|
16770
17062
|
return context ? context.createSnackbar : noop3;
|
|
16771
17063
|
}
|
|
16772
17064
|
function noop3() {
|
|
16773
17065
|
}
|
|
16774
17066
|
|
|
16775
17067
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16776
|
-
var
|
|
17068
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
16777
17069
|
function DynamicParagraph({ component }) {
|
|
16778
|
-
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 });
|
|
16779
17071
|
}
|
|
16780
17072
|
function BasicDynamicParagraph({ component }) {
|
|
16781
|
-
return /* @__PURE__ */ (0,
|
|
17073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("p", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16782
17074
|
" ",
|
|
16783
17075
|
component.text,
|
|
16784
17076
|
" "
|
|
16785
17077
|
] });
|
|
16786
17078
|
}
|
|
16787
17079
|
function CopyableDynamicParagraph({ component }) {
|
|
16788
|
-
const { formatMessage } = (0,
|
|
17080
|
+
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
16789
17081
|
const createSnackbar = useSnackBarIfAvailable2();
|
|
16790
17082
|
const { text } = component;
|
|
16791
17083
|
const copy = () => {
|
|
@@ -16796,8 +17088,8 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16796
17088
|
align: component.align,
|
|
16797
17089
|
margin: "sm"
|
|
16798
17090
|
})} form-control`;
|
|
16799
|
-
return /* @__PURE__ */ (0,
|
|
16800
|
-
/* @__PURE__ */ (0,
|
|
17091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: getTextAlignmentAndMargin2(component), children: [
|
|
17092
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
16801
17093
|
"input",
|
|
16802
17094
|
{
|
|
16803
17095
|
type: "text",
|
|
@@ -16807,7 +17099,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16807
17099
|
style: { textOverflow: "ellipsis" }
|
|
16808
17100
|
}
|
|
16809
17101
|
),
|
|
16810
|
-
/* @__PURE__ */ (0,
|
|
17102
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16811
17103
|
] });
|
|
16812
17104
|
}
|
|
16813
17105
|
function noop4() {
|
|
@@ -16815,8 +17107,8 @@ function noop4() {
|
|
|
16815
17107
|
var DynamicParagraph_default = DynamicParagraph;
|
|
16816
17108
|
|
|
16817
17109
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16818
|
-
var
|
|
16819
|
-
var
|
|
17110
|
+
var import_components67 = require("@transferwise/components");
|
|
17111
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
16820
17112
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16821
17113
|
key: String(index),
|
|
16822
17114
|
title: label,
|
|
@@ -16824,14 +17116,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16824
17116
|
}));
|
|
16825
17117
|
var getFieldValue2 = (value, help, orientation) => {
|
|
16826
17118
|
if (help) {
|
|
16827
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
16828
|
-
/* @__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 }),
|
|
16829
17121
|
" ",
|
|
16830
17122
|
value
|
|
16831
|
-
] }) : /* @__PURE__ */ (0,
|
|
17123
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
|
|
16832
17124
|
value,
|
|
16833
17125
|
" ",
|
|
16834
|
-
/* @__PURE__ */ (0,
|
|
17126
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Help_default2, { help })
|
|
16835
17127
|
] });
|
|
16836
17128
|
}
|
|
16837
17129
|
return value;
|
|
@@ -16856,25 +17148,25 @@ function DynamicReview(props) {
|
|
|
16856
17148
|
const orientation = getReviewLayout(review);
|
|
16857
17149
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
16858
17150
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
16859
|
-
return /* @__PURE__ */ (0,
|
|
16860
|
-
review.title && /* @__PURE__ */ (0,
|
|
16861
|
-
/* @__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) }) })
|
|
16862
17154
|
] });
|
|
16863
17155
|
}
|
|
16864
17156
|
var DynamicReview_default = DynamicReview;
|
|
16865
17157
|
|
|
16866
17158
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16867
|
-
var
|
|
17159
|
+
var import_react50 = require("react");
|
|
16868
17160
|
var import_icons5 = require("@transferwise/icons");
|
|
16869
17161
|
|
|
16870
17162
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16871
|
-
var
|
|
16872
|
-
var
|
|
17163
|
+
var import_components68 = require("@transferwise/components");
|
|
17164
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16873
17165
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16874
|
-
return /* @__PURE__ */ (0,
|
|
17166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16875
17167
|
title,
|
|
16876
|
-
/* @__PURE__ */ (0,
|
|
16877
|
-
|
|
17168
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
17169
|
+
import_components68.Input,
|
|
16878
17170
|
{
|
|
16879
17171
|
type: "text",
|
|
16880
17172
|
value,
|
|
@@ -16887,15 +17179,15 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16887
17179
|
};
|
|
16888
17180
|
|
|
16889
17181
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16890
|
-
var
|
|
16891
|
-
var
|
|
16892
|
-
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");
|
|
16893
17185
|
function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
16894
17186
|
if (results.length === 0) {
|
|
16895
|
-
return /* @__PURE__ */ (0,
|
|
17187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
16896
17188
|
}
|
|
16897
|
-
return /* @__PURE__ */ (0,
|
|
16898
|
-
|
|
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,
|
|
16899
17191
|
{
|
|
16900
17192
|
title: result.title,
|
|
16901
17193
|
content: result.description,
|
|
@@ -16908,11 +17200,11 @@ function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
|
16908
17200
|
)) });
|
|
16909
17201
|
}
|
|
16910
17202
|
function ErrorResult2({ onRetrySearch }) {
|
|
16911
|
-
const intl = (0,
|
|
16912
|
-
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: [
|
|
16913
17205
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16914
17206
|
"\xA0",
|
|
16915
|
-
/* @__PURE__ */ (0,
|
|
17207
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16916
17208
|
"a",
|
|
16917
17209
|
{
|
|
16918
17210
|
href: "/",
|
|
@@ -16927,15 +17219,15 @@ function ErrorResult2({ onRetrySearch }) {
|
|
|
16927
17219
|
}
|
|
16928
17220
|
|
|
16929
17221
|
// src/legacy/layout/search/useSearch.tsx
|
|
16930
|
-
var
|
|
17222
|
+
var import_react49 = require("react");
|
|
16931
17223
|
var headers = { "Content-Type": "application/json" };
|
|
16932
17224
|
var useSearch = (defaultSearchConfig) => {
|
|
16933
|
-
const [state, setState] = (0,
|
|
17225
|
+
const [state, setState] = (0, import_react49.useState)({
|
|
16934
17226
|
status: "idle"
|
|
16935
17227
|
});
|
|
16936
|
-
const abortControllerRef = (0,
|
|
17228
|
+
const abortControllerRef = (0, import_react49.useRef)(null);
|
|
16937
17229
|
const httpClient = useHttpClient();
|
|
16938
|
-
const search = (0,
|
|
17230
|
+
const search = (0, import_react49.useCallback)(
|
|
16939
17231
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
16940
17232
|
var _a;
|
|
16941
17233
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -16996,16 +17288,16 @@ var addQueryParameter2 = (url, key, value) => {
|
|
|
16996
17288
|
};
|
|
16997
17289
|
|
|
16998
17290
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16999
|
-
var
|
|
17291
|
+
var import_components70 = require("@transferwise/components");
|
|
17000
17292
|
var import_classnames15 = __toESM(require_classnames());
|
|
17001
|
-
var
|
|
17293
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
17002
17294
|
var DEBOUNCE_TIME2 = 400;
|
|
17003
17295
|
function DynamicSearch({ component, onAction }) {
|
|
17004
|
-
const [query, setQuery] = (0,
|
|
17296
|
+
const [query, setQuery] = (0, import_react50.useState)("");
|
|
17005
17297
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
17006
17298
|
const { status, results, search } = useSearch({ url, method, param });
|
|
17007
17299
|
const onEvent = useEventDispatcher();
|
|
17008
|
-
const debouncedSearch = (0,
|
|
17300
|
+
const debouncedSearch = (0, import_react50.useMemo)(() => debounce2(search, DEBOUNCE_TIME2), [search]);
|
|
17009
17301
|
const onSearchStart = () => {
|
|
17010
17302
|
onEvent("Dynamic Flow - Search Started", {});
|
|
17011
17303
|
};
|
|
@@ -17034,16 +17326,16 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17034
17326
|
void search(query);
|
|
17035
17327
|
};
|
|
17036
17328
|
if (control === "inline") {
|
|
17037
|
-
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: [
|
|
17038
17330
|
title,
|
|
17039
|
-
/* @__PURE__ */ (0,
|
|
17040
|
-
|
|
17331
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "m-t-1", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17332
|
+
import_components70.Typeahead,
|
|
17041
17333
|
{
|
|
17042
17334
|
id: "typeahead-input-id",
|
|
17043
17335
|
name: "typeahead-input-name",
|
|
17044
17336
|
size: "md",
|
|
17045
17337
|
maxHeight: 100,
|
|
17046
|
-
footer: /* @__PURE__ */ (0,
|
|
17338
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17047
17339
|
TypeaheadFooter2,
|
|
17048
17340
|
{
|
|
17049
17341
|
state: status,
|
|
@@ -17054,7 +17346,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17054
17346
|
),
|
|
17055
17347
|
multiple: false,
|
|
17056
17348
|
clearable: false,
|
|
17057
|
-
addon: /* @__PURE__ */ (0,
|
|
17349
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_icons5.Search, { size: 24 }),
|
|
17058
17350
|
options: results.map(mapResultToTypeaheadOption2),
|
|
17059
17351
|
onChange: (values) => {
|
|
17060
17352
|
if (values.length > 0) {
|
|
@@ -17069,11 +17361,11 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17069
17361
|
) })
|
|
17070
17362
|
] }) });
|
|
17071
17363
|
}
|
|
17072
|
-
return /* @__PURE__ */ (0,
|
|
17073
|
-
/* @__PURE__ */ (0,
|
|
17074
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
17075
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
17076
|
-
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 })
|
|
17077
17369
|
] });
|
|
17078
17370
|
}
|
|
17079
17371
|
function mapResultToTypeaheadOption2(result) {
|
|
@@ -17092,35 +17384,35 @@ function TypeaheadFooter2({
|
|
|
17092
17384
|
emptyMessage
|
|
17093
17385
|
}) {
|
|
17094
17386
|
if (state === "success" && results.length === 0) {
|
|
17095
|
-
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 });
|
|
17096
17388
|
}
|
|
17097
17389
|
if (state === "error" && results.length === 0) {
|
|
17098
|
-
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 }) });
|
|
17099
17391
|
}
|
|
17100
17392
|
if (state === "loading" || results.length === 0) {
|
|
17101
|
-
return /* @__PURE__ */ (0,
|
|
17393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
17102
17394
|
}
|
|
17103
17395
|
return null;
|
|
17104
17396
|
}
|
|
17105
17397
|
var DynamicSearch_default = DynamicSearch;
|
|
17106
17398
|
|
|
17107
17399
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
17108
|
-
var
|
|
17109
|
-
var
|
|
17110
|
-
var
|
|
17400
|
+
var import_components71 = require("@transferwise/components");
|
|
17401
|
+
var import_react51 = require("react");
|
|
17402
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
17111
17403
|
function DynamicModal(props) {
|
|
17112
|
-
const [visible, isVisible] = (0,
|
|
17404
|
+
const [visible, isVisible] = (0, import_react51.useState)(false);
|
|
17113
17405
|
const { component, onAction } = props;
|
|
17114
17406
|
const { margin = "md" } = component;
|
|
17115
|
-
return /* @__PURE__ */ (0,
|
|
17116
|
-
/* @__PURE__ */ (0,
|
|
17117
|
-
/* @__PURE__ */ (0,
|
|
17118
|
-
|
|
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,
|
|
17119
17411
|
{
|
|
17120
17412
|
scroll: "content",
|
|
17121
17413
|
open: visible,
|
|
17122
17414
|
size: "lg",
|
|
17123
|
-
body: /* @__PURE__ */ (0,
|
|
17415
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17124
17416
|
DynamicLayout_default,
|
|
17125
17417
|
__spreadProps(__spreadValues({}, props), {
|
|
17126
17418
|
components: component.content.components,
|
|
@@ -17138,7 +17430,7 @@ function DynamicModal(props) {
|
|
|
17138
17430
|
var DynamicModal_default = DynamicModal;
|
|
17139
17431
|
|
|
17140
17432
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
17141
|
-
var
|
|
17433
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
17142
17434
|
var isNullish3 = (value) => isNull3(value) || isUndefined3(value);
|
|
17143
17435
|
var getDefaultValue = (schema) => {
|
|
17144
17436
|
return schema.type === "boolean" && isNullish3(schema.default) ? false : schema.default;
|
|
@@ -17176,13 +17468,13 @@ var BasicTypeSchema = (props) => {
|
|
|
17176
17468
|
props.onBlur();
|
|
17177
17469
|
}
|
|
17178
17470
|
};
|
|
17179
|
-
const [model, setModel] = (0,
|
|
17180
|
-
const [lastModel, setLastModel] = (0,
|
|
17181
|
-
const [changed, setChanged] = (0,
|
|
17182
|
-
const [focused, setFocused] = (0,
|
|
17183
|
-
const [blurred, setBlurred] = (0,
|
|
17184
|
-
const [validations, setValidations] = (0,
|
|
17185
|
-
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]);
|
|
17186
17478
|
const onSchemaChange = () => {
|
|
17187
17479
|
const defaultValue = getDefaultValue(props.schema);
|
|
17188
17480
|
if (isNullish3(model) && !isNullish3(defaultValue)) {
|
|
@@ -17197,9 +17489,9 @@ var BasicTypeSchema = (props) => {
|
|
|
17197
17489
|
};
|
|
17198
17490
|
const isConst = props.schema.const;
|
|
17199
17491
|
const isHidden = props.schema.hidden || isConst;
|
|
17200
|
-
(0,
|
|
17201
|
-
(0,
|
|
17202
|
-
(0,
|
|
17492
|
+
(0, import_react52.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
17493
|
+
(0, import_react52.useEffect)(onSchemaChange, [props.schema]);
|
|
17494
|
+
(0, import_react52.useEffect)(() => {
|
|
17203
17495
|
var _a2;
|
|
17204
17496
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
17205
17497
|
if (newModel !== model) {
|
|
@@ -17214,15 +17506,15 @@ var BasicTypeSchema = (props) => {
|
|
|
17214
17506
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
17215
17507
|
const schemaHelp = props.schema.help;
|
|
17216
17508
|
const feedbackId = `${id}-feedback`;
|
|
17217
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
17218
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
17219
|
-
/* @__PURE__ */ (0,
|
|
17220
|
-
showLabel && /* @__PURE__ */ (0,
|
|
17221
|
-
/* @__PURE__ */ (0,
|
|
17222
|
-
!!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 })
|
|
17223
17515
|
] }),
|
|
17224
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
17225
|
-
/* @__PURE__ */ (0,
|
|
17516
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Help_default2, { help: schemaHelp }),
|
|
17517
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17226
17518
|
SchemaFormControl_default,
|
|
17227
17519
|
{
|
|
17228
17520
|
id,
|
|
@@ -17235,7 +17527,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17235
17527
|
describedBy: feedbackId
|
|
17236
17528
|
}
|
|
17237
17529
|
),
|
|
17238
|
-
/* @__PURE__ */ (0,
|
|
17530
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17239
17531
|
ControlFeedback_default,
|
|
17240
17532
|
{
|
|
17241
17533
|
id: feedbackId,
|
|
@@ -17260,7 +17552,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
17260
17552
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17261
17553
|
|
|
17262
17554
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17263
|
-
var
|
|
17555
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17264
17556
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17265
17557
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17266
17558
|
var _a;
|
|
@@ -17275,15 +17567,15 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
17275
17567
|
]);
|
|
17276
17568
|
function PersistAsyncBasicSchema(props) {
|
|
17277
17569
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
17278
|
-
const intl = (0,
|
|
17570
|
+
const intl = (0, import_react_intl31.useIntl)();
|
|
17279
17571
|
const httpClient = useHttpClient();
|
|
17280
17572
|
const onEvent = useEventDispatcher();
|
|
17281
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
17573
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react53.useState)(null);
|
|
17282
17574
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17283
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
17284
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
17285
|
-
const [abortController, setAbortController] = (0,
|
|
17286
|
-
(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)(() => {
|
|
17287
17579
|
if (controlTypesWithPersistOnChange.has(
|
|
17288
17580
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
17289
17581
|
getControlType(schema.persistAsync.schema)
|
|
@@ -17350,7 +17642,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17350
17642
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17351
17643
|
}
|
|
17352
17644
|
};
|
|
17353
|
-
return /* @__PURE__ */ (0,
|
|
17645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17354
17646
|
BasicTypeSchema_default,
|
|
17355
17647
|
{
|
|
17356
17648
|
required,
|
|
@@ -17371,9 +17663,9 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17371
17663
|
|
|
17372
17664
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17373
17665
|
var usePersistAsync = (persistAsync) => {
|
|
17374
|
-
const [abortController, setAbortController] = (0,
|
|
17666
|
+
const [abortController, setAbortController] = (0, import_react54.useState)(null);
|
|
17375
17667
|
const httpClient = useHttpClient();
|
|
17376
|
-
const intl = (0,
|
|
17668
|
+
const intl = (0, import_react_intl32.useIntl)();
|
|
17377
17669
|
const { schema } = persistAsync;
|
|
17378
17670
|
async function handlePersistAsync(model) {
|
|
17379
17671
|
const isInvalidSchema = model instanceof Blob ? !isBlobSchema2(schema) : !isValidSchema(model, schema);
|
|
@@ -17450,7 +17742,7 @@ function hasStringMessage(value) {
|
|
|
17450
17742
|
}
|
|
17451
17743
|
|
|
17452
17744
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
17453
|
-
var
|
|
17745
|
+
var import_react55 = require("react");
|
|
17454
17746
|
function usePolling({
|
|
17455
17747
|
asyncFn,
|
|
17456
17748
|
interval,
|
|
@@ -17459,9 +17751,9 @@ function usePolling({
|
|
|
17459
17751
|
onPollingResponse,
|
|
17460
17752
|
onFailure
|
|
17461
17753
|
}) {
|
|
17462
|
-
const onPollingResponseReference = (0,
|
|
17463
|
-
const onFailureReference = (0,
|
|
17464
|
-
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)(
|
|
17465
17757
|
() => createPollingClosure(
|
|
17466
17758
|
asyncFn,
|
|
17467
17759
|
maxAttempts,
|
|
@@ -17471,7 +17763,7 @@ function usePolling({
|
|
|
17471
17763
|
),
|
|
17472
17764
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
17473
17765
|
);
|
|
17474
|
-
(0,
|
|
17766
|
+
(0, import_react55.useEffect)(() => {
|
|
17475
17767
|
if (interval > 0) {
|
|
17476
17768
|
const intervalReference = setInterval(() => {
|
|
17477
17769
|
poll();
|
|
@@ -17479,7 +17771,7 @@ function usePolling({
|
|
|
17479
17771
|
return () => clearInterval(intervalReference);
|
|
17480
17772
|
}
|
|
17481
17773
|
}, [poll, interval]);
|
|
17482
|
-
(0,
|
|
17774
|
+
(0, import_react55.useEffect)(() => {
|
|
17483
17775
|
onPollingResponseReference.current = onPollingResponse;
|
|
17484
17776
|
onFailureReference.current = onFailure;
|
|
17485
17777
|
}, [onPollingResponse, onFailure]);
|
|
@@ -17510,20 +17802,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
17510
17802
|
}
|
|
17511
17803
|
|
|
17512
17804
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
17513
|
-
var
|
|
17805
|
+
var import_react56 = require("react");
|
|
17514
17806
|
var usePrevious = (value) => {
|
|
17515
|
-
const reference = (0,
|
|
17516
|
-
(0,
|
|
17807
|
+
const reference = (0, import_react56.useRef)();
|
|
17808
|
+
(0, import_react56.useEffect)(() => {
|
|
17517
17809
|
reference.current = value;
|
|
17518
17810
|
}, [value]);
|
|
17519
17811
|
return reference.current;
|
|
17520
17812
|
};
|
|
17521
17813
|
|
|
17522
17814
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
17523
|
-
var
|
|
17815
|
+
var import_react57 = require("react");
|
|
17524
17816
|
function useStepPolling(polling, onAction) {
|
|
17525
17817
|
const httpClient = useHttpClient();
|
|
17526
|
-
const asyncFn = (0,
|
|
17818
|
+
const asyncFn = (0, import_react57.useMemo)(() => {
|
|
17527
17819
|
if (polling) {
|
|
17528
17820
|
return () => httpClient(polling.url).then((response) => {
|
|
17529
17821
|
if (response.ok) {
|
|
@@ -17536,7 +17828,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17536
17828
|
}
|
|
17537
17829
|
return void 0;
|
|
17538
17830
|
}, [polling, httpClient]);
|
|
17539
|
-
const onPollingResponse = (0,
|
|
17831
|
+
const onPollingResponse = (0, import_react57.useCallback)(
|
|
17540
17832
|
(pollingResponse) => {
|
|
17541
17833
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
17542
17834
|
onAction(pollingResponse.action);
|
|
@@ -17552,7 +17844,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17552
17844
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
17553
17845
|
maxConsecutiveFails: 1,
|
|
17554
17846
|
onPollingResponse,
|
|
17555
|
-
onFailure: (0,
|
|
17847
|
+
onFailure: (0, import_react57.useCallback)(() => {
|
|
17556
17848
|
if (polling) {
|
|
17557
17849
|
onAction(polling.onError.action);
|
|
17558
17850
|
}
|
|
@@ -17561,7 +17853,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17561
17853
|
}
|
|
17562
17854
|
|
|
17563
17855
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17564
|
-
var
|
|
17856
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
17565
17857
|
var getComponents = (step, options) => {
|
|
17566
17858
|
var _a;
|
|
17567
17859
|
if (isEmpty(step)) {
|
|
@@ -17584,7 +17876,7 @@ var LayoutStep = (props) => {
|
|
|
17584
17876
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17585
17877
|
};
|
|
17586
17878
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17587
|
-
return /* @__PURE__ */ (0,
|
|
17879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17588
17880
|
DynamicLayout_default,
|
|
17589
17881
|
{
|
|
17590
17882
|
components,
|
|
@@ -17600,16 +17892,16 @@ var LayoutStep = (props) => {
|
|
|
17600
17892
|
var LayoutStep_default = LayoutStep;
|
|
17601
17893
|
|
|
17602
17894
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17603
|
-
var
|
|
17895
|
+
var import_react62 = require("react");
|
|
17604
17896
|
|
|
17605
17897
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17606
|
-
var
|
|
17607
|
-
var
|
|
17898
|
+
var import_react61 = require("react");
|
|
17899
|
+
var import_react_intl37 = require("react-intl");
|
|
17608
17900
|
var import_react_webcam = __toESM(require("react-webcam"));
|
|
17609
17901
|
|
|
17610
17902
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
17611
|
-
var
|
|
17612
|
-
var CameraCapture_messages_default = (0,
|
|
17903
|
+
var import_react_intl33 = require("react-intl");
|
|
17904
|
+
var CameraCapture_messages_default = (0, import_react_intl33.defineMessages)({
|
|
17613
17905
|
reviewSubmit: {
|
|
17614
17906
|
id: "dynamicFlows.CameraCapture.reviewSubmit",
|
|
17615
17907
|
defaultMessage: "Yes, submit",
|
|
@@ -17668,58 +17960,58 @@ var CameraCapture_messages_default = (0, import_react_intl32.defineMessages)({
|
|
|
17668
17960
|
});
|
|
17669
17961
|
|
|
17670
17962
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17671
|
-
var
|
|
17672
|
-
var
|
|
17673
|
-
var
|
|
17674
|
-
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 }) });
|
|
17675
17967
|
var ReviewBottomBar = ({
|
|
17676
17968
|
onSubmit,
|
|
17677
17969
|
onRetry
|
|
17678
17970
|
}) => {
|
|
17679
|
-
const intl = (0,
|
|
17680
|
-
return /* @__PURE__ */ (0,
|
|
17681
|
-
/* @__PURE__ */ (0,
|
|
17682
|
-
|
|
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,
|
|
17683
17975
|
{
|
|
17684
17976
|
className: "m-b-1",
|
|
17685
17977
|
block: true,
|
|
17686
|
-
size:
|
|
17687
|
-
type:
|
|
17978
|
+
size: import_components72.Size.MEDIUM,
|
|
17979
|
+
type: import_components72.ControlType.ACCENT,
|
|
17688
17980
|
onClick: onSubmit,
|
|
17689
17981
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17690
17982
|
}
|
|
17691
17983
|
),
|
|
17692
|
-
/* @__PURE__ */ (0,
|
|
17693
|
-
|
|
17984
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17985
|
+
import_components72.Button,
|
|
17694
17986
|
{
|
|
17695
17987
|
className: "m-b-2",
|
|
17696
17988
|
block: true,
|
|
17697
|
-
size:
|
|
17698
|
-
type:
|
|
17699
|
-
priority:
|
|
17989
|
+
size: import_components72.Size.MEDIUM,
|
|
17990
|
+
type: import_components72.ControlType.ACCENT,
|
|
17991
|
+
priority: import_components72.Priority.SECONDARY,
|
|
17700
17992
|
onClick: onRetry,
|
|
17701
17993
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
17702
17994
|
}
|
|
17703
17995
|
)
|
|
17704
17996
|
] }) }) });
|
|
17705
17997
|
};
|
|
17706
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
17998
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17707
17999
|
"button",
|
|
17708
18000
|
{
|
|
17709
18001
|
type: "button",
|
|
17710
18002
|
className: "camera-capture-btn m-b-2",
|
|
17711
18003
|
"data-testid": "camera-capture-button",
|
|
17712
18004
|
onClick,
|
|
17713
|
-
children: /* @__PURE__ */ (0,
|
|
18005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
17714
18006
|
}
|
|
17715
18007
|
);
|
|
17716
18008
|
|
|
17717
18009
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17718
|
-
var
|
|
18010
|
+
var import_react_intl36 = require("react-intl");
|
|
17719
18011
|
|
|
17720
18012
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
17721
|
-
var
|
|
17722
|
-
var OrientationLockOverlay_messages_default = (0,
|
|
18013
|
+
var import_react_intl35 = require("react-intl");
|
|
18014
|
+
var OrientationLockOverlay_messages_default = (0, import_react_intl35.defineMessages)({
|
|
17723
18015
|
text: {
|
|
17724
18016
|
id: "dynamicFlows.CameraCapture.rotatePhone.text",
|
|
17725
18017
|
defaultMessage: "Rotate your phone to portrait view to take a photo",
|
|
@@ -17728,11 +18020,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl34.defineMess
|
|
|
17728
18020
|
});
|
|
17729
18021
|
|
|
17730
18022
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17731
|
-
var
|
|
18023
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
17732
18024
|
function OrientationLockOverlay() {
|
|
17733
|
-
const intl = (0,
|
|
17734
|
-
return /* @__PURE__ */ (0,
|
|
17735
|
-
/* @__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)(
|
|
17736
18028
|
"img",
|
|
17737
18029
|
{
|
|
17738
18030
|
className: "m-b-3",
|
|
@@ -17742,25 +18034,25 @@ function OrientationLockOverlay() {
|
|
|
17742
18034
|
alt: ""
|
|
17743
18035
|
}
|
|
17744
18036
|
),
|
|
17745
|
-
/* @__PURE__ */ (0,
|
|
18037
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17746
18038
|
] });
|
|
17747
18039
|
}
|
|
17748
18040
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17749
18041
|
|
|
17750
18042
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17751
|
-
var
|
|
17752
|
-
var
|
|
18043
|
+
var import_components73 = require("@transferwise/components");
|
|
18044
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
17753
18045
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17754
|
-
return /* @__PURE__ */ (0,
|
|
17755
|
-
/* @__PURE__ */ (0,
|
|
17756
|
-
/* @__PURE__ */ (0,
|
|
17757
|
-
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 })
|
|
17758
18050
|
] }) }) });
|
|
17759
18051
|
}
|
|
17760
18052
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
17761
18053
|
|
|
17762
18054
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17763
|
-
var
|
|
18055
|
+
var import_react58 = require("react");
|
|
17764
18056
|
var import_screenfull = __toESM(require_screenfull());
|
|
17765
18057
|
|
|
17766
18058
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
@@ -17839,16 +18131,19 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17839
18131
|
|
|
17840
18132
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17841
18133
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17842
|
-
const lockOrientation = (0,
|
|
18134
|
+
const lockOrientation = (0, import_react58.useCallback)(() => {
|
|
17843
18135
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17844
|
-
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
|
+
}
|
|
17845
18140
|
}
|
|
17846
18141
|
}, [onEvent]);
|
|
17847
|
-
const unlockOrientation = (0,
|
|
18142
|
+
const unlockOrientation = (0, import_react58.useCallback)(() => {
|
|
17848
18143
|
var _a, _b, _c;
|
|
17849
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);
|
|
17850
18145
|
}, []);
|
|
17851
|
-
const enterFullScreen = (0,
|
|
18146
|
+
const enterFullScreen = (0, import_react58.useCallback)(() => {
|
|
17852
18147
|
setTimeout(() => {
|
|
17853
18148
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
17854
18149
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -17857,13 +18152,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17857
18152
|
}
|
|
17858
18153
|
}, 100);
|
|
17859
18154
|
}, [shouldLockOrientation, lockOrientation]);
|
|
17860
|
-
const exitFullScreen = (0,
|
|
18155
|
+
const exitFullScreen = (0, import_react58.useCallback)(() => {
|
|
17861
18156
|
if (import_screenfull.default.isFullscreen) {
|
|
17862
18157
|
import_screenfull.default.exit().catch(noop5);
|
|
17863
18158
|
}
|
|
17864
18159
|
unlockOrientation();
|
|
17865
18160
|
}, [unlockOrientation]);
|
|
17866
|
-
const handleOrientationChange = (0,
|
|
18161
|
+
const handleOrientationChange = (0, import_react58.useCallback)(
|
|
17867
18162
|
(event) => {
|
|
17868
18163
|
var _a, _b;
|
|
17869
18164
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -17874,7 +18169,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17874
18169
|
},
|
|
17875
18170
|
[onEvent]
|
|
17876
18171
|
);
|
|
17877
|
-
(0,
|
|
18172
|
+
(0, import_react58.useEffect)(() => {
|
|
17878
18173
|
var _a, _b;
|
|
17879
18174
|
if (shouldLockOrientation) {
|
|
17880
18175
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -17897,9 +18192,9 @@ var noop5 = () => {
|
|
|
17897
18192
|
};
|
|
17898
18193
|
|
|
17899
18194
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
17900
|
-
var
|
|
18195
|
+
var import_react59 = require("react");
|
|
17901
18196
|
var useVideoConstraints = (direction) => {
|
|
17902
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
18197
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react59.useState)();
|
|
17903
18198
|
const defaultVideoConstraints = {
|
|
17904
18199
|
facingMode: direction === "front" ? "user" : "environment",
|
|
17905
18200
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -17907,7 +18202,7 @@ var useVideoConstraints = (direction) => {
|
|
|
17907
18202
|
frameRate: 30,
|
|
17908
18203
|
aspectRatio: 16 / 9
|
|
17909
18204
|
};
|
|
17910
|
-
(0,
|
|
18205
|
+
(0, import_react59.useEffect)(() => {
|
|
17911
18206
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
17912
18207
|
}, [direction]);
|
|
17913
18208
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -17925,8 +18220,8 @@ var useVideoConstraints = (direction) => {
|
|
|
17925
18220
|
};
|
|
17926
18221
|
|
|
17927
18222
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
17928
|
-
var
|
|
17929
|
-
var
|
|
18223
|
+
var import_react60 = require("react");
|
|
18224
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
17930
18225
|
var captureButtonHeight = 92;
|
|
17931
18226
|
var reviewButtonsHeight = 120;
|
|
17932
18227
|
var imageHeight = 40;
|
|
@@ -17935,8 +18230,8 @@ var instructionsHeight = 48;
|
|
|
17935
18230
|
var reviewInstructionsHeight = 40;
|
|
17936
18231
|
var overlayMaxWidth = 800;
|
|
17937
18232
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
17938
|
-
const svgReference = (0,
|
|
17939
|
-
(0,
|
|
18233
|
+
const svgReference = (0, import_react60.useRef)(null);
|
|
18234
|
+
(0, import_react60.useEffect)(() => {
|
|
17940
18235
|
const listener = debounce2(() => {
|
|
17941
18236
|
var _a;
|
|
17942
18237
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -17948,18 +18243,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17948
18243
|
return () => window.removeEventListener("resize", listener);
|
|
17949
18244
|
});
|
|
17950
18245
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17951
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
17952
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
17953
|
-
title && /* @__PURE__ */ (0,
|
|
17954
|
-
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 })
|
|
17955
18250
|
] });
|
|
17956
18251
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17957
18252
|
if (reviewInstructions) {
|
|
17958
18253
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17959
|
-
helperBox = /* @__PURE__ */ (0,
|
|
18254
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17960
18255
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17961
18256
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17962
|
-
helperBox = /* @__PURE__ */ (0,
|
|
18257
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_jsx_runtime121.Fragment, {});
|
|
17963
18258
|
}
|
|
17964
18259
|
}
|
|
17965
18260
|
const framePosition = {
|
|
@@ -17977,20 +18272,20 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17977
18272
|
width: "90%"
|
|
17978
18273
|
}
|
|
17979
18274
|
};
|
|
17980
|
-
return /* @__PURE__ */ (0,
|
|
17981
|
-
/* @__PURE__ */ (0,
|
|
17982
|
-
/* @__PURE__ */ (0,
|
|
17983
|
-
/* @__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))
|
|
17984
18279
|
] }) }),
|
|
17985
|
-
overlay && /* @__PURE__ */ (0,
|
|
17986
|
-
outline && /* @__PURE__ */ (0,
|
|
17987
|
-
/* @__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 })) })
|
|
17988
18283
|
] });
|
|
17989
18284
|
}
|
|
17990
18285
|
var Overlay_default = Overlay;
|
|
17991
18286
|
|
|
17992
18287
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17993
|
-
var
|
|
18288
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
17994
18289
|
function CameraCapture({
|
|
17995
18290
|
direction = "back",
|
|
17996
18291
|
overlay = "",
|
|
@@ -18002,14 +18297,14 @@ function CameraCapture({
|
|
|
18002
18297
|
onCapture,
|
|
18003
18298
|
onEvent
|
|
18004
18299
|
}) {
|
|
18005
|
-
const [mode, setMode] = (0,
|
|
18006
|
-
const [cameraError, setCameraError] = (0,
|
|
18007
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
18008
|
-
const [ready, setReady] = (0,
|
|
18009
|
-
const [reviewImage, setReviewImage] = (0,
|
|
18010
|
-
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);
|
|
18011
18306
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
18012
|
-
const shouldLockOrientation = (0,
|
|
18307
|
+
const shouldLockOrientation = (0, import_react61.useMemo)(
|
|
18013
18308
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
18014
18309
|
[mode]
|
|
18015
18310
|
);
|
|
@@ -18017,8 +18312,8 @@ function CameraCapture({
|
|
|
18017
18312
|
shouldLockOrientation,
|
|
18018
18313
|
onEvent
|
|
18019
18314
|
);
|
|
18020
|
-
const intl = (0,
|
|
18021
|
-
const handleCapture = (0,
|
|
18315
|
+
const intl = (0, import_react_intl37.useIntl)();
|
|
18316
|
+
const handleCapture = (0, import_react61.useCallback)(async () => {
|
|
18022
18317
|
var _a, _b, _c, _d, _e, _f;
|
|
18023
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) {
|
|
18024
18319
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -18040,7 +18335,7 @@ function CameraCapture({
|
|
|
18040
18335
|
);
|
|
18041
18336
|
}
|
|
18042
18337
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
18043
|
-
const handleUserMediaError = (0,
|
|
18338
|
+
const handleUserMediaError = (0, import_react61.useCallback)(
|
|
18044
18339
|
(error) => {
|
|
18045
18340
|
setMode("ERROR" /* ERROR */);
|
|
18046
18341
|
if (error instanceof DOMException) {
|
|
@@ -18076,7 +18371,7 @@ function CameraCapture({
|
|
|
18076
18371
|
},
|
|
18077
18372
|
[intl, onEvent]
|
|
18078
18373
|
);
|
|
18079
|
-
const handleUserMedia = (0,
|
|
18374
|
+
const handleUserMedia = (0, import_react61.useCallback)(
|
|
18080
18375
|
(stream) => {
|
|
18081
18376
|
enterFullScreen();
|
|
18082
18377
|
setReady(true);
|
|
@@ -18093,13 +18388,13 @@ function CameraCapture({
|
|
|
18093
18388
|
setReviewImage(void 0);
|
|
18094
18389
|
};
|
|
18095
18390
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
18096
|
-
(0,
|
|
18391
|
+
(0, import_react61.useEffect)(() => {
|
|
18097
18392
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
18098
18393
|
exitFullScreen();
|
|
18099
18394
|
}
|
|
18100
18395
|
}, [mode, exitFullScreen]);
|
|
18101
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
18102
|
-
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)(
|
|
18103
18398
|
import_react_webcam.default,
|
|
18104
18399
|
{
|
|
18105
18400
|
ref: webcamReference,
|
|
@@ -18110,7 +18405,7 @@ function CameraCapture({
|
|
|
18110
18405
|
onUserMedia: handleUserMedia
|
|
18111
18406
|
}
|
|
18112
18407
|
),
|
|
18113
|
-
/* @__PURE__ */ (0,
|
|
18408
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18114
18409
|
Overlay_default,
|
|
18115
18410
|
{
|
|
18116
18411
|
overlay,
|
|
@@ -18120,8 +18415,8 @@ function CameraCapture({
|
|
|
18120
18415
|
instructions
|
|
18121
18416
|
}
|
|
18122
18417
|
),
|
|
18123
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
18124
|
-
ready && /* @__PURE__ */ (0,
|
|
18418
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(OrientationLockOverlay_default, {}),
|
|
18419
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18125
18420
|
CaptureBottomBar,
|
|
18126
18421
|
{
|
|
18127
18422
|
onCapture: () => {
|
|
@@ -18130,9 +18425,9 @@ function CameraCapture({
|
|
|
18130
18425
|
}
|
|
18131
18426
|
)
|
|
18132
18427
|
] });
|
|
18133
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
18134
|
-
/* @__PURE__ */ (0,
|
|
18135
|
-
/* @__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)(
|
|
18136
18431
|
Overlay_default,
|
|
18137
18432
|
{
|
|
18138
18433
|
overlay,
|
|
@@ -18142,18 +18437,18 @@ function CameraCapture({
|
|
|
18142
18437
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
18143
18438
|
}
|
|
18144
18439
|
),
|
|
18145
|
-
/* @__PURE__ */ (0,
|
|
18440
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
18146
18441
|
] });
|
|
18147
|
-
return /* @__PURE__ */ (0,
|
|
18442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("section", { children: [
|
|
18148
18443
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
18149
18444
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
18150
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0,
|
|
18445
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
18151
18446
|
] });
|
|
18152
18447
|
}
|
|
18153
18448
|
var CameraCapture_default = CameraCapture;
|
|
18154
18449
|
|
|
18155
18450
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
18156
|
-
var
|
|
18451
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
18157
18452
|
function blobToBase64(blob) {
|
|
18158
18453
|
return new Promise((resolve, _) => {
|
|
18159
18454
|
const reader = new FileReader();
|
|
@@ -18171,8 +18466,8 @@ function CameraStep(props) {
|
|
|
18171
18466
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
18172
18467
|
const { overlay, outline } = assets || {};
|
|
18173
18468
|
const { url: imageUrl } = image || {};
|
|
18174
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
18175
|
-
(0,
|
|
18469
|
+
const [captureClicked, setCaptureClicked] = (0, import_react62.useState)(false);
|
|
18470
|
+
(0, import_react62.useEffect)(() => {
|
|
18176
18471
|
if (captureClicked) {
|
|
18177
18472
|
onAction(action);
|
|
18178
18473
|
}
|
|
@@ -18191,7 +18486,7 @@ function CameraStep(props) {
|
|
|
18191
18486
|
});
|
|
18192
18487
|
}
|
|
18193
18488
|
};
|
|
18194
|
-
return /* @__PURE__ */ (0,
|
|
18489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
18195
18490
|
CameraCapture_default,
|
|
18196
18491
|
{
|
|
18197
18492
|
overlay,
|
|
@@ -18240,13 +18535,13 @@ function getFirstAction(step) {
|
|
|
18240
18535
|
}
|
|
18241
18536
|
|
|
18242
18537
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18243
|
-
var
|
|
18244
|
-
var
|
|
18538
|
+
var import_react_intl38 = require("react-intl");
|
|
18539
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
18245
18540
|
var noop6 = () => {
|
|
18246
18541
|
};
|
|
18247
18542
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18248
|
-
const { formatMessage } = (0,
|
|
18249
|
-
return /* @__PURE__ */ (0,
|
|
18543
|
+
const { formatMessage } = (0, import_react_intl38.useIntl)();
|
|
18544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
18250
18545
|
DynamicLayout_default,
|
|
18251
18546
|
{
|
|
18252
18547
|
components: [
|
|
@@ -18311,11 +18606,11 @@ function getOrigin2(url) {
|
|
|
18311
18606
|
}
|
|
18312
18607
|
|
|
18313
18608
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18314
|
-
var
|
|
18609
|
+
var import_components75 = require("@transferwise/components");
|
|
18315
18610
|
var import_icons6 = require("@transferwise/icons");
|
|
18316
|
-
var
|
|
18611
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
18317
18612
|
function BackButton2({ title, action, onAction }) {
|
|
18318
|
-
return /* @__PURE__ */ (0,
|
|
18613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
18319
18614
|
"a",
|
|
18320
18615
|
{
|
|
18321
18616
|
href: "/",
|
|
@@ -18326,8 +18621,8 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18326
18621
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18327
18622
|
},
|
|
18328
18623
|
children: [
|
|
18329
|
-
/* @__PURE__ */ (0,
|
|
18330
|
-
/* @__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" }) })
|
|
18331
18626
|
]
|
|
18332
18627
|
}
|
|
18333
18628
|
);
|
|
@@ -18335,7 +18630,7 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18335
18630
|
var BackButton_default2 = BackButton2;
|
|
18336
18631
|
|
|
18337
18632
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18338
|
-
var
|
|
18633
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
18339
18634
|
function DynamicFlowStep(props) {
|
|
18340
18635
|
var _a, _b, _c;
|
|
18341
18636
|
const { step, globalError, onAction } = props;
|
|
@@ -18344,28 +18639,28 @@ function DynamicFlowStep(props) {
|
|
|
18344
18639
|
const { requiresManualTrigger, dismissConfirmation } = useExternal2(externalUrl);
|
|
18345
18640
|
if (step === void 0) {
|
|
18346
18641
|
if (globalError) {
|
|
18347
|
-
return /* @__PURE__ */ (0,
|
|
18642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18348
18643
|
}
|
|
18349
18644
|
return null;
|
|
18350
18645
|
}
|
|
18351
18646
|
if (externalUrl && requiresManualTrigger) {
|
|
18352
|
-
return /* @__PURE__ */ (0,
|
|
18647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18353
18648
|
}
|
|
18354
18649
|
if (isCameraStep(step)) {
|
|
18355
|
-
return /* @__PURE__ */ (0,
|
|
18650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18356
18651
|
}
|
|
18357
|
-
return /* @__PURE__ */ (0,
|
|
18358
|
-
backButton && /* @__PURE__ */ (0,
|
|
18359
|
-
globalError ? /* @__PURE__ */ (0,
|
|
18360
|
-
/* @__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 }))
|
|
18361
18656
|
] });
|
|
18362
18657
|
}
|
|
18363
18658
|
|
|
18364
18659
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
18365
|
-
var
|
|
18660
|
+
var import_react63 = require("react");
|
|
18366
18661
|
var DEBOUNCE_DELAY = 1e3;
|
|
18367
18662
|
function useDebouncedRefresh(fetchRefresh) {
|
|
18368
|
-
const map = (0,
|
|
18663
|
+
const map = (0, import_react63.useRef)(/* @__PURE__ */ new Map());
|
|
18369
18664
|
const retrieveOrCreate = (key) => {
|
|
18370
18665
|
if (map.current.has(key)) {
|
|
18371
18666
|
return map.current.get(key);
|
|
@@ -18397,12 +18692,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18397
18692
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18398
18693
|
|
|
18399
18694
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18400
|
-
var
|
|
18695
|
+
var import_react64 = require("react");
|
|
18401
18696
|
var useDynamicFlowState = (initialStep) => {
|
|
18402
18697
|
var _a, _b;
|
|
18403
|
-
const [formErrors, setFormErrors] = (0,
|
|
18404
|
-
const [globalError, setGlobalError] = (0,
|
|
18405
|
-
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)({
|
|
18406
18701
|
step: initialStep || void 0,
|
|
18407
18702
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18408
18703
|
etag: void 0
|
|
@@ -18432,7 +18727,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
18432
18727
|
return updatedState;
|
|
18433
18728
|
});
|
|
18434
18729
|
};
|
|
18435
|
-
const modelIsValid = (0,
|
|
18730
|
+
const modelIsValid = (0, import_react64.useMemo)(
|
|
18436
18731
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
18437
18732
|
[models, step]
|
|
18438
18733
|
);
|
|
@@ -18504,19 +18799,19 @@ var getSchemaReference = (component) => {
|
|
|
18504
18799
|
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwnProperty.call(schema, "$ref");
|
|
18505
18800
|
|
|
18506
18801
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18507
|
-
var
|
|
18508
|
-
var
|
|
18509
|
-
var
|
|
18802
|
+
var import_components76 = require("@transferwise/components");
|
|
18803
|
+
var import_react65 = require("react");
|
|
18804
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
18510
18805
|
function useLoader(loaderConfig, initialState) {
|
|
18511
18806
|
const config = __spreadValues({
|
|
18512
|
-
size:
|
|
18807
|
+
size: import_components76.Size.EXTRA_LARGE,
|
|
18513
18808
|
initial: true,
|
|
18514
18809
|
submission: false
|
|
18515
18810
|
}, loaderConfig);
|
|
18516
|
-
const [loadingState, setLoadingState] = (0,
|
|
18811
|
+
const [loadingState, setLoadingState] = (0, import_react65.useState)(initialState);
|
|
18517
18812
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18518
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
18519
|
-
|
|
18813
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
18814
|
+
import_components76.Loader,
|
|
18520
18815
|
{
|
|
18521
18816
|
size: config.size,
|
|
18522
18817
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -18618,9 +18913,9 @@ var assertResponseIsValid2 = (response) => {
|
|
|
18618
18913
|
var isResponse2 = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
18619
18914
|
|
|
18620
18915
|
// src/legacy/dynamicFlow/utils/useErrorResponse.tsx
|
|
18621
|
-
var
|
|
18916
|
+
var import_react_intl39 = require("react-intl");
|
|
18622
18917
|
var useErrorResponse = () => {
|
|
18623
|
-
const { formatMessage } = (0,
|
|
18918
|
+
const { formatMessage } = (0, import_react_intl39.useIntl)();
|
|
18624
18919
|
return async (response, fetchType) => {
|
|
18625
18920
|
try {
|
|
18626
18921
|
const errorResponse = await parseErrorResponse(response);
|
|
@@ -18635,7 +18930,7 @@ var useErrorResponse = () => {
|
|
|
18635
18930
|
};
|
|
18636
18931
|
|
|
18637
18932
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18638
|
-
var
|
|
18933
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
18639
18934
|
var noop7 = () => {
|
|
18640
18935
|
};
|
|
18641
18936
|
var DynamicFlowComponent = ({
|
|
@@ -18663,7 +18958,7 @@ var DynamicFlowComponent = ({
|
|
|
18663
18958
|
setStepAndEtag,
|
|
18664
18959
|
setSchemaModel
|
|
18665
18960
|
} = useDynamicFlowState(initialStep);
|
|
18666
|
-
const [submitted, setSubmitted] = (0,
|
|
18961
|
+
const [submitted, setSubmitted] = (0, import_react66.useState)(false);
|
|
18667
18962
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18668
18963
|
loaderConfig,
|
|
18669
18964
|
initialStep ? "idle" : "initial"
|
|
@@ -18681,18 +18976,18 @@ var DynamicFlowComponent = ({
|
|
|
18681
18976
|
);
|
|
18682
18977
|
}
|
|
18683
18978
|
};
|
|
18684
|
-
const analyticsMetadata = (0,
|
|
18979
|
+
const analyticsMetadata = (0, import_react66.useMemo)(
|
|
18685
18980
|
() => {
|
|
18686
18981
|
var _a;
|
|
18687
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 : {});
|
|
18688
18983
|
},
|
|
18689
18984
|
[flowId, step]
|
|
18690
18985
|
);
|
|
18691
|
-
const dispatchEvent = (0,
|
|
18986
|
+
const dispatchEvent = (0, import_react66.useMemo)(
|
|
18692
18987
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
18693
18988
|
[onEvent, analyticsMetadata]
|
|
18694
18989
|
);
|
|
18695
|
-
const dfHttpClient = (0,
|
|
18990
|
+
const dfHttpClient = (0, import_react66.useCallback)(
|
|
18696
18991
|
({
|
|
18697
18992
|
action,
|
|
18698
18993
|
data,
|
|
@@ -18743,17 +19038,17 @@ var DynamicFlowComponent = ({
|
|
|
18743
19038
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
18744
19039
|
};
|
|
18745
19040
|
const { debouncedRefresh, isDebouncing, cancelPendingRefreshes } = useDebouncedRefresh(performRefresh);
|
|
18746
|
-
const dispatchEventAndComplete = (0,
|
|
19041
|
+
const dispatchEventAndComplete = (0, import_react66.useCallback)(
|
|
18747
19042
|
(result) => {
|
|
18748
19043
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
18749
19044
|
onCompletion(result);
|
|
18750
19045
|
},
|
|
18751
19046
|
[onCompletion, dispatchEvent]
|
|
18752
19047
|
);
|
|
18753
|
-
(0,
|
|
19048
|
+
(0, import_react66.useEffect)(() => {
|
|
18754
19049
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
18755
19050
|
}, []);
|
|
18756
|
-
(0,
|
|
19051
|
+
(0, import_react66.useEffect)(() => {
|
|
18757
19052
|
if (!initialStep) {
|
|
18758
19053
|
const action = __spreadValues({
|
|
18759
19054
|
id: "#initial-step-request",
|
|
@@ -18874,7 +19169,7 @@ var DynamicFlowComponent = ({
|
|
|
18874
19169
|
await performAction(action);
|
|
18875
19170
|
}
|
|
18876
19171
|
};
|
|
18877
|
-
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)(
|
|
18878
19173
|
DynamicFlowStep,
|
|
18879
19174
|
{
|
|
18880
19175
|
step,
|
|
@@ -18891,7 +19186,7 @@ var DynamicFlowComponent = ({
|
|
|
18891
19186
|
) }) }) }) }) });
|
|
18892
19187
|
};
|
|
18893
19188
|
function DynamicFlow(props) {
|
|
18894
|
-
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)) });
|
|
18895
19190
|
}
|
|
18896
19191
|
var DynamicFlow_default = DynamicFlow;
|
|
18897
19192
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18908,19 +19203,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18908
19203
|
};
|
|
18909
19204
|
|
|
18910
19205
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18911
|
-
var
|
|
19206
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
18912
19207
|
function JsonSchemaForm(props) {
|
|
18913
19208
|
const schemaProps = __spreadValues({
|
|
18914
19209
|
model: null,
|
|
18915
19210
|
errors: null
|
|
18916
19211
|
}, props);
|
|
18917
19212
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18918
|
-
return /* @__PURE__ */ (0,
|
|
19213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
18919
19214
|
EventsContextProvider,
|
|
18920
19215
|
{
|
|
18921
19216
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18922
19217
|
onEvent,
|
|
18923
|
-
children: /* @__PURE__ */ (0,
|
|
19218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18924
19219
|
}
|
|
18925
19220
|
) });
|
|
18926
19221
|
}
|