ingeniuscliq-core 0.4.25 → 0.4.27

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 (231) hide show
  1. package/dist/components/common/carousel/CustomCarousel.js +26 -0
  2. package/dist/components/common/carousel/CustomCarouselSection.js +41 -0
  3. package/dist/components/common/form/CustomFormField.js +29 -0
  4. package/dist/components/common/form/{FormCheckbox.tsx → FormCheckbox.js} +7 -7
  5. package/dist/components/common/form/{FormInput.tsx → FormInput.js} +5 -5
  6. package/dist/components/common/form/{FormSelect.tsx → FormSelect.js} +7 -7
  7. package/dist/components/common/form/{FormTextArea.tsx → FormTextArea.js} +5 -5
  8. package/dist/components/common/form/{FormWrapper.tsx → FormWrapper.js} +2 -2
  9. package/dist/components/common/logo/{Logo.tsx → Logo.js} +3 -3
  10. package/dist/components/common/pagination/{CustomPagination.tsx → CustomPagination.js} +6 -6
  11. package/dist/components/common/select/CustomSelect.js +27 -0
  12. package/dist/components/common/spinner/Spinner.js +32 -0
  13. package/dist/components/common/stepper/{Stepper.tsx → Stepper.js} +9 -9
  14. package/dist/components/layouts/CoreBaseLayout.js +19 -0
  15. package/dist/components/templates/CoreHomeLayout.js +8 -0
  16. package/dist/components/templates/{CorePreviewLayout.tsx → CorePreviewLayout.js} +3 -3
  17. package/dist/components/ui/accordion.js +44 -0
  18. package/dist/components/ui/{alert-dialog.tsx → alert-dialog.js} +28 -28
  19. package/dist/components/ui/{alert.tsx → alert.js} +5 -5
  20. package/dist/components/ui/{avatar.tsx → avatar.js} +11 -11
  21. package/dist/components/ui/{badge.tsx → badge.js} +3 -3
  22. package/dist/components/ui/{breadcrumb.tsx → breadcrumb.js} +13 -14
  23. package/dist/components/ui/{button.tsx → button.js} +4 -4
  24. package/dist/components/ui/{card.tsx → card.js} +8 -8
  25. package/dist/components/ui/{carousel.tsx → carousel.js} +14 -15
  26. package/dist/components/ui/{checkbox.tsx → checkbox.js} +9 -9
  27. package/dist/components/ui/{dialog.tsx → dialog.js} +26 -26
  28. package/dist/components/ui/{dropdown-menu.tsx → dropdown-menu.js} +37 -39
  29. package/dist/components/ui/{form.tsx → form.js} +10 -10
  30. package/dist/components/ui/{input.tsx → input.js} +2 -2
  31. package/dist/components/ui/{label.tsx → label.js} +6 -6
  32. package/dist/components/ui/{pagination.tsx → pagination.js} +16 -18
  33. package/dist/components/ui/{popover.tsx → popover.js} +8 -8
  34. package/dist/components/ui/radio-group.js +34 -0
  35. package/dist/components/ui/{select.tsx → select.js} +38 -40
  36. package/dist/components/ui/{separator.tsx → separator.js} +5 -5
  37. package/dist/components/ui/{sheet.tsx → sheet.js} +27 -27
  38. package/dist/components/ui/{skeleton.tsx → skeleton.js} +2 -2
  39. package/dist/components/ui/{slider.tsx → slider.js} +9 -9
  40. package/dist/components/ui/{stepper.tsx → stepper.js} +35 -35
  41. package/dist/components/ui/{switch.tsx → switch.js} +7 -7
  42. package/dist/components/ui/{table.tsx → table.js} +9 -9
  43. package/dist/components/ui/{tabs.tsx → tabs.js} +13 -13
  44. package/dist/components/ui/{textarea.tsx → textarea.js} +2 -2
  45. package/dist/components/ui/{tooltip.tsx → tooltip.js} +8 -8
  46. package/dist/helpers/axiosGlobal.js +1 -2
  47. package/dist/hooks/useNotification.js +1 -1
  48. package/dist/index.js +45 -45
  49. package/dist/lib/utils.js +2 -2
  50. package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
  51. package/dist/modules/CoreAuth/context/{AuthContext.tsx → AuthContext.js} +1 -1
  52. package/dist/modules/CoreAuth/index.js +2 -1
  53. package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
  54. package/dist/modules/CoreCustomization/index.js +1 -0
  55. package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
  56. package/dist/modules/CoreOrder/index.js +1 -0
  57. package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
  58. package/dist/modules/CorePayForm/index.js +1 -0
  59. package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
  60. package/dist/modules/CoreProduct/index.js +1 -0
  61. package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
  62. package/dist/modules/CoreShipment/index.js +1 -0
  63. package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
  64. package/package.json +2 -7
  65. package/dist/_virtual/index.js +0 -5
  66. package/dist/_virtual/index2.js +0 -3
  67. package/dist/_virtual/jsx-runtime.js +0 -5
  68. package/dist/_virtual/jsx-runtime2.js +0 -3
  69. package/dist/_virtual/react-jsx-runtime.development.js +0 -3
  70. package/dist/_virtual/react-jsx-runtime.production.js +0 -3
  71. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -3
  72. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -3
  73. package/dist/components/common/carousel/CustomCarousel.tsx +0 -26
  74. package/dist/components/common/carousel/CustomCarouselSection.tsx +0 -41
  75. package/dist/components/common/form/CustomFormField.tsx +0 -29
  76. package/dist/components/common/select/CustomSelect.tsx +0 -27
  77. package/dist/components/common/spinner/Spinner.tsx +0 -32
  78. package/dist/components/layouts/CoreBaseLayout.tsx +0 -19
  79. package/dist/components/templates/CoreHomeLayout.tsx +0 -8
  80. package/dist/components/ui/accordion.tsx +0 -44
  81. package/dist/components/ui/radio-group.tsx +0 -34
  82. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
  83. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
  84. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
  85. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
  86. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
  87. package/dist/node_modules/@radix-ui/number/dist/index.js +0 -6
  88. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
  89. package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +0 -305
  90. package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -147
  91. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
  92. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -118
  93. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -270
  94. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +0 -145
  95. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -70
  96. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
  97. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
  98. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
  99. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -11
  100. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
  101. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -267
  102. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
  103. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
  104. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
  105. package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -24
  106. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -834
  107. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -299
  108. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -283
  109. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
  110. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
  111. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
  112. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +0 -282
  113. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -223
  114. package/dist/node_modules/@radix-ui/react-select/dist/index.js +0 -1156
  115. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -30
  116. package/dist/node_modules/@radix-ui/react-slider/dist/index.js +0 -554
  117. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -99
  118. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -152
  119. package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -187
  120. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -482
  121. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
  122. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
  123. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
  124. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
  125. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
  126. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -15
  127. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
  128. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -35
  129. package/dist/node_modules/@stepperize/core/dist/index.js +0 -3
  130. package/dist/node_modules/@stepperize/react/dist/index.js +0 -6
  131. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
  132. package/dist/node_modules/axios/index.js +0 -25
  133. package/dist/node_modules/axios/lib/adapters/adapters.js +0 -81
  134. package/dist/node_modules/axios/lib/adapters/fetch.js +0 -229
  135. package/dist/node_modules/axios/lib/adapters/xhr.js +0 -199
  136. package/dist/node_modules/axios/lib/axios.js +0 -86
  137. package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -133
  138. package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -23
  139. package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -5
  140. package/dist/node_modules/axios/lib/core/Axios.js +0 -238
  141. package/dist/node_modules/axios/lib/core/AxiosError.js +0 -101
  142. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -312
  143. package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -69
  144. package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -22
  145. package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -81
  146. package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -106
  147. package/dist/node_modules/axios/lib/core/settle.js +0 -27
  148. package/dist/node_modules/axios/lib/core/transformData.js +0 -28
  149. package/dist/node_modules/axios/lib/defaults/index.js +0 -159
  150. package/dist/node_modules/axios/lib/defaults/transitional.js +0 -7
  151. package/dist/node_modules/axios/lib/env/data.js +0 -3
  152. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
  153. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
  154. package/dist/node_modules/axios/lib/helpers/bind.js +0 -7
  155. package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -69
  156. package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  157. package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -48
  158. package/dist/node_modules/axios/lib/helpers/cookies.js +0 -43
  159. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -93
  160. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
  161. package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  162. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  163. package/dist/node_modules/axios/lib/helpers/null.js +0 -4
  164. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
  165. package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  166. package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -46
  167. package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -58
  168. package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -53
  169. package/dist/node_modules/axios/lib/helpers/spread.js +0 -28
  170. package/dist/node_modules/axios/lib/helpers/throttle.js +0 -44
  171. package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -219
  172. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  173. package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -88
  174. package/dist/node_modules/axios/lib/helpers/validator.js +0 -99
  175. package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  176. package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  177. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
  178. package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
  179. package/dist/node_modules/axios/lib/platform/common/utils.js +0 -45
  180. package/dist/node_modules/axios/lib/platform/index.js +0 -9
  181. package/dist/node_modules/axios/lib/utils.js +0 -780
  182. package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
  183. package/dist/node_modules/clsx/dist/clsx.js +0 -3
  184. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
  185. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
  186. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
  187. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
  188. package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -43
  189. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -30
  190. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -20
  191. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +0 -17
  192. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +0 -17
  193. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +0 -14
  194. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -14
  195. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -14
  196. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -14
  197. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -14
  198. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +0 -14
  199. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -18
  200. package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -17
  201. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -28
  202. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -363
  203. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -44
  204. package/dist/node_modules/react/jsx-runtime.js +0 -19
  205. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -560
  206. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
  207. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
  208. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
  209. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
  210. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
  211. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  212. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  213. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
  214. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
  215. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
  216. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
  217. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
  218. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
  219. package/dist/node_modules/sonner/dist/index.js +0 -299
  220. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -3035
  221. package/dist/node_modules/tslib/tslib.es6.js +0 -56
  222. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
  223. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
  224. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
  225. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
  226. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
  227. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -106
  228. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  229. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -19
  230. package/dist/node_modules/zustand/esm/react.js +0 -22
  231. package/dist/node_modules/zustand/esm/vanilla.js +0 -24
