@trackunit/react-core-hooks 0.2.65 → 0.2.67

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.
Files changed (3) hide show
  1. package/index.cjs +2 -176
  2. package/index.js +1 -175
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
8
+ var reactRouterDom = require('react-router-dom');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
@@ -179,186 +180,11 @@ const OemBrandingContextProvider = (props) => {
179
180
  return jsxRuntime.jsx(OemBrandingContext.Provider, Object.assign({}, props));
180
181
  };
181
182
 
182
- /**
183
- * @remix-run/router v1.6.2
184
- *
185
- * Copyright (c) Remix Software Inc.
186
- *
187
- * This source code is licensed under the MIT license found in the
188
- * LICENSE.md file in the root directory of this source tree.
189
- *
190
- * @license MIT
191
- */
192
-
193
- ////////////////////////////////////////////////////////////////////////////////
194
- //#region Types and Constants
195
- ////////////////////////////////////////////////////////////////////////////////
196
-
197
- /**
198
- * Actions represent the type of change to a location value.
199
- */
200
- var Action;
201
-
202
- (function (Action) {
203
- /**
204
- * A POP indicates a change to an arbitrary index in the history stack, such
205
- * as a back or forward navigation. It does not describe the direction of the
206
- * navigation, only that the current index changed.
207
- *
208
- * Note: This is the default action for newly created history objects.
209
- */
210
- Action["Pop"] = "POP";
211
- /**
212
- * A PUSH indicates a new entry being added to the history stack, such as when
213
- * a link is clicked and a new page loads. When this happens, all subsequent
214
- * entries in the stack are lost.
215
- */
216
-
217
- Action["Push"] = "PUSH";
218
- /**
219
- * A REPLACE indicates the entry at the current index in the history stack
220
- * being replaced by a new one.
221
- */
222
-
223
- Action["Replace"] = "REPLACE";
224
- })(Action || (Action = {}));
225
- function invariant(value, message) {
226
- if (value === false || value === null || typeof value === "undefined") {
227
- throw new Error(message);
228
- }
229
- }
230
-
231
- var ResultType;
232
-
233
- (function (ResultType) {
234
- ResultType["data"] = "data";
235
- ResultType["deferred"] = "deferred";
236
- ResultType["redirect"] = "redirect";
237
- ResultType["error"] = "error";
238
- })(ResultType || (ResultType = {}));
239
-
240
- const validMutationMethodsArr = ["post", "put", "patch", "delete"];
241
- ["get", ...validMutationMethodsArr];
242
-
243
- /**
244
- * React Router v6.11.2
245
- *
246
- * Copyright (c) Remix Software Inc.
247
- *
248
- * This source code is licensed under the MIT license found in the
249
- * LICENSE.md file in the root directory of this source tree.
250
- *
251
- * @license MIT
252
- */
253
-
254
- const DataRouterContext = /*#__PURE__*/React__namespace.createContext(null);
255
-
256
- if (process.env.NODE_ENV !== "production") {
257
- DataRouterContext.displayName = "DataRouter";
258
- }
259
-
260
- const DataRouterStateContext = /*#__PURE__*/React__namespace.createContext(null);
261
-
262
- if (process.env.NODE_ENV !== "production") {
263
- DataRouterStateContext.displayName = "DataRouterState";
264
- }
265
-
266
- const AwaitContext = /*#__PURE__*/React__namespace.createContext(null);
267
-
268
- if (process.env.NODE_ENV !== "production") {
269
- AwaitContext.displayName = "Await";
270
- }
271
-
272
- const NavigationContext = /*#__PURE__*/React__namespace.createContext(null);
273
-
274
- if (process.env.NODE_ENV !== "production") {
275
- NavigationContext.displayName = "Navigation";
276
- }
277
-
278
- const LocationContext = /*#__PURE__*/React__namespace.createContext(null);
279
-
280
- if (process.env.NODE_ENV !== "production") {
281
- LocationContext.displayName = "Location";
282
- }
283
-
284
- const RouteContext = /*#__PURE__*/React__namespace.createContext({
285
- outlet: null,
286
- matches: [],
287
- isDataRoute: false
288
- });
289
-
290
- if (process.env.NODE_ENV !== "production") {
291
- RouteContext.displayName = "Route";
292
- }
293
-
294
- const RouteErrorContext = /*#__PURE__*/React__namespace.createContext(null);
295
-
296
- if (process.env.NODE_ENV !== "production") {
297
- RouteErrorContext.displayName = "RouteError";
298
- }
299
- /**
300
- * Returns true if this component is a descendant of a <Router>.
301
- *
302
- * @see https://reactrouter.com/hooks/use-in-router-context
303
- */
304
-
305
- function useInRouterContext() {
306
- return React__namespace.useContext(LocationContext) != null;
307
- }
308
- /**
309
- * Returns the current location object, which represents the current URL in web
310
- * browsers.
311
- *
312
- * Note: If you're using this it may mean you're doing some of your own
313
- * "routing" in your app, and we'd like to know what your use case is. We may
314
- * be able to provide something higher-level to better suit your needs.
315
- *
316
- * @see https://reactrouter.com/hooks/use-location
317
- */
318
-
319
- function useLocation() {
320
- !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
321
- // router loaded. We can help them understand how to avoid that.
322
- "useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
323
- return React__namespace.useContext(LocationContext).location;
324
- }
325
- var DataRouterHook;
326
-
327
- (function (DataRouterHook) {
328
- DataRouterHook["UseBlocker"] = "useBlocker";
329
- DataRouterHook["UseRevalidator"] = "useRevalidator";
330
- DataRouterHook["UseNavigateStable"] = "useNavigate";
331
- })(DataRouterHook || (DataRouterHook = {}));
332
-
333
- var DataRouterStateHook;
334
-
335
- (function (DataRouterStateHook) {
336
- DataRouterStateHook["UseBlocker"] = "useBlocker";
337
- DataRouterStateHook["UseLoaderData"] = "useLoaderData";
338
- DataRouterStateHook["UseActionData"] = "useActionData";
339
- DataRouterStateHook["UseRouteError"] = "useRouteError";
340
- DataRouterStateHook["UseNavigation"] = "useNavigation";
341
- DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
342
- DataRouterStateHook["UseMatches"] = "useMatches";
343
- DataRouterStateHook["UseRevalidator"] = "useRevalidator";
344
- DataRouterStateHook["UseNavigateStable"] = "useNavigate";
345
- DataRouterStateHook["UseRouteId"] = "useRouteId";
346
- })(DataRouterStateHook || (DataRouterStateHook = {}));
347
- var AwaitRenderStatus;
348
-
349
- (function (AwaitRenderStatus) {
350
- AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
351
- AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
352
- AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
353
- })(AwaitRenderStatus || (AwaitRenderStatus = {}));
354
-
355
- new Promise(() => {});
356
-
357
183
  /**
358
184
  * A react hook for notifying host about location changes
359
185
  */
