0.1.0 • Published 1 year ago

pj-package-portal-verifyme v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Picklejar Package: Portal Verify Me

Description

Picklejar portal verify me is a package that provides a PicklejarIDVerification component.

Installation

yarn install picklejar-package-portal-vefiryme

Picklejar ID Verification Landing Page Usage

  • Import the package
import { PicklejarIDVerification } from 'package-portal-verifyme';
  • Wrap your app with the AppContext, UserProvider, NotificationProvider and ThemeProvider components
<PicklejarIDVerification redirectOnSuccess={PICKLEJAR_DEFAULT_PROFILE_PAGE_URL}/>;

Picklejar ID Verification Landing Page Usage

  • Import the package
import { PicklejarIDVerification } from 'package-portal-verifyme';
  • Wrap your app with the AppContext, UserProvider, NotificationProvider and ThemeProvider components
const App = props => {
  const { sessionKey } = props;

  const environment = useMemo(() => getEnvironment(), []);

  const apiHost = getApiHost(environment);
  const host = getHost(environment);

  const appContextValue = useMemo(() => (
    { host, apiHost }
  ), [host, apiHost]);
  return (
    <AppContext.Provider value={appContextValue}>
      <UserProvider sessionKey={sessionKey}>
        <NotificationProvider>
          <NotificationBar/>
          <UserContext.Consumer>
            {context => {
              const { isLogged, status } = context;
              return (
                <ThemeProvider theme={PicklejarTheme}>
                  <div className="App">
                    ...
                    <Routes>
                      {isLogged && <Route
                        exact
                        path="/verify-id"
                        element={<PicklejarIDVerification redirectOnSuccess={PICKLEJAR_DEFAULT_PROFILE_PAGE_URL}/>}
                      />}
                    </Routes>
                    ...
                  </div>
                </ThemeProvider>
              );
            }}
          </UserContext.Consumer>
        </NotificationProvider>
      </UserProvider>
    </AppContext.Provider>
  );
};

App.defaultProps = {
  sessionKey: 'session_key_value'
};

App.propTypes = {
  sessionKey: PropTypes.string
};

export default App;