@fixefy/fixefy-ui-utils 0.2.56 → 0.2.58

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.
@@ -295,8 +295,9 @@ const nest = ({ items })=>{
295
295
  const nestedArray = [];
296
296
  items.forEach((item)=>{
297
297
  if (item) {
298
- if (item.parent) mappedArray[item.parent] && mappedArray[item.parent].children.push(mappedArray[item.id]);
299
- else nestedArray.push(mappedArray[item.id]);
298
+ if (item.parent) {
299
+ if (mappedArray[item.parent]) mappedArray[item.parent].children.push(mappedArray[item.id]);
300
+ } else nestedArray.push(mappedArray[item.id]);
300
301
  }
301
302
  });
302
303
  return nestedArray;
@@ -301,7 +301,7 @@ const parseArgs = ({ raw, _variables, upper_key, key, action, value })=>{
301
301
  });
302
302
  } else {
303
303
  // throw `Schema Object/Action Does Not Have Any Fields - '${operationName} - ${getFlower()}'`;
304
- throw `Schema Object/Action Does Not Have Any Fields`;
304
+ throw 'Schema Object/Action Does Not Have Any Fields';
305
305
  }
306
306
  }
307
307
  // if (_exists && raw.args.length > 0 && _exists === false) throw `Schema Object/Action Does Not Support - '${key}'`;
