From 83b58b376504e85a2177c337088d0a3b4499b486 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Wed, 5 Jun 2024 11:35:22 +0530 Subject: [PATCH] refactor: belt function removal --- src/BrowserSpec.res | 6 +-- src/CardUtils.res | 13 +++-- src/Components/AccordionContainer.res | 6 +-- src/Components/Loader.res | 4 +- src/Components/SavedMethods.res | 2 +- src/Components/SurchargeUtils.res | 2 +- src/PaymentOptions.res | 4 +- src/Payments/ApplePay.res | 4 +- src/Payments/GPay.res | 2 +- src/Payments/PayPal.res | 2 +- src/Payments/PaymentRequestButtonElement.res | 4 +- src/Payments/PreMountLoader.res | 6 +-- src/Payments/QRCodeDisplay.res | 7 ++- src/Types/PaymentConfirmTypes.res | 2 +- src/Types/PaymentType.res | 4 +- src/Types/PaypalSDKTypes.res | 8 ++-- src/Utilities/ErrorUtils.res | 2 +- src/Utilities/PaymentHelpers.res | 2 +- src/Utilities/Utils.res | 16 +++---- src/orca-loader/Elements.res | 50 ++++++++++---------- src/orca-loader/Hyper.res | 6 +-- src/orca-log-catcher/ErrorBoundary.res | 2 +- src/orca-log-catcher/OrcaLogger.res | 16 +++---- 23 files changed, 84 insertions(+), 86 deletions(-) diff --git a/src/BrowserSpec.res b/src/BrowserSpec.res index 967bf789d..29343a2cb 100644 --- a/src/BrowserSpec.res +++ b/src/BrowserSpec.res @@ -32,9 +32,9 @@ let broswerInfo = () => { "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"->JSON.Encode.string, ), ("language", navigator.language->JSON.Encode.string), - ("color_depth", colorDepth->Belt.Int.toFloat->JSON.Encode.float), - ("screen_height", screen.height->Belt.Int.toFloat->JSON.Encode.float), - ("screen_width", screen.width->Belt.Int.toFloat->JSON.Encode.float), + ("color_depth", colorDepth->Int.toFloat->JSON.Encode.float), + ("screen_height", screen.height->Int.toFloat->JSON.Encode.float), + ("screen_width", screen.width->Int.toFloat->JSON.Encode.float), ("time_zone", date.getTimezoneOffset()->JSON.Encode.float), ("java_enabled", true->JSON.Encode.bool), ("java_script_enabled", true->JSON.Encode.bool), diff --git a/src/CardUtils.res b/src/CardUtils.res index d60723150..dc0dd590e 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -71,8 +71,8 @@ type options = {timeZone: string} type dateTimeFormat = {resolvedOptions: unit => options} @val @scope("Intl") external dateTimeFormat: unit => dateTimeFormat = "DateTimeFormat" -let toInt = val => val->Belt.Int.fromString->Option.getOr(0) -let toString = val => val->Belt.Int.toString +let toInt = val => val->Int.fromString->Option.getOr(0) +let toString = val => val->Int.toString let getQueryParamsDictforKey = (searchParams, keyName) => { let dict = Dict.make() @@ -206,7 +206,7 @@ let getExpiryDates = val => { let date = Date.make()->Date.toISOString let (month, year) = splitExpiryDates(val) let (_, currentYear) = getCurrentMonthAndYear(date) - let prefix = currentYear->Belt.Int.toString->String.slice(~start=0, ~end=2) + let prefix = currentYear->Int.toString->String.slice(~start=0, ~end=2) (month, `${prefix}${year}`) } let formatExpiryToTwoDigit = expiry => { @@ -269,7 +269,7 @@ let getCardBrand = cardNumber => { isin ->String.replaceRegExp(%re("/[^\d]/g"), "") ->String.substring(~start=0, ~end=6) - ->Belt.Int.fromString + ->Int.fromString ->Option.getOr(0) let range = cardRanges->Array.map(cardRange => { @@ -317,12 +317,11 @@ let calculateLuhn = value => { ->Array.map(item => { let val = item->toInt let double = val * 2 - let str = double->Belt.Int.toString + let str = double->Int.toString let arr = str->String.split("") switch (arr[0], arr[1]) { - | (Some(first), Some(second)) if double > 9 => - (first->toInt + second->toInt)->Belt.Int.toString + | (Some(first), Some(second)) if double > 9 => (first->toInt + second->toInt)->Int.toString | _ => str } }) diff --git a/src/Components/AccordionContainer.res b/src/Components/AccordionContainer.res index 3a9ba173d..9f99ecb2e 100644 --- a/src/Components/AccordionContainer.res +++ b/src/Components/AccordionContainer.res @@ -19,7 +19,7 @@ module Loader = { : ""
Belt.Int.toString} + key={i->Int.toString} style={ minWidth: "80px", minHeight: "60px", @@ -131,7 +131,7 @@ let make = (~paymentOptions: array, ~checkoutEle: React.element) => { let isActive = payOption.paymentMethodName == selectedOption let borderRadiusStyle = getBorderRadiusStyleForCardOptionDetails(i) Belt.Int.toString} + key={i->Int.toString} paymentOption=payOption isActive checkoutEle @@ -149,7 +149,7 @@ let make = (~paymentOptions: array, ~checkoutEle: React.element) => { let isActive = payOption.paymentMethodName == selectedOption let borderRadiusStyle = getBorderRadiusStyleForDropDownOptionDetails(i) Belt.Int.toString} + key={i->Int.toString} paymentOption=payOption isActive checkoutEle diff --git a/src/Components/Loader.res b/src/Components/Loader.res index b14c7b117..b3188c667 100644 --- a/src/Components/Loader.res +++ b/src/Components/Loader.res @@ -10,10 +10,10 @@ let make = (~showText=true) => { size=52 style={ animation: "slowShow 1.5s ease-in-out infinite", - animationDelay: {((i + 1) * 180)->Belt.Int.toString ++ "ms"}, + animationDelay: {((i + 1) * 180)->Int.toString ++ "ms"}, } name=item - key={i->Belt.Int.toString} + key={i->Int.toString} /> }) ->React.array} diff --git a/src/Components/SavedMethods.res b/src/Components/SavedMethods.res index eae7aad23..a7c6f6fbc 100644 --- a/src/Components/SavedMethods.res +++ b/src/Components/SavedMethods.res @@ -60,7 +60,7 @@ let make = ( } let isActive = paymentTokenVal == obj.paymentToken Belt.Int.toString} + key={i->Int.toString} setPaymentToken isActive paymentItem=obj diff --git a/src/Components/SurchargeUtils.res b/src/Components/SurchargeUtils.res index e6f2ebd71..e6442067c 100644 --- a/src/Components/SurchargeUtils.res +++ b/src/Components/SurchargeUtils.res @@ -88,7 +88,7 @@ let useOneClickWalletsMessageGetter = (~paymentMethodListValue) => { let msgToConcat = if index === 0 { myMsg - } else if index === oneClickWalletsArr->Belt.Array.length - 1 { + } else if index === oneClickWalletsArr->Array.length - 1 { <> {React.string(`${Utils.nbsp}${localeString.\"and"}${Utils.nbsp}`)} {myMsg} diff --git a/src/PaymentOptions.res b/src/PaymentOptions.res index d128cd832..c57a487da 100644 --- a/src/PaymentOptions.res +++ b/src/PaymentOptions.res @@ -12,7 +12,7 @@ module TabLoader = { ->Array.mapWithIndex((_, i) => {
Belt.Int.toString} + key={i->Int.toString} style={ minWidth: "5rem", overflowWrap: "hidden", @@ -118,7 +118,7 @@ let make = ( {cardOptionDetails ->Array.mapWithIndex((payOption, i) => { let isActive = payOption.paymentMethodName == selectedOption - Belt.Int.toString} paymentOption=payOption isActive /> + Int.toString} paymentOption=payOption isActive /> }) ->React.array} diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index 2bd861ebd..220edb79a 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -288,12 +288,12 @@ let make = (~sessionObj: option) => { let billingContact = dict - ->getDictfromDict("applePayBillingContact") + ->getDictFromDict("applePayBillingContact") ->ApplePayTypes.billingContactItemToObjMapper let shippingContact = dict - ->getDictfromDict("applePayShippingContact") + ->getDictFromDict("applePayShippingContact") ->ApplePayTypes.shippingContactItemToObjMapper let requiredFieldsBody = DynamicFieldsUtils.getApplePayRequiredFields( diff --git a/src/Payments/GPay.res b/src/Payments/GPay.res index aa3782079..6ef4012c9 100644 --- a/src/Payments/GPay.res +++ b/src/Payments/GPay.res @@ -277,7 +277,7 @@ let make = (~sessionObj: option, ~thirdPartySessionObj: opti
Belt.Int.toString}px`} + style={height: `${height->Int.toString}px`} id="google-pay-button" className={`w-full flex flex-row justify-center rounded-md`} /> diff --git a/src/Payments/PayPal.res b/src/Payments/PayPal.res index d82417def..b444e15c2 100644 --- a/src/Payments/PayPal.res +++ b/src/Payments/PayPal.res @@ -86,7 +86,7 @@ let make = () => { style={ display: "inline-block", color: textColor, - height: `${height->Belt.Int.toString}px`, + height: `${height->Int.toString}px`, borderRadius: "2px", width: "100%", backgroundColor: buttonColor, diff --git a/src/Payments/PaymentRequestButtonElement.res b/src/Payments/PaymentRequestButtonElement.res index 0c44ede94..8a96bad35 100644 --- a/src/Payments/PaymentRequestButtonElement.res +++ b/src/Payments/PaymentRequestButtonElement.res @@ -62,8 +62,8 @@ let make = (~sessions, ~walletOptions, ~paymentType) => { {walletOptions ->Array.mapWithIndex((item, i) => { Belt.Int.toString}-request-button`}> - } key={i->Belt.Int.toString}> + level={ErrorBoundary.RequestButton} key={`${item}-${i->Int.toString}-request-button`}> + } key={i->Int.toString}> {switch clientSecret { | Some(_) => switch item->paymentMode { diff --git a/src/Payments/PreMountLoader.res b/src/Payments/PreMountLoader.res index 3b531e00b..c22273856 100644 --- a/src/Payments/PreMountLoader.res +++ b/src/Payments/PreMountLoader.res @@ -73,11 +73,11 @@ let make = (~sessionId, ~publishableKey, ~clientSecret, ~endpoint) => { | _ => JSON.Encode.null } let dict = json->Utils.getDictFromJson - if dict->Dict.get("sendPaymentMethodsResponse")->Belt.Option.isSome { + if dict->Dict.get("sendPaymentMethodsResponse")->Option.isSome { paymentMethodsResponse->sendPromiseData("payment_methods") - } else if dict->Dict.get("sendCustomerPaymentMethodsResponse")->Belt.Option.isSome { + } else if dict->Dict.get("sendCustomerPaymentMethodsResponse")->Option.isSome { customerPaymentMethodsResponse->sendPromiseData("customer_payment_methods") - } else if dict->Dict.get("sendSessionTokensResponse")->Belt.Option.isSome { + } else if dict->Dict.get("sendSessionTokensResponse")->Option.isSome { sessionTokensResponse->sendPromiseData("session_tokens") } } diff --git a/src/Payments/QRCodeDisplay.res b/src/Payments/QRCodeDisplay.res index 50ca3262e..8dd6eb9fc 100644 --- a/src/Payments/QRCodeDisplay.res +++ b/src/Payments/QRCodeDisplay.res @@ -44,7 +44,7 @@ let make = () => { Dict.set(headers, x, val->getStringFromJson("")) }) let expiryTime = - metaDataDict->getString("expiryTime", "")->Belt.Float.fromString->Option.getOr(0.0) + metaDataDict->getString("expiryTime", "")->Float.fromString->Option.getOr(0.0) let timeExpiry = expiryTime -. Date.now() if timeExpiry > 0.0 && timeExpiry < 900000.0 { setExpiryTime(_ => timeExpiry) @@ -121,9 +121,8 @@ let make = () => { } let expiryString = React.useMemo(() => { - let minutes = (expiryTime /. 60000.0)->Belt.Float.toInt->Belt.Int.toString - let seconds = - mod(expiryTime->Belt.Float.toInt, 60000)->Belt.Int.toString->String.slice(~start=0, ~end=2) + let minutes = (expiryTime /. 60000.0)->Float.toInt->Int.toString + let seconds = mod(expiryTime->Float.toInt, 60000)->Int.toString->String.slice(~start=0, ~end=2) let seconds = seconds->String.length == 1 ? `${seconds}0` : seconds `${minutes}:${seconds}` }, [expiryTime]) diff --git a/src/Types/PaymentConfirmTypes.res b/src/Types/PaymentConfirmTypes.res index f16088dbb..67f703cd9 100644 --- a/src/Types/PaymentConfirmTypes.res +++ b/src/Types/PaymentConfirmTypes.res @@ -163,7 +163,7 @@ let getNextAction = (dict, str) => { ->Option.flatMap(JSON.Decode.object) ->Option.map(json => json->getVoucherDetails) }, - next_action_data: Some(json->getDictfromDict("next_action_data")->JSON.Encode.object), + next_action_data: Some(json->getDictFromDict("next_action_data")->JSON.Encode.object), } }) ->Option.getOr(defaultNextAction) diff --git a/src/Types/PaymentType.res b/src/Types/PaymentType.res index 2b00dc7c8..3d8b26acf 100644 --- a/src/Types/PaymentType.res +++ b/src/Types/PaymentType.res @@ -915,7 +915,7 @@ let getConfirmParams = dict => { let getSdkHandleConfirmPaymentProps = dict => { handleConfirm: dict->getBool("handleConfirm", false), buttonText: ?dict->getOptionString("buttonText"), - confirmParams: dict->getDictfromDict("confirmParams")->getConfirmParams, + confirmParams: dict->getDictFromDict("confirmParams")->getConfirmParams, } let itemToObjMapper = (dict, logger) => { @@ -975,7 +975,7 @@ let itemToObjMapper = (dict, logger) => { showCardFormByDefault: getBool(dict, "showCardFormByDefault", true), billingAddress: getBillingAddress(dict, "billingAddress", logger), sdkHandleConfirmPayment: dict - ->getDictfromDict("sdkHandleConfirmPayment") + ->getDictFromDict("sdkHandleConfirmPayment") ->getSdkHandleConfirmPaymentProps, paymentMethodsHeaderText: ?getOptionString(dict, "paymentMethodsHeaderText"), savedPaymentMethodsHeaderText: ?getOptionString(dict, "savedPaymentMethodsHeaderText"), diff --git a/src/Types/PaypalSDKTypes.res b/src/Types/PaypalSDKTypes.res index ce66bbc22..c525de989 100644 --- a/src/Types/PaypalSDKTypes.res +++ b/src/Types/PaypalSDKTypes.res @@ -126,11 +126,11 @@ let getShippingDetails = shippingAddressOverrideObj => { } let paypalShippingDetails = purchaseUnit => { - let shippingAddress = purchaseUnit->Utils.getDictfromDict("shipping") - let payee = purchaseUnit->Utils.getDictfromDict("payee") + let shippingAddress = purchaseUnit->Utils.getDictFromDict("shipping") + let payee = purchaseUnit->Utils.getDictFromDict("payee") - let address = shippingAddress->Utils.getDictfromDict("address") - let name = shippingAddress->Utils.getDictfromDict("name") + let address = shippingAddress->Utils.getDictFromDict("address") + let name = shippingAddress->Utils.getDictFromDict("name") let recipientName = name->Utils.getOptionString("full_name") let line1 = address->Utils.getOptionString("address_line_1") diff --git a/src/Utilities/ErrorUtils.res b/src/Utilities/ErrorUtils.res index 86dd2e683..04d64221e 100644 --- a/src/Utilities/ErrorUtils.res +++ b/src/Utilities/ErrorUtils.res @@ -173,7 +173,7 @@ let unknownPropValueWarning = ( let valueOutRangeWarning = (num: int, dictType, range, ~logger: OrcaLogger.loggerMake) => { manageErrorWarning( VALUE_OUT_OF_RANGE, - ~dynamicStr=`${num->Belt.Int.toString} value in ${dictType} Expected value between ${range}`, + ~dynamicStr=`${num->Int.toString} value in ${dictType} Expected value between ${range}`, ~logger: OrcaLogger.loggerMake, (), ) diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 5eb36fd76..26f8f9c89 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -609,7 +609,7 @@ let rec intentCall = ( ("paymentIntentId", clientSecret->JSON.Encode.string), ("publishableKey", confirmParam.publishableKey->JSON.Encode.string), ("headers", headerObj->JSON.Encode.object), - ("expiryTime", expiryTime->Belt.Float.toString->JSON.Encode.string), + ("expiryTime", expiryTime->Float.toString->JSON.Encode.string), ("url", url.href->JSON.Encode.string), ]->Dict.fromArray handleLogging( diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index 7bddcce44..f6982de3d 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -55,8 +55,8 @@ let getInt = (dict, key, default: int) => { dict ->Dict.get(key) ->Option.flatMap(JSON.Decode.float) - ->Option.getOr(default->Belt.Int.toFloat) - ->Belt.Float.toInt + ->Option.getOr(default->Int.toFloat) + ->Float.toInt } let getFloatFromString = (str, default) => str->Float.fromString->Option.getOr(default) @@ -148,7 +148,7 @@ let getDictFromJson = (json: JSON.t) => { json->JSON.Decode.object->Option.getOr(Dict.make()) } -let getDictfromDict = (dict, key) => { +let getDictFromDict = (dict, key) => { dict->getJsonObjectFromDict(key)->getDictFromJson } @@ -172,7 +172,7 @@ let getNumberWithWarning = (dict, key, ~logger, default) => { switch dict->Dict.get(key) { | Some(val) => switch val->JSON.Decode.float { - | Some(val) => val->Belt.Float.toInt + | Some(val) => val->Float.toInt | None => manageErrorWarning(TYPE_INT_ERROR, ~dynamicStr=key, ~logger, ()) default @@ -361,7 +361,7 @@ let rec transformKeys = (json: JSON.t, to: case) => { } (key->toCase, val->JSON.Encode.string) } - | Number(val) => (key->toCase, val->Belt.Float.toString->JSON.Encode.string) + | Number(val) => (key->toCase, val->Float.toString->JSON.Encode.string) | _ => (key->toCase, value) } x @@ -631,14 +631,14 @@ let addSize = (str: string, value: float, unit: sizeunit) => { arr ->Array.slice(~start=0, ~end={arr->Array.length - unitInString->String.length}) ->Array.joinWith("") - ->Belt.Float.fromString + ->Float.fromString ->Option.getOr(0.0) - (val +. value)->Belt.Float.toString ++ unitInString + (val +. value)->Float.toString ++ unitInString } else { str } } -let toInt = val => val->Belt.Int.fromString->Option.getOr(0) +let toInt = val => val->Int.fromString->Option.getOr(0) let validateRountingNumber = str => { if str->String.length != 9 { diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 91a528c7c..8fcd23e5e 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -480,19 +480,19 @@ let make = ( let dict = json->getDictFromJson switch dict->Dict.get("applePayButtonClicked") { | Some(val) => - if val->JSON.Decode.bool->Belt.Option.getWithDefault(false) { + if val->JSON.Decode.bool->Option.getOr(false) { let applePaySessionTokenData = dict ->Dict.get("applePayPresent") ->Belt.Option.flatMap(JSON.Decode.object) - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) let isDelayedSessionToken = applePaySessionTokenData ->Dict.get("delayed_session_token") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) ->JSON.Decode.bool - ->Belt.Option.getWithDefault(false) + ->Option.getOr(false) if isDelayedSessionToken { logger.setLogInfo( @@ -505,9 +505,9 @@ let make = ( let connector = applePaySessionTokenData ->Dict.get("connector") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) ->JSON.Decode.string - ->Belt.Option.getWithDefault("") + ->Option.getOr("") switch connector { | "trustpay" => @@ -520,27 +520,27 @@ let make = ( let secrets = applePaySessionTokenData ->Dict.get("session_token_data") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) ->JSON.Decode.object - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->Dict.get("secrets") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) let paymentRequest = applePaySessionTokenData ->Dict.get("payment_request_data") ->Belt.Option.flatMap(JSON.Decode.object) - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->ApplePayTypes.jsonToPaymentRequestDataType let payment = secrets ->JSON.Decode.object - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->Dict.get("payment") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) ->JSON.Decode.string - ->Belt.Option.getWithDefault("") + ->Option.getOr("") try { let trustpay = trustPayApi(secrets) @@ -721,7 +721,7 @@ let make = ( let sessionsArr = json ->JSON.Decode.object - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->SessionsType.getSessionsTokenJson("session_token") let applePayPresent = sessionsArr->Array.find(item => { @@ -732,10 +732,10 @@ let make = ( x->Dict.get("wallet_name") }) ->Belt.Option.flatMap(JSON.Decode.string) - ->Belt.Option.getWithDefault("") + ->Option.getOr("") x === "apple_pay" || x === "applepay" }) - if !(applePayPresent->Belt.Option.isSome) { + if !(applePayPresent->Option.isSome) { let msg = [("applePaySessionObjNotPresent", true->JSON.Encode.bool)]->Dict.fromArray mountedIframeRef->Window.iframePostMessage(msg) @@ -748,7 +748,7 @@ let make = ( x->Dict.get("wallet_name") }) ->Belt.Option.flatMap(JSON.Decode.string) - ->Belt.Option.getWithDefault("") + ->Option.getOr("") x === "google_pay" || x === "googlepay" }) @@ -758,7 +758,7 @@ let make = ( let (json, applePayPresent, googlePayPresent) = res if ( componentType->getIsComponentTypeForPaymentElementCreate && - applePayPresent->Belt.Option.isSome + applePayPresent->Option.isSome ) { //do operations here let processPayment = ( @@ -783,15 +783,15 @@ let make = ( dict->Dict.get("applePayPaymentRequest"), ) { | (Some(val), Some(paymentRequest)) => - if val->JSON.Decode.bool->Belt.Option.getWithDefault(false) { + if val->JSON.Decode.bool->Option.getOr(false) { let isDelayedSessionToken = applePayPresent ->Belt.Option.flatMap(JSON.Decode.object) - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->Dict.get("delayed_session_token") - ->Belt.Option.getWithDefault(JSON.Encode.null) + ->Option.getOr(JSON.Encode.null) ->JSON.Decode.bool - ->Belt.Option.getWithDefault(false) + ->Option.getOr(false) if !isDelayedSessionToken { logger.setLogInfo( ~value="Normal Session Token Flow", @@ -817,9 +817,9 @@ let make = ( let merchantSession = applePayPresent ->Belt.Option.flatMap(JSON.Decode.object) - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getOr(Dict.make()) ->Dict.get("session_token_data") - ->Belt.Option.getWithDefault(Dict.make()->JSON.Encode.object) + ->Option.getOr(Dict.make()->JSON.Encode.object) ->transformKeys(CamelCase) ssn.completeMerchantValidation(merchantSession) } @@ -864,7 +864,7 @@ let make = ( } if ( componentType->getIsComponentTypeForPaymentElementCreate && - googlePayPresent->Belt.Option.isSome && + googlePayPresent->Option.isSome && wallets.googlePay === Auto ) { let dict = json->getDictFromJson diff --git a/src/orca-loader/Hyper.res b/src/orca-loader/Hyper.res index 7adabb05c..b11a213da 100644 --- a/src/orca-loader/Hyper.res +++ b/src/orca-loader/Hyper.res @@ -87,7 +87,7 @@ let make = (publishableKey, options: option, analyticsInfo: optionOption.flatMap(JSON.Decode.object)->Option.getOr(Dict.make()) let sessionID = analyticsInfoDict->getString("sessionID", "hyp_" ++ Utils.generateRandomString(8)) - let sdkTimestamp = analyticsInfoDict->getString("timeStamp", Date.now()->Belt.Float.toString) + let sdkTimestamp = analyticsInfoDict->getString("timeStamp", Date.now()->Float.toString) let logger = OrcaLogger.make( ~sessionId=sessionID, ~source=Loader, @@ -151,7 +151,7 @@ let make = (publishableKey, options: option, analyticsInfo: option - let loaderTimestamp = Date.now()->Belt.Float.toString + let loaderTimestamp = Date.now()->Float.toString { () => { @@ -280,7 +280,7 @@ let make = (publishableKey, options: option, analyticsInfo: optiongetDictFromJson - ->getDictfromDict("confirmParams") + ->getDictFromDict("confirmParams") ->getString("redirect", "if_required") let url = diff --git a/src/orca-log-catcher/ErrorBoundary.res b/src/orca-log-catcher/ErrorBoundary.res index 16c13f715..fb25e90c9 100644 --- a/src/orca-log-catcher/ErrorBoundary.res +++ b/src/orca-log-catcher/ErrorBoundary.res @@ -108,7 +108,7 @@ module ErrorCard = { if enableLogging && ["DEBUG", "INFO", "WARN", "ERROR"]->Array.includes(loggingLevel) { let errorLog: OrcaLogger.logFile = { logType: ERROR, - timestamp: Date.now()->Belt.Float.toString, + timestamp: Date.now()->Float.toString, sessionId: "", source: "orca-elements", version: GlobalVars.repoVersion, diff --git a/src/orca-log-catcher/OrcaLogger.res b/src/orca-log-catcher/OrcaLogger.res index 1c2852210..aa94918f7 100644 --- a/src/orca-log-catcher/OrcaLogger.res +++ b/src/orca-log-catcher/OrcaLogger.res @@ -613,7 +613,7 @@ let make = (~sessionId=?, ~source: source, ~clientSecret=?, ~merchantId=?, ~meta } | _ => 0. } - latency > 0. ? latency->Belt.Float.toString : "" + latency > 0. ? latency->Float.toString : "" } let setLogInfo = ( @@ -633,8 +633,8 @@ let make = (~sessionId=?, ~source: source, ~clientSecret=?, ~merchantId=?, ~meta | Some(lat) => lat->Float.toString | None => calculateLatencyHook(~eventName, ()) } - let localTimestamp = timestamp->Option.getOr(Date.now()->Belt.Float.toString) - let localTimestampFloat = localTimestamp->Belt.Float.fromString->Option.getOr(Date.now()) + let localTimestamp = timestamp->Option.getOr(Date.now()->Float.toString) + let localTimestampFloat = localTimestamp->Float.fromString->Option.getOr(Date.now()) { logType, timestamp: localTimestamp, @@ -684,8 +684,8 @@ let make = (~sessionId=?, ~source: source, ~clientSecret=?, ~merchantId=?, ~meta let eventNameStr = eventName->eventNameToStrMapper let firstEvent = events.contents->Dict.get(eventNameStr)->Option.isNone let latency = calculateLatencyHook(~eventName, ~apiLogType, ()) - let localTimestamp = timestamp->Option.getOr(Date.now()->Belt.Float.toString) - let localTimestampFloat = localTimestamp->Belt.Float.fromString->Option.getOr(Date.now()) + let localTimestamp = timestamp->Option.getOr(Date.now()->Float.toString) + let localTimestampFloat = localTimestamp->Float.fromString->Option.getOr(Date.now()) { logType, timestamp: localTimestamp, @@ -737,8 +737,8 @@ let make = (~sessionId=?, ~source: source, ~clientSecret=?, ~merchantId=?, ~meta | Some(lat) => lat->Float.toString | None => calculateLatencyHook(~eventName, ()) } - let localTimestamp = timestamp->Option.getOr(Date.now()->Belt.Float.toString) - let localTimestampFloat = localTimestamp->Belt.Float.fromString->Option.getOr(Date.now()) + let localTimestamp = timestamp->Option.getOr(Date.now()->Float.toString) + let localTimestampFloat = localTimestamp->Float.fromString->Option.getOr(Date.now()) { logType, timestamp: localTimestamp, @@ -775,7 +775,7 @@ let make = (~sessionId=?, ~source: source, ~clientSecret=?, ~merchantId=?, ~meta { logType: INFO, eventName, - timestamp: Date.now()->Belt.Float.toString, + timestamp: Date.now()->Float.toString, sessionId: sessionId.contents, source: sourceString, version: GlobalVars.repoVersion,