@innspel/react-native 0.8.0 → 0.9.1

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/index.cjs CHANGED
@@ -407,11 +407,14 @@ var arrow_back_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBo
407
407
  // ../../node_modules/ionicons/dist/svg/brush-outline.svg
408
408
  var brush_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M452.37 59.63a40.49 40.49 0 0 0-57.26 0L184 294.74c23.08 4.7 46.12 27.29 49.26 49.26l219.11-227.11a40.49 40.49 0 0 0 0-57.26M138 336c-29.88 0-54 24.5-54 54.86 0 23.95-20.88 36.57-36 36.57C64.56 449.74 92.82 464 120 464c39.78 0 72-32.73 72-73.14 0-30.36-24.12-54.86-54-54.86" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/></svg>';
409
409
 
410
+ // ../../node_modules/ionicons/dist/svg/bug.svg
411
+ var bug_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M463.55 272.13H400v-48.2q0-4.32-.27-8.47c29.57-27.88 32.25-64.63 32.27-103 0-8.61-6.64-16-15.25-16.41A16 16 0 0 0 400 112c0 28-1.86 48.15-9.9 63.84-19.22-41.15-65.78-63.91-134.1-63.91-39.8 0-74.19 9.13-99.43 26.39-14.9 10.19-26.2 22.91-33.7 37.72C114 160.65 112 141 112 112.46c0-8.61-6.6-16-15.2-16.44A16 16 0 0 0 80 112c0 37.63 2.61 73.73 32.44 101.63q-.43 5.06-.44 10.3v48.2H48.45c-8.61 0-16 6.62-16.43 15.23a16 16 0 0 0 16 16.77h64V320a143.3 143.3 0 0 0 10.39 53.69C96.74 396.64 80.18 422 80 463.34c0 8.74 6.62 16.3 15.36 16.65A16 16 0 0 0 112 464c0-27.66 9.1-44.71 26.17-61.32A144.37 144.37 0 0 0 220 459.42a16 16 0 0 0 20-15.49V192.45c0-8.61 6.62-16 15.23-16.43A16 16 0 0 1 272 192v251.93a16 16 0 0 0 20 15.49 144.4 144.4 0 0 0 81.82-56.74c17 16.54 26.09 33.52 26.17 60.95a16.27 16.27 0 0 0 15.1 16.37A16 16 0 0 0 432 464c0-41.68-16.6-67.23-42.39-90.31A143.3 143.3 0 0 0 400 320v-15.87h64a16 16 0 0 0 16-16.77c-.42-8.61-7.84-15.23-16.45-15.23"/><path d="m321.39 104 .32.09c13.57 3.8 25.07-10.55 18.2-22.85A95.86 95.86 0 0 0 256.21 32h-.42a95.87 95.87 0 0 0-84.19 50.13c-6.84 12.58 5.14 27 18.84 22.86 19.71-6 41.79-9.06 65.56-9.06 24.09 0 46.09 2.72 65.39 8.07"/></svg>';
412
+
410
413
  // ../../node_modules/ionicons/dist/svg/bug-outline.svg
411
414
  var bug_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M370 378c28.89 23.52 46 46.07 46 86M142 378c-28.89 23.52-46 46.06-46 86M384 208c28.89-23.52 32-56.07 32-96M128 206c-28.89-23.52-32-54.06-32-94M464 288.13h-80M128 288.13H48M256 192v256" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/><path d="M256 448c-70.4 0-128-57.6-128-128v-96.07c0-65.07 57.6-96 128-96h0c70.4 0 128 25.6 128 96V320c0 70.4-57.6 128-128 128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/><path d="M179.43 143.52a49.1 49.1 0 0 1-3.43-15.73A80 80 0 0 1 255.79 48h.42A80 80 0 0 1 336 127.79a41.9 41.9 0 0 1-3.12 14.3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/></svg>';
412
415
 
