@astral/ui 4.55.1 → 4.55.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/components/ConfigProvider/ConfigProvider.d.ts +3 -2
  2. package/components/ConfigProvider/ConfigProvider.js +10 -4
  3. package/components/ErrorBoundary/ErrorBoundary.d.ts +2 -5
  4. package/components/ErrorBoundary/ErrorBoundary.js +9 -10
  5. package/components/ProductSwitcher/useLogic/useLogic.js +5 -4
  6. package/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +6 -7
  7. package/components/fileUploading/PreviewFileUploader/PreviewFileUploader.d.ts +8 -1
  8. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +8 -9
  9. package/components/fileUploading/hooks/useFileUploader/hooks/index.d.ts +1 -0
  10. package/components/fileUploading/hooks/useFileUploader/hooks/index.js +1 -0
  11. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.d.ts +1 -0
  12. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.js +1 -0
  13. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.d.ts +2 -0
  14. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.js +14 -0
  15. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.d.ts +5 -0
  16. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.js +23 -0
  17. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.d.ts +1 -0
  18. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.js +1 -0
  19. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.d.ts +2 -0
  20. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.js +2 -0
  21. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.d.ts +1 -0
  22. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.js +1 -0
  23. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.d.ts +2 -0
  24. package/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.js +10 -0
  25. package/components/fileUploading/hooks/useFileUploader/useFileUploader.js +3 -1
  26. package/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.d.ts +34 -120
  27. package/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +10 -137
  28. package/components/fileUploading/restrictions/restrictFileType/constants.d.ts +4 -0
  29. package/components/fileUploading/restrictions/restrictFileType/constants.js +4 -0
  30. package/components/fileUploading/restrictions/restrictFileType/restrictFileType.d.ts +2 -2
  31. package/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +31 -55
  32. package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.d.ts +5 -0
  33. package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.js +21 -0
  34. package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.d.ts +1 -0
  35. package/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.js +1 -0
  36. package/components/fileUploading/restrictions/restrictFileType/utils/index.d.ts +1 -2
  37. package/components/fileUploading/restrictions/restrictFileType/utils/index.js +1 -2
  38. package/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.d.ts +9 -0
  39. package/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.js +27 -0
  40. package/components/fileUploading/services/MimeTypeRegistry/constants.d.ts +1 -0
  41. package/components/fileUploading/services/MimeTypeRegistry/constants.js +343 -0
  42. package/components/fileUploading/services/MimeTypeRegistry/index.d.ts +1 -0
  43. package/components/fileUploading/services/MimeTypeRegistry/index.js +1 -0
  44. package/components/fileUploading/types.d.ts +10 -0
  45. package/components/fileUploading/utils/index.d.ts +1 -1
  46. package/components/fileUploading/utils/index.js +1 -1
  47. package/components/services/ErrorService/ErrorService.d.ts +29 -0
  48. package/components/services/ErrorService/ErrorService.js +36 -0
  49. package/components/services/ErrorService/index.d.ts +1 -0
  50. package/components/services/ErrorService/index.js +1 -0
  51. package/hook-form/useFormWizard/useFormWizard.js +7 -4
  52. package/node/components/ConfigProvider/ConfigProvider.d.ts +3 -2
  53. package/node/components/ConfigProvider/ConfigProvider.js +9 -3
  54. package/node/components/ErrorBoundary/ErrorBoundary.d.ts +2 -5
  55. package/node/components/ErrorBoundary/ErrorBoundary.js +9 -10
  56. package/node/components/ProductSwitcher/useLogic/useLogic.js +4 -3
  57. package/node/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +6 -7
  58. package/node/components/fileUploading/PreviewFileUploader/PreviewFileUploader.d.ts +8 -1
  59. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +8 -9
  60. package/node/components/fileUploading/hooks/useFileUploader/hooks/index.d.ts +1 -0
  61. package/node/components/fileUploading/{restrictions/restrictFileType/utils/getFileTypeFromName → hooks/useFileUploader/hooks}/index.js +1 -1
  62. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/index.d.ts +1 -0
  63. package/node/components/fileUploading/{restrictions/restrictFileType/utils/getFileTypeFromFile → hooks/useFileUploader/hooks/usePrepareAccept}/index.js +1 -1
  64. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.d.ts +2 -0
  65. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/usePrepareAccept.js +18 -0
  66. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.d.ts +5 -0
  67. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/getAcceptMeta.js +27 -0
  68. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.d.ts +1 -0
  69. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta/index.js +17 -0
  70. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.d.ts +2 -0
  71. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/index.js +18 -0
  72. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.d.ts +1 -0
  73. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/index.js +17 -0
  74. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.d.ts +2 -0
  75. package/node/components/fileUploading/hooks/useFileUploader/hooks/usePrepareAccept/utils/validateAcceptMeta/validateAcceptMeta.js +14 -0
  76. package/node/components/fileUploading/hooks/useFileUploader/useFileUploader.js +3 -1
  77. package/node/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.d.ts +34 -120
  78. package/node/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +9 -136
  79. package/node/components/fileUploading/restrictions/restrictFileType/constants.d.ts +4 -0
  80. package/node/components/fileUploading/restrictions/restrictFileType/constants.js +5 -1
  81. package/node/components/fileUploading/restrictions/restrictFileType/restrictFileType.d.ts +2 -2
  82. package/node/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +29 -53
  83. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.d.ts +5 -0
  84. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/getFileMeta.js +25 -0
  85. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileMeta/index.d.ts +1 -0
  86. package/node/components/fileUploading/restrictions/restrictFileType/utils/{prepareType → getFileMeta}/index.js +1 -1
  87. package/node/components/fileUploading/restrictions/restrictFileType/utils/index.d.ts +1 -2
  88. package/node/components/fileUploading/restrictions/restrictFileType/utils/index.js +1 -2
  89. package/node/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.d.ts +9 -0
  90. package/node/components/fileUploading/services/MimeTypeRegistry/MimeTypeRegistry.js +31 -0
  91. package/node/components/fileUploading/services/MimeTypeRegistry/constants.d.ts +1 -0
  92. package/node/components/fileUploading/services/MimeTypeRegistry/constants.js +347 -0
  93. package/node/components/fileUploading/services/MimeTypeRegistry/index.d.ts +1 -0
  94. package/node/components/fileUploading/services/MimeTypeRegistry/index.js +17 -0
  95. package/node/components/fileUploading/types.d.ts +10 -0
  96. package/node/components/fileUploading/utils/index.d.ts +1 -1
  97. package/node/components/fileUploading/utils/index.js +16 -3
  98. package/node/components/services/ErrorService/ErrorService.d.ts +29 -0
  99. package/node/components/services/ErrorService/ErrorService.js +40 -0
  100. package/node/components/services/ErrorService/index.d.ts +1 -0
  101. package/node/components/services/ErrorService/index.js +17 -0
  102. package/node/hook-form/useFormWizard/useFormWizard.js +6 -3
  103. package/package.json +1 -1
  104. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.d.ts +0 -4
  105. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.js +0 -10
  106. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.d.ts +0 -1
  107. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.js +0 -1
  108. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.d.ts +0 -4
  109. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +0 -13
  110. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.d.ts +0 -1
  111. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.js +0 -1
  112. package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.d.ts +0 -1
  113. package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.js +0 -1
  114. package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.d.ts +0 -5
  115. package/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.js +0 -5
  116. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.d.ts +0 -4
  117. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/getFileTypeFromFile.js +0 -14
  118. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromFile/index.d.ts +0 -1
  119. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.d.ts +0 -4
  120. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +0 -17
  121. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/index.d.ts +0 -1
  122. package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/index.d.ts +0 -1
  123. package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.d.ts +0 -5
  124. package/node/components/fileUploading/restrictions/restrictFileType/utils/prepareType/prepareType.js +0 -9
