@jsonui/core 0.3.0 → 0.4.1

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/cjs/index.js CHANGED
@@ -1,4 +1,40 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var require$$0=require('react');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var require$$0__default=/*#__PURE__*/_interopDefaultLegacy(require$$0);/*! *****************************************************************************
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var require$$0=require('react');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var require$$0__default=/*#__PURE__*/_interopDefaultLegacy(require$$0);class Stock {
2
+ constructor(newStock, Wrapper, reduxStore) {
3
+ this.init = ({ components, functions }) => {
4
+ this.stock.components = Object.assign(Object.assign({}, this.stock.components), components);
5
+ this.stock.functions = Object.assign(Object.assign({}, this.stock.functions), functions);
6
+ };
7
+ this.registerComponent = (key, value) => {
8
+ if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.components)) {
9
+ this.stock.components[key] = value;
10
+ }
11
+ };
12
+ this.registerFunction = (key, value) => {
13
+ if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.functions)) {
14
+ this.stock.functions[key] = value;
15
+ }
16
+ };
17
+ this.callFunction = (name, attr, props, callerArgs) => {
18
+ if (!!attr && !!name && name in this.stock.functions) {
19
+ const result = this.stock.functions[name](attr, props, callerArgs, this);
20
+ return result;
21
+ }
22
+ return null;
23
+ };
24
+ this.getComponent = (componentName) => !!componentName && componentName in this.stock.components
25
+ ? this.stock.components[componentName]
26
+ : // eslint-disable-next-line no-underscore-dangle
27
+ this.stock.components._Undefined;
28
+ this.stock = {
29
+ components: {},
30
+ functions: {},
31
+ };
32
+ this.Wrapper = Wrapper;
33
+ this.validations = [];
34
+ this.reduxStore = reduxStore;
35
+ this.init(newStock);
36
+ }
37
+ }/*! *****************************************************************************
2
38
  Copyright (c) Microsoft Corporation.
3
39
 
4
40
  Permission to use, copy, modify, and/or distribute this software for any
@@ -13,17 +49,6 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
49
  PERFORMANCE OF THIS SOFTWARE.
14
50
  ***************************************************************************** */
15
51
 
16
- var __assign = function() {
17
- __assign = Object.assign || function __assign(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
-
27
52
  function __rest(s, e) {
28
53
  var t = {};
29
54
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -44,86 +69,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
44
69
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
70
  step((generator = generator.apply(thisArg, _arguments || [])).next());
46
71
  });
47
- }
48
-
49
- function __generator(thisArg, body) {
50
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
51
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
- function verb(n) { return function (v) { return step([n, v]); }; }
53
- function step(op) {
54
- if (f) throw new TypeError("Generator is already executing.");
55
- while (_) try {
56
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
- if (y = 0, t) op = [op[0] & 2, t.value];
58
- switch (op[0]) {
59
- case 0: case 1: t = op; break;
60
- case 4: _.label++; return { value: op[1], done: false };
61
- case 5: _.label++; y = op[1]; op = [0]; continue;
62
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
63
- default:
64
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
65
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
66
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
68
- if (t[2]) _.ops.pop();
69
- _.trys.pop(); continue;
70
- }
71
- op = body.call(thisArg, _);
72
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
73
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
- }
75
- }
76
-
77
- function __spreadArray(to, from, pack) {
78
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
79
- if (ar || !(i in from)) {
80
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
81
- ar[i] = from[i];
82
- }
83
- }
84
- return to.concat(ar || Array.prototype.slice.call(from));
85
- }var Stock = /** @class */ (function () {
86
- function Stock(newStock, Wrapper, reduxStore) {
87
- var _this = this;
88
- this.init = function (_a) {
89
- var components = _a.components, functions = _a.functions;
90
- _this.stock.components = __assign(__assign({}, _this.stock.components), components);
91
- _this.stock.functions = __assign(__assign({}, _this.stock.functions), functions);
92
- };
93
- this.registerComponent = function (key, value) {
94
- if (!!key && typeof key === 'string' && key.length > 0 && !(key in _this.stock.components)) {
95
- _this.stock.components[key] = value;
96
- }
97
- };
98
- this.registerFunction = function (key, value) {
99
- if (!!key && typeof key === 'string' && key.length > 0 && !(key in _this.stock.functions)) {
100
- _this.stock.functions[key] = value;
101
- }
102
- };
103
- this.callFunction = function (name, attr, props, callerArgs) {
104
- if (!!attr && !!name && name in _this.stock.functions) {
105
- var result = _this.stock.functions[name](attr, props, callerArgs, _this);
106
- return result;
107
- }
108
- return null;
109
- };
110
- this.getComponent = function (componentName) {
111
- return !!componentName && componentName in _this.stock.components
112
- ? _this.stock.components[componentName]
113
- : // eslint-disable-next-line no-underscore-dangle
114
- _this.stock.components._Undefined;
115
- };
116
- this.stock = {
117
- components: {},
118
- functions: {},
119
- };
120
- this.Wrapper = Wrapper;
121
- this.validations = [];
122
- this.reduxStore = reduxStore;
123
- this.init(newStock);
124
- }
125
- return Stock;
126
- }());var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
72
+ }var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
127
73
 
128
74
  function getDefaultExportFromCjs (x) {
129
75
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -5010,31 +4956,38 @@ var hasOwnProperty$3 = Object.hasOwnProperty || function (obj, key) {
5010
4956
  return key in obj;
5011
4957
  };
5012
4958
 
5013
- var traverse$3 = traverse$4.exports;var SEPARATOR = '/';
5014
- var STORE_ERROR_POSTFIX = '.error';
5015
- var PATH_MODIFIERS_KEY = '$pathModifiers';
5016
- var MODIFIER_KEY = '$modifier';
5017
- var ACTION_KEY = '$action';
5018
- var PERSIST_STORAGE_KEY = '$persistStores';
5019
- var PERSIST_STORAGE_NAMES = ['data'];
5020
- var REF_ASSETS = '$assetsRef';
5021
- var REF_LOCALES = '$locales';
5022
- var REF_VALIDATES = '$validations';
5023
- var STYLE_WEB_NAME = 'styleWeb';
5024
- var STYLE_RN_NAME = 'styleRN';
5025
- var REDUX_FUNCTIONS = ['set', 'get'];
5026
- var PATHNAME = 'path';
5027
- var SIMPLE_DATA_TYPES = ['string', 'number', 'boolean', 'null'];
5028
- var V_CHILDREN_NAME = '$children';
5029
- var V_COMP_NAME = '$comp';
5030
- var LIST_SEMAPHORE = '$isList';
5031
- var LIST_ITEM = '$listItem';
5032
- var LIST_PAGE = '$page';
5033
- var LIST_ITEM_PER_PAGE = '$itemPerPage';
5034
- var LIST_LENGTH = '$listLength';
5035
- var LIST_ITEM_PER_PAGE_DEFAULT = 10;
5036
- // TODO currentPaths maybe need to modify to ___currentPaths
5037
- var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT});var jsonpointer = {};var hasExcape = /~/;
4959
+ var traverse$3 = traverse$4.exports;const SEPARATOR = '/';
4960
+ const STORE_ERROR_POSTFIX = '.error';
4961
+ const PATH_MODIFIERS_KEY = '$pathModifiers';
4962
+ const MODIFIER_KEY = '$modifier';
4963
+ const ACTION_KEY = '$action';
4964
+ const PERSIST_STORAGE_KEY = '$persistStores';
4965
+ const PERSIST_STORAGE_NAMES = ['data'];
4966
+ const REF_ASSETS = '$assetsRef';
4967
+ const REF_LOCALES = '$locales';
4968
+ const REF_VALIDATES = '$validations';
4969
+ const STYLE_WEB_NAME = 'styleWeb';
4970
+ const STYLE_RN_NAME = 'styleRN';
4971
+ const REDUX_GET_FUNCTION = 'get';
4972
+ const REDUX_SET_FUNCTION = 'set';
4973
+ const REDUX_FUNCTIONS = [REDUX_GET_FUNCTION, REDUX_SET_FUNCTION];
4974
+ const PATHNAME = 'path';
4975
+ const SIMPLE_DATA_TYPES = ['string', 'number', 'boolean', 'null'];
4976
+ const V_CHILDREN_NAME = '$children';
4977
+ const V_COMP_NAME = '$comp';
4978
+ const LIST_SEMAPHORE = '$isList';
4979
+ const LIST_ITEM = '$listItem';
4980
+ const LIST_PAGE = '$page';
4981
+ const LIST_ITEM_PER_PAGE = '$itemPerPage';
4982
+ const LIST_LENGTH = '$listLength';
4983
+ const LIST_ITEM_PER_PAGE_DEFAULT = 10;
4984
+ const REDUX_PATHS = '$$reduxPaths';
4985
+ const V_CHILDREN_PREFIX = '$child';
4986
+ const PARENT_PROP_NAME = '__parentprop';
4987
+ const CURRENT_PATH_NAME = '__currentPaths';
4988
+ const PRIMITIVE_COMP_NAME = '_PrimitiveProp'; // TODO check all literal and replace with this constant
4989
+ const FRAGMENT_COMP_NAME = 'Fragment'; // TODO check all literal and replace with this constant
4990
+ var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_GET_FUNCTION:REDUX_GET_FUNCTION,REDUX_SET_FUNCTION:REDUX_SET_FUNCTION,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT,REDUX_PATHS:REDUX_PATHS,V_CHILDREN_PREFIX:V_CHILDREN_PREFIX,PARENT_PROP_NAME:PARENT_PROP_NAME,CURRENT_PATH_NAME:CURRENT_PATH_NAME,PRIMITIVE_COMP_NAME:PRIMITIVE_COMP_NAME,FRAGMENT_COMP_NAME:FRAGMENT_COMP_NAME});var jsonpointer = {};var hasExcape = /~/;
5038
4991
  var escapeMatcher = /~[01]/g;
