@kystverket/styrbord 1.3.12 → 1.3.13

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.
package/dist/main.js CHANGED
@@ -1159,6 +1159,14 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1159
1159
  select: I8,
1160
1160
  selectOption: E8
1161
1161
  }, f8 = {
1162
+ errors: {
1163
+ "network-error": "Nettverksfeil. Vennligst sjekk tilkoblingen og prøv igjen.",
1164
+ "invalid-file-type": "Filtypen er ikke tillatt.",
1165
+ "file-too-large": "Filen er for stor. Vennligst velg en mindre fil.",
1166
+ "file-scan-failed": "Filen kunne ikke lastes opp fordi sikkerhetsskanningen feilet.",
1167
+ error: "Noe gikk galt under opplastingen.",
1168
+ "unknown-error": "En ukjent feil oppstod. Vennligst prøv igjen senere."
1169
+ },
1162
1170
  existingFiles: {
1163
1171
  buttonOpen: "Bla igjennom filer",
1164
1172
  dialogCancel: "Avbryt",
@@ -1166,6 +1174,7 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1166
1174
  dialogTitle: "Filer",
1167
1175
  noFilesAvailable: "Ingen filer tilgjengelig."
1168
1176
  },
1177
+ loading: "Laster",
1169
1178
  maxFilesReached: "Maksimalt antall filer er lastet opp.",
1170
1179
  unknownFilename: "Ukjent filnavn",
1171
1180
  uploading: "Laster opp",
@@ -1179,6 +1188,14 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1179
1188
  organisasjonsnummer: d8,
1180
1189
  sentralbord: M8
1181
1190
  }, v8 = {
1191
+ errors: {
1192
+ "network-error": "Nettverksfeil. Vennlegst sjekk tilkoplinga og prøv igjen.",
1193
+ "invalid-file-type": "Filtypen er ikkje tillaten.",
1194
+ "file-too-large": "Fila er for stor. Vennlegst vel ei mindre fil.",
1195
+ "file-scan-failed": "Fila kunne ikkje lastast opp fordi tryggleiksskaninga feila.",
1196
+ error: "Noko gjekk gale under opplastinga.",
1197
+ "unknown-error": "Ein ukjend feil oppstod. Vennlegst prøv igjen seinare."
1198
+ },
1182
1199
  existingFiles: {
1183
1200
  buttonOpen: "Bla gjennom filer",
1184
1201
  dialogCancel: "Avbryt",
@@ -1186,6 +1203,7 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1186
1203
  dialogTitle: "Filer",
1187
1204
  noFilesAvailable: "Ingen filer tilgjengelege."
1188
1205
  },
1206
+ loading: "Laster",
1189
1207
  maxFilesReached: "Maksimalt tal filer er lasta opp.",
1190
1208
  unknownFilename: "Ukjent filnamn",
1191
1209
  uploading: "Lastar opp",
@@ -1199,6 +1217,14 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1199
1217
  organisasjonsnummer: g8,
1200
1218
  sentralbord: Q8
1201
1219
  }, R8 = {
1220
+ errors: {
1221
+ "network-error": "Network error. Please check your connection and try again.",
1222
+ "invalid-file-type": "File type is not allowed.",
1223
+ "file-too-large": "File is too large. Please select a smaller file.",
1224
+ "file-scan-failed": "File could not be uploaded because security scan failed.",
1225
+ error: "Something went wrong during upload.",
1226
+ "unknown-error": "An unknown error occurred. Please try again later."
1227
+ },
1202
1228
  existingFiles: {
1203
1229
  buttonOpen: "Browse files",
1204
1230
  dialogCancel: "Cancel",
@@ -1206,6 +1232,7 @@ const Nt = "_footer_aepms_2", _t = "_footerContainer_aepms_10", $t = "_linksCont
1206
1232
  dialogTitle: "Files",
1207
1233
  noFilesAvailable: "No files available."
1208
1234
  },
1235
+ loading: "Loading",
1209
1236
  maxFilesReached: "Maximum number of files uploaded.",
1210
1237
  unknownFilename: "Unknown filename",
1211
1238
  uploading: "Uploading",
@@ -10638,7 +10665,10 @@ function c5(r, n, e) {
10638
10665
  }
10639
10666
  const sc = async () => new Promise((r) => {
10640
10667
  setTimeout(() => {
10641
- r(c5());
10668
+ r({
10669
+ storageId: c5(),
10670
+ success: !0
10671
+ });
10642
10672
  }, 2500);
10643
10673
  }), uc = async () => new Promise((r) => {
10644
10674
  setTimeout(() => {
@@ -10678,7 +10708,7 @@ const sc = async () => new Promise((r) => {
10678
10708
  }
10679
10709
  })
10680
10710
  ).then((q) => {
10681
- vc(q, l, m.uploadFile, o);
10711
+ vc(q, l, m.uploadFile, o, d);
10682
10712
  });
10683
10713
  }, S = (g) => {
10684
10714
  o(l.filter((q) => q.contextId !== g.contextId));
@@ -10829,33 +10859,33 @@ const sc = async () => new Promise((r) => {
10829
10859
  ] })
10830
10860
  ] }) })
10831
10861
  ] });
10832
- }, vc = (r, n, e, t) => {
10862
+ }, vc = (r, n, e, t, A) => {
10833
10863
  console.log("onFilesChanged", r, n);
10834
- const A = [...n], i = {};
10835
- r.forEach((a) => {
10836
- const l = c5();
10837
- A.push({
10838
- contextId: l,
10839
- fileName: a.file.name,
10864
+ const i = [...n], a = {};
10865
+ r.forEach((l) => {
10866
+ const c = c5();
10867
+ i.push({
10868
+ contextId: c,
10869
+ fileName: l.file.name,
10840
10870
  status: "uploading",
10841
- contentType: a.file.type,
10842
- exif: a.exif
10843
- }), i[l] = a.file;
10844
- }), t(A), Object.keys(i).forEach(async (a) => {
10871
+ contentType: l.file.type,
10872
+ exif: l.exif
10873
+ }), a[c] = l.file;
10874
+ }), t(i), Object.keys(a).forEach(async (l) => {
10845
10875
  try {
10846
- const l = A.find((E) => E.contextId === a);
10847
- if (!l)
10848
- return;
10849
- const c = new FormData();
10850
- c.append("file", i[a], l.fileName);
10851
- const o = await e(c);
10852
- l.storageId = o, l.status = "uploaded", delete l.error, t([...A]);
10853
- } catch (l) {
10854
- console.error("Error when uploading", l);
10855
- const c = A.find((o) => o.contextId === a);
10876
+ const c = i.find((f) => f.contextId === l);
10856
10877
  if (!c)
10857
10878
  return;
10858
- c.status = "error", c.error = "Failed to upload file", t([...A]);
10879
+ const o = new FormData();
10880
+ o.append("file", a[l], c.fileName);
10881
+ const E = await e(o);
10882
+ E.success ? (c.storageId = E.storageId, c.status = "uploaded", delete c.error) : (c.status = "error", c.error = A(`errors.${E.error || "unknown-error"}`)), t([...i]);
10883
+ } catch (c) {
10884
+ console.error("Error when uploading", c);
10885
+ const o = i.find((E) => E.contextId === l);
10886
+ if (!o)
10887
+ return;
10888
+ o.status = "error", o.error = A("errors.unknown-error"), t([...i]);
10859
10889
  }
10860
10890
  });
10861
10891
  }, pc = "_icon_1tg5o_1", hc = {