New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trackunit/react-core-hooks

Package Overview
Dependencies
Maintainers
4
Versions
419
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trackunit/react-core-hooks - npm Package Compare versions

Comparing version 1.0.7 to 1.0.9

171

index.cjs.js
'use strict';
var React = require('react');
var react = require('react');
var jsxRuntime = require('react/jsx-runtime');

@@ -8,22 +8,3 @@ var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');

function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
const AnalyticsContext = React.createContext(null);
const AnalyticsContext = react.createContext(null);
const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import

@@ -47,8 +28,8 @@ /**

const useAnalytics = (events) => {
const context = React.useContext(AnalyticsContext);
const context = react.useContext(AnalyticsContext);
if (!context) {
throw new Error("useAnalytics must be used within an AnalyticsProvider");
}
const logEvent = React.useMemo(() => logEventWithDescription(context.logEvent, events), [context.logEvent, events]);
return React.useMemo(() => {
const logEvent = react.useMemo(() => logEventWithDescription(context.logEvent, events), [context.logEvent, events]);
return react.useMemo(() => {
return {

@@ -79,3 +60,3 @@ ...context,

const AssetSortingContext = React.createContext(null);
const AssetSortingContext = react.createContext(null);
/**

@@ -114,3 +95,3 @@ * This is a provider for the AssetSortingContext.

const useAssetSorting = () => {
const context = React.useContext(AssetSortingContext);
const context = react.useContext(AssetSortingContext);
if (!context) {

@@ -122,3 +103,3 @@ throw new Error("useAssetSorting must be used within a AssetSortingProvider");

const ConfirmationDialogContext = React__namespace.createContext(null);
const ConfirmationDialogContext = react.createContext(null);
/**

@@ -132,3 +113,3 @@ * This is a provider for the ConfirmationDialogContext.

const useConfirmationDialog = () => {
const confirmationDialogContext = React__namespace.useContext(ConfirmationDialogContext);
const confirmationDialogContext = react.useContext(ConfirmationDialogContext);
if (!confirmationDialogContext) {

@@ -140,3 +121,3 @@ throw new Error("useConfirmationDialog must be used within the ConfirmationDialogProvider");

const EnvironmentContext = React.createContext(null);
const EnvironmentContext = react.createContext(null);
/**

@@ -159,3 +140,3 @@ * This is a provider for the EnvironmentContext.

const useEnvironment = () => {
const context = React.useContext(EnvironmentContext);
const context = react.useContext(EnvironmentContext);
if (!context) {

@@ -167,3 +148,3 @@ throw new Error("useEnvironment must be used within an EnvironmentContext");

const ErrorHandlingContext = React.createContext(null);
const ErrorHandlingContext = react.createContext(null);
const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy import

@@ -184,3 +165,3 @@ /**

const useErrorHandler = () => {
const context = React.useContext(ErrorHandlingContext);
const context = react.useContext(ErrorHandlingContext);
if (!context) {

@@ -211,3 +192,3 @@ throw new Error("useErrorHandler must be used within an ErrorHandlingContextProvider");

const FilterBarContext = React__namespace.createContext(null);
const FilterBarContext = react.createContext(null);
/**

@@ -228,3 +209,3 @@ * This is a hook to use the FilterBarProvider.

const useFilterBarContext = () => {
const context = React__namespace.useContext(FilterBarContext);
const context = react.useContext(FilterBarContext);
if (!context) {

@@ -240,3 +221,3 @@ throw new Error("useFilterBar must be used within the FilterBarContext");

const TokenContext = React__namespace.createContext(null);
const TokenContext = react.createContext(null);
/**

@@ -252,3 +233,3 @@ * This is a hook to use the TokenContext.

const useToken = () => {
const context = React__namespace.useContext(TokenContext);
const context = react.useContext(TokenContext);
if (!context) {

@@ -294,4 +275,4 @@ throw new Error("useToken must be used within the TokenContext");

const { token } = useToken();
const [loading, setLoading] = React.useState(false);
const uploadImage = React.useCallback(({ postUrl, base64Image, type, authorize, }) => {
const [loading, setLoading] = react.useState(false);
const uploadImage = react.useCallback(({ postUrl, base64Image, type, authorize, }) => {
setLoading(true);

@@ -333,3 +314,3 @@ return new Promise((resolve, reject) => {

const { publicUrl, buildVersion, isFeatureBranch } = useEnvironment();
const featureBranchQueryParam = React.useMemo(() => (!publicUrl || !isFeatureBranch ? "" : `?fb_url=${encodeURIComponent(publicUrl)}&fb_version=${buildVersion}`), [publicUrl, buildVersion, isFeatureBranch]);
const featureBranchQueryParam = react.useMemo(() => (!publicUrl || !isFeatureBranch ? "" : `?fb_url=${encodeURIComponent(publicUrl)}&fb_version=${buildVersion}`), [publicUrl, buildVersion, isFeatureBranch]);
return { featureBranchQueryParam };

@@ -354,3 +335,3 @@ };

// Add Auth headers to all fetch requests
const headers = React.useMemo(() => ({
const headers = react.useMemo(() => ({
...tracingHeaders,

@@ -366,3 +347,3 @@ "commit-number": `${tracingHeaders["commit-number"]}`,

*/
const getAppUrl = React.useCallback(({ irisAppId, version }) => {
const getAppUrl = react.useCallback(({ irisAppId, version }) => {
return `${irisAppSdkServerUrl}app/${irisAppId}@${version}/`;

@@ -376,3 +357,3 @@ }, [irisAppSdkServerUrl]);

*/
const getAppImage = React.useCallback(async ({ irisAppUrl, logoPath }) => {
const getAppImage = react.useCallback(async ({ irisAppUrl, logoPath }) => {
if (!logoPath) {

@@ -391,3 +372,3 @@ return null;

const OEMBrandingService = React.createContext(null);
const OEMBrandingService = react.createContext(null);
/**

@@ -405,3 +386,3 @@ * This is a hook to use the OemBrandingContext.

const useOemBrandingContext = () => {
const context = React.useContext(OEMBrandingService);
const context = react.useContext(OEMBrandingService);
if (!context) {

@@ -419,3 +400,3 @@ throw new Error("useOemBranding must be used within an OemBrandingContextProvider");

const ModalDialogContext = React__namespace.createContext(null);
const ModalDialogContext = react.createContext(null);
/**

@@ -429,3 +410,3 @@ * This is a provider for the ModalDialogContext.

const useModalDialogContext = () => {
const modalDialogContext = React__namespace.useContext(ModalDialogContext);
const modalDialogContext = react.useContext(ModalDialogContext);
if (!modalDialogContext) {

@@ -437,3 +418,3 @@ throw new Error("useModalDialogContext must be used within the ModalDialogContextProvider");

const NavigationContext = React.createContext(null);
const NavigationContext = react.createContext(null);
/**

@@ -454,3 +435,3 @@ * This is a provider for the NavigationContext.

const useNavigateInHost = () => {
const context = React.useContext(NavigationContext);
const context = react.useContext(NavigationContext);
if (!context) {

@@ -477,8 +458,8 @@ throw new Error("useNavigateInHost must be used within an NavigationContext");

const useHasAccessTo = (options) => {
const context = React.useContext(NavigationContext);
const context = react.useContext(NavigationContext);
if (!context) {
throw new Error("useHasAccessTo must be used within an NavigationContext");
}
const [hasAccess, setHasAccess] = React.useState();
React.useEffect(() => {
const [hasAccess, setHasAccess] = react.useState();
react.useEffect(() => {
async function checkAccess() {

@@ -512,6 +493,6 @@ if (options.assetId) {

const useAssetRuntime = () => {
const [assetInfo, setAssetInfo] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [assetInfo, setAssetInfo] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getAssetInfo = async () => {

@@ -552,6 +533,6 @@ setLoading(true);

const useCustomerRuntime = () => {
const [customerInfo, setCustomerInfo] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [customerInfo, setCustomerInfo] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getCustomerInfo = async () => {

@@ -592,6 +573,6 @@ setLoading(true);

const useEventRuntime = () => {
const [eventInfo, setEventInfo] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [eventInfo, setEventInfo] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getEventInfo = async () => {

@@ -631,6 +612,6 @@ setLoading(true);

const useIrisAppName = () => {
const [appName, setAppName] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [appName, setAppName] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getAppName = async () => {

@@ -669,6 +650,6 @@ setLoading(true);

const useIrisAppId = () => {
const [irisAppId, setIrisAppId] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [irisAppId, setIrisAppId] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getAppName = async () => {

@@ -710,6 +691,6 @@ setLoading(true);

const useSiteRuntime = () => {
const [siteInfo, setSiteInfo] = React.useState();
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState();
React.useEffect(() => {
const [siteInfo, setSiteInfo] = react.useState();
const [loading, setLoading] = react.useState(true);
const [error, setError] = react.useState();
react.useEffect(() => {
const getSiteInfo = async () => {

@@ -732,3 +713,3 @@ setLoading(true);

const UserSubscriptionContext = React__namespace.createContext(null);
const UserSubscriptionContext = react.createContext(null);
/**

@@ -752,3 +733,3 @@ * This is a provider for the UserSubscriptionContext.

const useUserSubscription = () => {
const context = React__namespace.useContext(UserSubscriptionContext);
const context = react.useContext(UserSubscriptionContext);
if (!context) {

@@ -760,3 +741,3 @@ throw new Error("Cannot use useUserSubscription outside UserSubscriptionProvider");

const ToastContext = React__namespace.createContext(null);
const ToastContext = react.createContext(null);
/**

@@ -784,3 +765,3 @@ * This is a provider for the ToastContext.

const useToast = () => {
const toastContext = React__namespace.useContext(ToastContext);
const toastContext = react.useContext(ToastContext);
if (!toastContext) {

@@ -802,4 +783,4 @@ throw new Error("useToast must be used within the ToastProvider");

function useTextSearch(items, props) {
const [searchText, setSearchText] = React.useState("");
const result = React.useMemo(() => {
const [searchText, setSearchText] = react.useState("");
const result = react.useMemo(() => {
if (!searchText) {

@@ -813,3 +794,3 @@ return items;

const CurrentUserPreferenceContext = React.createContext(null);
const CurrentUserPreferenceContext = react.createContext(null);
/**

@@ -834,7 +815,7 @@ *

const useCurrentUserLanguage = () => {
const context = React.useContext(CurrentUserPreferenceContext);
const context = react.useContext(CurrentUserPreferenceContext);
if (!context) {
throw new Error("useCurrentUserLanguage must be used within the CurrentUserPreferenceProvider");
}
return React.useMemo(() => {
return react.useMemo(() => {
// This is there to make sure that the language is set on the global object so Graphql can use it.

@@ -861,7 +842,7 @@ global.language = context.language;

const useCurrentUserTimeZonePreference = () => {
const context = React.useContext(CurrentUserPreferenceContext);
const context = react.useContext(CurrentUserPreferenceContext);
if (!context) {
throw new Error("useCurrentUserTimeZone must be used within the CurrentUserPreferenceProvider");
}
return React.useMemo(() => {
return react.useMemo(() => {
return {

@@ -886,7 +867,7 @@ timeZonePreference: context.timeZonePreference,

const useCurrentUserSystemOfMeasurement = () => {
const context = React.useContext(CurrentUserPreferenceContext);
const context = react.useContext(CurrentUserPreferenceContext);
if (!context) {
throw new Error("useCurrentUserSystemOfMeasurement must be used within the CurrentUserPreferenceProvider");
}
return React.useMemo(() => {
return react.useMemo(() => {
return {

@@ -899,3 +880,3 @@ systemOfMeasurement: context.systemOfMeasurement || null,

const CurrentUserContext = React.createContext(null);
const CurrentUserContext = react.createContext(null);
/**

@@ -922,3 +903,3 @@ * This is a provider for the CurrentUserContext.

const useCurrentUser = () => {
const context = React__namespace.useContext(CurrentUserContext);
const context = react.useContext(CurrentUserContext);
if (!context) {

@@ -977,4 +958,4 @@ throw new Error("useCurrentUser must be used within the CurrentUserProvider");

const usePrevious = (value) => {
const ref = React.useRef();
React.useEffect(() => {
const ref = react.useRef();
react.useEffect(() => {
ref.current = value;

@@ -1008,3 +989,3 @@ }, [value]);

const prevState = usePrevious(state);
React.useEffect(() => {
react.useEffect(() => {
if (JSON.stringify(prevState) === JSON.stringify(state)) {

@@ -1048,3 +1029,3 @@ return;

}
const [state, setState] = React.useState(initLocalStorageState({ key, defaultState, schema }));
const [state, setState] = react.useState(initLocalStorageState({ key, defaultState, schema }));
useLocalStorageEffect({

@@ -1076,3 +1057,3 @@ key,

}
const [state, dispatch] = React.useReducer(reducer, defaultState, () => initLocalStorageState({ key, defaultState, schema }));
const [state, dispatch] = react.useReducer(reducer, defaultState, () => initLocalStorageState({ key, defaultState, schema }));
useLocalStorageEffect({ key, state, defaultState, schema, onValidationFailed, onValidationSuccessful });

@@ -1079,0 +1060,0 @@ return [state, dispatch];

@@ -1,2 +0,1 @@

import * as React from 'react';
import { createContext, useContext, useMemo, useState, useCallback, useEffect, useRef, useReducer } from 'react';

@@ -98,3 +97,3 @@ import { jsx } from 'react/jsx-runtime';

const ConfirmationDialogContext = React.createContext(null);
const ConfirmationDialogContext = createContext(null);
/**

@@ -108,3 +107,3 @@ * This is a provider for the ConfirmationDialogContext.

const useConfirmationDialog = () => {
const confirmationDialogContext = React.useContext(ConfirmationDialogContext);
const confirmationDialogContext = useContext(ConfirmationDialogContext);
if (!confirmationDialogContext) {

@@ -183,3 +182,3 @@ throw new Error("useConfirmationDialog must be used within the ConfirmationDialogProvider");

const FilterBarContext = React.createContext(null);
const FilterBarContext = createContext(null);
/**

@@ -200,3 +199,3 @@ * This is a hook to use the FilterBarProvider.

const useFilterBarContext = () => {
const context = React.useContext(FilterBarContext);
const context = useContext(FilterBarContext);
if (!context) {

@@ -212,3 +211,3 @@ throw new Error("useFilterBar must be used within the FilterBarContext");

const TokenContext = React.createContext(null);
const TokenContext = createContext(null);
/**

@@ -224,3 +223,3 @@ * This is a hook to use the TokenContext.

const useToken = () => {
const context = React.useContext(TokenContext);
const context = useContext(TokenContext);
if (!context) {

@@ -384,3 +383,3 @@ throw new Error("useToken must be used within the TokenContext");

const ModalDialogContext = React.createContext(null);
const ModalDialogContext = createContext(null);
/**

@@ -394,3 +393,3 @@ * This is a provider for the ModalDialogContext.

const useModalDialogContext = () => {
const modalDialogContext = React.useContext(ModalDialogContext);
const modalDialogContext = useContext(ModalDialogContext);
if (!modalDialogContext) {

@@ -688,3 +687,3 @@ throw new Error("useModalDialogContext must be used within the ModalDialogContextProvider");

const UserSubscriptionContext = React.createContext(null);
const UserSubscriptionContext = createContext(null);
/**

@@ -708,3 +707,3 @@ * This is a provider for the UserSubscriptionContext.

const useUserSubscription = () => {
const context = React.useContext(UserSubscriptionContext);
const context = useContext(UserSubscriptionContext);
if (!context) {

@@ -716,3 +715,3 @@ throw new Error("Cannot use useUserSubscription outside UserSubscriptionProvider");

const ToastContext = React.createContext(null);
const ToastContext = createContext(null);
/**

@@ -740,3 +739,3 @@ * This is a provider for the ToastContext.

const useToast = () => {
const toastContext = React.useContext(ToastContext);
const toastContext = useContext(ToastContext);
if (!toastContext) {

@@ -872,3 +871,3 @@ throw new Error("useToast must be used within the ToastProvider");

const useCurrentUser = () => {
const context = React.useContext(CurrentUserContext);
const context = useContext(CurrentUserContext);
if (!context) {

@@ -875,0 +874,0 @@ throw new Error("useCurrentUser must be used within the CurrentUserProvider");

{
"name": "@trackunit/react-core-hooks",
"version": "1.0.7",
"version": "1.0.9",
"repository": "https://github.com/Trackunit/manager",

@@ -13,5 +13,5 @@ "license": "SEE LICENSE IN LICENSE.txt",

"zod": "3.22.4",
"@trackunit/react-core-contexts-api": "^1.0.7",
"@trackunit/iris-app-runtime-core": "^1.0.7",
"@trackunit/shared-utils": "^1.1.1"
"@trackunit/react-core-contexts-api": "1.0.9",
"@trackunit/iris-app-runtime-core": "1.0.9",
"@trackunit/shared-utils": "1.2.1"
},

@@ -18,0 +18,0 @@ "module": "./index.esm.js",

import { ConfirmationDialogContextValue } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
export interface ConfirmationDialogContextProviderProps {
value: ConfirmationDialogContextValue;
children: React.ReactNode;
children: ReactNode;
}

@@ -7,0 +7,0 @@ /**

import { IFilterBarContext } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
/**

@@ -20,3 +20,3 @@ * This is a hook to use the FilterBarProvider.

value: IFilterBarContext;
children?: React.ReactNode;
children?: ReactNode;
}

@@ -23,0 +23,0 @@ /**

import { ModalDialogContextValue } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
export interface ModalDialogProviderProps {
value: ModalDialogContextValue;
children: React.ReactNode;
children: ReactNode;
}

@@ -7,0 +7,0 @@ /**

import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
interface IProps {
value: IUserSubscriptionContext;
children?: React.ReactNode;
children?: ReactNode;
}

@@ -7,0 +7,0 @@ /**

import { IToastContext } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
export interface ToastContextProviderProps {
value: IToastContext;
children: React.ReactNode;
children: ReactNode;
}

@@ -7,0 +7,0 @@ /**

import { ITokenContext } from "@trackunit/react-core-contexts-api";
import * as React from "react";
import { ReactNode } from "react";
/**

@@ -15,3 +15,3 @@ * This is a hook to use the TokenContext.

value: ITokenContext;
children?: React.ReactNode;
children?: ReactNode;
}

@@ -18,0 +18,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc