Skip to content

Commit

Permalink
chore: merged latest branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay committed Jan 3, 2024
2 parents 91c7340 + 543e074 commit ae03d50
Show file tree
Hide file tree
Showing 79 changed files with 733 additions and 1,368 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiBaseUrl=https://sandbox.hyperswitch.io
sdkBaseUrl=https://beta.hyperswitch.io/v1/HyperLoader.js
sdkBaseUrl=https://beta.hyperswitch.io/v1/HyperLoader.js
mixpanelToken=
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [conven

- - -

## 1.18.3 (2024-01-02)

### Bug Fixes

- Scrollbar revert ([#153](https://github.com/juspay/hyperswitch-control-center/pull/153)) ([`731ac50`](https://github.com/juspay/hyperswitch-control-center/commit/731ac503e93d051cf3dc1b34593e91b896105897))
- Business profile addition modal bugfix ([#152](https://github.com/juspay/hyperswitch-control-center/pull/152)) ([`7075812`](https://github.com/juspay/hyperswitch-control-center/commit/707581209d18e19c9247a551544a317035cd2039))
- Unnecessary API List count of connectors stop ([#154](https://github.com/juspay/hyperswitch-control-center/pull/154)) ([`40ae278`](https://github.com/juspay/hyperswitch-control-center/commit/40ae2788172c19f05206df59131e6a35e1b70f8e))

### Miscellaneous Tasks

- Mixpanel clearing ([#155](https://github.com/juspay/hyperswitch-control-center/pull/155)) ([`c3a6eaf`](https://github.com/juspay/hyperswitch-control-center/commit/c3a6eaff6f42abc977e8121e1730f2372fc1b5de))

**Full Changelog:** [`v1.18.2...v1.18.3`](https://github.com/juspay/hyperswitch-control-center/compare/v1.18.2...v1.18.3)

- - -


## 1.16.0 (2023-12-26)

### Features
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Follow these simple steps to set up Hyperswitch on your local machine.
```bash
apiBaseUrl = your-backend-url
sdkBaseUrl = your-sdk-url
mixpanelToken = mixpanel-token
# To view Mixpanel events on the Mixpanel dashboard, you must add your Mixpanel token; otherwise, you can ignore this requirement.
```

5. Start the ReScript compiler:
Expand Down
8 changes: 8 additions & 0 deletions public/hyperswitch/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ function getThreeDsKeys() {
}
}

function getSurchargeKeys() {
if (wasm) {
return wasm.getSurchargeKeys();
} else {
return [];
}
}

function getAllKeys() {
if (wasm) {
return wasm.getAllKeys();
Expand Down
23 changes: 1 addition & 22 deletions src/components/Button.res
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ let make = (
~customButtonStyle="",
~textStyleClass=?,
~customTextPaddingClass=?,
~hswitchMixPanelDescription=?,
~hswitchMixPanelPageName=?,
~hswitchMixPanelContextName=?,
~hswitchMixPanelActionName=?,
~allowButtonTextMinWidth=true,
~badge: badge={
value: 1->Belt.Int.toString,
Expand All @@ -365,7 +361,6 @@ let make = (
~isPhoneDropdown=false,
~showBtnTextToolTip=false,
) => {
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let parentRef = React.useRef(Js.Nullable.null)
let dummyRef = React.useRef(Js.Nullable.null)
let buttonRef = disableRipple ? dummyRef : parentRef
Expand Down Expand Up @@ -664,23 +659,7 @@ let make = (
}
let handleClick = ev => {
switch onClick {
| Some(fn) => {
if (
hswitchMixPanelPageName->Belt.Option.isSome &&
hswitchMixPanelActionName->Belt.Option.isSome &&
hswitchMixPanelContextName->Belt.Option.isSome
) {
hyperswitchMixPanel(
~pageName=hswitchMixPanelPageName->Belt.Option.getWithDefault(""),
~actionName=hswitchMixPanelActionName->Belt.Option.getWithDefault(""),
~contextName=hswitchMixPanelContextName->Belt.Option.getWithDefault(""),
~description=hswitchMixPanelDescription,
(),
)
}
fn(ev)
}

| Some(fn) => fn(ev)
| None => ()
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/components/Button.resi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type buttonType =
| Dropdown
| LightBlue
| ArdraDefaultBlue

type buttonSize = Large | Medium | Small | XSmall
type iconType =
| FontAwesome(string)
Expand Down Expand Up @@ -103,12 +102,8 @@ let make: (
~fullLength: bool=?,
~disableRipple: bool=?,
~customButtonStyle: Js.String2.t=?,
~textStyleClass: Js.String2.t=?,
~textStyleClass: string=?,
~customTextPaddingClass: string=?,
~hswitchMixPanelDescription: string=?,
~hswitchMixPanelPageName: string=?,
~hswitchMixPanelContextName: string=?,
~hswitchMixPanelActionName: string=?,
~allowButtonTextMinWidth: bool=?,
~badge: badge=?,
~buttonRightText: string=?,
Expand Down
20 changes: 0 additions & 20 deletions src/components/DynamicTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ let make = (
filterCheck,
filterForRow,
} = entity
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let tableName =
prefixAddition->Belt.Option.getWithDefault(false)
? title->Js.String.replaceByRe(%re("/ /g"), "-", _)->Js.String.toLowerCase->Some
Expand Down Expand Up @@ -249,17 +248,6 @@ let make = (
fetchApi(uri, ~bodyStr=Js.Json.stringify(finalJson), ~headers, ~method_=method, ())
->then(resp => {
let status = resp->Fetch.Response.status
if status >= 200 && status < 300 {
hyperswitchMixPanel(
~description=resp->Js.Json.stringifyAny,
~isApiFailure=true,
~apiUrl=`Dynamic Table Loading Failed - ${uri}`,
~apiMethodName=method->LogicUtils.methodStr,
~xRequestId=Some(resp->HyperSwitchUtils.fetchRequestIdFromAPI),
~responseStatusCode=Some(status),
(),
)
}
if status >= 300 {
setFetchSuccess(_ => false)
setTableDataLoading(_ => false)
Expand Down Expand Up @@ -296,14 +284,6 @@ let make = (
resolve()
})
->catch(_ => {
hyperswitchMixPanel(
~description=Some("Failed to fetch"),
~isApiFailure=true,
~apiUrl=`Dynamic Table Loading Failed - ${uri}`,
~apiMethodName=method->LogicUtils.methodStr,
(),
)

resolve()
})
->ignore
Expand Down
10 changes: 0 additions & 10 deletions src/components/HSwitchFeedBackModal.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@ let make = (
) => {
open HSwitchFeedBackModalUtils
open APIUtils
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let url = RescriptReactRouter.useUrl()
let showToast = ToastState.useShowToast()
let updateDetails = useUpdateMethod()

let onSubmit = async (values, _) => {
let mixPanelAction = switch modalType {
| FeedBackModal => "givefeedback"
| RequestConnectorModal => "request_connector"
}
["global", url.path->LogicUtils.getListHead]->Js.Array2.forEach(ele =>
hyperswitchMixPanel(~pageName=ele, ~contextName=feedbackVia, ~actionName=mixPanelAction, ())
)

try {
let url = getURL(~entityName=USERS, ~userType=#USER_DATA, ~methodType=Post, ())
let body =
Expand Down
18 changes: 0 additions & 18 deletions src/components/RemoteFilter.res
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ module CheckCustomFilters = {
~showAddFilter,
~showSelectFiltersSearch,
) => {
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let formState: ReactFinalForm.formState = ReactFinalForm.useFormState(
ReactFinalForm.useFormSubscription(["values"])->Js.Nullable.return,
)
Expand All @@ -294,8 +293,6 @@ module CheckCustomFilters = {
} else {
removeFilters(fieldNameArr, values)
}

hyperswitchMixPanel(~eventName=Some("analytics_addfilters"), ())
}

let selectOptions = options->Js.Array2.map(obj => obj.urlKey)
Expand Down Expand Up @@ -553,7 +550,6 @@ let make = (
~revampedFilter=false,
) => {
let {query} = React.useContext(FilterContext.filterContext)
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let alreadySelectedFiltersUserpref = `remote_filters_selected_keys_${tableName->Belt.Option.getWithDefault(
"",
)}`
Expand Down Expand Up @@ -962,13 +958,6 @@ let make = (
)
onClick={_ => {
setHideFilters(_ => !hideFilters)
hyperswitchMixPanel(
~eventName=Some(
`analytics_${hideFilters ? "showfilters" : "hidefilters"}`,
),
~description=Some(hideFilters ? "show_filters" : "hide_filters"),
(),
)
}}
/>
</div>}
Expand All @@ -994,13 +983,6 @@ let make = (
}
onClick={_ => {
setShowFiltersModal(_ => true)
hyperswitchMixPanel(
~eventName=Some(
`analytics_${hideFilters ? "showfilters" : "hidefilters"}`,
),
~description=Some(hideFilters ? "show_filters" : "hide_filters"),
(),
)
}}
/>
<UIUtils.RenderIf condition={count > 0 && filterHovered}>
Expand Down
17 changes: 0 additions & 17 deletions src/components/form/FormRenderer.res
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,6 @@ module SubmitButton = {
~textWeight=?,
~customHeightClass=?,
) => {
let url = RescriptReactRouter.useUrl()
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let dict = Js.Dict.empty()
[
"hasSubmitErrors",
Expand Down Expand Up @@ -686,22 +684,7 @@ module SubmitButton = {
buttonState
loadingText
onClick={_ev => {
let filterKeys =
formState.values
->LogicUtils.getDictFromJsonObject
->Js.Dict.keys
->Js.Array2.filter(key => {
["startTime", "endTime"]->Js.Array2.includes(key)->not
})
->Js.Json.stringifyAny
form.submit()->ignore
if text === "Apply Filters" {
hyperswitchMixPanel(
~eventName=Some(`${url.path->LogicUtils.getListHead}_applyfilters`),
~description=filterKeys,
(),
)
}
}} //either onclick or type_should be called #warning
leftIcon=icon
rightIcon
Expand Down
1 change: 1 addition & 0 deletions src/entryPoints/hyperswitch/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ let make = () => {
<SDKPage />
</FeatureFlagEnabledComponent>
| list{"3ds"} => <HSwitchThreeDS />
| list{"surcharge"} => <Surcharge />
| list{"account-settings"} =>
<FeatureFlagEnabledComponent isEnabled=featureFlagDetails.sampleData>
<HSwitchSettings />
Expand Down
5 changes: 0 additions & 5 deletions src/entryPoints/hyperswitch/HyperSwitchEntry.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module HyperSwitchEntryComponent = {
@react.component
let make = () => {
open HSLocalStorage
let hyperswitchMixPanel = HSMixPanel.useSendEvent()
let postDetails = APIUtils.useUpdateMethod()
let email = getFromMerchantDetails("email")
let name = getFromUserDetails("name")
Expand Down Expand Up @@ -44,10 +43,6 @@ module HyperSwitchEntryComponent = {
: `${page} - Dashboard [Test]`
DOMUtils.document.title = title
GoogleAnalytics.send({hitType: "pageview", page})
hyperswitchMixPanel(
~eventName=Some(pageTitle->HyperSwitchUtils.getMixpanelRouteName(url)),
(),
)
}

React.useEffect1(() => {
Expand Down
17 changes: 15 additions & 2 deletions src/entryPoints/hyperswitch/SidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open SidebarTypes
module GetProductionAccess = {
@react.component
let make = () => {
let mixpanelEvent = MixpanelHook.useSendEvent()
let textStyles = HSwitchUtils.getTextClass(~textVariant=P2, ~paragraphTextVariant=Medium, ())
let {isProdIntentCompleted, setShowProdIntentForm} = React.useContext(
GlobalProvider.defaultContext,
Expand All @@ -18,7 +19,12 @@ module GetProductionAccess = {
<div
className={`flex items-center gap-2 ${backgroundColor} ${cursorStyles} px-4 py-3 m-2 ml-2 mb-3 !mx-4 whitespace-nowrap rounded`}
onClick={_ => {
isProdIntentCompleted ? () : setShowProdIntentForm(_ => true)
isProdIntentCompleted
? ()
: {
setShowProdIntentForm(_ => true)
mixpanelEvent(~eventName="get_production_access", ())
}
}}>
<div className={`text-white ${textStyles} !font-semibold`}>
{productionAccessString->React.string}
Expand Down Expand Up @@ -149,13 +155,20 @@ let threeDs = SubLevelLink({
searchOptions: [("Configure 3ds", "")],
})

let surcharge = SubLevelLink({
name: "Surcharge",
link: `/surcharge`,
access: ReadWrite,
searchOptions: [("Add Surcharge", "")],
})

let workflow = isWorkflowEnabled =>
isWorkflowEnabled
? Section({
name: "Workflow",
icon: "3ds",
showSection: true,
links: [routing, threeDs],
links: [routing, threeDs, surcharge],
})
: emptyComponent

Expand Down
6 changes: 2 additions & 4 deletions src/entryPoints/hyperswitch/WooCommerce/WooCommerce.res
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module ConfigurePlugin = {
{"Use this key to authenticate all calls from your application's client"->React.string}
</div>
</div>
<UserOnboardingUIUtils.PublishableKeyArea currentRoute={WooCommercePlugin} />
<UserOnboardingUIUtils.PublishableKeyArea />
</div>
<div className="grid grid-cols-3 w-full py-4">
<div className="col-span-2">
Expand All @@ -123,9 +123,7 @@ module ConfigurePlugin = {
{"This helps to authenticate and verify live events send by Hyperswitch."->React.string}
</div>
</div>
<UserOnboardingUIUtils.PaymentResponseHashKeyArea
currentRoute={WooCommercePlugin}
/>
<UserOnboardingUIUtils.PaymentResponseHashKeyArea />
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/genericUtils/Identity.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ external jsonToFormReactEvent: Js.Json.t => ReactEvent.Form.t = "%identity"
external arrayOfGenericTypeToFormReactEvent: array<'a> => ReactEvent.Form.t = "%identity"
external webAPIFocusEventToReactEventFocus: Webapi.Dom.FocusEvent.t => ReactEvent.Focus.t =
"%identity"
external toWasm: Js.Dict.t<Js.Json.t> => RoutingTypes.wasmModule = "%identity"
5 changes: 4 additions & 1 deletion src/libraries/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ external getPayoutConnectorConfig: string => Js.Json.t = "getPayoutConnectorConf
@val @scope("window")
external getThreeDsKeys: unit => array<string> = "getThreeDsKeys"

@val @scope("window")
external getSurchargeKeys: unit => array<string> = "getSurchargeKeys"

@val @scope("window")
external getAllKeys: unit => array<string> = "getAllKeys"

Expand Down Expand Up @@ -224,6 +227,6 @@ external fcWidget: 'a = "fcWidget"
type boundingClient = {x: int, y: int, width: int, height: int}
@send external getBoundingClientRect: Dom.element => boundingClient = "getBoundingClientRect"

type env = {apiBaseUrl?: string, sdkBaseUrl?: string}
type env = {apiBaseUrl?: string, sdkBaseUrl?: string, mixpanelToken?: string}
@val @scope("window")
external env: env = "_env_"
Loading

0 comments on commit ae03d50

Please sign in to comment.