413
- // ../../node_modules/ionicons/dist/svg/bulb-outline.svg
414
- var bulb_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M304 384v-24c0-29 31.54-56.43 52-76 28.84-27.57 44-64.61 44-108 0-80-63.73-144-144-144a143.6 143.6 0 0 0-144 144c0 41.84 15.81 81.39 44 108 20.35 19.21 52 46.7 52 76v24M224 480h64M208 432h96M256 384V256" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/><path d="M294 240s-21.51 16-38 16-38-16-38-16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/></svg>';
416
+ // ../../node_modules/ionicons/dist/svg/bulb.svg
417
+ var bulb_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M288 464h-64a16 16 0 0 0 0 32h64a16 16 0 0 0 0-32M304 416h-96a16 16 0 0 0 0 32h96a16 16 0 0 0 0-32M369.42 62.69C339.35 32.58 299.07 16 256 16A159.62 159.62 0 0 0 96 176c0 46.62 17.87 90.23 49 119.64l4.36 4.09C167.37 316.57 192 339.64 192 360v24a16 16 0 0 0 16 16h24a8 8 0 0 0 8-8V274.82a8 8 0 0 0-5.13-7.47A130.7 130.7 0 0 1 208.71 253a16 16 0 1 1 18.58-26c7.4 5.24 21.65 13 28.71 13s21.31-7.78 28.73-13a16 16 0 0 1 18.56 26 130.7 130.7 0 0 1-26.16 14.32 8 8 0 0 0-5.13 7.47V392a8 8 0 0 0 8 8h24a16 16 0 0 0 16-16v-24c0-19.88 24.36-42.93 42.15-59.77l4.91-4.66C399.08 265 416 223.61 416 176a159.16 159.16 0 0 0-46.58-113.31"/></svg>';
415
418
 
416
419
  // ../../node_modules/ionicons/dist/svg/calendar-outline.svg
417
420
  var calendar_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><rect width="416" height="384" x="48" y="80" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" rx="48"/><circle cx="296" cy="232" r="24"/><circle cx="376" cy="232" r="24"/><circle cx="296" cy="312" r="24"/><circle cx="376" cy="312" r="24"/><circle cx="136" cy="312" r="24"/><circle cx="216" cy="312" r="24"/><circle cx="136" cy="392" r="24"/><circle cx="216" cy="392" r="24"/><circle cx="296" cy="392" r="24"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M128 48v32M384 48v32"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" d="M464 160H48"/></svg>';