@@ -1,55 +0,0 @@
1
- import utils from '../utils.js';
2
-
3
- // RawAxiosHeaders whose duplicates are ignored by node
4
- // c.f. https://nodejs.org/api/http.html#http_message_headers
5
- const ignoreDuplicateOf = utils.toObjectSet([
6
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
7
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
8
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
9
- 'referer', 'retry-after', 'user-agent'
10
- ]);
11
-
12
- /**
13
- * Parse headers into an object
14
- *
15
- * ```
16
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
17
- * Content-Type: application/json
18
- * Connection: keep-alive
19
- * Transfer-Encoding: chunked
20
- * ```
21
- *
22
- * @param {String} rawHeaders Headers needing to be parsed
23
- *
24
- * @returns {Object} Headers parsed into an object
25
- */
26
- const parseHeaders = rawHeaders => {
27
- const parsed = {};
28
- let key;
29
- let val;
30
- let i;
31
-
32
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
33
- i = line.indexOf(':');
34
- key = line.substring(0, i).trim().toLowerCase();
35
- val = line.substring(i + 1).trim();
36
-
37
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
38
- return;
39
- }
40
-
41
- if (key === 'set-cookie') {
42
- if (parsed[key]) {
43
- parsed[key].push(val);
44
- } else {
45
- parsed[key] = [val];
46
- }
47
- } else {
48
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
49
- }
50
- });
51
-
52
- return parsed;
53
- };
54
-
55
- export { parseHeaders as default };
@@ -1,6 +0,0 @@
1
- function parseProtocol(url) {
2
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3
- return match && match[1] || '';
4
- }
5
-
6
- export { parseProtocol as default };
@@ -1,46 +0,0 @@
1
- import speedometer from './speedometer.js';
2
- import throttle from './throttle.js';
3
- import utils from '../utils.js';
4
-
5
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
6
- let bytesNotified = 0;
7
- const _speedometer = speedometer(50, 250);
8
-
9
- return throttle(e => {
10
- const loaded = e.loaded;
11
- const total = e.lengthComputable ? e.total : undefined;
12
- const progressBytes = loaded - bytesNotified;
13
- const rate = _speedometer(progressBytes);
14
- const inRange = loaded <= total;
15
-
16
- bytesNotified = loaded;
17
-
18
- const data = {
19
- loaded,
20
- total,
21
- progress: total ? (loaded / total) : undefined,
22
- bytes: progressBytes,
23
- rate: rate ? rate : undefined,
24
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
25
- event: e,
26
- lengthComputable: total != null,
27
- [isDownloadStream ? 'download' : 'upload']: true
28
- };
29
-
30
- listener(data);
31
- }, freq);
32
- };
33
-
34
- const progressEventDecorator = (total, throttled) => {
35
- const lengthComputable = total != null;
36
-
37
- return [(loaded) => throttled[0]({
38
- lengthComputable,
39
- total,
40
- loaded
41
- }), throttled[1]];
42
- };
43
-
44
- const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
45
-
46
- export { asyncDecorator, progressEventDecorator, progressEventReducer };
@@ -1,58 +0,0 @@
1
- import platform from '../platform/index.js';
2
- import utils from '../utils.js';
3
- import isURLSameOrigin from './isURLSameOrigin.js';
4
- import cookies from './cookies.js';
5
- import buildFullPath from '../core/buildFullPath.js';
6
- import mergeConfig from '../core/mergeConfig.js';
7
- import AxiosHeaders from '../core/AxiosHeaders.js';
8
- import buildURL from './buildURL.js';
9
-
10
- const resolveConfig = (config) => {
11
- const newConfig = mergeConfig({}, config);
12
-
13
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
14
-
15
- newConfig.headers = headers = AxiosHeaders.from(headers);
16
-
17
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
18
-
19
- // HTTP basic authentication
20
- if (auth) {
21
- headers.set('Authorization', 'Basic ' +
22
- btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
23
- );
24
- }
25
-
26
- let contentType;
27
-
28
- if (utils.isFormData(data)) {
29
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
30
- headers.setContentType(undefined); // Let the browser set it
31
- } else if ((contentType = headers.getContentType()) !== false) {
32
- // fix semicolon duplication issue for ReactNative FormData implementation
33
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
34
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
35
- }
36
- }
37
-
38
- // Add xsrf header
39
- // This is only done if running in a standard browser environment.
40
- // Specifically not if we're in a web worker, or react-native.
41
-
42
- if (platform.hasStandardBrowserEnv) {
43
- withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
44
-
45
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
46
- // Add xsrf header
47
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
48
-
49
- if (xsrfValue) {
50
- headers.set(xsrfHeaderName, xsrfValue);
51
- }
52
- }
53
- }
54
-
55
- return newConfig;
56
- };
57
-
58
- export { resolveConfig as default };
@@ -1,53 +0,0 @@
1
- /**
2
- * Calculate data maxRate
3
- * @param {Number} [samplesCount= 10]
4
- * @param {Number} [min= 1000]
5
- * @returns {Function}
6
- */
7
- function speedometer(samplesCount, min) {
8
- samplesCount = samplesCount || 10;
9
- const bytes = new Array(samplesCount);
10
- const timestamps = new Array(samplesCount);
11
- let head = 0;
12
- let tail = 0;
13
- let firstSampleTS;
14
-
15
- min = min !== undefined ? min : 1000;
16
-
17
- return function push(chunkLength) {
18
- const now = Date.now();
19
-
20
- const startedAt = timestamps[tail];
21
-
22
- if (!firstSampleTS) {
23
- firstSampleTS = now;
24
- }
25
-
26
- bytes[head] = chunkLength;
27
- timestamps[head] = now;
28
-
29
- let i = tail;
30
- let bytesCount = 0;
31
-
32
- while (i !== head) {
33
- bytesCount += bytes[i++];
34
- i = i % samplesCount;
35
- }
36
-
37
- head = (head + 1) % samplesCount;
38
-
39
- if (head === tail) {
40
- tail = (tail + 1) % samplesCount;
41
- }
42
-
43
- if (now - firstSampleTS < min) {
44
- return;
45
- }
46
-
47
- const passed = startedAt && now - startedAt;
48
-
49
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
50
- };
51
- }
52
-
53
- export { speedometer as default };
@@ -1,28 +0,0 @@
1
- /**
2
- * Syntactic sugar for invoking a function and expanding an array for arguments.
3
- *
4
- * Common use case would be to use `Function.prototype.apply`.
5
- *
6
- * ```js
7
- * function f(x, y, z) {}
8
- * var args = [1, 2, 3];
9
- * f.apply(null, args);
10
- * ```
11
- *
12
- * With `spread` this example can be re-written.
13
- *
14
- * ```js
15
- * spread(function(x, y, z) {})([1, 2, 3]);
16
- * ```
17
- *
18
- * @param {Function} callback
19
- *
20
- * @returns {Function}
21
- */
22
- function spread(callback) {
23
- return function wrap(arr) {
24
- return callback.apply(null, arr);
25
- };
26
- }
27
-
28
- export { spread as default };
@@ -1,44 +0,0 @@
1
- /**
2
- * Throttle decorator
3
- * @param {Function} fn
4
- * @param {Number} freq
5
- * @return {Function}
6
- */
7
- function throttle(fn, freq) {
8
- let timestamp = 0;
9
- let threshold = 1000 / freq;
10
- let lastArgs;
11
- let timer;
12
-
13
- const invoke = (args, now = Date.now()) => {
14
- timestamp = now;
15
- lastArgs = null;
16
- if (timer) {
17
- clearTimeout(timer);
18
- timer = null;
19
- }
20
- fn(...args);
21
- };
22
-
23
- const throttled = (...args) => {
24
- const now = Date.now();
25
- const passed = now - timestamp;
26
- if ( passed >= threshold) {
27
- invoke(args, now);
28
- } else {
29
- lastArgs = args;
30
- if (!timer) {
31
- timer = setTimeout(() => {
32
- timer = null;
33
- invoke(lastArgs);
34
- }, threshold - passed);
35
- }
36
- }
37
- };
38
-
39
- const flush = () => lastArgs && invoke(lastArgs);
40
-
41
- return [throttled, flush];
42
- }
43
-
44
- export { throttle as default };
@@ -1,219 +0,0 @@
1
- import utils from '../utils.js';
2
- import AxiosError from '../core/AxiosError.js';
3
-
4
- /**
5
- * Determines if the given thing is a array or js object.
6
- *
7
- * @param {string} thing - The object or array to be visited.
8
- *
9
- * @returns {boolean}
10
- */
11
- function isVisitable(thing) {
12
- return utils.isPlainObject(thing) || utils.isArray(thing);
13
- }
14
-
15
- /**
16
- * It removes the brackets from the end of a string
17
- *
18
- * @param {string} key - The key of the parameter.
19
- *
20
- * @returns {string} the key without the brackets.
21
- */
22
- function removeBrackets(key) {
23
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
24
- }
25
-
26
- /**
27
- * It takes a path, a key, and a boolean, and returns a string
28
- *
29
- * @param {string} path - The path to the current key.
30
- * @param {string} key - The key of the current object being iterated over.
31
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
32
- *
33
- * @returns {string} The path to the current key.
34
- */
35
- function renderKey(path, key, dots) {
36
- if (!path) return key;
37
- return path.concat(key).map(function each(token, i) {
38
- // eslint-disable-next-line no-param-reassign
39
- token = removeBrackets(token);
40
- return !dots && i ? '[' + token + ']' : token;
41
- }).join(dots ? '.' : '');
42
- }
43
-
44
- /**
45
- * If the array is an array and none of its elements are visitable, then it's a flat array.
46
- *
47
- * @param {Array<any>} arr - The array to check
48
- *
49
- * @returns {boolean}
50
- */
51
- function isFlatArray(arr) {
52
- return utils.isArray(arr) && !arr.some(isVisitable);
53
- }
54
-
55
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
56
- return /^is[A-Z]/.test(prop);
57
- });
58
-
59
- /**
60
- * Convert a data object to FormData
61
- *
62
- * @param {Object} obj
63
- * @param {?Object} [formData]
64
- * @param {?Object} [options]
65
- * @param {Function} [options.visitor]
66
- * @param {Boolean} [options.metaTokens = true]
67
- * @param {Boolean} [options.dots = false]
68
- * @param {?Boolean} [options.indexes = false]
69
- *
70
- * @returns {Object}
71
- **/
72
-
73
- /**
74
- * It converts an object into a FormData object
75
- *
76
- * @param {Object<any, any>} obj - The object to convert to form data.
77
- * @param {string} formData - The FormData object to append to.
78
- * @param {Object<string, any>} options
79
- *
80
- * @returns
81
- */
82
- function toFormData(obj, formData, options) {
83
- if (!utils.isObject(obj)) {
84
- throw new TypeError('target must be an object');
85
- }
86
-
87
- // eslint-disable-next-line no-param-reassign
88
- formData = formData || new (FormData)();
89
-
90
- // eslint-disable-next-line no-param-reassign
91
- options = utils.toFlatObject(options, {
92
- metaTokens: true,
93
- dots: false,
94
- indexes: false
95
- }, false, function defined(option, source) {
96
- // eslint-disable-next-line no-eq-null,eqeqeq
97
- return !utils.isUndefined(source[option]);
98
- });
99
-
100
- const metaTokens = options.metaTokens;
101
- // eslint-disable-next-line no-use-before-define
102
- const visitor = options.visitor || defaultVisitor;
103
- const dots = options.dots;
104
- const indexes = options.indexes;
105
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
106
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
107
-
108
- if (!utils.isFunction(visitor)) {
109
- throw new TypeError('visitor must be a function');
110
- }
111
-
112
- function convertValue(value) {
113
- if (value === null) return '';
114
-
115
- if (utils.isDate(value)) {
116
- return value.toISOString();
117
- }
118
-
119
- if (utils.isBoolean(value)) {
120
- return value.toString();
121
- }
122
-
123
- if (!useBlob && utils.isBlob(value)) {
124
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
125
- }
126
-
127
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
128
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
129
- }
130
-
131
- return value;
132
- }
133
-
134
- /**
135
- * Default visitor.
136
- *
137
- * @param {*} value
138
- * @param {String|Number} key
139
- * @param {Array<String|Number>} path
140
- * @this {FormData}
141
- *
142
- * @returns {boolean} return true to visit the each prop of the value recursively
143
- */
144
- function defaultVisitor(value, key, path) {
145
- let arr = value;
146
-
147
- if (value && !path && typeof value === 'object') {
148
- if (utils.endsWith(key, '{}')) {
149
- // eslint-disable-next-line no-param-reassign
150
- key = metaTokens ? key : key.slice(0, -2);
151
- // eslint-disable-next-line no-param-reassign
152
- value = JSON.stringify(value);
153
- } else if (
154
- (utils.isArray(value) && isFlatArray(value)) ||
155
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
156
- )) {
157
- // eslint-disable-next-line no-param-reassign
158
- key = removeBrackets(key);
159
-
160
- arr.forEach(function each(el, index) {
161
- !(utils.isUndefined(el) || el === null) && formData.append(
162
- // eslint-disable-next-line no-nested-ternary
163
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
164
- convertValue(el)
165
- );
166
- });
167
- return false;
168
- }
169
- }
170
-
171
- if (isVisitable(value)) {
172
- return true;
173
- }
174
-
175
- formData.append(renderKey(path, key, dots), convertValue(value));
176
-
177
- return false;
178
- }
179
-
180
- const stack = [];
181
-
182
- const exposedHelpers = Object.assign(predicates, {
183
- defaultVisitor,
184
- convertValue,
185
- isVisitable
186
- });
187
-
188
- function build(value, path) {
189
- if (utils.isUndefined(value)) return;
190
-
191
- if (stack.indexOf(value) !== -1) {
192
- throw Error('Circular reference detected in ' + path.join('.'));
193
- }
194
-
195
- stack.push(value);
196
-
197
- utils.forEach(value, function each(el, key) {
198
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
199
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
200
- );
201
-
202
- if (result === true) {
203
- build(el, path ? path.concat(key) : [key]);
204
- }
205
- });
206
-
207
- stack.pop();
208
- }
209
-
210
- if (!utils.isObject(obj)) {
211
- throw new TypeError('data must be an object');
212
- }
213
-
214
- build(obj);
215
-
216
- return formData;
217
- }
218
-
219
- export { toFormData as default };
@@ -1,19 +0,0 @@
1
- import utils from '../utils.js';
2
- import toFormData from './toFormData.js';
3
- import platform from '../platform/index.js';
4
-
5
- function toURLEncodedForm(data, options) {
6
- return toFormData(data, new platform.classes.URLSearchParams(), {
7
- visitor: function(value, key, path, helpers) {
8
- if (platform.isNode && utils.isBuffer(value)) {
9
- this.append(key, value.toString('base64'));
10
- return false;
11
- }
12
-
13
- return helpers.defaultVisitor.apply(this, arguments);
14
- },
15
- ...options
16
- });
17
- }
18
-
19
- export { toURLEncodedForm as default };
@@ -1,88 +0,0 @@
1
- const streamChunk = function* (chunk, chunkSize) {
2
- let len = chunk.byteLength;
3
-
4
- if (len < chunkSize) {
5
- yield chunk;
6
- return;
7
- }
8
-
9
- let pos = 0;
10
- let end;
11
-
12
- while (pos < len) {
13
- end = pos + chunkSize;
14
- yield chunk.slice(pos, end);
15
- pos = end;
16
- }
17
- };
18
-
19
- const readBytes = async function* (iterable, chunkSize) {
20
- for await (const chunk of readStream(iterable)) {
21
- yield* streamChunk(chunk, chunkSize);
22
- }
23
- };
24
-
25
- const readStream = async function* (stream) {
26
- if (stream[Symbol.asyncIterator]) {
27
- yield* stream;
28
- return;
29
- }
30
-
31
- const reader = stream.getReader();
32
- try {
33
- for (;;) {
34
- const {done, value} = await reader.read();
35
- if (done) {
36
- break;
37
- }
38
- yield value;
39
- }
40
- } finally {
41
- await reader.cancel();
42
- }
43
- };
44
-
45
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
46
- const iterator = readBytes(stream, chunkSize);
47
-
48
- let bytes = 0;
49
- let done;
50
- let _onFinish = (e) => {
51
- if (!done) {
52
- done = true;
53
- onFinish && onFinish(e);
54
- }
55
- };
56
-
57
- return new ReadableStream({
58
- async pull(controller) {
59
- try {
60
- const {done, value} = await iterator.next();
61
-
62
- if (done) {
63
- _onFinish();
64
- controller.close();
65
- return;
66
- }
67
-
68
- let len = value.byteLength;
69
- if (onProgress) {
70
- let loadedBytes = bytes += len;
71
- onProgress(loadedBytes);
72
- }
73
- controller.enqueue(new Uint8Array(value));
74
- } catch (err) {
75
- _onFinish(err);
76
- throw err;
77
- }
78
- },
79
- cancel(reason) {
80
- _onFinish(reason);
81
- return iterator.return();
82
- }
83
- }, {
84
- highWaterMark: 2
85
- })
86
- };
87
-
88
- export { readBytes, streamChunk, trackStream };