@@ -346,6 +346,7 @@ const parseFields = ({ fields, fields_obj, key, _variables, upper_key, value, ac
346
346
  throw `Schema Object/Action Does Not Support - '${key}'`;
347
347
  };
348
348
  const setMutationEntityVariables = ({ field, kind, _variables, upper_key, value })=>{
349
+ // why to make such tricky code??? better to remove any and set types
349
350
  Array.isArray(_variables[upper_key]) ? _variables[upper_key] = _variables[upper_key].map((item)=>_object_spread_props(_object_spread({}, item), {
350
351
  [field.toLowerCase()]: buildValue({
351
352
  name: kind,
@@ -359,6 +360,7 @@ const setMutationEntityVariables = ({ field, kind, _variables, upper_key, value
359
360
  });
360
361
  };
361
362
  const setQueryEntityVariables = ({ field, _variables, upper_key, value })=>{
363
+ // why to make such tricky code??? better to remove 'any' and set types
362
364
  field.includes('some') ? _variables[upper_key] = _object_spread_props(_object_spread({}, _variables[upper_key]), {
363
365
  [field]: {
364
366
  id_in: [
@@ -114,10 +114,11 @@ const getHeaders = (ctx)=>{
114
114
  return headers;
115
115
  };
116
116
  const setHeaders = (ctx, _headers)=>{
117
- typeof _headers === 'string' ? (0, _nookies.setCookie)(ctx, 'fixefy:headers', _object_spread({}, JSON.parse(_headers)), {
117
+ if (typeof _headers == 'string') (0, _nookies.setCookie)(ctx, 'fixefy:headers', _object_spread({}, JSON.parse(_headers)), {
118
118
  maxAge: 7 * 24 * 60 * 60,
119
119
  path: '/'
120
- }) : (0, _nookies.setCookie)(ctx, 'fixefy:headers', _object_spread({}, _headers), {
120
+ });
121
+ else (0, _nookies.setCookie)(ctx, 'fixefy:headers', _object_spread({}, _headers), {
121
122
  maxAge: 7 * 24 * 60 * 60,
122
123
  path: '/'
123
124
  });
@@ -34,7 +34,7 @@ _export(exports, {
34
34
  const _ = require("..");
35
35
  const getJToken = (jToken, jsonPath, defaultValue)=>{
36
36
  // input check - if key is invalid - return error
37
- if ((0, _.isObjectValid)(jToken) === false) return defaultValue;
37
+ if ((0, _.is_object_valid)(jToken) === false) return defaultValue;
38
38
  // convert indexes to properties
39
39
  jsonPath = jsonPath.replace(/\[(\w+)\]/g, '.$1');
40
40
  // strip a leading dot
@@ -60,7 +60,7 @@ const getJToken = (jToken, jsonPath, defaultValue)=>{
60
60
  isContinueLoop = false;
61
61
  }
62
62
  }
63
- } catch (e) {
63
+ } catch (_e) {
64
64
  jToken = 'No Value Found';
65
65
  }
66
66
  return jToken;
@@ -77,15 +77,15 @@ const getJPart = (j, jsonPath, defaultValue)=>{
77
77
  const pathParts = jsonPath.split('.');
78
78
  for(let i = 0, n = pathParts.length; isLoop && i < n; ++i){
79
79
  currentPathPart = pathParts[i];
80
- _isStringValid = (0, _.isStringValid)(j);
81
- _isArrayValid = (0, _.isArrayValid)(j);
80
+ _isStringValid = (0, _.is_string_valid)(j);
81
+ _isArrayValid = (0, _.is_array_valid)(j);
82
82
  if (_isStringValid === true || _isArrayValid === true) {
83
83
  if (_isStringValid === true) {
84
84
  j = JSON.parse(j);
85
85
  } else {
86
86
  j = j.reduce((acc, cur)=>{
87
87
  const innerJ = getJPart(cur, pathParts.slice(i).join('.'), defaultValue);
88
- if ((0, _.isArrayValid)(innerJ)) {
88
+ if ((0, _.is_array_valid)(innerJ)) {
89
89
  acc.push(...innerJ);
90
90
  } else {
91
91
  acc.push(innerJ);
@@ -123,10 +123,10 @@ const isJson = (obj)=>{
123
123
  let objAsString;
124
124
  try {
125
125
  objAsString = JSON.stringify(obj);
126
- } catch (e) {
126
+ } catch (_e) {
127
127
  objAsString = null;
128
128
  }
129
- if (!objAsString || (0, _.isStringValid)(objAsString) === false) return false;
129
+ if ((0, _.is_string_valid)(objAsString) == false) return false;
130
130
  const rv = (objAsString === null || objAsString === void 0 ? void 0 : objAsString.indexOf('{')) === 0 && (objAsString === null || objAsString === void 0 ? void 0 : objAsString.indexOf('}')) === (objAsString === null || objAsString === void 0 ? void 0 : objAsString.length) - 1;
131
131
  return rv;
132
132
  };
@@ -137,7 +137,7 @@ const isNested = (obj)=>{
137
137
  return rv;
138
138
  };
139
139
  const isResultValid = (jResult)=>{
140
- if ((0, _.isObjectValid)(jResult) === false) return false;
140
+ if ((0, _.is_object_valid)(jResult) === false) return false;
141
141
  const rv = getJPart(jResult, 'ok', 0);
142
142
  return !!rv;
143
143
  };
@@ -145,18 +145,18 @@ const setJToken = (jEntity, fieldPathsAndValues)=>{
145
145
  let jCurrentToken, currentPath, pathParts, fieldName;
146
146
  for(let i = 0; i < fieldPathsAndValues.length; ++i){
147
147
  currentPath = fieldPathsAndValues[i]['json_path'];
148
- if ((0, _.isStringValid)(currentPath)) {
148
+ if ((0, _.is_string_valid)(currentPath)) {
149
149
  fieldName = currentPath;
150
150
  pathParts = currentPath.split('.');
151
- if ((0, _.isArrayValid)(pathParts)) {
151
+ if ((0, _.is_array_valid)(pathParts)) {
152
152
  fieldName = pathParts[pathParts.length - 1];
153
153
  pathParts = pathParts.splice(0, Math.max(0, pathParts.length - 1));
154
- if ((0, _.isArrayValid)(pathParts)) {
154
+ if ((0, _.is_array_valid)(pathParts)) {
155
155
  currentPath = pathParts.join('.');
156
156
  }
157
157
  }
158
158
  jCurrentToken = getJPart(jEntity, currentPath, null);
159
- if ((0, _.isObjectValid)(jCurrentToken) || isJson(jCurrentToken) === false) {
159
+ if ((0, _.is_object_valid)(jCurrentToken) || isJson(jCurrentToken) === false) {
160
160
  jCurrentToken = jEntity;
161
161
  }
162
162
  jCurrentToken[fieldName] = fieldPathsAndValues[i]['value'];
@@ -1,16 +1,13 @@
1
1
  export declare const makeStyles: <Params = void, RuleNameSubsetReferencableInNestedSelectors extends string = never>(params?: {
2
2
  name?: string | Record<string, unknown> | undefined;
3
3
  uniqId?: string | undefined;
4
- } | undefined) => <RuleName extends string>(cssObjectByRuleNameOrGetCssObjectByRuleName: Record<RuleName, import("tss-react").CSSObject> | ((theme: import("@mui/styles").DefaultTheme, params: Params, classes: Record<RuleNameSubsetReferencableInNestedSelectors, string>) => Record<RuleNameSubsetReferencableInNestedSelectors | RuleName, import("tss-react").CSSObject>)) => (params: Params, muiStyleOverridesParams?: {
5
- props: Record<string, unknown>;
6
- ownerState?: Record<string, unknown> | undefined;
7
- } | undefined) => {
4
+ } | undefined) => <RuleName extends string>(cssObjectByRuleNameOrGetCssObjectByRuleName: Record<RuleName, import("tss-react").CSSObject> | ((theme: import("@mui/material").Theme, params: Params, classes: Record<RuleNameSubsetReferencableInNestedSelectors, string>) => Record<RuleNameSubsetReferencableInNestedSelectors | RuleName, import("tss-react").CSSObject>)) => (params: Params, muiStyleOverridesParams?: import("tss-react/mui/themeStyleOverridesPlugin").MuiThemeStyleOverridesPluginParams["muiStyleOverridesParams"]) => {
8
5
  classes: Record<RuleName, string>;
9
- theme: import("@mui/styles").DefaultTheme;
6
+ theme: import("@mui/material").Theme;
10
7
  css: import("tss-react").Css;
11
8
  cx: import("tss-react").Cx;
12
9
  }, useStyles: () => {
13
- theme: import("@mui/styles").DefaultTheme;
10
+ theme: import("@mui/material").Theme;
14
11
  css: import("tss-react").Css;
15
12
  cx: import("tss-react").Cx;
16
13
  };
@@ -17,7 +17,12 @@ _export(exports, {
17
17
  }
18
18
  });
19
19
  const _tssreact = require("tss-react");
20
- const _styles = require("@mui/styles");
20
+ const _useTheme = /*#__PURE__*/ _interop_require_default(require("@mui/material/styles/useTheme"));
21
+ function _interop_require_default(obj) {
22
+ return obj && obj.__esModule ? obj : {
23
+ default: obj
24
+ };
25
+ }
21
26
  const { makeStyles, useStyles } = (0, _tssreact.createMakeStyles)({
22
- useTheme: _styles.useTheme
27
+ useTheme: _useTheme.default
23
28
  });
@@ -1,9 +1,3 @@
1
- /// <reference types="react" />
2
- import { Theme } from '@mui/material/styles';
3
- declare module '@mui/styles/defaultTheme' {
4
- interface DefaultTheme extends Theme {
5
- }
6
- }
7
1
  declare module '@mui/material/styles' {
8
2
  interface Theme {
9
3
  sizes: Sizes;
@@ -239,6 +233,7 @@ declare module '@mui/material/styles' {
239
233
  challenged: StatusColorOption;
240
234
  closed: StatusColorOption;
241
235
  credited: StatusColorOption;
236
+ credit_invoices: StatusColorOption;
242
237
  declined: StatusColorOption;
243
238
  discrepancy: StatusColorOption;
244
239
  duplicate: StatusColorOption;
@@ -257,6 +252,7 @@ declare module '@mui/material/styles' {
257
252
  approved: StatusColorOption;
258
253
  created: StatusColorOption;
259
254
  credited: StatusColorOption;
255
+ credit_invoices: StatusColorOption;
260
256
  declined: StatusColorOption;
261
257
  in_dispute: StatusColorOption;
262
258
  in_progress: StatusColorOption;
@@ -274,6 +270,7 @@ declare module '@mui/material/styles' {
274
270
  billed: StatusColorOption;
275
271
  created: StatusColorOption;
276
272
  credited: StatusColorOption;
273
+ credit_invoices: StatusColorOption;
277
274
  in_dispute: StatusColorOption;
278
275
  in_progress: StatusColorOption;
279
276
  paid: StatusColorOption;