@carbonorm/carbonreact 4.0.25 → 5.0.4

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/dist/index.esm.js CHANGED
@@ -1,440 +1,14 @@
1
- import require$$0, { useRef, useEffect, useState, Component, createContext, lazy } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useNavigate, HashRouter, MemoryRouter, BrowserRouter } from 'react-router-dom';
3
+ import React, { useRef, useEffect, useState, Component, createContext, lazy } from 'react';
3
4
  import { toast, ToastContainer } from 'react-toastify';
4
- import { toastOptions, timeout, axiosInstance, isVerbose, checkAllRequestsComplete } from '@carbonorm/carbonnode';
5
+ import { toastOptions, isVerbose, timeout, axiosInstance, checkAllRequestsComplete } from '@carbonorm/carbonnode';
5
6
  import classNames from 'classnames';
6
7
  import { faClose } from '@fortawesome/free-solid-svg-icons';
7
8
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
9
  import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
9
10
  import { waitFor } from '@testing-library/react';
10
11
 
11
- var jsxRuntime = {exports: {}};
12
-
13
- var reactJsxRuntime_production = {};
14
-
15
- /**
16
- * @license React
17
- * react-jsx-runtime.production.js
18
- *
19
- * Copyright (c) Meta Platforms, Inc. and affiliates.
20
- *
21
- * This source code is licensed under the MIT license found in the
22
- * LICENSE file in the root directory of this source tree.
23
- */
24
-
25
- var hasRequiredReactJsxRuntime_production;
26
-
27
- function requireReactJsxRuntime_production () {
28
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
29
- hasRequiredReactJsxRuntime_production = 1;
30
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
31
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
32
- function jsxProd(type, config, maybeKey) {
33
- var key = null;
34
- void 0 !== maybeKey && (key = "" + maybeKey);
35
- void 0 !== config.key && (key = "" + config.key);
36
- if ("key" in config) {
37
- maybeKey = {};
38
- for (var propName in config)
39
- "key" !== propName && (maybeKey[propName] = config[propName]);
40
- } else maybeKey = config;
41
- config = maybeKey.ref;
42
- return {
43
- $$typeof: REACT_ELEMENT_TYPE,
44
- type: type,
45
- key: key,
46
- ref: void 0 !== config ? config : null,
47
- props: maybeKey
48
- };
49
- }
50
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
51
- reactJsxRuntime_production.jsx = jsxProd;
52
- reactJsxRuntime_production.jsxs = jsxProd;
53
- return reactJsxRuntime_production;
54
- }
55
-
56
- var reactJsxRuntime_development = {};
57
-
58
- /**
59
- * @license React
60
- * react-jsx-runtime.development.js
61
- *
62
- * Copyright (c) Meta Platforms, Inc. and affiliates.
63
- *
64
- * This source code is licensed under the MIT license found in the
65
- * LICENSE file in the root directory of this source tree.
66
- */
67
-
68
- var hasRequiredReactJsxRuntime_development;
69
-
70
- function requireReactJsxRuntime_development () {
71
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
72
- hasRequiredReactJsxRuntime_development = 1;
73
- "production" !== process.env.NODE_ENV &&
74
- (function () {
75
- function getComponentNameFromType(type) {
76
- if (null == type) return null;
77
- if ("function" === typeof type)
78
- return type.$$typeof === REACT_CLIENT_REFERENCE
79
- ? null
80
- : type.displayName || type.name || null;
81
- if ("string" === typeof type) return type;
82
- switch (type) {
83
- case REACT_FRAGMENT_TYPE:
84
- return "Fragment";
85
- case REACT_PROFILER_TYPE:
86
- return "Profiler";
87
- case REACT_STRICT_MODE_TYPE:
88
- return "StrictMode";
89
- case REACT_SUSPENSE_TYPE:
90
- return "Suspense";
91
- case REACT_SUSPENSE_LIST_TYPE:
92
- return "SuspenseList";
93
- case REACT_ACTIVITY_TYPE:
94
- return "Activity";
95
- }
96
- if ("object" === typeof type)
97
- switch (
98
- ("number" === typeof type.tag &&
99
- console.error(
100
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
101
- ),
102
- type.$$typeof)
103
- ) {
104
- case REACT_PORTAL_TYPE:
105
- return "Portal";
106
- case REACT_CONTEXT_TYPE:
107
- return (type.displayName || "Context") + ".Provider";
108
- case REACT_CONSUMER_TYPE:
109
- return (type._context.displayName || "Context") + ".Consumer";
110
- case REACT_FORWARD_REF_TYPE:
111
- var innerType = type.render;
112
- type = type.displayName;
113
- type ||
114
- ((type = innerType.displayName || innerType.name || ""),
115
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
116
- return type;
117
- case REACT_MEMO_TYPE:
118
- return (
119
- (innerType = type.displayName || null),
120
- null !== innerType
121
- ? innerType
122
- : getComponentNameFromType(type.type) || "Memo"
123
- );
124
- case REACT_LAZY_TYPE:
125
- innerType = type._payload;
126
- type = type._init;
127
- try {
128
- return getComponentNameFromType(type(innerType));
129
- } catch (x) {}
130
- }
131
- return null;
132
- }
133
- function testStringCoercion(value) {
134
- return "" + value;
135
- }
136
- function checkKeyStringCoercion(value) {
137
- try {
138
- testStringCoercion(value);
139
- var JSCompiler_inline_result = !1;
140
- } catch (e) {
141
- JSCompiler_inline_result = true;
142
- }
143
- if (JSCompiler_inline_result) {
144
- JSCompiler_inline_result = console;
145
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
146
- var JSCompiler_inline_result$jscomp$0 =
147
- ("function" === typeof Symbol &&
148
- Symbol.toStringTag &&
149
- value[Symbol.toStringTag]) ||
150
- value.constructor.name ||
151
- "Object";
152
- JSCompiler_temp_const.call(
153
- JSCompiler_inline_result,
154
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
155
- JSCompiler_inline_result$jscomp$0
156
- );
157
- return testStringCoercion(value);
158
- }
159
- }
160
- function getTaskName(type) {
161
- if (type === REACT_FRAGMENT_TYPE) return "<>";
162
- if (
163
- "object" === typeof type &&
164
- null !== type &&
165
- type.$$typeof === REACT_LAZY_TYPE
166
- )
167
- return "<...>";
168
- try {
169
- var name = getComponentNameFromType(type);
170
- return name ? "<" + name + ">" : "<...>";
171
- } catch (x) {
172
- return "<...>";
173
- }
174
- }
175
- function getOwner() {
176
- var dispatcher = ReactSharedInternals.A;
177
- return null === dispatcher ? null : dispatcher.getOwner();
178
- }
179
- function UnknownOwner() {
180
- return Error("react-stack-top-frame");
181
- }
182
- function hasValidKey(config) {
183
- if (hasOwnProperty.call(config, "key")) {
184
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
185
- if (getter && getter.isReactWarning) return false;
186
- }
187
- return void 0 !== config.key;
188
- }
189
- function defineKeyPropWarningGetter(props, displayName) {
190
- function warnAboutAccessingKey() {
191
- specialPropKeyWarningShown ||
192
- ((specialPropKeyWarningShown = true),
193
- console.error(
194
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
195
- displayName
196
- ));
197
- }
198
- warnAboutAccessingKey.isReactWarning = true;
199
- Object.defineProperty(props, "key", {
200
- get: warnAboutAccessingKey,
201
- configurable: true
202
- });
203
- }
204
- function elementRefGetterWithDeprecationWarning() {
205
- var componentName = getComponentNameFromType(this.type);
206
- didWarnAboutElementRef[componentName] ||
207
- ((didWarnAboutElementRef[componentName] = true),
208
- console.error(
209
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
210
- ));
211
- componentName = this.props.ref;
212
- return void 0 !== componentName ? componentName : null;
213
- }
214
- function ReactElement(
215
- type,
216
- key,
217
- self,
218
- source,
219
- owner,
220
- props,
221
- debugStack,
222
- debugTask
223
- ) {
224
- self = props.ref;
225
- type = {
226
- $$typeof: REACT_ELEMENT_TYPE,
227
- type: type,
228
- key: key,
229
- props: props,
230
- _owner: owner
231
- };
232
- null !== (void 0 !== self ? self : null)
233
- ? Object.defineProperty(type, "ref", {
234
- enumerable: false,
235
- get: elementRefGetterWithDeprecationWarning
236
- })
237
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
238
- type._store = {};
239
- Object.defineProperty(type._store, "validated", {
240
- configurable: false,
241
- enumerable: false,
242
- writable: true,
243
- value: 0
244
- });
245
- Object.defineProperty(type, "_debugInfo", {
246
- configurable: false,
247
- enumerable: false,
248
- writable: true,
249
- value: null
250
- });
251
- Object.defineProperty(type, "_debugStack", {
252
- configurable: false,
253
- enumerable: false,
254
- writable: true,
255
- value: debugStack
256
- });
257
- Object.defineProperty(type, "_debugTask", {
258
- configurable: false,
259
- enumerable: false,
260
- writable: true,
261
- value: debugTask
262
- });
263
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
264
- return type;
265
- }
266
- function jsxDEVImpl(
267
- type,
268
- config,
269
- maybeKey,
270
- isStaticChildren,
271
- source,
272
- self,
273
- debugStack,
274
- debugTask
275
- ) {
276
- var children = config.children;
277
- if (void 0 !== children)
278
- if (isStaticChildren)
279
- if (isArrayImpl(children)) {
280
- for (
281
- isStaticChildren = 0;
282
- isStaticChildren < children.length;
283
- isStaticChildren++
284
- )
285
- validateChildKeys(children[isStaticChildren]);
286
- Object.freeze && Object.freeze(children);
287
- } else
288
- console.error(
289
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
290
- );
291
- else validateChildKeys(children);
292
- if (hasOwnProperty.call(config, "key")) {
293
- children = getComponentNameFromType(type);
294
- var keys = Object.keys(config).filter(function (k) {
295
- return "key" !== k;
296
- });
297
- isStaticChildren =
298
- 0 < keys.length
299
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
300
- : "{key: someKey}";
301
- didWarnAboutKeySpread[children + isStaticChildren] ||
302
- ((keys =
303
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
304
- console.error(
305
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
306
- isStaticChildren,
307
- children,
308
- keys,
309
- children
310
- ),
311
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
312
- }
313
- children = null;
314
- void 0 !== maybeKey &&
315
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
316
- hasValidKey(config) &&
317
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
318
- if ("key" in config) {
319
- maybeKey = {};
320
- for (var propName in config)
321
- "key" !== propName && (maybeKey[propName] = config[propName]);
322
- } else maybeKey = config;
323
- children &&
324
- defineKeyPropWarningGetter(
325
- maybeKey,
326
- "function" === typeof type
327
- ? type.displayName || type.name || "Unknown"
328
- : type
329
- );
330
- return ReactElement(
331
- type,
332
- children,
333
- self,
334
- source,
335
- getOwner(),
336
- maybeKey,
337
- debugStack,
338
- debugTask
339
- );
340
- }
341
- function validateChildKeys(node) {
342
- "object" === typeof node &&
343
- null !== node &&
344
- node.$$typeof === REACT_ELEMENT_TYPE &&
345
- node._store &&
346
- (node._store.validated = 1);
347
- }
348
- var React = require$$0,
349
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
350
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
351
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
352
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
353
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
354
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
355
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
356
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
357
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
358
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
359
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
360
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
361
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
362
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
363
- ReactSharedInternals =
364
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
365
- hasOwnProperty = Object.prototype.hasOwnProperty,
366
- isArrayImpl = Array.isArray,
367
- createTask = console.createTask
368
- ? console.createTask
369
- : function () {
370
- return null;
371
- };
372
- React = {
373
- "react-stack-bottom-frame": function (callStackForError) {
374
- return callStackForError();
375
- }
376
- };
377
- var specialPropKeyWarningShown;
378
- var didWarnAboutElementRef = {};
379
- var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
380
- React,
381
- UnknownOwner
382
- )();
383
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
384
- var didWarnAboutKeySpread = {};
385
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
386
- reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
387
- var trackActualOwner =
388
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
389
- return jsxDEVImpl(
390
- type,
391
- config,
392
- maybeKey,
393
- false,
394
- source,
395
- self,
396
- trackActualOwner
397
- ? Error("react-stack-top-frame")
398
- : unknownOwnerDebugStack,
399
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
400
- );
401
- };
402
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
403
- var trackActualOwner =
404
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
405
- return jsxDEVImpl(
406
- type,
407
- config,
408
- maybeKey,
409
- true,
410
- source,
411
- self,
412
- trackActualOwner
413
- ? Error("react-stack-top-frame")
414
- : unknownOwnerDebugStack,
415
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
416
- );
417
- };
418
- })();
419
- return reactJsxRuntime_development;
420
- }
421
-
422
- var hasRequiredJsxRuntime;
423
-
424
- function requireJsxRuntime () {
425
- if (hasRequiredJsxRuntime) return jsxRuntime.exports;
426
- hasRequiredJsxRuntime = 1;
427
-
428
- if (process.env.NODE_ENV === 'production') {
429
- jsxRuntime.exports = requireReactJsxRuntime_production();
430
- } else {
431
- jsxRuntime.exports = requireReactJsxRuntime_development();
432
- }
433
- return jsxRuntime.exports;
434
- }
435
-
436
- var jsxRuntimeExports = requireJsxRuntime();
437
-
438
12
  const clone = (obj) => {
439
13
  try {
440
14
  return structuredClone(obj);
@@ -503,28 +77,28 @@ function OutsideClickHandler({ onOutsideClick, children, disabled, useCapture })
503
77
  document.removeEventListener('touchstart', handle, useCapture);
504
78
  };
505
79
  }, [onOutsideClick, disabled, useCapture]);
