intelicoreact 1.3.21 → 1.3.22

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 (252) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +15 -23
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +15 -23
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +69 -124
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +27 -36
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +23 -39
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +110 -246
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +44 -85
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +246 -414
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +5 -9
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +93 -165
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +39 -64
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +51 -132
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +34 -73
  14. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +54 -75
  15. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +67 -110
  16. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +33 -83
  17. package/dist/Atomic/FormElements/Input/Input.js +161 -253
  18. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +48 -102
  19. package/dist/Atomic/FormElements/InputColor/InputColor.js +27 -40
  20. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +28 -58
  21. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +108 -176
  22. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +32 -57
  23. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +184 -302
  24. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +85 -157
  25. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +11 -16
  26. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +76 -193
  27. package/dist/Atomic/FormElements/InputLink/InputLink.js +34 -58
  28. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +8 -12
  29. package/dist/Atomic/FormElements/InputMask/InputMask.js +554 -964
  30. package/dist/Atomic/FormElements/InputMask/config.js +1 -1
  31. package/dist/Atomic/FormElements/InputMask/functions.js +17 -43
  32. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +268 -404
  33. package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
  34. package/dist/Atomic/FormElements/InputMask2/functions.js +17 -43
  35. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +300 -460
  36. package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
  37. package/dist/Atomic/FormElements/InputMask3/functions.js +17 -43
  38. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +53 -113
  39. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +64 -118
  40. package/dist/Atomic/FormElements/Label/Label.js +13 -23
  41. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +217 -349
  42. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +25 -47
  43. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +133 -207
  44. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +29 -61
  45. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +20 -42
  46. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +22 -33
  47. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +20 -43
  48. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +54 -101
  49. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +59 -102
  50. package/dist/Atomic/FormElements/RangeList/RangeList.js +89 -150
  51. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +23 -29
  52. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +135 -300
  53. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +381 -571
  54. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +14 -24
  55. package/dist/Atomic/FormElements/Switcher/Switcher.js +24 -29
  56. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +25 -47
  57. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +20 -32
  58. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +32 -55
  59. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +22 -42
  60. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +23 -33
  61. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +51 -120
  62. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
  63. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +23 -46
  64. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +260 -413
  65. package/dist/Atomic/FormElements/Text/Text.js +47 -53
  66. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +21 -31
  67. package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -27
  68. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +68 -128
  69. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +25 -36
  70. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +33 -70
  71. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +58 -124
  72. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +48 -80
  73. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +32 -42
  74. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +40 -60
  75. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -3
  76. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +50 -69
  77. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  78. package/dist/Atomic/Layout/Header/Header.js +21 -48
  79. package/dist/Atomic/Layout/MainMenu/MainMenu.js +36 -79
  80. package/dist/Atomic/Layout/Spinner/Spinner.js +8 -14
  81. package/dist/Atomic/UI/Accordion/Accordion.js +18 -48
  82. package/dist/Atomic/UI/Accordion/AccordionItem.js +35 -60
  83. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +49 -106
  84. package/dist/Atomic/UI/AccordionText/AccordionText.js +13 -37
  85. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +48 -94
  86. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +22 -50
  87. package/dist/Atomic/UI/Alert/Alert.js +20 -44
  88. package/dist/Atomic/UI/Arrow/Arrow.js +15 -35
  89. package/dist/Atomic/UI/Box/Box.js +14 -21
  90. package/dist/Atomic/UI/Button/Button.js +26 -35
  91. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +22 -31
  92. package/dist/Atomic/UI/Chart/Chart.js +45 -86
  93. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +14 -24
  94. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +13 -22
  95. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +68 -113
  96. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +158 -140
  97. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +26 -42
  98. package/dist/Atomic/UI/Chart/partial/utils.js +20 -48
  99. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +22 -42
  100. package/dist/Atomic/UI/DateTime/DateTime.js +23 -38
  101. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +12 -36
  102. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +5 -21
  103. package/dist/Atomic/UI/DoubleString/DoubleString.js +27 -50
  104. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +15 -63
  105. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +62 -157
  106. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +47 -110
  107. package/dist/Atomic/UI/Hint/Hint.js +49 -94
  108. package/dist/Atomic/UI/Modal/Modal.js +149 -179
  109. package/dist/Atomic/UI/Modal/ModalHOC.js +12 -21
  110. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -12
  111. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +17 -21
  112. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +98 -160
  113. package/dist/Atomic/UI/ModalBackup/Modal.js +65 -90
  114. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +12 -21
  115. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +6 -11
  116. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +15 -19
  117. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +32 -62
  118. package/dist/Atomic/UI/NavLine/NavLine.js +120 -211
  119. package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
  120. package/dist/Atomic/UI/PageTitle/PageTitle.js +13 -17
  121. package/dist/Atomic/UI/PieChart/PieChart.js +11 -21
  122. package/dist/Atomic/UI/Price/Price.js +10 -13
  123. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -11
  124. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +27 -56
  125. package/dist/Atomic/UI/Status/Status.js +19 -30
  126. package/dist/Atomic/UI/Table/Partials/TdCell.js +28 -71
  127. package/dist/Atomic/UI/Table/Partials/TdHeader.js +7 -16
  128. package/dist/Atomic/UI/Table/Partials/TdRow.js +29 -65
  129. package/dist/Atomic/UI/Table/Partials/TdTitle.js +16 -40
  130. package/dist/Atomic/UI/Table/Table.js +27 -47
  131. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -48
  132. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -19
  133. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +5 -8
  134. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +25 -47
  135. package/dist/Atomic/UI/Tag/Tag.js +20 -48
  136. package/dist/Atomic/UI/TagList/TagList.js +80 -150
  137. package/dist/Atomic/UI/UserBox/UserBox.js +14 -26
  138. package/dist/Classes/AbortableFetch.js +283 -422
  139. package/dist/Classes/AnimatedHandler.js +44 -56
  140. package/dist/Classes/RESTAPI/index.js +154 -433
  141. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +290 -428
  142. package/dist/Classes/RESTAPI/partials/ApiBase.js +24 -67
  143. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +57 -275
  144. package/dist/Classes/RESTAPI/partials/ApiUtils.js +146 -377
  145. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +155 -403
  146. package/dist/Classes/RESTAPI/partials/Utils.js +81 -135
  147. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
  148. package/dist/Classes/RESTAPI/partials/_utils.js +101 -395
  149. package/dist/Constants/index.constants.js +8 -15
  150. package/dist/Functions/Portal.js +14 -33
  151. package/dist/Functions/customEventListener.js +5 -20
  152. package/dist/Functions/fieldValueFormatters.js +148 -211
  153. package/dist/Functions/hooks/useFormFieldsChangesManager.js +75 -137
  154. package/dist/Functions/locale/createTranslator.js +13 -27
  155. package/dist/Functions/operations.js +35 -49
  156. package/dist/Functions/presets/inputMaskPresets.js +25 -27
  157. package/dist/Functions/presets/inputPresets.js +19 -22
  158. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
  159. package/dist/Functions/schemas.js +6 -15
  160. package/dist/Functions/useClickOutside.js +3 -7
  161. package/dist/Functions/useDebounce.js +11 -25
  162. package/dist/Functions/useFieldFocus.js +42 -67
  163. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +35 -54
  164. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +74 -95
  165. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +55 -91
  166. package/dist/Functions/useFormTools/functions/General.js +80 -99
  167. package/dist/Functions/useFormTools/functions/RenderFields.js +45 -72
  168. package/dist/Functions/useFormTools/functions/usePrevious.js +3 -7
  169. package/dist/Functions/useFormTools/index.js +382 -598
  170. package/dist/Functions/useInputHighlightError.js +27 -52
  171. package/dist/Functions/useIsMobile.js +13 -36
  172. package/dist/Functions/useLocalStorage.js +7 -22
  173. package/dist/Functions/useLocationParams.js +16 -27
  174. package/dist/Functions/useMetaInfo.js +19 -50
  175. package/dist/Functions/useMouseUpOutside.js +2 -5
  176. package/dist/Functions/useOnlineStatus.js +7 -26
  177. package/dist/Functions/usePasswordChecker.js +42 -77
  178. package/dist/Functions/usePrevious.js +3 -7
  179. package/dist/Functions/useResize.js +12 -32
  180. package/dist/Functions/useScrollTo.js +6 -20
  181. package/dist/Functions/useToggle.js +10 -30
  182. package/dist/Functions/utils.js +186 -366
  183. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +21 -32
  184. package/dist/Molecular/CustomIcons/components/AlertCircle.js +21 -32
  185. package/dist/Molecular/CustomIcons/components/AppStore.js +25 -36
  186. package/dist/Molecular/CustomIcons/components/Arrow.js +31 -42
  187. package/dist/Molecular/CustomIcons/components/ArrowDown.js +13 -24
  188. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +16 -27
  189. package/dist/Molecular/CustomIcons/components/ArrowRight.js +16 -27
  190. package/dist/Molecular/CustomIcons/components/ArrowUp.js +13 -24
  191. package/dist/Molecular/CustomIcons/components/Bell.js +11 -22
  192. package/dist/Molecular/CustomIcons/components/Button.js +11 -22
  193. package/dist/Molecular/CustomIcons/components/Campaigns.js +12 -23
  194. package/dist/Molecular/CustomIcons/components/Check.js +12 -23
  195. package/dist/Molecular/CustomIcons/components/Check2.js +11 -22
  196. package/dist/Molecular/CustomIcons/components/ChevronDown.js +11 -22
  197. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +11 -22
  198. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +11 -22
  199. package/dist/Molecular/CustomIcons/components/ChevronRight.js +11 -22
  200. package/dist/Molecular/CustomIcons/components/ChevronUp.js +11 -22
  201. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +26 -37
  202. package/dist/Molecular/CustomIcons/components/Close.js +13 -24
  203. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +38 -49
  204. package/dist/Molecular/CustomIcons/components/Delete.js +12 -23
  205. package/dist/Molecular/CustomIcons/components/Edit.js +11 -22
  206. package/dist/Molecular/CustomIcons/components/Email.js +29 -40
  207. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +19 -30
  208. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +27 -38
  209. package/dist/Molecular/CustomIcons/components/Flows.js +11 -22
  210. package/dist/Molecular/CustomIcons/components/Gift.js +16 -27
  211. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +25 -36
  212. package/dist/Molecular/CustomIcons/components/GooglePlay.js +25 -36
  213. package/dist/Molecular/CustomIcons/components/HelpCircle.js +14 -25
  214. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +15 -26
  215. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +14 -25
  216. package/dist/Molecular/CustomIcons/components/Home.js +14 -25
  217. package/dist/Molecular/CustomIcons/components/Home2.js +17 -28
  218. package/dist/Molecular/CustomIcons/components/Key.js +19 -30
  219. package/dist/Molecular/CustomIcons/components/Landers.js +15 -26
  220. package/dist/Molecular/CustomIcons/components/Lock.js +11 -22
  221. package/dist/Molecular/CustomIcons/components/Mail.js +19 -30
  222. package/dist/Molecular/CustomIcons/components/Mastercard.js +61 -72
  223. package/dist/Molecular/CustomIcons/components/Minus.js +24 -35
  224. package/dist/Molecular/CustomIcons/components/Offers.js +12 -23
  225. package/dist/Molecular/CustomIcons/components/Pause.js +24 -35
  226. package/dist/Molecular/CustomIcons/components/PayPal.js +38 -49
  227. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +25 -36
  228. package/dist/Molecular/CustomIcons/components/Phone.js +26 -37
  229. package/dist/Molecular/CustomIcons/components/Play.js +24 -35
  230. package/dist/Molecular/CustomIcons/components/Plus.js +24 -35
  231. package/dist/Molecular/CustomIcons/components/Profile.js +16 -27
  232. package/dist/Molecular/CustomIcons/components/QRCode.js +26 -37
  233. package/dist/Molecular/CustomIcons/components/Rectangle.js +11 -22
  234. package/dist/Molecular/CustomIcons/components/Revert.js +14 -25
  235. package/dist/Molecular/CustomIcons/components/Star.js +10 -21
  236. package/dist/Molecular/CustomIcons/components/Star2.js +12 -23
  237. package/dist/Molecular/CustomIcons/components/TrafficSources.js +14 -25
  238. package/dist/Molecular/CustomIcons/components/Trash.js +11 -22
  239. package/dist/Molecular/CustomIcons/components/TrashRed.js +11 -22
  240. package/dist/Molecular/CustomIcons/components/Triggers.js +11 -22
  241. package/dist/Molecular/CustomIcons/components/User.js +16 -27
  242. package/dist/Molecular/CustomIcons/components/Visa.js +27 -38
  243. package/dist/Molecular/CustomIcons/components/X.js +11 -22
  244. package/dist/Molecular/CustomIcons/index.js +61 -183
  245. package/dist/Molecular/FormElement/FormElement.js +18 -27
  246. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +95 -112
  247. package/dist/Molecular/FormWithDependOn/partials/_utils.js +35 -34
  248. package/dist/Molecular/InputAddress/InputAddress.js +176 -312
  249. package/dist/Molecular/InputPassword/InputPassword.js +15 -39
  250. package/dist/index.js +1 -3
  251. package/package.json +1 -1
  252. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -91
