@commercetools-frontend-extensions/operations 0.0.0-canary-20251209161906

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 (180) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +178 -0
  3. package/babel.config.js +6 -0
  4. package/dist/commercetools-frontend-extensions-operations.cjs.d.ts +2 -0
  5. package/dist/commercetools-frontend-extensions-operations.cjs.dev.js +3273 -0
  6. package/dist/commercetools-frontend-extensions-operations.cjs.js +7 -0
  7. package/dist/commercetools-frontend-extensions-operations.cjs.prod.js +3265 -0
  8. package/dist/commercetools-frontend-extensions-operations.esm.js +3074 -0
  9. package/dist/declarations/src/@api/export-operations.d.ts +5 -0
  10. package/dist/declarations/src/@api/fetcher.d.ts +17 -0
  11. package/dist/declarations/src/@api/file-import-jobs.d.ts +7 -0
  12. package/dist/declarations/src/@api/file-upload.d.ts +3 -0
  13. package/dist/declarations/src/@api/import-containers.d.ts +35 -0
  14. package/dist/declarations/src/@api/import-operations.d.ts +6 -0
  15. package/dist/declarations/src/@api/index.d.ts +9 -0
  16. package/dist/declarations/src/@api/process-file.d.ts +3 -0
  17. package/dist/declarations/src/@api/test-fixtures.d.ts +279 -0
  18. package/dist/declarations/src/@api/urls.d.ts +74 -0
  19. package/dist/declarations/src/@components/file-drop-area/active-drag-drop-area.d.ts +10 -0
  20. package/dist/declarations/src/@components/file-drop-area/disabled-drop-area.d.ts +5 -0
  21. package/dist/declarations/src/@components/file-drop-area/drop-area-wrapper.d.ts +11 -0
  22. package/dist/declarations/src/@components/file-drop-area/enabled-drop-area.d.ts +7 -0
  23. package/dist/declarations/src/@components/file-drop-area/file-drop-area.d.ts +14 -0
  24. package/dist/declarations/src/@components/file-drop-area/file-dropped-area.d.ts +6 -0
  25. package/dist/declarations/src/@components/file-drop-area/index.d.ts +7 -0
  26. package/dist/declarations/src/@components/file-drop-area/styles.d.ts +9 -0
  27. package/dist/declarations/src/@components/icons/file-icon.d.ts +2 -0
  28. package/dist/declarations/src/@components/icons/index.d.ts +2 -0
  29. package/dist/declarations/src/@components/icons/lock-icon.d.ts +2 -0
  30. package/dist/declarations/src/@components/index.d.ts +6 -0
  31. package/dist/declarations/src/@components/info-box/index.d.ts +1 -0
  32. package/dist/declarations/src/@components/info-box/info-box.d.ts +7 -0
  33. package/dist/declarations/src/@components/upload-separator/index.d.ts +1 -0
  34. package/dist/declarations/src/@components/upload-separator/upload-separator.d.ts +12 -0
  35. package/dist/declarations/src/@components/upload-settings/index.d.ts +1 -0
  36. package/dist/declarations/src/@components/upload-settings/upload-settings.d.ts +11 -0
  37. package/dist/declarations/src/@components/uploading-modal/index.d.ts +1 -0
  38. package/dist/declarations/src/@components/uploading-modal/uploading-modal.d.ts +13 -0
  39. package/dist/declarations/src/@constants/delimiters.d.ts +8 -0
  40. package/dist/declarations/src/@constants/file-import-job.d.ts +1 -0
  41. package/dist/declarations/src/@constants/import-limits.d.ts +6 -0
  42. package/dist/declarations/src/@constants/import-tags.d.ts +7 -0
  43. package/dist/declarations/src/@constants/index.d.ts +5 -0
  44. package/dist/declarations/src/@constants/resource-links.d.ts +10 -0
  45. package/dist/declarations/src/@errors/http-error.d.ts +6 -0
  46. package/dist/declarations/src/@errors/index.d.ts +9 -0
  47. package/dist/declarations/src/@errors/invalid-response-error.d.ts +3 -0
  48. package/dist/declarations/src/@errors/no-resources-to-export-error.d.ts +3 -0
  49. package/dist/declarations/src/@errors/polling-aborted-error.d.ts +3 -0
  50. package/dist/declarations/src/@errors/project-key-not-available-error.d.ts +3 -0
  51. package/dist/declarations/src/@errors/query-predicate-error.d.ts +4 -0
  52. package/dist/declarations/src/@errors/unexpected-column-error.d.ts +3 -0
  53. package/dist/declarations/src/@errors/unexpected-operation-state-error.d.ts +4 -0
  54. package/dist/declarations/src/@errors/unexpected-resource-type-error.d.ts +3 -0
  55. package/dist/declarations/src/@hooks/index.d.ts +8 -0
  56. package/dist/declarations/src/@hooks/use-fetch-export-operations.d.ts +15 -0
  57. package/dist/declarations/src/@hooks/use-fetch-file-import-job.d.ts +17 -0
  58. package/dist/declarations/src/@hooks/use-fetch-import-container-details.d.ts +15 -0
  59. package/dist/declarations/src/@hooks/use-fetch-import-operations.d.ts +16 -0
  60. package/dist/declarations/src/@hooks/use-fetch-import-summaries.d.ts +20 -0
  61. package/dist/declarations/src/@hooks/use-file-import-job-upload.d.ts +18 -0
  62. package/dist/declarations/src/@hooks/use-file-upload.d.ts +28 -0
  63. package/dist/declarations/src/@hooks/use-import-container-upload.d.ts +19 -0
  64. package/dist/declarations/src/@types/api.d.ts +13 -0
  65. package/dist/declarations/src/@types/basic-error-data-type.d.ts +5 -0
  66. package/dist/declarations/src/@types/export-operation.d.ts +97 -0
  67. package/dist/declarations/src/@types/file-import-job.d.ts +99 -0
  68. package/dist/declarations/src/@types/file-upload-result.d.ts +21 -0
  69. package/dist/declarations/src/@types/file-upload.d.ts +63 -0
  70. package/dist/declarations/src/@types/import-container.d.ts +53 -0
  71. package/dist/declarations/src/@types/import-operation.d.ts +13 -0
  72. package/dist/declarations/src/@types/import-states.d.ts +9 -0
  73. package/dist/declarations/src/@types/import-summary.d.ts +15 -0
  74. package/dist/declarations/src/@types/index.d.ts +11 -0
  75. package/dist/declarations/src/@types/shared.d.ts +7 -0
  76. package/dist/declarations/src/@utils/error-mapping.d.ts +19 -0
  77. package/dist/declarations/src/@utils/file-import-job-helpers.d.ts +12 -0
  78. package/dist/declarations/src/@utils/file-upload.d.ts +54 -0
  79. package/dist/declarations/src/@utils/form.d.ts +1 -0
  80. package/dist/declarations/src/@utils/format.d.ts +5 -0
  81. package/dist/declarations/src/@utils/import-container.d.ts +8 -0
  82. package/dist/declarations/src/@utils/index.d.ts +8 -0
  83. package/dist/declarations/src/@utils/poll-job-until-validated.d.ts +11 -0
  84. package/dist/declarations/src/@utils/url.d.ts +6 -0
  85. package/dist/declarations/src/index.d.ts +26 -0
  86. package/index.js +1 -0
  87. package/jest.test.config.js +11 -0
  88. package/package.json +62 -0
  89. package/src/@api/export-operations.ts +26 -0
  90. package/src/@api/fetcher.spec.ts +51 -0
  91. package/src/@api/fetcher.ts +137 -0
  92. package/src/@api/file-import-jobs.ts +217 -0
  93. package/src/@api/file-upload.spec.ts +85 -0
  94. package/src/@api/file-upload.ts +46 -0
  95. package/src/@api/import-containers.ts +256 -0
  96. package/src/@api/import-operations.ts +33 -0
  97. package/src/@api/index.ts +9 -0
  98. package/src/@api/process-file.spec.ts +74 -0
  99. package/src/@api/process-file.ts +53 -0
  100. package/src/@api/test-fixtures.ts +894 -0
  101. package/src/@api/urls.ts +194 -0
  102. package/src/@components/file-drop-area/active-drag-drop-area.tsx +33 -0
  103. package/src/@components/file-drop-area/disabled-drop-area.tsx +17 -0
  104. package/src/@components/file-drop-area/drop-area-wrapper.tsx +38 -0
  105. package/src/@components/file-drop-area/enabled-drop-area.tsx +27 -0
  106. package/src/@components/file-drop-area/file-drop-area.tsx +74 -0
  107. package/src/@components/file-drop-area/file-dropped-area.tsx +29 -0
  108. package/src/@components/file-drop-area/index.ts +7 -0
  109. package/src/@components/file-drop-area/styles.ts +67 -0
  110. package/src/@components/icons/file-icon.tsx +30 -0
  111. package/src/@components/icons/index.ts +2 -0
  112. package/src/@components/icons/lock-icon.tsx +34 -0
  113. package/src/@components/index.ts +6 -0
  114. package/src/@components/info-box/index.ts +1 -0
  115. package/src/@components/info-box/info-box.tsx +23 -0
  116. package/src/@components/upload-separator/index.ts +1 -0
  117. package/src/@components/upload-separator/upload-separator.tsx +61 -0
  118. package/src/@components/upload-settings/index.ts +1 -0
  119. package/src/@components/upload-settings/upload-settings.tsx +36 -0
  120. package/src/@components/uploading-modal/index.ts +1 -0
  121. package/src/@components/uploading-modal/uploading-modal.tsx +66 -0
  122. package/src/@constants/delimiters.ts +14 -0
  123. package/src/@constants/file-import-job.ts +1 -0
  124. package/src/@constants/import-limits.ts +13 -0
  125. package/src/@constants/import-tags.ts +9 -0
  126. package/src/@constants/index.ts +5 -0
  127. package/src/@constants/resource-links.ts +61 -0
  128. package/src/@errors/http-error.ts +17 -0
  129. package/src/@errors/index.ts +9 -0
  130. package/src/@errors/invalid-response-error.ts +6 -0
  131. package/src/@errors/no-resources-to-export-error.ts +6 -0
  132. package/src/@errors/polling-aborted-error.ts +6 -0
  133. package/src/@errors/project-key-not-available-error.ts +6 -0
  134. package/src/@errors/query-predicate-error.ts +10 -0
  135. package/src/@errors/unexpected-column-error.ts +6 -0
  136. package/src/@errors/unexpected-operation-state-error.ts +8 -0
  137. package/src/@errors/unexpected-resource-type-error.ts +6 -0
  138. package/src/@hooks/index.ts +8 -0
  139. package/src/@hooks/use-fetch-export-operations.ts +34 -0
  140. package/src/@hooks/use-fetch-file-import-job.spec.ts +131 -0
  141. package/src/@hooks/use-fetch-file-import-job.ts +38 -0
  142. package/src/@hooks/use-fetch-import-container-details.ts +31 -0
  143. package/src/@hooks/use-fetch-import-operations.ts +42 -0
  144. package/src/@hooks/use-fetch-import-summaries.ts +47 -0
  145. package/src/@hooks/use-fetch.spec.ts +68 -0
  146. package/src/@hooks/use-fetch.ts +76 -0
  147. package/src/@hooks/use-file-import-job-upload.spec.ts +273 -0
  148. package/src/@hooks/use-file-import-job-upload.ts +101 -0
  149. package/src/@hooks/use-file-upload.ts +223 -0
  150. package/src/@hooks/use-import-container-upload.spec.ts +297 -0
  151. package/src/@hooks/use-import-container-upload.ts +130 -0
  152. package/src/@types/api.ts +14 -0
  153. package/src/@types/basic-error-data-type.ts +5 -0
  154. package/src/@types/export-operation.ts +147 -0
  155. package/src/@types/file-import-job.ts +165 -0
  156. package/src/@types/file-upload-result.ts +23 -0
  157. package/src/@types/file-upload.ts +81 -0
  158. package/src/@types/import-container.ts +104 -0
  159. package/src/@types/import-operation.ts +31 -0
  160. package/src/@types/import-states.ts +9 -0
  161. package/src/@types/import-summary.ts +22 -0
  162. package/src/@types/index.ts +11 -0
  163. package/src/@types/shared.ts +52 -0
  164. package/src/@utils/error-mapping.spec.ts +126 -0
  165. package/src/@utils/error-mapping.ts +40 -0
  166. package/src/@utils/file-import-job-helpers.spec.ts +147 -0
  167. package/src/@utils/file-import-job-helpers.ts +47 -0
  168. package/src/@utils/file-upload.spec.ts +151 -0
  169. package/src/@utils/file-upload.ts +189 -0
  170. package/src/@utils/form.ts +20 -0
  171. package/src/@utils/format.spec.ts +62 -0
  172. package/src/@utils/format.ts +53 -0
  173. package/src/@utils/import-container.spec.ts +26 -0
  174. package/src/@utils/import-container.ts +34 -0
  175. package/src/@utils/index.ts +8 -0
  176. package/src/@utils/poll-job-until-validated.ts +76 -0
  177. package/src/@utils/url.spec.ts +75 -0
  178. package/src/@utils/url.ts +18 -0
  179. package/src/index.ts +27 -0
  180. package/tsconfig.json +9 -0