@@ -0,0 +1,343 @@
1
+ /* cSpell:disable */
2
+ export const getMimeTypesMap = () => ({
3
+ 'application/andrew-inset': ['ez'],
4
+ 'application/applixware': ['aw'],
5
+ 'application/atom+xml': ['atom'],
6
+ 'application/atomcat+xml': ['atomcat'],
7
+ 'application/atomdeleted+xml': ['atomdeleted'],
8
+ 'application/atomsvc+xml': ['atomsvc'],
9
+ 'application/atsc-dwd+xml': ['dwd'],
10
+ 'application/atsc-held+xml': ['held'],
11
+ 'application/atsc-rsat+xml': ['rsat'],
12
+ 'application/bdoc': ['bdoc'],
13
+ 'application/calendar+xml': ['xcs'],
14
+ 'application/ccxml+xml': ['ccxml'],
15
+ 'application/cdfx+xml': ['cdfx'],
16
+ 'application/cdmi-capability': ['cdmia'],
17
+ 'application/cdmi-container': ['cdmic'],
18
+ 'application/cdmi-domain': ['cdmid'],
19
+ 'application/cdmi-object': ['cdmio'],
20
+ 'application/cdmi-queue': ['cdmiq'],
21
+ 'application/cu-seeme': ['cu'],
22
+ 'application/dash+xml': ['mpd'],
23
+ 'application/davmount+xml': ['davmount'],
24
+ 'application/docbook+xml': ['dbk'],
25
+ 'application/dssc+der': ['dssc'],
26
+ 'application/dssc+xml': ['xdssc'],
27
+ 'application/ecmascript': ['ecma', 'es'],
28
+ 'application/emma+xml': ['emma'],
29
+ 'application/emotionml+xml': ['emotionml'],
30
+ 'application/epub+zip': ['epub'],
31
+ 'application/exi': ['exi'],
32
+ 'application/fdt+xml': ['fdt'],
33
+ 'application/font-tdpfr': ['pfr'],
34
+ 'application/geo+json': ['geojson'],
35
+ 'application/gml+xml': ['gml'],
36
+ 'application/gpx+xml': ['gpx'],
37
+ 'application/gxf': ['gxf'],
38
+ 'application/gzip': ['gz'],
39
+ 'application/hjson': ['hjson'],
40
+ 'application/hyperstudio': ['stk'],
41
+ 'application/inkml+xml': ['ink', 'inkml'],
42
+ 'application/ipfix': ['ipfix'],
43
+ 'application/its+xml': ['its'],
44
+ 'application/java-archive': ['jar', 'war', 'ear'],
45
+ 'application/java-serialized-object': ['ser'],
46
+ 'application/java-vm': ['class'],
47
+ 'application/javascript': ['js', 'mjs'],
48
+ 'application/json': ['json', 'map'],
49
+ 'application/json5': ['json5'],
50
+ 'application/jsonml+json': ['jsonml'],
51
+ 'application/ld+json': ['jsonld'],
52
+ 'application/lgr+xml': ['lgr'],
53
+ 'application/lost+xml': ['lostxml'],
54
+ 'application/mac-binhex40': ['hqx'],
55
+ 'application/mac-compactpro': ['cpt'],
56
+ 'application/mads+xml': ['mads'],
57
+ 'application/manifest+json': ['webmanifest'],
58
+ 'application/marc': ['mrc'],
59
+ 'application/marcxml+xml': ['mrcx'],
60
+ 'application/mathematica': ['ma', 'nb', 'mb'],
61
+ 'application/mathml+xml': ['mathml'],
62
+ 'application/mbox': ['mbox'],
63
+ 'application/mediaservercontrol+xml': ['mscml'],
64
+ 'application/metalink+xml': ['metalink'],
65
+ 'application/metalink4+xml': ['meta4'],
66
+ 'application/mets+xml': ['mets'],
67
+ 'application/mmt-aei+xml': ['maei'],
68
+ 'application/mmt-usd+xml': ['musd'],
69
+ 'application/mods+xml': ['mods'],
70
+ 'application/mp21': ['m21', 'mp21'],
71
+ 'application/mp4': ['mp4s', 'm4p'],
72
+ 'application/mrb-consumer+xml': ['*xdf'],
73
+ 'application/mrb-publish+xml': ['*xdf'],
74
+ 'application/msword': ['doc', 'dot'],
75
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [
76
+ 'docx',
77
+ ],
78
+ 'application/mxf': ['mxf'],
79
+ 'application/n-quads': ['nq'],
80
+ 'application/n-triples': ['nt'],
81
+ 'application/node': ['cjs'],
82
+ 'application/octet-stream': [
83
+ 'bin',
84
+ 'dms',
85
+ 'lrf',
86
+ 'mar',
87
+ 'so',
88
+ 'dist',
89
+ 'distz',
90
+ 'pkg',
91
+ 'bpk',
92
+ 'dump',
93
+ 'elc',
94
+ 'deploy',
95
+ 'exe',
96
+ 'dll',
97
+ 'deb',
98
+ 'dmg',
99
+ 'iso',
100
+ 'img',
101
+ 'msi',
102
+ 'msp',
103
+ 'msm',
104
+ 'buffer',
105
+ ],
106
+ 'application/oda': ['oda'],
107
+ 'application/oebps-package+xml': ['opf'],
108
+ 'application/ogg': ['ogx'],
109
+ 'application/omdoc+xml': ['omdoc'],
110
+ 'application/onenote': ['onetoc', 'onetoc2', 'onetmp', 'onepkg'],
111
+ 'application/oxps': ['oxps'],
112
+ 'application/p2p-overlay+xml': ['relo'],
113
+ 'application/patch-ops-error+xml': ['*xer'],
114
+ 'application/pdf': ['pdf'],
115
+ 'application/pgp-encrypted': ['pgp'],
116
+ 'application/pgp-signature': ['asc', 'sig'],
117
+ 'application/pics-rules': ['prf'],
118
+ 'application/pkcs10': ['p10'],
119
+ 'application/pkcs7-mime': ['p7m', 'p7c'],
120
+ 'application/pkcs7-signature': ['p7s'],
121
+ 'application/pkcs8': ['p8'],
122
+ 'application/pkix-attr-cert': ['ac'],
123
+ 'application/pkix-cert': ['cer'],
124
+ 'application/pkix-crl': ['crl'],
125
+ 'application/pkix-pkipath': ['pkipath'],
126
+ 'application/pkixcmp': ['pki'],
127
+ 'application/pls+xml': ['pls'],
128
+ 'application/postscript': ['ai', 'eps', 'ps'],
129
+ 'application/provenance+xml': ['provx'],
130
+ 'application/pskc+xml': ['pskcxml'],
131
+ 'application/raml+yaml': ['raml'],
132
+ 'application/rdf+xml': ['rdf', 'owl'],
133
+ 'application/reginfo+xml': ['rif'],
134
+ 'application/relax-ng-compact-syntax': ['rnc'],
135
+ 'application/resource-lists+xml': ['rl'],
136
+ 'application/resource-lists-diff+xml': ['rld'],
137
+ 'application/rls-services+xml': ['rs'],
138
+ 'application/route-apd+xml': ['rapd'],
139
+ 'application/route-s-tsid+xml': ['sls'],
140
+ 'application/route-usd+xml': ['rusd'],
141
+ 'application/rpki-ghostbusters': ['gbr'],
142
+ 'application/rpki-manifest': ['mft'],
143
+ 'application/rpki-roa': ['roa'],
144
+ 'application/rsd+xml': ['rsd'],
145
+ 'application/rss+xml': ['rss'],
146
+ 'application/rtf': ['rtf'],
147
+ 'application/sbml+xml': ['sbml'],
148
+ 'application/scvp-cv-request': ['scq'],
149
+ 'application/scvp-cv-response': ['scs'],
150
+ 'application/scvp-vp-request': ['spq'],
151
+ 'application/scvp-vp-response': ['spp'],
152
+ 'application/sdp': ['sdp'],
153
+ 'application/senml+xml': ['senmlx'],
154
+ 'application/sensml+xml': ['sensmlx'],
155
+ 'application/set-payment-initiation': ['setpay'],
156
+ 'application/set-registration-initiation': ['setreg'],
157
+ 'application/shf+xml': ['shf'],
158
+ 'application/sieve': ['siv', 'sieve'],
159
+ 'application/smil+xml': ['smi', 'smil'],
160
+ 'application/sparql-query': ['rq'],
161
+ 'application/sparql-results+xml': ['srx'],
162
+ 'application/srgs': ['gram'],
163
+ 'application/srgs+xml': ['grxml'],
164
+ 'application/sru+xml': ['sru'],
165
+ 'application/ssdl+xml': ['ssdl'],
166
+ 'application/ssml+xml': ['ssml'],
167
+ 'application/swid+xml': ['swidtag'],
168
+ 'application/tei+xml': ['tei', 'teicorpus'],
169
+ 'application/thraud+xml': ['tfi'],
170
+ 'application/timestamped-data': ['tsd'],
171
+ 'application/toml': ['toml'],
172
+ 'application/ttml+xml': ['ttml'],
173
+ 'application/ubjson': ['ubj'],
174
+ 'application/urc-ressheet+xml': ['rsheet'],
175
+ 'application/urc-targetdesc+xml': ['td'],
176
+ 'application/voicexml+xml': ['vxml'],
177
+ 'application/wasm': ['wasm'],
178
+ 'application/widget': ['wgt'],
179
+ 'application/winhlp': ['hlp'],
180
+ 'application/wsdl+xml': ['wsdl'],
181
+ 'application/wspolicy+xml': ['wspolicy'],
182
+ 'application/xaml+xml': ['xaml'],
183
+ 'application/xcap-att+xml': ['xav'],
184
+ 'application/xcap-caps+xml': ['xca'],
185
+ 'application/xcap-diff+xml': ['xdf'],
186
+ 'application/xcap-el+xml': ['xel'],
187
+ 'application/xcap-error+xml': ['xer'],
188
+ 'application/xcap-ns+xml': ['xns'],
189
+ 'application/xenc+xml': ['xenc'],
190
+ 'application/xhtml+xml': ['xhtml', 'xht'],
191
+ 'application/xliff+xml': ['xlf'],
192
+ 'application/xml': ['xml', 'xsl', 'xsd', 'rng'],
193
+ 'application/xml-dtd': ['dtd'],
194
+ 'application/vnd.oasis.opendocument.text': ['odt'],
195
+ 'application/vnd.oasis.opendocument.spreadsheet': ['ods'],
196
+ 'application/vnd.oasis.opendocument.graphics': ['odg'],
197
+ 'application/vnd.oasis.opendocument.presentation': ['odp'],
198
+ 'application/xop+xml': ['xop'],
199
+ 'application/xproc+xml': ['xpl'],
200
+ 'application/xslt+xml': ['*xsl', 'xslt'],
201
+ 'application/xspf+xml': ['xspf'],
202
+ 'application/xv+xml': ['mxml', 'xhvml', 'xvml', 'xvm'],
203
+ 'application/yang': ['yang'],
204
+ 'application/yin+xml': ['yin'],
205
+ 'application/zip': ['zip'],
206
+ 'application/zip-compressed': ['zip'],
207
+ 'application/x-zip-compressed': ['zip'],
208
+ 'application/x-rar-compressed': ['rar'],
209
+ 'application/vnd.rar': ['rar'],
210
+ 'application/x-compressed': ['rar'],
211
+ 'audio/3gpp': ['*3gpp'],
212
+ 'audio/adpcm': ['adp'],
213
+ 'audio/amr': ['amr'],
214
+ 'audio/basic': ['au', 'snd'],
215
+ 'audio/midi': ['mid', 'midi', 'kar', 'rmi'],
216
+ 'audio/mobile-xmf': ['mxmf'],
217
+ 'audio/mp3': ['*mp3'],
218
+ 'audio/mp4': ['m4a', 'mp4a'],
219
+ 'audio/mpeg': ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'],
220
+ 'audio/ogg': ['oga', 'ogg', 'spx', 'opus'],
221
+ 'audio/s3m': ['s3m'],
222
+ 'audio/silk': ['sil'],
223
+ 'audio/wav': ['wav'],
224
+ 'audio/wave': ['*wav'],
225
+ 'audio/webm': ['weba'],
226
+ 'audio/xm': ['xm'],
227
+ 'font/collection': ['ttc'],
228
+ 'font/otf': ['otf'],
229
+ 'font/ttf': ['ttf'],
230
+ 'font/woff': ['woff'],
231
+ 'font/woff2': ['woff2'],
232
+ 'image/aces': ['exr'],
233
+ 'image/apng': ['apng'],
234
+ 'image/avif': ['avif'],
235
+ 'image/bmp': ['bmp'],
236
+ 'image/cgm': ['cgm'],
237
+ 'image/dicom-rle': ['drle'],
238
+ 'image/emf': ['emf'],
239
+ 'image/fits': ['fits'],
240
+ 'image/g3fax': ['g3'],
241
+ 'image/gif': ['gif'],
242
+ 'image/heic': ['heic'],
243
+ 'image/heic-sequence': ['heics'],
244
+ 'image/heif': ['heif'],
245
+ 'image/heif-sequence': ['heifs'],
246
+ 'image/hej2k': ['hej2'],
247
+ 'image/hsj2': ['hsj2'],
248
+ 'image/ief': ['ief'],
249
+ 'image/jls': ['jls'],
250
+ 'image/jp2': ['jp2', 'jpg2'],
251
+ 'image/jpeg': ['jpeg', 'jpg', 'jpe'],
252
+ 'image/jph': ['jph'],
253
+ 'image/jphc': ['jhc'],
254
+ 'image/jpm': ['jpm'],
255
+ 'image/jpx': ['jpx', 'jpf'],
256
+ 'image/jxr': ['jxr'],
257
+ 'image/jxra': ['jxra'],
258
+ 'image/jxrs': ['jxrs'],
259
+ 'image/jxs': ['jxs'],
260
+ 'image/jxsc': ['jxsc'],
261
+ 'image/jxsi': ['jxsi'],
262
+ 'image/jxss': ['jxss'],
263
+ 'image/ktx': ['ktx'],
264
+ 'image/ktx2': ['ktx2'],
265
+ 'image/png': ['png'],
266
+ 'image/sgi': ['sgi'],
267
+ 'image/svg+xml': ['svg', 'svgz'],
268
+ 'image/t38': ['t38'],
269
+ 'image/tiff': ['tif', 'tiff'],
270
+ 'image/tiff-fx': ['tfx'],
271
+ 'image/webp': ['webp'],
272
+ 'image/wmf': ['wmf'],
273
+ 'message/disposition-notification': ['disposition-notification'],
274
+ 'message/global': ['u8msg'],
275
+ 'message/global-delivery-status': ['u8dsn'],
276
+ 'message/global-disposition-notification': ['u8mdn'],
277
+ 'message/global-headers': ['u8hdr'],
278
+ 'message/rfc822': ['eml', 'mime'],
279
+ 'model/3mf': ['3mf'],
280
+ 'model/gltf+json': ['gltf'],
281
+ 'model/gltf-binary': ['glb'],
282
+ 'model/iges': ['igs', 'iges'],
283
+ 'model/mesh': ['msh', 'mesh', 'silo'],
284
+ 'model/mtl': ['mtl'],
285
+ 'model/obj': ['obj'],
286
+ 'model/stl': ['stl'],
287
+ 'model/vrml': ['wrl', 'vrml'],
288
+ 'model/x3d+binary': ['*x3db', 'x3dbz'],
289
+ 'model/x3d+fastinfoset': ['x3db'],
290
+ 'model/x3d+vrml': ['*x3dv', 'x3dvz'],
291
+ 'model/x3d+xml': ['x3d', 'x3dz'],
292
+ 'model/x3d-vrml': ['x3dv'],
293
+ 'text/cache-manifest': ['appcache', 'manifest'],
294
+ 'text/calendar': ['ics', 'ifb'],
295
+ 'text/coffeescript': ['coffee', 'litcoffee'],
296
+ 'text/css': ['css'],
297
+ 'text/csv': ['csv'],
298
+ 'application/csv': ['csv'],
299
+ 'text/html': ['html', 'htm', 'shtml'],
300
+ 'text/jade': ['jade'],
301
+ 'text/jsx': ['jsx'],
302
+ 'text/less': ['less'],
303
+ 'text/markdown': ['markdown', 'md'],
304
+ 'text/mathml': ['mml'],
305
+ 'text/mdx': ['mdx'],
306
+ 'text/n3': ['n3'],
307
+ 'text/plain': ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini'],
308
+ 'text/richtext': ['rtx'],
309
+ 'text/rtf': ['*rtf'],
310
+ 'text/sgml': ['sgml', 'sgm'],
311
+ 'text/shex': ['shex'],
312
+ 'text/slim': ['slim', 'slm'],
313
+ 'text/spdx': ['spdx'],
314
+ 'text/stylus': ['stylus', 'styl'],
315
+ 'text/tab-separated-values': ['tsv'],
316
+ 'text/troff': ['t', 'tr', 'roff', 'man', 'me', 'ms'],
317
+ 'text/turtle': ['ttl'],
318
+ 'text/uri-list': ['uri', 'uris', 'urls'],
319
+ 'text/vcard': ['vcard'],
320
+ 'text/vtt': ['vtt'],
321
+ 'text/xml': ['*xml'],
322
+ 'text/yaml': ['yaml', 'yml'],
323
+ 'video/3gpp': ['3gp', '3gpp'],
324
+ 'video/3gpp2': ['3g2'],
325
+ 'video/h261': ['h261'],
326
+ 'video/h263': ['h263'],
327
+ 'video/h264': ['h264'],
328
+ 'video/iso.segment': ['m4s'],
329
+ 'video/jpeg': ['jpgv'],
330
+ 'video/jpm': ['*jpm', 'jpgm'],
331
+ 'video/mj2': ['mj2', 'mjp2'],
332
+ 'video/mp2t': ['ts'],
333
+ 'video/mp4': ['mp4', 'mp4v', 'mpg4'],
334
+ 'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],
335
+ 'video/ogg': ['ogv'],
336
+ 'video/quicktime': ['qt', 'mov'],
337
+ 'video/webm': ['webm'],
338
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],
339
+ 'application/vnd.ms-excel': ['xls', 'csv'],
340
+ 'application/x-x509-ca-cert': ['cer'],
341
+ 'application/x-pkcs7-certificates': ['p7b'],
342
+ 'application/sig': ['sig'],
343
+ });
@@ -0,0 +1 @@
1
+ export * from './MimeTypeRegistry';
@@ -0,0 +1 @@
1
+ export * from './MimeTypeRegistry';
@@ -1,10 +1,20 @@
1
1
  import type { ReactNode, RefObject } from 'react';