@@ -1,120 +1,70 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
-
14
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
-
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
-
20
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
21
-
22
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
23
-
24
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
25
-
26
8
  var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
27
-
28
9
  var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
29
-
30
- var _excluded = ["name", "path", "pathPrefix", "method", "queryParameters", "headers", "body", "options", "callback", "mergeProps"];
31
-
32
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
-
34
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
35
-
36
10
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
37
-
38
11
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
39
-
40
12
  /* eslint-disable no-unused-vars */
41
- var RESPONSE_AS_OBJECT_ALWAYS_VALUE = 'always';
42
13
 
14
+ const RESPONSE_AS_OBJECT_ALWAYS_VALUE = 'always';
43
15
  var _pathPrefix = /*#__PURE__*/new WeakMap();
44
-
45
16
  var _method = /*#__PURE__*/new WeakMap();
46
-
47
17
  var _queryParameters = /*#__PURE__*/new WeakMap();
48
-
49
18
  var _headers = /*#__PURE__*/new WeakMap();
50
-
51
19
  var _body = /*#__PURE__*/new WeakMap();
52
-
53
20
  var _options = /*#__PURE__*/new WeakMap();
54
-
55
21
  var _callback = /*#__PURE__*/new WeakMap();
56
-
57
22
  var _catchCallback = /*#__PURE__*/new WeakMap();