@@ -0,0 +1,3273 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
6
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
7
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
8
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
9
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
12
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
13
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
14
+ var applicationShell = require('@commercetools-frontend/application-shell');
15
+ var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
16
+ var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
17
+ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
18
+ var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
19
+ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
20
+ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
21
+ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
22
+ var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
23
+ var constants = require('@commercetools-frontend/constants');
24
+ var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
25
+ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
26
+ var pluralize = require('pluralize');
27
+ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
28
+ var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
29
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
30
+ var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
31
+ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
32
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
33
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
34
+ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
35
+ var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
36
+ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
37
+ var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
38
+ var Papa = require('papaparse');
39
+ var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
40
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
41
+ var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
42
+ var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
43
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
44
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
45
+ var _URLSearchParams = require('@babel/runtime-corejs3/core-js-stable/url-search-params');
46
+ var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
47
+ var uiKit = require('@commercetools-frontend/ui-kit');
48
+ var React = require('react');
49
+ var jsxRuntime = require('react/jsx-runtime');
50
+ var react = require('@emotion/react');
51
+ var _styled = require('@emotion/styled/base');
52
+ var reactDropzone = require('react-dropzone');
53
+ var applicationComponents = require('@commercetools-frontend/application-components');
54
+ var _setInterval = require('@babel/runtime-corejs3/core-js-stable/set-interval');
55
+ var sentry = require('@commercetools-frontend/sentry');
56
+
57
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
58
+
59
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
60
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
61
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
62
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
63
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
64
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
65
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
66
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
67
+ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
68
+ var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
69
+ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
70
+ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
71
+ var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
72
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
73
+ var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
74
+ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
75
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
76
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
77
+ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
78
+ var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
79
+ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
80
+ var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
81
+ var Papa__default = /*#__PURE__*/_interopDefault(Papa);
82
+ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
83
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
84
+ var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
85
+ var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
86
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
87
+ var _URLSearchParams__default = /*#__PURE__*/_interopDefault(_URLSearchParams);
88
+ var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
89
+ var React__default = /*#__PURE__*/_interopDefault(React);
90
+ var _styled__default = /*#__PURE__*/_interopDefault(_styled);
91
+ var _setInterval__default = /*#__PURE__*/_interopDefault(_setInterval);
92
+
93
+ function _callSuper$8(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$8() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
94
+ function _isNativeReflectConstruct$8() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$8 = function () { return !!t; })(); }
95
+ let HttpError = /*#__PURE__*/function (_Error) {
96
+ function HttpError(statusCode, statusText, errorData) {
97
+ var _this;
98
+ _classCallCheck(this, HttpError);
99
+ _this = _callSuper$8(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
100
+ _this.statusCode = void 0;
101
+ _this.errorData = void 0;
102
+ _this.name = 'HttpError';
103
+ _this.statusCode = statusCode;
104
+ _this.errorData = errorData;
105
+ return _this;
106
+ }
107
+ _inherits(HttpError, _Error);
108
+ return _createClass(HttpError);
109
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
110
+
111
+ function _callSuper$7(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$7() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
112
+ function _isNativeReflectConstruct$7() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$7 = function () { return !!t; })(); }
113
+ let InvalidResponseError = /*#__PURE__*/function (_Error) {
114
+ function InvalidResponseError(message) {
115
+ var _this;
116
+ _classCallCheck(this, InvalidResponseError);
117
+ _this = _callSuper$7(this, InvalidResponseError, [message]);
118
+ _this.name = 'InvalidResponseError';
119
+ return _this;
120
+ }
121
+ _inherits(InvalidResponseError, _Error);
122
+ return _createClass(InvalidResponseError);
123
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
124
+
125
+ function _callSuper$6(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$6() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
126
+ function _isNativeReflectConstruct$6() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$6 = function () { return !!t; })(); }
127
+ let NoResourcesToExportError = /*#__PURE__*/function (_Error) {
128
+ function NoResourcesToExportError() {
129
+ var _this;
130
+ let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'There are no resources to export.';
131
+ _classCallCheck(this, NoResourcesToExportError);
132
+ _this = _callSuper$6(this, NoResourcesToExportError, [message]);
133
+ _this.name = 'NoResourcesToExportError';
134
+ return _this;
135
+ }
136
+ _inherits(NoResourcesToExportError, _Error);
137
+ return _createClass(NoResourcesToExportError);
138
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
139
+
140
+ function _callSuper$5(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$5() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
141
+ function _isNativeReflectConstruct$5() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$5 = function () { return !!t; })(); }
142
+ let PollingAbortedError = /*#__PURE__*/function (_Error) {
143
+ function PollingAbortedError() {
144
+ var _this;
145
+ _classCallCheck(this, PollingAbortedError);
146
+ _this = _callSuper$5(this, PollingAbortedError, ['Polling was aborted']);
147
+ _this.name = 'PollingAbortedError';
148
+ return _this;
149
+ }
150
+ _inherits(PollingAbortedError, _Error);
151
+ return _createClass(PollingAbortedError);
152
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
153
+
154
+ function _callSuper$4(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$4() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
155
+ function _isNativeReflectConstruct$4() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$4 = function () { return !!t; })(); }
156
+ let ProjectKeyNotAvailableError = /*#__PURE__*/function (_Error) {
157
+ function ProjectKeyNotAvailableError() {
158
+ var _this;
159
+ let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Project key is not available';
160
+ _classCallCheck(this, ProjectKeyNotAvailableError);
161
+ _this = _callSuper$4(this, ProjectKeyNotAvailableError, [message]);
162
+ _this.name = 'ProjectKeyNotAvailableError';
163
+ return _this;
164
+ }
165
+ _inherits(ProjectKeyNotAvailableError, _Error);
166
+ return _createClass(ProjectKeyNotAvailableError);
167
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
168
+
169
+ function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
170
+ function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
171
+ let QueryPredicateError = /*#__PURE__*/function (_Error) {
172
+ function QueryPredicateError() {
173
+ var _this;
174
+ let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'There is an error with the query predicate. Make sure the syntax is correct.';
175
+ _classCallCheck(this, QueryPredicateError);
176
+ _this = _callSuper$3(this, QueryPredicateError, [message]);
177
+ _this.field = 'queryPredicate';
178
+ _this.name = 'QueryPredicateError';
179
+ return _this;
180
+ }
181
+ _inherits(QueryPredicateError, _Error);
182
+ return _createClass(QueryPredicateError);
183
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
184
+
185
+ function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
186
+ function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
187
+ let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
188
+ function UnexpectedColumnError(columnName) {
189
+ var _this;
190
+ _classCallCheck(this, UnexpectedColumnError);
191
+ _this = _callSuper$2(this, UnexpectedColumnError, [`Unexpected column "${columnName}"`]);
192
+ _this.name = 'UnexpectedColumnError';
193
+ return _this;
194
+ }
195
+ _inherits(UnexpectedColumnError, _Error);
196
+ return _createClass(UnexpectedColumnError);
197
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
198
+
199
+ function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
200
+ function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
201
+ let UnexpectedOperationStateError = /*#__PURE__*/function (_Error) {
202
+ function UnexpectedOperationStateError(state) {
203
+ var _this;
204
+ _classCallCheck(this, UnexpectedOperationStateError);
205
+ _this = _callSuper$1(this, UnexpectedOperationStateError, [`Unexpected operation state "${state}"`]);
206
+ _this.name = 'UnexpectedOperationStateError';
207
+ return _this;
208
+ }
209
+ _inherits(UnexpectedOperationStateError, _Error);
210
+ return _createClass(UnexpectedOperationStateError);
211
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
212
+
213
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
214
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
215
+ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
216
+ function UnexpectedResourceTypeError(resourceType) {
217
+ var _this;
218
+ _classCallCheck(this, UnexpectedResourceTypeError);
219
+ _this = _callSuper(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
220
+ _this.name = 'UnexpectedResourceTypeError';
221
+ return _this;
222
+ }
223
+ _inherits(UnexpectedResourceTypeError, _Error);
224
+ return _createClass(UnexpectedResourceTypeError);
225
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
226
+
227
+ function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
228
+ function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$9(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
229
+ const addProxyPrefixToUrl = (uri, proxy) => {
230
+ return proxy ? `/proxy/${proxy}${uri}` : uri;
231
+ };
232
+ const fetcher = async _ref => {
233
+ let url = _ref.url,
234
+ payload = _ref.payload,
235
+ config = _ref.config;
236
+ const data = await applicationShell.executeHttpClientRequest(async options => {
237
+ const res = await fetch(applicationShell.buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), _objectSpread$9(_objectSpread$9({}, options), {}, {
238
+ method: config?.method,
239
+ body: payload,
240
+ signal: config?.abortSignal
241
+ }));
242
+ if (!res.ok) {
243
+ const errorData = await res.json();
244
+ throw new HttpError(res.status, res.statusText, errorData);
245
+ }
246
+ const data = res.json();
247
+ return {
248
+ data,
249
+ statusCode: res.status,
250
+ getHeader: key => res.headers.get(key)
251
+ };
252
+ }, {
253
+ headers: _objectSpread$9({
254
+ 'Content-Type': 'application/json'
255
+ }, config?.headers)
256
+ });
257
+ return data;
258
+ };
259
+ const fetchUsingXhr = _ref2 => {
260
+ let url = _ref2.url,
261
+ payload = _ref2.payload,
262
+ config = _ref2.config,
263
+ onProgress = _ref2.onProgress,
264
+ onSuccess = _ref2.onSuccess,
265
+ onError = _ref2.onError;
266
+ const options = applicationShell.createHttpClientOptions({
267
+ headers: _objectSpread$9({
268
+ 'Content-Type': 'application/json'
269
+ }, config?.headers)
270
+ });
271
+ const xhr = new XMLHttpRequest();
272
+ xhr.open(config?.method, applicationShell.buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
273
+ xhr.withCredentials = true;
274
+ if (options.headers) {
275
+ var _context;
276
+ _forEachInstanceProperty__default["default"](_context = _Object$keys__default["default"](options.headers)).call(_context, key => {
277
+ xhr.setRequestHeader(key, options.headers[key]);
278
+ });
279
+ }
280
+ xhr.upload.onprogress = function (event) {
281
+ if (event.lengthComputable) {
282
+ const percentComplete = event.loaded / event.total * 100;
283
+ onProgress(percentComplete);
284
+ }
285
+ };
286
+ const throwError = errorData => {
287
+ onError(new HttpError(xhr.status, xhr.statusText, errorData));
288
+ };
289
+ xhr.onload = function () {
290
+ const data = JSON.parse(xhr.responseText);
291
+ // Code copied from `executeHttpClientRequest` to replicate the same behavior
292
+ const refreshedSessionToken = xhr.getResponseHeader('x-refreshed-session-token');
293
+ if (refreshedSessionToken) {
294
+ applicationShellConnectors.oidcStorage.setActiveSession(refreshedSessionToken);
295
+ }
296
+ if (xhr.status >= 200 && xhr.status < 300) {
297
+ onSuccess(data);
298
+ } else {
299
+ throwError(data);
300
+ }
301
+ };
302
+ xhr.onerror = function () {
303
+ const errorData = JSON.parse(xhr.responseText);
304
+ throwError(errorData);
305
+ };
306
+ xhr.onabort = function () {
307
+ onError(new DOMException('Aborted', 'AbortError'));
308
+ };
309
+ if (config.abortSignal) {
310
+ if (config.abortSignal.aborted) {
311
+ xhr.abort();
312
+ } else {
313
+ config.abortSignal.addEventListener('abort', () => xhr.abort(), {
314
+ once: true
315
+ });
316
+ }
317
+ }
318
+ xhr.send(payload);
319
+ return xhr;
320
+ };
321
+
322
+ function hasOwnProperty(obj, prop) {
323
+ return typeof obj === 'object' && obj !== null && obj.hasOwnProperty(prop);
324
+ }
325
+ function hasRequiredFields(maybeValidObject, requiredFields) {
326
+ return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty__default["default"](requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
327
+ }
328
+ function getMissingRequiredFields(maybeValidObject, requiredFields) {
329
+ return typeof maybeValidObject === 'object' && maybeValidObject !== null && _filterInstanceProperty__default["default"](requiredFields).call(requiredFields, property => !(property in maybeValidObject));
330
+ }
331
+ function isError(maybeError) {
332
+ if (maybeError instanceof Error) return true;
333
+ return false;
334
+ }
335
+ function isAbortError(error) {
336
+ return error instanceof DOMException && error.name === 'AbortError';
337
+ }
338
+ function isResourceType(maybeResourceType) {
339
+ return typeof maybeResourceType === 'string';
340
+ }
341
+ function assertResourceType(maybeResourceType) {
342
+ if (typeof maybeResourceType === 'string') return;
343
+ throw new Error(`Invalid value: ${maybeResourceType}`);
344
+ }
345
+
346
+ function assertPaginatedExportOperationResponse(maybePaginatedExportOperationResponseOrExportOperationsResponse) {
347
+ const requiredFields = ['results', 'total'];
348
+ if (hasRequiredFields(maybePaginatedExportOperationResponseOrExportOperationsResponse, requiredFields)) return;
349
+ throw new Error('Invalid response');
350
+ }
351
+ function assertExportOperationsDownloadFileResponse(maybeExportOperationDownloadFileResponse) {
352
+ const requiredFields = ['uri'];
353
+ if (hasRequiredFields(maybeExportOperationDownloadFileResponse, requiredFields)) return;
354
+ throw new Error('Invalid response');
355
+ }
356
+
357
+ function assertFileImportJob(maybeJob) {
358
+ const requiredFields = ['id', 'fileName', 'importContainerKey', 'state'];
359
+ if (hasRequiredFields(maybeJob, requiredFields)) return;
360
+ throw new Error('Invalid File Import Job response');
361
+ }
362
+ function assertFileImportJobRecordsResponse(maybeRecords) {
363
+ const requiredFields = ['results', 'total', 'limit', 'offset', 'count'];
364
+ if (!hasRequiredFields(maybeRecords, requiredFields)) {
365
+ throw new Error('Invalid File Import Job records response: missing required fields');
366
+ }
367
+ }
368
+ function assertProcessFileImportJobResponse(maybeResponse) {
369
+ const requiredFields = ['message'];
370
+ if (hasRequiredFields(maybeResponse, requiredFields)) return;
371
+ throw new Error('Invalid Process File Import Job response');
372
+ }
373
+ function assertListFileImportJobsResponse(maybeResponse) {
374
+ if (!_Array$isArray__default["default"](maybeResponse)) {
375
+ throw new Error('Invalid List File Import Jobs response: expected an array');
376
+ }
377
+ if (maybeResponse.length > 0) {
378
+ const requiredFields = ['id', 'fileName', 'importContainerKey', 'state'];
379
+ if (!hasRequiredFields(maybeResponse[0], requiredFields)) {
380
+ throw new Error('Invalid List File Import Jobs response: missing required fields');
381
+ }
382
+ }
383
+ }
384
+
385
+ function assertImportContainerPagedResponse(maybeImportContainerPagedResponse) {
386
+ const requiredFields = ['count', 'results'];
387
+ if (hasRequiredFields(maybeImportContainerPagedResponse, requiredFields)) return;
388
+ throw new Error('Invalid response');
389
+ }
390
+ function assertImportSummary(maybeImportSummary) {
391
+ const requiredFields = ['states', 'total'];
392
+ if (hasRequiredFields(maybeImportSummary, requiredFields)) return;
393
+ throw new Error('Invalid response');
394
+ }
395
+ function assertImportContainer(maybeImportContainerResponse) {
396
+ const requiredFields = ['key', 'version'];
397
+ if (hasRequiredFields(maybeImportContainerResponse, requiredFields)) return;
398
+ throw new Error('Invalid response');
399
+ }
400
+ function assertCancelContainerResponse(maybeCancelContainerResponse) {
401
+ if (typeof maybeCancelContainerResponse === 'object' && maybeCancelContainerResponse !== null) {
402
+ const responseData = maybeCancelContainerResponse;
403
+ if (typeof responseData.message === 'string') {
404
+ return;
405
+ }
406
+ }
407
+ throw new Error('Invalid response');
408
+ }
409
+
410
+ // Extended types to support settings that aren't in the base SDK yet
411
+
412
+ // TODO: Remove the temporarily extended ImportOperation when the SDK is updated
413
+
414
+ // TODO: Remove the temporarily extended ImportOperationPagedResponse when the SDK is updated
415
+
416
+ function assertImportOperationPagedResponse(maybeImportOperationPagedResponse) {
417
+ const requiredFields = ['count', 'total', 'results'];
418
+ if (hasRequiredFields(maybeImportOperationPagedResponse, requiredFields)) return;
419
+ throw new Error('Invalid response');
420
+ }
421
+
422
+ let ImportStates = /*#__PURE__*/function (ImportStates) {
423
+ ImportStates["Processing"] = "processing";
424
+ ImportStates["WaitForUnresolvedReferences"] = "wait-for-unresolved-references";
425
+ ImportStates["PartiallyCompleted"] = "partially-completed";
426
+ ImportStates["Failed"] = "failed";
427
+ ImportStates["SuccessfullyCompleted"] = "successfully-completed";
428
+ ImportStates["NoRunningImports"] = "no-running-imports";
429
+ ImportStates["Canceled"] = "canceled";
430
+ return ImportStates;
431
+ }({});
432
+
433
+ function getFileUploadErrorsCount(errors) {
434
+ if (!errors || !_Array$isArray__default["default"](errors)) return 0;
435
+ return _reduceInstanceProperty__default["default"](errors).call(errors, (acc, curr) => acc += curr.errors.length, 0);
436
+ }
437
+
438
+ // TODO: After fully migrating to new flow, remove `row` and only use `index`
439
+ function mapUploadFileErrorsResponseToUploadFileErrorRows(uploadFileErrorsResponse) {
440
+ if (!uploadFileErrorsResponse || !_Array$isArray__default["default"](uploadFileErrorsResponse)) return [];
441
+ let idCounter = 1;
442
+ return _flatMapInstanceProperty__default["default"](uploadFileErrorsResponse).call(uploadFileErrorsResponse, rowErrorsResponse => {
443
+ var _context;
444
+ // TODO: use `row` if available, otherwise fall back to `index`
445
+ // Old flow uses `row`, new flow uses `index`
446
+ const rowNumber = rowErrorsResponse.row ?? rowErrorsResponse.index;
447
+ return _mapInstanceProperty__default["default"](_context = rowErrorsResponse.errors).call(_context, rowError => ({
448
+ id: String(idCounter++),
449
+ row: rowNumber,
450
+ index: rowNumber,
451
+ field: rowError.field,
452
+ code: rowError.code,
453
+ validationMessage: rowError.message
454
+ }));
455
+ });
456
+ }
457
+
458
+ function getFileImportJobFileType(resourceType) {
459
+ return resourceType === 'custom-object' ? 'json' : 'csv';
460
+ }
461
+ function toImportApiResourceType(resourceType) {
462
+ return resourceType === 'product' ? 'product-draft' : resourceType;
463
+ }
464
+ function isImportJobQueued(job) {
465
+ return job?.state === 'queued';
466
+ }
467
+ function isImportJobProcessing(job) {
468
+ return job?.state === 'processing';
469
+ }
470
+ function isImportJobValidated(job) {
471
+ return job?.state === 'validated';
472
+ }
473
+ function isImportJobInitializing(job) {
474
+ return job?.state === 'initialising';
475
+ }
476
+ function isImportJobReady(job) {
477
+ return job?.state === 'ready';
478
+ }
479
+ function isImportJobRejected(job) {
480
+ return job?.state === 'rejected';
481
+ }
482
+ function isImportJobTerminal(job) {
483
+ return isImportJobValidated(job) || isImportJobRejected(job);
484
+ }
485
+ function shouldContinuePollingForImportValidation(job) {
486
+ if (!job) return true;
487
+ return isImportJobQueued(job) || isImportJobProcessing(job);
488
+ }
489
+
490
+ function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
491
+ function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$8(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$8(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
492
+
493
+ /**
494
+ * Convert megabytes to bytes
495
+ */
496
+ const toBytes = megabytes => megabytes * 1024 * 1024;
497
+
498
+ /**
499
+ * Returns the number of rows in a CSV file excluding the header
500
+ * @param file The CSV file to process
501
+ * @returns A promise that resolves to the number of rows
502
+ */
503
+ const getRowCount = file => {
504
+ return new _Promise__default["default"](resolve => {
505
+ let lineCount = 0;
506
+ Papa__default["default"].parse(file, {
507
+ step: _ref => {
508
+ let data = _ref.data;
509
+ // empty lines at the end of the file should not be counted
510
+ if (_Array$isArray__default["default"](data) && _findInstanceProperty__default["default"](data).call(data, Boolean)) lineCount++;
511
+ },
512
+ complete: () => {
513
+ // Subtract 1 for the header row
514
+ // We use Math.max to make sure the count is not less than 0, this is needed for empty files
515
+ resolve(Math.max(0, lineCount - 1));
516
+ }
517
+ });
518
+ });
519
+ };
520
+
521
+ /**
522
+ * Check if a CSV file has a single key column
523
+ * @param file The CSV file to check
524
+ * @returns A promise that resolves to true if the file has only one column named 'key'
525
+ */
526
+ const hasSingleKeyColumn = file => {
527
+ return new _Promise__default["default"](resolve => {
528
+ Papa__default["default"].parse(file, {
529
+ preview: 1,
530
+ complete: result => {
531
+ const headerRow = result.data?.[0];
532
+ const hasSingleColumn = _Array$isArray__default["default"](headerRow) && headerRow.length === 1;
533
+ const isKeyColumn = hasSingleColumn && headerRow[0].toLowerCase() === 'key';
534
+ resolve(isKeyColumn);
535
+ }
536
+ });
537
+ });
538
+ };
539
+
540
+ /**
541
+ * Validate delimiter in a CSV file
542
+ * @param file The CSV file to validate
543
+ * @param allowedDelimiters Array of allowed delimiters
544
+ * @returns A promise that resolves to false if delimiter is invalid
545
+ */
546
+ const validateDelimiter = (file, allowedDelimiters) => {
547
+ // Delimiters not included in this array may be treated as part of a column content
548
+ // potentially causing the file to be parsed as a single-column CSV and pass this validation
549
+ const NON_ALLOWED_COLUMN_DELIMITERS = ['%', '.', ' '];
550
+ const DELIMITERS_TO_GUESS = [...allowedDelimiters, ...NON_ALLOWED_COLUMN_DELIMITERS];
551
+ return new _Promise__default["default"](resolve => {
552
+ Papa__default["default"].parse(file, {
553
+ delimitersToGuess: DELIMITERS_TO_GUESS,
554
+ preview: 10,
555
+ complete: result => {
556
+ const headerRow = result.data?.[0];
557
+ const isOnlyOneColumn = _Array$isArray__default["default"](headerRow) && headerRow.length === 1;
558
+ if (isOnlyOneColumn) {
559
+ resolve(true);
560
+ return;
561
+ }
562
+ const detectedDelimiter = result.meta.delimiter;
563
+ let isValid = false;
564
+ if (detectedDelimiter !== null && _includesInstanceProperty__default["default"](allowedDelimiters).call(allowedDelimiters, detectedDelimiter)) {
565
+ var _context;
566
+ const isUndetectableDelimiter = _someInstanceProperty__default["default"](_context = result.errors).call(_context, error => error.code === 'UndetectableDelimiter');
567
+ if (!isUndetectableDelimiter) {
568
+ isValid = true;
569
+ }
570
+ }
571
+ resolve(isValid);
572
+ }
573
+ });
574
+ });
575
+ };
576
+
577
+ /**
578
+ * Returns columns from the provided `columns` excluding those specified in the `ignoredColumns`
579
+ */
580
+ const getValidatedColumns = (columns, ignoredColumns) => {
581
+ return _filterInstanceProperty__default["default"](columns).call(columns, column => !_includesInstanceProperty__default["default"](ignoredColumns).call(ignoredColumns, column));
582
+ };
583
+
584
+ /**
585
+ * Count items in a JSON file
586
+ * @param file The JSON file to process
587
+ * @returns Object with isValid flag and optional itemsCount
588
+ */
589
+ const countJsonFileItems = async file => {
590
+ const jsonContent = await file.text();
591
+ try {
592
+ const content = JSON.parse(jsonContent);
593
+ const isValid = _Array$isArray__default["default"](content);
594
+ if (isValid) {
595
+ return {
596
+ isValid,
597
+ itemsCount: content.length
598
+ };
599
+ }
600
+ return {
601
+ isValid
602
+ };
603
+ } catch {
604
+ return {
605
+ isValid: false
606
+ };
607
+ }
608
+ };
609
+
610
+ /**
611
+ * Count unique resources in a CSV file by counting unique values in the "key" column.
612
+ * A single resource can span multiple rows (when it has array fields like variants, assets...),
613
+ * so we count unique keys rather than rows.
614
+ * @param file The CSV file to process
615
+ * @returns A promise that resolves to the number of unique resources
616
+ */
617
+ const countUniqueResourcesInCsv = file => {
618
+ return new _Promise__default["default"](resolve => {
619
+ const uniqueKeys = new _Set__default["default"]();
620
+ let keyColumnIndex = -1;
621
+ let isFirstRow = true;
622
+ Papa__default["default"].parse(file, {
623
+ step: _ref2 => {
624
+ var _context4, _context5;
625
+ let data = _ref2.data;
626
+ if (!_Array$isArray__default["default"](data)) return;
627
+ if (isFirstRow) {
628
+ keyColumnIndex = _findIndexInstanceProperty__default["default"](data).call(data, col => {
629
+ var _context2, _context3;
630
+ return ((_context2 = col?.toLowerCase()) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _trimInstanceProperty__default["default"](_context2), _context2))?.() === 'key';
631
+ });
632
+ isFirstRow = false;
633
+ return;
634
+ }
635
+ if (keyColumnIndex === -1) return;
636
+ const keyValue = ((_context4 = data[keyColumnIndex]) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _trimInstanceProperty__default["default"](_context4), _context4))?.();
637
+ if (keyValue) {
638
+ uniqueKeys.add(keyValue);
639
+ }
640
+ },
641
+ complete: () => {
642
+ resolve(uniqueKeys.size);
643
+ }
644
+ });
645
+ });
646
+ };
647
+
648
+ /**
649
+ * Map file upload errors to upload file error rows with unique IDs
650
+ * @param uploadFileErrors Array of file upload errors
651
+ * @returns Array of upload file errors with unique id field
652
+ */
653
+ const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
654
+ let idCounter = 1;
655
+ return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$8(_objectSpread$8({}, uploadFileError), {}, {
656
+ id: String(idCounter++)
657
+ }));
658
+ };
659
+
660
+ function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
661
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
662
+ const mapFormikErrors = error => {
663
+ if (typeof error === 'string') {
664
+ return {
665
+ [error]: true
666
+ };
667
+ }
668
+ if (_Array$isArray__default["default"](error)) {
669
+ return _reduceInstanceProperty__default["default"](error).call(error, (errorAggregator, currentError) => _objectSpread$7(_objectSpread$7({}, errorAggregator), {}, {
670
+ [currentError]: true
671
+ }), {});
672
+ }
673
+ if (!error) return {};
674
+ return error;
675
+ };
676
+
677
+ function formatErrorCode(code) {
678
+ try {
679
+ const formattedCode = code.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z][a-z])/g, '$1 $2').toLowerCase();
680
+ let result = formattedCode.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](formattedCode).call(formattedCode, 1);
681
+ const specialWords = ['json', 'api', 'http'];
682
+ _forEachInstanceProperty__default["default"](specialWords).call(specialWords, word => {
683
+ const regex = new RegExp(`\\b${word}\\b`, 'gi');
684
+ result = result.replace(regex, word.toUpperCase());
685
+ });
686
+ return result;
687
+ } catch (error) {
688
+ return code;
689
+ }
690
+ }
691
+ function extractErrorDescriptionFromValidationMessage(message) {
692
+ return message.split('"').pop();
693
+ }
694
+ function formatKeys(obj) {
695
+ var _context;
696
+ let conjunction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'and';
697
+ if (typeof obj !== 'object' || obj === null) return '';
698
+ const keys = _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](obj)).call(_context, key => key.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase());
699
+ if (keys.length === 0) return '';
700
+ if (keys.length === 1) return keys[0];
701
+ return `${_sliceInstanceProperty__default["default"](keys).call(keys, 0, -1).join(', ')} ${conjunction} ${keys[keys.length - 1]}`;
702
+ }
703
+ function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
704
+ const extensionRegex = /\.(csv|json)$/i;
705
+ if (!extensionRegex.test(fileName)) return `${fileName}.${fileFormat}`;
706
+ return fileName;
707
+ }
708
+ function convertFileSizeToKB(sizeInBytes) {
709
+ return sizeInBytes / 1000;
710
+ }
711
+
712
+ const encodeFileNameWithTimestampToContainerKey = fileName => {
713
+ return btoa(_JSON$stringify__default["default"]({
714
+ timestamp: new Date().getTime(),
715
+ fileName
716
+ })).replace(/=+$/g, '');
717
+ };
718
+
719
+ /**
720
+ * Check if an import container is a file upload import
721
+ * @param tags - Array of tags from the import container
722
+ * @returns True if the tags indicate this is a file upload import
723
+ */
724
+ const checkIfFileUploadImport = tags => {
725
+ var _context, _context2;
726
+ return ((_context = tags) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _someInstanceProperty__default["default"](_context), _context))?.(tag => _startsWithInstanceProperty__default["default"](tag).call(tag, 'source:file-upload')) ?? false;
727
+ };
728
+ const decodeFileNameFromImportContainerKey = importContainerKey => {
729
+ try {
730
+ const decodedImportContainerKey = atob(importContainerKey);
731
+ const importInfo = JSON.parse(decodedImportContainerKey);
732
+ return importInfo.fileName;
733
+ } catch {
734
+ return '';
735
+ }
736
+ };
737
+
738
+ const pollJobUntilValidated = async _ref => {
739
+ let projectKey = _ref.projectKey,
740
+ jobId = _ref.jobId,
741
+ importContainerKey = _ref.importContainerKey,
742
+ _ref$pollingInterval = _ref.pollingInterval,
743
+ pollingInterval = _ref$pollingInterval === void 0 ? 5000 : _ref$pollingInterval,
744
+ _ref$maxAttempts = _ref.maxAttempts,
745
+ maxAttempts = _ref$maxAttempts === void 0 ? 120 : _ref$maxAttempts,
746
+ onJobUpdate = _ref.onJobUpdate,
747
+ abortSignal = _ref.abortSignal;
748
+ let attempts = 0;
749
+ while (attempts < maxAttempts) {
750
+ if (abortSignal?.aborted) {
751
+ throw new PollingAbortedError();
752
+ }
753
+ const job = await getFileImportJob({
754
+ projectKey,
755
+ importContainerKey,
756
+ jobId
757
+ });
758
+ if (abortSignal?.aborted) {
759
+ throw new PollingAbortedError();
760
+ }
761
+ onJobUpdate?.(job);
762
+ if (isImportJobTerminal(job)) {
763
+ return job;
764
+ }
765
+ await new _Promise__default["default"]((resolve, reject) => {
766
+ let timeoutId;
767
+ const onAbort = () => {
768
+ clearTimeout(timeoutId);
769
+ reject(new PollingAbortedError());
770
+ };
771
+ if (abortSignal?.aborted) {
772
+ reject(new PollingAbortedError());
773
+ return;
774
+ }
775
+ timeoutId = _setTimeout__default["default"](() => {
776
+ abortSignal?.removeEventListener('abort', onAbort);
777
+ resolve();
778
+ }, pollingInterval);
779
+ abortSignal?.addEventListener('abort', onAbort);
780
+ });
781
+ attempts++;
782
+ }
783
+ throw new Error(`Job validation timeout after ${maxAttempts} attempts (${maxAttempts * pollingInterval / 1000}s)`);
784
+ };
785
+
786
+ /**
787
+ * Formats an object into a URL query string
788
+ * @param queryParams - Object containing query parameters
789
+ * @returns Formatted query string with leading '?' or empty string
790
+ */
791
+ function formatQueryString() {
792
+ let queryParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
793
+ const queryString = new _URLSearchParams__default["default"]();
794
+ for (const _ref of _Object$entries__default["default"](queryParams)) {
795
+ var _ref2 = _slicedToArray(_ref, 2);
796
+ const key = _ref2[0];
797
+ const value = _ref2[1];
798
+ if (value !== undefined && value !== null) {
799
+ if (_Array$isArray__default["default"](value)) {
800
+ _forEachInstanceProperty__default["default"](value).call(value, v => queryString.append(key, String(v)));
801
+ } else {
802
+ queryString.append(key, String(value));
803
+ }
804
+ }
805
+ }
806
+ return queryString.toString() ? `?${queryString.toString()}` : '';
807
+ }
808
+
809
+ function getImportContainersURL(_ref) {
810
+ let projectKey = _ref.projectKey,
811
+ queryParams = _ref.queryParams;
812
+ const queryString = formatQueryString(queryParams);
813
+ return `/${projectKey}/import-containers${queryString}`;
814
+ }
815
+ function getImportOperationsURL(_ref2) {
816
+ let projectKey = _ref2.projectKey,
817
+ importContainerKey = _ref2.importContainerKey,
818
+ queryParams = _ref2.queryParams;
819
+ const queryString = formatQueryString(queryParams);
820
+ return `/${projectKey}/import-containers/${importContainerKey}/import-operations${queryString}&debug=true`;
821
+ }
822
+ function getImportContainerByKeyURL(_ref3) {
823
+ let projectKey = _ref3.projectKey,
824
+ importContainerKey = _ref3.importContainerKey;
825
+ return `/${projectKey}/import-containers/${importContainerKey}`;
826
+ }
827
+ function getCreateImportContainerURL(_ref4) {
828
+ let projectKey = _ref4.projectKey;
829
+ return `/${projectKey}/import-containers`;
830
+ }
831
+ function getImportContainerTasksURL(_ref5) {
832
+ let projectKey = _ref5.projectKey,
833
+ importContainerKey = _ref5.importContainerKey;
834
+ return `/${projectKey}/import-containers/${importContainerKey}/tasks`;
835
+ }
836
+ function getDeleteImportContainerURL(_ref6) {
837
+ let projectKey = _ref6.projectKey,
838
+ importContainerKey = _ref6.importContainerKey;
839
+ return `/${projectKey}/import-containers/${importContainerKey}`;
840
+ }
841
+ function getImportSummaryURL(_ref7) {
842
+ let projectKey = _ref7.projectKey,
843
+ importContainerKey = _ref7.importContainerKey;
844
+ return `/${projectKey}/import-containers/${importContainerKey}/import-summaries`;
845
+ }
846
+ function getFileUploadURL(_ref8) {
847
+ let projectKey = _ref8.projectKey,
848
+ resourceType = _ref8.resourceType,
849
+ importContainerKey = _ref8.importContainerKey;
850
+ return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${importContainerKey}/file-upload`;
851
+ }
852
+ function getProccessFileURL(_ref9) {
853
+ let projectKey = _ref9.projectKey,
854
+ resourceType = _ref9.resourceType,
855
+ importContainerKey = _ref9.importContainerKey;
856
+ return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${importContainerKey}/process-file`;
857
+ }
858
+ function getExportOperationsURL(_ref0) {
859
+ let projectKey = _ref0.projectKey,
860
+ queryParams = _ref0.queryParams;
861
+ const queryString = formatQueryString(queryParams);
862
+ return `/${projectKey}/export-operations${queryString}`;
863
+ }
864
+ function getFileImportJobsURL(_ref1) {
865
+ let projectKey = _ref1.projectKey,
866
+ resourceType = _ref1.resourceType,
867
+ importContainerKey = _ref1.importContainerKey;
868
+ return `/${projectKey}/${pluralize.plural(toImportApiResourceType(resourceType))}/import-containers/${importContainerKey}/file-import-jobs`;
869
+ }
870
+ function getFileImportJobByIdURL(_ref10) {
871
+ let projectKey = _ref10.projectKey,
872
+ importContainerKey = _ref10.importContainerKey,
873
+ jobId = _ref10.jobId;
874
+ return `/${projectKey}/import-containers/${importContainerKey}/file-import-jobs/${jobId}`;
875
+ }
876
+ function getFileImportJobRecordsURL(_ref11) {
877
+ let projectKey = _ref11.projectKey,
878
+ importContainerKey = _ref11.importContainerKey,
879
+ jobId = _ref11.jobId;
880
+ return `/${projectKey}/import-containers/${importContainerKey}/file-import-jobs/${jobId}/records`;
881
+ }
882
+ function getFileImportJobProcessURL(_ref12) {
883
+ let projectKey = _ref12.projectKey,
884
+ resourceType = _ref12.resourceType,
885
+ importContainerKey = _ref12.importContainerKey,
886
+ jobId = _ref12.jobId;
887
+ return `/${projectKey}/${pluralize.plural(toImportApiResourceType(resourceType))}/import-containers/${importContainerKey}/file-import-jobs/${jobId}/process`;
888
+ }
889
+ function getFileImportJobDeleteURL(_ref13) {
890
+ let projectKey = _ref13.projectKey,
891
+ importContainerKey = _ref13.importContainerKey,
892
+ jobId = _ref13.jobId;
893
+ return `/${projectKey}/import-containers/${importContainerKey}/file-import-jobs/${jobId}`;
894
+ }
895
+ function getFileImportJobsListURL(_ref14) {
896
+ let projectKey = _ref14.projectKey,
897
+ importContainerKey = _ref14.importContainerKey;
898
+ return `/${projectKey}/import-containers/${importContainerKey}/file-import-jobs`;
899
+ }
900
+
901
+ function uploadFileForImport(_ref) {
902
+ let projectKey = _ref.projectKey,
903
+ importContainerKey = _ref.importContainerKey,
904
+ resourceType = _ref.resourceType,
905
+ file = _ref.file,
906
+ abortSignal = _ref.abortSignal,
907
+ onSuccess = _ref.onSuccess,
908
+ onProgress = _ref.onProgress,
909
+ onError = _ref.onError;
910
+ const uri = getFileUploadURL({
911
+ projectKey,
912
+ resourceType,
913
+ importContainerKey
914
+ });
915
+ const formData = new FormData();
916
+ formData.append('file', file, file.name);
917
+ return fetchUsingXhr({
918
+ url: uri,
919
+ payload: formData,
920
+ config: {
921
+ abortSignal,
922
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
923
+ method: 'POST',
924
+ headers: {
925
+ 'Content-Type': null
926
+ }
927
+ },
928
+ onProgress,
929
+ onSuccess,
930
+ onError
931
+ });
932
+ }
933
+ function assertFileUploadResponse(maybeFileUploadResponse) {
934
+ const requiredFields = ['results', 'valid'];
935
+ if (hasRequiredFields(maybeFileUploadResponse, requiredFields)) return;
936
+ throw new Error('Invalid response');
937
+ }
938
+
939
+ function createFileImportJob(_ref) {
940
+ let projectKey = _ref.projectKey,
941
+ resourceType = _ref.resourceType,
942
+ importContainerKey = _ref.importContainerKey,
943
+ payload = _ref.payload,
944
+ onProgress = _ref.onProgress,
945
+ abortSignal = _ref.abortSignal;
946
+ const url = getFileImportJobsURL({
947
+ projectKey,
948
+ resourceType,
949
+ importContainerKey
950
+ });
951
+ if ('fileType' in payload) {
952
+ return new _Promise__default["default"]((resolve, reject) => {
953
+ const formData = new FormData();
954
+ formData.append('fileType', payload.fileType);
955
+ formData.append('fileName', payload.fileName);
956
+ formData.append('file', payload.file, payload.fileName);
957
+ fetchUsingXhr({
958
+ url,
959
+ payload: formData,
960
+ config: {
961
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
962
+ method: 'POST',
963
+ headers: {
964
+ 'Content-Type': null
965
+ },
966
+ abortSignal
967
+ },
968
+ onProgress: onProgress || (() => {}),
969
+ onSuccess: response => {
970
+ assertFileImportJob(response);
971
+ resolve(response);
972
+ },
973
+ onError: reject
974
+ });
975
+ });
976
+ }
977
+ return fetcher({
978
+ url,
979
+ payload: _JSON$stringify__default["default"](payload),
980
+ config: {
981
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
982
+ method: 'POST',
983
+ headers: {
984
+ accept: 'application/json',
985
+ 'Content-Type': 'application/json'
986
+ }
987
+ }
988
+ }).then(response => {
989
+ assertFileImportJob(response);
990
+ return response;
991
+ });
992
+ }
993
+ async function getFileImportJob(_ref2) {
994
+ let projectKey = _ref2.projectKey,
995
+ importContainerKey = _ref2.importContainerKey,
996
+ jobId = _ref2.jobId;
997
+ const url = getFileImportJobByIdURL({
998
+ projectKey,
999
+ importContainerKey,
1000
+ jobId
1001
+ });
1002
+ const response = await fetcher({
1003
+ url,
1004
+ config: {
1005
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1006
+ method: 'GET'
1007
+ }
1008
+ });
1009
+ assertFileImportJob(response);
1010
+ return response;
1011
+ }
1012
+ async function getFileImportJobRecords(_ref3) {
1013
+ let projectKey = _ref3.projectKey,
1014
+ importContainerKey = _ref3.importContainerKey,
1015
+ jobId = _ref3.jobId,
1016
+ limit = _ref3.limit,
1017
+ offset = _ref3.offset,
1018
+ isValid = _ref3.isValid;
1019
+ const baseUrl = getFileImportJobRecordsURL({
1020
+ projectKey,
1021
+ importContainerKey,
1022
+ jobId
1023
+ });
1024
+ const queryString = formatQueryString({
1025
+ limit,
1026
+ offset,
1027
+ isValid
1028
+ });
1029
+ const url = `${baseUrl}${queryString}`;
1030
+ const response = await fetcher({
1031
+ url,
1032
+ config: {
1033
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1034
+ method: 'GET'
1035
+ }
1036
+ });
1037
+ assertFileImportJobRecordsResponse(response);
1038
+ return response;
1039
+ }
1040
+ async function processFileImportJob(_ref4) {
1041
+ let projectKey = _ref4.projectKey,
1042
+ resourceType = _ref4.resourceType,
1043
+ importContainerKey = _ref4.importContainerKey,
1044
+ jobId = _ref4.jobId,
1045
+ action = _ref4.action;
1046
+ const url = getFileImportJobProcessURL({
1047
+ projectKey,
1048
+ resourceType,
1049
+ importContainerKey,
1050
+ jobId
1051
+ });
1052
+ const payload = action ? {
1053
+ action
1054
+ } : {};
1055
+ const response = await fetcher({
1056
+ url,
1057
+ payload: _JSON$stringify__default["default"](payload),
1058
+ config: {
1059
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1060
+ method: 'POST',
1061
+ headers: {
1062
+ accept: 'application/json',
1063
+ 'Content-Type': 'application/json'
1064
+ }
1065
+ }
1066
+ });
1067
+ assertProcessFileImportJobResponse(response);
1068
+ return response;
1069
+ }
1070
+ async function deleteFileImportJob(_ref5) {
1071
+ let projectKey = _ref5.projectKey,
1072
+ importContainerKey = _ref5.importContainerKey,
1073
+ jobId = _ref5.jobId;
1074
+ const url = getFileImportJobDeleteURL({
1075
+ projectKey,
1076
+ importContainerKey,
1077
+ jobId
1078
+ });
1079
+ await fetcher({
1080
+ url,
1081
+ config: {
1082
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1083
+ method: 'DELETE'
1084
+ }
1085
+ });
1086
+ }
1087
+ async function listFileImportJobs(_ref6) {
1088
+ let projectKey = _ref6.projectKey,
1089
+ importContainerKey = _ref6.importContainerKey,
1090
+ limit = _ref6.limit,
1091
+ offset = _ref6.offset;
1092
+ const baseUrl = getFileImportJobsListURL({
1093
+ projectKey,
1094
+ importContainerKey
1095
+ });
1096
+ const queryString = formatQueryString({
1097
+ limit,
1098
+ offset
1099
+ });
1100
+ const url = `${baseUrl}${queryString}`;
1101
+ const response = await fetcher({
1102
+ url,
1103
+ config: {
1104
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1105
+ method: 'GET'
1106
+ }
1107
+ });
1108
+ assertListFileImportJobsResponse(response);
1109
+ return response;
1110
+ }
1111
+
1112
+ function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1113
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$6(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1114
+ function getImportState(importSummary) {
1115
+ const processing = importSummary.states.processing > 0;
1116
+ if (processing) return ImportStates.Processing;
1117
+ const waitForUnresolvedReferences = importSummary.states.waitForMasterVariant > 0 || importSummary.states.unresolved > 0;
1118
+ if (waitForUnresolvedReferences) return ImportStates.WaitForUnresolvedReferences;
1119
+ const partiallyCompleted = importSummary.states.imported > 0 && importSummary.states.imported < importSummary.total || importSummary.states.deleted > 0 && importSummary.states.deleted < importSummary.total;
1120
+ if (partiallyCompleted) return ImportStates.PartiallyCompleted;
1121
+ const noRunning = importSummary.total === 0;
1122
+ if (noRunning) return ImportStates.NoRunningImports;
1123
+ const successfullyCompleted = importSummary.states.imported === importSummary.total || importSummary.states.deleted === importSummary.total;
1124
+ if (successfullyCompleted) return ImportStates.SuccessfullyCompleted;
1125
+ const failed = importSummary.states.rejected + importSummary.states.validationFailed === importSummary.total;
1126
+ if (failed) return ImportStates.Failed;
1127
+ const canceled = importSummary.states.canceled > 0;
1128
+ if (canceled) return ImportStates.Canceled;
1129
+ throw new Error(`Unsupported state ${_JSON$stringify__default["default"](importSummary.states)}`);
1130
+ }
1131
+ function createImportContainerForFileUpload(_ref) {
1132
+ let importContainerDraft = _ref.importContainerDraft,
1133
+ projectKey = _ref.projectKey;
1134
+ return fetcher({
1135
+ url: getCreateImportContainerURL({
1136
+ projectKey
1137
+ }),
1138
+ payload: _JSON$stringify__default["default"](_objectSpread$6({
1139
+ retentionPolicy: {
1140
+ strategy: 'ttl',
1141
+ config: {
1142
+ timeToLive: '54h' // 2 days and 6 hours
1143
+ }
1144
+ }
1145
+ }, importContainerDraft)),
1146
+ config: {
1147
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1148
+ method: 'POST',
1149
+ headers: {
1150
+ accept: 'application/json',
1151
+ 'Content-Type': 'application/json'
1152
+ }
1153
+ }
1154
+ });
1155
+ }
1156
+ function deleteImportContainer(_ref2) {
1157
+ let projectKey = _ref2.projectKey,
1158
+ importContainerKey = _ref2.importContainerKey;
1159
+ return fetcher({
1160
+ url: getDeleteImportContainerURL({
1161
+ projectKey,
1162
+ importContainerKey
1163
+ }),
1164
+ config: {
1165
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1166
+ method: 'DELETE',
1167
+ headers: {
1168
+ accept: 'application/json'
1169
+ }
1170
+ }
1171
+ });
1172
+ }
1173
+ async function fetchImportSummary(_ref3) {
1174
+ let projectKey = _ref3.projectKey,
1175
+ importContainerKey = _ref3.importContainerKey;
1176
+ const importSummary = await fetcher({
1177
+ url: getImportSummaryURL({
1178
+ projectKey,
1179
+ importContainerKey
1180
+ }),
1181
+ config: {
1182
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1183
+ method: 'GET'
1184
+ }
1185
+ });
1186
+ assertImportSummary(importSummary);
1187
+ return importSummary;
1188
+ }
1189
+ async function fetchImportContainers(_ref4) {
1190
+ let projectKey = _ref4.projectKey,
1191
+ queryParams = _ref4.queryParams;
1192
+ const importContainers = await fetcher({
1193
+ url: getImportContainersURL({
1194
+ projectKey,
1195
+ queryParams
1196
+ }),
1197
+ config: {
1198
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1199
+ method: 'GET'
1200
+ }
1201
+ });
1202
+ assertImportContainerPagedResponse(importContainers);
1203
+ return importContainers;
1204
+ }
1205
+ async function fetchImportSummaries(_ref5) {
1206
+ var _context;
1207
+ let projectKey = _ref5.projectKey,
1208
+ queryParams = _ref5.queryParams;
1209
+ const importContainers = await fetchImportContainers({
1210
+ projectKey,
1211
+ queryParams
1212
+ });
1213
+ const results = _mapInstanceProperty__default["default"](_context = importContainers.results).call(_context, async importContainer => {
1214
+ return await importContainerToContainerDetails(projectKey, importContainer);
1215
+ });
1216
+ return {
1217
+ results,
1218
+ count: importContainers.count,
1219
+ total: importContainers.total ?? 0,
1220
+ queryParams: {
1221
+ limit: importContainers.limit,
1222
+ offset: importContainers.offset
1223
+ }
1224
+ };
1225
+ }
1226
+ async function fetchImportContainerDetails(_ref6) {
1227
+ let projectKey = _ref6.projectKey,
1228
+ importContainerKey = _ref6.importContainerKey;
1229
+ const importContainer = await fetchImportContainerByKey({
1230
+ projectKey,
1231
+ importContainerKey
1232
+ });
1233
+ return await importContainerToContainerDetails(projectKey, importContainer);
1234
+ }
1235
+ async function fetchImportContainerByKey(_ref7) {
1236
+ let projectKey = _ref7.projectKey,
1237
+ importContainerKey = _ref7.importContainerKey;
1238
+ const importContainer = await fetcher({
1239
+ url: getImportContainerByKeyURL({
1240
+ projectKey,
1241
+ importContainerKey
1242
+ }),
1243
+ config: {
1244
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1245
+ method: 'GET'
1246
+ }
1247
+ });
1248
+ assertImportContainer(importContainer);
1249
+ return importContainer;
1250
+ }
1251
+ async function cancelImportContainerByKey(_ref8) {
1252
+ let projectKey = _ref8.projectKey,
1253
+ importContainerKey = _ref8.importContainerKey;
1254
+ const response = await fetcher({
1255
+ url: getImportContainerTasksURL({
1256
+ projectKey,
1257
+ importContainerKey
1258
+ }),
1259
+ payload: _JSON$stringify__default["default"]({
1260
+ task: 'cancel'
1261
+ }),
1262
+ config: {
1263
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1264
+ method: 'POST'
1265
+ }
1266
+ });
1267
+ assertCancelContainerResponse(response);
1268
+ return response;
1269
+ }
1270
+ async function importContainerToContainerDetails(projectKey, importContainer) {
1271
+ const importSummary = await fetchImportSummary({
1272
+ projectKey,
1273
+ importContainerKey: importContainer.key
1274
+ });
1275
+ const importState = getImportState(importSummary);
1276
+ const isFileUploadImport = checkIfFileUploadImport(importContainer.tags);
1277
+ return {
1278
+ importContainer: importContainer,
1279
+ importState,
1280
+ importSummary,
1281
+ isFileUploadImport
1282
+ };
1283
+ }
1284
+
1285
+ async function fetchImportOperations(_ref) {
1286
+ let projectKey = _ref.projectKey,
1287
+ importContainerKey = _ref.importContainerKey,
1288
+ queryParams = _ref.queryParams;
1289
+ const importOperations = await fetcher({
1290
+ url: getImportOperationsURL({
1291
+ projectKey,
1292
+ importContainerKey,
1293
+ queryParams
1294
+ }),
1295
+ config: {
1296
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1297
+ method: 'GET'
1298
+ }
1299
+ });
1300
+ assertImportOperationPagedResponse(importOperations);
1301
+ return importOperations;
1302
+ }
1303
+
1304
+ async function fetchExportOperations(_ref) {
1305
+ let projectKey = _ref.projectKey,
1306
+ queryParams = _ref.queryParams;
1307
+ const exportOperations = await fetcher({
1308
+ url: getExportOperationsURL({
1309
+ projectKey,
1310
+ queryParams
1311
+ }),
1312
+ config: {
1313
+ proxy: constants.MC_API_PROXY_TARGETS.EXPORT,
1314
+ method: 'GET'
1315
+ }
1316
+ });
1317
+ assertPaginatedExportOperationResponse(exportOperations);
1318
+ return exportOperations;
1319
+ }
1320
+
1321
+ async function processUploadedFile(_ref) {
1322
+ let projectKey = _ref.projectKey,
1323
+ importContainerKey = _ref.importContainerKey,
1324
+ resourceType = _ref.resourceType,
1325
+ action = _ref.action;
1326
+ // For delete operations with action (like 'delete') -> use different URL and payload structure
1327
+ const uri = action ? getImportContainerTasksURL({
1328
+ projectKey,
1329
+ importContainerKey
1330
+ }) : getProccessFileURL({
1331
+ projectKey,
1332
+ resourceType,
1333
+ importContainerKey
1334
+ });
1335
+ const payload = action ? {
1336
+ task: 'process-file',
1337
+ parameter: {
1338
+ resourceType,
1339
+ action
1340
+ }
1341
+ } : {};
1342
+ const response = await fetcher({
1343
+ url: uri,
1344
+ payload: _JSON$stringify__default["default"](payload),
1345
+ config: {
1346
+ proxy: constants.MC_API_PROXY_TARGETS.IMPORT,
1347
+ method: 'POST',
1348
+ headers: {
1349
+ accept: 'application/json',
1350
+ 'Content-Type': 'application/json'
1351
+ }
1352
+ }
1353
+ });
1354
+ assertProcessFileResponse(response);
1355
+ return response;
1356
+ }
1357
+ function assertProcessFileResponse(maybeProcessFileResponse) {
1358
+ const requiredFields = ['message'];
1359
+ if (hasRequiredFields(maybeProcessFileResponse, requiredFields)) return;
1360
+ throw new Error('Invalid response');
1361
+ }
1362
+
1363
+ const DELIMITERS = {
1364
+ COMMA: ',',
1365
+ SEMICOLON: ';',
1366
+ POINT: '.',
1367
+ TAB: '\t',
1368
+ PIPE: '|'
1369
+ };
1370
+ const COLUMN_DELIMITERS = [DELIMITERS.COMMA, DELIMITERS.SEMICOLON, DELIMITERS.PIPE, DELIMITERS.TAB];
1371
+
1372
+ const FILE_IMPORT_JOB_POLLING_INTERVAL = 2000;
1373
+
1374
+ const IMPORT_MAX_FILE_SIZE_MB = 200;
1375
+ const IMPORT_MAX_ITEM_COUNT = 500_000;
1376
+
1377
+ // =============================================================================
1378
+ // Legacy constants (old flow) - Remove after testing and migration is complete
1379
+ // =============================================================================
1380
+
1381
+ /** @deprecated Use IMPORT_MAX_FILE_SIZE_MB instead. Remove after migration. */
1382
+ const IMPORT_LEGACY_MAX_FILE_SIZE_MB = 35;
1383
+
1384
+ /** @deprecated Use IMPORT_MAX_ITEM_COUNT instead. Remove after migration. */
1385
+ const IMPORT_LEGACY_MAX_ROW_COUNT = 80_000;
1386
+
1387
+ const IMPORT_TAG_KEYS = {
1388
+ source: 'source'
1389
+ };
1390
+ const IMPORT_TAG_VALUES = {
1391
+ fileUpload: 'file-upload'
1392
+ };
1393
+ const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
1394
+
1395
+ /**
1396
+ * CommerceTools API documentation base URL
1397
+ */
1398
+ const CT_API_DOCS_URL = 'https://docs.commercetools.com/api/';
1399
+
1400
+ /**
1401
+ * Template download links for each resource type
1402
+ */
1403
+ const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
1404
+ category: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
1405
+ 'custom-object': 'https://docs.commercetools.com/merchant-center/downloads/custom_object_import_template.json',
1406
+ product: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
1407
+ 'inventory-entry': 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
1408
+ // TODO: remove `inventory` after aligning the resource type names in the Import API and Export API
1409
+ inventory: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
1410
+ 'discount-code': 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv',
1411
+ customer: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
1412
+ order: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
1413
+ 'product-type': 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv',
1414
+ 'business-unit': 'https://docs.commercetools.com/merchant-center/downloads/business_unit_import_template.csv'
1415
+ };
1416
+ const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
1417
+ category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
1418
+ 'custom-object': 'https://docs.commercetools.com/merchant-center/import-custom-objects#supported-fields-and-values',
1419
+ product: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
1420
+ 'inventory-entry': 'https://docs.commercetools.com/merchant-center/import-inventory#supported-headers-and-values',
1421
+ // TODO: remove `inventory` after aligning the resource type names in the Import API and Export API
1422
+ inventory: 'https://docs.commercetools.com/merchant-center/import-inventory#supported-headers-and-values',
1423
+ 'discount-code': 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values',
1424
+ customer: 'https://docs.commercetools.com/merchant-center/import-customers#supported-headers-and-values',
1425
+ order: 'https://docs.commercetools.com/merchant-center/import-orders#supported-headers-and-values',
1426
+ 'product-type': 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values',
1427
+ 'business-unit': 'https://docs.commercetools.com/merchant-center/import-business-units#supported-headers-and-values'
1428
+ };
1429
+
1430
+ const automatedImportContainerKey = 'automated-container-key';
1431
+ const fileUploadImportContainerKey = 'eyJ0aW1lc3RhbXAiOiAxNzA1MDc0MzIxODY4LCAiZmlsZU5hbWUiOiAiZmlsZS11cGxvYWQtY29udGFpbmVyLWtleS5jc3YifQ';
1432
+ const manualImports = [{
1433
+ key: 'eyJ0aW1lc3RhbXAiOjE2MjE0MTM0NzU4MzcsImZpbGVOYW1lIjoiX3ZhbGlkLXByb2R1Y3QuY3N2IiwiaW1wb3J0VHlwZSI6Im1hbnVhbCJ9',
1434
+ version: 0,
1435
+ resourceType: 'product',
1436
+ createdAt: '2021-05-19T08:37:56.021Z',
1437
+ lastModifiedAt: '2021-05-19T08:37:56.021Z',
1438
+ tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
1439
+ }, {
1440
+ key: 'eyJ0aW1lc3RhbXAiOjE2MjE0MTM3Mjc0ODksImZpbGVOYW1lIjoiX3ZhbGlkLWNhdGVnb3J5LmNzdiIsImltcG9ydFR5cGUiOiJtYW51YWwifQ',
1441
+ version: 0,
1442
+ resourceType: 'category',
1443
+ createdAt: '2021-05-19T08:42:07.720Z',
1444
+ lastModifiedAt: '2021-05-19T08:42:07.720Z',
1445
+ tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
1446
+ }];
1447
+ const automatedImports = [{
1448
+ key: 'product-import-container',
1449
+ version: 0,
1450
+ resourceType: 'product',
1451
+ createdAt: '2021-04-06T06:41:33.622Z',
1452
+ lastModifiedAt: '2021-04-06T06:41:33.622Z',
1453
+ tags: []
1454
+ }, {
1455
+ key: 'product-import-container-1',
1456
+ version: 0,
1457
+ resourceType: 'product',
1458
+ createdAt: '2021-05-26T14:46:12.673Z',
1459
+ lastModifiedAt: '2021-05-26T14:46:12.673Z',
1460
+ tags: []
1461
+ }];
1462
+ const importContainers = {
1463
+ count: 4,
1464
+ total: 100,
1465
+ results: _concatInstanceProperty__default["default"](manualImports).call(manualImports, automatedImports)
1466
+ };
1467
+ const importsSummaries = {
1468
+ eyJ0aW1lc3RhbXAiOjE2MjE0MTM0NzU4MzcsImZpbGVOYW1lIjoiX3ZhbGlkLXByb2R1Y3QuY3N2IiwiaW1wb3J0VHlwZSI6Im1hbnVhbCJ9: {
1469
+ states: {
1470
+ validationFailed: 0,
1471
+ unresolved: 3,
1472
+ waitForMasterVariant: 0,
1473
+ imported: 0,
1474
+ rejected: 0
1475
+ },
1476
+ total: 3
1477
+ },
1478
+ eyJ0aW1lc3RhbXAiOjE2MjE0MTM3Mjc0ODksImZpbGVOYW1lIjoiX3ZhbGlkLWNhdGVnb3J5LmNzdiIsImltcG9ydFR5cGUiOiJtYW51YWwifQ: {
1479
+ states: {
1480
+ validationFailed: 0,
1481
+ unresolved: 0,
1482
+ waitForMasterVariant: 0,
1483
+ imported: 0,
1484
+ rejected: 0
1485
+ },
1486
+ total: 0
1487
+ },
1488
+ 'product-import-container': {
1489
+ states: {
1490
+ validationFailed: 0,
1491
+ unresolved: 0,
1492
+ waitForMasterVariant: 0,
1493
+ imported: 0,
1494
+ rejected: 0
1495
+ },
1496
+ total: 0
1497
+ },
1498
+ 'product-import-container-1': {
1499
+ states: {
1500
+ validationFailed: 0,
1501
+ unresolved: 0,
1502
+ waitForMasterVariant: 0,
1503
+ imported: 0,
1504
+ rejected: 0
1505
+ },
1506
+ total: 0
1507
+ }
1508
+ };
1509
+ const importStatesMap = {
1510
+ [ImportStates.Processing]: [{
1511
+ states: {
1512
+ unresolved: 0,
1513
+ imported: 0,
1514
+ rejected: 0,
1515
+ validationFailed: 0,
1516
+ waitForMasterVariant: 0,
1517
+ processing: 10,
1518
+ canceled: 0,
1519
+ deleted: 0
1520
+ },
1521
+ total: 10
1522
+ }],
1523
+ [ImportStates.WaitForUnresolvedReferences]: [{
1524
+ states: {
1525
+ unresolved: 0,
1526
+ imported: 0,
1527
+ rejected: 0,
1528
+ validationFailed: 0,
1529
+ waitForMasterVariant: 10,
1530
+ processing: 0,
1531
+ canceled: 0,
1532
+ deleted: 0
1533
+ },
1534
+ total: 10
1535
+ }, {
1536
+ states: {
1537
+ unresolved: 10,
1538
+ imported: 0,
1539
+ rejected: 0,
1540
+ validationFailed: 0,
1541
+ waitForMasterVariant: 0,
1542
+ processing: 0,
1543
+ canceled: 0,
1544
+ deleted: 0
1545
+ },
1546
+ total: 10
1547
+ }, {
1548
+ states: {
1549
+ unresolved: 10,
1550
+ imported: 10,
1551
+ rejected: 10,
1552
+ validationFailed: 10,
1553
+ waitForMasterVariant: 0,
1554
+ processing: 0,
1555
+ canceled: 0,
1556
+ deleted: 0
1557
+ },
1558
+ total: 40
1559
+ }],
1560
+ [ImportStates.Failed]: [{
1561
+ states: {
1562
+ unresolved: 0,
1563
+ imported: 0,
1564
+ rejected: 4,
1565
+ validationFailed: 4,
1566
+ waitForMasterVariant: 0,
1567
+ processing: 0,
1568
+ canceled: 0,
1569
+ deleted: 0
1570
+ },
1571
+ total: 8
1572
+ }, {
1573
+ states: {
1574
+ unresolved: 0,
1575
+ imported: 0,
1576
+ rejected: 10,
1577
+ validationFailed: 0,
1578
+ waitForMasterVariant: 0,
1579
+ processing: 0,
1580
+ canceled: 0,
1581
+ deleted: 0
1582
+ },
1583
+ total: 10
1584
+ }, {
1585
+ states: {
1586
+ unresolved: 0,
1587
+ imported: 0,
1588
+ rejected: 0,
1589
+ validationFailed: 10,
1590
+ waitForMasterVariant: 0,
1591
+ processing: 0,
1592
+ canceled: 0,
1593
+ deleted: 0
1594
+ },
1595
+ total: 10
1596
+ }],
1597
+ [ImportStates.PartiallyCompleted]: [{
1598
+ states: {
1599
+ unresolved: 0,
1600
+ imported: 2,
1601
+ rejected: 1,
1602
+ validationFailed: 0,
1603
+ waitForMasterVariant: 0,
1604
+ processing: 0,
1605
+ canceled: 0,
1606
+ deleted: 0
1607
+ },
1608
+ total: 3
1609
+ }, {
1610
+ states: {
1611
+ unresolved: 0,
1612
+ imported: 10,
1613
+ rejected: 10,
1614
+ validationFailed: 10,
1615
+ waitForMasterVariant: 0,
1616
+ processing: 0,
1617
+ canceled: 0,
1618
+ deleted: 0
1619
+ },
1620
+ total: 30
1621
+ }],
1622
+ [ImportStates.SuccessfullyCompleted]: [{
1623
+ states: {
1624
+ unresolved: 0,
1625
+ imported: 20,
1626
+ rejected: 0,
1627
+ validationFailed: 0,
1628
+ waitForMasterVariant: 0,
1629
+ processing: 0,
1630
+ canceled: 0,
1631
+ deleted: 0
1632
+ },
1633
+ total: 20
1634
+ }, {
1635
+ states: {
1636
+ unresolved: 0,
1637
+ imported: 10,
1638
+ rejected: 0,
1639
+ validationFailed: 0,
1640
+ waitForMasterVariant: 0,
1641
+ processing: 0,
1642
+ canceled: 0,
1643
+ deleted: 0
1644
+ },
1645
+ total: 10
1646
+ }],
1647
+ [ImportStates.NoRunningImports]: [{
1648
+ states: {
1649
+ unresolved: 0,
1650
+ imported: 0,
1651
+ rejected: 0,
1652
+ validationFailed: 0,
1653
+ waitForMasterVariant: 0,
1654
+ processing: 0,
1655
+ canceled: 0,
1656
+ deleted: 0
1657
+ },
1658
+ total: 0
1659
+ }],
1660
+ [ImportStates.Canceled]: [{
1661
+ states: {
1662
+ unresolved: 0,
1663
+ imported: 0,
1664
+ rejected: 0,
1665
+ validationFailed: 0,
1666
+ waitForMasterVariant: 0,
1667
+ processing: 0,
1668
+ canceled: 10,
1669
+ deleted: 0
1670
+ },
1671
+ total: 10
1672
+ }]
1673
+ };
1674
+ const validFileUploadResponse = {
1675
+ results: [],
1676
+ invalid: 0,
1677
+ valid: 2,
1678
+ fileName: 'categories.csv',
1679
+ itemsCount: 2,
1680
+ rowsCount: 2,
1681
+ columnsCount: 11,
1682
+ fields: ['id', 'lastModifiedAt', 'key', 'name.en', 'name.de', 'slug.en', 'slug.de', 'orderHint', 'externalId', 'description.en', 'description.de'],
1683
+ ignoredFields: ['id', 'lastModifiedAt']
1684
+ };
1685
+ const invalidFileUploadResponse = {
1686
+ invalid: 2,
1687
+ valid: 0,
1688
+ fileName: 'categories.csv',
1689
+ itemsCount: 2,
1690
+ rowsCount: 2,
1691
+ columnsCount: 11,
1692
+ fields: ['key', 'externalId2', 'orderHint', 'name.de2', 'description.de2', 'slug.RU', 'name.enn', 'description.en', 'slug.RU', 'test1', 'test2'],
1693
+ ignoredFields: [],
1694
+ results: [{
1695
+ row: 1,
1696
+ errors: [{
1697
+ code: 'InvalidField',
1698
+ message: '"externalId2" is not allowed',
1699
+ field: 'externalId2'
1700
+ }, {
1701
+ code: 'InvalidField',
1702
+ message: '"name.de2" is not allowed',
1703
+ field: 'name.de2'
1704
+ }, {
1705
+ code: 'InvalidField',
1706
+ message: '"name.enn" is not allowed',
1707
+ field: 'name.enn'
1708
+ }, {
1709
+ code: 'InvalidField',
1710
+ message: '"slug.RU" is not allowed',
1711
+ field: 'slug.RU'
1712
+ }, {
1713
+ code: 'InvalidField',
1714
+ message: '"test1" is not allowed',
1715
+ field: 'test1'
1716
+ }, {
1717
+ code: 'InvalidField',
1718
+ message: '"test2" is not allowed',
1719
+ field: 'test2'
1720
+ }]
1721
+ }]
1722
+ };
1723
+ const allAutomatedImportOperations = [{
1724
+ version: 1,
1725
+ importContainerKey: automatedImportContainerKey,
1726
+ resourceKey: 'sample-3',
1727
+ id: 'fcbdb268-6bf0-4161-82ae-5bcd2c0ca1c3',
1728
+ state: 'ValidationFailed',
1729
+ errors: [{
1730
+ code: 'InvalidOperation',
1731
+ message: "The attributes contain definitions with duplicate names: '[product-ref-attribute]'."
1732
+ }],
1733
+ createdAt: '2021-08-03T10:13:52.867Z',
1734
+ lastModifiedAt: '2021-08-03T10:13:53.031Z',
1735
+ expiresAt: '2021-08-05T10:13:52.867Z'
1736
+ }, {
1737
+ version: 1,
1738
+ importContainerKey: automatedImportContainerKey,
1739
+ resourceKey: 'sample-2',
1740
+ id: 'c350f282-af46-44bd-b7fb-7767fe060b5d',
1741
+ state: 'imported',
1742
+ resourceVersion: 1,
1743
+ errors: [],
1744
+ createdAt: '2021-08-03T10:13:10.544Z',
1745
+ lastModifiedAt: '2021-08-03T10:13:11.056Z',
1746
+ expiresAt: '2021-08-05T10:13:10.544Z'
1747
+ }, {
1748
+ version: 1,
1749
+ importContainerKey: automatedImportContainerKey,
1750
+ resourceKey: 'sample',
1751
+ id: '50e01254-842a-4a94-9dc5-bd5d907a96f3',
1752
+ state: 'imported',
1753
+ resourceVersion: 1,
1754
+ errors: [],
1755
+ createdAt: '2021-08-03T10:12:16.293Z',
1756
+ lastModifiedAt: '2021-08-03T10:12:16.352Z',
1757
+ expiresAt: '2021-08-05T10:12:16.293Z'
1758
+ }, {
1759
+ version: 1,
1760
+ importContainerKey: automatedImportContainerKey,
1761
+ resourceKey: 'sample',
1762
+ id: '5679b11b-e6b2-44e3-bb32-feec7ee4295f',
1763
+ state: 'imported',
1764
+ resourceVersion: 1,
1765
+ errors: [],
1766
+ createdAt: '2021-08-03T10:12:13.955Z',
1767
+ lastModifiedAt: '2021-08-03T10:12:14.019Z',
1768
+ expiresAt: '2021-08-05T10:12:13.955Z'
1769
+ }, {
1770
+ version: 1,
1771
+ importContainerKey: automatedImportContainerKey,
1772
+ resourceKey: 'sample',
1773
+ id: '8ed41629-9e00-4779-abd7-ca054102690e',
1774
+ state: 'imported',
1775
+ resourceVersion: 1,
1776
+ errors: [],
1777
+ createdAt: '2021-08-03T10:12:07.214Z',
1778
+ lastModifiedAt: '2021-08-03T10:12:07.364Z',
1779
+ expiresAt: '2021-08-05T10:12:07.214Z'
1780
+ }, {
1781
+ version: 3,
1782
+ importContainerKey: automatedImportContainerKey,
1783
+ resourceKey: 'product-draft-key',
1784
+ id: '3f4d0fb6-95c0-444b-8e25-dbe1d6f25a54',
1785
+ state: 'imported',
1786
+ resourceVersion: 1,
1787
+ errors: [],
1788
+ createdAt: '2021-08-02T12:25:17.465Z',
1789
+ lastModifiedAt: '2021-08-02T12:25:34.673Z',
1790
+ expiresAt: '2021-08-04T12:25:17.465Z'
1791
+ }, {
1792
+ version: 3,
1793
+ importContainerKey: automatedImportContainerKey,
1794
+ resourceKey: 'product-draft-key',
1795
+ id: 'b3e4e438-3afd-46ed-929c-761286b839b4',
1796
+ state: 'imported',
1797
+ resourceVersion: 1,
1798
+ errors: [],
1799
+ createdAt: '2021-08-02T12:25:20.019Z',
1800
+ lastModifiedAt: '2021-08-02T12:25:34.657Z',
1801
+ expiresAt: '2021-08-04T12:25:20.019Z'
1802
+ }, {
1803
+ version: 3,
1804
+ importContainerKey: automatedImportContainerKey,
1805
+ resourceKey: 'product-draft-key',
1806
+ id: '8991ee30-2ad0-4e95-b784-e26e7672b49d',
1807
+ state: 'imported',
1808
+ resourceVersion: 1,
1809
+ errors: [],
1810
+ createdAt: '2021-08-02T12:25:20.454Z',
1811
+ lastModifiedAt: '2021-08-02T12:25:34.629Z',
1812
+ expiresAt: '2021-08-04T12:25:20.454Z'
1813
+ }, {
1814
+ version: 3,
1815
+ importContainerKey: automatedImportContainerKey,
1816
+ resourceKey: 'product-draft-key',
1817
+ id: 'd0a97b14-2927-414e-ae66-d20a27048418',
1818
+ state: 'imported',
1819
+ resourceVersion: 1,
1820
+ errors: [],
1821
+ createdAt: '2021-08-02T12:25:21.108Z',
1822
+ lastModifiedAt: '2021-08-02T12:25:34.570Z',
1823
+ expiresAt: '2021-08-04T12:25:21.108Z'
1824
+ }, {
1825
+ version: 1,
1826
+ importContainerKey: automatedImportContainerKey,
1827
+ resourceKey: 'sample',
1828
+ id: '702fbe9e-81c2-4daf-abd9-4c3f10ed9431',
1829
+ state: 'imported',
1830
+ resourceVersion: 1,
1831
+ errors: [],
1832
+ createdAt: '2021-08-02T12:25:27.585Z',
1833
+ lastModifiedAt: '2021-08-02T12:25:32.802Z',
1834
+ expiresAt: '2021-08-04T12:25:27.585Z'
1835
+ }];
1836
+ const successfulFileUploadImportOperations = [{
1837
+ version: 1,
1838
+ importContainerKey: fileUploadImportContainerKey,
1839
+ resourceKey: 'sample-2',
1840
+ id: 'c350f282-af46-44bd-b7fb-7767fe060b5d',
1841
+ state: 'imported',
1842
+ resourceVersion: 1,
1843
+ errors: [],
1844
+ createdAt: '2021-08-03T10:13:10.544Z',
1845
+ lastModifiedAt: '2021-08-03T10:13:11.056Z',
1846
+ expiresAt: '2021-08-05T10:13:10.544Z',
1847
+ tags: ['rowStartNumber:1']
1848
+ }];
1849
+ const allFileUploadImportOperations = [{
1850
+ version: 1,
1851
+ importContainerKey: fileUploadImportContainerKey,
1852
+ resourceKey: 'sample-3',
1853
+ id: 'fcbdb268-6bf0-4161-82ae-5bcd2c0ca1c3',
1854
+ state: 'ValidationFailed',
1855
+ errors: [{
1856
+ code: 'InvalidOperation',
1857
+ message: "The attributes contain definitions with duplicate names: '[product-ref-attribute]'."
1858
+ }],
1859
+ createdAt: '2021-08-03T10:13:52.867Z',
1860
+ lastModifiedAt: '2021-08-03T10:13:53.031Z',
1861
+ expiresAt: '2021-08-05T10:13:52.867Z',
1862
+ tags: ['rowStartNumber:1']
1863
+ }, {
1864
+ version: 1,
1865
+ importContainerKey: fileUploadImportContainerKey,
1866
+ resourceKey: 'sample-2',
1867
+ id: 'c350f282-af46-44bd-b7fb-7767fe060b5d',
1868
+ state: 'imported',
1869
+ resourceVersion: 1,
1870
+ errors: [],
1871
+ createdAt: '2021-08-03T10:13:10.544Z',
1872
+ lastModifiedAt: '2021-08-03T10:13:11.056Z',
1873
+ expiresAt: '2021-08-05T10:13:10.544Z',
1874
+ tags: ['rowStartNumber:2']
1875
+ }, {
1876
+ version: 1,
1877
+ importContainerKey: fileUploadImportContainerKey,
1878
+ resourceKey: 'sample',
1879
+ id: '50e01254-842a-4a94-9dc5-bd5d907a96f3',
1880
+ state: 'imported',
1881
+ resourceVersion: 1,
1882
+ errors: [],
1883
+ createdAt: '2021-08-03T10:12:16.293Z',
1884
+ lastModifiedAt: '2021-08-03T10:12:16.352Z',
1885
+ expiresAt: '2021-08-05T10:12:16.293Z',
1886
+ tags: ['rowStartNumber:3']
1887
+ }, {
1888
+ version: 1,
1889
+ importContainerKey: fileUploadImportContainerKey,
1890
+ resourceKey: 'sample',
1891
+ id: '5679b11b-e6b2-44e3-bb32-feec7ee4295f',
1892
+ state: 'imported',
1893
+ resourceVersion: 1,
1894
+ errors: [],
1895
+ createdAt: '2021-08-03T10:12:13.955Z',
1896
+ lastModifiedAt: '2021-08-03T10:12:14.019Z',
1897
+ expiresAt: '2021-08-05T10:12:13.955Z',
1898
+ tags: ['rowStartNumber:4']
1899
+ }, {
1900
+ version: 1,
1901
+ importContainerKey: fileUploadImportContainerKey,
1902
+ resourceKey: 'sample',
1903
+ id: '8ed41629-9e00-4779-abd7-ca054102690e',
1904
+ state: 'imported',
1905
+ resourceVersion: 1,
1906
+ errors: [],
1907
+ createdAt: '2021-08-03T10:12:07.214Z',
1908
+ lastModifiedAt: '2021-08-03T10:12:07.364Z',
1909
+ expiresAt: '2021-08-05T10:12:07.214Z',
1910
+ tags: ['rowStartNumber:5']
1911
+ }, {
1912
+ version: 3,
1913
+ importContainerKey: fileUploadImportContainerKey,
1914
+ resourceKey: 'product-draft-key',
1915
+ id: '3f4d0fb6-95c0-444b-8e25-dbe1d6f25a54',
1916
+ state: 'imported',
1917
+ resourceVersion: 1,
1918
+ errors: [],
1919
+ createdAt: '2021-08-02T12:25:17.465Z',
1920
+ lastModifiedAt: '2021-08-02T12:25:34.673Z',
1921
+ expiresAt: '2021-08-04T12:25:17.465Z',
1922
+ tags: ['rowStartNumber:6']
1923
+ }, {
1924
+ version: 3,
1925
+ importContainerKey: fileUploadImportContainerKey,
1926
+ resourceKey: 'product-draft-key',
1927
+ id: 'b3e4e438-3afd-46ed-929c-761286b839b4',
1928
+ state: 'imported',
1929
+ resourceVersion: 1,
1930
+ errors: [],
1931
+ createdAt: '2021-08-02T12:25:20.019Z',
1932
+ lastModifiedAt: '2021-08-02T12:25:34.657Z',
1933
+ expiresAt: '2021-08-04T12:25:20.019Z',
1934
+ tags: ['rowStartNumber:7']
1935
+ }, {
1936
+ version: 3,
1937
+ importContainerKey: fileUploadImportContainerKey,
1938
+ resourceKey: 'product-draft-key',
1939
+ id: '8991ee30-2ad0-4e95-b784-e26e7672b49d',
1940
+ state: 'imported',
1941
+ resourceVersion: 1,
1942
+ errors: [],
1943
+ createdAt: '2021-08-02T12:25:20.454Z',
1944
+ lastModifiedAt: '2021-08-02T12:25:34.629Z',
1945
+ expiresAt: '2021-08-04T12:25:20.454Z',
1946
+ tags: ['rowStartNumber:8']
1947
+ }, {
1948
+ version: 3,
1949
+ importContainerKey: fileUploadImportContainerKey,
1950
+ resourceKey: 'product-draft-key',
1951
+ id: 'd0a97b14-2927-414e-ae66-d20a27048418',
1952
+ state: 'imported',
1953
+ resourceVersion: 1,
1954
+ errors: [],
1955
+ createdAt: '2021-08-02T12:25:21.108Z',
1956
+ lastModifiedAt: '2021-08-02T12:25:34.570Z',
1957
+ expiresAt: '2021-08-04T12:25:21.108Z',
1958
+ tags: ['rowStartNumber:9']
1959
+ }, {
1960
+ version: 1,
1961
+ importContainerKey: fileUploadImportContainerKey,
1962
+ resourceKey: 'sample',
1963
+ id: '702fbe9e-81c2-4daf-abd9-4c3f10ed9431',
1964
+ state: 'imported',
1965
+ resourceVersion: 1,
1966
+ errors: [],
1967
+ createdAt: '2021-08-02T12:25:27.585Z',
1968
+ lastModifiedAt: '2021-08-02T12:25:32.802Z',
1969
+ expiresAt: '2021-08-04T12:25:27.585Z',
1970
+ tags: ['rowStartNumber:10']
1971
+ }];
1972
+ const allFileUploadImportOperationsResponse = {
1973
+ limit: 20,
1974
+ offset: 0,
1975
+ count: 10,
1976
+ total: 10,
1977
+ results: allFileUploadImportOperations
1978
+ };
1979
+ const allAutomatedImportOperationsResponse = {
1980
+ limit: 20,
1981
+ offset: 0,
1982
+ count: 10,
1983
+ total: 10,
1984
+ results: allAutomatedImportOperations
1985
+ };
1986
+ const successfulAutomatedImportOperations = [{
1987
+ version: 1,
1988
+ importContainerKey: automatedImportContainerKey,
1989
+ resourceKey: 'sample-2',
1990
+ id: 'c350f282-af46-44bd-b7fb-7767fe060b5d',
1991
+ state: 'imported',
1992
+ resourceVersion: 1,
1993
+ errors: [],
1994
+ createdAt: '2021-08-03T10:13:10.544Z',
1995
+ lastModifiedAt: '2021-08-03T10:13:11.056Z',
1996
+ expiresAt: '2021-08-05T10:13:10.544Z'
1997
+ }];
1998
+ const successfulAutomatedImportOperationsResponse = {
1999
+ limit: 1,
2000
+ offset: 0,
2001
+ count: 1,
2002
+ total: 1,
2003
+ results: successfulAutomatedImportOperations
2004
+ };
2005
+ const successfulFileUploadImportOperationsResponse = {
2006
+ limit: 1,
2007
+ offset: 0,
2008
+ count: 1,
2009
+ total: 1,
2010
+ results: successfulFileUploadImportOperations
2011
+ };
2012
+ const fileUploadMissingKeysResponse = {
2013
+ code: 'MissingCsvFieldIdentifier',
2014
+ message: 'Importing a new field without an identifier is not allowed',
2015
+ rowValue: {
2016
+ uri: 'http://example.com/asset-source-without-key',
2017
+ key: undefined
2018
+ },
2019
+ metadata: {
2020
+ row: 1
2021
+ }
2022
+ };
2023
+ const validProcessFileResponse = {
2024
+ message: 'acknowledged'
2025
+ };
2026
+ const exportOperationsCompleted = [{
2027
+ id: '10df6fe9252eeb1d54485795',
2028
+ fileName: 'test-12345.json',
2029
+ fileFormat: 'json',
2030
+ resourceType: 'category',
2031
+ createdAt: '2023-04-01T12:00:00.000Z',
2032
+ state: 'completed',
2033
+ query: 'query ExportCategories { categories { id } }',
2034
+ completedPercentage: 100,
2035
+ resourceCount: 100,
2036
+ fields: ['id'],
2037
+ locales: ['en']
2038
+ }, {
2039
+ id: '10df6fe9252eeb1d54485796',
2040
+ fileName: 'test-123456.csv',
2041
+ fileFormat: 'csv',
2042
+ resourceType: 'category',
2043
+ createdAt: '2023-04-02T12:00:00.000Z',
2044
+ state: 'completed',
2045
+ query: 'query ExportCategories { categories { id } }',
2046
+ completedPercentage: 100,
2047
+ resourceCount: 100,
2048
+ fields: ['id'],
2049
+ locales: ['en']
2050
+ }];
2051
+ const exportOperationsProcessing = [{
2052
+ id: '10df6fe9252eeb1d54485797',
2053
+ fileName: 'test-1234567.json',
2054
+ fileFormat: 'json',
2055
+ resourceType: 'category',
2056
+ createdAt: '2023-04-01T12:00:00.000Z',
2057
+ state: 'processing',
2058
+ query: 'query ExportCategories { categories { id } }',
2059
+ completedPercentage: 50,
2060
+ resourceCount: 100,
2061
+ fields: ['id'],
2062
+ locales: ['en']
2063
+ }, {
2064
+ id: '10df6fe9252eeb1d54485798',
2065
+ fileName: 'test-12345678.csv',
2066
+ fileFormat: 'csv',
2067
+ resourceType: 'category',
2068
+ createdAt: '2023-04-02T12:00:00.000Z',
2069
+ state: 'processing',
2070
+ query: 'query ExportCategories { categories { id } }',
2071
+ completedPercentage: 33,
2072
+ resourceCount: 100,
2073
+ fields: ['id'],
2074
+ locales: ['en']
2075
+ }];
2076
+ const validFileImportJobQueued = {
2077
+ id: 'job-uuid-12345',
2078
+ fileName: 'categories.csv',
2079
+ importContainerKey: 'container-key',
2080
+ state: 'queued',
2081
+ summary: {
2082
+ total: 0,
2083
+ valid: 0,
2084
+ invalid: 0,
2085
+ fieldsCount: 0,
2086
+ fields: [],
2087
+ ignoredFields: []
2088
+ }
2089
+ };
2090
+ const validFileImportJobProcessing = {
2091
+ id: 'job-uuid-12345',
2092
+ fileName: 'categories.csv',
2093
+ importContainerKey: 'container-key',
2094
+ state: 'processing',
2095
+ summary: {
2096
+ total: 0,
2097
+ valid: 0,
2098
+ invalid: 0,
2099
+ fieldsCount: 0,
2100
+ fields: [],
2101
+ ignoredFields: []
2102
+ }
2103
+ };
2104
+ const validFileImportJobValidated = {
2105
+ id: 'job-uuid-12345',
2106
+ fileName: 'categories.csv',
2107
+ importContainerKey: 'container-key',
2108
+ state: 'validated',
2109
+ summary: {
2110
+ total: 2,
2111
+ valid: 2,
2112
+ invalid: 0,
2113
+ fieldsCount: 2,
2114
+ fields: ['key', 'name.en'],
2115
+ ignoredFields: ['id', 'lastModifiedAt']
2116
+ }
2117
+ };
2118
+ const invalidFileImportJobValidated = {
2119
+ id: 'job-uuid-12345',
2120
+ fileName: 'categories.csv',
2121
+ importContainerKey: 'container-key',
2122
+ state: 'validated',
2123
+ summary: {
2124
+ total: 2,
2125
+ valid: 0,
2126
+ invalid: 2,
2127
+ fieldsCount: 11,
2128
+ fields: ['key', 'externalId2', 'orderHint', 'name.de2', 'description.de2', 'slug.RU', 'name.enn', 'description.en', 'slug.RU', 'test1', 'test2'],
2129
+ ignoredFields: []
2130
+ }
2131
+ };
2132
+ const validFileImportJobRecordsResponse = {
2133
+ results: [],
2134
+ total: 0,
2135
+ limit: 20,
2136
+ offset: 0,
2137
+ count: 0
2138
+ };
2139
+ const invalidFileImportJobRecordsResponse = {
2140
+ results: [{
2141
+ index: 1,
2142
+ errors: [{
2143
+ code: 'InvalidField',
2144
+ message: '"externalId2" is not allowed',
2145
+ field: 'externalId2'
2146
+ }, {
2147
+ code: 'InvalidField',
2148
+ message: '"orderHint" is not allowed',
2149
+ field: 'orderHint'
2150
+ }]
2151
+ }, {
2152
+ index: 2,
2153
+ errors: [{
2154
+ code: 'InvalidField',
2155
+ message: '"name.de2" is not allowed',
2156
+ field: 'name.de2'
2157
+ }]
2158
+ }],
2159
+ total: 2,
2160
+ limit: 20,
2161
+ offset: 0,
2162
+ count: 2
2163
+ };
2164
+ const processFileImportJobResponse = {
2165
+ message: 'acknowledged'
2166
+ };
2167
+
2168
+ function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2169
+ function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2170
+ const FileIcon = props => /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$5(_objectSpread$5({
2171
+ width: "32",
2172
+ height: "32",
2173
+ viewBox: "0 0 32 32",
2174
+ fill: "none",
2175
+ xmlns: "http://www.w3.org/2000/svg"
2176
+ }, props), {}, {
2177
+ children: [/*#__PURE__*/jsxRuntime.jsx("mask", {
2178
+ id: "mask0_17_6643",
2179
+ style: {
2180
+ maskType: 'alpha'
2181
+ },
2182
+ maskUnits: "userSpaceOnUse",
2183
+ x: "0",
2184
+ y: "0",
2185
+ width: "32",
2186
+ height: "32",
2187
+ children: /*#__PURE__*/jsxRuntime.jsx("rect", {
2188
+ width: "32",
2189
+ height: "32",
2190
+ fill: "#D9D9D9"
2191
+ })
2192
+ }), /*#__PURE__*/jsxRuntime.jsx("g", {
2193
+ mask: "url(#mask0_17_6643)",
2194
+ children: /*#__PURE__*/jsxRuntime.jsx("path", {
2195
+ d: "M14.6667 25.3333H17.3333V19.7667L19.4667 21.9L21.3333 20L16 14.6667L10.6667 20L12.5667 21.8667L14.6667 19.7667V25.3333ZM8 29.3333C7.26667 29.3333 6.63889 29.0722 6.11667 28.55C5.59444 28.0278 5.33333 27.4 5.33333 26.6667V5.33332C5.33333 4.59999 5.59444 3.97221 6.11667 3.44999C6.63889 2.92777 7.26667 2.66666 8 2.66666H18.6667L26.6667 10.6667V26.6667C26.6667 27.4 26.4056 28.0278 25.8833 28.55C25.3611 29.0722 24.7333 29.3333 24 29.3333H8ZM17.3333 12H24L17.3333 5.33332V12Z",
2196
+ fill: "#B1ACFF"
2197
+ })
2198
+ })]
2199
+ }));
2200
+
2201
+ const EnabledDropArea = _ref => {
2202
+ let dragAndDropText = _ref.dragAndDropText,
2203
+ orText = _ref.orText,
2204
+ browseFileText = _ref.browseFileText;
2205
+ return /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Inline, {
2206
+ alignItems: "center",
2207
+ justifyContent: "center",
2208
+ scale: "s",
2209
+ children: [/*#__PURE__*/jsxRuntime.jsx(FileIcon, {}), /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Inline, {
2210
+ alignItems: "center",
2211
+ scale: "s",
2212
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Subheadline, {
2213
+ as: "h4",
2214
+ children: dragAndDropText
2215
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Body, {
2216
+ children: orText
2217
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.Link, {
2218
+ tone: "secondary",
2219
+ to: "",
2220
+ onClick: ev => ev.preventDefault(),
2221
+ children: browseFileText
2222
+ })]
2223
+ })]
2224
+ });
2225
+ };
2226
+
2227
+ const FileDroppedArea = _ref => {
2228
+ let fileName = _ref.fileName,
2229
+ chooseFileLabel = _ref.chooseFileLabel;
2230
+ return /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Stack, {
2231
+ alignItems: "center",
2232
+ scale: "s",
2233
+ children: [/*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Inline, {
2234
+ alignItems: "flex-start",
2235
+ scale: "xs",
2236
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiKit.PaperclipIcon, {
2237
+ color: "neutral60"
2238
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
2239
+ max: 13,
2240
+ children: /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Body, {
2241
+ children: fileName
2242
+ })
2243
+ })]
2244
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.SecondaryButton, {
2245
+ tone: "secondary",
2246
+ size: "medium",
2247
+ label: chooseFileLabel
2248
+ })]
2249
+ });
2250
+ };
2251
+
2252
+ const ActiveDragDropArea = _ref => {
2253
+ let isFileDropped = _ref.isFileDropped,
2254
+ fileName = _ref.fileName,
2255
+ chooseFileLabel = _ref.chooseFileLabel,
2256
+ dragAndDropText = _ref.dragAndDropText,
2257
+ orText = _ref.orText,
2258
+ browseFileText = _ref.browseFileText;
2259
+ if (isFileDropped) {
2260
+ return /*#__PURE__*/jsxRuntime.jsx(FileDroppedArea, {
2261
+ fileName: fileName,
2262
+ chooseFileLabel: chooseFileLabel
2263
+ });
2264
+ }
2265
+ return /*#__PURE__*/jsxRuntime.jsx(EnabledDropArea, {
2266
+ dragAndDropText: dragAndDropText,
2267
+ orText: orText,
2268
+ browseFileText: browseFileText
2269
+ });
2270
+ };
2271
+
2272
+ function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2273
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2274
+ const LockIcon = props => /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$4(_objectSpread$4({
2275
+ width: "87px",
2276
+ height: "118px",
2277
+ viewBox: "0 0 87 118",
2278
+ version: "1.1",
2279
+ xmlns: "http://www.w3.org/2000/svg",
2280
+ xmlnsXlink: "http://www.w3.org/1999/xlink"
2281
+ }, props), {}, {
2282
+ children: [/*#__PURE__*/jsxRuntime.jsx("title", {
2283
+ children: "Shape"
2284
+ }), /*#__PURE__*/jsxRuntime.jsx("g", {
2285
+ id: "Final-ImportBoard",
2286
+ stroke: "none",
2287
+ strokeWidth: "1",
2288
+ fill: "none",
2289
+ fillRule: "evenodd",
2290
+ children: /*#__PURE__*/jsxRuntime.jsx("g", {
2291
+ id: "2-Upload-files---Locked",
2292
+ transform: "translate(-697.000000, -285.000000)",
2293
+ fill: "#999999",
2294
+ fillRule: "nonzero",
2295
+ children: /*#__PURE__*/jsxRuntime.jsx("path", {
2296
+ d: "M781.167075,334.924997 L774.342717,334.924997 L774.342717,319.039771 C774.342717,300.267972 759.042508,285 740.22093,285 C721.403902,285 706.099143,300.267972 706.099143,319.039771 L706.099143,334.924997 L699.274786,334.924997 C698.019104,334.924997 697,335.941652 697,337.194315 L697,389.184392 C697,389.974114 697.414011,390.709373 698.087348,391.122389 C710.839797,398.892534 725.407525,403 740.22093,403 C755.034335,403 769.602064,398.892534 782.359062,391.122389 C783.027849,390.709373 783.44186,389.974114 783.44186,389.184392 L783.44186,337.194315 C783.44186,335.941652 782.418207,334.924997 781.167075,334.924997 Z M745.590495,368.913821 L745.590495,384.782392 C745.590495,386.353821 744.382343,387.639535 742.905713,387.639535 L737.536148,387.639535 C736.054148,387.639535 734.851365,386.353821 734.851365,384.782392 L734.851365,368.913821 C731.651104,366.930963 729.4818,363.296678 729.4818,359.068106 C729.4818,352.759535 734.29293,347.639535 740.22093,347.639535 C746.14893,347.639535 750.960061,352.759535 750.960061,359.068106 C750.960061,363.285249 748.790756,366.930963 745.590495,368.913821 Z M760.116279,334.395349 L718.953488,334.395349 L718.953488,318.787791 C718.953488,307.724262 728.187674,298.72093 739.534884,298.72093 C750.877519,298.72093 760.116279,307.724262 760.116279,318.787791 L760.116279,334.395349 Z",
2297
+ id: "Shape"
2298
+ })
2299
+ })
2300
+ })]
2301
+ }));
2302
+
2303
+ const DisabledDropArea = _ref => {
2304
+ let disabledMessage = _ref.disabledMessage;
2305
+ return /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Stack, {
2306
+ alignItems: "center",
2307
+ children: [/*#__PURE__*/jsxRuntime.jsx(LockIcon, {}), disabledMessage && /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Body, {
2308
+ children: disabledMessage
2309
+ })]
2310
+ });
2311
+ };
2312
+
2313
+ const getBorderColor = state => {
2314
+ const borderColors = {
2315
+ default: '#909dbc',
2316
+ error: '#e60050',
2317
+ active: uiKit.customProperties.colorPrimary
2318
+ };
2319
+ return borderColors[state] || borderColors.default;
2320
+ };
2321
+ const getDashedBorder = function () {
2322
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
2323
+ const color = getBorderColor(state);
2324
+ const svgContent = `
2325
+ <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
2326
+ <rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
2327
+ </svg>
2328
+ `;
2329
+ return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
2330
+ };
2331
+ const base = /*#__PURE__*/react.css("border-radius:", uiKit.customProperties.borderRadius6, ";min-height:136px;display:flex;justify-content:center;align-items:center;" + (process.env.NODE_ENV === "production" ? "" : ";label:base;"));
2332
+ const disabled = /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:disabled;");
2333
+ const readyForDrop = /*#__PURE__*/react.css("background-image:url('", getDashedBorder(), "');background-color:", uiKit.customProperties.colorSurface, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:readyForDrop;"));
2334
+ const activeDrag = /*#__PURE__*/react.css("background-image:url('", getDashedBorder('active'), "');background-color:", uiKit.customProperties.colorPrimary95, ";padding:", uiKit.customProperties.spacing50, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:activeDrag;"));
2335
+ const fileDropped = /*#__PURE__*/react.css("background-image:url('", getDashedBorder(), "');background-color:", uiKit.customProperties.colorSurface, ";padding:", uiKit.customProperties.spacing50, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:fileDropped;"));
2336
+ const invalid = /*#__PURE__*/react.css("background-image:url('", getDashedBorder('default'), "');background-color:", uiKit.customProperties.colorSurface, ";padding:", uiKit.customProperties.spacing70, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:invalid;"));
2337
+ const parsing = /*#__PURE__*/react.css("background-image:url('", getDashedBorder(), "');background-color:", uiKit.customProperties.colorSurface, ";padding:", uiKit.customProperties.spacing50, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:parsing;"));
2338
+ const dropAreaStyles = {
2339
+ base,
2340
+ readyForDrop,
2341
+ fileDropped,
2342
+ disabled,
2343
+ activeDrag,
2344
+ invalid,
2345
+ parsing
2346
+ };
2347
+
2348
+ const DropAreaWrapper = /*#__PURE__*/_styled__default["default"]("div", process.env.NODE_ENV === "production" ? {
2349
+ target: "exmxphg0"
2350
+ } : {
2351
+ target: "exmxphg0",
2352
+ label: "DropAreaWrapper"
2353
+ })(dropAreaStyles.base, " ", props => {
2354
+ if (props.dropAreaState === 'disabled') {
2355
+ return dropAreaStyles.disabled;
2356
+ }
2357
+ if (props.dropAreaState === 'ready-for-drop') {
2358
+ return dropAreaStyles.readyForDrop;
2359
+ }
2360
+ if (props.dropAreaState === 'active-drag') {
2361
+ return dropAreaStyles.activeDrag;
2362
+ }
2363
+ if (props.dropAreaState === 'invalid') {
2364
+ return dropAreaStyles.invalid;
2365
+ }
2366
+ if (props.dropAreaState === 'is-parsing') {
2367
+ return dropAreaStyles.parsing;
2368
+ }
2369
+ if (props.dropAreaState === 'file-dropped') {
2370
+ return dropAreaStyles.fileDropped;
2371
+ }
2372
+ return getDefaultDropWrapperStyles(props.dropAreaState);
2373
+ }, ";");
2374
+ function getDefaultDropWrapperStyles(_dropAreaState) {
2375
+ return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;");
2376
+ }
2377
+
2378
+ function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2379
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$3(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2380
+ const FileDropArea = _ref => {
2381
+ let onDrop = _ref.onDrop,
2382
+ disabled = _ref.disabled,
2383
+ accept = _ref.accept,
2384
+ getDropAreaState = _ref.getDropAreaState,
2385
+ children = _ref.children,
2386
+ handleDropRejected = _ref.onDropRejected;
2387
+ const _useDropzone = reactDropzone.useDropzone({
2388
+ onDrop,
2389
+ multiple: false,
2390
+ disabled,
2391
+ accept,
2392
+ onDropRejected: _ref2 => {
2393
+ var _context, _context2, _context3, _context4, _context5, _context6;
2394
+ let _ref3 = _slicedToArray(_ref2, 1),
2395
+ rejectedFile = _ref3[0];
2396
+ if (!handleDropRejected) return;
2397
+ if (((_context = rejectedFile) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _someInstanceProperty__default["default"](_context2 = _context.errors), _context2))?.(error => error.code === 'too-many-files')) {
2398
+ handleDropRejected('too-many-files');
2399
+ return;
2400
+ }
2401
+ if (((_context4 = rejectedFile) == null ? void 0 : _bindInstanceProperty__default["default"](_context6 = Function.call).call(_context6, _someInstanceProperty__default["default"](_context5 = _context4.errors), _context5))?.(error => error.code === 'file-invalid-type')) {
2402
+ handleDropRejected('invalid-type');
2403
+ } else {
2404
+ handleDropRejected('generic');
2405
+ }
2406
+ }
2407
+ }),
2408
+ getRootProps = _useDropzone.getRootProps,
2409
+ getInputProps = _useDropzone.getInputProps,
2410
+ isDragActive = _useDropzone.isDragActive;
2411
+ const dropAreaState = getDropAreaState(isDragActive);
2412
+ return /*#__PURE__*/jsxRuntime.jsxs(DropAreaWrapper, _objectSpread$3(_objectSpread$3({
2413
+ role: "presentation"
2414
+ }, getRootProps()), {}, {
2415
+ dropAreaState: dropAreaState,
2416
+ children: [/*#__PURE__*/jsxRuntime.jsx("input", _objectSpread$3({
2417
+ "data-testid": "file-input"
2418
+ }, getInputProps())), /*#__PURE__*/jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
2419
+ children: children(dropAreaState)
2420
+ })]
2421
+ }));
2422
+ };
2423
+
2424
+ const InfoBox = _ref => {
2425
+ let title = _ref.title,
2426
+ description = _ref.description;
2427
+ return /*#__PURE__*/jsxRuntime.jsx(uiKit.ContentNotification, {
2428
+ type: "info",
2429
+ children: /*#__PURE__*/jsxRuntime.jsx(uiKit.Spacings.Inset, {
2430
+ scale: "xs",
2431
+ children: /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Stack, {
2432
+ scale: "xs",
2433
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Subheadline, {
2434
+ as: "h4",
2435
+ children: title
2436
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Body, {
2437
+ children: description
2438
+ })]
2439
+ })
2440
+ })
2441
+ });
2442
+ };
2443
+
2444
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2445
+ var _ref = process.env.NODE_ENV === "production" ? {
2446
+ name: "lt3z56",
2447
+ styles: "width:calc(50% - 16px)"
2448
+ } : {
2449
+ name: "1vfe1dp-UploadSeparator",
2450
+ styles: "width:calc(50% - 16px);label:UploadSeparator;",
2451
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
2452
+ };
2453
+ const UploadSeparator = _ref2 => {
2454
+ let value = _ref2.value,
2455
+ onChange = _ref2.onChange,
2456
+ separatorTitle = _ref2.separatorTitle,
2457
+ decimalsSeparatorDescription = _ref2.decimalsSeparatorDescription,
2458
+ decimalSeparatorPointLabel = _ref2.decimalSeparatorPointLabel,
2459
+ decimalSeparatorCommaLabel = _ref2.decimalSeparatorCommaLabel,
2460
+ decimalsLabel = _ref2.decimalsLabel;
2461
+ const decimalSeparatorOptions = [{
2462
+ label: decimalSeparatorPointLabel,
2463
+ value: DELIMITERS.POINT
2464
+ }, {
2465
+ label: decimalSeparatorCommaLabel,
2466
+ value: DELIMITERS.COMMA
2467
+ }];
2468
+ return /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Stack, {
2469
+ scale: "m",
2470
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2471
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Subheadline, {
2472
+ as: "h4",
2473
+ children: separatorTitle
2474
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Caption, {
2475
+ tone: "tertiary",
2476
+ children: decimalsSeparatorDescription
2477
+ })]
2478
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2479
+ css: _ref,
2480
+ children: /*#__PURE__*/jsxRuntime.jsx(uiKit.SelectField, {
2481
+ title: decimalsLabel,
2482
+ isSearchable: false,
2483
+ options: decimalSeparatorOptions,
2484
+ value: value,
2485
+ onChange: e => {
2486
+ onChange(e.target.value);
2487
+ }
2488
+ })
2489
+ })]
2490
+ });
2491
+ };
2492
+
2493
+ const UploadSettings = _ref => {
2494
+ let resourceType = _ref.resourceType,
2495
+ isPublishChecked = _ref.isPublishChecked,
2496
+ onPublishChange = _ref.onPublishChange,
2497
+ publishProductsLabel = _ref.publishProductsLabel,
2498
+ dataTrackingTarget = _ref.dataTrackingTarget,
2499
+ canPublishProducts = _ref.canPublishProducts;
2500
+ if (resourceType !== 'product' || !canPublishProducts) {
2501
+ return null;
2502
+ }
2503
+ return /*#__PURE__*/jsxRuntime.jsx(uiKit.CheckboxInput, {
2504
+ "data-tracking-target": dataTrackingTarget,
2505
+ isChecked: isPublishChecked,
2506
+ onChange: e => {
2507
+ onPublishChange(e.target.checked);
2508
+ },
2509
+ children: publishProductsLabel
2510
+ });
2511
+ };
2512
+
2513
+ const UploadingModal = _ref => {
2514
+ let isOpen = _ref.isOpen,
2515
+ title = _ref.title,
2516
+ fileName = _ref.fileName,
2517
+ fileSize = _ref.fileSize,
2518
+ progress = _ref.progress,
2519
+ cancelLabel = _ref.cancelLabel,
2520
+ onCancel = _ref.onCancel,
2521
+ onClose = _ref.onClose,
2522
+ statusMessage = _ref.statusMessage;
2523
+ return /*#__PURE__*/jsxRuntime.jsx(applicationComponents.InfoDialog, {
2524
+ size: 16,
2525
+ isOpen: isOpen,
2526
+ title: title,
2527
+ onClose: onClose,
2528
+ children: /*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Stack, {
2529
+ scale: "m",
2530
+ children: [/*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Inline, {
2531
+ alignItems: "center",
2532
+ justifyContent: "space-between",
2533
+ children: [/*#__PURE__*/jsxRuntime.jsxs(uiKit.Spacings.Inline, {
2534
+ alignItems: "center",
2535
+ children: [/*#__PURE__*/jsxRuntime.jsx(FileIcon, {}), /*#__PURE__*/jsxRuntime.jsx(uiKit.Spacings.Inline, {
2536
+ children: /*#__PURE__*/jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
2537
+ max: 10,
2538
+ children: /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Body, {
2539
+ truncate: true,
2540
+ isBold: true,
2541
+ children: fileName
2542
+ })
2543
+ })
2544
+ }), /*#__PURE__*/jsxRuntime.jsxs(uiKit.Text.Body, {
2545
+ tone: "secondary",
2546
+ children: ["(", convertFileSizeToKB(fileSize).toLocaleString(), " KB)"]
2547
+ })]
2548
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.SecondaryButton, {
2549
+ tone: "secondary",
2550
+ size: "medium",
2551
+ label: cancelLabel,
2552
+ onClick: onCancel
2553
+ })]
2554
+ }), /*#__PURE__*/jsxRuntime.jsx(uiKit.ProgressBar, {
2555
+ barWidth: "scale",
2556
+ height: "10",
2557
+ progress: progress
2558
+ }), statusMessage && /*#__PURE__*/jsxRuntime.jsx(uiKit.Text.Detail, {
2559
+ tone: "tertiary",
2560
+ children: statusMessage
2561
+ })]
2562
+ })
2563
+ });
2564
+ };
2565
+
2566
+ const useFetch = function (fetchFunction) {
2567
+ let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2568
+ const _React$useState = React__default["default"].useState(null),
2569
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2570
+ data = _React$useState2[0],
2571
+ setData = _React$useState2[1];
2572
+ const _React$useState3 = React__default["default"].useState(null),
2573
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2574
+ error = _React$useState4[0],
2575
+ setError = _React$useState4[1];
2576
+ const _React$useState5 = React__default["default"].useState(false),
2577
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
2578
+ isLoading = _React$useState6[0],
2579
+ setIsLoading = _React$useState6[1];
2580
+ const _React$useState7 = React__default["default"].useState(0),
2581
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
2582
+ refetchCount = _React$useState8[0],
2583
+ setRefetchCount = _React$useState8[1];
2584
+ const _React$useState9 = React__default["default"].useState(new Date()),
2585
+ _React$useState0 = _slicedToArray(_React$useState9, 2),
2586
+ lastFetchTime = _React$useState0[0],
2587
+ setLastFetchTime = _React$useState0[1];
2588
+ const refetch = React__default["default"].useCallback(() => {
2589
+ setRefetchCount(count => count + 1);
2590
+ }, []);
2591
+ React__default["default"].useEffect(() => {
2592
+ let pollingId = null;
2593
+ const fetchData = async () => {
2594
+ setIsLoading(true);
2595
+ try {
2596
+ const response = await fetchFunction();
2597
+ setData(response);
2598
+ setLastFetchTime(new Date());
2599
+ if (config.shouldContinuePolling && !config.shouldContinuePolling(response)) {
2600
+ if (pollingId) {
2601
+ clearInterval(pollingId);
2602
+ pollingId = null;
2603
+ }
2604
+ }
2605
+ } catch (err) {
2606
+ const error = err instanceof Error ? err : new Error(String(err));
2607
+ setError(error);
2608
+ if (!(err instanceof HttpError)) {
2609
+ sentry.reportErrorToSentry(new Error('An unexpected error occurred in the `useFetch` hook'), {
2610
+ extra: {
2611
+ error: err
2612
+ }
2613
+ });
2614
+ }
2615
+ } finally {
2616
+ setIsLoading(false);
2617
+ }
2618
+ };
2619
+ fetchData();
2620
+ if (config.pollingInterval && config.pollingInterval > 0) {
2621
+ pollingId = _setInterval__default["default"](fetchData, config.pollingInterval);
2622
+ }
2623
+ return () => {
2624
+ if (pollingId) {
2625
+ clearInterval(pollingId);
2626
+ }
2627
+ setError(null);
2628
+ setIsLoading(false);
2629
+ };
2630
+ }, [fetchFunction, refetchCount, config.pollingInterval, config.shouldContinuePolling]);
2631
+ return {
2632
+ data,
2633
+ error,
2634
+ isLoading,
2635
+ refetch,
2636
+ lastFetchTime
2637
+ };
2638
+ };
2639
+
2640
+ const useFetchExportOperations = _ref => {
2641
+ let projectKey = _ref.projectKey,
2642
+ queryParams = _ref.queryParams,
2643
+ pollingInterval = _ref.pollingInterval,
2644
+ shouldContinuePolling = _ref.shouldContinuePolling;
2645
+ const fetchData = React__default["default"].useCallback(() => {
2646
+ if (!projectKey) {
2647
+ return _Promise__default["default"].reject(new ProjectKeyNotAvailableError());
2648
+ }
2649
+ return fetchExportOperations({
2650
+ projectKey,
2651
+ queryParams
2652
+ });
2653
+ }, [projectKey, queryParams]);
2654
+ return useFetch(fetchData, {
2655
+ pollingInterval,
2656
+ shouldContinuePolling
2657
+ });
2658
+ };
2659
+
2660
+ const useFetchFileImportJob = _ref => {
2661
+ let projectKey = _ref.projectKey,
2662
+ importContainerKey = _ref.importContainerKey,
2663
+ jobId = _ref.jobId,
2664
+ pollingInterval = _ref.pollingInterval,
2665
+ shouldContinuePolling = _ref.shouldContinuePolling;
2666
+ const fetchData = React__default["default"].useCallback(() => {
2667
+ if (!projectKey) {
2668
+ return _Promise__default["default"].reject(new ProjectKeyNotAvailableError());
2669
+ }
2670
+ return getFileImportJob({
2671
+ projectKey,
2672
+ importContainerKey,
2673
+ jobId
2674
+ });
2675
+ }, [projectKey, importContainerKey, jobId]);
2676
+ return useFetch(fetchData, {
2677
+ pollingInterval,
2678
+ shouldContinuePolling
2679
+ });
2680
+ };
2681
+
2682
+ const useFetchImportContainerDetails = _ref => {
2683
+ let projectKey = _ref.projectKey,
2684
+ importContainerKey = _ref.importContainerKey,
2685
+ pollingInterval = _ref.pollingInterval,
2686
+ shouldContinuePolling = _ref.shouldContinuePolling;
2687
+ const fetchData = React__default["default"].useCallback(() => {
2688
+ if (!projectKey) {
2689
+ return _Promise__default["default"].reject(new ProjectKeyNotAvailableError());
2690
+ }
2691
+ return fetchImportContainerDetails({
2692
+ projectKey,
2693
+ importContainerKey
2694
+ });
2695
+ }, [projectKey, importContainerKey]);
2696
+ return useFetch(fetchData, {
2697
+ pollingInterval,
2698
+ shouldContinuePolling
2699
+ });
2700
+ };
2701
+
2702
+ const useFetchImportOperations = _ref => {
2703
+ let projectKey = _ref.projectKey,
2704
+ importContainerKey = _ref.importContainerKey,
2705
+ queryParams = _ref.queryParams,
2706
+ pollingInterval = _ref.pollingInterval,
2707
+ shouldContinuePolling = _ref.shouldContinuePolling;
2708
+ const fetchData = React__default["default"].useCallback(() => {
2709
+ if (!projectKey) {
2710
+ return _Promise__default["default"].reject(new ProjectKeyNotAvailableError());
2711
+ }
2712
+ return fetchImportOperations({
2713
+ projectKey,
2714
+ importContainerKey,
2715
+ queryParams
2716
+ });
2717
+ }, [projectKey, importContainerKey, queryParams]);
2718
+ return useFetch(fetchData, {
2719
+ pollingInterval,
2720
+ shouldContinuePolling
2721
+ });
2722
+ };
2723
+
2724
+ const useFetchImportSummaries = _ref => {
2725
+ let projectKey = _ref.projectKey,
2726
+ queryParams = _ref.queryParams,
2727
+ pollingInterval = _ref.pollingInterval,
2728
+ shouldContinuePolling = _ref.shouldContinuePolling;
2729
+ const fetchData = React__default["default"].useCallback(async () => {
2730
+ if (!projectKey) {
2731
+ return _Promise__default["default"].reject(new ProjectKeyNotAvailableError());
2732
+ }
2733
+ const summary = await fetchImportSummaries({
2734
+ projectKey,
2735
+ queryParams
2736
+ });
2737
+ const resolvedResults = await _Promise__default["default"].all(summary.results);
2738
+ return {
2739
+ results: resolvedResults,
2740
+ count: summary.count,
2741
+ total: summary.total
2742
+ };
2743
+ }, [projectKey, queryParams]);
2744
+ return useFetch(fetchData, {
2745
+ pollingInterval,
2746
+ shouldContinuePolling
2747
+ });
2748
+ };
2749
+
2750
+ function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2751
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2752
+ const useFileImportJobUpload = _ref => {
2753
+ let projectKey = _ref.projectKey;
2754
+ const _React$useState = React__default["default"].useState(false),
2755
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2756
+ isUploading = _React$useState2[0],
2757
+ setIsUploading = _React$useState2[1];
2758
+ const _React$useState3 = React__default["default"].useState(0),
2759
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2760
+ progress = _React$useState4[0],
2761
+ setProgress = _React$useState4[1];
2762
+ const upload = React__default["default"].useCallback(async config => {
2763
+ if (!projectKey) {
2764
+ throw new ProjectKeyNotAvailableError();
2765
+ }
2766
+ setIsUploading(true);
2767
+ setProgress(0);
2768
+ const importContainerKey = encodeFileNameWithTimestampToContainerKey(config.file.name);
2769
+ try {
2770
+ await createImportContainerForFileUpload({
2771
+ importContainerDraft: _objectSpread$2({
2772
+ key: importContainerKey,
2773
+ resourceType: config.resourceType,
2774
+ tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
2775
+ }, config.settings ? {
2776
+ settings: config.settings
2777
+ } : {}),
2778
+ projectKey
2779
+ });
2780
+ const jobResponse = await createFileImportJob({
2781
+ projectKey,
2782
+ resourceType: config.resourceType,
2783
+ importContainerKey,
2784
+ payload: {
2785
+ fileType: getFileImportJobFileType(config.resourceType),
2786
+ fileName: config.file.name,
2787
+ file: config.file
2788
+ },
2789
+ onProgress: uploadProgress => {
2790
+ setProgress(uploadProgress);
2791
+ config.onProgress?.(uploadProgress);
2792
+ },
2793
+ abortSignal: config.abortSignal
2794
+ });
2795
+ setIsUploading(false);
2796
+ setProgress(100);
2797
+ config.onSuccess(jobResponse.id, importContainerKey);
2798
+ } catch (error) {
2799
+ try {
2800
+ await deleteImportContainer({
2801
+ projectKey,
2802
+ importContainerKey
2803
+ });
2804
+ } catch {
2805
+ // Ignore cleanup errors - container will be cleaned up by TTL retention policy
2806
+ // Cleanup errors are unlikely unless there is a network issue or container was removed externally
2807
+ }
2808
+ setIsUploading(false);
2809
+ setProgress(0);
2810
+ config.onError?.(error);
2811
+ }
2812
+ }, [projectKey]);
2813
+ return {
2814
+ upload,
2815
+ isUploading,
2816
+ progress
2817
+ };
2818
+ };
2819
+
2820
+ function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2821
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2822
+ const useImportContainerUpload = _ref => {
2823
+ let projectKey = _ref.projectKey;
2824
+ const _React$useState = React__default["default"].useState(false),
2825
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2826
+ isUploading = _React$useState2[0],
2827
+ setIsUploading = _React$useState2[1];
2828
+ const _React$useState3 = React__default["default"].useState(0),
2829
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2830
+ progress = _React$useState4[0],
2831
+ setProgress = _React$useState4[1];
2832
+ const xhrRef = React__default["default"].useRef(null);
2833
+ const upload = async _ref2 => {
2834
+ let file = _ref2.file,
2835
+ resourceType = _ref2.resourceType,
2836
+ settings = _ref2.settings,
2837
+ onSuccess = _ref2.onSuccess,
2838
+ onError = _ref2.onError,
2839
+ onProgress = _ref2.onProgress,
2840
+ abortSignal = _ref2.abortSignal;
2841
+ if (!projectKey) {
2842
+ throw new ProjectKeyNotAvailableError();
2843
+ }
2844
+ setIsUploading(true);
2845
+ setProgress(0);
2846
+ const importContainerKey = encodeFileNameWithTimestampToContainerKey(file.name);
2847
+ try {
2848
+ await createImportContainerForFileUpload({
2849
+ importContainerDraft: _objectSpread$1({
2850
+ key: importContainerKey,
2851
+ resourceType,
2852
+ tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
2853
+ }, settings ? {
2854
+ settings
2855
+ } : {}),
2856
+ projectKey
2857
+ });
2858
+ const xhr = uploadFileForImport({
2859
+ projectKey,
2860
+ importContainerKey,
2861
+ resourceType,
2862
+ file,
2863
+ abortSignal,
2864
+ onSuccess: response => {
2865
+ setIsUploading(false);
2866
+ setProgress(100);
2867
+ onSuccess(response, importContainerKey);
2868
+ },
2869
+ onProgress: prog => {
2870
+ setProgress(prog);
2871
+ onProgress?.(prog);
2872
+ },
2873
+ onError: async error => {
2874
+ try {
2875
+ await deleteImportContainer({
2876
+ projectKey,
2877
+ importContainerKey
2878
+ });
2879
+ } catch {
2880
+ // Ignore cleanup errors - container will be cleaned up by TTL retention policy
2881
+ // Cleanup errors are unlikely unless there is a network issue or container was removed externally
2882
+ }
2883
+ setIsUploading(false);
2884
+ setProgress(0);
2885
+ onError?.(error);
2886
+ }
2887
+ });
2888
+ xhrRef.current = xhr;
2889
+ return xhr;
2890
+ } catch (error) {
2891
+ try {
2892
+ await deleteImportContainer({
2893
+ projectKey,
2894
+ importContainerKey
2895
+ });
2896
+ } catch {
2897
+ // Ignore cleanup errors - container will be cleaned up by TTL retention policy
2898
+ // Cleanup errors are unlikely unless there is a network issue or container was removed externally
2899
+ }
2900
+ setIsUploading(false);
2901
+ setProgress(0);
2902
+ onError?.(error);
2903
+ return undefined;
2904
+ }
2905
+ };
2906
+ const abort = () => {
2907
+ xhrRef.current?.abort();
2908
+ setIsUploading(false);
2909
+ setProgress(0);
2910
+ };
2911
+ return {
2912
+ upload,
2913
+ abort,
2914
+ isUploading,
2915
+ progress
2916
+ };
2917
+ };
2918
+
2919
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
2920
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2921
+ const safeDeleteContainer = async _ref => {
2922
+ let projectKey = _ref.projectKey,
2923
+ containerKey = _ref.containerKey;
2924
+ try {
2925
+ await deleteImportContainer({
2926
+ projectKey,
2927
+ importContainerKey: containerKey
2928
+ });
2929
+ } catch {}
2930
+ };
2931
+ const useFileUpload = _ref2 => {
2932
+ let projectKey = _ref2.projectKey,
2933
+ _ref2$useJobBasedFlow = _ref2.useJobBasedFlow,
2934
+ useJobBasedFlow = _ref2$useJobBasedFlow === void 0 ? false : _ref2$useJobBasedFlow,
2935
+ _ref2$pollingInterval = _ref2.pollingInterval,
2936
+ pollingInterval = _ref2$pollingInterval === void 0 ? 5000 : _ref2$pollingInterval,
2937
+ _ref2$maxPollingAttem = _ref2.maxPollingAttempts,
2938
+ maxPollingAttempts = _ref2$maxPollingAttem === void 0 ? 120 : _ref2$maxPollingAttem;
2939
+ const _React$useState = React__default["default"].useState(false),
2940
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2941
+ isUploading = _React$useState2[0],
2942
+ setIsUploading = _React$useState2[1];
2943
+ const _React$useState3 = React__default["default"].useState(0),
2944
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2945
+ progress = _React$useState4[0],
2946
+ setProgress = _React$useState4[1];
2947
+ const _React$useState5 = React__default["default"].useState({
2948
+ processed: 0,
2949
+ isValidating: false
2950
+ }),
2951
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
2952
+ validationProgress = _React$useState6[0],
2953
+ setValidationProgress = _React$useState6[1];
2954
+ const containerUpload = useImportContainerUpload({
2955
+ projectKey
2956
+ });
2957
+ const jobUpload = useFileImportJobUpload({
2958
+ projectKey
2959
+ });
2960
+ const resetState = React__default["default"].useCallback(() => {
2961
+ setIsUploading(false);
2962
+ setProgress(0);
2963
+ setValidationProgress({
2964
+ processed: 0,
2965
+ isValidating: false
2966
+ });
2967
+ }, []);
2968
+ const upload = React__default["default"].useCallback(async config => {
2969
+ setIsUploading(true);
2970
+ setProgress(0);
2971
+ try {
2972
+ if (useJobBasedFlow) {
2973
+ await jobUpload.upload({
2974
+ file: config.file,
2975
+ resourceType: config.resourceType,
2976
+ settings: config.settings,
2977
+ abortSignal: config.abortSignal,
2978
+ onSuccess: async (jobId, containerKey) => {
2979
+ try {
2980
+ setValidationProgress({
2981
+ processed: 0,
2982
+ isValidating: true
2983
+ });
2984
+ const validatedJob = await pollJobUntilValidated({
2985
+ projectKey,
2986
+ jobId,
2987
+ importContainerKey: containerKey,
2988
+ pollingInterval,
2989
+ maxAttempts: maxPollingAttempts,
2990
+ abortSignal: config.abortSignal,
2991
+ onJobUpdate: job => {
2992
+ const processed = job.summary?.total ?? 0;
2993
+ setValidationProgress({
2994
+ processed,
2995
+ isValidating: true
2996
+ });
2997
+ config.onValidationProgress?.(job);
2998
+ }
2999
+ });
3000
+
3001
+ // Handle rejected job with jobError for the new flow (like MissingCsvFieldIdentifier error)
3002
+ // We wrap it in HttpError to reuse existing error handling (for the old flow) in consumers until BE supports this error type
3003
+ if (validatedJob.jobError) {
3004
+ throw new HttpError(400, validatedJob.jobError.message, validatedJob.jobError);
3005
+ }
3006
+ let results = [];
3007
+ if (validatedJob.summary.invalid > 0) {
3008
+ const recordsResponse = await getFileImportJobRecords({
3009
+ projectKey,
3010
+ importContainerKey: containerKey,
3011
+ jobId,
3012
+ limit: 500,
3013
+ isValid: false
3014
+ });
3015
+ results = recordsResponse.results;
3016
+ await safeDeleteContainer({
3017
+ projectKey,
3018
+ containerKey
3019
+ });
3020
+ }
3021
+ const result = {
3022
+ containerKey,
3023
+ summary: _objectSpread(_objectSpread({}, validatedJob.summary), {}, {
3024
+ results
3025
+ }),
3026
+ jobId,
3027
+ job: validatedJob
3028
+ };
3029
+ setIsUploading(false);
3030
+ setValidationProgress({
3031
+ processed: 0,
3032
+ isValidating: false
3033
+ });
3034
+ config.onSuccess(result);
3035
+ } catch (error) {
3036
+ await safeDeleteContainer({
3037
+ projectKey,
3038
+ containerKey
3039
+ });
3040
+ resetState();
3041
+ if (!(error instanceof PollingAbortedError)) {
3042
+ config.onError?.(error);
3043
+ }
3044
+ }
3045
+ },
3046
+ onProgress: prog => {
3047
+ setProgress(prog);
3048
+ config.onProgress?.(prog);
3049
+ },
3050
+ onError: error => {
3051
+ resetState();
3052
+ config.onError?.(error);
3053
+ }
3054
+ });
3055
+ } else {
3056
+ await containerUpload.upload({
3057
+ file: config.file,
3058
+ resourceType: config.resourceType,
3059
+ settings: config.settings,
3060
+ abortSignal: config.abortSignal,
3061
+ onSuccess: async (fileUploadResponse, containerKey) => {
3062
+ if (config.abortSignal?.aborted) {
3063
+ await safeDeleteContainer({
3064
+ projectKey,
3065
+ containerKey
3066
+ });
3067
+ resetState();
3068
+ return;
3069
+ }
3070
+ if (fileUploadResponse.invalid > 0) {
3071
+ await safeDeleteContainer({
3072
+ projectKey,
3073
+ containerKey
3074
+ });
3075
+ }
3076
+ const result = {
3077
+ containerKey,
3078
+ summary: {
3079
+ total: fileUploadResponse.itemsCount,
3080
+ valid: fileUploadResponse.valid,
3081
+ invalid: fileUploadResponse.invalid,
3082
+ fieldsCount: fileUploadResponse.columnsCount,
3083
+ fields: fileUploadResponse.fields || [],
3084
+ ignoredFields: fileUploadResponse.ignoredFields || [],
3085
+ results: fileUploadResponse.results || []
3086
+ }
3087
+ };
3088
+ setIsUploading(false);
3089
+ config.onSuccess(result);
3090
+ },
3091
+ onProgress: prog => {
3092
+ setProgress(prog);
3093
+ config.onProgress?.(prog);
3094
+ },
3095
+ onError: error => {
3096
+ resetState();
3097
+ config.onError?.(error);
3098
+ }
3099
+ });
3100
+ }
3101
+ } catch (error) {
3102
+ resetState();
3103
+ config.onError?.(error);
3104
+ }
3105
+ }, [projectKey, useJobBasedFlow, pollingInterval, maxPollingAttempts, containerUpload, jobUpload]);
3106
+ return {
3107
+ upload,
3108
+ isUploading,
3109
+ progress,
3110
+ validationProgress
3111
+ };
3112
+ };
3113
+
3114
+ exports.ActiveDragDropArea = ActiveDragDropArea;
3115
+ exports.COLUMN_DELIMITERS = COLUMN_DELIMITERS;
3116
+ exports.CT_API_DOCS_URL = CT_API_DOCS_URL;
3117
+ exports.DELIMITERS = DELIMITERS;
3118
+ exports.DisabledDropArea = DisabledDropArea;
3119
+ exports.DropAreaWrapper = DropAreaWrapper;
3120
+ exports.EnabledDropArea = EnabledDropArea;
3121
+ exports.FILE_IMPORT_JOB_POLLING_INTERVAL = FILE_IMPORT_JOB_POLLING_INTERVAL;
3122
+ exports.FileDropArea = FileDropArea;
3123
+ exports.FileDroppedArea = FileDroppedArea;
3124
+ exports.FileIcon = FileIcon;
3125
+ exports.HttpError = HttpError;
3126
+ exports.IMPORT_LEGACY_MAX_FILE_SIZE_MB = IMPORT_LEGACY_MAX_FILE_SIZE_MB;
3127
+ exports.IMPORT_LEGACY_MAX_ROW_COUNT = IMPORT_LEGACY_MAX_ROW_COUNT;
3128
+ exports.IMPORT_MAX_FILE_SIZE_MB = IMPORT_MAX_FILE_SIZE_MB;
3129
+ exports.IMPORT_MAX_ITEM_COUNT = IMPORT_MAX_ITEM_COUNT;
3130
+ exports.IMPORT_TAG_KEYS = IMPORT_TAG_KEYS;
3131
+ exports.IMPORT_TAG_VALUES = IMPORT_TAG_VALUES;
3132
+ exports.ImportStates = ImportStates;
3133
+ exports.InfoBox = InfoBox;
3134
+ exports.InvalidResponseError = InvalidResponseError;
3135
+ exports.LockIcon = LockIcon;
3136
+ exports.NoResourcesToExportError = NoResourcesToExportError;
3137
+ exports.PollingAbortedError = PollingAbortedError;
3138
+ exports.ProjectKeyNotAvailableError = ProjectKeyNotAvailableError;
3139
+ exports.QueryPredicateError = QueryPredicateError;
3140
+ exports.RESOURCE_TYPE_DOCUMENTATION_LINKS = RESOURCE_TYPE_DOCUMENTATION_LINKS;
3141
+ exports.RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS;
3142
+ exports.TAG_KEY_SOURCE_FILE_UPLOAD = TAG_KEY_SOURCE_FILE_UPLOAD;
3143
+ exports.UnexpectedColumnError = UnexpectedColumnError;
3144
+ exports.UnexpectedOperationStateError = UnexpectedOperationStateError;
3145
+ exports.UnexpectedResourceTypeError = UnexpectedResourceTypeError;
3146
+ exports.UploadSeparator = UploadSeparator;
3147
+ exports.UploadSettings = UploadSettings;
3148
+ exports.UploadingModal = UploadingModal;
3149
+ exports.allAutomatedImportOperations = allAutomatedImportOperations;
3150
+ exports.allAutomatedImportOperationsResponse = allAutomatedImportOperationsResponse;
3151
+ exports.allFileUploadImportOperations = allFileUploadImportOperations;
3152
+ exports.allFileUploadImportOperationsResponse = allFileUploadImportOperationsResponse;
3153
+ exports.appendCsvOrJsonExtensionIfAbsent = appendCsvOrJsonExtensionIfAbsent;
3154
+ exports.assertCancelContainerResponse = assertCancelContainerResponse;
3155
+ exports.assertExportOperationsDownloadFileResponse = assertExportOperationsDownloadFileResponse;
3156
+ exports.assertFileImportJob = assertFileImportJob;
3157
+ exports.assertFileImportJobRecordsResponse = assertFileImportJobRecordsResponse;
3158
+ exports.assertFileUploadResponse = assertFileUploadResponse;
3159
+ exports.assertImportContainer = assertImportContainer;
3160
+ exports.assertImportContainerPagedResponse = assertImportContainerPagedResponse;
3161
+ exports.assertImportOperationPagedResponse = assertImportOperationPagedResponse;
3162
+ exports.assertImportSummary = assertImportSummary;
3163
+ exports.assertListFileImportJobsResponse = assertListFileImportJobsResponse;
3164
+ exports.assertPaginatedExportOperationResponse = assertPaginatedExportOperationResponse;
3165
+ exports.assertProcessFileImportJobResponse = assertProcessFileImportJobResponse;
3166
+ exports.assertProcessFileResponse = assertProcessFileResponse;
3167
+ exports.assertResourceType = assertResourceType;
3168
+ exports.automatedImportContainerKey = automatedImportContainerKey;
3169
+ exports.automatedImports = automatedImports;
3170
+ exports.cancelImportContainerByKey = cancelImportContainerByKey;
3171
+ exports.checkIfFileUploadImport = checkIfFileUploadImport;
3172
+ exports.convertFileSizeToKB = convertFileSizeToKB;
3173
+ exports.countJsonFileItems = countJsonFileItems;
3174
+ exports.countUniqueResourcesInCsv = countUniqueResourcesInCsv;
3175
+ exports.createFileImportJob = createFileImportJob;
3176
+ exports.createImportContainerForFileUpload = createImportContainerForFileUpload;
3177
+ exports.decodeFileNameFromImportContainerKey = decodeFileNameFromImportContainerKey;
3178
+ exports.deleteFileImportJob = deleteFileImportJob;
3179
+ exports.deleteImportContainer = deleteImportContainer;
3180
+ exports.dropAreaStyles = dropAreaStyles;
3181
+ exports.encodeFileNameWithTimestampToContainerKey = encodeFileNameWithTimestampToContainerKey;
3182
+ exports.exportOperationsCompleted = exportOperationsCompleted;
3183
+ exports.exportOperationsProcessing = exportOperationsProcessing;
3184
+ exports.extractErrorDescriptionFromValidationMessage = extractErrorDescriptionFromValidationMessage;
3185
+ exports.fetchExportOperations = fetchExportOperations;
3186
+ exports.fetchImportContainerByKey = fetchImportContainerByKey;
3187
+ exports.fetchImportContainerDetails = fetchImportContainerDetails;
3188
+ exports.fetchImportContainers = fetchImportContainers;
3189
+ exports.fetchImportOperations = fetchImportOperations;
3190
+ exports.fetchImportSummaries = fetchImportSummaries;
3191
+ exports.fetchImportSummary = fetchImportSummary;
3192
+ exports.fetchUsingXhr = fetchUsingXhr;
3193
+ exports.fetcher = fetcher;
3194
+ exports.fileUploadImportContainerKey = fileUploadImportContainerKey;
3195
+ exports.fileUploadMissingKeysResponse = fileUploadMissingKeysResponse;
3196
+ exports.formatErrorCode = formatErrorCode;
3197
+ exports.formatKeys = formatKeys;
3198
+ exports.formatQueryString = formatQueryString;
3199
+ exports.getCreateImportContainerURL = getCreateImportContainerURL;
3200
+ exports.getDeleteImportContainerURL = getDeleteImportContainerURL;
3201
+ exports.getExportOperationsURL = getExportOperationsURL;
3202
+ exports.getFileImportJob = getFileImportJob;
3203
+ exports.getFileImportJobByIdURL = getFileImportJobByIdURL;
3204
+ exports.getFileImportJobDeleteURL = getFileImportJobDeleteURL;
3205
+ exports.getFileImportJobFileType = getFileImportJobFileType;
3206
+ exports.getFileImportJobProcessURL = getFileImportJobProcessURL;
3207
+ exports.getFileImportJobRecords = getFileImportJobRecords;
3208
+ exports.getFileImportJobRecordsURL = getFileImportJobRecordsURL;
3209
+ exports.getFileImportJobsListURL = getFileImportJobsListURL;
3210
+ exports.getFileImportJobsURL = getFileImportJobsURL;
3211
+ exports.getFileUploadErrorsCount = getFileUploadErrorsCount;
3212
+ exports.getFileUploadURL = getFileUploadURL;
3213
+ exports.getImportContainerByKeyURL = getImportContainerByKeyURL;
3214
+ exports.getImportContainerTasksURL = getImportContainerTasksURL;
3215
+ exports.getImportContainersURL = getImportContainersURL;
3216
+ exports.getImportOperationsURL = getImportOperationsURL;
3217
+ exports.getImportState = getImportState;
3218
+ exports.getImportSummaryURL = getImportSummaryURL;
3219
+ exports.getMissingRequiredFields = getMissingRequiredFields;
3220
+ exports.getProccessFileURL = getProccessFileURL;
3221
+ exports.getRowCount = getRowCount;
3222
+ exports.getValidatedColumns = getValidatedColumns;
3223
+ exports.hasOwnProperty = hasOwnProperty;
3224
+ exports.hasRequiredFields = hasRequiredFields;
3225
+ exports.hasSingleKeyColumn = hasSingleKeyColumn;
3226
+ exports.importContainers = importContainers;
3227
+ exports.importStatesMap = importStatesMap;
3228
+ exports.importsSummaries = importsSummaries;
3229
+ exports.invalidFileImportJobRecordsResponse = invalidFileImportJobRecordsResponse;
3230
+ exports.invalidFileImportJobValidated = invalidFileImportJobValidated;
3231
+ exports.invalidFileUploadResponse = invalidFileUploadResponse;
3232
+ exports.isAbortError = isAbortError;
3233
+ exports.isError = isError;
3234
+ exports.isImportJobInitializing = isImportJobInitializing;
3235
+ exports.isImportJobProcessing = isImportJobProcessing;
3236
+ exports.isImportJobQueued = isImportJobQueued;
3237
+ exports.isImportJobReady = isImportJobReady;
3238
+ exports.isImportJobRejected = isImportJobRejected;
3239
+ exports.isImportJobTerminal = isImportJobTerminal;
3240
+ exports.isImportJobValidated = isImportJobValidated;
3241
+ exports.isResourceType = isResourceType;
3242
+ exports.listFileImportJobs = listFileImportJobs;
3243
+ exports.manualImports = manualImports;
3244
+ exports.mapFileUploadErrorsToUploadFileErrorRows = mapFileUploadErrorsToUploadFileErrorRows;
3245
+ exports.mapFormikErrors = mapFormikErrors;
3246
+ exports.mapUploadFileErrorsResponseToUploadFileErrorRows = mapUploadFileErrorsResponseToUploadFileErrorRows;
3247
+ exports.pollJobUntilValidated = pollJobUntilValidated;
3248
+ exports.processFileImportJob = processFileImportJob;
3249
+ exports.processFileImportJobResponse = processFileImportJobResponse;
3250
+ exports.processUploadedFile = processUploadedFile;
3251
+ exports.shouldContinuePollingForImportValidation = shouldContinuePollingForImportValidation;
3252
+ exports.successfulAutomatedImportOperations = successfulAutomatedImportOperations;
3253
+ exports.successfulAutomatedImportOperationsResponse = successfulAutomatedImportOperationsResponse;
3254
+ exports.successfulFileUploadImportOperations = successfulFileUploadImportOperations;
3255
+ exports.successfulFileUploadImportOperationsResponse = successfulFileUploadImportOperationsResponse;
3256
+ exports.toBytes = toBytes;
3257
+ exports.toImportApiResourceType = toImportApiResourceType;
3258
+ exports.uploadFileForImport = uploadFileForImport;
3259
+ exports.useFetchExportOperations = useFetchExportOperations;
3260
+ exports.useFetchFileImportJob = useFetchFileImportJob;
3261
+ exports.useFetchImportContainerDetails = useFetchImportContainerDetails;
3262
+ exports.useFetchImportOperations = useFetchImportOperations;
3263
+ exports.useFetchImportSummaries = useFetchImportSummaries;
3264
+ exports.useFileImportJobUpload = useFileImportJobUpload;
3265
+ exports.useFileUpload = useFileUpload;
3266
+ exports.useImportContainerUpload = useImportContainerUpload;
3267
+ exports.validFileImportJobProcessing = validFileImportJobProcessing;
3268
+ exports.validFileImportJobQueued = validFileImportJobQueued;
3269
+ exports.validFileImportJobRecordsResponse = validFileImportJobRecordsResponse;
3270
+ exports.validFileImportJobValidated = validFileImportJobValidated;
3271
+ exports.validFileUploadResponse = validFileUploadResponse;
3272
+ exports.validProcessFileResponse = validProcessFileResponse;
3273
+ exports.validateDelimiter = validateDelimiter;