360
186
  const useURLSynchronization = () => {
361
- const location = useLocation();
187
+ const location = reactRouterDom.useLocation();
362
188
  React__default["default"].useEffect(() => {
363
189
  const deepLink = {
364
190
  path: location.pathname,
package/index.js CHANGED
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import React__default, { createContext, useContext, useState, useEffect } from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { NavigationRuntime, AssetRuntime, CustomFieldRuntime, RestRuntime, SiteRuntime } from '@trackunit/iris-app-runtime-core';
5
+ import { useLocation } from 'react-router-dom';
5
6
 
6
7
  const AnalyticsContext = createContext(null);
7
8
  const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
@@ -153,181 +154,6 @@ const OemBrandingContextProvider = (props) => {
153
154
  return jsx(OemBrandingContext.Provider, Object.assign({}, props));
154
155
  };
155
156
 
156
- /**
157
- * @remix-run/router v1.6.2
158
- *
159
- * Copyright (c) Remix Software Inc.
160
- *
161
- * This source code is licensed under the MIT license found in the
162
- * LICENSE.md file in the root directory of this source tree.
163
- *
164
- * @license MIT
165
- */
166
-
167
- ////////////////////////////////////////////////////////////////////////////////
168
- //#region Types and Constants
169
- ////////////////////////////////////////////////////////////////////////////////
170
-
171
- /**
172
- * Actions represent the type of change to a location value.
173
- */
174
- var Action;
175
-
176
- (function (Action) {
177
- /**
178
- * A POP indicates a change to an arbitrary index in the history stack, such
179
- * as a back or forward navigation. It does not describe the direction of the
180
- * navigation, only that the current index changed.
181
- *
182
- * Note: This is the default action for newly created history objects.
183
- */
184
- Action["Pop"] = "POP";
185
- /**
186
- * A PUSH indicates a new entry being added to the history stack, such as when
187
- * a link is clicked and a new page loads. When this happens, all subsequent
188
- * entries in the stack are lost.
189
- */
190
-
191
- Action["Push"] = "PUSH";
192
- /**
193
- * A REPLACE indicates the entry at the current index in the history stack
194
- * being replaced by a new one.
195
- */
196
-
197
- Action["Replace"] = "REPLACE";
198
- })(Action || (Action = {}));
199
- function invariant(value, message) {
200
- if (value === false || value === null || typeof value === "undefined") {
201
- throw new Error(message);
202
- }
203
- }
204
-
205
- var ResultType;
206
-
207
- (function (ResultType) {
208
- ResultType["data"] = "data";
209
- ResultType["deferred"] = "deferred";
210
- ResultType["redirect"] = "redirect";
211
- ResultType["error"] = "error";
212
- })(ResultType || (ResultType = {}));
213
-
214
- const validMutationMethodsArr = ["post", "put", "patch", "delete"];
215
- ["get", ...validMutationMethodsArr];
216
-
217
- /**
218
- * React Router v6.11.2
219
- *
220
- * Copyright (c) Remix Software Inc.
221
- *
222
- * This source code is licensed under the MIT license found in the
223
- * LICENSE.md file in the root directory of this source tree.
224
- *
225
- * @license MIT
226
- */
227
-
228
- const DataRouterContext = /*#__PURE__*/React.createContext(null);
229
-
230
- if (process.env.NODE_ENV !== "production") {
231
- DataRouterContext.displayName = "DataRouter";
232
- }
233
-
234
- const DataRouterStateContext = /*#__PURE__*/React.createContext(null);
235
-
236
- if (process.env.NODE_ENV !== "production") {
237
- DataRouterStateContext.displayName = "DataRouterState";
238
- }
239
-
240
- const AwaitContext = /*#__PURE__*/React.createContext(null);
241
-
242
- if (process.env.NODE_ENV !== "production") {
243
- AwaitContext.displayName = "Await";
244
- }
245
-
246
- const NavigationContext = /*#__PURE__*/React.createContext(null);
247
-
248
- if (process.env.NODE_ENV !== "production") {
249
- NavigationContext.displayName = "Navigation";
250
- }
251
-
252
- const LocationContext = /*#__PURE__*/React.createContext(null);
253
-
254
- if (process.env.NODE_ENV !== "production") {
255
- LocationContext.displayName = "Location";
256
- }
257
-
258
- const RouteContext = /*#__PURE__*/React.createContext({
259
- outlet: null,
260
- matches: [],
261
- isDataRoute: false
262
- });
263
-
264
- if (process.env.NODE_ENV !== "production") {
265
- RouteContext.displayName = "Route";
266
- }
267
-
268
- const RouteErrorContext = /*#__PURE__*/React.createContext(null);
269
-
270
- if (process.env.NODE_ENV !== "production") {
271
- RouteErrorContext.displayName = "RouteError";
272
- }
273
- /**
274
- * Returns true if this component is a descendant of a <Router>.
275
- *
276
- * @see https://reactrouter.com/hooks/use-in-router-context
277
- */
278
-
279
- function useInRouterContext() {
280
- return React.useContext(LocationContext) != null;
281
- }
282
- /**
283
- * Returns the current location object, which represents the current URL in web
284
- * browsers.
285
- *
286
- * Note: If you're using this it may mean you're doing some of your own
287
- * "routing" in your app, and we'd like to know what your use case is. We may
288
- * be able to provide something higher-level to better suit your needs.
289
- *
290
- * @see https://reactrouter.com/hooks/use-location
291
- */
292
-
293
- function useLocation() {
294
- !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
295
- // router loaded. We can help them understand how to avoid that.
296
- "useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
297
- return React.useContext(LocationContext).location;
298
- }
299
- var DataRouterHook;
300
-
301
- (function (DataRouterHook) {
302
- DataRouterHook["UseBlocker"] = "useBlocker";
303
- DataRouterHook["UseRevalidator"] = "useRevalidator";
304
- DataRouterHook["UseNavigateStable"] = "useNavigate";
305
- })(DataRouterHook || (DataRouterHook = {}));
306
-
307
- var DataRouterStateHook;
308
-
309
- (function (DataRouterStateHook) {
310
- DataRouterStateHook["UseBlocker"] = "useBlocker";
311
- DataRouterStateHook["UseLoaderData"] = "useLoaderData";
312
- DataRouterStateHook["UseActionData"] = "useActionData";
313
- DataRouterStateHook["UseRouteError"] = "useRouteError";
314
- DataRouterStateHook["UseNavigation"] = "useNavigation";
315
- DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
316
- DataRouterStateHook["UseMatches"] = "useMatches";
317
- DataRouterStateHook["UseRevalidator"] = "useRevalidator";
318
- DataRouterStateHook["UseNavigateStable"] = "useNavigate";
319
- DataRouterStateHook["UseRouteId"] = "useRouteId";
320
- })(DataRouterStateHook || (DataRouterStateHook = {}));
321
- var AwaitRenderStatus;
322
-
323
- (function (AwaitRenderStatus) {
324
- AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
325
- AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
326
- AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
327
- })(AwaitRenderStatus || (AwaitRenderStatus = {}));
328
-
329
- new Promise(() => {});
330
-
331
157
  /**
332
158
  * A react hook for notifying host about location changes
333
159
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-hooks",
3
- "version": "0.2.65",
3
+ "version": "0.2.67",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,9 +11,9 @@
11
11
  "type": "module",
12
12
  "types": "./src/index.d.ts",
13
13
  "dependencies": {
14
- "@trackunit/iris-app-runtime-core": "0.3.51",
15
- "@trackunit/iris-app-runtime-core-api": "0.3.45",
16
- "@trackunit/react-core-contexts-api": "0.2.41",
14
+ "@trackunit/iris-app-runtime-core": "0.3.53",
15
+ "@trackunit/iris-app-runtime-core-api": "0.3.47",
16
+ "@trackunit/react-core-contexts-api": "0.2.43",
17
17
  "react": "18.2.0",
18
18
  "react-router-dom": "6.11.2"
19
19
  },