zoid-helper

v0.0.5arrow_drop_down
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
2,242
VISIBILITY
Public
PUBLISHED
4 years ago
SIZE
3 KB
Contexts, hooks, and definitions to help the app interact with Global Frontend
1 contributor
Install zoid-helper as a package?
Copied
npm i @bit/equipmentshare.global.libs.zoid-helper
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
modifieddraft
chevron_left
chevron_right

EventTypesEnum

Enum of available event types the app can dispatch events

Available Types

  • GO_TO_ORDER_ID
  • GO_TO_INVOICE_ID
Example
import { EventTypesEnum } from '@bit/equipmentshare.global.libs.zoid-helper';

console.log(EventTypesEnum.GO_TO_ORDER_ID) // `GO_TO_ORDER_ID`

EventTypes type

Example
import { EventTypes } from '@bit/equipmentshare.global.libs.zoid-helper';

const wrongEventType: EventTypes = `SOME_EVENT` // Typescript error
const correctEventType: EventTypes = `GO_TO_ORDER_ID` // pass

IZoidProps interface

Available component props the app can receive and use. For more information, please see documentation

useZoidPropsUpdater

React hook to manage props from the container and pass them to ZoidPropsContext

Example
import { useZoidPropsUpdater } from '@bit/equipmentshare.global.libs.zoid-helper';
 
 // pass in your window.xprops here
 const pluginProps = useZoidPropsUpdater(containerProps);

ZoidPropsContext

Share the zoid props from the container to your components downstream

Example
import React from 'react';
import { useZoidPropsUpdater, ZoidPropsContext } from '@bit/equipmentshare.global.libs.zoid-helper';

const App = (props) => {
const pluginProps = useZoidPropsUpdater(props);

return (
<ZoidPropsContext.Provider value={pluginProps}>
Contents here
</ZoidPropsContext.Provider>
);
}

// window.xprops is a global variable populated by Zoid
export default (
<App {...window[`xprops`]} />
)
Help and resources