open-index/open-npm huggingface dataset:
npm package: @qlibs/utils
Description: ``` const {     isLoadingPromiseAllData: isLoading,     promiseAllData,     fetchPromiseAllData,   } = usePromiseAllData<IPromiseAllData>({     httpRequest: httpRequest as any,     endpoints: [       {         endpoint: '/users/' + params.userId,         
Author: QBIT Developer
Latest version: 1.14.7

## usePromiseAllData
```
const {
    isLoadingPromiseAllData: isLoading,
    promiseAllData,
    fetchPromiseAllData,
  } = usePromiseAllData<IPromiseAllData>({
    httpRequest: httpRequest as any,
    endpoints: [
      {
        endpoint: '/users/' + params.userId,
        returnKey: 'user',
      },
      {
        endpoint: selectedProgram?.programId
          ? `evaluation-calculator/${selectedProgram?.programId}/${params.userId}`
          : `evaluation-calculator/${params.userId}`,
        returnKey: 'competencies',
      },
    ],
  });

  useEffect(() => {
    fetchPromiseAllData();
  }, []);
```

## useAdditionalDataForList
```
const { isLoadingAdditionalData, additionalData } =
    useAdditionalDataForList<IAdditionalData>({
      httpRequest: httpRequest as any,
      id: 'attendanceId',
      data,
      injects: [
        {
          injectedId: 'userId',
          endpoint: '/users?filterStatus=active&roles=talent&userIds=',
          endpointId: 'userId',
          returnKey: 'user',
        },
        props.type === 'EVENT' ? {
          injectedId: 'eventId',
          endpoint: '/event?eventIds=',
          endpointId: 'eventId',
          returnKey: 'event',
        } : {injectedId: '', endpoint: '', returnKey: '', endpointId: ''},
      ].filter(item => item?.injectedId),
    });
```

## TRACK ME
### How to use TrackMe
```
const {insertData} = useTrackData();
const location = useLocation()

<TrackMe 
  appName='QLIBS'
  userId='QLIBS_userId'
  userData={{name: 'QLIBS_user_name'}}
  processUpload={(
    activities: IActivity[],
    onSuccess: (ids: number[]) => void
  ) => {
    console.info('before onSuccess activities', activities);
    onSuccess(activities.map(item => (item as any).activityId));
  }}
  location={location}
  autoUploadConfig={{
    intervalInMs: 5000,
  }}
  isDemo={true}
/>
```

```
useTrackerIndexedDB({
  appName: "PROJECT_NAME",
  userId: user.userId,
  userData: user,
  processUpload: (activities: IActivity[], onSuccess: (ids: number[]) => void) => {
    httpRequest
      .post(process.env.REACT_APP_API_URL_TRACKME || '', { bulk: activities })
      .then((res: any) => {
        onSuccess((res.data.payload || []).map((item: any) => item.activityId));
      })
      .catch((err) => {
        message.error(getErrorMessage(err));
      });
  },
});
```

### How to don't track me
```
<button data-trackme="false">WILL NOT TRACKED</button>
```
npm package: @qlibs/utils-fe
Description: Just general reusable functions
Author: QBIT Developer
Latest version: 1.1.0

# LIBS-UTILS-FE
Just general reusable functions

## How to Install
`npm install @qlibs/utils-fe` or `yarn add @qlibs/utils-fe`

## Supported Permission Data (Example)
```
const EXAMPLE_BASE_PERMISSIONS: IFeaturePermissionV2 = {
  AUTH: ['LOGIN_CMS', 'LOGIN_WEB'],
  BANNER: ['VIEW', 'CREATE', 'UPDATE'],
  PROJECT: {
    PROJECT_1: ['VIEW', 'CREATE', 'UPDATE'],
    PROJECT_2: ['VIEW'],
  },
  USER: ['VIEW', 'CREATE', 'UPDATE'],
};

const EXAMPLE_USER_PERMISSIONS: IFeaturePermissionV2 = {
  AUTH: ['LOGIN_CMS', 'LOGIN_WEB'],
  PROJECT: {
    PROJECT_1: ['VIEW', 'CREATE', 'UPDATE'],
    PROJECT_2: ['VIEW'],
  },
  USER: ['VIEW', 'CREATE', 'UPDATE'],
};

```

## Available Methods
1. detectPermission
```
const permissionVersion = detectPermissionVersion(EXAMPLE_USER_PERMISSIONS);
console.info('permissionVersion', permissionVersion); // v1 | v2 | null
```

2. hasPermission
```
const isHasPermission = hasPermission(
  EXAMPLE_USER_PERMISSIONS,
  requiredPermissions: ["USER.VIEW"],
  "OR"
);
console.info('isHasPermission', isHasPermission); // true | false

```

3. injectSubFeatures
```
const result = injectSubFeatures("USER", ["project_id_1", "project_id_2"], EXAMPLE_USER_PERMISSIONS)
```

4. syncExistingDataWithBasePermission
```
const syncResult = syncExistingDataWithBasePermission(
  EXAMPLE_USER_PERMISSIONS, // data from database
  EXAMPLE_BASE_PERMISSIONS, // all features & permissions
  {
    autoEnableAllActionsForNewFeature: false;
  }
)
console.info('syncResult', syncResult); // result will follow the type "IFeaturePermissionV2"
```

5. generateFrontendPermissionData
```
const generatedFrontendPermissionData = generateFrontendPermissionData(
  EXAMPLE_USER_PERMISSIONS, // data from database
)
console.info('generatedFrontendPermissionData', generatedFrontendPermissionData); // result will follow the type "IFeaturePermissionV2"
```