@next-core/brick-kit 2.123.5 → 2.123.8

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
@@ -5,7 +5,7 @@ import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
7
7
  import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
- import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, pick, orderBy, omit, findLastIndex, noop, isObject as isObject$1, isString } from 'lodash';
8
+ import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
11
11
  import { pipes } from '@next-core/pipes';
@@ -1137,14 +1137,21 @@ var TRANSFORMATION_EDIT = "devtools-transformation-edit";
1137
1137
 
1138
1138
  /* istanbul ignore next */
1139
1139
  function devtoolsHookEmit(type, payload) {
1140
- Promise.resolve().then(() => {
1140
+ var emit = () => {
1141
1141
  var _getDevHook, _getDevHook$emit;
1142
1142
 
1143
1143
  (_getDevHook = getDevHook()) === null || _getDevHook === void 0 ? void 0 : (_getDevHook$emit = _getDevHook.emit) === null || _getDevHook$emit === void 0 ? void 0 : _getDevHook$emit.call(_getDevHook, {
1144
1144
  type,
1145
1145
  payload
1146
1146
  });
1147
- });
1147
+ }; // Try to emit only in idle time.
1148
+
1149
+
1150
+ if (typeof window.requestIdleCallback === "function") {
1151
+ window.requestIdleCallback(emit);
1152
+ } else {
1153
+ setTimeout(emit, 0);
1154
+ }
1148
1155
  }
1149
1156
  function listenDevtools() {
1150
1157
  window.addEventListener("message", event => {
@@ -6974,19 +6981,29 @@ function hasFileType(request) {
6974
6981
  return flag;
6975
6982
  }
6976
6983
  function transformFormData(data) {
6984
+ if (data instanceof FormData) {
6985
+ return data;
6986
+ }
6987
+
6977
6988
  var formData = new FormData();
6978
6989
 
6979
- for (var [key, value] of Object.entries(data)) {
6990
+ var _loop = function (key, value) {
6980
6991
  if (Array.isArray(value)) {
6981
- (function () {
6982
- var k = "".concat(key, "[]");
6983
- value.forEach(v => {
6984
- formData.append(k, v);
6985
- });
6986
- })();
6992
+ value.forEach(v => {
6993
+ formData.append(key, v);
6994
+ });
6995
+ } else if (isObject$1(value) && !(value instanceof Blob) && !(value instanceof Date)) {
6996
+ Object.entries(value).forEach(_ref => {
6997
+ var [k, v] = _ref;
6998
+ formData.append("".concat(key, "[").concat(k, "]"), v);
6999
+ });
6987
7000
  } else {
6988
7001
  formData.append(key, value);
6989
7002
  }
7003
+ };
7004
+
7005
+ for (var [key, value] of Object.entries(data)) {
7006
+ _loop(key, value);
6990
7007
  }
6991
7008
 
6992
7009
  return formData;
@@ -6996,14 +7013,14 @@ function CustomApi(_x) {
6996
7013
  }
6997
7014
 
6998
7015
  function _CustomApi() {
6999
- _CustomApi = _asyncToGenerator$4(function* (_ref) {
7016
+ _CustomApi = _asyncToGenerator$4(function* (_ref2) {
7000
7017
  var {
7001
7018
  url,
7002
7019
  method = "GET",
7003
7020
  responseWrapper = true,
7004
7021
  ext_fields = [],
7005
7022
  request
7006
- } = _ref;
7023
+ } = _ref2;
7007
7024
  var isSimpleRequest = ["get", "delete", "head"].includes(method.toLowerCase());
7008
7025
  var response;
7009
7026