5039
4992
  function escapeReplacer (m) {
5040
4993
  switch (m) {
@@ -6613,35 +6566,32 @@ var pullAll_1 = pullAll$1;var baseRest = _baseRest,
6613
6566
  */
6614
6567
  var pull = baseRest(pullAll);
6615
6568
 
6616
- var pull_1 = pull;var findLastIndex = function (arr, func) {
6617
- var reverseIdx = __spreadArray([], arr, true).reverse().findIndex(func);
6569
+ var pull_1 = pull;const findLastIndex = (arr, func) => {
6570
+ const reverseIdx = [...arr].reverse().findIndex(func);
6618
6571
  return reverseIdx === -1 ? reverseIdx : arr.length - (reverseIdx + 1);
6619
6572
  };
6620
- var drop = function (arr, n) {
6621
- if (n === void 0) { n = 1; }
6622
- return arr.slice(n);
6623
- };
6624
- var isNumber = function (a) { return typeof a === 'number'; };
6625
- var jsonPointerGet = function (json, path) {
6573
+ const drop = (arr, n = 1) => arr.slice(n);
6574
+ const isNumber = (a) => typeof a === 'number';
6575
+ const jsonPointerGet = (json, path) => {
6626
6576
  if (json === undefined || path === null || path === undefined || typeof path !== 'string')
6627
6577
  return undefined;
6628
6578
  if (path === SEPARATOR /* || path === '' same effect */)
6629
6579
  return json;
6630
6580
  try {
6631
- return jsonpointer.get(json, path.startsWith(SEPARATOR) ? path : "".concat(SEPARATOR).concat(path));
6581
+ return jsonpointer.get(json, path.startsWith(SEPARATOR) ? path : `${SEPARATOR}${path}`);
6632
6582
  }
6633
6583
  catch (e) {
6634
6584
  return undefined;
6635
6585
  }
6636
6586
  };
6637
- var jsonPointerSet = function (json, path, value) {
6587
+ const jsonPointerSet = (json, path, value) => {
6638
6588
  if (json === undefined || path === null || path === undefined || typeof path !== 'string')
6639
6589
  return json;
6640
6590
  if (path === SEPARATOR || path === '') {
6641
6591
  return value;
6642
6592
  }
6643
6593
  try {
6644
- jsonpointer.set(json, path.startsWith(SEPARATOR) ? path : "".concat(SEPARATOR).concat(path), value);
6594
+ jsonpointer.set(json, path.startsWith(SEPARATOR) ? path : `${SEPARATOR}${path}`, value);
6645
6595
  return json;
6646
6596
  // eslint-disable-next-line no-empty
6647
6597
  }
@@ -6649,47 +6599,48 @@ var jsonPointerSet = function (json, path, value) {
6649
6599
  return json;
6650
6600
  }
6651
6601
  };
6652
- var pathArrayToPathString = function (array) {
6653
- return array.map(function (i, index) { return (Number.isInteger(i) ? "[".concat(i, "]") : "".concat(index > 0 ? '.' : '').concat(i)); }).join('');
6654
- };
6655
- var pathArrayToJsonPointer = function (array) { return "/".concat(array.join('/')); };
6602
+ const pathArrayToPathString = (array) => array.map((i, index) => (Number.isInteger(i) ? `[${i}]` : `${index > 0 ? '.' : ''}${i}`)).join('');
6603
+ const pathArrayToJsonPointer = (array) => `/${array.join('/')}`;
6656
6604
  function isOnlyObject(item) {
6657
6605
  return !!item && typeof item === 'object' && !Array.isArray(item);
6658
6606
  }
6659
- var mergePath = function (target, newState) {
6607
+ const mergePath = (target, newState) => {
6660
6608
  if (!newState || typeof newState !== 'object')
6661
6609
  return target;
6662
- var newTarget = cloneDeep_1(target);
6663
- Object.entries(newState).forEach(function (_a) {
6664
- var key = _a[0], value = _a[1];
6610
+ let newTarget = cloneDeep_1(target);
6611
+ Object.entries(newState).forEach(([key, value]) => {
6665
6612
  newTarget = jsonPointerSet(newTarget, key, value);
6666
6613
  });
6667
6614
  return newTarget;
6668
6615
  };
6669
6616
  // eslint-disable-next-line import/prefer-default-export
6670
- var changeRelativePath = function (path) {
6671
- var pathArray = path.split(SEPARATOR);
6617
+ const changeRelativePath = (path) => {
6618
+ let pathArray = path.split(SEPARATOR);
6672
6619
  // remove last /
6673
6620
  if (pathArray && pathArray.length > 1 && pathArray[pathArray.length - 1] === '' && !(pathArray.length === 2 && pathArray[0] === '')) {
6674
6621
  pathArray.pop();
6675
6622
  }
6676
6623
  // the last / is meaningful
6677
- var absolutepathIndex = findLastIndex(pathArray, function (i) { return i === ''; });
6624
+ const absolutepathIndex = findLastIndex(pathArray, (i) => i === '');
6678
6625
  if (absolutepathIndex > 0) {
6679
6626
  pathArray = drop(pathArray, absolutepathIndex);
6680
6627
  }
6681
6628
  // all . need to remove because is just pointing the prev level
6682
6629
  pathArray = pull_1(pathArray, '.');
6683
- var count = 0;
6684
- var relativepathIndex = -1;
6630
+ let count = 0;
6631
+ let relativepathIndex = -1;
6685
6632
  do {
6686
6633
  count += 1;
6687
- relativepathIndex = findIndex_1(pathArray, function (i) { return i === '..'; });
6634
+ relativepathIndex = findIndex_1(pathArray, (i) => i === '..');
6688
6635
  if (relativepathIndex !== -1) {
6689
6636
  pathArray.splice(relativepathIndex, 1);
6690
6637
  pathArray.splice(relativepathIndex - 1, 1);
6691
6638
  }
6692
6639
  } while (relativepathIndex !== -1 && count < 100);
6640
+ pathArray = pull_1(pathArray, '..');
6641
+ if (pathArray.length === 1 && pathArray[0] !== '') {
6642
+ pathArray = ['', ...pathArray];
6643
+ }
6693
6644
  return pathArray.join(SEPARATOR);
6694
6645
  };
6695
6646
  /**
@@ -6697,58 +6648,53 @@ var changeRelativePath = function (path) {
6697
6648
  * @param target
6698
6649
  * @param ...sources
6699
6650
  */
6700
- function mergeDeep(target) {
6701
- var _a, _b;
6702
- var sources = [];
6703
- for (var _i = 1; _i < arguments.length; _i++) {
6704
- sources[_i - 1] = arguments[_i];
6705
- }
6651
+ function mergeDeep(target, ...sources) {
6706
6652
  if (!sources.length)
6707
6653
  return target;
6708
- var source = sources.shift();
6654
+ const source = sources.shift();
6709
6655
  if (isOnlyObject(target) && isOnlyObject(source)) {
6710
6656
  // eslint-disable-next-line no-restricted-syntax
6711
- for (var key in source) {
6657
+ for (const key in source) {
6712
6658
  if (isOnlyObject(source[key])) {
6713
6659
  if (!target[key])
6714
- Object.assign(target, (_a = {}, _a[key] = {}, _a));
6660
+ Object.assign(target, { [key]: {} });
6715
6661
  mergeDeep(target[key], source[key]);
6716
6662
  }
6717
6663
  else {
6718
- Object.assign(target, (_b = {}, _b[key] = source[key], _b));
6664
+ Object.assign(target, { [key]: source[key] });
6719
6665
  }
6720
6666
  }
6721
6667
  }
6722
- return mergeDeep.apply(void 0, __spreadArray([target], sources, false));
6668
+ return mergeDeep(target, ...sources);
6723
6669
  }
6724
- var collectObjMerge = function (refConst, json) {
6725
- var res = {};
6670
+ const collectObjMerge = (refConst, json) => {
6671
+ const res = {};
6726
6672
  if (refConst && json && typeof json === 'object') {
6727
- var refs_1 = [];
6673
+ const refs = [];
6728
6674
  // eslint-disable-next-line func-names
6729
6675
  traverse$3(json).forEach(function (x) {
6730
6676
  if (x && !!x[refConst] && !!this && !this.circular) {
6731
- refs_1.push(x[refConst]);
6677
+ refs.push(x[refConst]);
6732
6678
  }
6733
6679
  });
6734
- refs_1.filter(function (i) { return !!i; }).forEach(function (i) { return mergeDeep(res, i); });
6680
+ refs.filter((i) => !!i).forEach((i) => mergeDeep(res, i));
6735
6681
  }
6736
6682
  return res;
6737
6683
  };
6738
- var collectObjToArray = function (refConst, json) {
6684
+ const collectObjToArray = (refConst, json) => {
6739
6685
  if (refConst && json && typeof json === 'object') {
6740
- var refs_2 = [];
6686
+ const refs = [];
6741
6687
  // eslint-disable-next-line func-names
6742
6688
  traverse$3(json).forEach(function (x) {
6743
6689
  if (x && !!x[refConst] && !!this && !this.circular) {
6744
- refs_2.push(x[refConst]);
6690
+ refs.push(x[refConst]);
6745
6691
  }
6746
6692
  });
6747
- return refs_2;
6693
+ return refs;
6748
6694
  }
6749
6695
  return [];
6750
6696
  };
6751
- var isCircular = function (d) {
6697
+ const isCircular = (d) => {
6752
6698
  try {
6753
6699
  JSON.stringify(d);
6754
6700
  }
@@ -6756,121 +6702,116 @@ var isCircular = function (d) {
6756
6702
  return true;
6757
6703
  }
6758
6704
  return false;
6759
- };var util$1=/*#__PURE__*/Object.freeze({__proto__:null,findLastIndex:findLastIndex,drop:drop,isNumber:isNumber,jsonPointerGet:jsonPointerGet,jsonPointerSet:jsonPointerSet,pathArrayToPathString:pathArrayToPathString,pathArrayToJsonPointer:pathArrayToJsonPointer,isOnlyObject:isOnlyObject,mergePath:mergePath,changeRelativePath:changeRelativePath,mergeDeep:mergeDeep,collectObjMerge:collectObjMerge,collectObjToArray:collectObjToArray,isCircular:isCircular});var actionBuilder = function (props, stock) {
6760
- var paths = [];
6761
- props.parentComp; var propsNew = __rest(props
6762
- // eslint-disable-next-line func-names
6763
- , ["parentComp"]);
6764
- // eslint-disable-next-line func-names
6765
- traverse$3(propsNew).forEach(function (x) {
6766
- if (!!x &&
6767
- !!x[ACTION_KEY] &&
6768
- // && !c.REDUX_FUNCTIONS.includes(x[c.ACTION_KEY])
6769
- !(this.path.length > 1 && this.path.includes(V_CHILDREN_NAME))) {
6770
- paths.push({ path: this.path, level: this.level });
6771
- }
6772
- });
6773
- orderBy_1(paths, ['level'], ['desc']).forEach(function (i) { return __awaiter(void 0, void 0, void 0, function () {
6774
- var _a, _b, functionName, functionParams;
6775
- return __generator(this, function (_c) {
6776
- _a = traverse$3(props).get(i.path), _b = ACTION_KEY, functionName = _a[_b], functionParams = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
6777
- traverse$3(props).set(i.path, function () {
6778
- var callerArgs = [];
6779
- for (var _i = 0; _i < arguments.length; _i++) {
6780
- callerArgs[_i] = arguments[_i];
6705
+ };var util$1=/*#__PURE__*/Object.freeze({__proto__:null,findLastIndex:findLastIndex,drop:drop,isNumber:isNumber,jsonPointerGet:jsonPointerGet,jsonPointerSet:jsonPointerSet,pathArrayToPathString:pathArrayToPathString,pathArrayToJsonPointer:pathArrayToJsonPointer,isOnlyObject:isOnlyObject,mergePath:mergePath,changeRelativePath:changeRelativePath,mergeDeep:mergeDeep,collectObjMerge:collectObjMerge,collectObjToArray:collectObjToArray,isCircular:isCircular});const getFilteredPath = (_a, func) => {
6706
+ var _b = PARENT_PROP_NAME; _a[_b]; var propsNew = __rest(_a, [_b + ""]);
6707
+ const paths = [];
6708
+ function* jsonTraverse(o) {
6709
+ const memory = new Set();
6710
+ function* innerTraversal(oo, path = []) {
6711
+ var _a;
6712
+ if (memory.has(oo)) {
6713
+ return; // circular
6714
+ }
6715
+ memory.add(oo);
6716
+ // eslint-disable-next-line no-restricted-syntax
6717
+ for (const i of Object.keys(oo)) {
6718
+ const itemPath = path.concat(i);
6719
+ if (itemPath && itemPath.length > 1 && typeof oo[i] === 'object' && ((_a = oo[i]) === null || _a === void 0 ? void 0 : _a[V_COMP_NAME])) {
6720
+ // eslint-disable-next-line no-continue
6721
+ continue;
6781
6722
  }
6782
- return __awaiter(void 0, void 0, void 0, function () {
6783
- return __generator(this, function (_a) {
6784
- switch (_a.label) {
6785
- case 0: return [4 /*yield*/, stock.callFunction(functionName, functionParams, props, callerArgs)];
6786
- case 1:
6787
- _a.sent();
6788
- return [2 /*return*/];
6789
- }
6790
- });
6791
- });
6792
- });
6793
- return [2 /*return*/];
6794
- });
6795
- }); });
6796
- };
6797
- var modifierBuilder = function (props, stock) {
6798
- var paths = [];
6799
- props.parentComp; var propsNew = __rest(props
6800
- // eslint-disable-next-line func-names
6801
- , ["parentComp"]);
6802
- // eslint-disable-next-line func-names
6803
- traverse$3(propsNew).forEach(function (x) {
6804
- if (!!x && !!x[MODIFIER_KEY] && !REDUX_FUNCTIONS.includes(x[MODIFIER_KEY]) && !(this.path.length > 1 && this.path.includes(V_CHILDREN_NAME))) {
6805
- paths.push({ path: this.path, level: this.level });
6723
+ if (i === PARENT_PROP_NAME || i === CURRENT_PATH_NAME || i === LIST_ITEM) {
6724
+ // eslint-disable-next-line no-continue
6725
+ continue;
6726
+ }
6727
+ if (func({ key: i, value: oo[i], path, parent: oo, level: path.length })) {
6728
+ yield { key: i, value: oo[i], path, parent: oo, level: path.length };
6729
+ }
6730
+ if (oo[i] !== null && typeof oo[i] === 'object') {
6731
+ yield* innerTraversal(oo[i], itemPath);
6732
+ }
6733
+ }
6806
6734
  }
6735
+ yield* innerTraversal(o);
6736
+ }
6737
+ // eslint-disable-next-line no-restricted-syntax
6738
+ for (const filteredvalue of jsonTraverse(propsNew)) {
6739
+ paths.push(filteredvalue);
6740
+ }
6741
+ return paths;
6742
+ };
6743
+ const actionBuilder = (props, stock) => {
6744
+ const _a = props, _b = PARENT_PROP_NAME; _a[_b]; const propsNew = __rest(_a, [_b + ""]);
6745
+ const paths = getFilteredPath(propsNew, ({ key }) => key === ACTION_KEY);
6746
+ orderBy_1(paths, ['level'], ['desc']).forEach((i) => __awaiter(void 0, void 0, void 0, function* () {
6747
+ const _c = traverse$3(props).get(i.path), _d = ACTION_KEY, functionName = _c[_d], functionParams = __rest(_c, [_d + ""]);
6748
+ traverse$3(props).set(i.path, (...callerArgs) => __awaiter(void 0, void 0, void 0, function* () {
6749
+ yield stock.callFunction(functionName, functionParams, props, callerArgs);
6750
+ }));
6751
+ }));
6752
+ };
6753
+ const calculatePropsFromModifier = (props, stock) => {
6754
+ const reduxPaths = [];
6755
+ const _a = props, _b = PARENT_PROP_NAME; _a[_b]; const propsNew = __rest(_a, [_b + ""]);
6756
+ const paths = getFilteredPath(propsNew, ({ key }) => key === MODIFIER_KEY);
6757
+ orderBy_1(paths, ['level'], ['desc']).forEach((i) => __awaiter(void 0, void 0, void 0, function* () {
6758
+ const _c = traverse$3(props).get(i.path), _d = MODIFIER_KEY, functionName = _c[_d], functionParams = __rest(_c, [_d + ""]);
6759
+ if (typeof functionName === 'string' && functionName === REDUX_GET_FUNCTION) {
6760
+ reduxPaths.push(functionParams);
6761
+ }
6762
+ traverse$3(props).set(i.path, stock.callFunction(functionName, functionParams, props));
6763
+ }));
6764
+ return reduxPaths.map((i) => {
6765
+ return { store: i === null || i === void 0 ? void 0 : i.store, path: i === null || i === void 0 ? void 0 : i.path };
6807
6766
  });
6808
- orderBy_1(paths, ['level'], ['desc']).forEach(function (i) { return __awaiter(void 0, void 0, void 0, function () {
6809
- var _a, _b, functionName, functionParams;
6810
- return __generator(this, function (_c) {
6811
- _a = traverse$3(props).get(i.path), _b = MODIFIER_KEY, functionName = _a[_b], functionParams = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
6812
- traverse$3(props).set(i.path, stock.callFunction(functionName, functionParams, props));
6813
- return [2 /*return*/];
6814
- });
6815
- }); });
6816
6767
  };
6817
- var pathModifierBuilder = function (props, pathModifier) {
6818
- var currentPaths = __assign({}, props.currentPaths);
6819
- var modified = false;
6768
+ const getCurrentPaths = (props, pathModifier) => {
6769
+ const currentPaths = Object.assign({}, props[CURRENT_PATH_NAME]);
6820
6770
  if (pathModifier && Object.keys(pathModifier).length !== 0) {
6821
- Object.keys(pathModifier).forEach(function (key) {
6822
- var _a, _b;
6771
+ Object.keys(pathModifier).forEach((key) => {
6823
6772
  if (!!key && !!pathModifier[key] && pathModifier[key][PATHNAME] !== undefined && pathModifier[key][PATHNAME] !== null) {
6824
- var path = pathModifier[key][PATHNAME];
6825
- var parent_1 = currentPaths[key];
6826
- modified = true;
6827
- if ("".concat(path).startsWith(SEPARATOR) || !(parent_1 && parent_1[PATHNAME])) {
6828
- currentPaths[key] = (_a = {}, _a[PATHNAME] = path, _a);
6773
+ const path = pathModifier[key][PATHNAME];
6774
+ const parent = currentPaths[key];
6775
+ if (`${path}`.startsWith(SEPARATOR) || !(parent && parent[PATHNAME])) {
6776
+ currentPaths[key] = { [PATHNAME]: path };
6829
6777
  }
6830
6778
  else {
6831
- currentPaths[key] = (_b = {}, _b[PATHNAME] = changeRelativePath("".concat(parent_1[PATHNAME]).concat(SEPARATOR).concat(path)), _b);
6779
+ currentPaths[key] = { [PATHNAME]: changeRelativePath(`${parent[PATHNAME]}${SEPARATOR}${path}`) };
6832
6780
  }
6833
- if (!!currentPaths[key] && !"".concat(currentPaths[key][PATHNAME]).startsWith(SEPARATOR)) {
6834
- currentPaths[key][PATHNAME] = "".concat(SEPARATOR).concat(currentPaths[key][PATHNAME]);
6781
+ if (!!currentPaths[key] && !`${currentPaths[key][PATHNAME]}`.startsWith(SEPARATOR)) {
6782
+ currentPaths[key][PATHNAME] = `${SEPARATOR}${currentPaths[key][PATHNAME]}`;
6835
6783
  }
6836
6784
  }
6837
6785
  });
6838
6786
  }
6839
- return modified ? { currentPaths: currentPaths } : undefined;
6787
+ return currentPaths;
6840
6788
  };
6841
- var getWrapperProps = function (props, parentComp) {
6842
- var _a, _b;
6843
- if (props && Array.isArray(props)) {
6844
- return _a = {},
6845
- _a[V_COMP_NAME] = 'Fragment',
6846
- _a[V_CHILDREN_NAME] = props,
6847
- _a;
6789
+ const normalisePrimitives = (props, parentComp) => {
6790
+ if (!!props && Array.isArray(props)) {
6791
+ return { [V_COMP_NAME]: FRAGMENT_COMP_NAME, [V_CHILDREN_NAME]: props, [PARENT_PROP_NAME]: parentComp };
6848
6792
  }
6849
- var res = __assign(__assign({}, (SIMPLE_DATA_TYPES.includes(typeof props) ? {} : props)), (_b = { parentComp: parentComp }, _b[V_COMP_NAME] = SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? '_PrimitiveProp' : props[V_COMP_NAME], _b[V_CHILDREN_NAME] = SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? props : props[V_CHILDREN_NAME], _b));
6850
- // eslint-disable-next-line no-restricted-syntax
6851
- for (var i in res)
6852
- if (typeof res[i] === 'undefined')
6853
- delete res[i];
6854
- return res;
6793
+ if (props === null || SIMPLE_DATA_TYPES.includes(typeof props)) {
6794
+ return { [V_COMP_NAME]: PRIMITIVE_COMP_NAME, [V_CHILDREN_NAME]: props, [PARENT_PROP_NAME]: parentComp };
6795
+ }
6796
+ return Object.assign(Object.assign({}, props), { [PARENT_PROP_NAME]: parentComp });
6855
6797
  };
6856
- var genChildenFromListItem = function (props, stock) {
6857
- var _a, _b;
6858
- var page = !!props[LIST_PAGE] && isNumber(props[LIST_PAGE]) ? props[LIST_PAGE] : 0;
6859
- var listLength = !!props[LIST_LENGTH] && isNumber(props[LIST_LENGTH]) ? props[LIST_LENGTH] : undefined;
6860
- var itemPerPage = !!props[LIST_ITEM_PER_PAGE] && isNumber(props[LIST_ITEM_PER_PAGE]) ? props[LIST_ITEM_PER_PAGE] : undefined;
6861
- var listItem = props[LIST_ITEM];
6798
+ const genChildenFromListItem = (props, stock) => {
6799
+ let page = !!props[LIST_PAGE] && isNumber(props[LIST_PAGE]) ? props[LIST_PAGE] : 0;
6800
+ let listLength = !!props[LIST_LENGTH] && isNumber(props[LIST_LENGTH]) ? props[LIST_LENGTH] : undefined;
6801
+ let itemPerPage = !!props[LIST_ITEM_PER_PAGE] && isNumber(props[LIST_ITEM_PER_PAGE]) ? props[LIST_ITEM_PER_PAGE] : undefined;
6802
+ const listItem = props[LIST_ITEM];
6862
6803
  if (!listItem)
6863
6804
  return undefined;
6864
- var currentPaths = props.currentPaths;
6805
+ const currentPaths = props[CURRENT_PATH_NAME];
6865
6806
  if (!currentPaths)
6866
6807
  return undefined;
6867
- var store = Object.keys(currentPaths)[0];
6808
+ const store = Object.keys(currentPaths)[0];
6868
6809
  if (!store)
6869
6810
  return undefined;
6870
- var path = currentPaths[store].path;
6811
+ const { path } = currentPaths[store];
6871
6812
  if (currentPaths && !listLength) {
6872
6813
  if (path) {
6873
- var list = stock.callFunction('get', { store: store, path: path });
6814
+ const list = stock.callFunction('get', { store, path });
6874
6815
  listLength = !!list && Array.isArray(list) ? list.length : 0;
6875
6816
  }
6876
6817
  }
@@ -6880,45 +6821,80 @@ var genChildenFromListItem = function (props, stock) {
6880
6821
  page = Number.isInteger(page) && page >= 0 ? page : 0;
6881
6822
  itemPerPage = !!itemPerPage && Number.isInteger(itemPerPage) && itemPerPage >= 0 ? itemPerPage : 0;
6882
6823
  listLength = !!listLength && Number.isInteger(listLength) && listLength >= 0 ? listLength : 0;
6883
- var offset = page * itemPerPage <= listLength ? page * itemPerPage : 0;
6884
- var children = [];
6824
+ const offset = page * itemPerPage <= listLength ? page * itemPerPage : 0;
6825
+ const children = [];
6885
6826
  // eslint-disable-next-line no-plusplus
6886
- for (var i = offset; i < listLength && i < offset + itemPerPage; i++) {
6887
- children.push(__assign(__assign({}, listItem), (_a = {}, _a[PATH_MODIFIERS_KEY] = (_b = {},
6888
- _b[store] = {
6889
- path: ".".concat(SEPARATOR).concat(i),
6890
- },
6891
- _b), _a)));
6827
+ for (let i = offset; i < listLength && i < offset + itemPerPage; i++) {
6828
+ children.push(Object.assign(Object.assign({}, listItem), { [PATH_MODIFIERS_KEY]: {
6829
+ [store]: {
6830
+ path: `.${SEPARATOR}${i}`,
6831
+ },
6832
+ } }));
6892
6833
  }
6893
6834
  return children.length > 0 ? children : undefined;
6894
6835
  };
6895
- var getRootWrapperProps = function (props, stock) {
6896
- var newProps = __assign({}, props);
6897
- modifierBuilder(newProps, stock);
6836
+ const getRootWrapperProps = (props, stock) => {
6837
+ const newProps = Object.assign({}, props);
6838
+ const subscriberPaths = calculatePropsFromModifier(newProps, stock);
6898
6839
  actionBuilder(newProps, stock);
6899
6840
  if (newProps[LIST_SEMAPHORE]) {
6900
6841
  newProps[V_CHILDREN_NAME] = genChildenFromListItem(newProps, stock);
6901
6842
  }
6843
+ newProps.subscriberPaths = subscriberPaths;
6902
6844
  return newProps;
6903
6845
  };
6904
- var getChildrensForRoot = function (props, children, Wrapper) {
6905
- var _a = props; _a.parentComp; var _b = V_CHILDREN_NAME; _a[_b]; var newParentComp = __rest(_a, ["parentComp", _b + ""]);
6846
+ const isChildrenProps = (propName) => !!propName && typeof propName === 'string' && propName.startsWith(V_CHILDREN_PREFIX);
6847
+ const getParentProps = (props) => {
6848
+ return props && typeof props === 'object' && !Array.isArray(props)
6849
+ ? Object.keys(props)
6850
+ .filter((key) => !isChildrenProps(key) && key !== PARENT_PROP_NAME)
6851
+ .reduce((newObj, key) => {
6852
+ // eslint-disable-next-line no-param-reassign
6853
+ newObj[key] = props[key];
6854
+ return newObj;
6855
+ }, {})
6856
+ : {};
6857
+ };
6858
+ const getPropsChildrenFilter = ({ props, filter }) => props && typeof props === 'object' && !Array.isArray(props)
6859
+ ? Object.keys(props)
6860
+ .filter((key) => ((filter === 'withoutChildren' && !isChildrenProps(key)) || (filter === 'onlyChildren' && isChildrenProps(key))) && key !== PARENT_PROP_NAME)
6861
+ .reduce((newObj, key) => {
6862
+ // eslint-disable-next-line no-param-reassign
6863
+ newObj[key] = props[key];
6864
+ return newObj;
6865
+ }, {})
6866
+ : {};
6867
+ const getChildrensForRoot = (props, children, Wrapper) => {
6906
6868
  // eslint-disable-next-line no-nested-ternary
6907
6869
  if (!!props && Array.isArray(children)) {
6908
- return children.map(function (childrenItem, index) {
6870
+ return children.map((childrenItem, index) => {
6909
6871
  // eslint-disable-next-line react/no-array-index-key
6910
- return jsxRuntime.exports.jsx(Wrapper, __assign({}, getWrapperProps(childrenItem, newParentComp)), index);
6872
+ return jsxRuntime.exports.jsx(Wrapper, { props: normalisePrimitives(childrenItem, getParentProps(props)) }, index);
6911
6873
  });
6912
6874
  }
6913
6875
  if (!!props && !!children) {
6914
- return jsxRuntime.exports.jsx(Wrapper, __assign({}, getWrapperProps(children, newParentComp)), void 0);
6876
+ return jsxRuntime.exports.jsx(Wrapper, { props: normalisePrimitives(children, getParentProps(props)) }, void 0);
6915
6877
  }
6916
6878
  return undefined;
6917
6879
  };
6918
- var generateChildren = function (props, _a) {
6919
- var Wrapper = _a.Wrapper;
6920
- return props[V_COMP_NAME] !== '_PrimitiveProp' ? getChildrensForRoot(props, props[V_CHILDREN_NAME], Wrapper) : props[V_CHILDREN_NAME];
6921
- };var wrapperUtil=/*#__PURE__*/Object.freeze({__proto__:null,actionBuilder:actionBuilder,modifierBuilder:modifierBuilder,pathModifierBuilder:pathModifierBuilder,getWrapperProps:getWrapperProps,getRootWrapperProps:getRootWrapperProps,getChildrensForRoot:getChildrensForRoot,generateChildren:generateChildren});var ajv = {exports: {}};var core$2 = {};var validate = {};var boolSchema = {};var errors = {};var codegen = {};var code$1 = {};(function (exports) {
6880
+ const generateChildren = (props, { Wrapper }) => props[V_COMP_NAME] !== '_PrimitiveProp' ? getChildrensForRoot(props, props[V_CHILDREN_NAME], Wrapper) : props[V_CHILDREN_NAME];
6881
+ const generateNewChildren = (props, { Wrapper }) => {
6882
+ // eslint-disable-next-line no-nested-ternary
6883
+ if (props) {
6884
+ if (Array.isArray(props)) {
6885
+ return props.map((childrenItem, index) => {
6886
+ // eslint-disable-next-line react/no-array-index-key
6887
+ return jsxRuntime.exports.jsx(Wrapper, { props: normalisePrimitives(childrenItem, getParentProps(props)) }, index);
6888
+ });
6889
+ }
6890
+ return jsxRuntime.exports.jsx(Wrapper, { props: normalisePrimitives(props, getParentProps(props)) }, void 0);
6891
+ }
6892
+ return undefined;
6893
+ };
6894
+ const removeTechnicalProps = (changeableProps) => {
6895
+ const _a = changeableProps, _b = PARENT_PROP_NAME; _a[_b]; const _c = STYLE_WEB_NAME; _a[_c]; const _d = V_COMP_NAME; _a[_d]; const _e = PATH_MODIFIERS_KEY; _a[_e]; const _f = CURRENT_PATH_NAME; _a[_f]; const _g = PATH_MODIFIERS_KEY; _a[_g]; const _h = LIST_SEMAPHORE; _a[_h]; const _j = LIST_ITEM; _a[_j]; const _k = LIST_PAGE; _a[_k]; const _l = LIST_ITEM_PER_PAGE; _a[_l]; const _m = LIST_LENGTH; _a[_m]; const newProps = __rest(_a, [_b + "", "style", _c + "", _d + "", _e + "", _f + "", "subscriberPaths", _g + "", _h + "", _j + "", _k + "", _l + "", _m + ""]);
6896
+ return newProps;
6897
+ };var wrapperUtil=/*#__PURE__*/Object.freeze({__proto__:null,getFilteredPath:getFilteredPath,actionBuilder:actionBuilder,calculatePropsFromModifier:calculatePropsFromModifier,getCurrentPaths:getCurrentPaths,normalisePrimitives:normalisePrimitives,getRootWrapperProps:getRootWrapperProps,isChildrenProps:isChildrenProps,getParentProps:getParentProps,getPropsChildrenFilter:getPropsChildrenFilter,getChildrensForRoot:getChildrensForRoot,generateChildren:generateChildren,generateNewChildren:generateNewChildren,removeTechnicalProps:removeTechnicalProps});var ajv = {exports: {}};var core$2 = {};var validate = {};var boolSchema = {};var errors = {};var codegen = {};var code$1 = {};(function (exports) {
6922
6898
  Object.defineProperty(exports, "__esModule", { value: true });
6923
6899
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
6924
6900
  class _CodeOrName {
@@ -13843,7 +13819,7 @@ var src = function(str, data, delimiter = [ '{{ ', ' }}' ]) {
13843
13819
 
13844
13820
  return str
13845
13821
 
13846
- };var I18nSchema = {
13822
+ };const I18nSchema = {
13847
13823
  $id: 'http://example.com/schemas/schema.json',
13848
13824
  type: 'object',
13849
13825
  additionalProperties: {
@@ -13868,28 +13844,26 @@ var src = function(str, data, delimiter = [ '{{ ', ' }}' ]) {
13868
13844
  },
13869
13845
  minProperties: 1,
13870
13846
  };
13871
- var I18n = /** @class */ (function () {
13847
+ class I18n {
13872
13848
  // eslint-disable-next-line consistent-this
13873
- function I18n(_a) {
13874
- var _this = this;
13875
- var _b = _a.language, language = _b === void 0 ? 'en' : _b, resources = _a.resources, nonExistsHandler = _a.nonExistsHandler, _c = _a.keyPrefix, keyPrefix = _c === void 0 ? '{{' : _c, _d = _a.keyPostfix, keyPostfix = _d === void 0 ? '}}' : _d;
13876
- this.getLocales = function () { return (_this.language.includes('-') ? _this.language.split('-') : _this.language.split('_') || [])[0]; };
13877
- this.t = function (key, options, language) {
13849
+ constructor({ language = 'en', resources, nonExistsHandler, keyPrefix = '{{', keyPostfix = '}}' }) {
13850
+ this.getLocales = () => (this.language.includes('-') ? this.language.split('-') : this.language.split('_') || [])[0];
13851
+ this.t = (key, options, language) => {
13878
13852
  if (!(typeof key === 'string')) {
13879
13853
  return key;
13880
13854
  }
13881
- if (!_this.resources || (!_this.resources && !_this.language && !language) || !_this.resources["".concat(_this.availableLanguageKey || language)]) {
13855
+ if (!this.resources || (!this.resources && !this.language && !language) || !this.resources[`${this.availableLanguageKey || language}`]) {
13882
13856
  return key;
13883
13857
  }
13884
- var value = _this.resources["".concat(_this.availableLanguageKey || language)].translation[key];
13858
+ const value = this.resources[`${this.availableLanguageKey || language}`].translation[key];
13885
13859
  if (value === undefined) {
13886
- if (_this.nonExistsHandler && typeof _this.nonExistsHandler === 'function') {
13887
- return _this.nonExistsHandler(key);
13860
+ if (this.nonExistsHandler && typeof this.nonExistsHandler === 'function') {
13861
+ return this.nonExistsHandler(key);
13888
13862
  }
13889
13863
  return key;
13890
13864
  }
13891
13865
  if (options) {
13892
- return src(value, options, [_this.keyPrefix, _this.keyPostfix]);
13866
+ return src(value, options, [this.keyPrefix, this.keyPostfix]);
13893
13867
  }
13894
13868
  return value;
13895
13869
  };
@@ -13897,9 +13871,9 @@ var I18n = /** @class */ (function () {
13897
13871
  this.nonExistsHandler = nonExistsHandler;
13898
13872
  this.keyPrefix = keyPrefix;
13899
13873
  this.keyPostfix = keyPostfix;
13900
- var ajv = new Ajv();
13901
- var validate = ajv.compile(I18nSchema);
13902
- var isValid = validate(resources);
13874
+ const ajv = new Ajv();
13875
+ const validate = ajv.compile(I18nSchema);
13876
+ const isValid = validate(resources);
13903
13877
  if (isValid) {
13904
13878
  this.resources = resources;
13905
13879
  }
@@ -13911,84 +13885,49 @@ var I18n = /** @class */ (function () {
13911
13885
  this.availableLanguageKey = this.getLocales();
13912
13886
  }
13913
13887
  }
13914
- return I18n;
13915
- }());var StockContext = require$$0.createContext(null);
13916
- var PathModifierContext = require$$0.createContext({});var getState = function (state) { return state === null || state === void 0 ? void 0 : state.root; };
13917
- var getValue = function (state, store, path) { return jsonPointerGet(state[store], path) || null; };
13918
- var getStateValue$1 = function (globalState, _a, currentPaths) {
13919
- var store = _a.store, path = _a.path, _b = _a.isError, isError = _b === void 0 ? false : _b;
13920
- var state = getState(globalState);
13888
+ }const StockContext = require$$0.createContext(null);
13889
+ const PathModifierContext = require$$0.createContext({});const getState = (state) => state === null || state === void 0 ? void 0 : state.root;
13890
+ const getValue = (state, store, path) => jsonPointerGet(state[store], path) || null;
13891
+ const getStateValue$1 = (globalState, { store, path, isError = false }, currentPaths) => {
13892
+ const state = getState(globalState);
13921
13893
  if (state && store && path) {
13922
- var convertedPath = currentPaths && currentPaths[store] && currentPaths[store].path ? changeRelativePath("".concat(currentPaths[store].path).concat(SEPARATOR).concat(path)) : path;
13923
- return getValue(state, "".concat(store).concat(isError ? STORE_ERROR_POSTFIX : ''), convertedPath);
13894
+ const convertedPath = currentPaths && currentPaths[store] && currentPaths[store].path ? changeRelativePath(`${currentPaths[store].path}${SEPARATOR}${path}`) : path;
13895
+ return getValue(state, `${store}${isError ? STORE_ERROR_POSTFIX : ''}`, convertedPath);
13924
13896
  }
13925
13897
  return null;
13926
13898
  };
13927
- var genAllStateProps = function (globalState, props) {
13928
- var currentPaths = props.currentPaths;
13929
- var result = {};
13930
- var paths = [];
13931
- props.parentComp; var propsNew = __rest(props
13932
- // eslint-disable-next-line func-names
13933
- , ["parentComp"]);
13934
- // eslint-disable-next-line func-names
13935
- traverse$3(propsNew).forEach(function (x) {
13936
- if (!!x && !!x[MODIFIER_KEY] && x[MODIFIER_KEY] === 'get' && !(this.path.length > 1 && this.path.includes(V_CHILDREN_NAME))) {
13937
- paths.push({ path: this.path, level: this.level });
13938
- }
13939
- });
13940
- orderBy_1(paths, ['level'], ['desc']).forEach(function (i) { return __awaiter(void 0, void 0, void 0, function () {
13941
- var _a, _b, functionName, functionParams, value, jsonata, expression;
13942
- return __generator(this, function (_c) {
13943
- _a = traverse$3(props).get(i.path), _b = MODIFIER_KEY, functionName = _a[_b], functionParams = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
13944
- if (functionName === 'get' && functionParams.store && functionParams.path) {
13945
- value = getStateValue$1(globalState, functionParams, currentPaths);
13946
- if (functionParams.jsonataDef) {
13947
- try {
13948
- jsonata = require('jsonata');
13949
- expression = jsonata(functionParams.jsonataDef);
13950
- value = expression.evaluate(value);
13951
- }
13952
- catch (error) {
13953
- // eslint-disable-next-line no-console
13954
- console.error('jsonata error', error, functionParams.jsonataDef);
13955
- }
13956
- }
13957
- // traverse(result).set(i.path, value)
13958
- result[pathArrayToJsonPointer(i.path)] = value;
13959
- }
13960
- return [2 /*return*/];
13961
- });
13962
- }); });
13963
- return result;
13964
- };var DATA_UPDATE = 'DATA_UPDATE';
13965
- var PURGE = 'PURGE';
13966
- var set$1 = function (payload) { return ({
13899
+ const compSelectorHook = (currentPaths, subscriberPaths) => (state) => {
13900
+ if (typeof subscriberPaths === 'object' && Array.isArray(subscriberPaths) && (subscriberPaths === null || subscriberPaths === void 0 ? void 0 : subscriberPaths.length) > 0) {
13901
+ return subscriberPaths.map((subscriberPath) => getStateValue$1(state, subscriberPath, currentPaths));
13902
+ }
13903
+ // TODO isError, currentPaths, root need to solve propperly
13904
+ return undefined;
13905
+ };const DATA_UPDATE = 'DATA_UPDATE';
13906
+ const PURGE = 'PURGE';
13907
+ const set$1 = (payload) => ({
13967
13908
  type: DATA_UPDATE,
13968
- payload: payload,
13969
- }); };
13970
- var purge = function (payload) { return ({
13909
+ payload,
13910
+ });
13911
+ const purge = (payload) => ({
13971
13912
  type: PURGE,
13972
- payload: payload,
13973
- }); };var getStateValue = function (attr, _a, callerArgs, stock) {
13974
- var _b = _a === void 0 ? {} : _a, currentPaths = _b.currentPaths;
13975
- var store = attr.store, path = attr.path;
13976
- var state = stock.reduxStore.getState();
13977
- return getStateValue$1(state, { store: store, path: path }, currentPaths);
13978
- };
13979
- var get = function (attr, _a, callerArgs, stock) {
13980
- var _b = _a === void 0 ? {} : _a, currentPaths = _b.currentPaths;
13981
- var store = attr.store, path = attr.path;
13982
- var state = stock.reduxStore.getState();
13983
- return getStateValue$1(state, { store: store, path: path }, currentPaths);
13984
- };
13985
- var set = function (attr, props, callerArgs, stock) {
13986
- stock.reduxStore.dispatch(set$1(__assign(__assign({}, attr), { value: attr && attr.value !== undefined ? attr.value : callerArgs[0], currentPaths: props.currentPaths, stock: stock })));
13913
+ payload,
13914
+ });const getStateValue = (attr, { [CURRENT_PATH_NAME]: currentPaths } = {}, callerArgs, stock) => {
13915
+ const { store, path } = attr;
13916
+ const state = stock.reduxStore.getState();
13917
+ return getStateValue$1(state, { store, path }, currentPaths);
13918
+ };
13919
+ const get = (attr, { [CURRENT_PATH_NAME]: currentPaths } = {}, callerArgs, stock) => {
13920
+ const { store, path } = attr;
13921
+ const state = stock.reduxStore.getState();
13922
+ return getStateValue$1(state, { store, path }, currentPaths);
13923
+ };
13924
+ const set = (attr, props, callerArgs, stock) => {
13925
+ stock.reduxStore.dispatch(set$1(Object.assign(Object.assign({}, attr), { value: attr && attr.value !== undefined ? attr.value : callerArgs[0], [CURRENT_PATH_NAME]: props[CURRENT_PATH_NAME], stock })));
13987
13926
  };
13988
13927
  var functions = {
13989
- getStateValue: getStateValue,
13990
- get: get,
13991
- set: set,
13928
+ getStateValue,
13929
+ get,
13930
+ set,
13992
13931
  };/**
13993
13932
  * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
13994
13933
  *
@@ -14494,11 +14433,11 @@ var pick = flatRest(function(object, paths) {
14494
14433
  return object == null ? {} : basePick(object, paths);
14495
14434
  });
14496
14435
 
14497
- var pick_1 = pick;var SetTransform = createTransform(function (inboundState, key) {
14436
+ var pick_1 = pick;const SetTransform = createTransform((inboundState, key) => {
14498
14437
  if (key !== 'root')
14499
14438
  return inboundState;
14500
14439
  return pick_1(inboundState, PERSIST_STORAGE_NAMES);
14501
- }, function (outboundState, key) {
14440
+ }, (outboundState, key) => {
14502
14441
  if (key !== 'root')
14503
14442
  return outboundState;
14504
14443
  return pick_1(outboundState, PERSIST_STORAGE_NAMES);
@@ -14508,81 +14447,80 @@ var persistConfig = {
14508
14447
  whitelist: ['root'],
14509
14448
  transforms: [SetTransform],
14510
14449
  };function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!n.constructor[L]||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?(n.delete(r),n.add(t)):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)?n:(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0),n)}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function O(n){g(n),n.p.forEach(S),n.p=null;}function g(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.O=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.g||b("ES5").S(e,r,o),o?(i[Q].P&&(O(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o;i(3===e.i?new Set(o):o,(function(r,i){return A(n,e,o,r,i,t)})),x(n,o,!1),t&&n.u&&b("Patches").R(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var v=M(e,c,s&&i&&3!==i.i&&!u(i.D,a)?s.concat(a):void 0);if(f(o,a,v),!r(v))return;e.m=!1;}if(t(c)&&!y(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),n.h.F&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function R(n,r,t){var e=s(r)?b("MapSet").N(r,t):v(r)?b("MapSet").T(r,t):n.g?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function D(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=F(r,c),u.I=!1;}else e=F(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function F(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=R(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.D[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&"number"!=typeof t&&(void 0!==t||r in n.o)||(n.o[r]=t,n.D[r]=!0,!0)},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.D[r]=!1,E(n),k(n)):delete n.D[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.g=B,this.F=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=R(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?O(c):g(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw O(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.F&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=D(e));var i=w(this),o=R(this,e,void 0);return o[Q].C=!0,g(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.F=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.g=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
14511
- var pathConverter = function (path) { return path.replace(/\./g, SEPARATOR); };
14512
- var errorConverter = function (errors) {
14513
- var res = {};
14450
+ const pathConverter = (path) => path.replace(/\./g, SEPARATOR);
14451
+ const errorConverter = (errors) => {
14452
+ const res = {};
14514
14453
  if (errors) {
14515
- errors.forEach(function (i) {
14454
+ errors.forEach((i) => {
14516
14455
  if (i.keyword === 'required') {
14517
- jsonpointer.set(res, "".concat(pathConverter("".concat(i.instancePath, ".").concat(i.params.missingProperty)), "/-"), i.message);
14456
+ jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${i.params.missingProperty}`)}/-`, i.message);
14518
14457
  }
14519
14458
  else {
14520
- jsonpointer.set(res, "".concat(pathConverter(i.instancePath), "/-"), i.message);
14459
+ jsonpointer.set(res, `${pathConverter(i.instancePath)}/-`, i.message);
14521
14460
  }
14522
14461
  });
14523
14462
  }
14524
14463
  return res;
14525
14464
  };
14526
- var validateJSON = function (schema, store, data) {
14527
- var ajv = new Ajv({ allErrors: true });
14528
- var validate = ajv.compile(schema);
14529
- var valid = validate(data);
14465
+ const validateJSON = (schema, store, data) => {
14466
+ const ajv = new Ajv({ allErrors: true });
14467
+ const validate = ajv.compile(schema);
14468
+ const valid = validate(data);
14530
14469
  return {
14531
- store: "".concat(store).concat(STORE_ERROR_POSTFIX),
14532
- valid: valid,
14470
+ store: `${store}${STORE_ERROR_POSTFIX}`,
14471
+ valid,
14533
14472
  value: valid ? null : errorConverter(validate.errors),
14534
14473
  };
14535
- };var initialState = {};
14536
- var validateNewState = function (stock, newState, actionStore, actionPath) {
14474
+ };const initialState = {};
14475
+ const validateNewState = (stock, newState, actionStore, actionPath) => {
14537
14476
  if (stock === null || stock === void 0 ? void 0 : stock.validations) {
14538
- stock.validations.forEach(function (validateItem) {
14539
- if (validateItem.store === actionStore && "".concat(actionPath).startsWith(validateItem.path)) {
14477
+ stock.validations.forEach((validateItem) => {
14478
+ if (validateItem.store === actionStore && `${actionPath}`.startsWith(validateItem.path)) {
14540
14479
  if (validateItem.schema) {
14541
- var stateToBeValidated = jsonPointerGet(newState, "".concat(SEPARATOR).concat(actionStore).concat(validateItem.path));
14542
- var errors = validateJSON(validateItem.schema, actionStore, stateToBeValidated);
14480
+ const stateToBeValidated = jsonPointerGet(newState, `${SEPARATOR}${actionStore}${validateItem.path}`);
14481
+ const errors = validateJSON(validateItem.schema, actionStore, stateToBeValidated);
14543
14482
  // console.log('matched validator', `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors)
14544
14483
  // eslint-disable-next-line no-param-reassign
14545
- newState = jsonPointerSet(newState, "".concat(SEPARATOR).concat(errors.store).concat(validateItem.path), errors.value);
14484
+ newState = jsonPointerSet(newState, `${SEPARATOR}${errors.store}${validateItem.path}`, errors.value);
14546
14485
  }
14547
14486
  }
14548
14487
  });
14549
14488
  }
14550
14489
  };
14551
- var reducer = function (state, action) {
14552
- if (state === void 0) { state = initialState; }
14490
+ const reducer = (state = initialState, action) => {
14553
14491
  switch (action === null || action === void 0 ? void 0 : action.type) {
14554
14492
  case DATA_UPDATE: {
14555
- var _a = (action === null || action === void 0 ? void 0 : action.payload) || {}, _b = _a.store, store_1 = _b === void 0 ? undefined : _b, _c = _a.path, path = _c === void 0 ? undefined : _c, _d = _a.value, value_1 = _d === void 0 ? undefined : _d, _e = _a.jsonataDef, jsonataDef_1 = _e === void 0 ? undefined : _e, _f = _a.currentPaths, currentPaths = _f === void 0 ? undefined : _f, _g = _a.stock, stock_1 = _g === void 0 ? undefined : _g;
14556
- if (store_1 && path && !isCircular(value_1)) {
14557
- var storekey = "".concat(store_1);
14558
- var convertedPath_1 = currentPaths && currentPaths[storekey] && currentPaths[storekey].path
14559
- ? changeRelativePath("".concat(currentPaths[storekey].path).concat(SEPARATOR).concat(path))
14493
+ const { store = undefined, path = undefined, value = undefined, jsonataDef = undefined, [CURRENT_PATH_NAME]: currentPaths = undefined, stock = undefined, } = (action === null || action === void 0 ? void 0 : action.payload) || {};
14494
+ if (store && path && !isCircular(value)) {
14495
+ const storekey = `${store}`;
14496
+ let convertedPath = currentPaths && currentPaths[storekey] && currentPaths[storekey].path
14497
+ ? changeRelativePath(`${currentPaths[storekey].path}${SEPARATOR}${path}`)
14560
14498
  : changeRelativePath(path);
14561
- convertedPath_1 = convertedPath_1.startsWith(SEPARATOR) ? convertedPath_1 : "".concat(SEPARATOR).concat(convertedPath_1);
14562
- var absolutePathWithStoreKey_1 = "".concat(SEPARATOR).concat(storekey).concat(convertedPath_1);
14563
- var newState = produce(state, function (draft) {
14564
- if (jsonataDef_1) {
14499
+ convertedPath = convertedPath.startsWith(SEPARATOR) ? convertedPath : `${SEPARATOR}${convertedPath}`;
14500
+ const absolutePathWithStoreKey = `${SEPARATOR}${storekey}${convertedPath}`;
14501
+ const newState = produce(state, (draft) => {
14502
+ if (jsonataDef) {
14565
14503
  try {
14566
14504
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
14567
- var jsonata = require('jsonata');
14568
- var expression = jsonata(jsonataDef_1);
14569
- var newValue = expression.evaluate(value_1);
14505
+ const jsonata = require('jsonata');
14506
+ const expression = jsonata(jsonataDef);
14507
+ const newValue = expression.evaluate(value);
14570
14508
  // eslint-disable-next-line no-param-reassign
14571
- draft = jsonPointerSet(draft, absolutePathWithStoreKey_1, newValue);
14509
+ draft = jsonPointerSet(draft, absolutePathWithStoreKey, newValue);
14572
14510
  }
14573
14511
  catch (error) {
14574
14512
  // eslint-disable-next-line no-console
14575
- console.error('jsonata error', error, jsonataDef_1);
14513
+ console.error('jsonata error', error, jsonataDef);
14576
14514
  // eslint-disable-next-line no-param-reassign
14577
- draft = jsonPointerSet(draft, absolutePathWithStoreKey_1, value_1);
14515
+ draft = jsonPointerSet(draft, absolutePathWithStoreKey, value);
14578
14516
  }
14579
14517
  }
14580
14518
  else {
14581
14519
  // eslint-disable-next-line no-param-reassign
14582
- draft = jsonPointerSet(draft, absolutePathWithStoreKey_1, value_1);
14520
+ draft = jsonPointerSet(draft, absolutePathWithStoreKey, value);
14583
14521
  }
14584
14522
  // if validatior has match, need to validate it synchronously
14585
- validateNewState(stock_1, draft, store_1, convertedPath_1);
14523
+ validateNewState(stock, draft, store, convertedPath);
14586
14524
  });
14587
14525
  return newState;
14588
14526
  }
@@ -14594,16 +14532,8 @@ var reducer = function (state, action) {
14594
14532
  default:
14595
14533
  return state;
14596
14534
  }
14597
- };var rootReducer = combineReducers({ root: reducer });var deletePersistDataStore = function (attr, props, callerArgs, stock) { return __awaiter(void 0, void 0, void 0, function () {
14598
- return __generator(this, function (_a) {
14599
- switch (_a.label) {
14600
- case 0:
14601
- stock.reduxStore.dispatch(purge(null));
14602
- return [4 /*yield*/, stock.callFunction('reloadApp', {})];
14603
- case 1:
14604
- _a.sent();
14605
- return [2 /*return*/];
14606
- }
14607
- });
14608
- }); };
14609
- var appRootFunctions = { deletePersistDataStore: deletePersistDataStore };exports.I18n=I18n;exports.PathModifierContext=PathModifierContext;exports.Stock=Stock;exports.StockContext=StockContext;exports.appRootFunctions=appRootFunctions;exports.constants=constants;exports.genAllStateProps=genAllStateProps;exports.persistConfig=persistConfig;exports.stockFunctions=functions;exports.storeReducers=rootReducer;exports.util=util$1;exports.wrapperUtil=wrapperUtil;//# sourceMappingURL=index.js.map
14535
+ };const rootReducer = combineReducers({ root: reducer });const deletePersistDataStore = (attr, props, callerArgs, stock) => __awaiter(void 0, void 0, void 0, function* () {
14536
+ stock.reduxStore.dispatch(purge(null));
14537
+ yield stock.callFunction('reloadApp', {});
14538
+ });
14539
+ const appRootFunctions = { deletePersistDataStore };exports.I18n=I18n;exports.PathModifierContext=PathModifierContext;exports.Stock=Stock;exports.StockContext=StockContext;exports.appRootFunctions=appRootFunctions;exports.compSelectorHook=compSelectorHook;exports.constants=constants;exports.persistConfig=persistConfig;exports.stockFunctions=functions;exports.storeReducers=rootReducer;exports.util=util$1;exports.wrapperUtil=wrapperUtil;//# sourceMappingURL=index.js.map