Skip to content

Commit

Permalink
chore: remove agreement screen and prod onboarding (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 authored Oct 3, 2024
1 parent 1a90976 commit f5c9f40
Show file tree
Hide file tree
Showing 39 changed files with 42 additions and 6,674 deletions.
56 changes: 1 addition & 55 deletions src/entryPoints/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ let make = () => {
setShowFeedbackModal,
dashboardPageState,
setDashboardPageState,
setQuickStartPageState,
isProdIntentCompleted,
} = React.useContext(GlobalProvider.defaultContext)
let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading)
let merchantDetailsTypedValue = Recoil.useRecoilValueFromAtom(merchantDetailsValueAtom)
let enumDetails =
enumVariantAtom->Recoil.useRecoilValueFromAtom->safeParse->QuickStartUtils.getTypedValueFromDict
let featureFlagDetails = featureFlagAtom->Recoil.useRecoilValueFromAtom
let (userPermissionJson, setuserPermissionJson) = Recoil.useRecoilState(userPermissionAtom)
let getEnumDetails = EnumVariantHook.useFetchEnumDetails()
let {userInfo: {orgId, merchantId, profileId, roleId}, checkUserEntity} = React.useContext(
UserInfoProvider.defaultContext,
)
Expand All @@ -41,20 +36,6 @@ let make = () => {
let isLiveUsersCounterEnabled = featureFlagDetails.liveUsersCounter
let hyperSwitchAppSidebars = SidebarValues.useGetSidebarValues(~isReconEnabled)
sessionExpired := false
let fetchInitialEnums = async () => {
try {
let response = await getEnumDetails(QuickStartUtils.quickStartEnumIntialArray)
let responseValueDict = response->getValFromNullableValue(Dict.make())
let pageStateToSet = responseValueDict->QuickStartUtils.getCurrentStep
setQuickStartPageState(_ => pageStateToSet->QuickStartUtils.enumToVarinatMapper)
responseValueDict
} catch {
| Exn.Error(e) => {
let err = Exn.message(e)->Option.getOr("Failed to Fetch!")
Exn.raiseError(err)
}
}
}

let fetchPermissions = async () => {
try {
Expand Down Expand Up @@ -84,9 +65,6 @@ let make = () => {
try {
Window.connectorWasmInit()->ignore
let _ = await fetchPermissions()
if featureFlagDetails.quickStart {
let _ = await fetchInitialEnums()
}
switch url.path->urlPath {
| list{"unauthorized"} => RescriptReactRouter.push(appendDashboardPath(~url="/home"))
| _ => ()
Expand All @@ -112,40 +90,13 @@ let make = () => {
None
}, (featureFlagDetails.mixpanel, path))

let determineStripePlusPayPal = () => {
enumDetails->checkStripePlusPayPal
? RescriptReactRouter.replace(appendDashboardPath(~url="/home"))
: setDashboardPageState(_ => #STRIPE_PLUS_PAYPAL)

React.null
}

let determineWooCommerce = () => {
enumDetails->checkWooCommerce
? RescriptReactRouter.replace(appendDashboardPath(~url="/home"))
: setDashboardPageState(_ => #WOOCOMMERCE_FLOW)

React.null
}

let determineQuickStartPageState = () => {
isProdIntentCompleted->Option.getOr(false) &&
enumDetails.integrationCompleted &&
!(enumDetails.testPayment.payment_id->isEmptyString)
? RescriptReactRouter.replace(appendDashboardPath(~url="/home"))
: setDashboardPageState(_ => #QUICK_START)

React.null
}
<>
<PageLoaderWrapper screenState={screenState} sectionHeight="!h-screen" showLogoutButton=true>
<div>
{switch dashboardPageState {
| #AUTO_CONNECTOR_INTEGRATION => <HSwitchSetupAccount />
// INTEGRATION_DOC AND PROD_ONBOARDING Need to be removed
// INTEGRATION_DOC Need to be removed
| #INTEGRATION_DOC => <UserOnboarding />
| #PROD_ONBOARDING => <ProdOnboardingLanding />
| #QUICK_START => <ConfigureControlCenter />
| #HOME =>
<div className="relative" key={renderKey}>
// TODO: Change the key to only profileId once the userInfo starts sending profileId
Expand Down Expand Up @@ -305,9 +256,6 @@ let make = () => {
renderList={() => <HSwitchProfileSettings />}
renderShow={(_, _) => <ModifyTwoFaSettings />}
/>
| list{"quick-start"} => determineQuickStartPageState()
| list{"woocommerce"} => determineWooCommerce()
| list{"stripe-plus-paypal"} => determineStripePlusPayPal()
| list{"search"} => <SearchResultsPage />
| list{"payment-attempts"} =>
<AccessControl
Expand Down Expand Up @@ -355,12 +303,10 @@ let make = () => {
</RenderIf>
</div>
</div>
| #WOOCOMMERCE_FLOW => <WooCommerce />
| #DEFAULT =>
<div className="h-screen flex justify-center items-center">
<Loader />
</div>
| #STRIPE_PLUS_PAYPAL => <StripePlusPaypal />
}}
</div>
</PageLoaderWrapper>
Expand Down
8 changes: 0 additions & 8 deletions src/entryPoints/Provider/GlobalProvider.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ let defaultValue = {
setPermissionInfo: _ => (),
isProdIntentCompleted: None,
setIsProdIntentCompleted: _ => (),
quickStartPageState: QuickStartTypes.ConnectProcessor(LANDING),
setQuickStartPageState: _ => (),
}

let defaultContext = React.createContext(defaultValue)
Expand All @@ -31,10 +29,6 @@ let make = (~children) => {
let (dashboardPageState, setDashboardPageState) = React.useState(_ => #DEFAULT)
let (permissionInfo, setPermissionInfo) = React.useState(_ => [])
let (isProdIntentCompleted, setIsProdIntentCompleted) = React.useState(_ => None)
let (
quickStartPageState,
setQuickStartPageState,
) = React.useState(_ => QuickStartTypes.ConnectProcessor(LANDING))

let (integrationDetails, setIntegrationDetails) = React.useState(_ =>
Dict.make()->JSON.Encode.object->ProviderHelper.getIntegrationDetails
Expand All @@ -54,8 +48,6 @@ let make = (~children) => {
setPermissionInfo,
isProdIntentCompleted,
setIsProdIntentCompleted,
quickStartPageState,
setQuickStartPageState,
}>
children
</Provider>
Expand Down
8 changes: 0 additions & 8 deletions src/entryPoints/Provider/ProviderTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ type dashboardPageStateTypes = [
| #AUTO_CONNECTOR_INTEGRATION
| #DEFAULT
| #INTEGRATION_DOC
| #PROD_ONBOARDING
| #HOME
| #WOOCOMMERCE_FLOW
| #STRIPE_PLUS_PAYPAL
| #QUICK_START
]

type integrationDetailsType = {
Expand All @@ -34,10 +30,6 @@ type contextType = {
) => unit,
isProdIntentCompleted: option<bool>,
setIsProdIntentCompleted: (option<bool> => option<bool>) => unit,
quickStartPageState: QuickStartTypes.quickStartType,
setQuickStartPageState: (
QuickStartTypes.quickStartType => QuickStartTypes.quickStartType
) => unit,
}

type sidebarContextType = {
Expand Down
6 changes: 1 addition & 5 deletions src/screens/APIUtils/APIUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,7 @@ let useGetURL = () => {
// ACCEPT INVITE PRE_LOGIN
| #ACCEPT_INVITATION_PRE_LOGIN => `${userUrl}/user/invite/accept/v2/pre_auth`

// SWITCH & CREATE MERCHANT
| #SWITCH_MERCHANT =>
switch methodType {
| _ => `${userUrl}/${(userType :> string)->String.toLowerCase}`
}
// CREATE MERCHANT
| #CREATE_MERCHANT =>
switch queryParamerters {
| Some(params) => `${userUrl}/${(userType :> string)->String.toLowerCase}?${params}`
Expand Down
1 change: 0 additions & 1 deletion src/screens/APIUtils/APIUtilsTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ type userType = [
| #VERIFY_EMAILV2
| #ACCEPT_INVITE_FROM_EMAIL
| #SET_METADATA
| #SWITCH_MERCHANT
| #PERMISSION_INFO
| #ROLE_INFO
| #MERCHANT_DATA
Expand Down
11 changes: 0 additions & 11 deletions src/screens/HSwitchUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,6 @@ let getTextClass = variantType => {
}
}

let checkStripePlusPayPal = (enumDetails: QuickStartTypes.responseType) => {
enumDetails.stripeConnected.processorID->isNonEmptyString &&
enumDetails.paypalConnected.processorID->isNonEmptyString &&
enumDetails.sPTestPayment
}

let checkWooCommerce = (enumDetails: QuickStartTypes.responseType) => {
enumDetails.setupWoocomWebhook &&
enumDetails.firstProcessorConnected.processorID->isNonEmptyString
}

let noAccessControlText = "You do not have the required permissions to access this module. Please contact your admin."
let noAccessControlTextForProcessors = "You do not have the required permissions to connect this processor. Please contact admin."

Expand Down
Loading

0 comments on commit f5c9f40

Please sign in to comment.