@seamapi/react 1.13.0 → 1.15.0

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/elements.js CHANGED
@@ -8077,7 +8077,7 @@ const mm = "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;60
8077
8077
  const n = globalThis.document.createElement("link");
8078
8078
  n.rel = "stylesheet", n.type = "text/css", n.href = mm, globalThis.document.head.appendChild(n);
8079
8079
  }, [t]);
8080
- }, NE = "1.13.0", HE = "https://react.seam.co", DE = ({
8080
+ }, NE = "1.15.0", HE = "https://react.seam.co", DE = ({
8081
8081
  disabled: t = !1,
8082
8082
  unminified: e = !1
8083
8083
  }) => {
@@ -23628,60 +23628,76 @@ function P1({
23628
23628
  }
23629
23629
  function R1({
23630
23630
  deviceId: t,
23631
- onBack: e,
23632
- className: n
23631
+ onAccessCodeClick: e = () => {
23632
+ },
23633
+ preventDefaultOnAccessCodeClick: n = !1,
23634
+ onBack: r,
23635
+ className: i
23633
23636
  }) {
23634
- const { accessCodes: r } = S1({
23637
+ const { accessCodes: o } = S1({
23635
23638
  device_id: t
23636
- }), [i, o] = k.useState(
23637
- null
23638
- ), [s, l] = k.useState("");
23639
- if (i != null)
23639
+ }), [s, l] = k.useState(null), [c, a] = k.useState(""), u = k.useCallback(
23640
+ (f) => {
23641
+ e(f), !n && l(f);
23642
+ },
23643
+ [
23644
+ e,
23645
+ n,
23646
+ l
23647
+ ]
23648
+ );
23649
+ if (s != null)
23640
23650
  return /* @__PURE__ */ v.jsx(
23641
23651
  N1,
23642
23652
  {
23643
- className: n,
23644
- accessCodeId: i.access_code_id,
23653
+ className: i,
23654
+ accessCodeId: s,
23645
23655
  onBack: () => {
23646
- o(null);
23656
+ l(null);
23647
23657
  }
23648
23658
  }
23649
23659
  );
23650
- if (r == null)
23660
+ if (o == null)
23651
23661
  return null;
23652
- const c = r.filter((u) => s === "" ? !0 : new RegExp(s, "i").test(u.name ?? "")), a = r.length;
23653
- return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-access-code-table", n), children: [
23654
- /* @__PURE__ */ v.jsx(nd, { onBack: e }),
23662
+ const p = o.filter((f) => c === "" ? !0 : new RegExp(c, "i").test(f.name ?? "")), d = o.length;
23663
+ return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-access-code-table", i), children: [
23664
+ /* @__PURE__ */ v.jsx(nd, { onBack: r }),
23655
23665
  /* @__PURE__ */ v.jsxs(M1, { children: [
23656
23666
  /* @__PURE__ */ v.jsxs(j1, { children: [
23657
23667
  fa.accessCodes,
23658
23668
  " ",
23659
23669
  /* @__PURE__ */ v.jsxs(z1, { children: [
23660
23670
  "(",
23661
- a,
23671
+ d,
23662
23672
  ")"
23663
23673
  ] })
23664
23674
  ] }),
23665
23675
  /* @__PURE__ */ v.jsx(
23666
23676
  Qf,
23667
23677
  {
23668
- value: s,
23669
- onChange: l,
23670
- disabled: a === 0
23678
+ value: c,
23679
+ onChange: a,
23680
+ disabled: d === 0
23671
23681
  }
23672
23682
  )
23673
23683
  ] }),
23674
- /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(zM, { accessCodes: c, selectAccessCode: o }) })
23684
+ /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(
23685
+ zM,
23686
+ {
23687
+ accessCodes: p,
23688
+ onAccessCodeClick: u
23689
+ }
23690
+ ) })
23675
23691
  ] });
23676
23692
  }
