From ad2ffb9df736e6617a6ebfd3fb6e7cd1803458af Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Wed, 24 Jan 2024 17:08:25 +0530 Subject: [PATCH 01/28] fix: content type fix (#302) --- src/hooks/AuthHooks.res | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/AuthHooks.res b/src/hooks/AuthHooks.res index fce80749f..57792db24 100644 --- a/src/hooks/AuthHooks.res +++ b/src/hooks/AuthHooks.res @@ -24,6 +24,7 @@ let getHeaders = (~uri, ~headers, ()) => { | Some(token) => { headers->Dict.set("authorization", `Bearer ${token}`) headers->Dict.set("api-key", `hyperswitch`) + headers->Dict.set("Content-Type", `application/json`) headers } From 17efd52ad93f9b4350b68931d2dd43bf8dadb841 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Wed, 24 Jan 2024 17:41:17 +0530 Subject: [PATCH 02/28] feat: added webhooks events (#272) Co-authored-by: Pritish Budhiraja <1805317@kiit.ac.in> --- public/hyperswitch/icons/solid.svg | 15 + src/screens/HyperSwitch/APIUtils/APIUtils.res | 10 + .../HyperSwitch/APIUtils/APIUtilsTypes.res | 2 + .../HyperSwitch/PaymentLogs/PaymentLogs.res | 575 +++++++++++------- .../PaymentLogs/PaymentLogsTypes.res | 11 + ...{PaymentUtils.res => PaymentLogsUtils.res} | 17 + src/utils/LogicUtils.res | 6 +- tailwindHyperSwitch.config.js | 1 + 8 files changed, 412 insertions(+), 225 deletions(-) create mode 100644 src/screens/HyperSwitch/PaymentLogs/PaymentLogsTypes.res rename src/screens/HyperSwitch/PaymentLogs/{PaymentUtils.res => PaymentLogsUtils.res} (57%) diff --git a/public/hyperswitch/icons/solid.svg b/public/hyperswitch/icons/solid.svg index b2467c422..640d696dc 100644 --- a/public/hyperswitch/icons/solid.svg +++ b/public/hyperswitch/icons/solid.svg @@ -1402,6 +1402,21 @@ License) d="M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z" > + + + + + + + + + + + + + + + "" } + | WEBHOOKS_EVENT_LOGS => + switch id { + | Some(payment_id) => `analytics/v1/outgoing_webhook_event_logs?payment_id=${payment_id}` + | None => "" + } + | CONNECTOR_EVENT_LOGS => + switch id { + | Some(payment_id) => `analytics/v1/connector_event_logs?type=Payment&payment_id=${payment_id}` + | None => "" + } | USERS => let userUrl = `user` switch userType { diff --git a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res index d0b8eddef..46056dfbf 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res @@ -17,6 +17,8 @@ type entityName = | ANALYTICS_SYSTEM_METRICS | PAYMENT_LOGS | SDK_EVENT_LOGS + | WEBHOOKS_EVENT_LOGS + | CONNECTOR_EVENT_LOGS | GENERATE_SAMPLE_DATA | USERS | RECON diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index f7644cf63..55a3d89e7 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -1,8 +1,20 @@ -open OrderUtils -open APIUtils -open LogicUtils @module("js-sha256") external sha256: string => string = "sha256" + +open PaymentLogsTypes +let getLogType = dict => { + if dict->Dict.get("connector_name")->Option.isSome { + CONNECTOR + } else if dict->Dict.get("request_id")->Option.isSome { + PAYMENTS + } else if dict->Dict.get("component")->Option.isSome { + SDK + } else { + WEBHOOKS + } +} + module PrettyPrintJson = { + open LogicUtils @react.component let make = ( ~jsonToDisplay, @@ -13,7 +25,6 @@ module PrettyPrintJson = { let showToast = ToastState.useShowToast() let (isTextVisible, setIsTextVisible) = React.useState(_ => false) let (parsedJson, setParsedJson) = React.useState(_ => "") - let parseJsonValue = () => { try { let parsedValue = jsonToDisplay->Js.Json.parseExn->Js.Json.stringifyWithSpace(3) @@ -34,11 +45,11 @@ module PrettyPrintJson = { let copyParsedJson =
handleOnClickCopy(~parsedValue=parsedJson)} className="cursor-pointer"> - +
-
- String.length > 0}> +
+ isNonEmptyString}> {<> Option.isSome}>
@@ -50,12 +61,9 @@ module PrettyPrintJson = {
+              className={`${overrideBackgroundColor} p-3 text-jp-gray-900 dark:bg-jp-gray-950 dark:bg-opacity-100 text-fs-13 text font-medium`}>
               {parsedJson->React.string}
             
- {copyParsedJson}
diff --git a/src/components/RemoteFilter.res b/src/components/RemoteFilter.res index 5bb81d18b..7bce6fb6e 100644 --- a/src/components/RemoteFilter.res +++ b/src/components/RemoteFilter.res @@ -1,10 +1,5 @@ let makeFieldInfo = FormRenderer.makeFieldInfo -@val @scope(("window", "location")) -external reload: unit => unit = "reload" -@val @scope(("window", "location")) -external replace: string => unit = "replace" - module ClearForm = { @react.component let make = () => { @@ -835,7 +830,7 @@ let make = ( let urlValue = `${path}?${newQueryStr}` setClearFilterAfterRefresh(_ => true) setInitialValueJson(_ => Dict.make()->Js.Json.object_) - replace(urlValue) + Window.Location.replace(urlValue) } let refreshFilterUi = { diff --git a/src/components/SelectBox.res b/src/components/SelectBox.res index 73bf8e53b..77b6325a9 100644 --- a/src/components/SelectBox.res +++ b/src/components/SelectBox.res @@ -4,9 +4,6 @@ external toDict: 'a => Dict.t<'t> = "%identity" @send external getClientRects: Dom.element => Dom.domRect = "getClientRects" @send external focus: Dom.element => unit = "focus" -@val @scope("window") external windowInnerHeight: int = "innerHeight" -@val @scope("window") external windowInnerWidth: int = "innerWidth" - external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array, > = "%identity" @@ -1624,9 +1621,9 @@ module BaseDropdown = { ->Js.Nullable.toOption ->Option.flatMap(elem => elem->getClientRects->toDict->Dict.get("0")) ->Option.flatMap(firstEl => { - let bottomVacent = windowInnerHeight - firstEl["bottom"]->Belt.Float.toInt > 375 + let bottomVacent = Window.innerHeight - firstEl["bottom"]->Belt.Float.toInt > 375 let topVacent = firstEl["top"]->Belt.Float.toInt > 470 - let rightVacent = windowInnerWidth - firstEl["left"]->Belt.Float.toInt > 270 + let rightVacent = Window.innerWidth - firstEl["left"]->Belt.Float.toInt > 270 let leftVacent = firstEl["right"]->Belt.Float.toInt > 270 if bottomVacent { diff --git a/src/components/SelectBox.resi b/src/components/SelectBox.resi index 6cd2a5f7f..69661c26e 100644 --- a/src/components/SelectBox.resi +++ b/src/components/SelectBox.resi @@ -1,16 +1,54 @@ type retType = CheckBox(array) | Radiobox(string) -external toDict: 'a => Dict.t<'t> = "%identity" +external toDict: 'a => RescriptCore.Dict.t<'t> = "%identity" @send external getClientRects: Dom.element => Dom.domRect = "getClientRects" @send external focus: Dom.element => unit = "focus" -@val @scope("window") external windowInnerHeight: int = "innerHeight" -@val @scope("window") external windowInnerWidth: int = "innerWidth" external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array, > = "%identity" external ffInputToRadioInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< string, > = "%identity" - +let regex: (string, string) => Js.Re.t +module ListItem: { + @react.component + let make: ( + ~isDropDown: bool, + ~searchString: string, + ~multiSelect: bool, + ~optionSize: CheckBoxIcon.size=?, + ~isSelectedStateMinus: bool=?, + ~isSelected: bool, + ~isPrevSelected: bool=?, + ~isNextSelected: bool=?, + ~onClick: JsxEvent.Mouse.t => unit, + ~text: Js.String2.t, + ~fill: string=?, + ~labelValue: Js.String2.t=?, + ~isDisabled: bool=?, + ~icon: Button.iconType, + ~leftVacennt: bool=?, + ~showToggle: bool=?, + ~customStyle: string=?, + ~serialNumber: option=?, + ~isMobileView: bool=?, + ~description: option=?, + ~customLabelStyle: option=?, + ~customMarginStyle: string=?, + ~listFlexDirection: string=?, + ~customSelectStyle: string=?, + ~textOverflowClass: string=?, + ~dataId: int, + ~showDescriptionAsTool: bool=?, + ~optionClass: string=?, + ~selectClass: string=?, + ~toggleProps: string=?, + ~checkboxDimension: string=?, + ~iconStroke: string=?, + ~showToolTipOptions: bool=?, + ~textEllipsisForDropDownOptions: bool=?, + ~textColorClass: string=?, + ) => React.element +} type dropdownOptionWithoutOptional = { label: string, value: string, @@ -31,7 +69,8 @@ type dropdownOption = { iconStroke?: string, textColor?: string, } -let useTransformed: Js.Array2.t => Js.Array2.t +let makeNonOptional: dropdownOption => dropdownOptionWithoutOptional +let useTransformed: array => array type allSelectType = Icon | Text type opt = {name_: string} let makeOptions: array => array @@ -56,12 +95,12 @@ module BaseSelect: { ~showSerialNumber: bool=?, ~heading: string=?, ~showSelectionAsChips: bool=?, - ~maxHeight: Js.String2.t=?, + ~maxHeight: string=?, ~searchable: bool=?, ~optionRigthElement: React.element=?, ~searchInputPlaceHolder: string=?, ~showSearchIcon: bool=?, - ~customStyle: Js.String2.t=?, + ~customStyle: string=?, ~customMargin: string=?, ~disableSelect: bool=?, ~deselectDisable: bool=?, @@ -88,10 +127,61 @@ module BaseSelect: { ~dropdownClassName: string=?, ~onItemSelect: (JsxEvent.Mouse.t, Js_string.t) => unit=?, ~wrapBasis: string=?, - ~preservedAppliedOptions: Js.Array2.t=?, + ~preservedAppliedOptions: array=?, ) => React.element } - +module BaseSelectButton: { + @react.component + let make: ( + ~showDropDown: bool=?, + ~isDropDown: bool=?, + ~isHorizontal: bool=?, + ~options: array, + ~optionSize: CheckBoxIcon.size=?, + ~isSelectedStateMinus: bool=?, + ~onSelect: string => unit, + ~value: Js.Json.t, + ~deselectDisable: bool=?, + ~onBlur: ReactEvent.Focus.t => unit=?, + ~setShowDropDown: ('a => bool) => unit=?, + ~onAssignClick: string => unit=?, + ~customSearchStyle: string, + ~disableSelect: bool=?, + ~isMobileView: bool=?, + ~hideAssignBtn: bool=?, + ~searchInputPlaceHolder: string=?, + ~showSearchIcon: bool=?, + ~allowButtonTextMinWidth: bool=?, + ) => React.element +} +module RenderListItemInBaseRadio: { + @react.component + let make: ( + ~newOptions: Js.Array2.t, + ~value: Js.Json.t, + ~descriptionOnHover: bool, + ~isDropDown: bool, + ~textIconPresent: bool, + ~searchString: string, + ~optionSize: CheckBoxIcon.size, + ~isSelectedStateMinus: bool, + ~onItemClick: (string, bool, JsxEvent.Mouse.t) => unit, + ~fill: string, + ~customStyle: string, + ~isMobileView: bool, + ~listFlexDirection: string, + ~customSelectStyle: string, + ~textOverflowClass: option, + ~showToolTipOptions: bool, + ~textEllipsisForDropDownOptions: bool, + ~isHorizontal: bool, + ~customMarginStyleOfListItem: string=?, + ) => React.element +} +let getHashMappedOptionValues: array => RescriptCore.Dict.t< + array, +> +let getSortedKeys: RescriptCore.Dict.t<'a> => Js.Array2.t module BaseRadio: { @react.component let make: ( @@ -106,13 +196,13 @@ module BaseRadio: { ~deselectDisable: bool=?, ~onBlur: ReactEvent.Focus.t => unit=?, ~fill: string=?, - ~customStyle: Js.String2.t=?, + ~customStyle: string=?, ~searchable: bool=?, ~isMobileView: bool=?, ~customSearchStyle: string=?, ~descriptionOnHover: bool=?, ~addDynamicValue: bool=?, - ~dropdownCustomWidth: Js.String2.t=?, + ~dropdownCustomWidth: string=?, ~dropdownRef: React.ref>=?, ~showMatchingRecordsText: bool=?, ~fullLength: bool=?, @@ -130,12 +220,11 @@ module BaseRadio: { ~textEllipsisForDropDownOptions: bool=?, ) => React.element } - type direction = BottomLeft | BottomMiddle | BottomRight | TopLeft | TopMiddle | TopRight module BaseDropdown: { @react.component let make: ( - ~buttonText: Js.String2.t, + ~buttonText: string, ~buttonSize: Button.buttonSize=?, ~allowMultiSelect: bool, ~input: ReactFinalForm.fieldRenderPropsInput, @@ -155,12 +244,12 @@ module BaseDropdown: { ~defaultLeftIcon: Button.iconType=?, ~autoApply: bool=?, ~fullLength: bool=?, - ~customButtonStyle: Js.String2.t=?, + ~customButtonStyle: string=?, ~onAssignClick: string => unit=?, ~fixedDropDownDirection: direction=?, ~addButton: bool=?, ~marginTop: string=?, - ~customStyle: Js.String2.t=?, + ~customStyle: string=?, ~customSearchStyle: string=?, ~showSelectionAsChips: bool=?, ~showToolTip: bool=?, @@ -174,16 +263,16 @@ module BaseDropdown: { ~addDynamicValue: bool=?, ~showMatchingRecordsText: bool=?, ~hasApplyButton: bool=?, - ~dropdownCustomWidth: Js.String2.t=?, + ~dropdownCustomWidth: string=?, ~allowButtonTextMinWidth: bool=?, ~customMarginStyle: string=?, ~customButtonLeftIcon: Button.iconType=?, ~customTextPaddingClass: string=?, ~customButtonPaddingClass: string=?, ~customButtonIconMargin: string=?, - ~textStyleClass: Js.String2.t=?, + ~textStyleClass: string=?, ~buttonStyleOnDropDownOpened: string=?, - ~selectedString: Js.String2.t=?, + ~selectedString: string=?, ~setSelectedString: ('a => Js_string.t) => unit=?, ~setExtSearchString: ('b => string) => unit=?, ~listFlexDirection: string=?, @@ -193,7 +282,7 @@ module BaseDropdown: { ~showAllSelectedOptions: bool=?, ~buttonClickFn: string => unit=?, ~showSelectCountButton: bool=?, - ~maxHeight: Js.String2.t=?, + ~maxHeight: string=?, ~customBackColor: string=?, ~showToolTipOptions: bool=?, ~textEllipsisForDropDownOptions: bool=?, @@ -231,7 +320,7 @@ module ChipFilterSelectBox: { @react.component let make: ( ~input: ReactFinalForm.fieldRenderPropsInput, - ~buttonText: Js.String2.t=?, + ~buttonText: string=?, ~buttonSize: Button.buttonSize=?, ~allowMultiSelect: bool=?, ~isDropDown: bool=?, @@ -246,13 +335,13 @@ let make: ( ~buttonType: Button.buttonType=?, ~disableSelect: bool=?, ~fullLength: bool=?, - ~customButtonStyle: Js.String2.t=?, + ~customButtonStyle: string=?, ~textStyle: string=?, ~marginTop: string=?, - ~customStyle: Js.String2.t=?, + ~customStyle: string=?, ~showSelectionAsChips: bool=?, ~showToggle: bool=?, - ~maxHeight: Js.String2.t=?, + ~maxHeight: string=?, ~searchable: bool=?, ~fill: string=?, ~optionRigthElement: React.element=?, @@ -273,7 +362,7 @@ let make: ( ~customButton: React.element=?, ~descriptionOnHover: bool=?, ~fixedDropDownDirection: direction=?, - ~dropdownCustomWidth: Js.String2.t=?, + ~dropdownCustomWidth: string=?, ~allowButtonTextMinWidth: bool=?, ~baseComponent: React.element=?, ~baseComponentMethod: bool => React.element=?, @@ -283,7 +372,7 @@ let make: ( ~customTextPaddingClass: string=?, ~customButtonPaddingClass: string=?, ~customButtonIconMargin: string=?, - ~textStyleClass: Js.String2.t=?, + ~textStyleClass: string=?, ~setExtSearchString: ('a => string) => unit=?, ~buttonStyleOnDropDownOpened: string=?, ~listFlexDirection: string=?, diff --git a/src/components/form/FormValuesSpy.res b/src/components/form/FormValuesSpy.res index 444e8f9da..85de63832 100644 --- a/src/components/form/FormValuesSpy.res +++ b/src/components/form/FormValuesSpy.res @@ -8,14 +8,12 @@ module JsonBox = { } } -@val @scope(("window", "location")) external hostname: string = "hostname" - @react.component let make = (~wrapperClass="", ~jsonModifier=?, ~restrictToLocal=true, ~displayProps=true) => { let subs = ReactFinalForm.useFormSubscription(["values"]) let canRender = if restrictToLocal { - hostname === "localhost" + Window.Location.hostname === "localhost" } else { true } diff --git a/src/context/ThemeProvider.res b/src/context/ThemeProvider.res index b323109a3..b363a8436 100644 --- a/src/context/ThemeProvider.res +++ b/src/context/ThemeProvider.res @@ -17,9 +17,6 @@ let useTheme = () => { theme } -@val external window: Js.Nullable.t<'a> = "window" -@val @scope("window") external parent: 't = "parent" - @react.component let make = (~children) => { let eventTheme = ThemeUtils.useThemeFromEvent() @@ -33,7 +30,7 @@ let make = (~children) => { | Some("Dark") => Dark | Some(_val) => Light | None => - if window !== parent { + if window !== Window.parent { Light } else { themeState diff --git a/src/entities/analytics/EulerAnalyticsLogUtils.res b/src/entities/analytics/EulerAnalyticsLogUtils.res index 4f461155f..46f06f4e8 100644 --- a/src/entities/analytics/EulerAnalyticsLogUtils.res +++ b/src/entities/analytics/EulerAnalyticsLogUtils.res @@ -1,5 +1,3 @@ -@val @scope("window") -external location: {..} = "location" external toJson: exn => Js.Json.t = "%identity" external toExn: string => exn = "%identity" diff --git a/src/genericUtils/DOMUtils.res b/src/genericUtils/DOMUtils.res index 40fe6011a..55785e388 100644 --- a/src/genericUtils/DOMUtils.res +++ b/src/genericUtils/DOMUtils.res @@ -6,13 +6,11 @@ type window @val external window: window = "window" @send external click: (Dom.element, unit) => unit = "click" @send external reset: (Dom.element, unit) => unit = "reset" -@val @scope("window") external parent: window = "parent" type event @new external event: string => event = "Event" @send external dispatchEvent: ('a, event) => unit = "dispatchEvent" @send external postMessage: (window, Js.Json.t, string) => unit = "postMessage" -@val @scope(("window", "location")) external windowOrigin: string = "origin" @get external keyCode: 'a => int = "keyCode" @send external querySelectorAll: (document, string) => array = "querySelectorAll" @send external setAttribute: (Dom.element, string, string) => unit = "setAttribute" diff --git a/src/hooks/AuthHooks.res b/src/hooks/AuthHooks.res index 57792db24..222c63966 100644 --- a/src/hooks/AuthHooks.res +++ b/src/hooks/AuthHooks.res @@ -35,9 +35,6 @@ let getHeaders = (~uri, ~headers, ()) => { Fetch.HeadersInit.make(headerObj->dictToObj) } -@val @scope(("window", "location")) -external hostName: string = "host" - type betaEndpoint = { betaApiStr: string, originalApiStr: string, diff --git a/src/libraries/Clipboard.res b/src/libraries/Clipboard.res index ecb036917..b763cbfee 100644 --- a/src/libraries/Clipboard.res +++ b/src/libraries/Clipboard.res @@ -15,12 +15,9 @@ external prepend: 'a => unit = "prepend" @val @scope("document") external execCommand: string => unit = "execCommand" -@val @scope("window") -external isSecureContext: bool = "isSecureContext" - let writeText = (str: string) => { try { - if isSecureContext { + if Window.isSecureContext { writeTextDoc(str) } else { let textArea = document->DOMUtils.createElement("textarea") diff --git a/src/libraries/Window.res b/src/libraries/Window.res index 08254a5bd..f1cc7d9b2 100644 --- a/src/libraries/Window.res +++ b/src/libraries/Window.res @@ -2,6 +2,9 @@ type t type listener<'ev> = 'ev => unit +@val @scope("window") +external parent: 't = "parent" + @val @scope("window") external addEventListener: (string, listener<'ev>) => unit = "addEventListener" @@ -80,6 +83,9 @@ external getParsedJson: string => Js.Json.t = "getParsedJson" @val @scope("window") external payPalCreateAccountWindow: unit => unit = "payPalCreateAccountWindow" +@val @scope("window") +external isSecureContext: bool = "isSecureContext" + module MatchMedia = { type matchEvent = { matches: bool, diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index 140ca923e..d3c37f015 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -1,7 +1,4 @@ @get external keyCode: 'a => int = "keyCode" -type window -@val external window: window = "window" -@scope("window") @val external parent: window = "parent" open LogicUtils diff --git a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res index 31550c323..633600c47 100644 --- a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res @@ -1,5 +1,3 @@ -@val @scope(("window", "location")) external hostname: string = "hostname" - let filterFieldsPortalName = "analytics" let setPrecision = (num, ~digit=2, ()) => { diff --git a/src/screens/HyperSwitch/SDKPayment/WebSDK.res b/src/screens/HyperSwitch/SDKPayment/WebSDK.res index 1a40ef235..c9c4c0c3e 100644 --- a/src/screens/HyperSwitch/SDKPayment/WebSDK.res +++ b/src/screens/HyperSwitch/SDKPayment/WebSDK.res @@ -2,9 +2,6 @@ open HyperSwitch open HyperSwitchTypes open Promise -@val external window: 'a = "window" -@val @scope("window") external parent: 'a = "parent" - type configElements = { appearanceElement: Js.Json.t, paymentElement: Js.Json.t, diff --git a/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res b/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res index d1f2efd82..49c74a73f 100644 --- a/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res +++ b/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res @@ -1,6 +1,3 @@ -@val @scope(("window", "location")) -external reload: unit => unit = "reload" - type status = COMPLETED | ONGOING | PENDING type subOption = { From f617d873e48e809373e2882e92557b0adb726695 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:34:30 +0000 Subject: [PATCH 05/28] chore(version): v1.29.0 --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 227656b1c..859a593ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.29.0 (2024-01-24) + +### Features + +- Added webhooks events ([#272](https://github.com/juspay/hyperswitch-control-center/pull/272)) ([`17efd52`](https://github.com/juspay/hyperswitch-control-center/commit/17efd52ad93f9b4350b68931d2dd43bf8dadb841)) +- Syntax highlighter ([#300](https://github.com/juspay/hyperswitch-control-center/pull/300)) ([`d4b800f`](https://github.com/juspay/hyperswitch-control-center/commit/d4b800f32927a6e28a991e574cf312124add26bc)) + +### Bug Fixes + +- Headers issue ([#295](https://github.com/juspay/hyperswitch-control-center/pull/295)) ([`91f98c4`](https://github.com/juspay/hyperswitch-control-center/commit/91f98c4aedb7b744043e63405ed9189b14103fb9)) +- Quick start default selection issue ([#287](https://github.com/juspay/hyperswitch-control-center/pull/287)) ([`0ce1d05`](https://github.com/juspay/hyperswitch-control-center/commit/0ce1d055066453338b98b725fef5dcb5c8a402b6)) +- Content type fix ([#302](https://github.com/juspay/hyperswitch-control-center/pull/302)) ([`ad2ffb9`](https://github.com/juspay/hyperswitch-control-center/commit/ad2ffb9df736e6617a6ebfd3fb6e7cd1803458af)) + +### Miscellaneous Tasks + +- Utils refactor ([#282](https://github.com/juspay/hyperswitch-control-center/pull/282)) ([`40954d2`](https://github.com/juspay/hyperswitch-control-center/commit/40954d25e225520d41bd2585f2b0fbfc4d9ee965)) +- Remove redundant code ([#298](https://github.com/juspay/hyperswitch-control-center/pull/298)) ([`d047ae7`](https://github.com/juspay/hyperswitch-control-center/commit/d047ae7905b3df6fc19679519ed29ad17c164e29)) + +**Full Changelog:** [`v1.28.1...v1.29.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.28.1...v1.29.0) + +- - - + + ## 1.28.1 (2024-01-23) ### Bug Fixes From 7006d915dec69b2db96cf36a5399accd86f173c2 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Thu, 25 Jan 2024 11:51:59 +0530 Subject: [PATCH 06/28] fix: close connector drop down bydefault (#303) --- src/screens/HyperSwitch/Connectors/ConnectorPreview.res | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index 5ba240082..8996ec04b 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -72,12 +72,14 @@ module MenuOption = { { + panelProps["close"]() setCurrentStep(_ => updateStepValue) }} /> { + panelProps["close"]() openConfirmationPopUp() }} /> From 1466e6adf9dac3d746c5105b5ccfb9b1a51f9c4c Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran <120017870+JeevaRamu0104@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:34:10 +0530 Subject: [PATCH 07/28] chore: change tag creation (#297) --- .github/git-cliff-changelog.toml | 7 +- .github/workflows/pr-label.yml | 5 +- .../workflows/release-new-nightly-version.yml | 30 ++++ .github/workflows/release-stable-version.yml | 154 ++++++++++++++++++ 4 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release-new-nightly-version.yml create mode 100644 .github/workflows/release-stable-version.yml diff --git a/.github/git-cliff-changelog.toml b/.github/git-cliff-changelog.toml index a82c637d8..5ba3af252 100644 --- a/.github/git-cliff-changelog.toml +++ b/.github/git-cliff-changelog.toml @@ -14,7 +14,7 @@ body = """ {% set commit_base_url = "https://github.com/juspay/hyperswitch-control-center/commit/" -%} {% set compare_base_url = "https://github.com/juspay/hyperswitch-control-center/compare/" -%} {% if version -%} - ## {{ version | trim_start_matches(pat="v") }} ({{ timestamp | date(format="%Y-%m-%d") }}) + ## {{ version }} {% else -%} ## [unreleased] {% endif -%} @@ -69,7 +69,8 @@ commit_parsers = [ { message = "^(?i)(refactor)", group = "Refactors" }, { message = "^(?i)(test)", group = "Testing" }, { message = "^(?i)(docs)", group = "Documentation" }, - { message = "^(?i)(chore\\(version\\)): V[\\d]+\\.[\\d]+\\.[\\d]+", skip = true }, + { message = "^(?i)(chore\\(version\\)): (V|v)[\\d]+\\.[\\d]+\\.[\\d]+", skip = true }, + { message = "^(?i)(chore\\(version\\)): [0-9]{4}\\.[0-9]{2}\\.[0-9]{2}(\\.[0-9]+)?(-.+)?", skip = true }, { message = "^(?i)(chore)", group = "Miscellaneous Tasks" }, { message = "^(?i)(build)", group = "Build System / Dependencies" }, { message = "^(?i)(ci)", skip = true }, @@ -79,7 +80,7 @@ protect_breaking_commits = false # filter out the commits that are not matched by commit parsers filter_commits = false # glob pattern for matching git tags -tag_pattern = "v[0-9]*" +tag_pattern = "[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}(\\.[0-9]+)?(-.+)?" # regex for skipping tags # skip_tags = "v0.1.0-beta.1" # regex for ignoring tags diff --git a/.github/workflows/pr-label.yml b/.github/workflows/pr-label.yml index a3fc40d5c..2f127e5bd 100644 --- a/.github/workflows/pr-label.yml +++ b/.github/workflows/pr-label.yml @@ -26,7 +26,7 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER" \ | jq -r '.labels | map(.name) | join(" ")') - + echo $EXISTING_LABELS # Remove existing labels @@ -41,6 +41,3 @@ jobs: run: | export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} gh pr edit ${{ github.event.pull_request.number }} --add-label "closed" - - - diff --git a/.github/workflows/release-new-nightly-version.yml b/.github/workflows/release-new-nightly-version.yml new file mode 100644 index 000000000..75a7cb760 --- /dev/null +++ b/.github/workflows/release-new-nightly-version.yml @@ -0,0 +1,30 @@ +name: Release a new nightly hyperswitch control center version + +on: + schedule: + - cron: "30 14 * * 0-4" # Run workflow at 8 PM IST every Sunday-Thursday + + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# on: +# pull_request_target: +# types: +# - closed + +env: + # Allow more retries for network requests in cargo (downloading crates) and + # rustup (installing toolchains). This should help to reduce flaky CI failures + # from transient network timeouts or other issues. + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + +jobs: + create-nightly-tag: + name: Create a nightly tag + uses: juspay/hyperswitch/.github/workflows/release-nightly-version-reusable.yml@main + secrets: + token: ${{ secrets.AUTO_RELEASE_PAT }} diff --git a/.github/workflows/release-stable-version.yml b/.github/workflows/release-stable-version.yml new file mode 100644 index 000000000..ca191657c --- /dev/null +++ b/.github/workflows/release-stable-version.yml @@ -0,0 +1,154 @@ +name: Release a stable version + +on: + workflow_dispatch: + inputs: + bump_type: + description: The part of the semantic version to bump. + required: true + type: choice + options: + - patch + - minor + +jobs: + create-semver-tag: + name: Create a SemVer tag + runs-on: ubuntu-latest + + steps: + - name: Generate GitHub app token + id: generate_app_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }} + private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }} + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if the input is valid CalVer tag + shell: bash + run: | + if [[ ${{github.ref}} =~ ^refs/tags/[0-9]{4}\.[0-9]{2}\.[0-9]{2}(\.([0-9]+))?(-(.+))?$ ]]; then + echo "${{github.ref}} is a valid CalVer tag." + else + echo "::error::${{github.ref}} is not a valid CalVer tag." + exit 1 + fi + + - name: Check if user is authorized to trigger workflow + shell: bash + env: + GH_TOKEN: ${{ steps.generate_app_token.outputs.token }} + run: | + echo "::add-mask::${GH_TOKEN}" + + function is_user_team_member() { + username="${1}" + team_slug="${2}" + org_name=${{ github.repository_owner }} + + # We obtain HTTP status code since the API returns: + # - 200 status code if the user is a member of the specified team + # - 404 status code if the user is not a member of the specified team + # + # We cannot use the GitHub CLI since it does not seem to provide a way to obtain + # only the HTTP status code (yet). + status_code="$( + curl \ + --location \ + --silent \ + --output /dev/null \ + --write-out '%{http_code}' \ + --header 'Accept: application/vnd.github+json' \ + --header 'X-GitHub-Api-Version: 2022-11-28' \ + --header "Authorization: Bearer ${GH_TOKEN}" \ + "https://api.github.com/orgs/${org_name}/teams/${team_slug}/memberships/${username}" + )" + + # Returns a boolean value, allowing it to be directly used in if conditions + [[ status_code -eq 200 ]] + } + + allowed_teams=('hyperswitch-admins' 'hyperswitch-maintainers') + is_user_authorized=false + username=${{ github.triggering_actor }} + + for team in "${allowed_teams[@]}"; do + if is_user_team_member "${username}" "${team}"; then + is_user_authorized=true + break + fi + done + + if ${is_user_authorized}; then + echo "${username} is authorized to trigger workflow" + else + printf -v allowed_teams_comma_separated '%s, ' "${allowed_teams[@]}" + echo "::error::${username} is not authorized to trigger workflow; must be a member of one of these teams: ${allowed_teams_comma_separated%, }" + exit 1 + fi + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Install git-cliff + uses: baptiste0928/cargo-install@v2.2.0 + with: + crate: git-cliff + version: 1.4.0 + + - name: Install convco + uses: baptiste0928/cargo-install@v2.2.0 + with: + crate: convco + version: 0.5.0 + + - name: Obtain previous and next tag information + shell: bash + run: | + PREVIOUS_TAG="v$(convco version --prefix 'v')" + NEXT_TAG="v$(convco version --prefix 'v' "--${{ inputs.bump_type }}")" + + echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV + echo "NEXT_TAG=${NEXT_TAG}" >> $GITHUB_ENV + + # We make use of GitHub API calls to create the tag to have signed tags + - name: Create SemVer tag + shell: bash + env: + GH_TOKEN: ${{ steps.generate_app_token.outputs.token }} + run: | + # Create a lightweight tag to point to the checked out CalVer tag + gh api \ + --method POST \ + --header 'Accept: application/vnd.github+json' \ + --header 'X-GitHub-Api-Version: 2022-11-28' \ + '/repos/{owner}/{repo}/git/refs' \ + --raw-field "ref=refs/tags/${NEXT_TAG}" \ + --raw-field 'sha=${{ github.sha }}' + + - name: Generate changelog + shell: bash + run: | + # Override git-cliff tag pattern to only consider SemVer tags + export GIT_CLIFF__GIT__TAG_PATTERN='v[0-9]*' + + # Update heading format in git-cliff changelog template to include date + sed -i 's/## {{ version }}/## {{ version | trim_start_matches(pat="v") }} ({{ timestamp | date(format="%Y-%m-%d") }})/' .github/git-cliff-changelog.toml + + # Generate changelog content and store it in `release-notes.md` + git-cliff --config '.github/git-cliff-changelog.toml' --strip header --tag "${NEXT_TAG}" "${PREVIOUS_TAG}^.." \ + | sed "/## ${PREVIOUS_TAG}\$/,\$d" > release-notes.md + + - name: Upload changelog as build artifact + uses: actions/upload-artifact@v4 + with: + name: release-notes.md + path: release-notes.md + if-no-files-found: error \ No newline at end of file From 8891961aa700d3794b4f605cf943bf42fae893b9 Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran Date: Thu, 25 Jan 2024 13:48:54 +0530 Subject: [PATCH 08/28] chore(version): 2024.01.25.0 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 859a593ac..fe9e27cd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 2024.01.25.0 + +### Bug Fixes + +- Close connector drop down bydefault ([#303](https://github.com/juspay/hyperswitch-control-center/pull/303)) ([`7006d91`](https://github.com/juspay/hyperswitch-control-center/commit/7006d915dec69b2db96cf36a5399accd86f173c2)) + +### Miscellaneous Tasks + +- Change tag creation ([#297](https://github.com/juspay/hyperswitch-control-center/pull/297)) ([`1466e6a`](https://github.com/juspay/hyperswitch-control-center/commit/1466e6adf9dac3d746c5105b5ccfb9b1a51f9c4c)) + +- - - + ## 1.29.0 (2024-01-24) ### Features From a4f9dfa4d0a327feb629621e4b270c19fa87a1df Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran <120017870+JeevaRamu0104@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:58:35 +0530 Subject: [PATCH 09/28] chore: Update release-stable-version.yml (#306) --- .github/workflows/release-stable-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-stable-version.yml b/.github/workflows/release-stable-version.yml index ca191657c..3c5927e2f 100644 --- a/.github/workflows/release-stable-version.yml +++ b/.github/workflows/release-stable-version.yml @@ -73,7 +73,7 @@ jobs: [[ status_code -eq 200 ]] } - allowed_teams=('hyperswitch-admins' 'hyperswitch-maintainers') + allowed_teams=('hyperswitch-control-center-maintainers') is_user_authorized=false username=${{ github.triggering_actor }} @@ -151,4 +151,4 @@ jobs: with: name: release-notes.md path: release-notes.md - if-no-files-found: error \ No newline at end of file + if-no-files-found: error From 4b01c99656ba7fc1bc93a8b76a786bdcf318f949 Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran <120017870+JeevaRamu0104@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:08:44 +0530 Subject: [PATCH 10/28] chore: remove old workflow (#307) --- .github/workflows/release-new-version.yml | 79 ----------------------- 1 file changed, 79 deletions(-) delete mode 100644 .github/workflows/release-new-version.yml diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml deleted file mode 100644 index ade4f1982..000000000 --- a/.github/workflows/release-new-version.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Release a new hyperswitch version - -on: - schedule: - - cron: "30 14 * * 0-4" # Run workflow at 8 PM IST every Sunday-Thursday - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -# on: -# pull_request_target: -# types: -# - closed - -env: - # Allow more retries for network requests in cargo (downloading crates) and - # rustup (installing toolchains). This should help to reduce flaky CI failures - # from transient network timeouts or other issues. - CARGO_NET_RETRY: 10 - RUSTUP_MAX_RETRIES: 10 - -jobs: - create-release: - name: Release a new version - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.AUTO_RELEASE_PAT }} - - - name: Install Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable 2 weeks ago - - - name: Install cocogitto - uses: baptiste0928/cargo-install@v2.2.0 - with: - crate: cocogitto - version: 5.4.0 - - - name: Set Git Configuration - shell: bash - run: | - git config --local user.name 'github-actions' - git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' - - - name: Obtain previous and new tag information - shell: bash - # Only consider tags on current branch when setting PREVIOUS_TAG - run: | - PREVIOUS_TAG="$(git tag --sort='version:refname' --merged | tail --lines 1)" - if [[ "$(cog bump --auto --dry-run)" == *"No conventional commits for your repository that required a bump"* ]]; then - NEW_TAG="$(cog bump --patch --dry-run)" - else - NEW_TAG="$(cog bump --auto --dry-run)" - fi - echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV - echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV - - - name: Update changelog and create tag - shell: bash - if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }} - # Remove prefix 'v' from 'NEW_TAG' as cog bump --version expects only the version number - run: | - cog bump --version ${NEW_TAG#v} - - - name: Push created commit and tag - shell: bash - if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }} - run: | - git push - git push --tags From c76fcf291b558a76f1c635f0fdc5cfb0c965df2d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:39:11 +0000 Subject: [PATCH 11/28] chore(version): 2024.01.25.1 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe9e27cd6..cc5e7d6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 2024.01.25.1 + +### Miscellaneous Tasks + +- Update release-stable-version.yml ([#306](https://github.com/juspay/hyperswitch-control-center/pull/306)) ([`a4f9dfa`](https://github.com/juspay/hyperswitch-control-center/commit/a4f9dfa4d0a327feb629621e4b270c19fa87a1df)) +- Remove old workflow ([#307](https://github.com/juspay/hyperswitch-control-center/pull/307)) ([`4b01c99`](https://github.com/juspay/hyperswitch-control-center/commit/4b01c99656ba7fc1bc93a8b76a786bdcf318f949)) + +**Full Changelog:** [`2024.01.25.0...2024.01.25.1`](https://github.com/juspay/hyperswitch-control-center/compare/2024.01.25.0...2024.01.25.1) + +- - - + ## 2024.01.25.0 ### Bug Fixes From 6bffa75d580896bb86122da823e94814516bdb41 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Mon, 29 Jan 2024 11:02:35 +0530 Subject: [PATCH 12/28] fix: audit log fix (#305) Co-authored-by: Pritish Budhiraja <1805317@kiit.ac.in> --- .../HyperSwitch/PaymentLogs/PaymentLogs.res | 113 +++++++++++++----- 1 file changed, 81 insertions(+), 32 deletions(-) diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index 0b52f8123..9ca545e60 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -59,23 +59,28 @@ module PrettyPrintJson = { {copyParsedJson}
- - {parsedJson} - +
+ + {parsedJson} + +