@limrun/ui 0.13.7 → 0.14.0-rc.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.
Files changed (47) hide show
  1. package/dist/app-store-relay/index.cjs +3 -3
  2. package/dist/app-store-relay/index.d.ts +3 -5
  3. package/dist/app-store-relay/index.js +56 -58
  4. package/dist/app-store-relay/react.cjs +1 -1
  5. package/dist/app-store-relay/react.d.ts +2 -2
  6. package/dist/app-store-relay/react.js +35 -34
  7. package/dist/client-BtC4n_qf.js +1 -0
  8. package/dist/client-CBX-hLnL.mjs +189 -0
  9. package/dist/core/device-install/apple/client.d.ts +5 -4
  10. package/dist/core/device-install/apple/relay.d.ts +24 -13
  11. package/dist/core/device-install/operations/limbuild-client.d.ts +2 -1
  12. package/dist/core/device-install/operations/operations.d.ts +19 -4
  13. package/dist/core/device-install/operations/relay-client.d.ts +2 -1
  14. package/dist/device-build/index.cjs +1 -1
  15. package/dist/device-build/index.js +1 -1
  16. package/dist/device-build/react.cjs +1 -1
  17. package/dist/device-build/react.d.ts +1 -0
  18. package/dist/device-build/react.js +34 -33
  19. package/dist/device-install/index.cjs +1 -1
  20. package/dist/device-install/index.d.ts +1 -1
  21. package/dist/device-install/index.js +121 -119
  22. package/dist/device-install/react.cjs +1 -1
  23. package/dist/device-install/react.d.ts +4 -3
  24. package/dist/device-install/react.js +58 -54
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +519 -531
  27. package/dist/limbuild-client-BagK_FWE.mjs +83 -0
  28. package/dist/limbuild-client-CVDwq54z.js +1 -0
  29. package/package.json +1 -1
  30. package/src/app-store-relay/index.test.ts +19 -29
  31. package/src/app-store-relay/index.ts +6 -9
  32. package/src/app-store-relay/react.ts +5 -4
  33. package/src/components/remote-control.tsx +1 -28
  34. package/src/core/device-install/apple/client.ts +22 -33
  35. package/src/core/device-install/apple/relay.ts +108 -148
  36. package/src/core/device-install/operations/limbuild-client.ts +3 -0
  37. package/src/core/device-install/operations/operations.ts +21 -9
  38. package/src/core/device-install/operations/relay-client.ts +3 -2
  39. package/src/device-build/react.ts +2 -0
  40. package/src/device-install/README.md +5 -5
  41. package/src/device-install/demo/demo.tsx +26 -28
  42. package/src/device-install/index.ts +1 -0
  43. package/src/device-install/react.ts +12 -6
  44. package/dist/client-ASLtHFLh.js +0 -1
  45. package/dist/client-CGdh8yoJ.mjs +0 -234
  46. package/dist/limbuild-client-CgEncrgx.js +0 -1
  47. package/dist/limbuild-client-D7U7w342.mjs +0 -81