@@ -495,8 +498,10 @@ var IKONER = Object.fromEntries(
495
498
  Object.entries({
496
499
  "arrow-back-outline": arrow_back_outline_default,
497
500
  "brush-outline": brush_outline_default,
501
+ // Fylte varianter: bare på sporvalgets to kort (DD-63), der ikonet bærer stemningen.
502
+ bug: bug_default,
503
+ bulb: bulb_default,
498
504
  "bug-outline": bug_outline_default,
499
- "bulb-outline": bulb_outline_default,
500
505
  "calendar-outline": calendar_outline_default,
501
506
  "camera-outline": camera_outline_default,
502
507
  "checkmark-circle-outline": checkmark_circle_outline_default,
@@ -542,6 +547,7 @@ function Ikon({
542
547
  width: maal,
543
548
  height: maal,
544
549
  color: farge ?? tema.color.textPrimary,
550
+ fill: farge ?? tema.color.textPrimary,
545
551
  accessibilityElementsHidden: true,
546
552
  importantForAccessibility: "no"
547
553
  }
@@ -749,7 +755,8 @@ function Banner({
749
755
  // src/widget/tekster.ts
750
756
  function saksnr(id) {
751
757
  const i = id.indexOf("_");
752
- return i >= 0 ? id.slice(i + 1) : id;
758
+ const rest = i >= 0 ? id.slice(i + 1) : id;
759
+ return rest.length > 8 ? rest.slice(-4) : rest;
753
760
  }
754
761
  var stor = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
755
762
  var tekst = {
@@ -852,6 +859,9 @@ var tekst = {
852
859
  provIgjen: "Pr\xF8v igjen",
853
860
  // 2j — mine innspill
854
861
  mineTittel: "Mine innspill",
862
+ /** Knappen på første steg med innspill fra før (DD-62): tallet er det som gjør den til en inngang. */
863
+ mineMedAntall: (n) => `Mine innspill \xB7 ${n}`,
864
+ mineEtikett: (n) => `Mine innspill, ${n} innspill`,
855
865
  mineUnder: "Status og hva du kan vente deg.",
856
866
  mineTom: "Du har ikke sendt noe enn\xE5.",
857
867
  mineIkkeSendt: "Ikke sendt enn\xE5",
@@ -1277,7 +1287,21 @@ function Valg({ onVelg }) {
1277
1287
  padding: tema.space.md
1278
1288
  },
1279
1289
  children: [
1280
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Ikon, { navn: ikon, storrelse: "stor", farge: tema.color.textPrimary }),
1290
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1291
+ import_react_native4.View,
1292
+ {
1293
+ testID: `spor-${spor}-ikonflate`,
1294
+ style: {
1295
+ width: 2 * tema.icon.inline + 2 * tema.space.md,
1296
+ height: 2 * tema.icon.inline + 2 * tema.space.md,
1297
+ borderRadius: tema.radius.pill,
1298
+ backgroundColor: tema.color.brandBg,
1299
+ alignItems: "center",
1300
+ justifyContent: "center"
1301
+ },
1302
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Ikon, { navn: ikon, storrelse: "stor", farge: tema.color.brand })
1303
+ }
1304
+ ),
1281
1305
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1282
1306
  import_react_native4.Text,
1283
1307
  {
@@ -1297,8 +1321,8 @@ function Valg({ onVelg }) {
1297
1321
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.View, { style: { flex: 1, gap: tema.space.lg }, children: [
1298
1322
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(H, { children: tekst.valgTittel }),
1299
1323
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: { flex: 1, justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native4.View, { style: { flexDirection: "row", gap: tema.space.md }, children: [
1300
- flate("feil", "bug-outline", tekst.sporFeil, tekst.sporFeilUnder),
1301
- flate("onske", "bulb-outline", tekst.sporOnske, tekst.sporOnskeUnder)
1324
+ flate("feil", "bug", tekst.sporFeil, tekst.sporFeilUnder),
1325
+ flate("onske", "bulb", tekst.sporOnske, tekst.sporOnskeUnder)
1302
1326
  ] }) })
1303
1327
  ] });
1304
1328
  }
@@ -1856,7 +1880,11 @@ function Widget({
1856
1880
  client.track({ name: "widget_opened" });
1857
1881
  void client.queue.flush().catch(() => void 0);
1858
1882
  void client.loadSettings().then((s) => setInnstillinger({ ...s })).catch(() => void 0);
1859
- if (apneOpsjoner?.track) velgSpor(apneOpsjoner.track);
1883
+ if (!client.isAnonymous) {
1884
+ void client.subjects.submissions().then(setMine).catch(() => void 0);
1885
+ }
1886
+ if (apneOpsjoner?.view === "mine" && !client.isAnonymous) void visMine();
1887
+ else if (apneOpsjoner?.track) velgSpor(apneOpsjoner.track);
1860
1888
  }, [synlig]);
1861
1889
  const hentKort = (0, import_react11.useCallback)(async () => {
1862
1890
  setLasterKort(true);
@@ -2077,7 +2105,17 @@ function Widget({
2077
2105
  !online && steg !== "kvittering" && steg !== "mine" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Banner, { ikon: "cloud-offline-outline", tone: "info", testID: "offline-banner", children: tekst.offlineBanner }) : null,
2078
2106
  steg === "valg" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2079
2107
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Valg, { onVelg: velgSpor }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Btn, { variant: "ghost", testID: "mine-innspill", ikon: "list-outline", label: tekst.mineTittel, onPress: visMine })
2108
+ !client.isAnonymous ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2109
+ Btn,
2110
+ {
2111
+ variant: mine.length > 0 ? "secondary" : "ghost",
2112
+ testID: "mine-innspill",
2113
+ ikon: "list-outline",
2114
+ label: mine.length > 0 ? tekst.mineMedAntall(mine.length) : tekst.mineTittel,
2115
+ accessibilityLabel: mine.length > 0 ? tekst.mineEtikett(mine.length) : tekst.mineTittel,
2116
+ onPress: visMine
2117
+ }
2118
+ ) : null
2081
2119
  ] }) : null,
2082
2120
  steg === "kjenteFeil" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2083
2121
  KjenteFeil,