@bigbinary/neeto-commons-frontend 1.0.10 → 2.0.0
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/README.md +41 -9
- package/initializers.js +22 -572
- package/package.json +3 -2
- package/pure.js +394 -0
- package/react.js +4 -6
- package/utils.js +17 -344
package/initializers.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var objects = require('pure/objects');
|
|
4
|
+
var neetoui = require('@bigbinary/neetoui');
|
|
3
5
|
var axios = require('axios');
|
|
4
|
-
var ramda = require('ramda');
|
|
5
6
|
var i18next = require('i18next');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var updateLocale = require('dayjs/plugin/updateLocale');
|
|
9
|
-
var neetoui = require('@bigbinary/neetoui');
|
|
7
|
+
var strings = require('pure/strings');
|
|
8
|
+
var ramda = require('ramda');
|
|
10
9
|
var mixpanel = require('mixpanel-browser');
|
|
11
10
|
var reactI18next = require('react-i18next');
|
|
12
11
|
|
|
@@ -14,22 +13,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
13
|
|
|
15
14
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
16
15
|
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
17
|
-
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
18
|
-
var relativeTime__default = /*#__PURE__*/_interopDefaultLegacy(relativeTime);
|
|
19
|
-
var updateLocale__default = /*#__PURE__*/_interopDefaultLegacy(updateLocale);
|
|
20
16
|
var mixpanel__default = /*#__PURE__*/_interopDefaultLegacy(mixpanel);
|
|
21
17
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
xCsrfToken: "X-CSRF-TOKEN"
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var resetAuthTokens = function resetAuthTokens() {
|
|
29
|
-
ramda.values(HEADERS_KEYS).forEach(function (header) {
|
|
30
|
-
delete axios__default["default"].defaults.headers[header];
|
|
31
|
-
});
|
|
32
|
-
};
|
|
18
|
+
var _document$getElements, _document$getElements2;
|
|
19
|
+
window.globalProps = objects.keysToCamelCase(JSON.parse(((_document$getElements = document.getElementsByClassName("root-container")[0]) === null || _document$getElements === void 0 ? void 0 : (_document$getElements2 = _document$getElements.dataset) === null || _document$getElements2 === void 0 ? void 0 : _document$getElements2.reactProps) || "{}"));
|
|
20
|
+
objects.deepFreezeObject(window.globalProps);
|
|
33
21
|
|
|
34
22
|
function _arrayWithHoles(arr) {
|
|
35
23
|
if (Array.isArray(arr)) return arr;
|
|
@@ -92,72 +80,16 @@ function _slicedToArray(arr, i) {
|
|
|
92
80
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
93
81
|
}
|
|
94
82
|
|
|
95
|
-
function _typeof
|
|
83
|
+
function _typeof(obj) {
|
|
96
84
|
"@babel/helpers - typeof";
|
|
97
85
|
|
|
98
|
-
return _typeof
|
|
86
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
99
87
|
return typeof obj;
|
|
100
88
|
} : function (obj) {
|
|
101
89
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
102
|
-
}, _typeof
|
|
90
|
+
}, _typeof(obj);
|
|
103
91
|
}
|
|
104
92
|
|
|
105
|
-
var snakeToCamelCase = function snakeToCamelCase(string) {
|
|
106
|
-
return string.replace(/(_\w)/g, function (letter) {
|
|
107
|
-
return letter[1].toUpperCase();
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
var camelToSnakeCase = function camelToSnakeCase(string) {
|
|
111
|
-
return string.replace(/[A-Z]/g, function (letter) {
|
|
112
|
-
return "_".concat(letter.toLowerCase());
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
var transformObjectDeep = function transformObjectDeep(object, keyValueTransformer) {
|
|
117
|
-
if (Array.isArray(object)) {
|
|
118
|
-
return object.map(function (obj) {
|
|
119
|
-
return transformObjectDeep(obj, keyValueTransformer);
|
|
120
|
-
});
|
|
121
|
-
} else if (object === null || _typeof$1(object) !== "object") {
|
|
122
|
-
return object;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return Object.fromEntries(Object.entries(object).map(function (_ref) {
|
|
126
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
127
|
-
key = _ref2[0],
|
|
128
|
-
value = _ref2[1];
|
|
129
|
-
|
|
130
|
-
return keyValueTransformer(key, transformObjectDeep(value, keyValueTransformer));
|
|
131
|
-
}));
|
|
132
|
-
};
|
|
133
|
-
var keysToCamelCase = function keysToCamelCase(object) {
|
|
134
|
-
return transformObjectDeep(object, function (key, value) {
|
|
135
|
-
return [snakeToCamelCase(key), value];
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
var deepFreezeObject = function deepFreezeObject(object) {
|
|
139
|
-
if (object && _typeof$1(object) === "object" && !Object.isFrozen(object)) {
|
|
140
|
-
Object.keys(object).forEach(function (property) {
|
|
141
|
-
return deepFreezeObject(object[property]);
|
|
142
|
-
});
|
|
143
|
-
Object.freeze(object);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return object;
|
|
147
|
-
};
|
|
148
|
-
var matches = ramda.curry(function (pattern, object) {
|
|
149
|
-
if (object === pattern) return true;
|
|
150
|
-
if (ramda.isNil(pattern) || ramda.isNil(object)) return false;
|
|
151
|
-
if (_typeof$1(pattern) !== "object") return false;
|
|
152
|
-
return Object.entries(pattern).every(function (_ref3) {
|
|
153
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
154
|
-
key = _ref4[0],
|
|
155
|
-
value = _ref4[1];
|
|
156
|
-
|
|
157
|
-
return matches(value, object[key]);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
93
|
function _defineProperty(obj, key, value) {
|
|
162
94
|
if (key in obj) {
|
|
163
95
|
Object.defineProperty(obj, key, {
|
|
@@ -173,499 +105,17 @@ function _defineProperty(obj, key, value) {
|
|
|
173
105
|
return obj;
|
|
174
106
|
}
|
|
175
107
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return item.id !== id;
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
ramda.curry(function (id, array) {
|
|
185
|
-
return array.find(function (item) {
|
|
186
|
-
return item.id === id;
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
ramda.curry(function (id, newItem, array) {
|
|
190
|
-
return array.map(function (item) {
|
|
191
|
-
return item.id === id ? newItem : item;
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
ramda.curry(function (id, modifier, array) {
|
|
195
|
-
return array.map(function (item) {
|
|
196
|
-
return item.id === id ? modifier(item) : item;
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
ramda.curry(function (pattern, array) {
|
|
200
|
-
return array.find(matches(pattern));
|
|
201
|
-
});
|
|
202
|
-
ramda.curry(function (pattern, array) {
|
|
203
|
-
return array.filter(ramda.complement(matches(pattern)));
|
|
204
|
-
});
|
|
205
|
-
ramda.curry(function (pattern, newItem, array) {
|
|
206
|
-
return array.map(function (item) {
|
|
207
|
-
return matches(pattern, item) ? newItem : item;
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
ramda.curry(function (pattern, modifier, array) {
|
|
211
|
-
return array.map(function (item) {
|
|
212
|
-
return matches(pattern, item) ? modifier(item) : item;
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
ramda.curry(function (id, array) {
|
|
216
|
-
return array.some(function (item) {
|
|
217
|
-
return item.id === id;
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
ramda.curry(function (pattern, array) {
|
|
221
|
-
return array.some(matches(pattern));
|
|
222
|
-
});
|
|
223
|
-
ramda.curry(function (keyMap, objectArray) {
|
|
224
|
-
return objectArray.map(function (object) {
|
|
225
|
-
return _objectSpread(_objectSpread({}, object), ramda.fromPairs(ramda.toPairs(keyMap).map(function (_ref) {
|
|
226
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
227
|
-
key = _ref2[0],
|
|
228
|
-
value = _ref2[1];
|
|
229
|
-
|
|
230
|
-
return [value, object[key]];
|
|
231
|
-
})));
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
ramda.curry(function (keyMap, objectArray) {
|
|
235
|
-
return objectArray.map(function (object) {
|
|
236
|
-
return _objectSpread(_objectSpread({}, ramda.omit(ramda.keys(keyMap), object)), ramda.fromPairs(ramda.toPairs(keyMap).map(function (_ref3) {
|
|
237
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
238
|
-
source = _ref4[0],
|
|
239
|
-
destination = _ref4[1];
|
|
240
|
-
|
|
241
|
-
return [destination, object[source]];
|
|
242
|
-
})));
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
ramda.curry(function (keyMap, objectArray) {
|
|
246
|
-
var copyKeysSingleObject = function copyKeysSingleObject(object, keyMap) {
|
|
247
|
-
var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
248
|
-
return _objectSpread(_objectSpread({}, object), ramda.fromPairs(ramda.toPairs(keyMap).map(function (_ref5) {
|
|
249
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
250
|
-
destination = _ref6[0],
|
|
251
|
-
source = _ref6[1];
|
|
252
|
-
|
|
253
|
-
if (typeof source === "function") {
|
|
254
|
-
return [destination, source(object[destination], root)];
|
|
255
|
-
} else if (Array.isArray(source)) {
|
|
256
|
-
return [destination, ramda.path(source, root)];
|
|
257
|
-
} else if (_typeof$1(source) === "object") {
|
|
258
|
-
return [destination, copyKeysSingleObject(object[destination], source, root)];
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return [destination, object[source]];
|
|
262
|
-
})));
|
|
263
|
-
};
|
|
108
|
+
var HEADERS_KEYS = {
|
|
109
|
+
xAuthEmail: "X-Auth-Email",
|
|
110
|
+
xAuthToken: "X-Auth-Token",
|
|
111
|
+
xCsrfToken: "X-CSRF-TOKEN"
|
|
112
|
+
};
|
|
264
113
|
|
|
265
|
-
|
|
266
|
-
|
|
114
|
+
var resetAuthTokens = function resetAuthTokens() {
|
|
115
|
+
ramda.values(HEADERS_KEYS).forEach(function (header) {
|
|
116
|
+
delete axios__default["default"].defaults.headers[header];
|
|
267
117
|
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
var regeneratorRuntime$1 = {exports: {}};
|
|
271
|
-
|
|
272
|
-
var _typeof = {exports: {}};
|
|
273
|
-
|
|
274
|
-
(function (module) {
|
|
275
|
-
function _typeof(obj) {
|
|
276
|
-
"@babel/helpers - typeof";
|
|
277
|
-
|
|
278
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
279
|
-
return typeof obj;
|
|
280
|
-
} : function (obj) {
|
|
281
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
282
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
286
|
-
} (_typeof));
|
|
287
|
-
|
|
288
|
-
(function (module) {
|
|
289
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
290
|
-
|
|
291
|
-
function _regeneratorRuntime() {
|
|
292
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
293
|
-
|
|
294
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
295
|
-
return exports;
|
|
296
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
297
|
-
var exports = {},
|
|
298
|
-
Op = Object.prototype,
|
|
299
|
-
hasOwn = Op.hasOwnProperty,
|
|
300
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
301
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
302
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
303
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
304
|
-
|
|
305
|
-
function define(obj, key, value) {
|
|
306
|
-
return Object.defineProperty(obj, key, {
|
|
307
|
-
value: value,
|
|
308
|
-
enumerable: !0,
|
|
309
|
-
configurable: !0,
|
|
310
|
-
writable: !0
|
|
311
|
-
}), obj[key];
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
try {
|
|
315
|
-
define({}, "");
|
|
316
|
-
} catch (err) {
|
|
317
|
-
define = function define(obj, key, value) {
|
|
318
|
-
return obj[key] = value;
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
323
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
324
|
-
generator = Object.create(protoGenerator.prototype),
|
|
325
|
-
context = new Context(tryLocsList || []);
|
|
326
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
327
|
-
var state = "suspendedStart";
|
|
328
|
-
return function (method, arg) {
|
|
329
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
330
|
-
|
|
331
|
-
if ("completed" === state) {
|
|
332
|
-
if ("throw" === method) throw arg;
|
|
333
|
-
return doneResult();
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
for (context.method = method, context.arg = arg;;) {
|
|
337
|
-
var delegate = context.delegate;
|
|
338
|
-
|
|
339
|
-
if (delegate) {
|
|
340
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
341
|
-
|
|
342
|
-
if (delegateResult) {
|
|
343
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
344
|
-
return delegateResult;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
349
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
350
|
-
context.dispatchException(context.arg);
|
|
351
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
352
|
-
state = "executing";
|
|
353
|
-
var record = tryCatch(innerFn, self, context);
|
|
354
|
-
|
|
355
|
-
if ("normal" === record.type) {
|
|
356
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
357
|
-
return {
|
|
358
|
-
value: record.arg,
|
|
359
|
-
done: context.done
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
}(innerFn, self, context), generator;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function tryCatch(fn, obj, arg) {
|
|
370
|
-
try {
|
|
371
|
-
return {
|
|
372
|
-
type: "normal",
|
|
373
|
-
arg: fn.call(obj, arg)
|
|
374
|
-
};
|
|
375
|
-
} catch (err) {
|
|
376
|
-
return {
|
|
377
|
-
type: "throw",
|
|
378
|
-
arg: err
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
exports.wrap = wrap;
|
|
384
|
-
var ContinueSentinel = {};
|
|
385
|
-
|
|
386
|
-
function Generator() {}
|
|
387
|
-
|
|
388
|
-
function GeneratorFunction() {}
|
|
389
|
-
|
|
390
|
-
function GeneratorFunctionPrototype() {}
|
|
391
|
-
|
|
392
|
-
var IteratorPrototype = {};
|
|
393
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
394
|
-
return this;
|
|
395
|
-
});
|
|
396
|
-
var getProto = Object.getPrototypeOf,
|
|
397
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
398
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
399
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
400
|
-
|
|
401
|
-
function defineIteratorMethods(prototype) {
|
|
402
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
403
|
-
define(prototype, method, function (arg) {
|
|
404
|
-
return this._invoke(method, arg);
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
410
|
-
function invoke(method, arg, resolve, reject) {
|
|
411
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
412
|
-
|
|
413
|
-
if ("throw" !== record.type) {
|
|
414
|
-
var result = record.arg,
|
|
415
|
-
value = result.value;
|
|
416
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
417
|
-
invoke("next", value, resolve, reject);
|
|
418
|
-
}, function (err) {
|
|
419
|
-
invoke("throw", err, resolve, reject);
|
|
420
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
421
|
-
result.value = unwrapped, resolve(result);
|
|
422
|
-
}, function (error) {
|
|
423
|
-
return invoke("throw", error, resolve, reject);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
reject(record.arg);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
var previousPromise;
|
|
431
|
-
|
|
432
|
-
this._invoke = function (method, arg) {
|
|
433
|
-
function callInvokeWithMethodAndArg() {
|
|
434
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
435
|
-
invoke(method, arg, resolve, reject);
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
444
|
-
var method = delegate.iterator[context.method];
|
|
445
|
-
|
|
446
|
-
if (undefined === method) {
|
|
447
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
448
|
-
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
449
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
return ContinueSentinel;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
456
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
457
|
-
var info = record.arg;
|
|
458
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
function pushTryEntry(locs) {
|
|
462
|
-
var entry = {
|
|
463
|
-
tryLoc: locs[0]
|
|
464
|
-
};
|
|
465
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function resetTryEntry(entry) {
|
|
469
|
-
var record = entry.completion || {};
|
|
470
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
function Context(tryLocsList) {
|
|
474
|
-
this.tryEntries = [{
|
|
475
|
-
tryLoc: "root"
|
|
476
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
function values(iterable) {
|
|
480
|
-
if (iterable) {
|
|
481
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
482
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
483
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
484
|
-
|
|
485
|
-
if (!isNaN(iterable.length)) {
|
|
486
|
-
var i = -1,
|
|
487
|
-
next = function next() {
|
|
488
|
-
for (; ++i < iterable.length;) {
|
|
489
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return next.value = undefined, next.done = !0, next;
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
return next.next = next;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
return {
|
|
500
|
-
next: doneResult
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
function doneResult() {
|
|
505
|
-
return {
|
|
506
|
-
value: undefined,
|
|
507
|
-
done: !0
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
512
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
513
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
514
|
-
}, exports.mark = function (genFun) {
|
|
515
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
516
|
-
}, exports.awrap = function (arg) {
|
|
517
|
-
return {
|
|
518
|
-
__await: arg
|
|
519
|
-
};
|
|
520
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
521
|
-
return this;
|
|
522
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
523
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
524
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
525
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
526
|
-
return result.done ? result.value : iter.next();
|
|
527
|
-
});
|
|
528
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
529
|
-
return this;
|
|
530
|
-
}), define(Gp, "toString", function () {
|
|
531
|
-
return "[object Generator]";
|
|
532
|
-
}), exports.keys = function (object) {
|
|
533
|
-
var keys = [];
|
|
534
|
-
|
|
535
|
-
for (var key in object) {
|
|
536
|
-
keys.push(key);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
return keys.reverse(), function next() {
|
|
540
|
-
for (; keys.length;) {
|
|
541
|
-
var key = keys.pop();
|
|
542
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
return next.done = !0, next;
|
|
546
|
-
};
|
|
547
|
-
}, exports.values = values, Context.prototype = {
|
|
548
|
-
constructor: Context,
|
|
549
|
-
reset: function reset(skipTempReset) {
|
|
550
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
551
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
stop: function stop() {
|
|
555
|
-
this.done = !0;
|
|
556
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
557
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
558
|
-
return this.rval;
|
|
559
|
-
},
|
|
560
|
-
dispatchException: function dispatchException(exception) {
|
|
561
|
-
if (this.done) throw exception;
|
|
562
|
-
var context = this;
|
|
563
|
-
|
|
564
|
-
function handle(loc, caught) {
|
|
565
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
569
|
-
var entry = this.tryEntries[i],
|
|
570
|
-
record = entry.completion;
|
|
571
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
572
|
-
|
|
573
|
-
if (entry.tryLoc <= this.prev) {
|
|
574
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
575
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
576
|
-
|
|
577
|
-
if (hasCatch && hasFinally) {
|
|
578
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
579
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
580
|
-
} else if (hasCatch) {
|
|
581
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
582
|
-
} else {
|
|
583
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
584
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
},
|
|
589
|
-
abrupt: function abrupt(type, arg) {
|
|
590
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
591
|
-
var entry = this.tryEntries[i];
|
|
592
|
-
|
|
593
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
594
|
-
var finallyEntry = entry;
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
600
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
601
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
602
|
-
},
|
|
603
|
-
complete: function complete(record, afterLoc) {
|
|
604
|
-
if ("throw" === record.type) throw record.arg;
|
|
605
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
606
|
-
},
|
|
607
|
-
finish: function finish(finallyLoc) {
|
|
608
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
609
|
-
var entry = this.tryEntries[i];
|
|
610
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
611
|
-
}
|
|
612
|
-
},
|
|
613
|
-
"catch": function _catch(tryLoc) {
|
|
614
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
615
|
-
var entry = this.tryEntries[i];
|
|
616
|
-
|
|
617
|
-
if (entry.tryLoc === tryLoc) {
|
|
618
|
-
var record = entry.completion;
|
|
619
|
-
|
|
620
|
-
if ("throw" === record.type) {
|
|
621
|
-
var thrown = record.arg;
|
|
622
|
-
resetTryEntry(entry);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
return thrown;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
throw new Error("illegal catch attempt");
|
|
630
|
-
},
|
|
631
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
632
|
-
return this.delegate = {
|
|
633
|
-
iterator: values(iterable),
|
|
634
|
-
resultName: resultName,
|
|
635
|
-
nextLoc: nextLoc
|
|
636
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
637
|
-
}
|
|
638
|
-
}, exports;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
642
|
-
} (regeneratorRuntime$1));
|
|
643
|
-
|
|
644
|
-
// TODO(Babel 8): Remove this file.
|
|
645
|
-
|
|
646
|
-
var runtime = regeneratorRuntime$1.exports();
|
|
647
|
-
|
|
648
|
-
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
649
|
-
try {
|
|
650
|
-
regeneratorRuntime = runtime;
|
|
651
|
-
} catch (accidentalStrictMode) {
|
|
652
|
-
if (typeof globalThis === "object") {
|
|
653
|
-
globalThis.regeneratorRuntime = runtime;
|
|
654
|
-
} else {
|
|
655
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
ramda.curry(function (func, event) {
|
|
660
|
-
return func(event.target.value);
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
dayjs__default["default"].extend(relativeTime__default["default"]);
|
|
664
|
-
dayjs__default["default"].extend(updateLocale__default["default"]);
|
|
665
|
-
|
|
666
|
-
var _document$getElements, _document$getElements2;
|
|
667
|
-
window.globalProps = keysToCamelCase(JSON.parse(((_document$getElements = document.getElementsByClassName("root-container")[0]) === null || _document$getElements === void 0 ? void 0 : (_document$getElements2 = _document$getElements.dataset) === null || _document$getElements2 === void 0 ? void 0 : _document$getElements2.reactProps) || "{}"));
|
|
668
|
-
deepFreezeObject(window.globalProps);
|
|
118
|
+
};
|
|
669
119
|
|
|
670
120
|
var setAxiosDefaults = function setAxiosDefaults() {
|
|
671
121
|
axios__default["default"].defaults.baseURL = "/";
|
|
@@ -699,7 +149,7 @@ var handleSuccessResponse = function handleSuccessResponse(response) {
|
|
|
699
149
|
showToastr = _response$config$show === void 0 ? true : _response$config$show;
|
|
700
150
|
|
|
701
151
|
if (response.data) {
|
|
702
|
-
if (transformResponseCase) response.data = keysToCamelCase(response.data);
|
|
152
|
+
if (transformResponseCase) response.data = objects.keysToCamelCase(response.data);
|
|
703
153
|
|
|
704
154
|
if (showToastr && typeof response.data.notice === "string") {
|
|
705
155
|
neetoui.Toastr.success(response.data.notice);
|
|
@@ -755,7 +205,7 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
|
|
|
755
205
|
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
756
206
|
if (Array.isArray(object)) {
|
|
757
207
|
return object.map(serializeKeysToSnakeCase);
|
|
758
|
-
} else if (object === null || _typeof
|
|
208
|
+
} else if (object === null || _typeof(object) !== "object") {
|
|
759
209
|
return object;
|
|
760
210
|
}
|
|
761
211
|
|
|
@@ -765,7 +215,7 @@ var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
|
765
215
|
value = _ref2[1];
|
|
766
216
|
|
|
767
217
|
var val = typeof (value === null || value === void 0 ? void 0 : value.toJSON) === "function" ? value.toJSON() : value;
|
|
768
|
-
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
218
|
+
return [strings.camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
769
219
|
}));
|
|
770
220
|
};
|
|
771
221
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"initializers*.js",
|
|
17
17
|
"react*.js",
|
|
18
|
-
"utils*.js"
|
|
18
|
+
"utils*.js",
|
|
19
|
+
"pure*.js"
|
|
19
20
|
],
|
|
20
21
|
"lint-staged": {
|
|
21
22
|
"**/*.{js,jsx,json}": [
|