diff --git a/.changeset/cyan-files-suffer.md b/.changeset/cyan-files-suffer.md new file mode 100644 index 0000000..6ed1feb --- /dev/null +++ b/.changeset/cyan-files-suffer.md @@ -0,0 +1,5 @@ +--- +"saleor-app-search": patch +--- + +Use input component from the shared package. diff --git a/apps/search/next.config.js b/apps/search/next.config.js index 4f637e1..0dafa2f 100644 --- a/apps/search/next.config.js +++ b/apps/search/next.config.js @@ -23,7 +23,7 @@ const moduleExports = { }, ], }, - transpilePackages: ["@saleor/apps-shared", "@saleor/apps-ui"], + transpilePackages: ["@saleor/apps-shared", "@saleor/apps-ui", "@saleor/react-hook-form-macaw"], sentry: { /* * Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` diff --git a/apps/search/package.json b/apps/search/package.json index 7efebbd..582e4ba 100644 --- a/apps/search/package.json +++ b/apps/search/package.json @@ -20,6 +20,7 @@ "@saleor/app-sdk": "0.38.0", "@saleor/apps-shared": "workspace:*", "@saleor/apps-ui": "workspace:*", + "@saleor/react-hook-form-macaw": "workspace:*", "@saleor/macaw-ui": "^0.8.0-pre.84", "@sentry/nextjs": "^7.46.0", "@types/debug": "^4.1.7", diff --git a/apps/search/src/components/AlgoliaConfigurationForm.tsx b/apps/search/src/components/AlgoliaConfigurationForm.tsx index dd46ebd..c6dc8a0 100644 --- a/apps/search/src/components/AlgoliaConfigurationForm.tsx +++ b/apps/search/src/components/AlgoliaConfigurationForm.tsx @@ -1,9 +1,10 @@ import { useAuthenticatedFetch } from "@saleor/app-sdk/app-bridge"; -import { Controller, useForm } from "react-hook-form"; +import { useForm } from "react-hook-form"; import { useMutation, useQuery, useQueryClient } from "react-query"; import { fetchConfiguration } from "../lib/configuration"; -import { Box, Button, Divider, Input, Text } from "@saleor/macaw-ui/next"; +import { Box, Button, Divider, Text } from "@saleor/macaw-ui/next"; +import { Input } from "@saleor/react-hook-form-macaw"; import { useDashboardNotification } from "@saleor/apps-shared"; import { AlgoliaSearchProvider } from "../lib/algolia/algoliaSearchProvider"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -93,61 +94,33 @@ export const AlgoliaConfigurationForm = () => {
- { - return ( - - ); - }} + name="appId" + disabled={isFormDisabled} + required + label="Application ID" + helperText="Usually 10 characters, e.g. XYZAAABB00" /> - ( - - )} + name="secretKey" + disabled={isFormDisabled} + required + label="Admin API Key" + helperText="In Algolia dashboard it's a masked field" /> - { - return ( - - ); - }} + name="indexNamePrefix" + disabled={isFormDisabled} + required + label="Index name prefix" + helperText='Optional prefix, you can add "test" or "staging" to test the app' /> {credentialsValidationError && ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 148ae5f..cd6868b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1251,6 +1251,9 @@ importers: '@saleor/macaw-ui': specifier: ^0.8.0-pre.84 version: 0.8.0-pre.84(@types/react@18.0.38)(react-dom@18.2.0)(react@18.2.0) + '@saleor/react-hook-form-macaw': + specifier: workspace:* + version: link:../../packages/react-hook-form-macaw '@sentry/nextjs': specifier: ^7.46.0 version: 7.46.0(next@13.3.0)(react@18.2.0)