@carbonorm/carbonreact 1.3.1 → 2.0.0

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
- "version": "1.3.1",
3
+ "version": "2.0.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
8
8
  "dependencies": {
9
- "@carbonorm/carbonnode": "^1.0.3",
9
+ "@carbonorm/carbonnode": "^1.0.8",
10
10
  "@fortawesome/fontawesome-svg-core": "^6.4.0",
11
11
  "@fortawesome/free-solid-svg-icons": "^6.4.0",
12
12
  "@fortawesome/react-fontawesome": "^0.2.0",
@@ -20,6 +20,7 @@
20
20
  "react-outside-click-handler": "^1.3.0",
21
21
  "react-router-dom": "^6.14.2",
22
22
  "react-toastify": "^9.1.3",
23
+ "typed-css-modules": "^0.7.2",
23
24
  "typed-scss-modules": "^7.1.2"
24
25
  },
25
26
  "devDependencies": {
@@ -61,7 +62,7 @@
61
62
  "dev": "rollup -c -w",
62
63
  "test": "node test/test.js",
63
64
  "pretest": "npm run build",
64
- "build:index": "npx barrelsby -d ./src --delete --exclude '(jestHoc|\\.test|\\.d).(js|tsx?)$' --exportDefault --verbose",
65
+ "build:index": "npx barrelsby --directory ./src --delete --exclude '(jestHoc|\\.test|\\.d).(js|tsx?)$' --exportDefault --verbose --mode top",
65
66
  "build:css": "sass ./src:./src && typed-scss-modules 'src/**/*.?(s)css' --nameFormat all --exportType default src"
66
67
  },
67
68
  "files": [
@@ -8,38 +8,35 @@ import {ToastContainer} from 'react-toastify';
8
8
  import 'react-toastify/dist/ReactToastify.min.css';
9
9
  import BackendThrowable from 'components/Errors/BackendThrowable';
10
10
  import Nest from 'components/Nest/Nest';
11
- import {iCarbons} from "variables/C6";
11
+ import {initialRestfulObjectArrayTypes, iRestfulObjectArrayTypes} from "variables/C6";
12
12
 
13
13
 
14
- export type tStatefulApiData<T> = T[] | undefined | null;
15
-
16
-
17
- // this refers to the value types of the keys above, aka values in the state
18
- export interface iRestfulObjectArrayTypes {
19
- carbons: tStatefulApiData<iCarbons>,
20
- }
21
-
22
- export type tRestfulObjectArrayKeys = keyof iRestfulObjectArrayTypes
23
-
24
- export type tRestfulObjectArrayValues = iRestfulObjectArrayTypes[tRestfulObjectArrayKeys];
25
-
26
- // @ts-ignore
27
- export type tRestfulObjectValues = tRestfulObjectArrayValues[number];
28
14
 
29
15
  // our central container, single page application is best with the DigApi
30
- export interface iCarbonORMState extends iRestfulObjectArrayTypes {
16
+ export interface iCarbonORMState {
17
+ alertsWaiting: any[],
31
18
  websocketEvents: MessageEvent[],
32
19
  websocketData: any[],
33
20
  websocket?: WebSocket,
34
- websocketMounted: boolean,
35
- alert?: boolean,
36
- alertsWaiting: any[],
37
21
  backendThrowable: any[],
38
22
  }
39
23
 
24
+ export const initialRequiredState: iCarbonORMState = {
25
+ alertsWaiting: [],
26
+ backendThrowable: [],
27
+ websocketData: [],
28
+ websocketEvents: [],
29
+ }
30
+
31
+ export const initialCarbonORMState: iCarbonORMState = {
32
+ ...initialRestfulObjectArrayTypes,
33
+ ...initialRequiredState,
34
+
35
+ }
36
+
40
37
  export default class CarbonReact<P = {}, S = {}> extends React.Component<{
41
38
  children?: ReactNode | ReactNode[],
42
- } & P, iCarbonORMState & S> {
39
+ } & P, ( iRestfulObjectArrayTypes |& S ) & iCarbonORMState> {
43
40
 
44
41
  static instance: CarbonReact;
45
42
 
@@ -53,14 +50,7 @@ export default class CarbonReact<P = {}, S = {}> extends React.Component<{
53
50
 
54
51
  super(props);
55
52
 
56
- this.state = {
57
- carbons: undefined,
58
- alertsWaiting: [],
59
- backendThrowable: [],
60
- websocketData: [],
61
- websocketEvents: [],
62
- websocketMounted: false,
63
- } as unknown as iCarbonORMState & S;
53
+ this.state = initialCarbonORMState as unknown as iCarbonORMState & S;
64
54
 
65
55
  CarbonReact.instance = this;
66
56
 
@@ -271,7 +271,7 @@ function axiosInterceptors(axios: AxiosInstance): void {
271
271
 
272
272
  if (isTest) {
273
273
 
274
- throw new Error(error?.response.data['CarbonPHP\\Error\\PublicAlert'] ?? error?.response.data['DropInGaming\\PHP\\Errors\\DropException'] ?? JSON.stringify(error?.response.data, undefined, 4))
274
+ throw new Error(error?.response.data['CarbonPHP\\Error\\PublicAlert'] ?? error?.response.data['TRACE'] ?? JSON.stringify(error?.response.data, undefined, 4))
275
275
 
276
276
  }
277
277
 
@@ -1,6 +1,6 @@
1
1
  import classNames from "classnames";
2
2
  import BootstrapStyle from "variables/bootstrap.module.css"
3
- import DropInGamingStyles from "style.module.css"
3
+ import Styles from "style.module.css"
4
4
 
5
5
  export const getRootStyleValue = (property = '--dig_primary_color') : string => {
6
6
 
@@ -27,13 +27,13 @@ function mergeStyles<iStyleA extends iStyle, iStyleB extends iStyle>(styleA : iS
27
27
 
28
28
  }
29
29
 
30
- const dropStyles = mergeStyles(BootstrapStyle, DropInGamingStyles);
30
+ const dropStyles = mergeStyles(BootstrapStyle, Styles);
31
31
 
32
32
  type tBootstrap = typeof BootstrapStyle
33
33
 
34
- type tDropInGaming = typeof DropInGamingStyles
34
+ type tStyles = typeof Styles
35
35
 
36
- export default function getStyles<iCSS extends {}>(overrides: iCSS = {} as iCSS): tBootstrap & tDropInGaming & iCSS {
36
+ export default function getStyles<iCSS extends {}>(overrides: iCSS = {} as iCSS): tBootstrap & tStyles & iCSS {
37
37
 
38
38
  if (0 === Object.keys(overrides).length) {
39
39
  return dropStyles as (typeof dropStyles) & iCSS
@@ -5,7 +5,7 @@ export default function setUrl() {
5
5
 
6
6
  const isGitHubActions = process.env.REACT_APP_TEST_REMOTE === 'true'
7
7
 
8
- const host = ( isGitHubActions ? process.env.REACT_APP_REMOTE_SUBDOMAIN : process.env.REACT_APP_LOCAL_SUBDOMAIN ) + '.dropingaming.com' + (isGitHubActions ? '' : ':8080')
8
+ const host = ( isGitHubActions ? process.env.REACT_APP_REMOTE_SUBDOMAIN : process.env.REACT_APP_LOCAL_SUBDOMAIN ) + '.example.com' + (isGitHubActions ? '' : ':8080')
9
9
 
10
10
  console.log("test host:: ", host, isGitHubActions)
11
11