@putkoff/abstract-utilities 0.1.103 → 0.1.105

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.
@@ -0,0 +1,8 @@
1
+ /** Runtime-loaded JSON (config.json) shape */
2
+ export interface RuntimeConfig {
3
+ API_BASE_URL: string;
4
+ }
5
+ /** Call once, early in app startup (e.g. in index.tsx) */
6
+ export declare function load(): Promise<void>;
7
+ /** Get the base (after `load()`), or '' if not loaded yet */
8
+ export declare function apiBase(): string;
@@ -4,5 +4,4 @@ export { stripPrefixes } from './../string_utils';
4
4
  export { alertit } from './../rndm_utils';
5
5
  export { ensure_list } from './../type_utils';
6
6
  export { eatInner } from './../string_utils';
7
- export { AppConfig } from './../../utils/src/config';
8
7
  export type { LogoutButtonProps, FetchVariables } from './../../types';
@@ -4,8 +4,6 @@ export declare function ensureAbstractUrl(endpoint: string, slices?: string[]):
4
4
  * Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
5
5
  */
6
6
  export declare function getResult<T>(obj: unknown): T;
7
- /** Pulls base-URL from AppConfig.API_BASE_URL, strips trailing slashes */
8
- export declare function getRawConfigUrl(): any;
9
7
  export declare function api(endpoint: string): string;
10
8
  export declare function checkResponse(res: Response): any;
11
9
  export declare function parseResult(res: Response): Promise<unknown>;
@@ -1,3 +1,4 @@
1
+ export { useCallback, useRef, useState } from "react";
1
2
  export * from './auth_utils';
2
3
  export * from './constants_utils';
3
4
  export * from './env_utils';
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
3
  var react = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
7
  /******************************************************************************
@@ -1111,15 +1111,8 @@ function getFetchVars(headers = null, method = null, body = null) {
1111
1111
  }
1112
1112
 
1113
1113
  function getAppConfig(endpoint) {
1114
- var _a;
1115
- const rawBase = (_a = void 0 ) !== null && _a !== void 0 ? _a : "";
1116
- const base = rawBase.replace(/\/+$/, "");
1117
- // strip any leading slashes on endpoint, then prefix “/api/”
1118
- const cleanEndpoint = endpoint.replace(/^\/+/, "");
1119
- const url = base
1120
- ? `${base}/${cleanEndpoint}`
1121
- : `/api/${cleanEndpoint}`;
1122
- return url;
1114
+ const clean = endpoint.replace(/^\/+/, '');
1115
+ return `/api/${clean}`;
1123
1116
  }
1124
1117
 
1125
1118
  /**
@@ -1707,6 +1700,18 @@ function useFiles() {
1707
1700
  };
1708
1701
  }
1709
1702
 
1703
+ Object.defineProperty(exports, "useCallback", {
1704
+ enumerable: true,
1705
+ get: function () { return react.useCallback; }
1706
+ });
1707
+ Object.defineProperty(exports, "useRef", {
1708
+ enumerable: true,
1709
+ get: function () { return react.useRef; }
1710
+ });
1711
+ Object.defineProperty(exports, "useState", {
1712
+ enumerable: true,
1713
+ get: function () { return react.useState; }
1714
+ });
1710
1715
  exports.API_PREFIX = API_PREFIX;
1711
1716
  exports.BASE_URL = BASE_URL;
1712
1717
  exports.Button = Button;