@telia-ace/widget-utilities 1.0.0 → 1.0.3

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.
Files changed (113) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +3 -3
  3. package/{lib-esm → dist}/append-class-names.d.ts +0 -0
  4. package/{lib-esm → dist}/batch.d.ts +0 -0
  5. package/{lib-esm → dist}/camilize.d.ts +0 -0
  6. package/{lib-esm → dist}/category-trail.d.ts +0 -0
  7. package/{lib-esm → dist}/create-params.d.ts +0 -0
  8. package/{lib-esm → dist}/data-uri-to-blob.d.ts +0 -0
  9. package/{lib-esm → dist}/debug.d.ts +0 -0
  10. package/{lib-esm → dist}/deep-clone.d.ts +0 -0
  11. package/{lib-esm → dist}/find-and-activate-stored-widgets.d.ts +0 -0
  12. package/{lib-esm → dist}/find-category-by-id.d.ts +0 -0
  13. package/{lib-esm → dist}/format-date.d.ts +0 -0
  14. package/{lib-esm → dist}/format-url.d.ts +0 -0
  15. package/{lib-esm → dist}/get-cookie.d.ts +0 -0
  16. package/{lib-esm → dist}/has-non-empty-categories.d.ts +0 -0
  17. package/{lib-esm → dist}/hash.d.ts +0 -0
  18. package/{lib-esm → dist}/html-parent-contains.d.ts +0 -0
  19. package/{lib-esm → dist}/index.d.ts +0 -0
  20. package/dist/index.js +802 -0
  21. package/dist/index.js.map +1 -0
  22. package/{lib-esm → dist}/is-anchor-link.d.ts +0 -0
  23. package/{lib-esm → dist}/kebab-case.d.ts +0 -0
  24. package/{lib-esm → dist}/lock.d.ts +0 -0
  25. package/{lib-esm → dist}/merge-deep.d.ts +0 -0
  26. package/{lib-esm → dist}/notify-data-loaded.d.ts +0 -0
  27. package/{lib-esm → dist}/remove-null-and-undefined-values.d.ts +0 -0
  28. package/{lib-esm → dist}/set-cookie.d.ts +0 -0
  29. package/{lib-esm → dist}/shallow-compare.d.ts +0 -0
  30. package/{lib-esm → dist}/uuid.d.ts +0 -0
  31. package/{lib-esm → dist}/wait-for.d.ts +0 -0
  32. package/package.json +36 -35
  33. package/lib/append-class-names.d.ts +0 -6
  34. package/lib/append-class-names.js +0 -84
  35. package/lib/batch.d.ts +0 -4
  36. package/lib/batch.js +0 -38
  37. package/lib/camilize.d.ts +0 -1
  38. package/lib/camilize.js +0 -29
  39. package/lib/category-trail.d.ts +0 -14
  40. package/lib/category-trail.js +0 -96
  41. package/lib/create-params.d.ts +0 -21
  42. package/lib/create-params.js +0 -108
  43. package/lib/data-uri-to-blob.d.ts +0 -2
  44. package/lib/data-uri-to-blob.js +0 -20
  45. package/lib/debug.d.ts +0 -52
  46. package/lib/debug.js +0 -155
  47. package/lib/deep-clone.d.ts +0 -2
  48. package/lib/deep-clone.js +0 -21
  49. package/lib/find-and-activate-stored-widgets.d.ts +0 -9
  50. package/lib/find-and-activate-stored-widgets.js +0 -27
  51. package/lib/find-category-by-id.d.ts +0 -6
  52. package/lib/find-category-by-id.js +0 -89
  53. package/lib/format-date.d.ts +0 -2
  54. package/lib/format-date.js +0 -23
  55. package/lib/format-url.d.ts +0 -2
  56. package/lib/format-url.js +0 -111
  57. package/lib/get-cookie.d.ts +0 -1
  58. package/lib/get-cookie.js +0 -18
  59. package/lib/has-non-empty-categories.d.ts +0 -2
  60. package/lib/has-non-empty-categories.js +0 -23
  61. package/lib/hash.d.ts +0 -1
  62. package/lib/hash.js +0 -16
  63. package/lib/html-parent-contains.d.ts +0 -7
  64. package/lib/html-parent-contains.js +0 -21
  65. package/lib/index.d.ts +0 -27
  66. package/lib/index.js +0 -57
  67. package/lib/is-anchor-link.d.ts +0 -2
  68. package/lib/is-anchor-link.js +0 -9
  69. package/lib/kebab-case.d.ts +0 -1
  70. package/lib/kebab-case.js +0 -9
  71. package/lib/lock.d.ts +0 -9
  72. package/lib/lock.js +0 -78
  73. package/lib/merge-deep.d.ts +0 -7
  74. package/lib/merge-deep.js +0 -72
  75. package/lib/notify-data-loaded.d.ts +0 -6
  76. package/lib/notify-data-loaded.js +0 -96
  77. package/lib/remove-null-and-undefined-values.d.ts +0 -6
  78. package/lib/remove-null-and-undefined-values.js +0 -12
  79. package/lib/set-cookie.d.ts +0 -1
  80. package/lib/set-cookie.js +0 -12
  81. package/lib/shallow-compare.d.ts +0 -6
  82. package/lib/shallow-compare.js +0 -25
  83. package/lib/uuid.d.ts +0 -1
  84. package/lib/uuid.js +0 -12
  85. package/lib/wait-for.d.ts +0 -20
  86. package/lib/wait-for.js +0 -52
  87. package/lib-esm/append-class-names.js +0 -77
  88. package/lib-esm/batch.js +0 -36
  89. package/lib-esm/camilize.js +0 -26
  90. package/lib-esm/category-trail.js +0 -87
  91. package/lib-esm/create-params.js +0 -105
  92. package/lib-esm/data-uri-to-blob.js +0 -18
  93. package/lib-esm/debug.js +0 -151
  94. package/lib-esm/deep-clone.js +0 -19
  95. package/lib-esm/find-and-activate-stored-widgets.js +0 -25
  96. package/lib-esm/find-category-by-id.js +0 -87
  97. package/lib-esm/format-date.js +0 -21
  98. package/lib-esm/format-url.js +0 -109
  99. package/lib-esm/get-cookie.js +0 -15
  100. package/lib-esm/has-non-empty-categories.js +0 -18
  101. package/lib-esm/hash.js +0 -13
  102. package/lib-esm/html-parent-contains.js +0 -19
  103. package/lib-esm/index.js +0 -24
  104. package/lib-esm/is-anchor-link.js +0 -7
  105. package/lib-esm/kebab-case.js +0 -6
  106. package/lib-esm/lock.js +0 -75
  107. package/lib-esm/merge-deep.js +0 -67
  108. package/lib-esm/notify-data-loaded.js +0 -94
  109. package/lib-esm/remove-null-and-undefined-values.js +0 -10
  110. package/lib-esm/set-cookie.js +0 -9
  111. package/lib-esm/shallow-compare.js +0 -23
  112. package/lib-esm/uuid.js +0 -9
  113. package/lib-esm/wait-for.js +0 -50
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- function createParams(args) {
15
- if (args === void 0) { args = {}; }
16
- var _a = args.phrase, phrase = _a === void 0 ? '' : _a, category = args.category, guideCategory = args.guideCategory, contactCategory = args.contactCategory, take = args.take, connectionKey = args.connectionKey, accordion = args.accordion, id = args.id, uriName = args.uriName, sorting = args.sorting, tag = args.tag, tagId = args.tagId, tagTitle = args.tagTitle, other = __rest(args, ["phrase", "category", "guideCategory", "contactCategory", "take", "connectionKey", "accordion", "id", "uriName", "sorting", "tag", "tagId", "tagTitle"]);
17
- var params = {};
18
- Object.keys(other).forEach(function (k) {
19
- if (typeof args[k] === 'string') {
20
- params[k] = args[k];
21
- }
22
- });
23
- if (typeof phrase === 'string' && phrase.length) {
24
- params.phrase = phrase;
25
- }
26
- if (phrase === null) {
27
- params.phrase = phrase;
28
- }
29
- if (typeof guideCategory === 'string' && guideCategory !== '0') {
30
- params.guideCategory = guideCategory;
31
- }
32
- if (typeof guideCategory === 'number' && guideCategory !== 0) {
33
- params.guideCategory = guideCategory;
34
- }
35
- if (typeof guideCategory === 'object' && guideCategory !== null) {
36
- if (typeof guideCategory.id === 'string' && guideCategory.id !== '0') {
37
- params.guideCategory = guideCategory.id;
38
- }
39
- if (typeof guideCategory.id === 'number' && guideCategory.id !== 0) {
40
- params.guideCategory = guideCategory.id;
41
- }
42
- }
43
- if (typeof contactCategory === 'string' && contactCategory !== '0') {
44
- params.contactCategory = contactCategory;
45
- }
46
- if (typeof contactCategory === 'number' && contactCategory !== 0) {
47
- params.contactCategory = contactCategory;
48
- }
49
- if (typeof contactCategory === 'object' && contactCategory !== null) {
50
- if (typeof contactCategory.id === 'string' && contactCategory.id !== '0') {
51
- params.contactCategory = contactCategory.id;
52
- }
53
- if (typeof contactCategory.id === 'number' && contactCategory.id !== 0) {
54
- params.contactCategory = contactCategory.id;
55
- }
56
- }
57
- if (typeof category === 'string' && category !== '0') {
58
- params.category = category;
59
- }
60
- if (typeof category === 'number' && category !== 0) {
61
- params.category = category;
62
- }
63
- if (typeof category === 'object' && category !== null) {
64
- if (typeof category.id === 'string' && category.id !== '0') {
65
- params.category = category.id;
66
- }
67
- if (typeof category.id === 'number' && category.id !== 0) {
68
- params.category = category.id;
69
- }
70
- }
71
- if (id) {
72
- params.id = id;
73
- }
74
- if (uriName &&
75
- (!!+params.category ||
76
- !!+params.guideCategory ||
77
- !!+params.guide ||
78
- !!+params.contactCategory ||
79
- !!+params.contactMethod)) {
80
- params.uriName = uriName;
81
- }
82
- if (connectionKey) {
83
- params.connectionKey = connectionKey;
84
- }
85
- if (take) {
86
- params.take = take;
87
- }
88
- if (sorting) {
89
- params.sorting = sorting;
90
- }
91
- if (typeof accordion === 'string' && accordion.length > 0) {
92
- params.accordion = accordion;
93
- }
94
- if (typeof tag === 'string' && tag !== '0') {
95
- params.tag = tag;
96
- }
97
- if (typeof tag === 'number' && tag !== 0) {
98
- params.tag = tag;
99
- }
100
- if (typeof tagId === 'string' || typeof tagId === 'number') {
101
- params.tagId = tagId;
102
- }
103
- if (typeof tagTitle === 'string') {
104
- params.tagTitle = tagTitle;
105
- }
106
- return params;
107
- }
108
- exports.default = createParams;
@@ -1,2 +0,0 @@
1
- declare const dataURItoBlob: (dataURI: string) => Blob;
2
- export default dataURItoBlob;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var dataURItoBlob = function (dataURI) {
4
- var byteString;
5
- var mimestring;
6
- if (dataURI.split(',')[0].indexOf('base64') !== -1) {
7
- byteString = atob(dataURI.split(',')[1]);
8
- }
9
- else {
10
- byteString = decodeURI(dataURI.split(',')[1]);
11
- }
12
- mimestring = dataURI.split(',')[0].split(':')[1].split(';')[0];
13
- var content = [];
14
- for (var i = 0; i < byteString.length; i++) {
15
- // tslint:disable-line no-increment-decrement
16
- content[i] = byteString.charCodeAt(i);
17
- }
18
- return new Blob([new Uint8Array(content)], { type: mimestring });
19
- };
20
- exports.default = dataURItoBlob;
package/lib/debug.d.ts DELETED
@@ -1,52 +0,0 @@
1
- /**
2
- * Checks if process.env.NODE_ENV === 'production'
3
- * and passes arguments to console.warn().
4
- */
5
- export declare function debugLog(...args: any[]): false | void;
6
- /**
7
- * Simple internal log-handler
8
- */
9
- export declare class Logger {
10
- private keys;
11
- private lookup;
12
- /**
13
- * Passes args to console.log
14
- */
15
- static log: (...args: any[]) => void;
16
- /**
17
- * Passes args to console.warn
18
- */
19
- static warn: (...args: any[]) => void;
20
- /**
21
- * Passes args to console.error
22
- */
23
- static error: (...args: any[]) => void;
24
- /**
25
- * Passes args to console.info
26
- */
27
- static info: (...args: any[]) => void;
28
- /**
29
- * Checks if key already has been logged.
30
- * If not, passes following args to console.log
31
- * and stores key in logged messages.
32
- */
33
- log: (key: string, ...args: any[]) => void;
34
- /**
35
- * Checks if key already has been logged.
36
- * If not, passes following args to console.warn
37
- * and stores key in logged messages.
38
- */
39
- warn: (key: string, ...args: any[]) => void;
40
- /**
41
- * Checks if key already has been logged.
42
- * If not, passes following args to console.error
43
- * and stores key in logged messages.
44
- */
45
- error: (key: string, ...args: any[]) => void;
46
- /**
47
- * Checks if key already has been logged.
48
- * If not, passes following args to console.info
49
- * and stores key in logged messages.
50
- */
51
- info: (key: string, ...args: any[]) => void;
52
- }
package/lib/debug.js DELETED
@@ -1,155 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
- if (ar || !(i in from)) {
21
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
- ar[i] = from[i];
23
- }
24
- }
25
- return to.concat(ar || Array.prototype.slice.call(from));
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.Logger = exports.debugLog = void 0;
29
- /**
30
- * Checks if process.env.NODE_ENV === 'production'
31
- * and passes arguments to console.warn().
32
- */
33
- function debugLog() {
34
- var args = [];
35
- for (var _i = 0; _i < arguments.length; _i++) {
36
- args[_i] = arguments[_i];
37
- }
38
- return process.env.NODE_ENV !== 'production' && console && console.warn.apply(console, __spreadArray([], __read(args), false));
39
- }
40
- exports.debugLog = debugLog;
41
- var print = function (print, msgOrObj) {
42
- var args = [];
43
- for (var _i = 2; _i < arguments.length; _i++) {
44
- args[_i - 2] = arguments[_i];
45
- }
46
- if (typeof msgOrObj === 'string') {
47
- return print.apply(void 0, __spreadArray(["[humany] ".concat(msgOrObj)], __read(args), false));
48
- }
49
- return print.apply(void 0, __spreadArray([msgOrObj], __read(args), false));
50
- };
51
- /**
52
- * Simple internal log-handler
53
- */
54
- var Logger = /** @class */ (function () {
55
- function Logger() {
56
- var _this = this;
57
- this.keys = [];
58
- /**
59
- * Checks if key already has been logged.
60
- * If not, passes following args to console.log
61
- * and stores key in logged messages.
62
- */
63
- this.log = function (key) {
64
- var args = [];
65
- for (var _i = 1; _i < arguments.length; _i++) {
66
- args[_i - 1] = arguments[_i];
67
- }
68
- return _this.lookup(key, function () { return Logger.log.apply(Logger, __spreadArray([], __read(args), false)); });
69
- };
70
- /**
71
- * Checks if key already has been logged.
72
- * If not, passes following args to console.warn
73
- * and stores key in logged messages.
74
- */
75
- this.warn = function (key) {
76
- var args = [];
77
- for (var _i = 1; _i < arguments.length; _i++) {
78
- args[_i - 1] = arguments[_i];
79
- }
80
- return _this.lookup(key, function () { return Logger.warn.apply(Logger, __spreadArray([], __read(args), false)); });
81
- };
82
- /**
83
- * Checks if key already has been logged.
84
- * If not, passes following args to console.error
85
- * and stores key in logged messages.
86
- */
87
- this.error = function (key) {
88
- var args = [];
89
- for (var _i = 1; _i < arguments.length; _i++) {
90
- args[_i - 1] = arguments[_i];
91
- }
92
- return _this.lookup(key, function () { return Logger.error.apply(Logger, __spreadArray([], __read(args), false)); });
93
- };
94
- /**
95
- * Checks if key already has been logged.
96
- * If not, passes following args to console.info
97
- * and stores key in logged messages.
98
- */
99
- this.info = function (key) {
100
- var args = [];
101
- for (var _i = 1; _i < arguments.length; _i++) {
102
- args[_i - 1] = arguments[_i];
103
- }
104
- return _this.lookup(key, function () { return Logger.info.apply(Logger, __spreadArray([], __read(args), false)); });
105
- };
106
- }
107
- Logger.prototype.lookup = function (key, fn) {
108
- if (this.keys.indexOf(key) === -1) {
109
- this.keys.push(key);
110
- fn();
111
- }
112
- };
113
- /**
114
- * Passes args to console.log
115
- */
116
- Logger.log = function () {
117
- var args = [];
118
- for (var _i = 0; _i < arguments.length; _i++) {
119
- args[_i] = arguments[_i];
120
- }
121
- return print.apply(void 0, __spreadArray([console.log], __read(args), false));
122
- };
123
- /**
124
- * Passes args to console.warn
125
- */
126
- Logger.warn = function () {
127
- var args = [];
128
- for (var _i = 0; _i < arguments.length; _i++) {
129
- args[_i] = arguments[_i];
130
- }
131
- return print.apply(void 0, __spreadArray([console.warn], __read(args), false));
132
- };
133
- /**
134
- * Passes args to console.error
135
- */
136
- Logger.error = function () {
137
- var args = [];
138
- for (var _i = 0; _i < arguments.length; _i++) {
139
- args[_i] = arguments[_i];
140
- }
141
- return print.apply(void 0, __spreadArray([console.error], __read(args), false));
142
- };
143
- /**
144
- * Passes args to console.info
145
- */
146
- Logger.info = function () {
147
- var args = [];
148
- for (var _i = 0; _i < arguments.length; _i++) {
149
- args[_i] = arguments[_i];
150
- }
151
- return print.apply(void 0, __spreadArray([console.info], __read(args), false));
152
- };
153
- return Logger;
154
- }());
155
- exports.Logger = Logger;
@@ -1,2 +0,0 @@
1
- declare const deepClone: <Type>(data: Type) => Type;
2
- export default deepClone;
package/lib/deep-clone.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // todo: consolidate with merge in component platform
4
- var deepClone = function (data) {
5
- var out = {};
6
- var value;
7
- var key;
8
- // If it's not an object return the original data
9
- if (typeof data !== 'object' || data === null) {
10
- return data;
11
- }
12
- // Create array if data is array, otherwise create an object
13
- out = Array.isArray(data) ? [] : {};
14
- for (key in data) {
15
- value = data[key];
16
- // Copy nested objects and arrays recursively
17
- out[key] = typeof value === 'object' && value !== null ? deepClone(value) : value;
18
- }
19
- return out;
20
- };
21
- exports.default = deepClone;
@@ -1,9 +0,0 @@
1
- declare const _default: (implementation: any) => null | undefined;
2
- /**
3
- * Looks for stored widgets on the implementation in localStorage
4
- * and adds a trigger link to the DOM.
5
- *
6
- * TODO: A more robust version have been discussed, where the storageService is added to the
7
- * implementation instead of the widget.
8
- */
9
- export default _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var _1 = require(".");
4
- /**
5
- * Looks for stored widgets on the implementation in localStorage
6
- * and adds a trigger link to the DOM.
7
- *
8
- * TODO: A more robust version have been discussed, where the storageService is added to the
9
- * implementation instead of the widget.
10
- */
11
- exports.default = (function (implementation) {
12
- if (!implementation) {
13
- return null;
14
- }
15
- var implementationStorage = localStorage.getItem("humany_".concat((0, _1.hash)(implementation.tenant + implementation.name)));
16
- if (implementationStorage) {
17
- var activeStickyWidget = JSON.parse(implementationStorage).activeStickyWidget;
18
- if (activeStickyWidget && activeStickyWidget.value) {
19
- var widget = implementation.widgets.get(activeStickyWidget.value);
20
- if (widget) {
21
- var el = document.createElement('a');
22
- el.setAttribute('href', "//".concat(implementation.bindings[0], "/").concat(activeStickyWidget.value));
23
- document.body.appendChild(el);
24
- }
25
- }
26
- }
27
- });
@@ -1,6 +0,0 @@
1
- /**
2
- * Find a category by it's ID
3
- * @param id Id of category to find
4
- */
5
- declare const findCategoryById: (id: string, categories: any) => any;
6
- export default findCategoryById;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __generator = (this && this.__generator) || function (thisArg, body) {
3
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
5
- function verb(n) { return function (v) { return step([n, v]); }; }
6
- function step(op) {
7
- if (f) throw new TypeError("Generator is already executing.");
8
- while (_) try {
9
- 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;
10
- if (y = 0, t) op = [op[0] & 2, t.value];
11
- switch (op[0]) {
12
- case 0: case 1: t = op; break;
13
- case 4: _.label++; return { value: op[1], done: false };
14
- case 5: _.label++; y = op[1]; op = [0]; continue;
15
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
16
- default:
17
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
18
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
19
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
20
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
21
- if (t[2]) _.ops.pop();
22
- _.trys.pop(); continue;
23
- }
24
- op = body.call(thisArg, _);
25
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
26
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
27
- }
28
- };
29
- var __values = (this && this.__values) || function(o) {
30
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
31
- if (m) return m.call(o);
32
- if (o && typeof o.length === "number") return {
33
- next: function () {
34
- if (o && i >= o.length) o = void 0;
35
- return { value: o && o[i++], done: !o };
36
- }
37
- };
38
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- /**
42
- * Recursively find items
43
- * @param data Data to look in
44
- */
45
- function processData(data) {
46
- var i, val;
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0:
50
- if (!data) {
51
- return [2 /*return*/];
52
- }
53
- i = 0;
54
- _a.label = 1;
55
- case 1:
56
- if (!(i < data.length)) return [3 /*break*/, 5];
57
- val = data[i];
58
- return [4 /*yield*/, val];
59
- case 2:
60
- _a.sent();
61
- if (!val.items) return [3 /*break*/, 4];
62
- return [5 /*yield**/, __values(processData(val.items))];
63
- case 3:
64
- _a.sent();
65
- _a.label = 4;
66
- case 4:
67
- i++;
68
- return [3 /*break*/, 1];
69
- case 5: return [2 /*return*/];
70
- }
71
- });
72
- }
73
- /**
74
- * Find a category by it's ID
75
- * @param id Id of category to find
76
- */
77
- var findCategoryById = function (id, categories) {
78
- var it = processData(categories);
79
- var res = it.next();
80
- var found = null;
81
- while (!res.done) {
82
- if (res.value.id === id) {
83
- found = res.value;
84
- }
85
- res = it.next();
86
- }
87
- return found;
88
- };
89
- exports.default = findCategoryById;
@@ -1,2 +0,0 @@
1
- declare const _default: (date: any, includeTime?: boolean) => string;
2
- export default _default;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (function (date, includeTime) {
4
- if (includeTime === void 0) { includeTime = false; }
5
- var d = new Date(date);
6
- var month = "".concat(d.getMonth() + 1);
7
- var day = "".concat(d.getDate());
8
- var year = d.getFullYear();
9
- if (month.length < 2)
10
- month = "0".concat(month);
11
- if (day.length < 2)
12
- day = "0".concat(day);
13
- if (includeTime) {
14
- var hours = "".concat(d.getHours());
15
- var minutes = "".concat(d.getMinutes());
16
- if (hours.length < 2)
17
- hours = "0".concat(hours);
18
- if (minutes.length < 2)
19
- minutes = "0".concat(minutes);
20
- return "".concat([year, month, day].join('-'), " ").concat([hours, minutes].join(':'));
21
- }
22
- return [year, month, day].join('-');
23
- });
@@ -1,2 +0,0 @@
1
- declare const formatUrl: (url: string) => string;
2
- export default formatUrl;
package/lib/format-url.js DELETED
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var formatUrl = function (url) {
4
- if (!url) {
5
- return '';
6
- }
7
- var replacements = [
8
- { from: /[äæǽ]+/gi, to: 'ae' },
9
- { from: /[öœ]+/gi, to: 'oe' },
10
- { from: /[ü]+/gi, to: 'ue' },
11
- { from: /[Ä]+/gi, to: 'Ae' },
12
- { from: /[Ü]+/gi, to: 'Ue' },
13
- { from: /[Ö]+/gi, to: 'Oe' },
14
- { from: /[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi, to: 'A' },
15
- { from: /[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi, to: 'a' },
16
- { from: /[Б]+/gi, to: 'B' },
17
- { from: /[б]+/gi, to: 'b' },
18
- { from: /[ÇĆĈĊČ]+/gi, to: 'C' },
19
- { from: /[çćĉċč]+/gi, to: 'c' },
20
- { from: /[Д]+/gi, to: 'D' },
21
- { from: /[д]+/gi, to: 'd' },
22
- { from: /[ÐĎĐΔ]+/gi, to: 'Dj' },
23
- { from: /[ðďđδ]+/gi, to: 'dj' },
24
- { from: /[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi, to: 'E' },
25
- { from: /[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi, to: 'e' },
26
- { from: /[Ф]+/gi, to: 'F' },
27
- { from: /[ф]+/gi, to: 'f' },
28
- { from: /[ĜĞĠĢΓГҐ]+/gi, to: 'G' },
29
- { from: /[ĝğġģγгґ]+/gi, to: 'g' },
30
- { from: /[ĤĦ]+/gi, to: 'H' },
31
- { from: /[ĥħ]+/gi, to: 'h' },
32
- { from: /[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi, to: 'I' },
33
- { from: /[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi, to: 'i' },
34
- { from: /[Ĵ]+/gi, to: 'J' },
35
- { from: /[ĵ]+/gi, to: 'j' },
36
- { from: /[ĶΚК]+/gi, to: 'K' },
37
- { from: /[ķκк]+/gi, to: 'k' },
38
- { from: /[ĹĻĽĿŁΛЛ]+/gi, to: 'L' },
39
- { from: /[ĺļľŀłλл]+/gi, to: 'l' },
40
- { from: /[М]+/gi, to: 'M' },
41
- { from: /[м]+/gi, to: 'm' },
42
- { from: /[ÑŃŅŇΝН]+/gi, to: 'N' },
43
- { from: /[ñńņňʼnνн]+/gi, to: 'n' },
44
- { from: /[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi, to: 'O' },
45
- { from: /[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi, to: 'o' },
46
- { from: /[П]+/gi, to: 'P' },
47
- { from: /[п]+/gi, to: 'p' },
48
- { from: /[ŔŖŘΡР]+/gi, to: 'R' },
49
- { from: /[ŕŗřρр]+/gi, to: 'r' },
50
- { from: /[ŚŜŞȘŠΣС]+/gi, to: 'S' },
51
- { from: /[śŝşșšſσςс]+/gi, to: 's' },
52
- { from: /[ȚŢŤŦτТ]+/gi, to: 'T' },
53
- { from: /[țţťŧт]+/gi, to: 't' },
54
- { from: /[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi, to: 'U' },
55
- { from: /[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi, to: 'u' },
56
- { from: /[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi, to: 'Y' },
57
- { from: /[ýÿŷỳỹỷỵй]+/gi, to: 'y' },
58
- { from: /[В]+/gi, to: 'V' },
59
- { from: /[в]+/gi, to: 'v' },
60
- { from: /[Ŵ]+/gi, to: 'W' },
61
- { from: /[ŵ]+/gi, to: 'w' },
62
- { from: /[ŹŻŽΖЗ]+/gi, to: 'Z' },
63
- { from: /[źżžζз]+/gi, to: 'z' },
64
- { from: /[ÆǼ]+/gi, to: 'AE' },
65
- { from: /[ß]+/gi, to: 'ss' },
66
- { from: /[IJ]+/gi, to: 'IJ' },
67
- { from: /[ij]+/gi, to: 'ij' },
68
- { from: /[Œ]+/gi, to: 'OE' },
69
- { from: /[ƒ]+/gi, to: 'f' },
70
- { from: /[ξ]+/gi, to: 'ks' },
71
- { from: /[π]+/gi, to: 'p' },
72
- { from: /[β]+/gi, to: 'v' },
73
- { from: /[μ]+/gi, to: 'm' },
74
- { from: /[ψ]+/gi, to: 'ps' },
75
- { from: /[Ё]+/gi, to: 'Yo' },
76
- { from: /[ё]+/gi, to: 'yo' },
77
- { from: /[Є]+/gi, to: 'Ye' },
78
- { from: /[є]+/gi, to: 'ye' },
79
- { from: /[Ї]+/gi, to: 'Yi' },
80
- { from: /[Ж]+/gi, to: 'Zh' },
81
- { from: /[ж]+/gi, to: 'zh' },
82
- { from: /[Х]+/gi, to: 'Kh' },
83
- { from: /[х]+/gi, to: 'kh' },
84
- { from: /[Ц]+/gi, to: 'Ts' },
85
- { from: /[ц]+/gi, to: 'ts' },
86
- { from: /[Ч]+/gi, to: 'Ch' },
87
- { from: /[ч]+/gi, to: 'ch' },
88
- { from: /[Ш]+/gi, to: 'Sh' },
89
- { from: /[ш]+/gi, to: 'sh' },
90
- { from: /[Щ]+/gi, to: 'Shch' },
91
- { from: /[щ]+/gi, to: 'shch' },
92
- { from: /[ЪъЬь]+/gi, to: '' },
93
- { from: /[Ю]+/gi, to: 'Yu' },
94
- { from: /[ю]+/gi, to: 'yu' },
95
- { from: /[Я]+/gi, to: 'Ya' },
96
- { from: /[я]+/gi, to: 'ya' },
97
- ];
98
- var alphanumericExpression = /[^a-zA-Z0-9]+/g;
99
- var trailingDashExpression = /[-]$/;
100
- var parsed = url;
101
- for (var i in replacements) {
102
- if (replacements.hasOwnProperty(i) && replacements[i].from.test(url)) {
103
- parsed = parsed.replace(replacements[i].from, replacements[i].to);
104
- }
105
- }
106
- parsed = parsed.replace(alphanumericExpression, '-');
107
- parsed = parsed.replace(trailingDashExpression, '');
108
- parsed = parsed.toLowerCase();
109
- return parsed || 'humany';
110
- };
111
- exports.default = formatUrl;
@@ -1 +0,0 @@
1
- export default function getCookie(cookieName: string): string | null;
package/lib/get-cookie.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function getCookie(cookieName) {
4
- var documentCookie = document.cookie;
5
- if (documentCookie.length > 0) {
6
- var start = documentCookie.indexOf("".concat(cookieName, "="));
7
- if (start !== -1) {
8
- start = start + cookieName.length + 1;
9
- var end = documentCookie.indexOf(';', start);
10
- if (end === -1) {
11
- end = documentCookie.length;
12
- }
13
- return unescape(documentCookie.substring(start, end));
14
- }
15
- }
16
- return null;
17
- }
18
- exports.default = getCookie;
@@ -1,2 +0,0 @@
1
- export declare function checkForEmptyCategories(items: any[], v?: boolean): boolean;
2
- export default function hasNonEmptyCategories(items: any[], v?: boolean): boolean;