diff --git a/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res b/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res index c1a1080ac..4935c4cdf 100644 --- a/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res +++ b/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res @@ -47,6 +47,7 @@ let make = () => {
{ app.listen(4242, () => console.log("Node server listening on port 4242!"));` -let reactInstallationDisplayCheckout: string = `npm install @juspay-tech/hyper-js -npm install @juspay-tech/react-hyper-js` - -let reactImportDisplayCheckout: string = `import React, { useState, useEffect } from "react"; -import { loadHyper } from "@juspay-tech/hyper-js"; -import { HyperElements } from "@juspay-tech/react-hyper-js";` - -let nodeDisplayCheckout: string = `const hyperPromise = loadHyper("YOUR_PUBLISHABLE_KEY"); -const [clientSecret, setClientSecret] = useState(""); -// store a reference to hyper -const hyper = useHyper();` - let reactDisplayPaymentConfirmation: string = `const handleSubmit = async (e) => { e.preventDefault(); if (!hyper || !widgets) { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/OnboardingChecklist.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/OnboardingChecklist.res deleted file mode 100644 index b635ef8e7..000000000 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/OnboardingChecklist.res +++ /dev/null @@ -1,129 +0,0 @@ -@react.component -let make = () => { - open APIUtils - let url = RescriptReactRouter.useUrl() - let updateDetails = useUpdateMethod() - let { - integrationDetails, - setIntegrationDetails, - setDashboardPageState, - setShowProdIntentForm, - } = React.useContext(GlobalProvider.defaultContext) - - let stepperValue = HSwitchVerticalStepper.getStepperValue(~integrationDetails) - - let typeOfIntegrationDocs = - LogicUtils.getDictFromUrlSearchParams(url.search) - ->Js.Dict.get("type") - ->Belt.Option.getWithDefault("") - - let markAsDone = currentRoute => - async () => { - try { - let url = getURL(~entityName=INTEGRATION_DETAILS, ~methodType=Post, ()) - let body = HSwitchUtils.constructOnboardingBody( - ~dashboardPageState=#INTEGRATION_DOC, - ~integrationDetails, - ~is_done=true, - ~metadata=[ - ("is_skip", false->Js.Json.boolean), - ( - "integrationType", - currentRoute->UserOnboardingUtils.variantToTextMapperForBuildHS->Js.Json.string, - ), - ] - ->Js.Dict.fromArray - ->Js.Json.object_, - (), - ) - let _res = await updateDetails(url, body, Post) - setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) - RescriptReactRouter.replace("/home") - setDashboardPageState(_ => #HOME) - setShowProdIntentForm(_ => true) - } catch { - | _ => () - } - } - - let handleBackButton = () => { - RescriptReactRouter.push("/home") - setDashboardPageState(_ => #HOME) - } - let isFromOnboardingChecklist = integrationDetails.integration_checklist.is_done - -
-
-
-
- {
-
- {switch (url.path, typeOfIntegrationDocs) { - | (list{"onboarding-checklist"}, "migrate-from-stripe") => - - | (list{"onboarding-checklist"}, "integrate-from-scratch") => - - | (list{"onboarding-checklist"}, "sample-projects") => - - | (list{"onboarding-checklist"}, "woocommerce-plugin") => - - | _ => -
- -
- -
- }} -
-
} -
-
-} diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index 95ae3309c..8724636b1 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -1074,108 +1074,3 @@ let getTabsForIntegration = ( | _ => [] } } - -module GitHubLanguageFilters = { - @react.component - let make = ( - ~frontEndLang: languages, - ~setFrontEndLang, - ~backEndLang: languages, - ~setBackEndLang, - ~isFromOnboardingChecklist=false, - ) => { - let hyperswitchMixPanel = HSMixPanel.useSendEvent() - let url = RescriptReactRouter.useUrl() - let urlHead = url.path->LogicUtils.getListHead - - let backendLangInput: ReactFinalForm.fieldRenderPropsInput = { - name: "Backend", - onBlur: _ev => (), - onChange: ev => { - let val = ev->formEventToStr->getLangauge - setBackEndLang(_ => val) - hyperswitchMixPanel(~eventName=Some(`${urlHead}_${(val :> string)}`), ()) - }, - onFocus: _ev => (), - value: (backEndLang :> string)->Js.Json.string, - checked: true, - } - let frontendLangInput: ReactFinalForm.fieldRenderPropsInput = { - name: "Frontend", - onBlur: _ev => (), - onChange: ev => { - let val = ev->formEventToStr->getLangauge - setFrontEndLang(_ => val) - hyperswitchMixPanel(~eventName=Some(`${urlHead}_${(val :> string)}`), ()) - }, - onFocus: _ev => (), - value: (frontEndLang :> string)->Js.Json.string, - checked: true, - } - - let frontendDropdownText = { - frontEndLang === #ChooseLanguage ? "Choose Frontend" : (frontEndLang :> string) - } - let backendDropdownText = { - backEndLang === #ChooseLanguage ? "Choose Backend" : (backEndLang :> string) - } - -
Js.Json.object_}> -
- Js.Array2.map((lang): SelectBox.dropdownOption => { - {value: (lang :> string), label: (lang :> string)} - })} - customButtonStyle="!rounded-md" - hideMultiSelectButtons=true - buttonClickFn={e => { - hyperswitchMixPanel(~eventName=Some(`${urlHead}_${e->Js.String2.replace(" ", "")}`), ()) - }} - autoApply=false - customStyle="!rounded-md" - baseComponent={
-
- } -} diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res index d28ab4aa8..261db46a0 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res @@ -195,15 +195,6 @@ let getCreateAPayment = (lang: languages): string => { } } -let getDisplayPaymentConfirmation = (lang: languages): string => { - open CodeSnippets - switch lang { - | #ReactJs => reactDisplayPaymentConfirmation - | #Node => nodeDisplayPaymentConfirmation - | _ => "" - } -} - let getMainPageText = currentRoute => switch currentRoute { | MigrateFromStripe => "Migrate from Stripe" @@ -220,14 +211,6 @@ let getLanguages = currentRoute => | _ => ([], []) } -let getHeadingTextForRequestOnlyPlat = platform => - switch platform { - | #BigCommerce => "Big Commerce" - | #Android => "Android" - | #IOS => "IOS" - | _ => "" - } - // To be refactored let getFilteredList = ( frontEndLang: languages, diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res index 424944dfe..6a21fd6cd 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res @@ -1,6 +1,4 @@ open HSwitchSettingTypes -open CountryUtils -let errorClass = "text-sm leading-4 font-medium text-start ml-1 mt-2" type modalFields = ProfileName @@ -10,13 +8,6 @@ let getStringFromVariant = key => { } } -let defaultCountry = "UnitedStatesOfAmerica" -let defaultLabel = "default" - -let getFormatedCountryName = countryCode => { - countryCode->getCountryCodeFromString->getCountryFromCountryCode->splitCountryNameWithSpace -} - let labelField = FormRenderer.makeFieldInfo( ~label="Profile Name", ~name="profile_name", diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res index a3543e558..384f1d88f 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res @@ -62,51 +62,6 @@ module AddEntryBtn = { } } -module BusinessUnitText = { - @react.component - let make = () => { -
-
- {"How this works?"->React.string} -
-
    -

    - {"If you have multiple business units, add them here by providing the country and a label for each unit. We have created a default business unit during your sign up"->React.string} -

    -

    - {"For Eg: If you have clothing and shoe business units in both US & GB and the 'US clothing' unit has to be your default business unit, then create the following units:"->React.string} -

    -
      -
    • {"Country = US, label = default"->React.string}
    • -
    • {"Country = US, label = shoe"->React.string}
    • -
    • {"Country = GB, label = clothing"->React.string}
    • -
    • {"Country = GB, label = shoe"->React.string}
    • -
    -

    {"Note: "->React.string}

    -
      -
    • - {"When creating a connector, you need to attach it to a business unit."->React.string} -
    • -
    • - - {"If you have more than one business unit, you need to send the business_country & business_label fields during"->React.string} - - - Window._open( - "https://api-reference.hyperswitch.io/docs/hyperswitch-api-reference/60bae82472db8-payments-create", - )} - target="_blank"> - {"payments/create API request"->React.string} - -
    • -
    -
-
- } -} - @react.component let make = ( ~isFromSettings=true, @@ -182,9 +137,13 @@ let make = ( currrentFetchCount={businessProfileValues->Js.Array2.length} /> // -
- -
+ +
+ +
+
diff --git a/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res b/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res index e88c87089..ac05ee285 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res +++ b/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res @@ -1,196 +1,4 @@ open HSwitchSettingTypes -let merchantName = FormRenderer.makeFieldInfo( - ~label="Name", - ~name="merchant_name", - ~placeholder="Enter your name", - ~customInput=InputFields.textInput(), - ~isRequired=true, - (), -) - -let webhookVersion = FormRenderer.makeFieldInfo( - ~label="Webhook Version", - ~name="webhook_version", - ~placeholder="Enter webhooks version", - ~customInput=InputFields.textInput(~autoComplete="off", ()), - ~isRequired=false, - (), -) - -let webhookUsername = FormRenderer.makeFieldInfo( - ~label="Webhook Username", - ~name="webhook_username", - ~placeholder="Enter webhooks username", - ~customInput=InputFields.textInput(~autoComplete="off", ()), - ~isRequired=false, - (), -) - -let createdPaymentToggle = FormRenderer.makeFieldInfo( - ~label="", - ~name="payment_created_enabled", - ~customInput=InputFields.boolInput(~isDisabled=false), - ~isRequired=false, - (), -) - -let succeededPaymentToggle = FormRenderer.makeFieldInfo( - ~label="", - ~name="payment_succeeded_enabled", - ~customInput=InputFields.boolInput(~isDisabled=true), - ~isRequired=false, - (), -) - -let failedPaymentToggle = FormRenderer.makeFieldInfo( - ~label="", - ~name="payment_failed_enabled", - ~customInput=InputFields.boolInput(~isDisabled=true), - ~isRequired=false, - (), -) - -let webhookPassword = FormRenderer.makeFieldInfo( - ~label="Webhook Password", - ~name="webhook_password", - ~placeholder="Enter webhook password", - ~customInput=InputFields.textInput( - ~type_="password", - ~autoComplete="off", - ~leftIcon={ - - }, - (), - ), - ~isRequired=false, - (), -) - -let primaryContactPerson = FormRenderer.makeFieldInfo( - ~label="Primary Contact Person", - ~name="primary_contact_person", - ~placeholder="Primary Contact Person", - ~customInput=InputFields.textInput(), - ~isRequired=true, - (), -) - -let secondaryContactPerson = FormRenderer.makeFieldInfo( - ~label="Secondary Contact Person", - ~name="secondary_contact_person", - ~placeholder="Secondary Contact Person", - ~customInput=InputFields.textInput(), - ~isRequired=true, - (), -) - -let website = FormRenderer.makeFieldInfo( - ~label="Website", - ~name="website", - ~placeholder="https://www.example.com", - ~customInput=InputFields.textInput(), - ~isRequired=false, - (), -) - -let aboutBusiness = FormRenderer.makeFieldInfo( - ~label="About Business", - ~name="about_business", - ~placeholder="About Business", - ~customInput=InputFields.multiLineTextInput( - ~isDisabled=false, - ~customClass="w-96", - ~rows=Some(6), - ~cols=Some(4), - (), - ), - ~isRequired=true, - (), -) - -let addressL1 = FormRenderer.makeFieldInfo( - ~label="", - ~name="line1", - ~placeholder="", - ~customInput=InputFields.textInput(), - (), -) - -let addressL2 = FormRenderer.makeFieldInfo( - ~label="", - ~name="line2", - ~placeholder="", - ~customInput=InputFields.textInput(), - (), -) -let addressL3 = FormRenderer.makeFieldInfo( - ~label="", - ~name="line3", - ~placeholder="", - ~customInput=InputFields.textInput(), - (), -) - -let addressCity = FormRenderer.makeFieldInfo( - ~label="", - ~name="city", - ~placeholder="City", - ~customInput=InputFields.textInput(), - (), -) - -let addressState = FormRenderer.makeFieldInfo( - ~label="", - ~name="state", - ~placeholder="State", - ~customInput=InputFields.textInput(), - (), -) - -let addressZip = FormRenderer.makeFieldInfo( - ~label="", - ~name="zip", - ~placeholder="Zip", - ~customInput=InputFields.textInput(), - (), -) - -let primaryEmail = FormRenderer.makeFieldInfo( - ~label="Primary Email", - ~name="primary_email", - ~placeholder="Primary Email", - ~isRequired=true, - ~customInput=InputFields.textInput(), - (), -) - -let secondaryEmail = FormRenderer.makeFieldInfo( - ~label="Secondary Email", - ~name="secondary_email", - ~placeholder="Secondary Email", - ~isRequired=true, - ~customInput=InputFields.textInput(), - (), -) - -let primaryPhone = FormRenderer.makeFieldInfo( - ~label="Primary Phone", - ~name="primary_phone", - ~placeholder="Primary Phone", - ~isRequired=true, - ~customInput=InputFields.textInput(), - (), -) - -let secondaryPhone = FormRenderer.makeFieldInfo( - ~label="Secondar Phone", - ~name="secondary_phone", - ~placeholder="Secondary Phone", - ~isRequired=true, - ~customInput=InputFields.textInput(), - (), -) - let parseKey = api_key => { api_key->Js.String2.slice(~from=0, ~to_=6)->Js.String2.concat(Js.String2.repeat("*", 20)) } @@ -244,60 +52,6 @@ let confirmPasswordCheck = (value, key, confirmKey, passwordKey, valuesDict, err } } -let validateChangePasswordForm = ( - values: Js.Json.t, - ~setIsDisabled=_ => (), - keys: array, -) => { - open LogicUtils - let valuesDict = switch values->Js.Json.decodeObject { - | Some(dict) => - dict - ->Js.Dict.entries - ->Array.reduce(Js.Dict.empty(), (acc, entry) => { - let (key, value) = entry - switch value->Js.Json.decodeString { - | Some(strVal) => Js.Dict.set(acc, key, strVal->Js.Json.string) - | None => () - } - acc - }) - | None => Js.Dict.empty() - } - - let errors = Js.Dict.empty() - - keys->Js.Array2.forEach(key => { - let value = valuesDict->getString(key, "") - - // empty check - if value == "" { - switch key { - | "oldPassword" => Js.Dict.set(errors, key, "Please enter your Old Password"->Js.Json.string) - | "password" => Js.Dict.set(errors, key, "Please enter your New Password"->Js.Json.string) - | "comfirmPassword" => - Js.Dict.set(errors, key, "Please enter your New Password Once Again"->Js.Json.string) - | _ => - Js.Dict.set( - errors, - key, - `${key->LogicUtils.capitalizeString} cannot be empty`->Js.Json.string, - ) - } - } - - // password check - passwordKeyValidation(value, key, "password", errors) - - // confirm password check - confirmPasswordCheck(value, key, "comfirmPassword", "password", valuesDict, errors) - }) - - errors == Js.Dict.empty() ? setIsDisabled(_ => false) : setIsDisabled(_ => true) - - errors->Js.Json.object_ -} - let parseBussinessProfileJson = (profileRecord: profileEntity) => { open LogicUtils let { @@ -366,32 +120,6 @@ let parseMerchantJson = (merchantDict: merchantPayload) => { merchantInfo } -let convertJsontoDict = (values: Js.Json.t) => { - switch values->Js.Json.decodeObject { - | Some(dict) => - dict - ->Js.Dict.entries - ->Array.reduce(Js.Dict.empty(), (acc, entry) => { - let (key, value) = entry - switch key { - | "primary_business_details" => - switch value->Js.Json.decodeArray { - | Some(strVal) => Js.Dict.set(acc, key, strVal->Js.Json.array) - | None => () - } - | _ => - switch value->Js.Json.decodeString { - | Some(strVal) => Js.Dict.set(acc, key, strVal->Js.Json.string) - | None => () - } - } - - acc - }) - | None => Js.Dict.empty() - } -} - let constructWebhookDetailsObject = webhookDetailsDict => { open LogicUtils let webhookDetails = { @@ -809,11 +537,9 @@ let useFetchMerchantDetails = () => { try { let accountUrl = APIUtils.getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Get, ()) let merchantDetailsJSON = await fetchDetails(accountUrl) - setMerchantDetailsValue(._ => merchantDetailsJSON->Js.Json.stringify) } catch { - | Js.Exn.Error(e) => - let _err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + | _ => () } } } diff --git a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res index 9c81f4689..40478cbdf 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res @@ -28,9 +28,7 @@ module MerchantDetailsSection = { setMerchantInfo(_ => requiredInfo) setScreenState(_ => PageLoaderWrapper.Success) } catch { - | Js.Exn.Error(e) => - let _err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") - setScreenState(_ => PageLoaderWrapper.Custom) + | Js.Exn.Error(_) => setScreenState(_ => PageLoaderWrapper.Custom) } } React.useEffect0(() => {