@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/HookRenderer.cjs
CHANGED
|
@@ -10,6 +10,7 @@ require('@trackunit/react-core-contexts-api');
|
|
|
10
10
|
require('util');
|
|
11
11
|
require('@trackunit/react-core-hooks');
|
|
12
12
|
require('@trackunit/tailwind-styled-components');
|
|
13
|
+
require('react-router-dom');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
16
|
|
package/HookRenderer.js
CHANGED
package/index.cjs
CHANGED
package/index.js
CHANGED
package/index2.cjs
CHANGED
|
@@ -9,6 +9,7 @@ var ReactDOMClient = require('react-dom/client');
|
|
|
9
9
|
var require$$0 = require('util');
|
|
10
10
|
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
11
11
|
var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
12
|
+
var reactRouterDom = require('react-router-dom');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
|
@@ -33698,525 +33699,6 @@ var lodash = {exports: {}};
|
|
|
33698
33699
|
}.call(commonjsGlobal));
|
|
33699
33700
|
}(lodash, lodash.exports));
|
|
33700
33701
|
|
|
33701
|
-
/**
|
|
33702
|
-
* @remix-run/router v1.6.2
|
|
33703
|
-
*
|
|
33704
|
-
* Copyright (c) Remix Software Inc.
|
|
33705
|
-
*
|
|
33706
|
-
* This source code is licensed under the MIT license found in the
|
|
33707
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33708
|
-
*
|
|
33709
|
-
* @license MIT
|
|
33710
|
-
*/
|
|
33711
|
-
function _extends() {
|
|
33712
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
33713
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33714
|
-
var source = arguments[i];
|
|
33715
|
-
|
|
33716
|
-
for (var key in source) {
|
|
33717
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33718
|
-
target[key] = source[key];
|
|
33719
|
-
}
|
|
33720
|
-
}
|
|
33721
|
-
}
|
|
33722
|
-
|
|
33723
|
-
return target;
|
|
33724
|
-
};
|
|
33725
|
-
return _extends.apply(this, arguments);
|
|
33726
|
-
}
|
|
33727
|
-
|
|
33728
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33729
|
-
//#region Types and Constants
|
|
33730
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33731
|
-
|
|
33732
|
-
/**
|
|
33733
|
-
* Actions represent the type of change to a location value.
|
|
33734
|
-
*/
|
|
33735
|
-
var Action;
|
|
33736
|
-
|
|
33737
|
-
(function (Action) {
|
|
33738
|
-
/**
|
|
33739
|
-
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
33740
|
-
* as a back or forward navigation. It does not describe the direction of the
|
|
33741
|
-
* navigation, only that the current index changed.
|
|
33742
|
-
*
|
|
33743
|
-
* Note: This is the default action for newly created history objects.
|
|
33744
|
-
*/
|
|
33745
|
-
Action["Pop"] = "POP";
|
|
33746
|
-
/**
|
|
33747
|
-
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
33748
|
-
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
33749
|
-
* entries in the stack are lost.
|
|
33750
|
-
*/
|
|
33751
|
-
|
|
33752
|
-
Action["Push"] = "PUSH";
|
|
33753
|
-
/**
|
|
33754
|
-
* A REPLACE indicates the entry at the current index in the history stack
|
|
33755
|
-
* being replaced by a new one.
|
|
33756
|
-
*/
|
|
33757
|
-
|
|
33758
|
-
Action["Replace"] = "REPLACE";
|
|
33759
|
-
})(Action || (Action = {}));
|
|
33760
|
-
/**
|
|
33761
|
-
* Memory history stores the current location in memory. It is designed for use
|
|
33762
|
-
* in stateful non-browser environments like tests and React Native.
|
|
33763
|
-
*/
|
|
33764
|
-
|
|
33765
|
-
function createMemoryHistory(options) {
|
|
33766
|
-
if (options === void 0) {
|
|
33767
|
-
options = {};
|
|
33768
|
-
}
|
|
33769
|
-
|
|
33770
|
-
let {
|
|
33771
|
-
initialEntries = ["/"],
|
|
33772
|
-
initialIndex,
|
|
33773
|
-
v5Compat = false
|
|
33774
|
-
} = options;
|
|
33775
|
-
let entries; // Declare so we can access from createMemoryLocation
|
|
33776
|
-
|
|
33777
|
-
entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined));
|
|
33778
|
-
let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
|
|
33779
|
-
let action = Action.Pop;
|
|
33780
|
-
let listener = null;
|
|
33781
|
-
|
|
33782
|
-
function clampIndex(n) {
|
|
33783
|
-
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
33784
|
-
}
|
|
33785
|
-
|
|
33786
|
-
function getCurrentLocation() {
|
|
33787
|
-
return entries[index];
|
|
33788
|
-
}
|
|
33789
|
-
|
|
33790
|
-
function createMemoryLocation(to, state, key) {
|
|
33791
|
-
if (state === void 0) {
|
|
33792
|
-
state = null;
|
|
33793
|
-
}
|
|
33794
|
-
|
|
33795
|
-
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key);
|
|
33796
|
-
warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to));
|
|
33797
|
-
return location;
|
|
33798
|
-
}
|
|
33799
|
-
|
|
33800
|
-
function createHref(to) {
|
|
33801
|
-
return typeof to === "string" ? to : createPath(to);
|
|
33802
|
-
}
|
|
33803
|
-
|
|
33804
|
-
let history = {
|
|
33805
|
-
get index() {
|
|
33806
|
-
return index;
|
|
33807
|
-
},
|
|
33808
|
-
|
|
33809
|
-
get action() {
|
|
33810
|
-
return action;
|
|
33811
|
-
},
|
|
33812
|
-
|
|
33813
|
-
get location() {
|
|
33814
|
-
return getCurrentLocation();
|
|
33815
|
-
},
|
|
33816
|
-
|
|
33817
|
-
createHref,
|
|
33818
|
-
|
|
33819
|
-
createURL(to) {
|
|
33820
|
-
return new URL(createHref(to), "http://localhost");
|
|
33821
|
-
},
|
|
33822
|
-
|
|
33823
|
-
encodeLocation(to) {
|
|
33824
|
-
let path = typeof to === "string" ? parsePath(to) : to;
|
|
33825
|
-
return {
|
|
33826
|
-
pathname: path.pathname || "",
|
|
33827
|
-
search: path.search || "",
|
|
33828
|
-
hash: path.hash || ""
|
|
33829
|
-
};
|
|
33830
|
-
},
|
|
33831
|
-
|
|
33832
|
-
push(to, state) {
|
|
33833
|
-
action = Action.Push;
|
|
33834
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33835
|
-
index += 1;
|
|
33836
|
-
entries.splice(index, entries.length, nextLocation);
|
|
33837
|
-
|
|
33838
|
-
if (v5Compat && listener) {
|
|
33839
|
-
listener({
|
|
33840
|
-
action,
|
|
33841
|
-
location: nextLocation,
|
|
33842
|
-
delta: 1
|
|
33843
|
-
});
|
|
33844
|
-
}
|
|
33845
|
-
},
|
|
33846
|
-
|
|
33847
|
-
replace(to, state) {
|
|
33848
|
-
action = Action.Replace;
|
|
33849
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33850
|
-
entries[index] = nextLocation;
|
|
33851
|
-
|
|
33852
|
-
if (v5Compat && listener) {
|
|
33853
|
-
listener({
|
|
33854
|
-
action,
|
|
33855
|
-
location: nextLocation,
|
|
33856
|
-
delta: 0
|
|
33857
|
-
});
|
|
33858
|
-
}
|
|
33859
|
-
},
|
|
33860
|
-
|
|
33861
|
-
go(delta) {
|
|
33862
|
-
action = Action.Pop;
|
|
33863
|
-
let nextIndex = clampIndex(index + delta);
|
|
33864
|
-
let nextLocation = entries[nextIndex];
|
|
33865
|
-
index = nextIndex;
|
|
33866
|
-
|
|
33867
|
-
if (listener) {
|
|
33868
|
-
listener({
|
|
33869
|
-
action,
|
|
33870
|
-
location: nextLocation,
|
|
33871
|
-
delta
|
|
33872
|
-
});
|
|
33873
|
-
}
|
|
33874
|
-
},
|
|
33875
|
-
|
|
33876
|
-
listen(fn) {
|
|
33877
|
-
listener = fn;
|
|
33878
|
-
return () => {
|
|
33879
|
-
listener = null;
|
|
33880
|
-
};
|
|
33881
|
-
}
|
|
33882
|
-
|
|
33883
|
-
};
|
|
33884
|
-
return history;
|
|
33885
|
-
}
|
|
33886
|
-
function invariant$2(value, message) {
|
|
33887
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
33888
|
-
throw new Error(message);
|
|
33889
|
-
}
|
|
33890
|
-
}
|
|
33891
|
-
function warning(cond, message) {
|
|
33892
|
-
if (!cond) {
|
|
33893
|
-
// eslint-disable-next-line no-console
|
|
33894
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
33895
|
-
|
|
33896
|
-
try {
|
|
33897
|
-
// Welcome to debugging history!
|
|
33898
|
-
//
|
|
33899
|
-
// This error is thrown as a convenience so you can more easily
|
|
33900
|
-
// find the source for a warning that appears in the console by
|
|
33901
|
-
// enabling "pause on exceptions" in your JavaScript debugger.
|
|
33902
|
-
throw new Error(message); // eslint-disable-next-line no-empty
|
|
33903
|
-
} catch (e) {}
|
|
33904
|
-
}
|
|
33905
|
-
}
|
|
33906
|
-
|
|
33907
|
-
function createKey() {
|
|
33908
|
-
return Math.random().toString(36).substr(2, 8);
|
|
33909
|
-
}
|
|
33910
|
-
/**
|
|
33911
|
-
* Creates a Location object with a unique key from the given Path
|
|
33912
|
-
*/
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
function createLocation(current, to, state, key) {
|
|
33916
|
-
if (state === void 0) {
|
|
33917
|
-
state = null;
|
|
33918
|
-
}
|
|
33919
|
-
|
|
33920
|
-
let location = _extends({
|
|
33921
|
-
pathname: typeof current === "string" ? current : current.pathname,
|
|
33922
|
-
search: "",
|
|
33923
|
-
hash: ""
|
|
33924
|
-
}, typeof to === "string" ? parsePath(to) : to, {
|
|
33925
|
-
state,
|
|
33926
|
-
// TODO: This could be cleaned up. push/replace should probably just take
|
|
33927
|
-
// full Locations now and avoid the need to run through this flow at all
|
|
33928
|
-
// But that's a pretty big refactor to the current test suite so going to
|
|
33929
|
-
// keep as is for the time being and just let any incoming keys take precedence
|
|
33930
|
-
key: to && to.key || key || createKey()
|
|
33931
|
-
});
|
|
33932
|
-
|
|
33933
|
-
return location;
|
|
33934
|
-
}
|
|
33935
|
-
/**
|
|
33936
|
-
* Creates a string URL path from the given pathname, search, and hash components.
|
|
33937
|
-
*/
|
|
33938
|
-
|
|
33939
|
-
function createPath(_ref) {
|
|
33940
|
-
let {
|
|
33941
|
-
pathname = "/",
|
|
33942
|
-
search = "",
|
|
33943
|
-
hash = ""
|
|
33944
|
-
} = _ref;
|
|
33945
|
-
if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
33946
|
-
if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
33947
|
-
return pathname;
|
|
33948
|
-
}
|
|
33949
|
-
/**
|
|
33950
|
-
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
33951
|
-
*/
|
|
33952
|
-
|
|
33953
|
-
function parsePath(path) {
|
|
33954
|
-
let parsedPath = {};
|
|
33955
|
-
|
|
33956
|
-
if (path) {
|
|
33957
|
-
let hashIndex = path.indexOf("#");
|
|
33958
|
-
|
|
33959
|
-
if (hashIndex >= 0) {
|
|
33960
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
33961
|
-
path = path.substr(0, hashIndex);
|
|
33962
|
-
}
|
|
33963
|
-
|
|
33964
|
-
let searchIndex = path.indexOf("?");
|
|
33965
|
-
|
|
33966
|
-
if (searchIndex >= 0) {
|
|
33967
|
-
parsedPath.search = path.substr(searchIndex);
|
|
33968
|
-
path = path.substr(0, searchIndex);
|
|
33969
|
-
}
|
|
33970
|
-
|
|
33971
|
-
if (path) {
|
|
33972
|
-
parsedPath.pathname = path;
|
|
33973
|
-
}
|
|
33974
|
-
}
|
|
33975
|
-
|
|
33976
|
-
return parsedPath;
|
|
33977
|
-
}
|
|
33978
|
-
|
|
33979
|
-
var ResultType;
|
|
33980
|
-
|
|
33981
|
-
(function (ResultType) {
|
|
33982
|
-
ResultType["data"] = "data";
|
|
33983
|
-
ResultType["deferred"] = "deferred";
|
|
33984
|
-
ResultType["redirect"] = "redirect";
|
|
33985
|
-
ResultType["error"] = "error";
|
|
33986
|
-
})(ResultType || (ResultType = {}));
|
|
33987
|
-
/**
|
|
33988
|
-
* @private
|
|
33989
|
-
*/
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
function stripBasename(pathname, basename) {
|
|
33993
|
-
if (basename === "/") return pathname;
|
|
33994
|
-
|
|
33995
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
33996
|
-
return null;
|
|
33997
|
-
} // We want to leave trailing slash behavior in the user's control, so if they
|
|
33998
|
-
// specify a basename with a trailing slash, we should support it
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
34002
|
-
let nextChar = pathname.charAt(startIndex);
|
|
34003
|
-
|
|
34004
|
-
if (nextChar && nextChar !== "/") {
|
|
34005
|
-
// pathname does not start with basename/
|
|
34006
|
-
return null;
|
|
34007
|
-
}
|
|
34008
|
-
|
|
34009
|
-
return pathname.slice(startIndex) || "/";
|
|
34010
|
-
}
|
|
34011
|
-
|
|
34012
|
-
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
34013
|
-
["get", ...validMutationMethodsArr];
|
|
34014
|
-
|
|
34015
|
-
/**
|
|
34016
|
-
* React Router v6.11.2
|
|
34017
|
-
*
|
|
34018
|
-
* Copyright (c) Remix Software Inc.
|
|
34019
|
-
*
|
|
34020
|
-
* This source code is licensed under the MIT license found in the
|
|
34021
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
34022
|
-
*
|
|
34023
|
-
* @license MIT
|
|
34024
|
-
*/
|
|
34025
|
-
|
|
34026
|
-
const DataRouterContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34027
|
-
|
|
34028
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34029
|
-
DataRouterContext.displayName = "DataRouter";
|
|
34030
|
-
}
|
|
34031
|
-
|
|
34032
|
-
const DataRouterStateContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34033
|
-
|
|
34034
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34035
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
34036
|
-
}
|
|
34037
|
-
|
|
34038
|
-
const AwaitContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34039
|
-
|
|
34040
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34041
|
-
AwaitContext.displayName = "Await";
|
|
34042
|
-
}
|
|
34043
|
-
|
|
34044
|
-
const NavigationContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34045
|
-
|
|
34046
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34047
|
-
NavigationContext.displayName = "Navigation";
|
|
34048
|
-
}
|
|
34049
|
-
|
|
34050
|
-
const LocationContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34051
|
-
|
|
34052
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34053
|
-
LocationContext.displayName = "Location";
|
|
34054
|
-
}
|
|
34055
|
-
|
|
34056
|
-
const RouteContext = /*#__PURE__*/React__namespace.createContext({
|
|
34057
|
-
outlet: null,
|
|
34058
|
-
matches: [],
|
|
34059
|
-
isDataRoute: false
|
|
34060
|
-
});
|
|
34061
|
-
|
|
34062
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34063
|
-
RouteContext.displayName = "Route";
|
|
34064
|
-
}
|
|
34065
|
-
|
|
34066
|
-
const RouteErrorContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34067
|
-
|
|
34068
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34069
|
-
RouteErrorContext.displayName = "RouteError";
|
|
34070
|
-
}
|
|
34071
|
-
/**
|
|
34072
|
-
* Returns true if this component is a descendant of a <Router>.
|
|
34073
|
-
*
|
|
34074
|
-
* @see https://reactrouter.com/hooks/use-in-router-context
|
|
34075
|
-
*/
|
|
34076
|
-
|
|
34077
|
-
function useInRouterContext() {
|
|
34078
|
-
return React__namespace.useContext(LocationContext) != null;
|
|
34079
|
-
}
|
|
34080
|
-
var DataRouterHook;
|
|
34081
|
-
|
|
34082
|
-
(function (DataRouterHook) {
|
|
34083
|
-
DataRouterHook["UseBlocker"] = "useBlocker";
|
|
34084
|
-
DataRouterHook["UseRevalidator"] = "useRevalidator";
|
|
34085
|
-
DataRouterHook["UseNavigateStable"] = "useNavigate";
|
|
34086
|
-
})(DataRouterHook || (DataRouterHook = {}));
|
|
34087
|
-
|
|
34088
|
-
var DataRouterStateHook;
|
|
34089
|
-
|
|
34090
|
-
(function (DataRouterStateHook) {
|
|
34091
|
-
DataRouterStateHook["UseBlocker"] = "useBlocker";
|
|
34092
|
-
DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
|
34093
|
-
DataRouterStateHook["UseActionData"] = "useActionData";
|
|
34094
|
-
DataRouterStateHook["UseRouteError"] = "useRouteError";
|
|
34095
|
-
DataRouterStateHook["UseNavigation"] = "useNavigation";
|
|
34096
|
-
DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
34097
|
-
DataRouterStateHook["UseMatches"] = "useMatches";
|
|
34098
|
-
DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
|
34099
|
-
DataRouterStateHook["UseNavigateStable"] = "useNavigate";
|
|
34100
|
-
DataRouterStateHook["UseRouteId"] = "useRouteId";
|
|
34101
|
-
})(DataRouterStateHook || (DataRouterStateHook = {}));
|
|
34102
|
-
|
|
34103
|
-
/**
|
|
34104
|
-
* A <Router> that stores all entries in memory.
|
|
34105
|
-
*
|
|
34106
|
-
* @see https://reactrouter.com/router-components/memory-router
|
|
34107
|
-
*/
|
|
34108
|
-
function MemoryRouter(_ref3) {
|
|
34109
|
-
let {
|
|
34110
|
-
basename,
|
|
34111
|
-
children,
|
|
34112
|
-
initialEntries,
|
|
34113
|
-
initialIndex
|
|
34114
|
-
} = _ref3;
|
|
34115
|
-
let historyRef = React__namespace.useRef();
|
|
34116
|
-
|
|
34117
|
-
if (historyRef.current == null) {
|
|
34118
|
-
historyRef.current = createMemoryHistory({
|
|
34119
|
-
initialEntries,
|
|
34120
|
-
initialIndex,
|
|
34121
|
-
v5Compat: true
|
|
34122
|
-
});
|
|
34123
|
-
}
|
|
34124
|
-
|
|
34125
|
-
let history = historyRef.current;
|
|
34126
|
-
let [state, setState] = React__namespace.useState({
|
|
34127
|
-
action: history.action,
|
|
34128
|
-
location: history.location
|
|
34129
|
-
});
|
|
34130
|
-
React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
|
|
34131
|
-
return /*#__PURE__*/React__namespace.createElement(Router, {
|
|
34132
|
-
basename: basename,
|
|
34133
|
-
children: children,
|
|
34134
|
-
location: state.location,
|
|
34135
|
-
navigationType: state.action,
|
|
34136
|
-
navigator: history
|
|
34137
|
-
});
|
|
34138
|
-
}
|
|
34139
|
-
|
|
34140
|
-
/**
|
|
34141
|
-
* Provides location context for the rest of the app.
|
|
34142
|
-
*
|
|
34143
|
-
* Note: You usually won't render a <Router> directly. Instead, you'll render a
|
|
34144
|
-
* router that is more specific to your environment such as a <BrowserRouter>
|
|
34145
|
-
* in web browsers or a <StaticRouter> for server rendering.
|
|
34146
|
-
*
|
|
34147
|
-
* @see https://reactrouter.com/router-components/router
|
|
34148
|
-
*/
|
|
34149
|
-
function Router(_ref5) {
|
|
34150
|
-
let {
|
|
34151
|
-
basename: basenameProp = "/",
|
|
34152
|
-
children = null,
|
|
34153
|
-
location: locationProp,
|
|
34154
|
-
navigationType = Action.Pop,
|
|
34155
|
-
navigator,
|
|
34156
|
-
static: staticProp = false
|
|
34157
|
-
} = _ref5;
|
|
34158
|
-
!!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
|
|
34159
|
-
// the enforcement of trailing slashes throughout the app
|
|
34160
|
-
|
|
34161
|
-
let basename = basenameProp.replace(/^\/*/, "/");
|
|
34162
|
-
let navigationContext = React__namespace.useMemo(() => ({
|
|
34163
|
-
basename,
|
|
34164
|
-
navigator,
|
|
34165
|
-
static: staticProp
|
|
34166
|
-
}), [basename, navigator, staticProp]);
|
|
34167
|
-
|
|
34168
|
-
if (typeof locationProp === "string") {
|
|
34169
|
-
locationProp = parsePath(locationProp);
|
|
34170
|
-
}
|
|
34171
|
-
|
|
34172
|
-
let {
|
|
34173
|
-
pathname = "/",
|
|
34174
|
-
search = "",
|
|
34175
|
-
hash = "",
|
|
34176
|
-
state = null,
|
|
34177
|
-
key = "default"
|
|
34178
|
-
} = locationProp;
|
|
34179
|
-
let locationContext = React__namespace.useMemo(() => {
|
|
34180
|
-
let trailingPathname = stripBasename(pathname, basename);
|
|
34181
|
-
|
|
34182
|
-
if (trailingPathname == null) {
|
|
34183
|
-
return null;
|
|
34184
|
-
}
|
|
34185
|
-
|
|
34186
|
-
return {
|
|
34187
|
-
location: {
|
|
34188
|
-
pathname: trailingPathname,
|
|
34189
|
-
search,
|
|
34190
|
-
hash,
|
|
34191
|
-
state,
|
|
34192
|
-
key
|
|
34193
|
-
},
|
|
34194
|
-
navigationType
|
|
34195
|
-
};
|
|
34196
|
-
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
34197
|
-
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;
|
|
34198
|
-
|
|
34199
|
-
if (locationContext == null) {
|
|
34200
|
-
return null;
|
|
34201
|
-
}
|
|
34202
|
-
|
|
34203
|
-
return /*#__PURE__*/React__namespace.createElement(NavigationContext.Provider, {
|
|
34204
|
-
value: navigationContext
|
|
34205
|
-
}, /*#__PURE__*/React__namespace.createElement(LocationContext.Provider, {
|
|
34206
|
-
children: children,
|
|
34207
|
-
value: locationContext
|
|
34208
|
-
}));
|
|
34209
|
-
}
|
|
34210
|
-
var AwaitRenderStatus;
|
|
34211
|
-
|
|
34212
|
-
(function (AwaitRenderStatus) {
|
|
34213
|
-
AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
|
34214
|
-
AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
|
34215
|
-
AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
|
34216
|
-
})(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
|
34217
|
-
|
|
34218
|
-
new Promise(() => {});
|
|
34219
|
-
|
|
34220
33702
|
var genericMessage = "Invariant Violation";
|
|
34221
33703
|
var _a$3 = Object.setPrototypeOf, setPrototypeOf = _a$3 === void 0 ? function (obj, proto) {
|
|
34222
33704
|
obj.__proto__ = proto;
|
|
@@ -44064,6 +43546,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44064
43546
|
* Use this Analytics Context.
|
|
44065
43547
|
* Defaults to mockAnalyticsContext.
|
|
44066
43548
|
*
|
|
43549
|
+
* This context is used by the useAnalytics hook from lib "@trackunit/react-core-hooks"
|
|
43550
|
+
*
|
|
44067
43551
|
* @see mockAnalyticsContext
|
|
44068
43552
|
* @example
|
|
44069
43553
|
* ...
|
|
@@ -44091,6 +43575,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44091
43575
|
* Use this Environment Context.
|
|
44092
43576
|
* Defaults to mockEnvironmentContext.
|
|
44093
43577
|
*
|
|
43578
|
+
* This context is used by the useEnvironment hook from lib "@trackunit/react-core-hooks"
|
|
43579
|
+
*
|
|
44094
43580
|
* @see mockEnvironmentContext
|
|
44095
43581
|
* @example
|
|
44096
43582
|
* ...
|
|
@@ -44117,6 +43603,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44117
43603
|
* Use this to pass in a differerent current user.
|
|
44118
43604
|
* Defaults to mockCurrentUserContext.
|
|
44119
43605
|
*
|
|
43606
|
+
* This context is used by the useCurrentUser hook from lib "@trackunit/react-core-hooks"
|
|
43607
|
+
*
|
|
44120
43608
|
* @see mockCurrentUserContext
|
|
44121
43609
|
* @example
|
|
44122
43610
|
* ...
|
|
@@ -44142,6 +43630,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44142
43630
|
* Use this to pass in a differerent current user subscription.
|
|
44143
43631
|
* Defaults to mockUserSubscriptionContext.
|
|
44144
43632
|
*
|
|
43633
|
+
* This context is used by the useUserSubscription hook from lib "@trackunit/react-core-hooks"
|
|
43634
|
+
*
|
|
44145
43635
|
* @see mockUserSubscriptionContext
|
|
44146
43636
|
* @example
|
|
44147
43637
|
* ...
|
|
@@ -44175,6 +43665,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44175
43665
|
* Set global asset sorting context.
|
|
44176
43666
|
* Defaults to mockAssetSortingContext.
|
|
44177
43667
|
*
|
|
43668
|
+
* This context is used by the useAssetSorting hook from lib "@trackunit/react-core-hooks"
|
|
43669
|
+
*
|
|
44178
43670
|
* @see mockAssetSortingContext
|
|
44179
43671
|
* @example
|
|
44180
43672
|
* ...
|
|
@@ -44201,6 +43693,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44201
43693
|
* Set OEM Branding context.
|
|
44202
43694
|
* Defaults to mockOemBrandingContext.
|
|
44203
43695
|
*
|
|
43696
|
+
* This context is used by the useAssetSorting hook from lib "@trackunit/react-core-hooks"
|
|
43697
|
+
*
|
|
44204
43698
|
* @see mockOemBrandingContext
|
|
44205
43699
|
* @example
|
|
44206
43700
|
* ...
|
|
@@ -44226,6 +43720,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44226
43720
|
* Use this ToastContext with the given mocks.
|
|
44227
43721
|
* Defaults to mockToastContext.
|
|
44228
43722
|
*
|
|
43723
|
+
* This context is used by the useToast hook from lib "@trackunit/react-core-hooks"
|
|
43724
|
+
*
|
|
44229
43725
|
* @see mockToastContext
|
|
44230
43726
|
* @example
|
|
44231
43727
|
* ...
|
|
@@ -44251,6 +43747,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44251
43747
|
* Use this global selection.
|
|
44252
43748
|
* Defaults to null.
|
|
44253
43749
|
*
|
|
43750
|
+
* This context is used by the useGlobalSelection hook from lib "@trackunit/react-core-hooks"
|
|
43751
|
+
*
|
|
44254
43752
|
* @example
|
|
44255
43753
|
* ...
|
|
44256
43754
|
* it("should allow render", async () => {
|
|
@@ -44275,6 +43773,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44275
43773
|
/**
|
|
44276
43774
|
* Use this token.
|
|
44277
43775
|
*
|
|
43776
|
+
* This context is used by the useToken hook from lib "@trackunit/react-core-hooks"
|
|
43777
|
+
*
|
|
44278
43778
|
* @example
|
|
44279
43779
|
* ...
|
|
44280
43780
|
* it("should allow render", async () => {
|
|
@@ -44299,6 +43799,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44299
43799
|
/**
|
|
44300
43800
|
* Use this Router Props with the given mocks.
|
|
44301
43801
|
*
|
|
43802
|
+
* This is used to provide a MemoryRouter from lib "react-router-dom"
|
|
43803
|
+
*
|
|
44302
43804
|
* @example
|
|
44303
43805
|
* ...
|
|
44304
43806
|
* it("should allow render", async () => {
|
|
@@ -44323,6 +43825,8 @@ class TrackunitProvidersMockBuilder {
|
|
|
44323
43825
|
/**
|
|
44324
43826
|
* Use this Manager Apollo Context Provider with the given mocks.
|
|
44325
43827
|
*
|
|
43828
|
+
* This context is used by the useQuery and useLazyQuery hook from lib "@apollo/client"
|
|
43829
|
+
*
|
|
44326
43830
|
* @see https://www.apollographql.com/docs/react/development-testing/testing
|
|
44327
43831
|
* @example
|
|
44328
43832
|
* ...
|
|
@@ -44360,7 +43864,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
44360
43864
|
* @param addTestRootContainer - if you want to add a root container to the test.
|
|
44361
43865
|
*/
|
|
44362
43866
|
getMockedCompositionRoot(testChildren, addTestRootContainer = true) {
|
|
44363
|
-
return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx(TestRoot, { "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
|
|
43867
|
+
return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx(TestRoot, { "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
|
|
44364
43868
|
}
|
|
44365
43869
|
/**
|
|
44366
43870
|
* This will return the mocked composition root.
|