diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dc051fa9..3555b2371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,31 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.26.0 (2024-01-18) + +### Features + +- Add new user ([#237](https://github.com/juspay/hyperswitch-control-center/pull/237)) ([`3749e32`](https://github.com/juspay/hyperswitch-control-center/commit/3749e3278602c2ad514079db3d6d78226cfa9391)) +- Access added for Button ([#274](https://github.com/juspay/hyperswitch-control-center/pull/274)) ([`d5ecee6`](https://github.com/juspay/hyperswitch-control-center/commit/d5ecee626d3da87f6bda8495b7539ba8660a7618)) + +### Bug Fixes + +- Floating point value fix for test payment ([#270](https://github.com/juspay/hyperswitch-control-center/pull/270)) ([`038a714`](https://github.com/juspay/hyperswitch-control-center/commit/038a71492de22f1a1a51b6de9f68f010bf872268)) + +### Refactors + +- Routing types and utils ([#254](https://github.com/juspay/hyperswitch-control-center/pull/254)) ([`b8b5034`](https://github.com/juspay/hyperswitch-control-center/commit/b8b5034fbae6974e34c799e6f9333e3663247f7f)) + +### Miscellaneous Tasks + +- Added Access Type & Remove the Read & ReadWrite Type ([#267](https://github.com/juspay/hyperswitch-control-center/pull/267)) ([`49e3eae`](https://github.com/juspay/hyperswitch-control-center/commit/49e3eaeb9bd14a3c788649b81cf561386a5ce006)) +- Refactor invite users ([#273](https://github.com/juspay/hyperswitch-control-center/pull/273)) ([`85b07d0`](https://github.com/juspay/hyperswitch-control-center/commit/85b07d0cf058dd0842b11acb7714cd85f8d9d6c6)) + +**Full Changelog:** [`v1.25.1...v1.26.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.25.1...v1.26.0) + +- - - + + ## 1.25.1 (2024-01-17) ### Miscellaneous Tasks diff --git a/src/components/Button.res b/src/components/Button.res index 59b89f0a2..dc91ab56f 100644 --- a/src/components/Button.res +++ b/src/components/Button.res @@ -360,6 +360,7 @@ let make = ( ~customBackColor=?, ~isPhoneDropdown=false, ~showBtnTextToolTip=false, + ~access=AuthTypes.Access, ) => { let parentRef = React.useRef(Js.Nullable.null) let dummyRef = React.useRef(Js.Nullable.null) @@ -695,110 +696,109 @@ let make = ( : ""} ${customBackColor->Belt.Option.getWithDefault( backColor, )} ${customRoundedClass->Belt.Option.getWithDefault(roundedClass)}` - - let newThemeGap = "" - - - - + }} + + + } diff --git a/src/components/Button.resi b/src/components/Button.resi index 53bb21c2f..5d9c12918 100644 --- a/src/components/Button.resi +++ b/src/components/Button.resi @@ -75,7 +75,7 @@ let useGetTextColor: ( ) => string @react.component let make: ( - ~buttonFor: Js.String2.t=?, + ~buttonFor: string=?, ~loadingText: string=?, ~buttonState: buttonState=?, ~text: Js.String2.t=?, @@ -101,7 +101,7 @@ let make: ( ~textWeight: string=?, ~fullLength: bool=?, ~disableRipple: bool=?, - ~customButtonStyle: Js.String2.t=?, + ~customButtonStyle: string=?, ~textStyleClass: string=?, ~customTextPaddingClass: string=?, ~allowButtonTextMinWidth: bool=?, @@ -115,4 +115,5 @@ let make: ( ~customBackColor: string=?, ~isPhoneDropdown: bool=?, ~showBtnTextToolTip: bool=?, + ~access: AuthTypes.authorization=?, ) => React.element diff --git a/src/components/EntityScaffold.res b/src/components/EntityScaffold.res index d9d048b33..68afbe809 100644 --- a/src/components/EntityScaffold.res +++ b/src/components/EntityScaffold.res @@ -1,85 +1,32 @@ -module ComingSoon = { - @react.component - let make = (~title) => { -
-
{React.string(title)}
-
{React.string("Coming soon...")}
-
- } -} - -module ShowPage = { - @react.component - let make = (~entityName, ~id) => { -
-
- {React.string(`Show ${entityName} `)} - {React.string(`#${id}`)} -
-
{React.string("Coming soon...")}
-
- } -} - -module UnauthorizedPage = { - @react.component - let make = (~entityName) => { -
-
{React.string(entityName)}
-
{React.string("You don't have access to this module. Contact admin for access")}
-
- } -} - @react.component let make = ( ~entityName="", ~remainingPath, ~isAdminAccount=false, - ~access: AuthTypes.authorization=ReadWrite, - ~renderList=() => , - ~renderNewForm=() => , + ~access: AuthTypes.authorization=Access, + ~renderList, + ~renderNewForm=?, ~renderShow=?, - ~renderOrder=?, - ~renderEdit=_id => , - ~renderEditWithMultiId=(_id1, _id2) => , - ~renderClone=_id => , ) => { if access === NoAccess { - + } else { switch remainingPath { | list{"new"} => switch access { - | ReadWrite => renderNewForm() - | _ => - } - | list{id, "clone"} => - switch access { - | ReadWrite => renderClone(id) - | _ => + | Access => + switch renderNewForm { + | Some(element) => element() + | None => React.null + } + | NoAccess => } | list{id} => let page = switch renderShow { | Some(fn) => fn(id) - | None => + | None => React.null } page - | list{id, "edit"} => - switch access { - | ReadWrite => renderEdit(id) - | _ => - } - | list{id1, id2, "edit"} => - switch access { - | ReadWrite => renderEditWithMultiId(id1, id2) - | _ => - } - | list{"order", id} => - switch renderOrder { - | Some(fn) => fn(id) - | None => - } | list{} => renderList() | _ => } diff --git a/src/components/HyperSwitchAuthWrapper.res b/src/components/HyperSwitchAuthWrapper.res index ee0d30017..9f0c21dbd 100644 --- a/src/components/HyperSwitchAuthWrapper.res +++ b/src/components/HyperSwitchAuthWrapper.res @@ -23,7 +23,7 @@ let make = (~children) => { | _ => switch LocalStorage.getItem("login")->Js.Nullable.toOption { | Some(token) => - if !(token->HSwitchUtils.isEmptyString) { + if !(token->LogicUtils.isEmptyString) { setAuthStatus(LoggedIn(HyperSwitchAuthTypes.getDummyAuthInfoForToken(token))) } else { setAuthStatus(LoggedOut) diff --git a/src/components/UnauthorizedPage.res b/src/components/UnauthorizedPage.res new file mode 100644 index 000000000..55bddadc9 --- /dev/null +++ b/src/components/UnauthorizedPage.res @@ -0,0 +1,19 @@ +@react.component +let make = (~message="You don't have access to this module. Contact admin for access") => { + let {setDashboardPageState} = React.useContext(GlobalProvider.defaultContext) + React.useEffect0(() => { + RescriptReactRouter.replace("/unauthorized") + None + }) + +