diff --git a/public/hyperswitch/wasm/euclid.d.ts b/public/hyperswitch/wasm/euclid.d.ts index a14381d58..3e372fb07 100644 --- a/public/hyperswitch/wasm/euclid.d.ts +++ b/public/hyperswitch/wasm/euclid.d.ts @@ -59,6 +59,14 @@ export function getAllKeys(): any; */ export function getKeyType(key: string): string; /** +* @returns {any} +*/ +export function getThreeDsKeys(): any; +/** +* @returns {any} +*/ +export function getSurchargeKeys(): any; +/** * @param {string} val * @returns {string} */ @@ -100,6 +108,8 @@ export interface InitOutput { readonly getAllConnectors: (a: number) => void; readonly getAllKeys: (a: number) => void; readonly getKeyType: (a: number, b: number, c: number) => void; + readonly getThreeDsKeys: (a: number) => void; + readonly getSurchargeKeys: (a: number) => void; readonly getVariantValues: (a: number, b: number, c: number) => void; readonly addTwo: (a: number, b: number) => number; readonly getDescriptionCategory: (a: number) => void; diff --git a/public/hyperswitch/wasm/euclid.js b/public/hyperswitch/wasm/euclid.js index 501d28975..9490f3eb2 100644 --- a/public/hyperswitch/wasm/euclid.js +++ b/public/hyperswitch/wasm/euclid.js @@ -401,6 +401,44 @@ export function getKeyType(key) { } } +/** +* @returns {any} +*/ +export function getThreeDsKeys() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getThreeDsKeys(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + +/** +* @returns {any} +*/ +export function getSurchargeKeys() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getSurchargeKeys(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } +} + /** * @param {string} val * @returns {string} diff --git a/public/hyperswitch/wasm/euclid_bg.wasm b/public/hyperswitch/wasm/euclid_bg.wasm index 1430b1bd0..143b9a046 100644 Binary files a/public/hyperswitch/wasm/euclid_bg.wasm and b/public/hyperswitch/wasm/euclid_bg.wasm differ diff --git a/public/hyperswitch/wasm/euclid_bg.wasm.d.ts b/public/hyperswitch/wasm/euclid_bg.wasm.d.ts index d5ceadfad..bf2ec483a 100644 --- a/public/hyperswitch/wasm/euclid_bg.wasm.d.ts +++ b/public/hyperswitch/wasm/euclid_bg.wasm.d.ts @@ -10,6 +10,8 @@ export function runProgram(a: number, b: number, c: number): void; export function getAllConnectors(a: number): void; export function getAllKeys(a: number): void; export function getKeyType(a: number, b: number, c: number): void; +export function getThreeDsKeys(a: number): void; +export function getSurchargeKeys(a: number): void; export function getVariantValues(a: number, b: number, c: number): void; export function addTwo(a: number, b: number): number; export function getDescriptionCategory(a: number): void; diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index 7b7b20656..3e1761419 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -287,34 +287,43 @@ module FieldInp = { let field = ReactFinalForm.useField(`${prefix}.lhs`).input let op = ReactFinalForm.useField(`${prefix}.comparison`).input let val = ReactFinalForm.useField(`${prefix}.value.value`).input - - let keyDescriptionMapper = Window.getDescriptionCategory()->MapTypes.changeType - let convertedValue = LogicUtils.convertMapObjectToDict(keyDescriptionMapper) - let options = convertedValue->Js.Dict.keys->Js.Array2.reduce((acc, ele) => { - open LogicUtils - convertedValue - ->Js.Dict.get(ele) - ->Belt.Option.getWithDefault([]->Js.Json.array) - ->Js.Json.decodeArray - ->Belt.Option.getWithDefault([]) - ->Js.Array2.forEach(value => { - let dictValue = value->LogicUtils.getDictFromJsonObject - let extractValueFromDict = key => - dictValue - ->Js.Dict.get(key) - ->Option.getWithDefault(""->Js.Json.string) - ->getStringFromJson("") - - let generatedSelectBoxOptionType: SelectBox.dropdownOption = { - label: extractValueFromDict("kind"), - value: extractValueFromDict("kind"), - description: extractValueFromDict("description"), - optGroup: ele, - } - acc->Js.Array2.push(generatedSelectBoxOptionType)->ignore - }) - acc - }, []) + let descriptionCategory = Window.getDescriptionCategory() + + let convertedValue = React.useMemo1(() => { + let keyDescriptionMapper = descriptionCategory->MapTypes.changeType + keyDescriptionMapper->LogicUtils.convertMapObjectToDict + }, [descriptionCategory]) + + let options = React.useMemo1( + () => convertedValue->Js.Dict.keys->Js.Array2.reduce((acc, ele) => { + open LogicUtils + convertedValue + ->Js.Dict.get(ele) + ->Belt.Option.getWithDefault([]->Js.Json.array) + ->Js.Json.decodeArray + ->Belt.Option.getWithDefault([]) + ->Js.Array2.forEach( + value => { + let dictValue = value->LogicUtils.getDictFromJsonObject + let extractValueFromDict = key => + dictValue + ->Js.Dict.get(key) + ->Option.getWithDefault(""->Js.Json.string) + ->getStringFromJson("") + + let generatedSelectBoxOptionType: SelectBox.dropdownOption = { + label: extractValueFromDict("kind"), + value: extractValueFromDict("kind"), + description: extractValueFromDict("description"), + optGroup: ele, + } + acc->Js.Array2.push(generatedSelectBoxOptionType)->ignore + }, + ) + acc + }, []), + [convertedValue], + ) let input: ReactFinalForm.fieldRenderPropsInput = { name: "string",