diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4a32168e3..71de05d03 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,6 @@ - @akash-c-k @ArushKapoorJuspay @PritishBudhiraja @seekshiva +* @PritishBudhiraja @seekshiva @ArushKapoorJuspay docs/ @akash-c-k LICENSE @akash-c-k README.md @akash-c-k @@ -17,5 +18,5 @@ webpack.dev.js @ArushKapoorJuspay @PritishBudhiraja @seekshiva webpack.common.js @ArushKapoorJuspay @PritishBudhiraja @seekshiva src/ @seekshiva @PritishBudhiraja @ArushKapoorJuspay -src/orca-log-catcher @Sanskar2001 +src/hyper-log-catcher @Sanskar2001 cypress-tests/ @seekshiva @Sanskar2001 diff --git a/src/App.res b/src/App.res index a8d3c8c1f..b1ff97128 100644 --- a/src/App.res +++ b/src/App.res @@ -7,7 +7,7 @@ let make = () => { let paymentMode = CardUtils.getQueryParamsDictforKey(url.search, "componentName") let paymentType = paymentMode->CardThemeType.getPaymentMode let (logger, initTimestamp) = React.useMemo0(() => { - (OrcaLogger.make(~source=Elements(paymentType)), Date.now()) + (HyperLogger.make(~source=Elements(paymentType)), Date.now()) }) let fullscreenMode = CardUtils.getQueryParamsDictforKey(url.search, "fullscreenType") diff --git a/src/Payments/PaypalSDKHelpers.res b/src/Payments/PaypalSDKHelpers.res index ffdd80024..96603bf72 100644 --- a/src/Payments/PaypalSDKHelpers.res +++ b/src/Payments/PaypalSDKHelpers.res @@ -4,7 +4,7 @@ open Utils open TaxCalculation let loadPaypalSDK = ( - ~loggerState: OrcaLogger.loggerMake, + ~loggerState: HyperLogger.loggerMake, ~sdkHandleOneClickConfirmPayment as _, ~buttonStyle, ~iframeId, @@ -227,7 +227,7 @@ let loadPaypalSDK = ( } let loadBraintreePaypalSdk = ( - ~loggerState: OrcaLogger.loggerMake, + ~loggerState: HyperLogger.loggerMake, ~sdkHandleOneClickConfirmPayment, ~token, ~buttonStyle, diff --git a/src/Payments/PlaidSDKIframe.res b/src/Payments/PlaidSDKIframe.res index e3716d663..7b1c11ac1 100644 --- a/src/Payments/PlaidSDKIframe.res +++ b/src/Payments/PlaidSDKIframe.res @@ -9,7 +9,7 @@ let make = () => { let (clientSecret, setClientSecret) = React.useState(_ => "") let (isForceSync, setIsForceSync) = React.useState(_ => false) let logger = React.useMemo(() => { - OrcaLogger.make(~source=Elements(Payment), ~clientSecret, ~merchantId=publishableKey) + HyperLogger.make(~source=Elements(Payment), ~clientSecret, ~merchantId=publishableKey) }, (publishableKey, clientSecret)) React.useEffect0(() => { diff --git a/src/Payments/PreMountLoader.res b/src/Payments/PreMountLoader.res index c600b7a84..8f976ca43 100644 --- a/src/Payments/PreMountLoader.res +++ b/src/Payments/PreMountLoader.res @@ -19,7 +19,7 @@ let make = ( false ) let (sessionTokensResponseSent, setSessionTokensResponseSent) = React.useState(_ => false) - let logger = OrcaLogger.make( + let logger = HyperLogger.make( ~sessionId, ~source=Loader, ~merchantId=publishableKey, diff --git a/src/ThreeDSAuth.res b/src/ThreeDSAuth.res index 96e0693ee..84ad15273 100644 --- a/src/ThreeDSAuth.res +++ b/src/ThreeDSAuth.res @@ -8,7 +8,7 @@ let make = () => { let threeDsAuthoriseUrl = React.useRef("") let (expiryTime, setExpiryTime) = React.useState(_ => 600000.0) - let logger = OrcaLogger.make(~source=Elements(Payment)) + let logger = HyperLogger.make(~source=Elements(Payment)) let handleFrictionLess = () => { let ele = Window.querySelector("#threeDsAuthDiv") diff --git a/src/ThreeDSMethod.res b/src/ThreeDSMethod.res index 4b2b1caf5..25ce113da 100644 --- a/src/ThreeDSMethod.res +++ b/src/ThreeDSMethod.res @@ -1,7 +1,7 @@ open Utils @react.component let make = () => { - let logger = OrcaLogger.make(~source=Elements(Payment)) + let logger = HyperLogger.make(~source=Elements(Payment)) let (stateMetadata, setStateMetadata) = React.useState(_ => Dict.make()->JSON.Encode.object) diff --git a/src/Utilities/ApplePayHelpers.res b/src/Utilities/ApplePayHelpers.res index 5c33cca71..b337e3ede 100644 --- a/src/Utilities/ApplePayHelpers.res +++ b/src/Utilities/ApplePayHelpers.res @@ -72,7 +72,7 @@ let startApplePaySession = ( ~paymentRequest, ~applePaySessionRef, ~applePayPresent, - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ~callBackFunc, ~resolvePromise, ~clientSecret, diff --git a/src/Utilities/ErrorUtils.res b/src/Utilities/ErrorUtils.res index 919b46143..1118612db 100644 --- a/src/Utilities/ErrorUtils.res +++ b/src/Utilities/ErrorUtils.res @@ -1,9 +1,9 @@ type type_ = Error | Warning type stringType = Dynamic(string => string) | Static(string) -type error = array<(OrcaLogger.eventName, type_, string)> +type error = array<(HyperLogger.eventName, type_, string)> -open OrcaLogger +open HyperLogger let errorWarning = [ ( @@ -107,9 +107,9 @@ let errorWarning = [ ] let manageErrorWarning = ( - key: OrcaLogger.eventName, + key: HyperLogger.eventName, ~dynamicStr="", - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ) => { let entry = errorWarning->Array.find(((value, _, _)) => value == key) switch entry { @@ -120,7 +120,7 @@ let manageErrorWarning = ( | Static(string) => string | Dynamic(fn) => fn(dynamicStr) } - let logType: OrcaLogger.logType = switch type_ { + let logType: HyperLogger.logType = switch type_ { | Warning => WARNING | Error => ERROR } @@ -154,7 +154,7 @@ let unknownPropValueWarning = ( inValidValue, validValueArr, dictType, - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ) => { let expectedValues = validValueArr @@ -168,10 +168,10 @@ let unknownPropValueWarning = ( ~logger, ) } -let valueOutRangeWarning = (num: int, dictType, range, ~logger: OrcaLogger.loggerMake) => { +let valueOutRangeWarning = (num: int, dictType, range, ~logger: HyperLogger.loggerMake) => { manageErrorWarning( VALUE_OUT_OF_RANGE, ~dynamicStr=`${num->Int.toString} value in ${dictType} Expected value between ${range}`, - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ) } diff --git a/src/Utilities/LoggerUtils.res b/src/Utilities/LoggerUtils.res index fd9b4570c..f5174f7bb 100644 --- a/src/Utilities/LoggerUtils.res +++ b/src/Utilities/LoggerUtils.res @@ -2,13 +2,13 @@ let logApi = ( ~eventName, ~statusCode="", ~data: JSON.t=Dict.make()->JSON.Encode.object, - ~apiLogType: OrcaLogger.apiLogType, + ~apiLogType: HyperLogger.apiLogType, ~url="", ~paymentMethod="", ~result: JSON.t=Dict.make()->JSON.Encode.object, - ~optLogger: option, - ~logType: OrcaLogger.logType=INFO, - ~logCategory: OrcaLogger.logCategory=API, + ~optLogger: option, + ~logType: HyperLogger.logType=INFO, + ~logCategory: HyperLogger.logCategory=API, ~isPaymentSession: bool=false, ) => { let (value, internalMetadata) = switch apiLogType { @@ -50,17 +50,17 @@ let logApi = ( } } -let logInputChangeInfo = (text, logger: OrcaLogger.loggerMake) => { +let logInputChangeInfo = (text, logger: HyperLogger.loggerMake) => { logger.setLogInfo(~value=text, ~eventName=INPUT_FIELD_CHANGED) } let handleLogging = ( - ~optLogger: option, + ~optLogger: option, ~value, ~internalMetadata="", ~eventName, ~paymentMethod, - ~logType: OrcaLogger.logType=INFO, + ~logType: HyperLogger.logType=INFO, ) => { switch optLogger { | Some(logger) => diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 4a95def13..08ce312c5 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -325,7 +325,7 @@ let rec intentCall = ( let isCompleteAuthorize = uri->String.includes("/complete_authorize") let isPostSessionTokens = uri->String.includes("/post_session_tokens") - let (eventName: OrcaLogger.eventName, initEventName: OrcaLogger.eventName) = switch ( + let (eventName: HyperLogger.eventName, initEventName: HyperLogger.eventName) = switch ( isConfirm, isCompleteAuthorize, isPostSessionTokens, @@ -923,7 +923,7 @@ let rec intentCall = ( }) } -let usePaymentSync = (optLogger: option, paymentType: payment) => { +let usePaymentSync = (optLogger: option, paymentType: payment) => { open RecoilAtoms let paymentMethodList = Recoil.useRecoilValueFromAtom(paymentMethodList) let keys = Recoil.useRecoilValueFromAtom(keys) @@ -1175,7 +1175,7 @@ let usePaymentIntent = (optLogger, paymentType) => { } } -let useCompleteAuthorize = (optLogger: option, paymentType: payment) => { +let useCompleteAuthorize = (optLogger: option, paymentType: payment) => { open RecoilAtoms let paymentMethodList = Recoil.useRecoilValueFromAtom(paymentMethodList) let keys = Recoil.useRecoilValueFromAtom(keys) @@ -1789,7 +1789,7 @@ let callAuthExchange = ( open Promise open PaymentType let endpoint = ApiEndpoint.getApiEndPoint() - let logger = OrcaLogger.make(~source=Elements(Payment)) + let logger = HyperLogger.make(~source=Elements(Payment)) let uri = `${endpoint}/payment_methods/auth/exchange` let updatedBody = [ ("client_secret", clientSecret->Option.getOr("")->JSON.Encode.string), diff --git a/src/Utilities/PmAuthConnectorUtils.res b/src/Utilities/PmAuthConnectorUtils.res index ebdce4008..e7d604026 100644 --- a/src/Utilities/PmAuthConnectorUtils.res +++ b/src/Utilities/PmAuthConnectorUtils.res @@ -17,7 +17,7 @@ let pmAuthConnectorToScriptUrlMapper = authConnector => { let mountAuthConnectorScript = ( ~authConnector, ~onScriptLoaded, - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ) => { let authConnector = authConnector->Option.getOr("") let pmAuthConnectorScriptUrl = @@ -47,7 +47,7 @@ let mountAuthConnectorScript = ( let mountAllRequriedAuthConnectorScripts = ( ~pmAuthConnectorsArr, ~onScriptLoaded, - ~logger: OrcaLogger.loggerMake, + ~logger: HyperLogger.loggerMake, ) => { pmAuthConnectorsArr->Array.forEach(item => { mountAuthConnectorScript(~authConnector=item, ~onScriptLoaded, ~logger) diff --git a/src/Utilities/RecoilAtoms.res b/src/Utilities/RecoilAtoms.res index 438334e52..414340f08 100644 --- a/src/Utilities/RecoilAtoms.res +++ b/src/Utilities/RecoilAtoms.res @@ -7,7 +7,7 @@ let elementOptions = Recoil.atom("elementOptions", ElementType.defaultOptions) let optionAtom = Recoil.atom("options", PaymentType.defaultOptions) let sessions = Recoil.atom("sessions", PaymentType.Loading) let paymentMethodList = Recoil.atom("paymentMethodList", PaymentType.Loading) -let loggerAtom = Recoil.atom("component", OrcaLogger.defaultLoggerConfig) +let loggerAtom = Recoil.atom("component", HyperLogger.defaultLoggerConfig) let sessionId = Recoil.atom("sessionId", "") let isConfirmBlocked = Recoil.atom("isConfirmBlocked", false) let customPodUri = Recoil.atom("customPodUri", "") diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index b56fd5f98..50f09d979 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -689,7 +689,7 @@ let handlePostMessageEvents = ( ~complete, ~empty, ~paymentType, - ~loggerState: OrcaLogger.loggerMake, + ~loggerState: HyperLogger.loggerMake, ~savedMethod=false, ) => { if complete && paymentType !== "" { @@ -833,8 +833,8 @@ let getHeaders = (~uri=?, ~token=?, ~headers=Dict.make()) => { ("Content-Type", "application/json"), ("X-Client-Version", Window.version), ("X-Payment-Confirm-Source", "sdk"), - ("X-Browser-Name", OrcaLogger.arrayOfNameAndVersion->Array.get(0)->Option.getOr("Others")), - ("X-Browser-Version", OrcaLogger.arrayOfNameAndVersion->Array.get(1)->Option.getOr("0")), + ("X-Browser-Name", HyperLogger.arrayOfNameAndVersion->Array.get(0)->Option.getOr("Others")), + ("X-Browser-Version", HyperLogger.arrayOfNameAndVersion->Array.get(1)->Option.getOr("0")), ("X-Client-Platform", "web"), ]->Dict.fromArray diff --git a/src/orca-loader/Elements.res b/src/hyper-loader/Elements.res similarity index 99% rename from src/orca-loader/Elements.res rename to src/hyper-loader/Elements.res index 681994ed2..ff44fb7fc 100644 --- a/src/orca-loader/Elements.res +++ b/src/hyper-loader/Elements.res @@ -17,13 +17,13 @@ let make = ( ~clientSecret, ~sdkSessionId, ~publishableKey, - ~logger: option, + ~logger: option, ~analyticsMetadata, ~customBackendUrl, ) => { try { let iframeRef = [] - let logger = logger->Option.getOr(OrcaLogger.defaultLoggerConfig) + let logger = logger->Option.getOr(HyperLogger.defaultLoggerConfig) let savedPaymentElement = Dict.make() let localOptions = options->JSON.Decode.object->Option.getOr(Dict.make()) diff --git a/src/orca-loader/Hyper.res b/src/hyper-loader/Hyper.res similarity index 99% rename from src/orca-loader/Hyper.res rename to src/hyper-loader/Hyper.res index eb3d6e29e..347f05276 100644 --- a/src/orca-loader/Hyper.res +++ b/src/hyper-loader/Hyper.res @@ -86,7 +86,7 @@ let handleHyperApplePayMounted = (event: Types.event) => { let sdkSessionId = dict->getString("sdkSessionId", "") let analyticsMetadata = dict->getJsonFromDict("analyticsMetadata", JSON.Encode.null) - let logger = OrcaLogger.make( + let logger = HyperLogger.make( ~sessionId=sdkSessionId, ~source=Loader, ~merchantId=publishableKey, @@ -155,7 +155,7 @@ let make = (publishableKey, options: option, analyticsInfo: optiongetString("sessionID", "hyp_" ++ Utils.generateRandomString(8)) let sdkTimestamp = analyticsInfoDict->getString("timeStamp", Date.now()->Float.toString) - let logger = OrcaLogger.make( + let logger = HyperLogger.make( ~sessionId=sessionID, ~source=Loader, ~merchantId=publishableKey, diff --git a/src/orca-loader/HyperLoader.res b/src/hyper-loader/HyperLoader.res similarity index 78% rename from src/orca-loader/HyperLoader.res rename to src/hyper-loader/HyperLoader.res index 1e3ba9e77..885933ad2 100644 --- a/src/orca-loader/HyperLoader.res +++ b/src/hyper-loader/HyperLoader.res @@ -3,7 +3,7 @@ let loadHyper = (str, option) => { } let loadStripe = (str, option) => { - ErrorUtils.manageErrorWarning(DEPRECATED_LOADSTRIPE, ~logger=OrcaLogger.defaultLoggerConfig) + ErrorUtils.manageErrorWarning(DEPRECATED_LOADSTRIPE, ~logger=HyperLogger.defaultLoggerConfig) loadHyper(str, option) } diff --git a/src/orca-loader/LoaderPaymentElement.res b/src/hyper-loader/LoaderPaymentElement.res similarity index 100% rename from src/orca-loader/LoaderPaymentElement.res rename to src/hyper-loader/LoaderPaymentElement.res diff --git a/src/orca-loader/PaymentMethodsManagementElements.res b/src/hyper-loader/PaymentMethodsManagementElements.res similarity index 98% rename from src/orca-loader/PaymentMethodsManagementElements.res rename to src/hyper-loader/PaymentMethodsManagementElements.res index e6403f975..5b9a0ea11 100644 --- a/src/orca-loader/PaymentMethodsManagementElements.res +++ b/src/hyper-loader/PaymentMethodsManagementElements.res @@ -9,14 +9,14 @@ let make = ( ~ephemeralKey, ~sdkSessionId, ~publishableKey, - ~logger: option, + ~logger: option, ~analyticsMetadata, ~customBackendUrl, ) => { let hyperComponentName = PaymentMethodsManagementElements try { let iframeRef = [] - let logger = logger->Option.getOr(OrcaLogger.defaultLoggerConfig) + let logger = logger->Option.getOr(HyperLogger.defaultLoggerConfig) let savedPaymentElement = Dict.make() let localOptions = options->JSON.Decode.object->Option.getOr(Dict.make()) diff --git a/src/orca-loader/PaymentSession.res b/src/hyper-loader/PaymentSession.res similarity index 87% rename from src/orca-loader/PaymentSession.res rename to src/hyper-loader/PaymentSession.res index 751ebc0bb..78107c024 100644 --- a/src/orca-loader/PaymentSession.res +++ b/src/hyper-loader/PaymentSession.res @@ -4,10 +4,10 @@ let make = ( options, ~clientSecret, ~publishableKey, - ~logger: option, + ~logger: option, ~ephemeralKey, ) => { - let logger = logger->Option.getOr(OrcaLogger.defaultLoggerConfig) + let logger = logger->Option.getOr(HyperLogger.defaultLoggerConfig) let customPodUri = options ->JSON.Decode.object diff --git a/src/orca-loader/PaymentSessionMethods.res b/src/hyper-loader/PaymentSessionMethods.res similarity index 100% rename from src/orca-loader/PaymentSessionMethods.res rename to src/hyper-loader/PaymentSessionMethods.res diff --git a/src/orca-loader/Types.res b/src/hyper-loader/Types.res similarity index 100% rename from src/orca-loader/Types.res rename to src/hyper-loader/Types.res diff --git a/src/orca-log-catcher/ErrorBoundary.res b/src/hyper-log-catcher/ErrorBoundary.res similarity index 95% rename from src/orca-log-catcher/ErrorBoundary.res rename to src/hyper-log-catcher/ErrorBoundary.res index 4f95da757..c2ea81446 100644 --- a/src/orca-log-catcher/ErrorBoundary.res +++ b/src/hyper-log-catcher/ErrorBoundary.res @@ -126,7 +126,7 @@ module ErrorCard = { let make = (~error: Sentry.ErrorBoundary.fallbackArg, ~level, ~componentName) => { let beaconApiCall = data => { if data->Array.length > 0 { - let logData = data->Array.map(OrcaLogger.logFileToObj)->JSON.Encode.array->JSON.stringify + let logData = data->Array.map(HyperLogger.logFileToObj)->JSON.Encode.array->JSON.stringify Window.Navigator.sendBeacon(GlobalVars.logEndpoint, logData) } } @@ -142,7 +142,7 @@ module ErrorCard = { errorDict->Dict.set("componentName", componentName->JSON.Encode.string) - let errorLog: OrcaLogger.logFile = { + let errorLog: HyperLogger.logFile = { logType: ERROR, timestamp: Date.now()->Float.toString, sessionId: "", @@ -153,8 +153,8 @@ module ErrorCard = { category: USER_ERROR, paymentId: "", merchantId: "", - browserName: OrcaLogger.arrayOfNameAndVersion->Array.get(0)->Option.getOr("Others"), - browserVersion: OrcaLogger.arrayOfNameAndVersion->Array.get(1)->Option.getOr("0"), + browserName: HyperLogger.arrayOfNameAndVersion->Array.get(0)->Option.getOr("Others"), + browserVersion: HyperLogger.arrayOfNameAndVersion->Array.get(1)->Option.getOr("0"), platform: Window.Navigator.platform, userAgent: Window.Navigator.userAgent, appId: "", diff --git a/src/orca-log-catcher/OrcaLogger.res b/src/hyper-log-catcher/HyperLogger.res similarity index 99% rename from src/orca-log-catcher/OrcaLogger.res rename to src/hyper-log-catcher/HyperLogger.res index 707073429..715ed5609 100644 --- a/src/orca-log-catcher/OrcaLogger.res +++ b/src/hyper-log-catcher/HyperLogger.res @@ -239,7 +239,7 @@ let logFileToObj = logFile => { }->JSON.Encode.string, ), ("source", logFile.source->convertToScreamingSnakeCase->JSON.Encode.string), - ("version", logFile.version->JSON.Encode.string), // repoversion of orca-android + ("version", logFile.version->JSON.Encode.string), ("value", logFile.value->JSON.Encode.string), ("internal_metadata", logFile.internalMetadata->JSON.Encode.string), ("session_id", logFile.sessionId->JSON.Encode.string), diff --git a/src/orca-log-catcher/ReusableReactSuspense.res b/src/hyper-log-catcher/ReusableReactSuspense.res similarity index 100% rename from src/orca-log-catcher/ReusableReactSuspense.res rename to src/hyper-log-catcher/ReusableReactSuspense.res diff --git a/src/orca-log-catcher/Sentry.res b/src/hyper-log-catcher/Sentry.res similarity index 100% rename from src/orca-log-catcher/Sentry.res rename to src/hyper-log-catcher/Sentry.res diff --git a/src/libraries/Recoil.res b/src/libraries/Recoil.res index 0c23c1668..20d0c6b1c 100644 --- a/src/libraries/Recoil.res +++ b/src/libraries/Recoil.res @@ -20,7 +20,7 @@ external useSetRecoilState: recoilAtom<'valueT> => ('valueT => 'valueT) => unit @module("recoil") external useRecoilValueFromAtom: recoilAtom<'valueT> => 'valueT = "useRecoilValue" -let useLoggedRecoilState = (atomName, type_, logger: OrcaLogger.loggerMake) => { +let useLoggedRecoilState = (atomName, type_, logger: HyperLogger.loggerMake) => { let (state, setState) = useRecoilState(atomName) let newSetState = value => { LoggerUtils.logInputChangeInfo(type_, logger) @@ -29,7 +29,7 @@ let useLoggedRecoilState = (atomName, type_, logger: OrcaLogger.loggerMake) => { (state, newSetState) } -let useLoggedSetRecoilState = (atomName, type_, logger: OrcaLogger.loggerMake) => { +let useLoggedSetRecoilState = (atomName, type_, logger: HyperLogger.loggerMake) => { let setState = useSetRecoilState(atomName) let newSetState = value => { LoggerUtils.logInputChangeInfo(type_, logger) diff --git a/webpack.common.js b/webpack.common.js index 4357ab075..c3cea6c8f 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -67,7 +67,7 @@ const maxLogsPushedPerEventName = 100; module.exports = (publicPath = "auto") => { const entries = { app: "./index.js", - HyperLoader: "./src/orca-loader/HyperLoader.bs.js", + HyperLoader: "./src/hyper-loader/HyperLoader.bs.js", }; const plugins = [ new MiniCssExtractPlugin(),