@innspel/react-native 0.2.0 → 0.2.2

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
@@ -1434,7 +1434,8 @@ function Widget({
1434
1434
  const [rotStorrelse, setRotStorrelse] = (0, import_react10.useState)({ width: 1, height: 1 });
1435
1435
  const [komponerer, setKomponerer] = (0, import_react10.useState)(false);
1436
1436
  const [vedlegg, setVedlegg] = (0, import_react10.useState)();
1437
- const skjermbildeMulig = client.settings.screenshotsEnabled && skjermbilde?.adapter != null;
1437
+ const [innstillinger, setInnstillinger] = (0, import_react10.useState)({ ...client.settings });
1438
+ const skjermbildeMulig = innstillinger.screenshotsEnabled && skjermbilde?.adapter != null;
1438
1439
  const nullstill = (0, import_react10.useCallback)(() => {
1439
1440
  setSteg("valg");
1440
1441
  setSpor("feil");
@@ -1458,6 +1459,7 @@ function Widget({
1458
1459
  if (!synlig) return;
1459
1460
  client.track({ name: "widget_opened" });
1460
1461
  void client.queue.flush().catch(() => void 0);
1462
+ void client.loadSettings().then((s) => setInnstillinger({ ...s })).catch(() => void 0);
1461
1463
  if (apneOpsjoner?.track) velgSpor(apneOpsjoner.track);
1462
1464
  }, [synlig]);
1463
1465
  const hentKort = (0, import_react10.useCallback)(async () => {
@@ -1660,8 +1662,8 @@ function Widget({
1660
1662
  spor,
1661
1663
  verdi,
1662
1664
  onEndre: endreTekst,
1663
- minTextLength: client.settings.minTextLength,
1664
- textMaxLength: client.settings.textMaxLength,
1665
+ minTextLength: innstillinger.minTextLength,
1666
+ textMaxLength: innstillinger.textMaxLength,
1665
1667
  kontekst: client.context,
1666
1668
  fjernedeFelter: fjernede,
1667
1669
  onFjernKontekst: (f) => setFjernede((x) => [...x, f]),
@@ -1712,8 +1714,8 @@ function Widget({
1712
1714
  }
1713
1715
  function fjernetKontekst(client, fjernede) {
1714
1716
  const ut = {};
1715
- for (const [k, v] of Object.entries(client.context)) {
1716
- if (k !== "sdkVersion" && !fjernede.includes(k)) ut[k] = v;
1717
+ for (const k of Object.keys(client.context)) {
1718
+ if (k !== "sdkVersion" && fjernede.includes(k)) ut[k] = void 0;
1717
1719
  }
1718
1720
  return ut;
1719
1721
  }