506
- return jsxRuntimeExports.jsx("div", { ref: containerRef, children: children });
80
+ return jsx("div", { ref: containerRef, children: children });
507
81
  }
508
82
 
509
83
  var BackendThrowable = (props) => {
510
84
  const { instance } = props;
511
85
  const currentThrowable = instance.state.backendThrowable[0];
512
86
  console.log([instance.state.backendThrowable, currentThrowable]);
513
- return jsxRuntimeExports.jsxs("div", { className: styles$1.maintenanceHero, children: [jsxRuntimeExports.jsx("h1", { className: styles$1.httpStatusCode, children: currentThrowable?.status || 500 }), jsxRuntimeExports.jsx(OutsideClickHandler, { onOutsideClick: () => instance.setState(currentState => ({ backendThrowable: currentState.backendThrowable.slice(1) })), children: jsxRuntimeExports.jsx("div", { className: styles$1.centeredContainer, children: Object.keys(currentThrowable).map((key, index) => {
87
+ return jsxs("div", { className: styles$1.maintenanceHero, children: [jsx("h1", { className: styles$1.httpStatusCode, children: currentThrowable?.status || 500 }), jsx(OutsideClickHandler, { onOutsideClick: () => instance.setState(currentState => ({ backendThrowable: currentState.backendThrowable.slice(1) })), children: jsx("div", { className: styles$1.centeredContainer, children: Object.keys(currentThrowable).map((key, index) => {
514
88
  const valueIsString = typeof currentThrowable[key] === 'string';
515
89
  const valueIsCode = 'THROWN NEAR' === key;
516
- return jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: styles$1.errorTextGeneral, children: [" > ", jsxRuntimeExports.jsx("span", { className: styles$1.errorKeys, children: key }), ":", valueIsString
517
- ? (valueIsCode ? jsxRuntimeExports.jsx("div", { style: { backgroundColor: 'black', fontSize: 'xx-small' }, dangerouslySetInnerHTML: { __html: currentThrowable[key] } }) :
518
- jsxRuntimeExports.jsxs("i", { className: styles$1.errorValues, children: ["\"", currentThrowable[key], "\""] }))
90
+ return jsxs("div", { children: [jsxs("div", { className: styles$1.errorTextGeneral, children: [" > ", jsx("span", { className: styles$1.errorKeys, children: key }), ":", valueIsString
91
+ ? (valueIsCode ? jsx("div", { style: { backgroundColor: 'black', fontSize: 'xx-small' }, dangerouslySetInnerHTML: { __html: currentThrowable[key] } }) :
92
+ jsxs("i", { className: styles$1.errorValues, children: ["\"", currentThrowable[key], "\""] }))
519
93
  : ''] }), valueIsString
520
94
  ? ''
521
- : jsxRuntimeExports.jsx("pre", { className: styles$1.errorPre, children: JSON.stringify(currentThrowable[key], undefined, 4) })] }, index);
95
+ : jsx("pre", { className: styles$1.errorPre, children: JSON.stringify(currentThrowable[key], undefined, 4) })] }, index);
522
96
  }) }) })] });
523
97
  };
524
98
 
525
99
  const range = n => new Array(n).fill(0).map((_, idx) => idx);
526
100
  // @link https://sites.google.com/site/webglbook/home/chapter-3
527
- class Nest extends require$$0.Component {
101
+ class Nest extends React.Component {
528
102
  static defaultProps = {
529
103
  backgroundColor: "white",
530
104
  display: "block",
@@ -640,7 +214,7 @@ class Nest extends require$$0.Component {
640
214
  cancelAnimationFrame(this.tid);
641
215
  }
642
216
  render() {
643
- return (jsxRuntimeExports.jsxs("div", { children: [this.props.children, jsxRuntimeExports.jsx("canvas", { id: "2d", width: window.innerWidth, height: window.innerHeight, style: {
217
+ return (jsxs("div", { children: [this.props.children, jsx("canvas", { id: "2d", width: window.innerWidth, height: window.innerHeight, style: {
644
218
  backgroundColor: this.props.backgroundColor,
645
219
  display: this.props.display,
646
220
  position: this.props.position,
@@ -3013,7 +2587,7 @@ function getStyles(overrides = {}) {
3013
2587
  // @link https://stackoverflow.com/questions/58399637/include-modal-functionality-in-react-higher-order-component
3014
2588
  function Popup({ open = true, handleClose, children, maxWidth, }) {
3015
2589
  const dig = getStyles();
3016
- return jsxRuntimeExports.jsx("div", { className: classNames(dig.modal, dig.fade, { [dig.show]: open }, dig.dBlock), style: { backgroundColor: "rgba(0,0,0,0.8)" }, id: "exampleModalCenter", tabIndex: -1, "aria-labelledby": "exampleModalCenterTitle", "aria-modal": "true", role: "dialog", children: jsxRuntimeExports.jsx("div", { style: { maxWidth: maxWidth }, className: classNames(dig.modalDialog, dig.modalDialogCentered), children: jsxRuntimeExports.jsx(OutsideClickHandler, { onOutsideClick: () => handleClose(), children: jsxRuntimeExports.jsx("div", { className: classNames(dig.modalContent, dig.bgTransparent, dig.modalDialogScrollable), children: children }) }) }) });
2590
+ return jsx("div", { className: classNames(dig.modal, dig.fade, { [dig.show]: open }, dig.dBlock), style: { backgroundColor: "rgba(0,0,0,0.8)" }, id: "exampleModalCenter", tabIndex: -1, "aria-labelledby": "exampleModalCenterTitle", "aria-modal": "true", role: "dialog", children: jsx("div", { style: { maxWidth: maxWidth }, className: classNames(dig.modalDialog, dig.modalDialogCentered), children: jsx(OutsideClickHandler, { onOutsideClick: () => handleClose(), children: jsx("div", { className: classNames(dig.modalContent, dig.bgTransparent, dig.modalDialogScrollable), children: children }) }) }) });
3017
2591
  }
3018
2592
 
3019
2593
  const isProduction = window.location.host.split(".")[0] === "www";
@@ -3103,20 +2677,20 @@ function Alert({ instance }) {
3103
2677
  handleClose();
3104
2678
  }, timeout);
3105
2679
  }
3106
- return jsxRuntimeExports.jsx(Popup, { handleClose: handleClose, children: jsxRuntimeExports.jsxs("div", { className: classNames("model-content", styles.rounded0, styles.border0), style: {
2680
+ return jsx(Popup, { handleClose: handleClose, children: jsxs("div", { className: classNames("model-content", styles.rounded0, styles.border0), style: {
3107
2681
  maxWidth: '75vw',
3108
2682
  maxHeight: '75vh',
3109
- }, children: [jsxRuntimeExports.jsxs("div", { className: classNames(styles.modalHeader, styles.rounded0, styles.border0, {
2683
+ }, children: [jsxs("div", { className: classNames(styles.modalHeader, styles.rounded0, styles.border0, {
3110
2684
  // icon?: "warning" | "error" | "success" | "info" | "question"
3111
2685
  [styles.bg_primary]: "info" === alert.icon || alert.icon === undefined || alert.icon === null,
3112
2686
  [styles.bg_success]: "success" === alert.icon,
3113
2687
  [styles.bg_warning]: "warning" === alert.icon,
3114
2688
  [styles.bg_danger]: "error" === alert.icon, // TODO - change to red
3115
2689
  [styles.bgPrimary]: "question" === alert.icon,
3116
- }), children: [jsxRuntimeExports.jsxs("h3", { className: classNames(styles.modalTitle, styles.textDark), id: "staticBackdropLabel", children: ["#", alertWaiting, " ", alert.title] }), jsxRuntimeExports.jsx("div", { onClick: handleClose, children: jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faClose, size: 'xl' }) })] }), jsxRuntimeExports.jsx("div", { className: classNames(styles.modalBody, styles.border0, styles.textWhite), children: jsxRuntimeExports.jsxs("div", { className: styles.textCenter, children: [alert.text, alert.component] }) }), undefined !== alert.buttons &&
3117
- jsxRuntimeExports.jsxs("div", { className: classNames(styles.modalFooter, styles.border0, styles.rounded0), children: [alert.footerText &&
3118
- jsxRuntimeExports.jsx("div", { className: classNames(styles.textCenter, styles.textWhite), children: alert.footerText }), alert.buttons?.map((button, index) => {
3119
- return jsxRuntimeExports.jsx("button", { className: classNames(styles.btn, styles.btnLg, {
2690
+ }), children: [jsxs("h3", { className: classNames(styles.modalTitle, styles.textDark), id: "staticBackdropLabel", children: ["#", alertWaiting, " ", alert.title] }), jsx("div", { onClick: handleClose, children: jsx(FontAwesomeIcon, { icon: faClose, size: 'xl' }) })] }), jsx("div", { className: classNames(styles.modalBody, styles.border0, styles.textWhite), children: jsxs("div", { className: styles.textCenter, children: [alert.text, alert.component] }) }), undefined !== alert.buttons &&
2691
+ jsxs("div", { className: classNames(styles.modalFooter, styles.border0, styles.rounded0), children: [alert.footerText &&
2692
+ jsx("div", { className: classNames(styles.textCenter, styles.textWhite), children: alert.footerText }), alert.buttons?.map((button, index) => {
2693
+ return jsx("button", { className: classNames(styles.btn, styles.btnLg, {
3120
2694
  // todo - color: "default" | "primary" | "secondary" | "inherit" | "danger" | "info" | "success" | "warning" | undefined,
3121
2695
  [styles.bg_success]: "success" === button.color,
3122
2696
  [styles.bg_danger]: "danger" === button.color,
@@ -3132,7 +2706,7 @@ function Alert({ instance }) {
3132
2706
  // @link https://dev.to/ag-grid/react-18-avoiding-use-effect-getting-called-twice-4i9e
3133
2707
  const useEffectOnce = (effect) => {
3134
2708
  const effectFn = useRef(effect);
3135
- const destroyFn = useRef();
2709
+ const destroyFn = useRef(undefined);
3136
2710
  const effectCalled = useRef(false);
3137
2711
  const rendered = useRef(false);
3138
2712
  const [, setVal] = useState(0);
@@ -3162,7 +2736,8 @@ const useEffectOnce = (effect) => {
3162
2736
  **/
3163
2737
  function initiateWebsocket(props) {
3164
2738
  let { instance, url = 'ws' + (window.location.protocol === 'https:' ? 's' : '') + '://' + window.location.host + '/carbonorm/websocket', timeoutSeconds = 250, heartbeatSeconds = 60, C6 } = props;
3165
- const { TABLES = undefined, IMPORT = undefined, } = C6 ?? {};
2739
+ const { TABLES = undefined, } = C6 ?? {};
2740
+ const verbose = isVerbose();
3166
2741
  const { websocket } = instance.state;
3167
2742
  if (!("WebSocket" in window)) {
3168
2743
  // todo - store that this has been shown in the state
@@ -3206,70 +2781,96 @@ function initiateWebsocket(props) {
3206
2781
  websocketData: prevState.websocketData.concat(parsedData), // JSON.parse no good - base64?
3207
2782
  }), () => {
3208
2783
  if (undefined === TABLES) {
3209
- console.log('WebSocket updates without the TABLES property passed will not automatically update the state.');
2784
+ if (verbose) {
2785
+ console.log('WebSocket updates without the TABLES property passed will not automatically update the state.');
2786
+ }
3210
2787
  return;
3211
2788
  }
3212
2789
  if (parsedData?.REST) {
3213
2790
  const TABLE_NAME = parsedData?.REST?.TABLE_NAME;
3214
- const TABLE_PREFIX = parsedData?.REST?.TABLE_PREFIX;
2791
+ const TABLE_PREFIX = parsedData?.REST?.TABLE_PREFIX ?? '';
3215
2792
  const METHOD = parsedData?.REST?.METHOD;
3216
2793
  const REQUEST = parsedData?.REST?.REQUEST;
3217
2794
  const REQUEST_PRIMARY_KEY = parsedData?.REST?.REQUEST_PRIMARY_KEY ?? null;
3218
2795
  if (null === REQUEST_PRIMARY_KEY) {
3219
- console.log('WebSocket updates without a primary key are not yet supported.');
2796
+ if (verbose) {
2797
+ console.log('WebSocket updates without a primary key are not yet supported.');
2798
+ }
3220
2799
  return;
3221
2800
  }
3222
- console.log('todo - going to impl REST', TABLE_NAME, METHOD, REQUEST_PRIMARY_KEY, parsedData?.REST);
3223
- const TABLE_NAME_SHORT = TABLE_NAME.substring(TABLE_PREFIX.length);
2801
+ if (verbose) {
2802
+ console.log('todo - going to impl REST', TABLE_NAME, METHOD, REQUEST_PRIMARY_KEY, parsedData?.REST);
2803
+ }
2804
+ const TABLE_NAME_SHORT = TABLE_NAME.startsWith(TABLE_PREFIX)
2805
+ ? TABLE_NAME.substring(TABLE_PREFIX.length)
2806
+ : TABLE_NAME;
3224
2807
  const currentCache = instance.state[TABLE_NAME_SHORT];
3225
2808
  // just because we have a websocket update, doesn't mean we need the update
3226
2809
  // check to see if the primary key is in the current cache
3227
2810
  const c6Table = TABLES[TABLE_NAME_SHORT] ?? null;
3228
2811
  if (null === c6Table) {
3229
- console.error('WebSocket update could not find (' + TABLE_NAME_SHORT + ') in the TABLES property passed.', TABLES);
2812
+ if (verbose) {
2813
+ console.error('WebSocket update could not find (' + TABLE_NAME_SHORT + ') in the TABLES property passed.', TABLES);
2814
+ }
3230
2815
  return;
3231
2816
  }
3232
- const primaryKeyKeys = Object.keys(REQUEST_PRIMARY_KEY);
3233
- // todo - which direction should we filter
3234
- const elementsToUpdate = currentCache?.filter((row) => {
3235
- for (const element of primaryKeyKeys) {
3236
- // remove the table name from the column name
3237
- const column = element.split('.')[1];
3238
- console.log('column', column, REQUEST_PRIMARY_KEY[element], row[column]);
3239
- if (REQUEST_PRIMARY_KEY[element] !== row[column]) {
3240
- return false;
2817
+ const columns = c6Table.COLUMNS;
2818
+ const validColumns = new Set(Object.values(columns));
2819
+ const normalizeRecord = (record) => {
2820
+ const normalized = {};
2821
+ for (const [key, value] of Object.entries(record ?? {})) {
2822
+ const shortKey = columns[key] ?? (key.includes('.') ? key.split('.').pop() : key);
2823
+ if (validColumns.has(shortKey)) {
2824
+ normalized[shortKey] = value;
3241
2825
  }
3242
2826
  }
3243
- return true;
3244
- }) ?? [];
3245
- console.log('elementsToUpdate', elementsToUpdate);
2827
+ return normalized;
2828
+ };
2829
+ const normalizedPrimaryKey = normalizeRecord(REQUEST_PRIMARY_KEY);
2830
+ const primaryKeyKeys = Object.keys(normalizedPrimaryKey);
2831
+ if (primaryKeyKeys.length === 0) {
2832
+ if (verbose) {
2833
+ console.error('WebSocket update could not map primary keys for', TABLE_NAME_SHORT, REQUEST_PRIMARY_KEY);
2834
+ }
2835
+ return;
2836
+ }
2837
+ // todo - which direction should we filter
2838
+ const elementsToUpdate = currentCache?.filter((row) => primaryKeyKeys.every((key) => normalizedPrimaryKey[key] === row[key])) ?? [];
2839
+ if (verbose) {
2840
+ console.log('elementsToUpdate', elementsToUpdate);
2841
+ }
3246
2842
  if (elementsToUpdate.length === 0) {
3247
- console.error('Could not find any elements to update in the cache.', elementsToUpdate, primaryKeyKeys, REQUEST_PRIMARY_KEY, currentCache);
2843
+ if (verbose) {
2844
+ console.error('Could not find any elements to update in the cache.', elementsToUpdate, primaryKeyKeys, REQUEST_PRIMARY_KEY, currentCache);
2845
+ }
3248
2846
  return;
3249
2847
  }
3250
- const updatedElements = elementsToUpdate.map((row) => {
3251
- return {
3252
- ...row,
3253
- ...REQUEST
3254
- };
3255
- });
3256
- updatedElements.forEach(async (row) => {
3257
- const RestRequests = await IMPORT?.(TABLE_NAME_SHORT);
3258
- const { postState, deleteState, putState, } = RestRequests;
3259
- switch (METHOD) {
3260
- case 'POST':
3261
- postState({}, row);
3262
- break;
3263
- case 'DELETE':
3264
- deleteState({}, row);
3265
- break;
3266
- case 'PUT':
3267
- putState({}, row);
3268
- break;
3269
- default:
2848
+ const normalizedRequest = normalizeRecord(REQUEST);
2849
+ const updatedElements = elementsToUpdate.map((row) => ({
2850
+ ...row,
2851
+ ...normalizedRequest,
2852
+ }));
2853
+ switch (METHOD) {
2854
+ case 'POST':
2855
+ case 'PUT':
2856
+ instance.updateRestfulObjectArrays({
2857
+ dataOrCallback: updatedElements,
2858
+ stateKey: TABLE_NAME_SHORT,
2859
+ uniqueObjectId: c6Table.PRIMARY_SHORT,
2860
+ });
2861
+ break;
2862
+ case 'DELETE':
2863
+ instance.deleteRestfulObjectArrays({
2864
+ dataOrCallback: elementsToUpdate,
2865
+ stateKey: TABLE_NAME_SHORT,
2866
+ uniqueObjectId: c6Table.PRIMARY_SHORT,
2867
+ });
2868
+ break;
2869
+ default:
2870
+ if (verbose) {
3270
2871
  console.error('Method not supported', METHOD);
3271
- }
3272
- });
2872
+ }
2873
+ }
3273
2874
  }
3274
2875
  });
3275
2876
  };
@@ -3549,11 +3150,11 @@ class CarbonReact extends Component {
3549
3150
  reactRouterContext(children) {
3550
3151
  switch (this.props.routerType ?? eRouterType.BrowserRouter) {
3551
3152
  case eRouterType.BrowserRouter:
3552
- return jsxRuntimeExports.jsx(BrowserRouter, { children: children });
3153
+ return jsx(BrowserRouter, { children: children });
3553
3154
  case eRouterType.MemoryRouter:
3554
- return jsxRuntimeExports.jsx(MemoryRouter, { initialEntries: ['/'], children: children });
3155
+ return jsx(MemoryRouter, { initialEntries: ['/'], children: children });
3555
3156
  case eRouterType.HashRouter:
3556
- return jsxRuntimeExports.jsx(HashRouter, { children: children });
3157
+ return jsx(HashRouter, { children: children });
3557
3158
  default:
3558
3159
  throw new Error('Invalid routerType');
3559
3160
  }
@@ -3562,14 +3163,14 @@ class CarbonReact extends Component {
3562
3163
  console.log('CarbonORM TSX RENDER');
3563
3164
  const colorHex = '#' + Math.random().toString(16).slice(-6);
3564
3165
  console.log('%c color (' + colorHex + ')', 'color: ' + colorHex);
3565
- const nest = jsxRuntimeExports.jsx(Nest, { position: 'fixed', backgroundColor: '', color: hexToRgb(colorHex), count: 100 });
3166
+ const nest = jsx(Nest, { position: 'fixed', backgroundColor: '', color: hexToRgb(colorHex), count: 100 });
3566
3167
  if (this.state.backendThrowable.length > 0) {
3567
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [nest, jsxRuntimeExports.jsx(BackendThrowable, { instance: this })] });
3168
+ return jsxs(Fragment, { children: [nest, jsx(BackendThrowable, { instance: this })] });
3568
3169
  }
3569
3170
  this.context = createContext(this.state);
3570
3171
  const Context = this.context.Provider;
3571
- return this.reactRouterContext(jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(GlobalHistory, {}), this.props.websocket &&
3572
- jsxRuntimeExports.jsx(CarbonWebSocket, { ...(false !== this.props.websocket ? this.props.websocket : {}), instance: this }), jsxRuntimeExports.jsx(Context, { value: this.state, children: this.props.children }), jsxRuntimeExports.jsx(ToastContainer, {})] }));
3172
+ return this.reactRouterContext(jsxs(Fragment, { children: [jsx(GlobalHistory, {}), this.props.websocket &&
3173
+ jsx(CarbonWebSocket, { ...(false !== this.props.websocket ? this.props.websocket : {}), instance: this }), jsx(Context, { value: this.state, children: this.props.children }), jsx(ToastContainer, {})] }));
3573
3174
  }
3574
3175
  }
3575
3176
 
@@ -3591,7 +3192,7 @@ function watchInputElementChangeEvent(event, cb, timeoutMs = 3000) {
3591
3192
  var styles = {"notfound":"_4yBvJ55","notfound_404":"WQ39uQo"};
3592
3193
 
3593
3194
  function AccessDenied({ children }) {
3594
- return (jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { className: styles.notfound, children: jsxRuntimeExports.jsxs("div", { className: styles.notfound_404, children: [jsxRuntimeExports.jsx("h3", { children: "Oops! Access not granted" }), children, jsxRuntimeExports.jsxs("h1", { style: {
3195
+ return (jsx("div", { children: jsx("div", { className: styles.notfound, children: jsxs("div", { className: styles.notfound_404, children: [jsx("h3", { children: "Oops! Access not granted" }), children, jsxs("h1", { style: {
3595
3196
  position: "absolute",
3596
3197
  left: "50%",
3597
3198
  top: "50%",
@@ -3602,21 +3203,21 @@ function AccessDenied({ children }) {
3602
3203
  letterSpacing: "-40px",
3603
3204
  marginLeft: "-20px",
3604
3205
  marginTop: "20px"
3605
- }, children: [jsxRuntimeExports.jsx("span", { children: "4" }), jsxRuntimeExports.jsx("span", { children: "0" }), jsxRuntimeExports.jsx("span", { children: "3" })] })] }) }) }));
3206
+ }, children: [jsx("span", { children: "4" }), jsx("span", { children: "0" }), jsx("span", { children: "3" })] })] }) }) }));
3606
3207
  }
3607
3208
 
3608
3209
  function ErrorHttpCode({ code, title = 'Hey Gamer, we\'ve encountered an unexpected issue!', message = 'Our team has been alerted and is actively investigating the issue. Please continue playing or ask support for any questions.' }) {
3609
- return jsxRuntimeExports.jsx("main", { role: "main", children: jsxRuntimeExports.jsx("div", { className: classes.maintenance, children: jsxRuntimeExports.jsx("div", { className: classes.problemBox, children: jsxRuntimeExports.jsxs("div", { className: classes.notfound, children: [jsxRuntimeExports.jsxs("div", { className: classes.notfound_404, children: [jsxRuntimeExports.jsx("h3", { children: title }), jsxRuntimeExports.jsx("h1", { children: code })] }), jsxRuntimeExports.jsx("h2", { children: message })] }) }) }) });
3210
+ return jsx("main", { role: "main", children: jsx("div", { className: classes.maintenance, children: jsx("div", { className: classes.problemBox, children: jsxs("div", { className: classes.notfound, children: [jsxs("div", { className: classes.notfound_404, children: [jsx("h3", { children: title }), jsx("h1", { children: code })] }), jsx("h2", { children: message })] }) }) }) });
3610
3211
  }
3611
3212
 
3612
3213
  function PageNotFound() {
3613
- return jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsxs("div", { className: classes.notfound, children: [jsxRuntimeExports.jsxs("div", { className: classes.notfound_404, children: [jsxRuntimeExports.jsx("h3", { children: "Oops! Page not found" }), jsxRuntimeExports.jsxs("h1", { children: [jsxRuntimeExports.jsx("span", { children: "4" }), jsxRuntimeExports.jsx("span", { children: "0" }), jsxRuntimeExports.jsx("span", { children: "4" })] })] }), jsxRuntimeExports.jsx("h2", { children: "we are sorry, but the page you requested was not found" })] }) });
3214
+ return jsx("div", { children: jsxs("div", { className: classes.notfound, children: [jsxs("div", { className: classes.notfound_404, children: [jsx("h3", { children: "Oops! Page not found" }), jsxs("h1", { children: [jsx("span", { children: "4" }), jsx("span", { children: "0" }), jsx("span", { children: "4" })] })] }), jsx("h2", { children: "we are sorry, but the page you requested was not found" })] }) });
3614
3215
  }
3615
3216
 
3616
3217
  function Loading(props) {
3617
3218
  const dig = getStyles();
3618
3219
  const primaryColor = getRootStyleValue();
3619
- return jsxRuntimeExports.jsx("div", { className: classNames(dig.my5, dig.px3, dig.pb5, dig.container), style: { lineHeight: props.lineHeight || 4 }, children: jsxRuntimeExports.jsxs(SkeletonTheme, { baseColor: primaryColor, highlightColor: "#444", children: [jsxRuntimeExports.jsx(Skeleton, { className: classNames(dig.row, dig.my3, dig.justifyContentCenter, dig.mAuto), count: props.count || 1, height: 60, inline: true }), props.children, undefined !== props?.message && jsxRuntimeExports.jsx("h2", { style: {
3220
+ return jsx("div", { className: classNames(dig.my5, dig.px3, dig.pb5, dig.container), style: { lineHeight: props.lineHeight || 4 }, children: jsxs(SkeletonTheme, { baseColor: primaryColor, highlightColor: "#444", children: [jsx(Skeleton, { className: classNames(dig.row, dig.my3, dig.justifyContentCenter, dig.mAuto), count: props.count || 1, height: 60, inline: true }), props.children, undefined !== props?.message && jsx("h2", { style: {
3620
3221
  display: 'flex',
3621
3222
  alignItems: 'center',
3622
3223
  justifyContent: 'center',
@@ -3725,8 +3326,9 @@ function ValidSQL (sql) {
3725
3326
  function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/' } = {}) {
3726
3327
  const fs = require("fs");
3727
3328
  const { inspect } = require("util");
3728
- const originalWindowLocation = window.location;
3329
+ const originalWindowLocation = window.location.href;
3729
3330
  const consoleOriginal = console;
3331
+ const isVerboseEnabled = isVerbose();
3730
3332
  const testName = () => expect.getState().currentTestName?.replaceAll(" ", "_").toLowerCase();
3731
3333
  const validSqlFile = () => sqlDirectory + testName() + '.json';
3732
3334
  const logsFile = () => logsDirectory + testName() + '.log';
@@ -3742,19 +3344,19 @@ function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/te
3742
3344
  global.console = {
3743
3345
  ...console,
3744
3346
  // use jest.fn() to silence, comment out to leave as it is
3745
- debug: (...args) => (isVerbose && consoleOriginal.debug(...args), asyncFileLogging('debug', ...args)),
3746
- error: (...args) => (isVerbose && consoleOriginal.error(...args), asyncFileLogging('error', ...args)),
3747
- group: (...args) => (isVerbose && consoleOriginal.group(...args), asyncFileLogging('group', ...args)),
3748
- groupCollapsed: (...args) => (isVerbose && consoleOriginal.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
3749
- groupEnd: () => (isVerbose && consoleOriginal.groupEnd(), asyncFileLogging('groupEnd')),
3750
- info: (...args) => (isVerbose && consoleOriginal.info(...args), asyncFileLogging('info', ...args)),
3751
- log: (...args) => (isVerbose && consoleOriginal.log(...args), asyncFileLogging('log', ...args)),
3752
- table: (...args) => (isVerbose && consoleOriginal.table(...args), asyncFileLogging('table', ...args)),
3753
- trace: (...args) => (isVerbose && consoleOriginal.trace(...args), asyncFileLogging((() => {
3347
+ debug: (...args) => (isVerboseEnabled && consoleOriginal.debug(...args), asyncFileLogging('debug', ...args)),
3348
+ error: (...args) => (isVerboseEnabled && consoleOriginal.error(...args), asyncFileLogging('error', ...args)),
3349
+ group: (...args) => (isVerboseEnabled && consoleOriginal.group(...args), asyncFileLogging('group', ...args)),
3350
+ groupCollapsed: (...args) => (isVerboseEnabled && consoleOriginal.groupCollapsed(...args), asyncFileLogging('groupCollapsed', ...args)),
3351
+ groupEnd: () => (isVerboseEnabled && consoleOriginal.groupEnd(), asyncFileLogging('groupEnd')),
3352
+ info: (...args) => (isVerboseEnabled && consoleOriginal.info(...args), asyncFileLogging('info', ...args)),
3353
+ log: (...args) => (isVerboseEnabled && consoleOriginal.log(...args), asyncFileLogging('log', ...args)),
3354
+ table: (...args) => (isVerboseEnabled && consoleOriginal.table(...args), asyncFileLogging('table', ...args)),
3355
+ trace: (...args) => (isVerboseEnabled && consoleOriginal.trace(...args), asyncFileLogging((() => {
3754
3356
  const err = new Error();
3755
3357
  return err.stack;
3756
3358
  })())),
3757
- warn: (...args) => (isVerbose && consoleOriginal.warn(...args), asyncFileLogging('warn', ...args)),
3359
+ warn: (...args) => (isVerboseEnabled && consoleOriginal.warn(...args), asyncFileLogging('warn', ...args)),
3758
3360
  };
3759
3361
  afterEach(async () => {
3760
3362
  await waitFor(async () => {
@@ -3764,7 +3366,7 @@ function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/te
3764
3366
  console.log('After each Test (' + expect.getState().currentTestName + ')', validSQL, expect.getState());
3765
3367
  // restore `window.location` to the original `jsdom`
3766
3368
  // `Location` object
3767
- window.location = originalWindowLocation;
3369
+ window.location.href = originalWindowLocation;
3768
3370
  fs.writeFileSync(validSqlFile(), jsonSQL);
3769
3371
  }, 65000);
3770
3372
  }