diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index 9d6e08029..2accf7baa 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -1,9 +1,9 @@ { "test_live_toggle": false, "is_live_mode": false, - "magic_link": false, + "magic_link": true, "production_access": false, - "quick_start": false, + "quick_start": true, "switch_merchant": false, "audit_trail": false, "system_metrics": false, diff --git a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrateYourAppUtils.res b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrateYourAppUtils.res index ecc45839b..2b24edd6b 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrateYourAppUtils.res +++ b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrateYourAppUtils.res @@ -56,3 +56,15 @@ let getPolyMorphicVariantOfIntegrationSubStep: standardIntegrationSteps => Quick | DisplayPaymentConfirmation => #DisplayPaymentConfirmation } } + +let getPolyMorphicVariantOfMigrateFromStripe: migrateFromStripeSteps => QuickStartTypes.sectionHeadingVariant = ( + currentStep: migrateFromStripeSteps, +) => { + switch currentStep { + | DownloadAPIKey => #DownloadTestAPIKeyStripe + | InstallDeps => #InstallDeps + | ReplaceAPIKeys => #ReplaceAPIKeys + | ReconfigureCheckout => #ReconfigureCheckout + | LoadCheckout => #LoadCheckout + } +} diff --git a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/MigrateFromStripe.res b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/MigrateFromStripe.res index 0d1b1f156..249ff9046 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/MigrateFromStripe.res +++ b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/MigrateFromStripe.res @@ -14,6 +14,7 @@ let make = ( let (currentStep, setCurrentStep) = React.useState(_ => DownloadAPIKey) let {setQuickStartPageState} = React.useContext(GlobalProvider.defaultContext) let isLastStep = currentStep === LoadCheckout + let updateEnumInRecoil = EnumVariantHook.useUpdateEnumInRecoil() let theme = switch ThemeProvider.useTheme() { | Dark => "vs-dark" @@ -25,10 +26,18 @@ let make = ( buttonState={Normal} buttonType={PrimaryOutline} text="Back" - onClick={_ => - currentStep === DownloadAPIKey - ? setQuickStartPageState(_ => IntegrateApp(CHOOSE_INTEGRATION)) - : setCurrentStep(_ => getNavigationStepForMigrateFromStripe(~currentStep, ()))} + onClick={_ => { + let prevStep = getNavigationStepForMigrateFromStripe(~currentStep, ()) + if currentStep === DownloadAPIKey { + setQuickStartPageState(_ => IntegrateApp(CHOOSE_INTEGRATION)) + } else { + let _res = updateEnumInRecoil([ + (String("pending"), currentStep->getPolyMorphicVariantOfMigrateFromStripe), + (String("ongoing"), prevStep->getPolyMorphicVariantOfMigrateFromStripe), + ]) + setCurrentStep(_ => prevStep) + } + }} buttonSize=Small /> @@ -40,9 +49,12 @@ let make = ( if isLastStep { markAsDone()->ignore } else { - setCurrentStep(_ => - getNavigationStepForMigrateFromStripe(~currentStep, ~forward=true, ()) - ) + let nextStep = getNavigationStepForMigrateFromStripe(~currentStep, ~forward=true, ()) + let _res = updateEnumInRecoil([ + (String("completed"), currentStep->getPolyMorphicVariantOfMigrateFromStripe), + (String("ongoing"), nextStep->getPolyMorphicVariantOfMigrateFromStripe), + ]) + setCurrentStep(_ => nextStep) } }} buttonSize=Small diff --git a/src/screens/HyperSwitch/Home/QuickStart/QuickStartTypes.res b/src/screens/HyperSwitch/Home/QuickStart/QuickStartTypes.res index 9fb529ebb..ec2d99862 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/QuickStartTypes.res +++ b/src/screens/HyperSwitch/Home/QuickStart/QuickStartTypes.res @@ -60,6 +60,11 @@ type sectionHeadingVariant = [ | #SetupWoocomWebhook | #IsMultipleConfiguration | #GoLive + | #DownloadTestAPIKeyStripe + | #InstallDeps + | #ReplaceAPIKeys + | #ReconfigureCheckout + | #LoadCheckout ] type processorType = { @@ -93,6 +98,11 @@ type responseType = { configureWoocom: bool, setupWoocomWebhook: bool, isMultipleConfiguration: bool, + downloadTestAPIKeyStripe: string, + installDeps: string, + replaceAPIKeys: string, + reconfigureCheckout: string, + loadCheckout: string, } type requestObjectType = @@ -102,5 +112,6 @@ type requestObjectType = | IntegrationMethod(integrationMethod) | ConnectorChoice(connectorChoice) | Boolean(bool) + | String(string) type valueType = String(string) | Boolean(bool) diff --git a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res index c7546351b..641c6f7e5 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res +++ b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res @@ -190,6 +190,11 @@ let getTypedValueFromDict = valueString => { configureWoocom: value->getBool(#ConfigureWoocom->getStringFromVariant, false), setupWoocomWebhook: value->getBool(#SetupWoocomWebhook->getStringFromVariant, false), isMultipleConfiguration: value->getBool(#IsMultipleConfiguration->getStringFromVariant, false), + downloadTestAPIKeyStripe: value->getString(#DownloadTestAPIKeyStripe->getStringFromVariant, ""), + installDeps: value->getString(#InstallDeps->getStringFromVariant, ""), + replaceAPIKeys: value->getString(#ReplaceAPIKeys->getStringFromVariant, ""), + reconfigureCheckout: value->getString(#ReconfigureCheckout->getStringFromVariant, ""), + loadCheckout: value->getString(#LoadCheckout->getStringFromVariant, ""), } typedValue } @@ -238,6 +243,17 @@ let getStatusValue = (comparator: valueType, enumVariant, dashboardPageState) => boolValue ? COMPLETED : dashboardPageState === enumVariant ? ONGOING : PENDING } } + +let getStatusFromString = statusString => { + open HSSelfServeSidebar + switch statusString->Js.String2.toUpperCase { + | "PENDING" => PENDING + | "COMPLETED" => COMPLETED + | "ONGOING" => ONGOING + | _ => PENDING + } +} + let sidebarTextBasedOnVariant = choiceState => switch choiceState { | #MigrateFromStripe => "Hyperswitch For Stripe Users" @@ -263,7 +279,7 @@ let getSidebarOptionsForIntegrateYourApp: ( open LogicUtils let enumValue = enumDetails->safeParse->getTypedValueFromDict - + Js.log2("updated lokii", enumValue) let migrateFromStripeSidebar: array = [ { title: "Choose integration method", @@ -283,23 +299,23 @@ let getSidebarOptionsForIntegrateYourApp: ( subOptions: [ { title: "Download Test API Keys", - status: PENDING, + status: enumValue.downloadTestAPIKeyStripe->getStatusFromString, }, { title: "Install Dependencies", - status: PENDING, + status: enumValue.installDeps->getStatusFromString, }, { title: "Replace API keys", - status: PENDING, + status: enumValue.replaceAPIKeys->getStatusFromString, }, { title: "Reconfigure Checkout Form", - status: PENDING, + status: enumValue.reconfigureCheckout->getStatusFromString, }, { title: "Load Hyperswitch Checkout", - status: PENDING, + status: enumValue.loadCheckout->getStatusFromString, }, ], }, @@ -590,6 +606,7 @@ let generateBodyBasedOnType = (parentVariant: sectionHeadingVariant, value: requ ]->getJsonFromArrayOfJson | Boolean(_) => (parentVariant :> string)->Js.Json.string + | String(str) => str->Js.Json.string } } diff --git a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res index ae31a0902..7015eee45 100644 --- a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res +++ b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res @@ -48,11 +48,16 @@ let useUpdateEnumInRecoil = () => { let booleanDict = [((enumVariant :> string), true->Js.Json.boolean)]->Js.Dict.fromArray enumDictsArray->Array.push(booleanDict) } + | String(str) => { + let stringDict = [((enumVariant :> string), str->Js.Json.string)]->Js.Dict.fromArray + enumDictsArray->Array.push(stringDict) + } | _ => enumDictsArray->Array.push(bodyValForApi->getDictFromJsonObject) } }) let updatedRecoilValueDict = DictionaryUtils.mergeDicts(enumDictsArray) + Js.log2("lokiiiiii", enumDictsArray) setEnumVariantValues(._ => updatedRecoilValueDict->Js.Json.object_->Js.Json.stringify) updatedRecoilValueDict }