@@ -1,100 +1,104 @@
1
- import { useState as u, useRef as h, useCallback as l, useEffect as D } from "react";
2
- import { closeDeviceRelayTarget as d, requestUSBAccess as N, pairDevice as q, startDeviceInstall as C } from "./index.js";
3
- import { j as T, k as j } from "../browser-storage-Cx9eW-bm.mjs";
4
- function F({
5
- apiUrl: a,
1
+ import { useState as u, useRef as g, useCallback as l, useEffect as S } from "react";
2
+ import { closeDeviceRelayTarget as d, requestUSBAccess as C, pairDevice as I, startDeviceInstall as T } from "./index.js";
3
+ import { j, k as x } from "../browser-storage-Cx9eW-bm.mjs";
4
+ function H({
5
+ apiUrl: c,
6
6
  token: v,
7
- log: R = x
7
+ organizationId: f,
8
+ log: m = L
8
9
  }) {
9
- const [e, m] = u(), [n, y] = u(), [g, s] = u(), [P, i] = u(), [S, f] = u(!1), w = h(void 0), b = h(void 0), r = h(R);
10
- r.current = R;
11
- const c = l(async () => {
12
- w.current?.close(), w.current = void 0, await d(b.current, r.current);
10
+ const [e, D] = u(), [n, h] = u(), [p, s] = u(), [b, i] = u(), [A, w] = u(!1), y = g(void 0), P = g(void 0), r = g(m);
11
+ r.current = m;
12
+ const a = l(async () => {
13
+ y.current?.close(), y.current = void 0, await d(P.current, r.current);
13
14
  }, []);
14
- D(() => {
15
- b.current = e;
16
- }, [e]), D(() => () => {
17
- c();
18
- }, [c]);
19
- const A = l(async () => {
20
- s("usb"), i(void 0), f(!1);
15
+ S(() => {
16
+ P.current = e;
17
+ }, [e]), S(() => () => {
18
+ a();
19
+ }, [a]);
20
+ const B = l(async () => {
21
+ s("usb"), i(void 0), w(!1);
21
22
  let t;
22
23
  try {
23
- await c(), t = await N({ log: r.current });
24
- const o = await T(t.hello.serialNumber);
25
- return m(t), y(o), r.current(
24
+ await a(), t = await C({ log: r.current });
25
+ const o = await j(t.hello.serialNumber);
26
+ return D(t), h(o), r.current(
26
27
  o ? "Pair record found" : "No pair record found",
27
28
  t.hello.serialNumber
28
29
  ), t;
29
30
  } catch (o) {
30
- await d(t, r.current), m(void 0), y(void 0), i(p(o));
31
+ await d(t, r.current), D(void 0), h(void 0), i(R(o));
31
32
  return;
32
33
  } finally {
33
34
  s(void 0);
34
35
  }
35
- }, [c]), B = l(async () => {
36
- if (!a || !e)
36
+ }, [a]), E = l(async () => {
37
+ if (!c || !e)
37
38
  throw new Error("Select a USB device before pairing.");
38
- s("pair"), i(void 0), f(!1);
39
+ s("pair"), i(void 0), w(!1);
39
40
  try {
40
- await c();
41
- const t = await q({
42
- limbuildApiUrl: a,
41
+ await a();
42
+ const t = await I({
43
+ registryApiUrl: c,
43
44
  token: v,
45
+ organizationId: f,
44
46
  log: r.current,
45
47
  target: e
46
- }), o = await j(t.pairRecord, {
48
+ }), o = await x(t.pairRecord, {
47
49
  productName: e.hello.productName
48
50
  });
49
- return t.relay.close(), await d(e, r.current), y(o), f(!1), r.current("Device paired", "The pair record was stored locally in this browser."), o;
51
+ return t.relay.close(), await d(e, r.current), h(o), w(!1), r.current("Device paired", "The pair record was stored locally in this browser."), o;
50
52
  } catch (t) {
51
- await d(e, r.current), f(!0), i(p(t));
53
+ await d(e, r.current), w(!0), i(R(t));
52
54
  return;
53
55
  } finally {
54
56
  s(void 0);
55
57
  }
56
- }, [a, c, e, v]), E = l(async () => {
57
- if (!a || !e || !n)
58
+ }, [c, a, e, f, v]), N = l(async (t) => {
59
+ if (!c || !e || !n)
58
60
  throw new Error("Select and pair a USB device before starting installation.");
59
61
  s("install"), i(void 0);
60
62
  try {
61
- return await c(), w.current = await C({
62
- limbuildApiUrl: a,
63
+ return await a(), y.current = await T({
64
+ registryApiUrl: c,
63
65
  token: v,
66
+ organizationId: f,
64
67
  log: r.current,
65
68
  target: e,
66
- pairRecord: n
67
- }), r.current("Device install started", "Installation will continue through the connected iPhone."), w.current;
68
- } catch (t) {
69
- await d(e, r.current), i(p(t));
69
+ pairRecord: n,
70
+ installSource: t
71
+ }), r.current("Device install started", "Installation will continue through the connected iPhone."), y.current;
72
+ } catch (o) {
73
+ await d(e, r.current), i(R(o));
70
74
  return;
71
75
  } finally {
72
76
  s(void 0);
73
77
  }
74
- }, [a, c, e, n, v]), I = l(() => {
75
- c(), r.current("Device relay stopped");
76
- }, [c]);
78
+ }, [c, a, e, f, n, v]), q = l(() => {
79
+ a(), r.current("Device relay stopped");
80
+ }, [a]);
77
81
  return {
78
82
  device: e,
79
83
  pairRecord: n,
80
- busyAction: g,
81
- error: P,
82
- pairConfirmationRequired: S,
84
+ busyAction: p,
85
+ error: b,
86
+ pairConfirmationRequired: A,
83
87
  hasPairRecord: !!n,
84
- canPair: !!a && !g && !!e,
85
- canInstall: !!a && !g && !!e && !!n,
86
- requestUSBAccess: A,
87
- pairBrowser: B,
88
- startInstallation: E,
89
- stopRelay: I,
88
+ canPair: !!c && !p && !!e,
89
+ canInstall: !!c && !p && !!e && !!n,
90
+ requestUSBAccess: B,
91
+ pairBrowser: E,
92
+ startInstallation: N,
93
+ stopRelay: q,
90
94
  clearError: () => i(void 0)
91
95
  };
92
96
  }
93
- function x() {
97
+ function L() {
94
98
  }
95
- function p(a) {
96
- return a instanceof Error ? a.message : String(a);
99
+ function R(c) {
100
+ return c instanceof Error ? c.message : String(c);
97
101
  }
98
102
  export {
99
- F as useDeviceInstallRelay
103
+ H as useDeviceInstallRelay
100
104
  };