23677
23693
  function zM(t) {
23678
- const { accessCodes: e, selectAccessCode: n } = t;
23694
+ const { accessCodes: e, onAccessCodeClick: n } = t;
23679
23695
  return e.length === 0 ? /* @__PURE__ */ v.jsx(C1, { children: fa.noAccessCodesMessage }) : /* @__PURE__ */ v.jsx(v.Fragment, { children: e.map((r) => /* @__PURE__ */ v.jsx(
23680
23696
  PM,
23681
23697
  {
23682
23698
  accessCode: r,
23683
23699
  onClick: () => {
23684
- n(r);
23700
+ n(r.access_code_id);
23685
23701
  }
23686
23702
  },
23687
23703
  r.access_code_id
@@ -24317,6 +24333,8 @@ const On = {
24317
24333
  props: JM
24318
24334
  }, Symbol.toStringTag, { value: "Module" })), eT = "seam-access-code-table", tT = {
24319
24335
  deviceId: "string",
24336
+ onAccessCodeClick: "function",
24337
+ preventDefaultOnAccessCodeClick: "boolean",
24320
24338
  onBack: "function",
24321
24339
  className: "string"
24322
24340
  }, nT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -24640,59 +24658,60 @@ function wT(t) {
24640
24658
  }
24641
24659
  function ET({
24642
24660
  deviceIds: t,
24643
- onDeviceClick: e,
24644
- onBack: n,
24645
- className: r
24661
+ onDeviceClick: e = () => {
24662
+ },
24663
+ preventDefaultOnDeviceClick: n = !1,
24664
+ onBack: r,
24665
+ className: i
24646
24666
  } = {}) {
24647
- const { devices: i, isLoading: o, isError: s, error: l } = wT({
24667
+ const { devices: o, isLoading: s, isError: l, error: c } = wT({
24648
24668
  device_ids: t
24649
- }), [c, a] = k.useState(null), [u, p] = k.useState("");
24650
- if (c != null)
24669
+ }), [a, u] = k.useState(null), [p, d] = k.useState(""), f = k.useCallback(
24670
+ (b) => {
24671
+ e(b), !n && u(b);
24672
+ },
24673
+ [e, n, u]
24674
+ );
24675
+ if (a != null)
24651
24676
  return /* @__PURE__ */ v.jsx(
24652
24677
  Wf,
24653
24678
  {
24654
- className: r,
24655
- deviceId: c,
24679
+ className: i,
24680
+ deviceId: a,
24656
24681
  onBack: () => {
24657
- a(null);
24682
+ u(null);
24658
24683
  }
24659
24684
  }
24660
24685
  );
24661
- if (o)
24662
- return /* @__PURE__ */ v.jsx("p", { className: r, children: "..." });
24663
24686
  if (s)
24664
- return /* @__PURE__ */ v.jsx("p", { className: r, children: l == null ? void 0 : l.message });
24665
- if (i == null)
24687
+ return /* @__PURE__ */ v.jsx("p", { className: i, children: "..." });
24688
+ if (l)
24689
+ return /* @__PURE__ */ v.jsx("p", { className: i, children: c == null ? void 0 : c.message });
24690
+ if (o == null)
24666
24691
  return null;
24667
- const d = i.length, f = i.filter((h) => u === "" ? !0 : new RegExp(u, "i").test(h.properties.name));
24668
- return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-device-table", r), children: [
24669
- /* @__PURE__ */ v.jsx(nd, { onBack: n }),
24692
+ const h = o.length, g = o.filter((b) => p === "" ? !0 : new RegExp(p, "i").test(b.properties.name));
24693
+ return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-device-table", i), children: [
24694
+ /* @__PURE__ */ v.jsx(nd, { onBack: r }),
24670
24695
  /* @__PURE__ */ v.jsxs(M1, { children: [
24671
24696
  /* @__PURE__ */ v.jsxs(j1, { children: [
24672
24697
  H1.devices,
24673
24698
  " ",
24674
24699
  /* @__PURE__ */ v.jsxs(z1, { children: [
24675
24700
  "(",
24676
- d,
24701
+ h,
24677
24702
  ")"
24678
24703
  ] })
24679
24704
  ] }),
24680
24705
  /* @__PURE__ */ v.jsx(
24681
24706
  Qf,
24682
24707
  {
24683
- value: u,
24684
- onChange: p,
24685
- disabled: d === 0
24708
+ value: p,
24709
+ onChange: d,
24710
+ disabled: h === 0
24686
24711
  }
24687
24712
  )
24688
24713
  ] }),
24689
- /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(
24690
- OT,
24691
- {
24692
- devices: f,
24693
- onDeviceClick: e ?? a
24694
- }
24695
- ) })
24714
+ /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(OT, { devices: g, onDeviceClick: f }) })
24696
24715
  ] });
24697
24716
  }
24698
24717
  function OT(t) {
@@ -24728,6 +24747,7 @@ const H1 = {
24728
24747
  }, IT = "seam-device-table", CT = {
24729
24748
  deviceIds: "json",
24730
24749
  onDeviceClick: "function",
24750
+ preventDefaultOnDeviceClick: "boolean",
24731
24751
  onBack: "function",
24732
24752
  className: "string"
24733
24753
  }, xT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({