@limrun/ui 0.9.0-rc.8 → 0.13.3-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.
- package/README.md +25 -8
- package/dist/app-store-relay/index.cjs +9 -0
- package/dist/app-store-relay/index.d.ts +102 -0
- package/dist/app-store-relay/index.js +430 -0
- package/dist/app-store-relay/react.cjs +1 -0
- package/dist/app-store-relay/react.d.ts +15 -0
- package/dist/app-store-relay/react.js +65 -0
- package/dist/browser-storage-BJ__DGJ6.mjs +202 -0
- package/dist/browser-storage-C1jQLXat.js +1 -0
- package/dist/client-Bk1N3XIF.mjs +228 -0
- package/dist/client-CnbCWvCs.js +1 -0
- package/dist/components/device-install/index.d.ts +1 -2
- package/dist/core/device-install/apple/provisioning.d.ts +55 -4
- package/dist/core/device-install/operations/limbuild-client.d.ts +15 -1
- package/dist/core/device-install/storage/browser-storage.d.ts +9 -5
- package/dist/core/device-install/types.d.ts +4 -1
- package/dist/device-build/index.cjs +1 -0
- package/dist/device-build/index.d.ts +4 -0
- package/dist/device-build/index.js +84 -0
- package/dist/device-build/react.cjs +1 -0
- package/dist/device-build/react.d.ts +20 -0
- package/dist/device-build/react.js +66 -0
- package/dist/device-build/signing.d.ts +20 -0
- package/dist/device-install/index.cjs +1 -1
- package/dist/device-install/index.d.ts +18 -3
- package/dist/device-install/index.js +570 -76
- package/dist/device-install/react.cjs +1 -1
- package/dist/device-install/react.d.ts +23 -1
- package/dist/device-install/react.js +93 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index-BXg7HdIs.mjs +11547 -0
- package/dist/index-CMeQfhYy.js +22 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +502 -495
- package/dist/limbuild-client-CFJhYsRx.mjs +79 -0
- package/dist/limbuild-client-C_CMNLYV.js +1 -0
- package/dist/provisioning-CdseoMJQ.mjs +239 -0
- package/dist/provisioning-D2ZZQeyX.js +1 -0
- package/package.json +21 -1
- package/src/app-store-relay/index.test.ts +74 -0
- package/src/app-store-relay/index.ts +447 -0
- package/src/app-store-relay/react.ts +125 -0
- package/src/components/device-install/index.ts +1 -2
- package/src/core/device-install/apple/provisioning.test.ts +84 -0
- package/src/core/device-install/apple/provisioning.ts +91 -7
- package/src/core/device-install/operations/limbuild-client.ts +32 -2
- package/src/core/device-install/storage/browser-storage.ts +29 -14
- package/src/core/device-install/types.ts +5 -1
- package/src/device-build/index.ts +42 -0
- package/src/device-build/react.ts +128 -0
- package/src/device-build/signing.ts +94 -0
- package/src/device-install/index.ts +49 -3
- package/src/device-install/react.ts +180 -1
- package/src/hooks/index.ts +1 -1
- package/src/index.ts +1 -4
- package/vite.config.ts +4 -0
- package/dist/components/device-install/device-install-dialog.d.ts +0 -5
- package/dist/device-install-dialog-DGn2ZdBB.js +0 -2
- package/dist/device-install-dialog-DgWsZF6o.mjs +0 -443
- package/dist/device-install-dialog.css +0 -1
- package/dist/hooks/use-device-install.d.ts +0 -73
- package/dist/use-device-install-ByUSmeYz.js +0 -31
- package/dist/use-device-install-Y42p84we.mjs +0 -13624
- package/src/components/device-install/device-install-dialog.css +0 -325
- package/src/components/device-install/device-install-dialog.tsx +0 -495
- package/src/hooks/use-device-install.ts +0 -1219
|
@@ -1 +1,180 @@
|
|
|
1
|
-
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
closeDeviceRelayTarget,
|
|
4
|
+
getPairRecord,
|
|
5
|
+
pairDevice,
|
|
6
|
+
putPairRecord,
|
|
7
|
+
requestUSBAccess,
|
|
8
|
+
startDeviceInstall,
|
|
9
|
+
type DeviceInstallLog,
|
|
10
|
+
type DeviceRelayTarget,
|
|
11
|
+
type RelayClient,
|
|
12
|
+
type StoredPairRecord,
|
|
13
|
+
} from './index';
|
|
14
|
+
|
|
15
|
+
export type DeviceInstallRelayBusyAction = 'usb' | 'pair' | 'install';
|
|
16
|
+
|
|
17
|
+
export type UseDeviceInstallRelayOptions = {
|
|
18
|
+
apiUrl?: string;
|
|
19
|
+
token?: string;
|
|
20
|
+
log?: DeviceInstallLog;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type UseDeviceInstallRelayResult = {
|
|
24
|
+
device?: DeviceRelayTarget;
|
|
25
|
+
pairRecord?: StoredPairRecord;
|
|
26
|
+
busyAction?: DeviceInstallRelayBusyAction;
|
|
27
|
+
error?: string;
|
|
28
|
+
pairConfirmationRequired: boolean;
|
|
29
|
+
hasPairRecord: boolean;
|
|
30
|
+
canPair: boolean;
|
|
31
|
+
canInstall: boolean;
|
|
32
|
+
requestUSBAccess: () => Promise<DeviceRelayTarget | undefined>;
|
|
33
|
+
pairBrowser: () => Promise<StoredPairRecord | undefined>;
|
|
34
|
+
startInstallation: () => Promise<RelayClient | undefined>;
|
|
35
|
+
stopRelay: () => void;
|
|
36
|
+
clearError: () => void;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function useDeviceInstallRelay({
|
|
40
|
+
apiUrl,
|
|
41
|
+
token,
|
|
42
|
+
log = noopLog,
|
|
43
|
+
}: UseDeviceInstallRelayOptions): UseDeviceInstallRelayResult {
|
|
44
|
+
const [device, setDevice] = useState<DeviceRelayTarget | undefined>();
|
|
45
|
+
const [pairRecord, setPairRecord] = useState<StoredPairRecord | undefined>();
|
|
46
|
+
const [busyAction, setBusyAction] = useState<DeviceInstallRelayBusyAction | undefined>();
|
|
47
|
+
const [error, setError] = useState<string | undefined>();
|
|
48
|
+
const [pairConfirmationRequired, setPairConfirmationRequired] = useState(false);
|
|
49
|
+
const relayRef = useRef<RelayClient | undefined>(undefined);
|
|
50
|
+
const deviceRef = useRef<DeviceRelayTarget | undefined>(undefined);
|
|
51
|
+
|
|
52
|
+
const cleanupDeviceAccess = useCallback(async () => {
|
|
53
|
+
relayRef.current?.close();
|
|
54
|
+
relayRef.current = undefined;
|
|
55
|
+
await closeDeviceRelayTarget(deviceRef.current, log);
|
|
56
|
+
}, [log]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
deviceRef.current = device;
|
|
60
|
+
}, [device]);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
return () => {
|
|
64
|
+
void cleanupDeviceAccess();
|
|
65
|
+
};
|
|
66
|
+
}, [cleanupDeviceAccess]);
|
|
67
|
+
|
|
68
|
+
const selectUSBDevice = useCallback(async () => {
|
|
69
|
+
setBusyAction('usb');
|
|
70
|
+
setError(undefined);
|
|
71
|
+
setPairConfirmationRequired(false);
|
|
72
|
+
let target: DeviceRelayTarget | undefined;
|
|
73
|
+
try {
|
|
74
|
+
await cleanupDeviceAccess();
|
|
75
|
+
target = await requestUSBAccess({ log });
|
|
76
|
+
const storedPairRecord = await getPairRecord(target.hello.serialNumber);
|
|
77
|
+
setDevice(target);
|
|
78
|
+
setPairRecord(storedPairRecord);
|
|
79
|
+
log(storedPairRecord ? 'Pair record found' : 'No pair record found', target.hello.serialNumber);
|
|
80
|
+
return target;
|
|
81
|
+
} catch (caught) {
|
|
82
|
+
await closeDeviceRelayTarget(target, log);
|
|
83
|
+
setDevice(undefined);
|
|
84
|
+
setPairRecord(undefined);
|
|
85
|
+
setError(errorMessage(caught));
|
|
86
|
+
return undefined;
|
|
87
|
+
} finally {
|
|
88
|
+
setBusyAction(undefined);
|
|
89
|
+
}
|
|
90
|
+
}, [cleanupDeviceAccess, log]);
|
|
91
|
+
|
|
92
|
+
const pairBrowser = useCallback(async () => {
|
|
93
|
+
if (!apiUrl || !device) {
|
|
94
|
+
throw new Error('Select a USB device before pairing.');
|
|
95
|
+
}
|
|
96
|
+
setBusyAction('pair');
|
|
97
|
+
setError(undefined);
|
|
98
|
+
setPairConfirmationRequired(false);
|
|
99
|
+
try {
|
|
100
|
+
await cleanupDeviceAccess();
|
|
101
|
+
const result = await pairDevice({
|
|
102
|
+
limbuildApiUrl: apiUrl,
|
|
103
|
+
token,
|
|
104
|
+
log,
|
|
105
|
+
target: device,
|
|
106
|
+
});
|
|
107
|
+
const stored = await putPairRecord(result.pairRecord, {
|
|
108
|
+
productName: device.hello.productName,
|
|
109
|
+
});
|
|
110
|
+
result.relay.close();
|
|
111
|
+
await closeDeviceRelayTarget(device, log);
|
|
112
|
+
setPairRecord(stored);
|
|
113
|
+
setPairConfirmationRequired(false);
|
|
114
|
+
log('Device paired', 'The pair record was stored locally in this browser.');
|
|
115
|
+
return stored;
|
|
116
|
+
} catch (caught) {
|
|
117
|
+
await closeDeviceRelayTarget(device, log);
|
|
118
|
+
setPairConfirmationRequired(true);
|
|
119
|
+
setError(errorMessage(caught));
|
|
120
|
+
return undefined;
|
|
121
|
+
} finally {
|
|
122
|
+
setBusyAction(undefined);
|
|
123
|
+
}
|
|
124
|
+
}, [apiUrl, cleanupDeviceAccess, device, log, token]);
|
|
125
|
+
|
|
126
|
+
const startInstallation = useCallback(async () => {
|
|
127
|
+
if (!apiUrl || !device || !pairRecord) {
|
|
128
|
+
throw new Error('Select and pair a USB device before starting installation.');
|
|
129
|
+
}
|
|
130
|
+
setBusyAction('install');
|
|
131
|
+
setError(undefined);
|
|
132
|
+
try {
|
|
133
|
+
await cleanupDeviceAccess();
|
|
134
|
+
relayRef.current = await startDeviceInstall({
|
|
135
|
+
limbuildApiUrl: apiUrl,
|
|
136
|
+
token,
|
|
137
|
+
log,
|
|
138
|
+
target: device,
|
|
139
|
+
pairRecord,
|
|
140
|
+
});
|
|
141
|
+
log('Device install started', 'Installation will continue through the connected iPhone.');
|
|
142
|
+
return relayRef.current;
|
|
143
|
+
} catch (caught) {
|
|
144
|
+
await closeDeviceRelayTarget(device, log);
|
|
145
|
+
setError(errorMessage(caught));
|
|
146
|
+
return undefined;
|
|
147
|
+
} finally {
|
|
148
|
+
setBusyAction(undefined);
|
|
149
|
+
}
|
|
150
|
+
}, [apiUrl, cleanupDeviceAccess, device, log, pairRecord, token]);
|
|
151
|
+
|
|
152
|
+
const stopRelay = useCallback(() => {
|
|
153
|
+
void cleanupDeviceAccess();
|
|
154
|
+
log('Device relay stopped');
|
|
155
|
+
}, [cleanupDeviceAccess, log]);
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
device,
|
|
159
|
+
pairRecord,
|
|
160
|
+
busyAction,
|
|
161
|
+
error,
|
|
162
|
+
pairConfirmationRequired,
|
|
163
|
+
hasPairRecord: !!pairRecord,
|
|
164
|
+
canPair: !!apiUrl && !busyAction && !!device,
|
|
165
|
+
canInstall: !!apiUrl && !busyAction && !!device && !!pairRecord,
|
|
166
|
+
requestUSBAccess: selectUSBDevice,
|
|
167
|
+
pairBrowser,
|
|
168
|
+
startInstallation,
|
|
169
|
+
stopRelay,
|
|
170
|
+
clearError: () => setError(undefined),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function noopLog() {
|
|
175
|
+
// Intentionally empty. Consumers can pass a logger for progress messages.
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function errorMessage(error: unknown) {
|
|
179
|
+
return error instanceof Error ? error.message : String(error);
|
|
180
|
+
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,4 @@ export {
|
|
|
16
16
|
normalizeAndroidTree,
|
|
17
17
|
normalizeIosTree,
|
|
18
18
|
AX_UNAVAILABLE_ERROR,
|
|
19
|
-
} from './core/ax-tree';
|
|
20
|
-
|
|
21
|
-
export { DeviceInstallDialog, DeviceInstallRelay } from './components/device-install';
|
|
22
|
-
export { useDeviceInstall } from './hooks/use-device-install';
|
|
19
|
+
} from './core/ax-tree';
|
package/vite.config.ts
CHANGED
|
@@ -11,6 +11,10 @@ export default defineConfig({
|
|
|
11
11
|
lib: {
|
|
12
12
|
entry: {
|
|
13
13
|
index: resolve(__dirname, 'src/index.ts'),
|
|
14
|
+
'app-store-relay/index': resolve(__dirname, 'src/app-store-relay/index.ts'),
|
|
15
|
+
'app-store-relay/react': resolve(__dirname, 'src/app-store-relay/react.ts'),
|
|
16
|
+
'device-build/index': resolve(__dirname, 'src/device-build/index.ts'),
|
|
17
|
+
'device-build/react': resolve(__dirname, 'src/device-build/react.ts'),
|
|
14
18
|
'device-install/index': resolve(__dirname, 'src/device-install/index.ts'),
|
|
15
19
|
'device-install/react': resolve(__dirname, 'src/device-install/react.ts'),
|
|
16
20
|
},
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { UseDeviceInstallOptions } from '../../hooks/use-device-install';
|
|
2
|
-
export type DeviceInstallDialogProps = UseDeviceInstallOptions & {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare function DeviceInstallDialog({ disabled, ...hookOptions }: DeviceInstallDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";require('./device-install-dialog.css');const e=require("react/jsx-runtime"),d=require("react"),w=require("./use-device-install-ByUSmeYz.js");function S(l){var t,a,n="";if(typeof l=="string"||typeof l=="number")n+=l;else if(typeof l=="object")if(Array.isArray(l)){var c=l.length;for(t=0;t<c;t++)l[t]&&(a=S(l[t]))&&(n&&(n+=" "),n+=a)}else for(a in l)l[a]&&(n&&(n+=" "),n+=a);return n}function u(){for(var l,t,a=0,n="",c=arguments.length;a<c;a++)(l=arguments[a])&&(t=S(l))&&(n&&(n+=" "),n+=t);return n}const P=[{id:"signing",title:"Prepare signing",description:"Choose Apple ID login or upload certificates for a registered developer device."},{id:"build",title:"Build for device",description:"Start the signed iPhone build before connecting over USB."},{id:"connect",title:"Connect and pair",description:"After the build succeeds, connect the iPhone with WebUSB and pair this browser."},{id:"install",title:"Start installation",description:"Relay the last successful device build to the paired iPhone."}];function I({disabled:l,...t}){const[a,n]=d.useState(!1),[c,h]=d.useState("signing"),[o,b]=d.useState(),[g,y]=d.useState(""),[m,A]=d.useState(""),[x,C]=d.useState(""),j=d.useId(),i=w.useDeviceInstall(t);d.useEffect(()=>{h(i.currentStep)},[i.currentStep]);const f=(r,p)=>{i.setSigningFiles({[r]:p.currentTarget.files?.[0]})};return e.jsxs("div",{className:"lr-device-install",children:[e.jsx("button",{type:"button",className:"lr-device-install__trigger",disabled:l||!t.apiUrl,onClick:()=>n(!0),children:"Install to iPhone"}),a&&e.jsx("div",{className:"lr-device-install__backdrop",role:"presentation",children:e.jsxs("section",{"aria-labelledby":j,"aria-modal":"true",className:"lr-device-install__dialog",role:"dialog",children:[e.jsxs("header",{className:"lr-device-install__header",children:[e.jsxs("div",{children:[e.jsx("h2",{id:j,children:"Install to a real iPhone"}),e.jsx("p",{children:"Prepare signing, build for the registered device, connect and pair, then install from this browser."})]}),e.jsx("button",{type:"button",className:"lr-device-install__icon-button",onClick:()=>n(!1),children:"Close"})]}),i.error&&e.jsx("div",{className:"lr-device-install__error",children:i.error}),e.jsx("div",{className:"lr-device-install__steps",children:P.map((r,p)=>e.jsxs(T,{index:p+1,step:r,active:i.currentStep===r.id,open:c===r.id,status:i.stepStatuses[r.id],onToggle:()=>h(r.id),children:[r.id==="signing"&&e.jsxs("div",{className:"lr-device-install__step-body",children:[e.jsxs("div",{className:"lr-device-install__choice-grid",children:[e.jsxs("button",{type:"button",className:u("lr-device-install__choice",o==="apple-id"&&"lr-device-install__choice--active"),onClick:()=>b("apple-id"),children:[e.jsx("strong",{children:"Apple ID login"}),e.jsx("span",{children:"Sign in, choose team, bundle ID, and registered devices, then generate signing assets."})]}),e.jsxs("button",{type:"button",className:u("lr-device-install__choice",o==="upload"&&"lr-device-install__choice--active"),onClick:()=>b("upload"),children:[e.jsx("strong",{children:"Upload certificates"}),e.jsx("span",{children:"Use an existing .p12 certificate and provisioning profile."})]})]}),o==="apple-id"&&e.jsxs("div",{className:"lr-device-install__section-panel",children:[e.jsxs("div",{className:"lr-device-install__grid",children:[e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Apple ID"}),e.jsx("input",{type:"email",autoComplete:"username",placeholder:"name@example.com",value:g,onChange:s=>y(s.currentTarget.value)})]}),e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Apple ID password"}),e.jsx("input",{type:"password",autoComplete:"current-password",placeholder:"Password stays in this browser",value:m,onChange:s=>A(s.currentTarget.value)})]}),!i.hasReusableAppleCertificate&&e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Generated .p12 password"}),e.jsx("input",{type:"password",placeholder:"Used when exporting Apple certificate",onChange:s=>i.setSigningFiles({certificatePassword:s.currentTarget.value})})]})]}),e.jsxs("div",{className:"lr-device-install__actions",children:[e.jsx("button",{type:"button",className:"lr-device-install__secondary",disabled:l||!t.apiUrl||!g||!m||i.busyAction==="signing",onClick:()=>void i.startAppleIDLogin({accountName:g,password:m}),children:i.appleSigningStatus==="authenticating"?"Signing in...":"Sign in with Apple ID"}),e.jsxs("span",{className:"lr-device-install__hint",children:["Apple password is used only by browser-side SRP. Status: ",i.appleSigningStatus]})]}),i.appleSigningStatus==="two-factor-required"&&e.jsxs("div",{className:"lr-device-install__grid",children:[e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Two-factor code"}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"one-time-code",value:x,onChange:s=>C(s.currentTarget.value)})]}),e.jsx("button",{type:"button",className:"lr-device-install__secondary",disabled:!x||i.busyAction==="signing",onClick:()=>void i.submitAppleTwoFactorCode(x),children:"Submit Apple ID code"})]}),i.appleTeams.length>0&&e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Apple Developer team"}),e.jsx("select",{value:i.selectedAppleTeamID??"",onChange:s=>i.setSelectedAppleTeamID(s.currentTarget.value||void 0),children:i.appleTeams.map((s,_)=>{const v=s.teamId??(s.providerId===void 0?void 0:String(s.providerId))??s.publicProviderId??"";return e.jsxs("option",{value:v,children:[s.name??"Apple Developer Team"," ",v?`(${v})`:""]},`${v}-${_}`)})})]}),i.appleDevices.length>0&&e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Apple Developer devices"}),e.jsx("select",{multiple:!0,value:i.selectedAppleDeviceIDs,onChange:s=>i.setSelectedAppleDeviceIDs(Array.from(s.currentTarget.selectedOptions).map(_=>_.value)),children:i.appleDevices.map(s=>e.jsxs("option",{value:s.deviceId??"",children:[s.name??s.model??"Apple device"," ",s.deviceNumber??""]},s.deviceId??s.deviceNumber))})]}),i.applePortalSummary&&e.jsxs("p",{className:"lr-device-install__hint",children:["Found ",i.applePortalSummary.certificateCount," certificates and"," ",i.applePortalSummary.profileCount," provisioning profiles."]}),i.hasReusableAppleCertificate&&e.jsx("p",{className:"lr-device-install__hint",children:"Reusing the certificate and private key stored in this browser."}),e.jsx("button",{type:"button",className:"lr-device-install__primary",disabled:l||!i.canPrepareAppleSigningAssets,onClick:()=>void i.prepareAppleSigningAssets(),children:i.appleSigningStatus==="preparing-assets"?"Preparing signing assets...":"Generate certificate and profile"})]}),o==="upload"&&e.jsxs("div",{className:"lr-device-install__section-panel",children:[e.jsxs("div",{className:"lr-device-install__grid",children:[e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Certificate (.p12)"}),e.jsx("input",{type:"file",accept:".p12,application/x-pkcs12",onChange:s=>f("certificateFile",s)})]}),e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Provisioning profile"}),e.jsx("input",{type:"file",accept:".mobileprovision",onChange:s=>f("provisioningProfileFile",s)})]}),e.jsxs("label",{className:"lr-device-install__field",children:[e.jsx("span",{children:"Uploaded .p12 password"}),e.jsx("input",{type:"password",placeholder:"Export password",onChange:s=>i.setSigningFiles({certificatePassword:s.currentTarget.value})})]})]}),e.jsx("p",{className:"lr-device-install__hint",children:"The provisioning profile will be checked against the connected iPhone before installation."})]}),i.hasSigningAssets&&e.jsx("p",{children:"Signing assets are stored in this browser for the selected bundle and device."})]}),r.id==="connect"&&e.jsxs("div",{className:"lr-device-install__step-body",children:[e.jsx("p",{children:"WebUSB works in Chromium browsers on secure origins. Once the build succeeds, connect the iPhone over USB, approve the browser permission prompt, then pair this browser."}),e.jsxs("div",{className:"lr-device-install__actions",children:[e.jsx("button",{type:"button",className:"lr-device-install__primary",disabled:l||!i.canRequestUSBAccess,onClick:()=>void i.requestUSBAccess(),children:i.busyAction==="usb"?"Selecting iPhone...":"Allow USB access"}),e.jsx("button",{type:"button",className:"lr-device-install__secondary",disabled:l||!i.canPairBrowser,onClick:()=>void i.pairBrowser(),children:i.busyAction==="pair"?"Pairing...":i.pairConfirmationRequired?"Confirm pair record":"Pair browser"})]}),i.device&&e.jsx("div",{className:"lr-device-install__device",children:`${i.device.productName??"iPhone"} ${i.device.serialNumber??""}`.trim()}),i.pairConfirmationRequired&&e.jsxs("p",{children:["Unlock the iPhone and tap ",e.jsx("strong",{children:"Trust"})," in the system dialog, then confirm the pair record."]}),e.jsx("p",{children:i.hasPairRecord?"Pair record is stored locally. Continue to installation.":"Pair this browser once before installing."})]}),r.id==="build"&&e.jsxs("div",{className:"lr-device-install__step-body",children:[e.jsxs("div",{className:"lr-device-install__checklist",children:[e.jsx(N,{label:"Signing assets",ready:i.hasSigningInputs}),e.jsx(N,{label:"Device build",ready:i.buildStatus==="succeeded"?!0:void 0,pendingText:"Not started"})]}),e.jsx("button",{type:"button",className:"lr-device-install__primary",disabled:l||!i.canBuild,onClick:()=>void i.startDeviceBuild(),children:i.busyAction==="build"?"Starting build...":"Start device build"}),e.jsxs("details",{className:"lr-device-install__build-logs",open:i.buildLogPanelOpen,onToggle:s=>i.setBuildLogPanelOpen(s.currentTarget.open),children:[e.jsxs("summary",{children:["Build logs (",i.buildStatus,")"]}),e.jsx("pre",{children:i.buildLogs.length>0?i.buildLogs.filter(s=>s.type!=="meta").map(s=>s.data).join(`
|
|
2
|
-
`):"Build logs will appear here while the device build is running."})]})]}),r.id==="install"&&e.jsxs("div",{className:"lr-device-install__step-body",children:[e.jsx("button",{type:"button",className:"lr-device-install__primary",disabled:l||!i.canInstall,onClick:()=>void i.startInstallation(),children:i.busyAction==="install"?"Installing...":"Install last build"}),e.jsx("button",{type:"button",className:"lr-device-install__secondary",onClick:i.stopRelay,children:"Stop relay"})]})]},r.id))}),e.jsxs("footer",{className:"lr-device-install__logs",children:[e.jsx("h3",{children:"Progress"}),e.jsx("ol",{children:i.logs.map((r,p)=>e.jsx("li",{children:r},`${p}-${r.slice(0,24)}`))})]})]})})]})}function T({index:l,step:t,active:a,open:n,status:c,onToggle:h,children:o}){return e.jsxs("article",{className:u("lr-device-install__step",a&&"lr-device-install__step--active"),children:[e.jsxs("button",{type:"button",className:"lr-device-install__step-header","aria-expanded":n,onClick:h,children:[e.jsx("div",{className:"lr-device-install__step-number",children:l}),e.jsxs("div",{children:[e.jsx("h3",{children:t.title}),e.jsx("p",{children:t.description})]}),e.jsx("span",{className:u("lr-device-install__status",`lr-device-install__status--${c}`),children:c==="complete"?"✓ Completed":c})]}),n&&o]})}function N({label:l,ready:t,pendingText:a="Not ready"}){const n=t===void 0?a:t?"Ready":"Needs attention";return e.jsxs("div",{className:"lr-device-install__check-row",children:[e.jsx("span",{children:l}),e.jsx("strong",{children:n})]})}exports.DeviceInstallDialog=I;exports.clsx=u;
|