58
-
59
23
  var _everyPromiseCallback = /*#__PURE__*/new WeakMap();
60
-
61
24
  var _isResponseAsObject = /*#__PURE__*/new WeakMap();
62
-
63
- var AbortableFetch = /*#__PURE__*/function () {
64
- function AbortableFetch(input) {
65
- (0, _classCallCheck2.default)(this, AbortableFetch);
66
-
25
+ class AbortableFetch {
26
+ constructor(input) {
67
27
  _classPrivateFieldInitSpec(this, _pathPrefix, {
68
28
  writable: true,
69
29
  value: null
70
30
  });
71
-
72
31
  _classPrivateFieldInitSpec(this, _method, {
73
32
  writable: true,
74
33
  value: null
75
34
  });
76
-
77
35
  _classPrivateFieldInitSpec(this, _queryParameters, {
78
36
  writable: true,
79
37
  value: null
80
38
  });
81
-
82
39
  _classPrivateFieldInitSpec(this, _headers, {
83
40
  writable: true,
84
41
  value: null
85
42
  });
86
-
87
43
  _classPrivateFieldInitSpec(this, _body, {
88
44
  writable: true,
89
45
  value: null
90
46
  });
91
-
92
47
  _classPrivateFieldInitSpec(this, _options, {
93
48
  writable: true,
94
49
  value: null
95
50
  });
96
-
97
51
  _classPrivateFieldInitSpec(this, _callback, {
98
52
  writable: true,
99
53
  value: null
100
54
  });
101
-
102
55
  _classPrivateFieldInitSpec(this, _catchCallback, {
103
56
  writable: true,
104
57
  value: null
105
58
  });
106
-
107
59
  _classPrivateFieldInitSpec(this, _everyPromiseCallback, {
108
60
  writable: true,
109
61
  value: null
110
62
  });
111
-
112
63
  _classPrivateFieldInitSpec(this, _isResponseAsObject, {
113
64
  writable: true,
114
65
  value: false
115
66
  });
116
-
117
- if (input && ((0, _typeof2.default)(input) !== 'object' || Array.isArray(input))) throw new Error('Not valid input value!');
67
+ if (input && (typeof input !== 'object' || Array.isArray(input))) throw new Error('Not valid input value!');
118
68
  this.getPathPrefix = this.getPathPrefix.bind(this);
119
69
  this.setPathPrefix = this.setPathPrefix.bind(this);
120
70
  this.getMethod = this.getMethod.bind(this);
@@ -143,378 +93,289 @@ var AbortableFetch = /*#__PURE__*/function () {
143
93
  this.repeatRequest = this.repeatRequest.bind(this);
144
94
  this.setProps(input || {});
145
95
  }
146
-
147
- (0, _createClass2.default)(AbortableFetch, [{
148
- key: "request",
149
- value: function request(props) {
150
- var _this = this;
151
-
152
- if (!props || (0, _typeof2.default)(props) !== 'object' && typeof props !== 'string') throw new Error('Not valid props value!');
153
-
154
- var stringifyBody = function stringifyBody(b) {
155
- return (b === null || b === void 0 ? void 0 : b.constructor) === FormData ? b : JSON.stringify(b);
156
- };
157
-
158
- this.requestInput = props; // eslint-disable-next-line no-use-before-define
159
-
160
- var requests = getRequestsArray.call(this, props);
161
- if (!requests.length) return Promise.reject(new Error('There are no any valid props'));
162
- var abortController = new AbortController();
163
- var externalRequest = Promise.all(requests.map( /*#__PURE__*/function () {
164
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(item) {
165
- var safelyQuery, request;
166
- return _regenerator.default.wrap(function _callee$(_context) {
167
- while (1) {
168
- switch (_context.prev = _context.next) {
169
- case 0:
170
- safelyQuery = item.path.includes('?') ? "&".concat(item.queryParameters.replace(/\?/g, '')) : item.queryParameters;
171
- request = fetch("".concat(item.pathPrefix).concat(item.path).concat(safelyQuery), _objectSpread(_objectSpread(_objectSpread({}, item.options), {}, {
172
- method: item.method,
173
- headers: item.headers
174
- }, item.body ? {
175
- body: stringifyBody(item.body)
176
- } : {}), {}, {
177
- signal: abortController.signal
178
- })).then(function (response) {
179
- response.request = item;
180
- return response;
181
- }).catch(function (response) {
182
- return Promise.resolve({
183
- ok: false,
184
- status: 0,
185
- statusText: response,
186
- request: item
187
- });
188
- });
189
- if ((0, _classPrivateFieldGet2.default)(_this, _everyPromiseCallback) && !item.isSkipEveryPromiseCallback) request = request.then(function (response) {
190
- return (0, _classPrivateFieldGet2.default)(_this, _everyPromiseCallback).call(_this, response);
191
- });
192
- if (item.callback) request = request.then(function (response) {
193
- return item.callback(response);
194
- });
195
- if ((0, _classPrivateFieldGet2.default)(_this, _isResponseAsObject)) request = request.then(function (response) {
196
- return {
197
- name: item.name,
198
- response: response
199
- };
200
- });
201
- return _context.abrupt("return", request);
202
-
203
- case 6:
204
- case "end":
205
- return _context.stop();
206
- }
207
- }
208
- }, _callee);
209
- }));
210
-
211
- return function (_x) {
212
- return _ref.apply(this, arguments);
213
- };
214
- }()));
215
- externalRequest = externalRequest.then(function (response) {
216
- return response.length < 2 ? response[0] : response;
217
- });
218
-
219
- if ((0, _classPrivateFieldGet2.default)(this, _isResponseAsObject)) {
220
- externalRequest = externalRequest.then(function (response) {
221
- if (Array.isArray(props) && props.length > 1) return response.reduce(function (ac, item) {
222
- return _objectSpread(_objectSpread({}, ac), {}, (0, _defineProperty2.default)({}, item.name, item.response));
223
- }, {});else return (0, _classPrivateFieldGet2.default)(_this, _isResponseAsObject) === RESPONSE_AS_OBJECT_ALWAYS_VALUE ? (0, _defineProperty2.default)({}, response.name, response.response) : response.response;
224
- });
225
- }
226
-
227
- externalRequest = externalRequest.then(function (response) {
228
- return (0, _classPrivateFieldGet2.default)(_this, _callback) ? (0, _classPrivateFieldGet2.default)(_this, _callback).call(_this, response) : response;
96
+ request(props) {
97
+ if (!props || typeof props !== 'object' && typeof props !== 'string') throw new Error('Not valid props value!');
98
+ const stringifyBody = b => (b === null || b === void 0 ? void 0 : b.constructor) === FormData ? b : JSON.stringify(b);
99
+ this.requestInput = props;
100
+ // eslint-disable-next-line no-use-before-define
101
+ const requests = getRequestsArray.call(this, props);
102
+ if (!requests.length) return Promise.reject(new Error('There are no any valid props'));
103
+ const abortController = new AbortController();
104
+ let externalRequest = Promise.all(requests.map(async item => {
105
+ const safelyQuery = item.path.includes('?') ? "&".concat(item.queryParameters.replace(/\?/g, '')) : item.queryParameters;
106
+ let request = fetch("".concat(item.pathPrefix).concat(item.path).concat(safelyQuery), {
107
+ ...item.options,
108
+ method: item.method,
109
+ headers: item.headers,
110
+ ...(item.body ? {
111
+ body: stringifyBody(item.body)
112
+ } : {}),
113
+ signal: abortController.signal
114
+ }).then(response => {
115
+ response.request = item;
116
+ return response;
117
+ }).catch(response => Promise.resolve({
118
+ ok: false,
119
+ status: 0,
120
+ statusText: response,
121
+ request: item
122
+ }));
123
+ if ((0, _classPrivateFieldGet2.default)(this, _everyPromiseCallback) && !item.isSkipEveryPromiseCallback) request = request.then(response => (0, _classPrivateFieldGet2.default)(this, _everyPromiseCallback).call(this, response));
124
+ if (item.callback) request = request.then(response => item.callback(response));
125
+ if ((0, _classPrivateFieldGet2.default)(this, _isResponseAsObject)) request = request.then(response => ({
126
+ name: item.name,
127
+ response
128
+ }));
129
+ return request;
130
+ }));
131
+ externalRequest = externalRequest.then(response => response.length < 2 ? response[0] : response);
132
+ if ((0, _classPrivateFieldGet2.default)(this, _isResponseAsObject)) {
133
+ externalRequest = externalRequest.then(response => {
134
+ if (Array.isArray(props) && props.length > 1) return response.reduce((ac, item) => ({
135
+ ...ac,
136
+ [item.name]: item.response
137
+ }), {});else return (0, _classPrivateFieldGet2.default)(this, _isResponseAsObject) === RESPONSE_AS_OBJECT_ALWAYS_VALUE ? {
138
+ [response.name]: response.response
139
+ } : response.response;
229
140
  });
230
- externalRequest = externalRequest.catch(function (error) {
231
- return (0, _classPrivateFieldGet2.default)(_this, _catchCallback) ? (0, _classPrivateFieldGet2.default)(_this, _catchCallback).call(_this, error) : error;
232
- }); // eslint-disable-next-line no-proto
233
-
234
- externalRequest.__proto__.abort = function () {
235
- return abortController.abort();
236
- };
237
-
238
- return externalRequest;
239
-
240
- function getRequestsArray(input) {
241
- var _this2 = this;
242
-
243
- var requestsArray = function () {
244
- if (typeof input === 'string') return [{
245
- path: input
246
- }];
247
- return Array.isArray(input) ? (0, _toConsumableArray2.default)(input) : [input];
248
- }();
249
-
250
- return requestsArray.reduce(function (ac, item, index) {
251
- var itemObj = (0, _typeof2.default)(item) === 'object' && item !== null && !Array.isArray(item) ? item : {};
252
- var name = itemObj.name,
253
- path = itemObj.path,
254
- method = itemObj.method,
255
- queryParameters = itemObj.queryParameters,
256
- headers = itemObj.headers,
257
- body = itemObj.body,
258
- options = itemObj.options,
259
- callback = itemObj.callback,
260
- mergeProps = itemObj.mergeProps,
261
- isNoPathPrefix = itemObj.isNoPathPrefix,
262
- isSkipEveryPromiseCallback = itemObj.isSkipEveryPromiseCallback;
263
- var safelyMergeProps = mergeProps instanceof Object && !Array.isArray(mergeProps) ? mergeProps : {};
264
-
265
- var getMergeProps = function getMergeProps(key) {
266
- var _safelyMergeProps$all;
267
-
268
- return (_safelyMergeProps$all = safelyMergeProps.all) !== null && _safelyMergeProps$all !== void 0 ? _safelyMergeProps$all : safelyMergeProps[key];
269
- };
270
-
271
- if (!path || typeof path !== 'string') return ac;
272
-
273
- var _ref3 = options || {},
274
- omitName = _ref3.name,
275
- omitPath = _ref3.path,
276
- omitPathPrefix = _ref3.pathPrefix,
277
- omitMethod = _ref3.method,
278
- omitQueryParameters = _ref3.queryParameters,
279
- omitHeaders = _ref3.headers,
280
- omitBody = _ref3.body,
281
- omitOptions = _ref3.options,
282
- omitCallback = _ref3.callback,
283
- omitMergeProps = _ref3.mergeProps,
284
- optionsRest = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
285
-
286
- return [].concat((0, _toConsumableArray2.default)(ac), [_objectSpread({
287
- path: path,
288
- pathPrefix: getMergeProps('pathPrefix') === 'onlyLocal' || isNoPathPrefix ? '' : (0, _classPrivateFieldGet2.default)(_this2, _pathPrefix) || '',
289
- method: function () {
290
- if (getMergeProps('method') === 'onlyLocal') return method || 'GET';
291
- return getMergeProps('method') === 'onlyGlobal' ? (0, _classPrivateFieldGet2.default)(_this2, _method) || 'GET' : method || (0, _classPrivateFieldGet2.default)(_this2, _method) || 'GET';
292
- }(),
293
- queryParameters: function () {
294
- var _getMergeProps, _getMergeProps2;
295
-
296
- if (((_getMergeProps = getMergeProps('queryParameters')) !== null && _getMergeProps !== void 0 ? _getMergeProps : getMergeProps('query')) === 'onlyLocal') {
297
- return _this2.getQueryString(_this2.getQueryArray(queryParameters));
298
- }
299
-
300
- return ((_getMergeProps2 = getMergeProps('queryParameters')) !== null && _getMergeProps2 !== void 0 ? _getMergeProps2 : getMergeProps('query')) === 'onlyGlobal' ? _this2.getQueryString(_this2.getQueryArray((0, _classPrivateFieldGet2.default)(_this2, _queryParameters))) : _this2.getQueryString([].concat((0, _toConsumableArray2.default)(_this2.getQueryArray((0, _classPrivateFieldGet2.default)(_this2, _queryParameters))), (0, _toConsumableArray2.default)(_this2.getQueryArray(queryParameters))));
301
- }(),
302
- headers: function () {
303
- if (getMergeProps('headers') === 'onlyLocal') return _this2.getHeadersObj(headers || {});
304
- return getMergeProps('headers') === 'onlyGlobal' ? _this2.getHeadersObj(_objectSpread({}, (0, _classPrivateFieldGet2.default)(_this2, _headers) || {})) : _this2.getHeadersObj(_objectSpread(_objectSpread({}, (0, _classPrivateFieldGet2.default)(_this2, _headers) || {}), headers || {}));
305
- }(),
306
- body: function () {
307
- if (getMergeProps('body') === 'onlyLocal') return body || null;
308
- if (getMergeProps('body') === 'onlyGlobal') return (0, _classPrivateFieldGet2.default)(_this2, _body) || null;
309
-
310
- if (body && (0, _classPrivateFieldGet2.default)(_this2, _body) && (0, _typeof2.default)(body) === (0, _typeof2.default)((0, _classPrivateFieldGet2.default)(_this2, _body)) && (0, _typeof2.default)(body) === 'object') {
311
- return Array.isArray(body) ? [].concat((0, _toConsumableArray2.default)((0, _classPrivateFieldGet2.default)(_this2, _body)), (0, _toConsumableArray2.default)(body)) : _objectSpread(_objectSpread({}, (0, _classPrivateFieldGet2.default)(_this2, _body)), body);
312
- } else return body || (0, _classPrivateFieldGet2.default)(_this2, _body) || null;
313
- }(),
314
- options: function () {
315
- if (getMergeProps('options') === 'onlyLocal') return _objectSpread({}, optionsRest || {});
316
- return getMergeProps('options') === 'onlyGlobal' ? _objectSpread({}, (0, _classPrivateFieldGet2.default)(_this2, _options) || {}) : _objectSpread(_objectSpread({}, (0, _classPrivateFieldGet2.default)(_this2, _options) || {}), optionsRest || {});
317
- }(),
318
- callback: callback,
319
- isSkipEveryPromiseCallback: isSkipEveryPromiseCallback
320
- }, _this2.getIsResponseAsObject() ? {
321
- name: name && typeof name === 'string' ? name : index
322
- } : {})]);
323
- }, []);
324
- }
325
- }
326
- }, {
327
- key: "repeatRequest",
328
- value: function repeatRequest() {
329
- return this.request(this.requestInput);
330
- } // ***** getters and setters *****
331
-
332
- }, {
333
- key: "getPathPrefix",
334
- value: function getPathPrefix() {
335
- return (0, _classPrivateFieldGet2.default)(this, _pathPrefix);
336
- }
337
- }, {
338
- key: "setPathPrefix",
339
- value: function setPathPrefix(value) {
340
- if (value && typeof value !== 'string') throw new Error('Not valid pathPrefix value!');
341
- (0, _classPrivateFieldSet2.default)(this, _pathPrefix, value || null);
342
141
  }
343
- }, {
344
- key: "getMethod",
345
- value: function getMethod() {
346
- return (0, _classPrivateFieldGet2.default)(this, _method);
347
- }
348
- }, {
349
- key: "setMethod",
350
- value: function setMethod(value) {
351
- var methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'];
352
- if (value && !methods.includes(value)) throw new Error('Not valid method value!');
353
- (0, _classPrivateFieldSet2.default)(this, _method, value || null);
142
+ externalRequest = externalRequest.then(response => (0, _classPrivateFieldGet2.default)(this, _callback) ? (0, _classPrivateFieldGet2.default)(this, _callback).call(this, response) : response);
143
+ externalRequest = externalRequest.catch(error => (0, _classPrivateFieldGet2.default)(this, _catchCallback) ? (0, _classPrivateFieldGet2.default)(this, _catchCallback).call(this, error) : error);
144
+
145
+ // eslint-disable-next-line no-proto
146
+ externalRequest.__proto__.abort = () => abortController.abort();
147
+ return externalRequest;
148
+ function getRequestsArray(input) {
149
+ const requestsArray = (() => {
150
+ if (typeof input === 'string') return [{
151
+ path: input
152
+ }];
153
+ return Array.isArray(input) ? [...input] : [input];
154
+ })();
155
+ return requestsArray.reduce((ac, item, index) => {
156
+ const itemObj = typeof item === 'object' && item !== null && !Array.isArray(item) ? item : {};
157
+ const {
158
+ name,
159
+ path,
160
+ method,
161
+ queryParameters,
162
+ headers,
163
+ body,
164
+ options,
165
+ callback,
166
+ mergeProps,
167
+ isNoPathPrefix,
168
+ isSkipEveryPromiseCallback
169
+ } = itemObj;
170
+ const safelyMergeProps = mergeProps instanceof Object && !Array.isArray(mergeProps) ? mergeProps : {};
171
+ const getMergeProps = key => {
172
+ var _safelyMergeProps$all;
173
+ return (_safelyMergeProps$all = safelyMergeProps.all) !== null && _safelyMergeProps$all !== void 0 ? _safelyMergeProps$all : safelyMergeProps[key];
174
+ };
175
+ if (!path || typeof path !== 'string') return ac;
176
+ const {
177
+ name: omitName,
178
+ path: omitPath,
179
+ pathPrefix: omitPathPrefix,
180
+ method: omitMethod,
181
+ queryParameters: omitQueryParameters,
182
+ headers: omitHeaders,
183
+ body: omitBody,
184
+ options: omitOptions,
185
+ callback: omitCallback,
186
+ mergeProps: omitMergeProps,
187
+ ...optionsRest
188
+ } = options || {};
189
+ return [...ac, {
190
+ path,
191
+ pathPrefix: getMergeProps('pathPrefix') === 'onlyLocal' || isNoPathPrefix ? '' : (0, _classPrivateFieldGet2.default)(this, _pathPrefix) || '',
192
+ method: (() => {
193
+ if (getMergeProps('method') === 'onlyLocal') return method || 'GET';
194
+ return getMergeProps('method') === 'onlyGlobal' ? (0, _classPrivateFieldGet2.default)(this, _method) || 'GET' : method || (0, _classPrivateFieldGet2.default)(this, _method) || 'GET';
195
+ })(),
196
+ queryParameters: ((_getMergeProps, _getMergeProps2) => {
197
+ if (((_getMergeProps = getMergeProps('queryParameters')) !== null && _getMergeProps !== void 0 ? _getMergeProps : getMergeProps('query')) === 'onlyLocal') {
198
+ return this.getQueryString(this.getQueryArray(queryParameters));
199
+ }
200
+ return ((_getMergeProps2 = getMergeProps('queryParameters')) !== null && _getMergeProps2 !== void 0 ? _getMergeProps2 : getMergeProps('query')) === 'onlyGlobal' ? this.getQueryString(this.getQueryArray((0, _classPrivateFieldGet2.default)(this, _queryParameters))) : this.getQueryString([...this.getQueryArray((0, _classPrivateFieldGet2.default)(this, _queryParameters)), ...this.getQueryArray(queryParameters)]);
201
+ })(),
202
+ headers: (() => {
203
+ if (getMergeProps('headers') === 'onlyLocal') return this.getHeadersObj(headers || {});
204
+ return getMergeProps('headers') === 'onlyGlobal' ? this.getHeadersObj({
205
+ ...((0, _classPrivateFieldGet2.default)(this, _headers) || {})
206
+ }) : this.getHeadersObj({
207
+ ...((0, _classPrivateFieldGet2.default)(this, _headers) || {}),
208
+ ...(headers || {})
209
+ });
210
+ })(),
211
+ body: (() => {
212
+ if (getMergeProps('body') === 'onlyLocal') return body || null;
213
+ if (getMergeProps('body') === 'onlyGlobal') return (0, _classPrivateFieldGet2.default)(this, _body) || null;
214
+ if (body && (0, _classPrivateFieldGet2.default)(this, _body) && typeof body === typeof (0, _classPrivateFieldGet2.default)(this, _body) && typeof body === 'object') {
215
+ return Array.isArray(body) ? [...(0, _classPrivateFieldGet2.default)(this, _body), ...body] : {
216
+ ...(0, _classPrivateFieldGet2.default)(this, _body),
217
+ ...body
218
+ };
219
+ } else return body || (0, _classPrivateFieldGet2.default)(this, _body) || null;
220
+ })(),
221
+ options: (() => {
222
+ if (getMergeProps('options') === 'onlyLocal') return {
223
+ ...(optionsRest || {})
224
+ };
225
+ return getMergeProps('options') === 'onlyGlobal' ? {
226
+ ...((0, _classPrivateFieldGet2.default)(this, _options) || {})
227
+ } : {
228
+ ...((0, _classPrivateFieldGet2.default)(this, _options) || {}),
229
+ ...(optionsRest || {})
230
+ };
231
+ })(),
232
+ callback,
233
+ isSkipEveryPromiseCallback,
234
+ ...(this.getIsResponseAsObject() ? {
235
+ name: name && typeof name === 'string' ? name : index
236
+ } : {})
237
+ }];
238
+ }, []);
354
239
  }
355
- }, {
356
- key: "getQueryParameters",
357
- value: function getQueryParameters() {
358
- return (0, _classPrivateFieldGet2.default)(this, _queryParameters);
359
- } // eslint-disable-next-line class-methods-use-this
360
-
361
- }, {
362
- key: "getQueryArray",
363
- value: function getQueryArray(value) {
364
- var _value$replace;
365
-
366
- if (typeof value === 'string') return value === null || value === void 0 ? void 0 : (_value$replace = value.replace(/\?/g, '')) === null || _value$replace === void 0 ? void 0 : _value$replace.split('&');else if (Array.isArray(value)) return value.map(function (item) {
367
- return item.replace(/\?/g, '');
368
- });else if ((0, _typeof2.default)(value) === 'object' && value !== null) return Object.keys(value).filter(function (key) {
369
- return key && value[key];
370
- }).map(function (key) {
371
- return "".concat(key, "=").concat(value[key]);
372
- });else return [];
373
- } // eslint-disable-next-line class-methods-use-this
240
+ }
241
+ repeatRequest() {
242
+ return this.request(this.requestInput);
243
+ }
374
244
 
375
- }, {
376
- key: "getQueryString",
377
- value: function getQueryString(value) {
378
- if (!Array.isArray(value)) throw new Error('Not valid query parameters value!');
379
- return value.length ? "?".concat(value.join('&')) : '';
380
- }
381
- }, {
382
- key: "setQueryParameters",
383
- value: function setQueryParameters(value) {
384
- if (value && !Array.isArray(value)) throw new Error('Not valid query parameters value!');
385
- (0, _classPrivateFieldSet2.default)(this, _queryParameters, value || null);
386
- }
387
- }, {
388
- key: "getHeaders",
389
- value: function getHeaders() {
390
- return (0, _classPrivateFieldGet2.default)(this, _headers);
391
- } // eslint-disable-next-line class-methods-use-this
245
+ // ***** getters and setters *****
246
+ getPathPrefix() {
247
+ return (0, _classPrivateFieldGet2.default)(this, _pathPrefix);
248
+ }
249
+ setPathPrefix(value) {
250
+ if (value && typeof value !== 'string') throw new Error('Not valid pathPrefix value!');
251
+ (0, _classPrivateFieldSet2.default)(this, _pathPrefix, value || null);
252
+ }
253
+ getMethod() {
254
+ return (0, _classPrivateFieldGet2.default)(this, _method);
255
+ }
256
+ setMethod(value) {
257
+ const methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'];
258
+ if (value && !methods.includes(value)) throw new Error('Not valid method value!');
259
+ (0, _classPrivateFieldSet2.default)(this, _method, value || null);
260
+ }
261
+ getQueryParameters() {
262
+ return (0, _classPrivateFieldGet2.default)(this, _queryParameters);
263
+ }
392
264
 
393
- }, {
394
- key: "getHeadersObj",
395
- value: function getHeadersObj(value) {
396
- var headers = new Headers();
397
- if (!value) return headers;
398
- if ((0, _typeof2.default)(value) !== 'object' || Array.isArray(value)) throw new Error('Not valid headers value!');
399
- Object.keys(value).forEach(function (item) {
400
- headers.append(item, value[item]);
401
- });
402
- return headers;
403
- }
404
- }, {
405
- key: "setHeaders",
406
- value: function setHeaders(value) {
407
- if (value && ((0, _typeof2.default)(value) !== 'object' || Array.isArray(value))) throw new Error('Not valid headers value!');
408
- (0, _classPrivateFieldSet2.default)(this, _headers, value || null);
409
- }
410
- }, {
411
- key: "getBody",
412
- value: function getBody() {
413
- return (0, _classPrivateFieldGet2.default)(this, _body);
414
- }
415
- }, {
416
- key: "setBody",
417
- value: function setBody(value) {
418
- (0, _classPrivateFieldSet2.default)(this, _body, value);
419
- }
420
- }, {
421
- key: "getOptions",
422
- value: function getOptions() {
423
- return (0, _classPrivateFieldGet2.default)(this, _options);
424
- }
425
- }, {
426
- key: "setOptions",
427
- value: function setOptions(value) {
428
- if (value && ((0, _typeof2.default)(value) !== 'object' || Array.isArray(value))) throw new Error('Not valid options value!');
429
- (0, _classPrivateFieldSet2.default)(this, _options, _objectSpread({}, value));
430
- }
431
- }, {
432
- key: "getCallback",
433
- value: function getCallback() {
434
- return (0, _classPrivateFieldGet2.default)(this, _callback);
435
- }
436
- }, {
437
- key: "setCallback",
438
- value: function setCallback(value) {
439
- if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
440
- (0, _classPrivateFieldSet2.default)(this, _callback, value || null);
441
- }
442
- }, {
443
- key: "getCatchCallback",
444
- value: function getCatchCallback() {
445
- return (0, _classPrivateFieldGet2.default)(this, _catchCallback);
446
- }
447
- }, {
448
- key: "setCatchCallback",
449
- value: function setCatchCallback(value) {
450
- if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
451
- (0, _classPrivateFieldSet2.default)(this, _catchCallback, value || null);
452
- }
453
- }, {
454
- key: "getEveryPromiseCallback",
455
- value: function getEveryPromiseCallback() {
456
- return (0, _classPrivateFieldGet2.default)(this, _everyPromiseCallback);
457
- }
458
- }, {
459
- key: "setEveryPromiseCallback",
460
- value: function setEveryPromiseCallback(value) {
461
- if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
462
- (0, _classPrivateFieldSet2.default)(this, _everyPromiseCallback, value || null);
463
- }
464
- }, {
465
- key: "getIsResponseAsObject",
466
- value: function getIsResponseAsObject() {
467
- return (0, _classPrivateFieldGet2.default)(this, _isResponseAsObject);
468
- }
469
- }, {
470
- key: "setIsResponseAsObject",
471
- value: function setIsResponseAsObject(value) {
472
- (0, _classPrivateFieldSet2.default)(this, _isResponseAsObject, typeof value !== 'boolean' && value !== 'always' ? !!value : value);
473
- }
474
- }, {
475
- key: "getProps",
476
- value: function getProps() {
477
- return {
478
- pathPrefix: this.getPathPrefix() || null,
479
- method: this.getMethod() || null,
480
- queryParameters: this.getQueryParameters() || null,
481
- headers: this.getHeaders() || null,
482
- body: this.getBody() || null,
483
- options: this.getOptions() || null,
484
- callback: this.getCallback() || null,
485
- everyPromiseCallback: this.getEveryPromiseCallback(),
486
- // isAnywayRunCallback: this.getIsAnywayRunCallback(),
487
- isResponseAsObject: this.getIsResponseAsObject()
488
- };
489
- }
490
- }, {
491
- key: "setProps",
492
- value: function setProps(input) {
493
- var pathPrefix = input.pathPrefix,
494
- method = input.method,
495
- queryParameters = input.queryParameters,
496
- headers = input.headers,
497
- body = input.body,
498
- options = input.options,
499
- callback = input.callback,
500
- catchCallback = input.catchCallback,
501
- everyPromiseCallback = input.everyPromiseCallback,
502
- isResponseAsObject = input.isResponseAsObject;
503
- if (pathPrefix) this.setPathPrefix(pathPrefix);
504
- if (method) this.setMethod(method);
505
- if (queryParameters) this.setQueryParameters(this.getQueryArray(queryParameters));
506
- if (headers) this.setHeaders(headers);
507
- if (body) this.setBody(body);
508
- if (options) this.setOptions(options);
509
- if (callback) this.setCallback(callback);
510
- if (catchCallback) this.setCatchCallback(catchCallback);
511
- if (everyPromiseCallback) this.setEveryPromiseCallback(everyPromiseCallback); // if (isAnywayRunCallback) this.setIsAnywayRunCallback(isAnywayRunCallback);
265
+ // eslint-disable-next-line class-methods-use-this
266
+ getQueryArray(value) {
267
+ var _value$replace;
268
+ if (typeof value === 'string') return value === null || value === void 0 || (_value$replace = value.replace(/\?/g, '')) === null || _value$replace === void 0 ? void 0 : _value$replace.split('&');else if (Array.isArray(value)) return value.map(item => item.replace(/\?/g, ''));else if (typeof value === 'object' && value !== null) return Object.keys(value).filter(key => key && value[key]).map(key => "".concat(key, "=").concat(value[key]));else return [];
269
+ }
512
270
 
513
- if (isResponseAsObject !== undefined) this.setIsResponseAsObject(isResponseAsObject);
514
- }
515
- }]);
516
- return AbortableFetch;
517
- }();
271
+ // eslint-disable-next-line class-methods-use-this
272
+ getQueryString(value) {
273
+ if (!Array.isArray(value)) throw new Error('Not valid query parameters value!');
274
+ return value.length ? "?".concat(value.join('&')) : '';
275
+ }
276
+ setQueryParameters(value) {
277
+ if (value && !Array.isArray(value)) throw new Error('Not valid query parameters value!');
278
+ (0, _classPrivateFieldSet2.default)(this, _queryParameters, value || null);
279
+ }
280
+ getHeaders() {
281
+ return (0, _classPrivateFieldGet2.default)(this, _headers);
282
+ }
518
283
 
519
- var _default = AbortableFetch;
520
- exports.default = _default;
284
+ // eslint-disable-next-line class-methods-use-this
285
+ getHeadersObj(value) {
286
+ const headers = new Headers();
287
+ if (!value) return headers;
288
+ if (typeof value !== 'object' || Array.isArray(value)) throw new Error('Not valid headers value!');
289
+ Object.keys(value).forEach(item => {
290
+ headers.append(item, value[item]);
291
+ });
292
+ return headers;
293
+ }
294
+ setHeaders(value) {
295
+ if (value && (typeof value !== 'object' || Array.isArray(value))) throw new Error('Not valid headers value!');
296
+ (0, _classPrivateFieldSet2.default)(this, _headers, value || null);
297
+ }
298
+ getBody() {
299
+ return (0, _classPrivateFieldGet2.default)(this, _body);
300
+ }
301
+ setBody(value) {
302
+ (0, _classPrivateFieldSet2.default)(this, _body, value);
303
+ }
304
+ getOptions() {
305
+ return (0, _classPrivateFieldGet2.default)(this, _options);
306
+ }
307
+ setOptions(value) {
308
+ if (value && (typeof value !== 'object' || Array.isArray(value))) throw new Error('Not valid options value!');
309
+ (0, _classPrivateFieldSet2.default)(this, _options, {
310
+ ...value
311
+ });
312
+ }
313
+ getCallback() {
314
+ return (0, _classPrivateFieldGet2.default)(this, _callback);
315
+ }
316
+ setCallback(value) {
317
+ if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
318
+ (0, _classPrivateFieldSet2.default)(this, _callback, value || null);
319
+ }
320
+ getCatchCallback() {
321
+ return (0, _classPrivateFieldGet2.default)(this, _catchCallback);
322
+ }
323
+ setCatchCallback(value) {
324
+ if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
325
+ (0, _classPrivateFieldSet2.default)(this, _catchCallback, value || null);
326
+ }
327
+ getEveryPromiseCallback() {
328
+ return (0, _classPrivateFieldGet2.default)(this, _everyPromiseCallback);
329
+ }
330
+ setEveryPromiseCallback(value) {
331
+ if (value && typeof value !== 'function') throw new Error('Not valid callback value!');
332
+ (0, _classPrivateFieldSet2.default)(this, _everyPromiseCallback, value || null);
333
+ }
334
+ getIsResponseAsObject() {
335
+ return (0, _classPrivateFieldGet2.default)(this, _isResponseAsObject);
336
+ }
337
+ setIsResponseAsObject(value) {
338
+ (0, _classPrivateFieldSet2.default)(this, _isResponseAsObject, typeof value !== 'boolean' && value !== 'always' ? !!value : value);
339
+ }
340
+ getProps() {
341
+ return {
342
+ pathPrefix: this.getPathPrefix() || null,
343
+ method: this.getMethod() || null,
344
+ queryParameters: this.getQueryParameters() || null,
345
+ headers: this.getHeaders() || null,
346
+ body: this.getBody() || null,
347
+ options: this.getOptions() || null,
348
+ callback: this.getCallback() || null,
349
+ everyPromiseCallback: this.getEveryPromiseCallback(),
350
+ // isAnywayRunCallback: this.getIsAnywayRunCallback(),
351
+ isResponseAsObject: this.getIsResponseAsObject()
352
+ };
353
+ }
354
+ setProps(input) {
355
+ const {
356
+ pathPrefix,
357
+ method,
358
+ queryParameters,
359
+ headers,
360
+ body,
361
+ options,
362
+ callback,
363
+ catchCallback,
364
+ everyPromiseCallback,
365
+ // isAnywayRunCallback,
366
+ isResponseAsObject
367
+ } = input;
368
+ if (pathPrefix) this.setPathPrefix(pathPrefix);
369
+ if (method) this.setMethod(method);
370
+ if (queryParameters) this.setQueryParameters(this.getQueryArray(queryParameters));
371
+ if (headers) this.setHeaders(headers);
372
+ if (body) this.setBody(body);
373
+ if (options) this.setOptions(options);
374
+ if (callback) this.setCallback(callback);
375
+ if (catchCallback) this.setCatchCallback(catchCallback);
376
+ if (everyPromiseCallback) this.setEveryPromiseCallback(everyPromiseCallback);
377
+ // if (isAnywayRunCallback) this.setIsAnywayRunCallback(isAnywayRunCallback);
378
+ if (isResponseAsObject !== undefined) this.setIsResponseAsObject(isResponseAsObject);
379
+ }
380
+ }
381
+ var _default = exports.default = AbortableFetch;