@trackunit/react-core-contexts-test 0.1.76 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HookRenderer.cjs +1 -0
- package/HookRenderer.js +1 -0
- package/index.cjs +1 -0
- package/index.js +1 -0
- package/index2.cjs +24 -520
- package/index2.js +23 -519
- package/package.json +3 -3
- package/src/TrackunitProvidersMockBuilder.d.ts +22 -0
package/index2.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as ReactDOMClient from 'react-dom/client';
|
|
|
8
8
|
import require$$0 from 'util';
|
|
9
9
|
import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, GlobalSelectionProvider, AssetSortingProvider } from '@trackunit/react-core-hooks';
|
|
10
10
|
import { tw } from '@trackunit/tailwind-styled-components';
|
|
11
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
11
12
|
|
|
12
13
|
function _mergeNamespaces(n, m) {
|
|
13
14
|
m.forEach(function (e) {
|
|
@@ -33670,525 +33671,6 @@ var lodash = {exports: {}};
|
|
|
33670
33671
|
}.call(commonjsGlobal));
|
|
33671
33672
|
}(lodash, lodash.exports));
|
|
33672
33673
|
|
|
33673
|
-
/**
|
|
33674
|
-
* @remix-run/router v1.6.2
|
|
33675
|
-
*
|
|
33676
|
-
* Copyright (c) Remix Software Inc.
|
|
33677
|
-
*
|
|
33678
|
-
* This source code is licensed under the MIT license found in the
|
|
33679
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33680
|
-
*
|
|
33681
|
-
* @license MIT
|
|
33682
|
-
*/
|
|
33683
|
-
function _extends() {
|
|
33684
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
33685
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33686
|
-
var source = arguments[i];
|
|
33687
|
-
|
|
33688
|
-
for (var key in source) {
|
|
33689
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33690
|
-
target[key] = source[key];
|
|
33691
|
-
}
|
|
33692
|
-
}
|
|
33693
|
-
}
|
|
33694
|
-
|
|
33695
|
-
return target;
|
|
33696
|
-
};
|
|
33697
|
-
return _extends.apply(this, arguments);
|
|
33698
|
-
}
|
|
33699
|
-
|
|
33700
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33701
|
-
//#region Types and Constants
|
|
33702
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33703
|
-
|
|
33704
|
-
/**
|
|
33705
|
-
* Actions represent the type of change to a location value.
|
|
33706
|
-
*/
|
|
33707
|
-
var Action;
|
|
33708
|
-
|
|
33709
|
-
(function (Action) {
|
|
33710
|
-
/**
|
|
33711
|
-
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
33712
|
-
* as a back or forward navigation. It does not describe the direction of the
|
|
33713
|
-
* navigation, only that the current index changed.
|
|
33714
|
-
*
|
|
33715
|
-
* Note: This is the default action for newly created history objects.
|
|
33716
|
-
*/
|
|
33717
|
-
Action["Pop"] = "POP";
|
|
33718
|
-
/**
|
|
33719
|
-
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
33720
|
-
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
33721
|
-
* entries in the stack are lost.
|
|
33722
|
-
*/
|
|
33723
|
-
|
|
33724
|
-
Action["Push"] = "PUSH";
|
|
33725
|
-
/**
|
|
33726
|
-
* A REPLACE indicates the entry at the current index in the history stack
|
|
33727
|
-
* being replaced by a new one.
|
|
33728
|
-
*/
|
|
33729
|
-
|
|
33730
|
-
Action["Replace"] = "REPLACE";
|
|
33731
|
-
})(Action || (Action = {}));
|
|
33732
|
-
/**
|
|
33733
|
-
* Memory history stores the current location in memory. It is designed for use
|
|
33734
|
-
* in stateful non-browser environments like tests and React Native.
|
|
33735
|
-
*/
|
|
33736
|
-
|
|
33737
|
-
function createMemoryHistory(options) {
|
|
33738
|
-
if (options === void 0) {
|
|
33739
|
-
options = {};
|
|
33740
|
-
}
|
|
33741
|
-
|
|
33742
|
-
let {
|
|
33743
|
-
initialEntries = ["/"],
|
|
33744
|
-
initialIndex,
|
|
33745
|
-
v5Compat = false
|
|
33746
|
-
} = options;
|
|
33747
|
-
let entries; // Declare so we can access from createMemoryLocation
|
|
33748
|
-
|
|
33749
|
-
entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined));
|
|
33750
|
-
let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
|
|
33751
|
-
let action = Action.Pop;
|
|
33752
|
-
let listener = null;
|
|
33753
|
-
|
|
33754
|
-
function clampIndex(n) {
|
|
33755
|
-
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
33756
|
-
}
|
|
33757
|
-
|
|
33758
|
-
function getCurrentLocation() {
|
|
33759
|
-
return entries[index];
|
|
33760
|
-
}
|
|
33761
|
-
|
|
33762
|
-
function createMemoryLocation(to, state, key) {
|
|
33763
|
-
if (state === void 0) {
|
|
33764
|
-
state = null;
|
|
33765
|
-
}
|
|
33766
|
-
|
|
33767
|
-
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key);
|
|
33768
|
-
warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to));
|
|
33769
|
-
return location;
|
|
33770
|
-
}
|
|
33771
|
-
|
|
33772
|
-
function createHref(to) {
|
|
33773
|
-
return typeof to === "string" ? to : createPath(to);
|
|
33774
|
-
}
|
|
33775
|
-
|
|
33776
|
-
let history = {
|
|
33777
|
-
get index() {
|
|
33778
|
-
return index;
|
|
33779
|
-
},
|
|
33780
|
-
|
|
33781
|
-
get action() {
|
|
33782
|
-
return action;
|
|
33783
|
-
},
|
|
33784
|
-
|
|
33785
|
-
get location() {
|
|
33786
|
-
return getCurrentLocation();
|
|
33787
|
-
},
|
|
33788
|
-
|
|
33789
|
-
createHref,
|
|
33790
|
-
|
|
33791
|
-
createURL(to) {
|
|
33792
|
-
return new URL(createHref(to), "http://localhost");
|
|
33793
|
-
},
|
|
33794
|
-
|
|
33795
|
-
encodeLocation(to) {
|
|
33796
|
-
let path = typeof to === "string" ? parsePath(to) : to;
|
|
33797
|
-
return {
|
|
33798
|
-
pathname: path.pathname || "",
|
|
33799
|
-
search: path.search || "",
|
|
33800
|
-
hash: path.hash || ""
|
|
33801
|
-
};
|
|
33802
|
-
},
|
|
33803
|
-
|
|
33804
|
-
push(to, state) {
|
|
33805
|
-
action = Action.Push;
|
|
33806
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33807
|
-
index += 1;
|
|
33808
|
-
entries.splice(index, entries.length, nextLocation);
|
|
33809
|
-
|
|
33810
|
-
if (v5Compat && listener) {
|
|
33811
|
-
listener({
|
|
33812
|
-
action,
|
|
33813
|
-
location: nextLocation,
|
|
33814
|
-
delta: 1
|
|
33815
|
-
});
|
|
33816
|
-
}
|
|
33817
|
-
},
|
|
33818
|
-
|
|
33819
|
-
replace(to, state) {
|
|
33820
|
-
action = Action.Replace;
|
|
33821
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33822
|
-
entries[index] = nextLocation;
|
|
33823
|
-
|
|
33824
|
-
if (v5Compat && listener) {
|
|
33825
|
-
listener({
|
|
33826
|
-
action,
|
|
33827
|
-
location: nextLocation,
|
|
33828
|
-
delta: 0
|
|
33829
|
-
});
|
|
33830
|
-
}
|
|
33831
|
-
},
|
|
33832
|
-
|
|
33833
|
-
go(delta) {
|
|
33834
|
-
action = Action.Pop;
|
|
33835
|
-
let nextIndex = clampIndex(index + delta);
|
|
33836
|
-
let nextLocation = entries[nextIndex];
|
|
33837
|
-
index = nextIndex;
|
|
33838
|
-
|
|
33839
|
-
if (listener) {
|
|
33840
|
-
listener({
|
|
33841
|
-
action,
|
|
33842
|
-
location: nextLocation,
|
|
33843
|
-
delta
|
|
33844
|
-
});
|
|
33845
|
-
}
|
|
33846
|
-
},
|
|
33847
|
-
|
|
33848
|
-
listen(fn) {
|
|
33849
|
-
listener = fn;
|
|
33850
|
-
return () => {
|
|
33851
|
-
listener = null;
|
|
33852
|
-
};
|
|
33853
|
-
}
|
|
33854
|
-
|
|
33855
|
-
};
|
|
33856
|
-
return history;
|
|
33857
|
-
}
|
|
33858
|
-
function invariant$2(value, message) {
|
|
33859
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
33860
|
-
throw new Error(message);
|
|
33861
|
-
}
|
|
33862
|
-
}
|
|
33863
|
-
function warning(cond, message) {
|
|
33864
|
-
if (!cond) {
|
|
33865
|
-
// eslint-disable-next-line no-console
|
|
33866
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
33867
|
-
|
|
33868
|
-
try {
|
|
33869
|
-
// Welcome to debugging history!
|
|
33870
|
-
//
|
|
33871
|
-
// This error is thrown as a convenience so you can more easily
|
|
33872
|
-
// find the source for a warning that appears in the console by
|
|
33873
|
-
// enabling "pause on exceptions" in your JavaScript debugger.
|
|
33874
|
-
throw new Error(message); // eslint-disable-next-line no-empty
|
|
33875
|
-
} catch (e) {}
|
|
33876
|
-
}
|
|
33877
|
-
}
|
|
33878
|
-
|
|
33879
|
-
function createKey() {
|
|
33880
|
-
return Math.random().toString(36).substr(2, 8);
|
|
33881
|
-
}
|
|
33882
|
-
/**
|
|
33883
|
-
* Creates a Location object with a unique key from the given Path
|
|
33884
|
-
*/
|
|
33885
|
-
|
|
33886
|
-
|
|
33887
|
-
function createLocation(current, to, state, key) {
|
|
33888
|
-
if (state === void 0) {
|
|
33889
|
-
state = null;
|
|
33890
|
-
}
|
|
33891
|
-
|
|
33892
|
-
let location = _extends({
|
|
33893
|
-
pathname: typeof current === "string" ? current : current.pathname,
|
|
33894
|
-
search: "",
|
|
33895
|
-
hash: ""
|
|
33896
|
-
}, typeof to === "string" ? parsePath(to) : to, {
|
|
33897
|
-
state,
|
|
33898
|
-
// TODO: This could be cleaned up. push/replace should probably just take
|
|
33899
|
-
// full Locations now and avoid the need to run through this flow at all
|
|
33900
|
-
// But that's a pretty big refactor to the current test suite so going to
|
|
33901
|
-
// keep as is for the time being and just let any incoming keys take precedence
|
|
33902
|
-
key: to && to.key || key || createKey()
|
|
33903
|
-
});
|
|
33904
|
-
|
|
33905
|
-
return location;
|
|
33906
|
-
}
|
|
33907
|
-
/**
|
|
33908
|
-
* Creates a string URL path from the given pathname, search, and hash components.
|
|
33909
|
-
*/
|
|
33910
|
-
|
|
33911
|
-
function createPath(_ref) {
|
|
33912
|
-
let {
|
|
33913
|
-
pathname = "/",
|
|
33914
|
-
search = "",
|
|
33915
|
-
hash = ""
|
|
33916
|
-
} = _ref;
|
|
33917
|
-
if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
33918
|
-
if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
33919
|
-
return pathname;
|
|
33920
|
-
}
|
|
33921
|
-
/**
|
|
33922
|
-
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
33923
|
-
*/
|
|
33924
|
-
|
|
33925
|
-
function parsePath(path) {
|
|
33926
|
-
let parsedPath = {};
|
|
33927
|
-
|
|
33928
|
-
if (path) {
|
|
33929
|
-
let hashIndex = path.indexOf("#");
|
|
33930
|
-
|
|
33931
|
-
if (hashIndex >= 0) {
|
|
33932
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
33933
|
-
path = path.substr(0, hashIndex);
|
|
33934
|
-
}
|
|
33935
|
-
|
|
33936
|
-
let searchIndex = path.indexOf("?");
|
|
33937
|
-
|
|
33938
|
-
if (searchIndex >= 0) {
|
|
33939
|
-
parsedPath.search = path.substr(searchIndex);
|
|
33940
|
-
path = path.substr(0, searchIndex);
|
|
33941
|
-
}
|
|
33942
|
-
|
|
33943
|
-
if (path) {
|
|
33944
|
-
parsedPath.pathname = path;
|
|
33945
|
-
}
|
|
33946
|
-
}
|
|
33947
|
-
|
|
33948
|
-
return parsedPath;
|
|
33949
|
-
}
|
|
33950
|
-
|
|
33951
|
-
var ResultType;
|
|
33952
|
-
|
|
33953
|
-
(function (ResultType) {
|
|
33954
|
-
ResultType["data"] = "data";
|
|
33955
|
-
ResultType["deferred"] = "deferred";
|
|
33956
|
-
ResultType["redirect"] = "redirect";
|
|
33957
|
-
ResultType["error"] = "error";
|
|
33958
|
-
})(ResultType || (ResultType = {}));
|
|
33959
|
-
/**
|
|
33960
|
-
* @private
|
|
33961
|
-
*/
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
function stripBasename(pathname, basename) {
|
|
33965
|
-
if (basename === "/") return pathname;
|
|
33966
|
-
|
|
33967
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
33968
|
-
return null;
|
|
33969
|
-
} // We want to leave trailing slash behavior in the user's control, so if they
|
|
33970
|
-
// specify a basename with a trailing slash, we should support it
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
33974
|
-
let nextChar = pathname.charAt(startIndex);
|
|
33975
|
-
|
|
33976
|
-
if (nextChar && nextChar !== "/") {
|
|
33977
|
-
// pathname does not start with basename/
|
|
33978
|
-
return null;
|
|
33979
|
-
}
|
|
33980
|
-
|
|
33981
|
-
return pathname.slice(startIndex) || "/";
|
|
33982
|
-
}
|
|
33983
|
-
|
|
33984
|
-
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
33985
|
-
["get", ...validMutationMethodsArr];
|
|
33986
|
-
|
|
33987
|
-
/**
|
|
33988
|
-
* React Router v6.11.2
|
|
33989
|
-
*
|
|
33990
|
-
* Copyright (c) Remix Software Inc.
|
|
33991
|
-
*
|
|
33992
|
-
* This source code is licensed under the MIT license found in the
|
|
33993
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33994
|
-
*
|
|
33995
|
-
* @license MIT
|
|
33996
|
-
*/
|
|
33997
|
-
|
|
33998
|
-
const DataRouterContext = /*#__PURE__*/React.createContext(null);
|
|
33999
|
-
|
|
34000
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34001
|
-
DataRouterContext.displayName = "DataRouter";
|
|
34002
|
-
}
|
|
34003
|
-
|
|
34004
|
-
const DataRouterStateContext = /*#__PURE__*/React.createContext(null);
|
|
34005
|
-
|
|
34006
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34007
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
34008
|
-
}
|
|
34009
|
-
|
|
34010
|
-
const AwaitContext = /*#__PURE__*/React.createContext(null);
|
|
34011
|
-
|
|
34012
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34013
|
-
AwaitContext.displayName = "Await";
|
|
34014
|
-
}
|
|
34015
|
-
|
|
34016
|
-
const NavigationContext = /*#__PURE__*/React.createContext(null);
|
|
34017
|
-
|
|
34018
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34019
|
-
NavigationContext.displayName = "Navigation";
|
|
34020
|
-
}
|
|
34021
|
-
|
|
34022
|
-
const LocationContext = /*#__PURE__*/React.createContext(null);
|
|
34023
|
-
|
|
34024
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34025
|
-
LocationContext.displayName = "Location";
|
|
34026
|
-
}
|
|
34027
|
-
|
|
34028
|
-
const RouteContext = /*#__PURE__*/React.createContext({
|
|
34029
|
-
outlet: null,
|
|
34030
|
-
matches: [],
|
|
34031
|
-
isDataRoute: false
|
|
34032
|
-
});
|
|
34033
|
-
|
|
34034
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34035
|
-
RouteContext.displayName = "Route";
|
|
34036
|
-
}
|
|
34037
|
-
|
|
34038
|
-
const RouteErrorContext = /*#__PURE__*/React.createContext(null);
|
|
34039
|
-
|
|
34040
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34041
|
-
RouteErrorContext.displayName = "RouteError";
|
|
34042
|
-
}
|
|
34043
|
-
/**
|
|
34044
|
-
* Returns true if this component is a descendant of a <Router>.
|
|
34045
|
-
*
|
|
34046
|
-
* @see https://reactrouter.com/hooks/use-in-router-context
|
|
34047
|
-
*/
|
|
34048
|
-
|
|
34049
|
-
function useInRouterContext() {
|
|
34050
|
-
return React.useContext(LocationContext) != null;
|
|
34051
|
-
}
|
|
34052
|
-
var DataRouterHook;
|
|
34053
|
-
|
|
34054
|
-
(function (DataRouterHook) {
|
|
34055
|
-
DataRouterHook["UseBlocker"] = "useBlocker";
|
|
34056
|
-
DataRouterHook["UseRevalidator"] = "useRevalidator";
|
|
34057
|
-
DataRouterHook["UseNavigateStable"] = "useNavigate";
|
|
34058
|
-
})(DataRouterHook || (DataRouterHook = {}));
|
|
34059
|
-
|
|
34060
|
-
var DataRouterStateHook;
|
|
34061
|
-
|
|
34062
|
-
(function (DataRouterStateHook) {
|
|
34063
|
-
DataRouterStateHook["UseBlocker"] = "useBlocker";
|
|
34064
|
-
DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
|
34065
|
-
DataRouterStateHook["UseActionData"] = "useActionData";
|
|
34066
|
-
DataRouterStateHook["UseRouteError"] = "useRouteError";
|
|
34067
|
-
DataRouterStateHook["UseNavigation"] = "useNavigation";
|
|
34068
|
-
DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
34069
|
-
DataRouterStateHook["UseMatches"] = "useMatches";
|
|
34070
|
-
DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
|
34071
|
-
DataRouterStateHook["UseNavigateStable"] = "useNavigate";
|
|
34072
|
-
DataRouterStateHook["UseRouteId"] = "useRouteId";
|
|
34073
|
-
})(DataRouterStateHook || (DataRouterStateHook = {}));
|
|
34074
|
-
|
|
34075
|
-
/**
|
|
34076
|
-
* A <Router> that stores all entries in memory.
|
|
34077
|
-
*
|
|
34078
|
-
* @see https://reactrouter.com/router-components/memory-router
|
|
34079
|
-
*/
|
|
34080
|
-
function MemoryRouter(_ref3) {
|
|
34081
|
-
let {
|
|
34082
|
-
basename,
|
|
34083
|
-
children,
|
|
34084
|
-
initialEntries,
|
|
34085
|
-
initialIndex
|
|
34086
|
-
} = _ref3;
|
|
34087
|
-
let historyRef = React.useRef();
|
|
34088
|
-
|
|
34089
|
-
if (historyRef.current == null) {
|
|
34090
|
-
historyRef.current = createMemoryHistory({
|
|
34091
|
-
initialEntries,
|
|
34092
|
-
initialIndex,
|
|
34093
|
-
v5Compat: true
|
|
34094
|
-
});
|
|
34095
|
-
}
|
|
34096
|
-
|
|
34097
|
-
let history = historyRef.current;
|
|
34098
|
-
let [state, setState] = React.useState({
|
|
34099
|
-
action: history.action,
|
|
34100
|
-
location: history.location
|
|
34101
|
-
});
|
|
34102
|
-
React.useLayoutEffect(() => history.listen(setState), [history]);
|
|
34103
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
34104
|
-
basename: basename,
|
|
34105
|
-
children: children,
|
|
34106
|
-
location: state.location,
|
|
34107
|
-
navigationType: state.action,
|
|
34108
|
-
navigator: history
|
|
34109
|
-
});
|
|
34110
|
-
}
|
|
34111
|
-
|
|
34112
|
-
/**
|
|
34113
|
-
* Provides location context for the rest of the app.
|
|
34114
|
-
*
|
|
34115
|
-
* Note: You usually won't render a <Router> directly. Instead, you'll render a
|
|
34116
|
-
* router that is more specific to your environment such as a <BrowserRouter>
|
|
34117
|
-
* in web browsers or a <StaticRouter> for server rendering.
|
|
34118
|
-
*
|
|
34119
|
-
* @see https://reactrouter.com/router-components/router
|
|
34120
|
-
*/
|
|
34121
|
-
function Router(_ref5) {
|
|
34122
|
-
let {
|
|
34123
|
-
basename: basenameProp = "/",
|
|
34124
|
-
children = null,
|
|
34125
|
-
location: locationProp,
|
|
34126
|
-
navigationType = Action.Pop,
|
|
34127
|
-
navigator,
|
|
34128
|
-
static: staticProp = false
|
|
34129
|
-
} = _ref5;
|
|
34130
|
-
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant$2(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : invariant$2(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
|
|
34131
|
-
// the enforcement of trailing slashes throughout the app
|
|
34132
|
-
|
|
34133
|
-
let basename = basenameProp.replace(/^\/*/, "/");
|
|
34134
|
-
let navigationContext = React.useMemo(() => ({
|
|
34135
|
-
basename,
|
|
34136
|
-
navigator,
|
|
34137
|
-
static: staticProp
|
|
34138
|
-
}), [basename, navigator, staticProp]);
|
|
34139
|
-
|
|
34140
|
-
if (typeof locationProp === "string") {
|
|
34141
|
-
locationProp = parsePath(locationProp);
|
|
34142
|
-
}
|
|
34143
|
-
|
|
34144
|
-
let {
|
|
34145
|
-
pathname = "/",
|
|
34146
|
-
search = "",
|
|
34147
|
-
hash = "",
|
|
34148
|
-
state = null,
|
|
34149
|
-
key = "default"
|
|
34150
|
-
} = locationProp;
|
|
34151
|
-
let locationContext = React.useMemo(() => {
|
|
34152
|
-
let trailingPathname = stripBasename(pathname, basename);
|
|
34153
|
-
|
|
34154
|
-
if (trailingPathname == null) {
|
|
34155
|
-
return null;
|
|
34156
|
-
}
|
|
34157
|
-
|
|
34158
|
-
return {
|
|
34159
|
-
location: {
|
|
34160
|
-
pathname: trailingPathname,
|
|
34161
|
-
search,
|
|
34162
|
-
hash,
|
|
34163
|
-
state,
|
|
34164
|
-
key
|
|
34165
|
-
},
|
|
34166
|
-
navigationType
|
|
34167
|
-
};
|
|
34168
|
-
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
34169
|
-
process.env.NODE_ENV !== "production" ? warning(locationContext != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") : void 0;
|
|
34170
|
-
|
|
34171
|
-
if (locationContext == null) {
|
|
34172
|
-
return null;
|
|
34173
|
-
}
|
|
34174
|
-
|
|
34175
|
-
return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
|
|
34176
|
-
value: navigationContext
|
|
34177
|
-
}, /*#__PURE__*/React.createElement(LocationContext.Provider, {
|
|
34178
|
-
children: children,
|
|
34179
|
-
value: locationContext
|
|
34180
|
-
}));
|
|
34181
|
-
}
|
|
34182
|
-
var AwaitRenderStatus;
|
|
34183
|
-
|
|
34184
|
-
(function (AwaitRenderStatus) {
|
|
34185
|
-
AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
|
34186
|
-
AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
|
34187
|
-
AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
|
34188
|
-
})(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
|
34189
|
-
|
|
34190
|
-
new Promise(() => {});
|
|
34191
|
-
|
|
34192
33674
|
var genericMessage = "Invariant Violation";
|
|
34193
33675
|
var _a$3 = Object.setPrototypeOf, setPrototypeOf = _a$3 === void 0 ? function (obj, proto) {
|
|
34194
33676
|
obj.__proto__ = proto;
|
|
@@ -44036,6 +43518,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44036
43518
|
* Use this Analytics Context.
|
|
44037
43519
|
* Defaults to mockAnalyticsContext.
|
|
44038
43520
|
*
|
|
43521
|
+
* This context is used by the useAnalytics hook from lib "@trackunit/react-core-hooks"
|
|
43522
|
+
*
|
|
44039
43523
|
* @see mockAnalyticsContext
|
|
44040
43524
|
* @example
|
|
44041
43525
|
* ...
|
|
@@ -44063,6 +43547,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44063
43547
|
* Use this Environment Context.
|
|
44064
43548
|
* Defaults to mockEnvironmentContext.
|
|
44065
43549
|
*
|
|
43550
|
+
* This context is used by the useEnvironment hook from lib "@trackunit/react-core-hooks"
|
|
43551
|
+
*
|
|
44066
43552
|
* @see mockEnvironmentContext
|
|
44067
43553
|
* @example
|
|
44068
43554
|
* ...
|
|
@@ -44089,6 +43575,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44089
43575
|
* Use this to pass in a differerent current user.
|
|
44090
43576
|
* Defaults to mockCurrentUserContext.
|
|
44091
43577
|
*
|
|
43578
|
+
* This context is used by the useCurrentUser hook from lib "@trackunit/react-core-hooks"
|
|
43579
|
+
*
|
|
44092
43580
|
* @see mockCurrentUserContext
|
|
44093
43581
|
* @example
|
|
44094
43582
|
* ...
|
|
@@ -44114,6 +43602,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44114
43602
|
* Use this to pass in a differerent current user subscription.
|
|
44115
43603
|
* Defaults to mockUserSubscriptionContext.
|
|
44116
43604
|
*
|
|
43605
|
+
* This context is used by the useUserSubscription hook from lib "@trackunit/react-core-hooks"
|
|
43606
|
+
*
|
|
44117
43607
|
* @see mockUserSubscriptionContext
|
|
44118
43608
|
* @example
|
|
44119
43609
|
* ...
|
|
@@ -44147,6 +43637,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44147
43637
|
* Set global asset sorting context.
|
|
44148
43638
|
* Defaults to mockAssetSortingContext.
|
|
44149
43639
|
*
|
|
43640
|
+
* This context is used by the useAssetSorting hook from lib "@trackunit/react-core-hooks"
|
|
43641
|
+
*
|
|
44150
43642
|
* @see mockAssetSortingContext
|
|
44151
43643
|
* @example
|
|
44152
43644
|
* ...
|
|
@@ -44173,6 +43665,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44173
43665
|
* Set OEM Branding context.
|
|
44174
43666
|
* Defaults to mockOemBrandingContext.
|
|
44175
43667
|
*
|
|
43668
|
+
* This context is used by the useAssetSorting hook from lib "@trackunit/react-core-hooks"
|
|
43669
|
+
*
|
|
44176
43670
|
* @see mockOemBrandingContext
|
|
44177
43671
|
* @example
|
|
44178
43672
|
* ...
|
|
@@ -44198,6 +43692,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44198
43692
|
* Use this ToastContext with the given mocks.
|
|
44199
43693
|
* Defaults to mockToastContext.
|
|
44200
43694
|
*
|
|
43695
|
+
* This context is used by the useToast hook from lib "@trackunit/react-core-hooks"
|
|
43696
|
+
*
|
|
44201
43697
|
* @see mockToastContext
|
|
44202
43698
|
* @example
|
|
44203
43699
|
* ...
|
|
@@ -44223,6 +43719,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44223
43719
|
* Use this global selection.
|
|
44224
43720
|
* Defaults to null.
|
|
44225
43721
|
*
|
|
43722
|
+
* This context is used by the useGlobalSelection hook from lib "@trackunit/react-core-hooks"
|
|
43723
|
+
*
|
|
44226
43724
|
* @example
|
|
44227
43725
|
* ...
|
|
44228
43726
|
* it("should allow render", async () => {
|
|
@@ -44247,6 +43745,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44247
43745
|
/**
|
|
44248
43746
|
* Use this token.
|
|
44249
43747
|
*
|
|
43748
|
+
* This context is used by the useToken hook from lib "@trackunit/react-core-hooks"
|
|
43749
|
+
*
|
|
44250
43750
|
* @example
|
|
44251
43751
|
* ...
|
|
44252
43752
|
* it("should allow render", async () => {
|
|
@@ -44271,6 +43771,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44271
43771
|
/**
|
|
44272
43772
|
* Use this Router Props with the given mocks.
|
|
44273
43773
|
*
|
|
43774
|
+
* This is used to provide a MemoryRouter from lib "react-router-dom"
|
|
43775
|
+
*
|
|
44274
43776
|
* @example
|
|
44275
43777
|
* ...
|
|
44276
43778
|
* it("should allow render", async () => {
|
|
@@ -44295,6 +43797,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44295
43797
|
/**
|
|
44296
43798
|
* Use this Manager Apollo Context Provider with the given mocks.
|
|
44297
43799
|
*
|
|
43800
|
+
* This context is used by the useQuery and useLazyQuery hook from lib "@apollo/client"
|
|
43801
|
+
*
|
|
44298
43802
|
* @see https://www.apollographql.com/docs/react/development-testing/testing
|
|
44299
43803
|
* @example
|
|
44300
43804
|
* ...
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"types": "./src/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@apollo/client": "3.7.10",
|
|
15
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
16
|
-
"@trackunit/react-core-hooks": "0.2.
|
|
15
|
+
"@trackunit/react-core-contexts-api": "0.2.42",
|
|
16
|
+
"@trackunit/react-core-hooks": "0.2.66",
|
|
17
17
|
"@trackunit/tailwind-styled-components": "0.0.58",
|
|
18
18
|
"graphql": "15.8.0",
|
|
19
19
|
"lodash": "4.17.21",
|