2
+ export type FileMimeType = string;
2
3
  export type RestrictionFnResult = {
3
4
  code: string;
4
5
  message: string;
5
6
  };
6
7
  export type RestrictionFn = (value: File) => RestrictionFnResult | undefined;
7
8
  export type FileId = string;
9
+ /**
10
+ * Расширенная информация о переданном accept
11
+ */
12
+ export type AcceptMeta = {
13
+ extensions: string[];
14
+ mimeTypes: string[];
15
+ generalMimeTypes: string[];
16
+ isOnlyExtensions: boolean;
17
+ };
8
18
  export type FileStatus = {
9
19
  /**
10
20
  * Если true, будет отображен progress-бар загрузки файла
@@ -1,6 +1,6 @@
1
- export { getFileTypeFromName } from '../restrictions/restrictFileType/utils/getFileTypeFromName';
2
1
  export { compareFile } from './compareFile';
3
2
  export { declensionFile } from './declensionFile';
4
3
  export { generateAttrLinkNewTab } from './generateAttrLinkNewTab';
5
4
  export { rulePipe } from './rulePipe';
6
5
  export { toArray } from './toArray';
6
+ export * from '../hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta';
@@ -1,6 +1,6 @@
1
- export { getFileTypeFromName } from '../restrictions/restrictFileType/utils/getFileTypeFromName';
2
1
  export { compareFile } from './compareFile';
3
2
  export { declensionFile } from './declensionFile';
4
3
  export { generateAttrLinkNewTab } from './generateAttrLinkNewTab';
5
4
  export { rulePipe } from './rulePipe';
6
5
  export { toArray } from './toArray';
6
+ export * from '../hooks/useFileUploader/hooks/usePrepareAccept/utils/getAcceptMeta';
@@ -0,0 +1,29 @@
1
+ export type CaptureException = (error: unknown, data?: {
2
+ extra?: Record<string, unknown>;
3
+ }) => void;
4
+ type ErrorExtra = {
5
+ /**
6
+ * Место, где произошла ошибка. Например, название компонента
7
+ */
8
+ place: string;
9
+ [key: string]: unknown;
10
+ };
11
+ /**
12
+ * Занимается логированием ошибок и отправкой их в sentry
13
+ */
14
+ export declare class ErrorService {
15
+ private readonly logger;
16
+ private static instance;
17
+ private _captureException?;
18
+ private constructor();
19
+ init(captureException: CaptureException): void;
20
+ captureException: (error: unknown, extra?: ErrorExtra) => void;
21
+ captureCustomError: (place: string, message: string) => void;
22
+ /**
23
+ * Логирует ошибку в консоль и отправляет в sentry
24
+ * */
25
+ logError: (place: string, message: string) => void;
26
+ static getInstance(): ErrorService;
27
+ private createError;
28
+ }
29
+ export {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Занимается логированием ошибок и отправкой их в sentry
3
+ */
4
+ export class ErrorService {
5
+ constructor(logger) {
6
+ this.logger = logger;
7
+ this.captureException = (error, extra) => {
8
+ if (this._captureException) {
9
+ this._captureException(error, extra ? { extra } : undefined);
10
+ }
11
+ };
12
+ this.captureCustomError = (place, message) => {
13
+ this.captureException(this.createError(place, message));
14
+ };
15
+ /**
16
+ * Логирует ошибку в консоль и отправляет в sentry
17
+ * */
18
+ this.logError = (place, message) => {
19
+ const error = this.createError(place, message);
20
+ this.logger.error(error);
21
+ this.captureException(error);
22
+ };
23
+ this.createError = (componentName, message) => {
24
+ return new Error(`ASTRAL_UI:${componentName}: ${message}`);
25
+ };
26
+ }
27
+ init(captureException) {
28
+ this._captureException = captureException;
29
+ }
30
+ static getInstance() {
31
+ if (!ErrorService.instance) {
32
+ ErrorService.instance = new ErrorService(console);
33
+ }
34
+ return ErrorService.instance;
35
+ }
36
+ }
@@ -0,0 +1 @@
1
+ export * from './ErrorService';
@@ -0,0 +1 @@
1
+ export * from './ErrorService';
@@ -1,5 +1,5 @@
1
- import { useContext, useMemo, useRef, useState } from 'react';
2
- import { ConfigContext } from '../../components/ConfigProvider';
1
+ import { useMemo, useRef, useState } from 'react';
2
+ import { ErrorService } from '../../components/services/ErrorService';
3
3
  import { useForm } from '../useForm';
4
4
  import { useFormWatchFields } from '../useFormWatchFields';
5
5
  import { CHANGE_STEP_REASON } from './constants';
@@ -20,7 +20,6 @@ import { compareSteps, getWatchFields } from './utils';
20
20
  * <FormWizard {...formWizardProps} />
21
21
  */
22
22
  export const useFormWizard = ({ initialStepId, defaultValues, isDisabled, steps, autoSaveStrategy, onChangeStep, onAutoSave, onSubmit, onAutoSaveError, }) => {
23
- const { captureException } = useContext(ConfigContext);
24
23
  const calculateInitialVisibleSteps = () => steps.filter(({ shouldSkip }) => shouldSkip?.calculate
25
24
  ? !shouldSkip.calculate(defaultValues)
26
25
  : true);
@@ -95,7 +94,11 @@ export const useFormWizard = ({ initialStepId, defaultValues, isDisabled, steps,
95
94
  setCurrentStepId(nextStepId);
96
95
  })
97
96
  .catch((error) => {
98
- captureException(error);
97
+ ErrorService.getInstance().captureException(error, {
98
+ place: 'useFormWizard',
99
+ currentStepId,
100
+ nextStepId,
101
+ });
99
102
  });
100
103
  }
101
104
  setCurrentStepId(nextStepId);
@@ -1,6 +1,7 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
2
  import { type LanguageMap } from '../DatePicker/types';
3
3
  import { type PlaceholderImageProps } from '../placeholders/Placeholder/Image';
4
+ import { type CaptureException } from '../services/ErrorService';
4
5
  import { type NextFeatureFlagsContextProps } from './NextFeatureFlagsContext';
5
6
  type Language = 'ru';
6
7
  type ImagesMap = {
@@ -45,7 +46,7 @@ export type ConfigContextProps = {
45
46
  * @default russianMap
46
47
  */
47
48
  datePickerLanguageMap: LanguageMap;
48
- captureException: (error: any) => void;
49
+ captureException: CaptureException;
49
50
  /**
50
51
  * Карта для типовых изображений.
51
52
  * Используется в компонентах ui-kit, где требуется отображение декоративных
@@ -139,5 +140,5 @@ export type ConfigProviderProps = Partial<ConfigContextProps> & {
139
140
  nextFeatureFlags?: NextFeatureFlagsContextProps;
140
141
  };
141
142
  export declare const ConfigContext: import("react").Context<ConfigContextProps>;
142
- export declare const ConfigProvider: ({ children, language, datePickerLanguageMap, captureException, emptySymbol, imagesMap, techSup, hidePersonalData, hidePersonalDataClassname, hidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags, }: Partial<ConfigProviderProps>) => import("react/jsx-runtime").JSX.Element;
143
+ export declare const ConfigProvider: ({ children, language, datePickerLanguageMap, captureException: captureExceptionProp, emptySymbol, imagesMap, techSup, hidePersonalData, hidePersonalDataClassname, hidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags, }: Partial<ConfigProviderProps>) => import("react/jsx-runtime").JSX.Element;
143
144
  export {};
@@ -4,6 +4,7 @@ exports.ConfigProvider = exports.ConfigContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const constants_1 = require("../DatePicker/constants");
7
+ const ErrorService_1 = require("../services/ErrorService");
7
8
  const NextFeatureFlagsContext_1 = require("./NextFeatureFlagsContext");
8
9
  const imagesMapDefault = {
9
10
  noDataImgSrc: '',
@@ -29,7 +30,13 @@ exports.ConfigContext = (0, react_1.createContext)({
29
30
  hidePersonalInputDataClassname: defaultHidePersonalInputDataClassname,
30
31
  hidePersonalData: true,
31
32
  });
32
- const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = constants_1.russianMap, captureException, emptySymbol = '—', imagesMap = imagesMapDefault, techSup = techSupDefault, hidePersonalData = true, hidePersonalDataClassname = defaultHidePersonalDataClassname, hidePersonalInputDataClassname = defaultHidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags = {}, }) => {
33
+ const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = constants_1.russianMap, captureException: captureExceptionProp, emptySymbol = '—', imagesMap = imagesMapDefault, techSup = techSupDefault, hidePersonalData = true, hidePersonalDataClassname = defaultHidePersonalDataClassname, hidePersonalInputDataClassname = defaultHidePersonalInputDataClassname, components: propsComponents, nextFeatureFlags = {}, }) => {
34
+ const captureException =
35
+ // biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
36
+ captureExceptionProp || ((error) => console.error(error));
37
+ (0, react_1.useMemo)(() => {
38
+ ErrorService_1.ErrorService.getInstance().init(captureException);
39
+ }, [captureException]);
33
40
  (0, react_1.useEffect)(() => {
34
41
  if (!captureException) {
35
42
  // biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
@@ -58,8 +65,7 @@ const ConfigProvider = ({ children, language = 'ru', datePickerLanguageMap = con
58
65
  return ((0, jsx_runtime_1.jsx)(exports.ConfigContext.Provider, { value: {
59
66
  language,
60
67
  datePickerLanguageMap,
61
- // biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
62
- captureException: captureException || ((error) => console.error(error)),
68
+ captureException,
63
69
  emptySymbol,
64
70
  imagesMap,
65
71
  techSup,
@@ -1,5 +1,4 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import { ConfigContext } from '../ConfigProvider';
3
2
  import { ErrorBoundaryTypeError } from './enums';
4
3
  export type State = {
5
4
  /**
@@ -23,14 +22,12 @@ type Props = {
23
22
  * @example <ErrorBoundary><InsecureComponent/></ErrorBoundary>
24
23
  */
25
24
  declare class ErrorBoundary extends React.Component<Props, State> {
26
- static contextType: React.Context<import("../ConfigProvider").ConfigContextProps>;
27
- context: React.ContextType<typeof ConfigContext>;
28
25
  state: State;
26
+ componentDidCatch(error: Error): void;
27
+ render(): React.ReactNode;
29
28
  static getDerivedStateFromError(error: Error): {
30
29
  hasError: boolean;
31
30
  typeError: ErrorBoundaryTypeError;
32
31
  };
33
- componentDidCatch(error: Error): void;
34
- render(): React.ReactNode;
35
32
  }
36
33
  export { ErrorBoundary };
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ErrorBoundary = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = __importDefault(require("react"));
9
- const ConfigProvider_1 = require("../ConfigProvider");
10
9
  const InternalErrorPlaceholder_1 = require("../placeholders/InternalErrorPlaceholder");
11
10
  const OutdatedReleasePlaceholder_1 = require("../placeholders/OutdatedReleasePlaceholder");
11
+ const ErrorService_1 = require("../services/ErrorService");
12
12
  const constants_1 = require("./constants");
13
13
  const enums_1 = require("./enums");
14
14
  /**
@@ -31,15 +31,8 @@ class ErrorBoundary extends react_1.default.Component {
31
31
  typeError: enums_1.ErrorBoundaryTypeError.Default,
32
32
  };
33
33
  }
34
- static getDerivedStateFromError(error) {
35
- return {
36
- hasError: true,
37
- typeError: constants_1.CONDITION_TYPE_ERROR.find(({ condition }) => condition(error))?.type ??
38
- enums_1.ErrorBoundaryTypeError.Default,
39
- };
40
- }
41
34
  componentDidCatch(error) {
42
- this.context.captureException(error);
35
+ ErrorService_1.ErrorService.getInstance().captureException(error);
43
36
  }
44
37
  render() {
45
38
  if (this.state.hasError) {
@@ -47,6 +40,12 @@ class ErrorBoundary extends react_1.default.Component {
47
40
  }
48
41
  return this.props.children;
49
42
  }
43
+ static getDerivedStateFromError(error) {
44
+ return {
45
+ hasError: true,
46
+ typeError: constants_1.CONDITION_TYPE_ERROR.find(({ condition }) => condition(error))?.type ??
47
+ enums_1.ErrorBoundaryTypeError.Default,
48
+ };
49
+ }
50
50
  }
51
51
  exports.ErrorBoundary = ErrorBoundary;
52
- ErrorBoundary.contextType = ConfigProvider_1.ConfigContext;
@@ -2,13 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
4
  const react_1 = require("react");
5
- const ConfigProvider_1 = require("../../ConfigProvider");
5
+ const ErrorService_1 = require("../../services/ErrorService");
6
6
  const useMenu_1 = require("../../useMenu");
7
7
  const useLogic = ({ getProducts, filter }) => {
8
8
  const [products, setProducts] = (0, react_1.useState)([]);
9
9
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
10
10
  const [isError, setIsError] = (0, react_1.useState)(false);
11
- const { captureException } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
12
11
  const { open, anchorRef, handleOpenMenu, handleCloseMenu } = (0, useMenu_1.useMenu)();
13
12
  const filterProductList = (productList) => {
14
13
  const { hostname } = new URL(window.origin);
@@ -35,7 +34,9 @@ const useLogic = ({ getProducts, filter }) => {
35
34
  }
36
35
  catch (error) {
37
36
  setIsError(true);
38
- captureException(error);
37
+ ErrorService_1.ErrorService.getInstance().captureException(error, {
38
+ place: 'ProductSwitcher',
39
+ });
39
40
  }
40
41
  finally {
41
42
  setIsLoading(false);