2.12.1 • Published 10 months ago

@oaknational/oak-pupil-client v2.12.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Oak Pupil Client

License: MIT

The Pupil Client is a React TypeScript client to interface with the Oak Pupil API.

Installation

To integrate the Oak Pupil Client into your project, you will need React 18 later. Install the package using NPM or your preferred package manager:

npm i @oaknational/oak-pupil-client

Usage

Setting up the client

Wrap your app with the provider

import { OakPupilClientProvider } from "@oaknational/oak-pupil-client";

export const MyView = ({ children }: { children: React.ReactNode }) => {
  return (
    <OakPupilClientProvider
      config={{
        getLessonAttemptUrl: "https://example.com/get-lessom-attempt",
        logLessonAttemptUrl: "http://example.com/log-lesson-attempt",
      }}
    >
      {children}
    </OakPupilClientProvider>
  );
};

Using the Hook

For components that need to interact with the state, the useOakPupil hook can be utilised. This hook provides access to the current state, allowing users to log and retrieve lesson attempts.

import { useOakPupil } from "@oaknational/oak-pupil-client";

function MyComponent() {
  const { state } = useOakPupil();

  useEffect(() => {
    if (requiresInteraction) {
      showCookieBanner(); // you're expected to handle any UI and its associated state
    }
  }, [requiresInteraction]);
}

External Contributions

Security and Bug Bounty

Please see our security.txt file.

Contributing to the Code

While the Oak Pupil Client is currently not open for direct contributions, we encourage you to report any issues or suggest enhancements through the GitHub issue tracker. Your feedback is invaluable in making this tool more effective for developers.

Open Source Acknowledgements

As with all web projects we are dependent on open source libraries maintained by others. While it is not practical to acknowledge them all, we would nevertheless like to express our gratitude for the contributions and efforts of the OSS community. Our dependency list can be found in our package.json file.

License

Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation. Where any Oak National Academy trademarks or logos are included, these are not released under the MIT License, and should be used in line with Oak National Academy brand guidelines.

Any documentation included is © Oak National Academy and available under the terms of the Open Government Licence v3.0, except where otherwise stated.

2.12.1

10 months ago

2.12.0

10 months ago

2.11.0

10 months ago

2.10.0

10 months ago

2.9.0

10 months ago

2.8.0

10 months ago

2.7.0

10 months ago

2.6.0

10 months ago

2.5.0

10 months ago

2.3.0

11 months ago

2.4.0

11 months ago

2.2.0

11 months ago

0.0.0

11 months ago