@steroidsjs/core 3.0.91 → 3.0.93

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/actions/list.js CHANGED
@@ -42,26 +42,6 @@ exports.LIST_CHANGE_ACTION = '@list/change_action';
42
42
  exports.LIST_SELECT_ITEM = '@list/select_item';
43
43
  //const STORAGE_LAYOUT_KEY_PREFIX = 'listLayout_';
44
44
  var lazyTimers = {};
45
- var createList = function (listId, props) { return ({
46
- action: props.action || props.action === '' ? props.action : null,
47
- actionMethod: props.actionMethod || 'get',
48
- onFetch: props.onFetch,
49
- onError: props.onError,
50
- condition: props.condition,
51
- scope: props.scope,
52
- total: props.total || null,
53
- items: null,
54
- sourceItems: props.items || null,
55
- isRemote: !props.items,
56
- loadMore: props._pagination.loadMore,
57
- primaryKey: props.primaryKey,
58
- listId: listId,
59
- formId: (0, get_1["default"])(props, 'searchForm.formId') || listId,
60
- pageAttribute: (0, get_1["default"])(props, '_pagination.attribute') || null,
61
- pageSizeAttribute: (0, get_1["default"])(props, '_paginationSize.attribute') || null,
62
- sortAttribute: (0, get_1["default"])(props, '_sort.attribute') || null,
63
- layoutAttribute: (0, get_1["default"])(props, '_layout.attribute') || null
64
- }); };
65
45
  var httpFetchHandler = function (list, query, _a, options) {
66
46
  var http = _a.http;
67
47
  if (options === void 0) { options = {}; }
@@ -9,5 +9,8 @@ export declare const closeNotification: (id?: string | null) => {
9
9
  type: string;
10
10
  id: string;
11
11
  };
12
- export declare const showNotification: (message: string, level?: ColorName, params?: IShowNotificationParameters) => (dispatch: any) => void;
12
+ export declare const showNotification: (message: string | {
13
+ message: string;
14
+ description?: string;
15
+ }, level?: ColorName, params?: IShowNotificationParameters) => (dispatch: any) => void;
13
16
  export declare const setFlashes: (flashes: any) => ((dispatch: any) => void)[][];
@@ -1,11 +1,6 @@
1
1
  export interface IClientStorageComponentConfig {
2
2
  /**
3
- * Кастомный домен для куки
4
- */
5
- domain?: string;
6
- /**
7
- * Автоматически устанавливает куку для всех поддоменов текущего домена,
8
- * но только если параметр domain не указан явно
3
+ * Позволяет использовать cookie на всех поддоменах (по умолчанию, false)
9
4
  */
10
5
  shareBetweenSubdomains?: boolean;
11
6
  /**
@@ -49,7 +44,6 @@ export default class ClientStorageComponent implements IClientStorageComponent {
49
44
  STORAGE_SESSION: any;
50
45
  localStorageAvailable: boolean;
51
46
  sessionStorageAvailable: boolean;
52
- domain?: string;
53
47
  shareBetweenSubdomains?: boolean;
54
48
  private _ssrCookie;
55
49
  constructor(components: any, config: any);
@@ -62,7 +62,6 @@ var ClientStorageComponent = /** @class */ (function () {
62
62
  this.sessionStorageAvailable = false;
63
63
  }
64
64
  }
65
- this.domain = (config === null || config === void 0 ? void 0 : config.domain) || null;
66
65
  this.shareBetweenSubdomains = (_a = config === null || config === void 0 ? void 0 : config.shareBetweenSubdomains) !== null && _a !== void 0 ? _a : false;
67
66
  this._ssrCookie = config === null || config === void 0 ? void 0 : config.ssrCookie;
68
67
  }
@@ -88,10 +87,13 @@ var ClientStorageComponent = /** @class */ (function () {
88
87
  window.sessionStorage.setItem(name, value);
89
88
  }
90
89
  else {
90
+ var domain = this._getDomain();
91
91
  var options = {
92
- expires: expires,
93
- domain: this._getDomain()
92
+ expires: expires
94
93
  };
94
+ if (domain) {
95
+ options.domain = domain;
96
+ }
95
97
  if (expires && process.env.IS_SSR) {
96
98
  options.expires = (0, dayjs_1["default"])().add(options.expires, 'days').utc().toDate();
97
99
  }
@@ -108,27 +110,27 @@ var ClientStorageComponent = /** @class */ (function () {
108
110
  window.sessionStorage.removeItem(name);
109
111
  }
110
112
  else {
111
- var options = {
112
- domain: this._getDomain()
113
- };
113
+ var domain = this._getDomain();
114
+ var options = {};
115
+ if (domain) {
116
+ options.domain = domain;
117
+ }
114
118
  process.env.IS_SSR ? this._ssrCookie.remove(name, options) : cookie.remove(name, options);
115
119
  }
116
120
  };
117
121
  ClientStorageComponent.prototype._getDomain = function () {
118
- if (this.domain) {
119
- return this.domain;
120
- }
121
- var host = typeof window !== 'undefined' ? window.location.hostname : '';
122
122
  if (this.shareBetweenSubdomains) {
123
+ var host = typeof window !== 'undefined' ? window.location.hostname : '';
123
124
  var isIp = /^\d{1,3}(\.\d{1,3}){3}$/.test(host);
124
- if (!isIp) {
125
+ var isLocalhost = host === 'localhost';
126
+ if (!isIp && !isLocalhost) {
125
127
  return host
126
128
  .split('.')
127
129
  .slice(-2)
128
130
  .join('.');
129
131
  }
130
132
  }
131
- return host;
133
+ return null;
132
134
  };
133
135
  return ClientStorageComponent;
134
136
  }());