Skip to content

Commit

Permalink
[#546] move provider types/change names
Browse files Browse the repository at this point in the history
  • Loading branch information
Sworzen1 committed Apr 11, 2024
1 parent e3221c6 commit a99939a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ changes.

## [Unreleased]

- Inicjalize Usersnap into App [Issue 546](https://github.com/IntersectMBO/govtool/issues/546)
- Inicialize Usersnap into App [Issue 546](https://github.com/IntersectMBO/govtool/issues/546)
- Integrate frontend with metadata validation service [Issue 617](https://github.com/IntersectMBO/govtool/issues/617)
- Implement a loading modal for the validation of the metadata [Issue 646](https://github.com/IntersectMBO/govtool/issues/646)

Expand Down
22 changes: 12 additions & 10 deletions govtool/frontend/src/context/usersnapContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ import {

const API_KEY = import.meta.env.VITE_USERSNAP_SPACE_API_KEY;

const defaultValues = {
openFeedbackWindow: () => {},
type UsersnapProviderProps = {
initParams?: InitOptions;
children?: React.ReactNode;
};

export const UsersnapContext = React.createContext(defaultValues);

type API = {
type UsersnapAPI = {
init: (params?: InitOptions | undefined) => Promise<void>;
logEvent: (eventName: string) => Promise<void>;
show: (apiKey: string) => Promise<WidgetApi>;
Expand All @@ -29,14 +28,17 @@ type API = {
off: (eventName: SpaceEventName, callback: SpaceEventCallback) => void;
};

const defaultValues = {
openFeedbackWindow: () => {},
};

export const UsersnapContext = React.createContext(defaultValues);

export const UsersnapProvider = ({
initParams,
children,
}: {
initParams?: InitOptions;
children?: React.ReactNode;
}) => {
const [usersnapApi, setUsersnapApi] = useState<API | null>(null);
}: UsersnapProviderProps) => {
const [usersnapApi, setUsersnapApi] = useState<UsersnapAPI | null>(null);

const openFeedbackWindow = useCallback(() => {
if (usersnapApi) {
Expand Down

0 comments on commit a99939a

Please sign in to comment.