@limrun/ui 0.14.0-rc.5 → 0.14.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 (115) hide show
  1. package/README.md +9 -26
  2. package/dist/components/remote-control.d.ts +36 -0
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1351 -1196
  6. package/package.json +10 -51
  7. package/src/components/remote-control.tsx +414 -2
  8. package/src/index.ts +1 -1
  9. package/vite.config.ts +0 -9
  10. package/dist/app-store-relay/index.cjs +0 -9
  11. package/dist/app-store-relay/index.d.ts +0 -204
  12. package/dist/app-store-relay/index.js +0 -677
  13. package/dist/app-store-relay/react.cjs +0 -1
  14. package/dist/app-store-relay/react.d.ts +0 -15
  15. package/dist/app-store-relay/react.js +0 -69
  16. package/dist/apple-credentials/index.cjs +0 -1
  17. package/dist/apple-credentials/index.d.ts +0 -110
  18. package/dist/apple-credentials/index.js +0 -291
  19. package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
  20. package/dist/browser-storage-DLxIqZk5.js +0 -1
  21. package/dist/client-C9z_sgOf.js +0 -1
  22. package/dist/client-CFDB4mX5.mjs +0 -191
  23. package/dist/core/device-install/apple/client.d.ts +0 -18
  24. package/dist/core/device-install/apple/crypto.d.ts +0 -20
  25. package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
  26. package/dist/core/device-install/apple/index.d.ts +0 -5
  27. package/dist/core/device-install/apple/provisioning.d.ts +0 -237
  28. package/dist/core/device-install/apple/relay.d.ts +0 -53
  29. package/dist/core/device-install/index.d.ts +0 -4
  30. package/dist/core/device-install/operations/index.d.ts +0 -6
  31. package/dist/core/device-install/operations/limbuild-client.d.ts +0 -43
  32. package/dist/core/device-install/operations/operations.d.ts +0 -47
  33. package/dist/core/device-install/operations/relay-client.d.ts +0 -26
  34. package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
  35. package/dist/core/device-install/operations/usbmux.d.ts +0 -32
  36. package/dist/core/device-install/operations/webusb.d.ts +0 -21
  37. package/dist/core/device-install/storage/browser-storage.d.ts +0 -56
  38. package/dist/core/device-install/storage/index.d.ts +0 -2
  39. package/dist/core/device-install/storage/secret-store.d.ts +0 -124
  40. package/dist/core/device-install/types.d.ts +0 -57
  41. package/dist/core/errors.d.ts +0 -1
  42. package/dist/core/play-publish/google.d.ts +0 -13
  43. package/dist/core/play-publish/publish.d.ts +0 -34
  44. package/dist/device-build/index.cjs +0 -1
  45. package/dist/device-build/index.d.ts +0 -4
  46. package/dist/device-build/index.js +0 -85
  47. package/dist/device-build/react.cjs +0 -1
  48. package/dist/device-build/react.d.ts +0 -21
  49. package/dist/device-build/react.js +0 -68
  50. package/dist/device-build/signing.d.ts +0 -20
  51. package/dist/device-install/demo/demo.d.ts +0 -0
  52. package/dist/device-install/index.cjs +0 -1
  53. package/dist/device-install/index.d.ts +0 -18
  54. package/dist/device-install/index.js +0 -594
  55. package/dist/device-install/react.cjs +0 -1
  56. package/dist/device-install/react.d.ts +0 -24
  57. package/dist/device-install/react.js +0 -105
  58. package/dist/errors-BSkqS7U-.js +0 -1
  59. package/dist/errors-gy8yQJos.mjs +0 -6
  60. package/dist/gsa-srp-Bme3JLEi.mjs +0 -266
  61. package/dist/gsa-srp-CCIfUz7Y.js +0 -1
  62. package/dist/index-ChhtuQ7e.js +0 -22
  63. package/dist/index-YDu8K9a4.mjs +0 -11279
  64. package/dist/limbuild-client-BagK_FWE.mjs +0 -83
  65. package/dist/limbuild-client-CVDwq54z.js +0 -1
  66. package/dist/play-publish/index.cjs +0 -1
  67. package/dist/play-publish/index.d.ts +0 -2
  68. package/dist/play-publish/index.js +0 -109
  69. package/dist/play-publish/react.cjs +0 -1
  70. package/dist/play-publish/react.d.ts +0 -31
  71. package/dist/play-publish/react.js +0 -91
  72. package/dist/provisioning-CDPvxd1h.mjs +0 -270
  73. package/dist/provisioning-CbC4h--7.js +0 -1
  74. package/src/app-store-relay/index.test.ts +0 -60
  75. package/src/app-store-relay/index.ts +0 -846
  76. package/src/app-store-relay/react.ts +0 -131
  77. package/src/apple-credentials/index.test.ts +0 -180
  78. package/src/apple-credentials/index.ts +0 -388
  79. package/src/core/device-install/apple/client.ts +0 -150
  80. package/src/core/device-install/apple/crypto.ts +0 -205
  81. package/src/core/device-install/apple/gsa-srp.ts +0 -123
  82. package/src/core/device-install/apple/index.ts +0 -5
  83. package/src/core/device-install/apple/provisioning.test.ts +0 -114
  84. package/src/core/device-install/apple/provisioning.ts +0 -419
  85. package/src/core/device-install/apple/relay.ts +0 -202
  86. package/src/core/device-install/index.ts +0 -4
  87. package/src/core/device-install/operations/index.ts +0 -6
  88. package/src/core/device-install/operations/limbuild-client.ts +0 -144
  89. package/src/core/device-install/operations/operations.ts +0 -239
  90. package/src/core/device-install/operations/relay-client.ts +0 -286
  91. package/src/core/device-install/operations/relay-protocol.ts +0 -71
  92. package/src/core/device-install/operations/usbmux.ts +0 -270
  93. package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
  94. package/src/core/device-install/operations/webusb.ts +0 -110
  95. package/src/core/device-install/storage/browser-storage.test.ts +0 -65
  96. package/src/core/device-install/storage/browser-storage.ts +0 -325
  97. package/src/core/device-install/storage/index.ts +0 -2
  98. package/src/core/device-install/storage/secret-store.ts +0 -332
  99. package/src/core/device-install/types.ts +0 -69
  100. package/src/core/errors.ts +0 -3
  101. package/src/core/play-publish/google.ts +0 -113
  102. package/src/core/play-publish/publish.test.ts +0 -68
  103. package/src/core/play-publish/publish.ts +0 -89
  104. package/src/device-build/index.ts +0 -42
  105. package/src/device-build/react.ts +0 -130
  106. package/src/device-build/signing.ts +0 -94
  107. package/src/device-install/README.md +0 -423
  108. package/src/device-install/demo/demo.css +0 -493
  109. package/src/device-install/demo/demo.tsx +0 -1061
  110. package/src/device-install/demo/index.html +0 -12
  111. package/src/device-install/index.ts +0 -50
  112. package/src/device-install/react.ts +0 -195
  113. package/src/play-publish/README.md +0 -66
  114. package/src/play-publish/index.ts +0 -12
  115. package/src/play-publish/react.ts +0 -208
@@ -1,677 +0,0 @@
1
- import { p as g, a as d } from "../client-CFDB4mX5.mjs";
2
- import { A as Ne, f as Oe, o as Fe, b as ze, c as Ve, d as He, e as _e, s as Ge, t as Me, g as We } from "../client-CFDB4mX5.mjs";
3
- import { f as l } from "../index-YDu8K9a4.mjs";
4
- import { A as Qe } from "../gsa-srp-Bme3JLEi.mjs";
5
- import { l as C, f as q, a as B, s as R, b as T, d as E, c as K, e as $, h as k, i as U, r as L, j as x, k as N, m as O, n as F, o as z, q as V, t as H } from "../provisioning-CDPvxd1h.mjs";
6
- const _ = {
7
- name: "RSASSA-PKCS1-v1_5",
8
- modulusLength: 2048,
9
- publicExponent: new Uint8Array([1, 0, 1]),
10
- hash: "SHA-256"
11
- };
12
- async function de(e) {
13
- if (!crypto.subtle)
14
- throw new Error("WebCrypto is not available in this browser.");
15
- const t = await crypto.subtle.generateKey(_, !0, ["sign", "verify"]), r = new Uint8Array(await crypto.subtle.exportKey("spki", t.publicKey)), n = f(
16
- j(0),
17
- G(e),
18
- r,
19
- W(0, new Uint8Array())
20
- ), i = new Uint8Array(
21
- await crypto.subtle.sign(
22
- "RSASSA-PKCS1-v1_5",
23
- t.privateKey,
24
- ie(n)
25
- )
26
- ), o = f(
27
- n,
28
- f(D("1.2.840.113549.1.1.11"), Q()),
29
- Y(i)
30
- ), a = new Uint8Array(await crypto.subtle.exportKey("pkcs8", t.privateKey));
31
- return {
32
- privateKey: t.privateKey,
33
- privateKeyPKCS8Base64: m(a),
34
- publicKeySPKIBase64: m(r),
35
- csrPEM: ee("CERTIFICATE REQUEST", o),
36
- csrBase64: m(o)
37
- };
38
- }
39
- function fe(e) {
40
- if (!e.certificateBase64 && !e.certificatePEM)
41
- throw new Error("certificateBase64 or certificatePEM is required.");
42
- const t = l.pki.privateKeyFromPem(te("PRIVATE KEY", e.privateKeyPKCS8Base64)), r = e.certificatePEM ? l.pki.certificateFromPem(e.certificatePEM) : l.pki.certificateFromAsn1(
43
- l.asn1.fromDer(l.util.createBuffer(ne(e.certificateBase64)))
44
- ), n = l.pkcs12.toPkcs12Asn1(t, [r], e.password, {
45
- algorithm: "3des",
46
- friendlyName: e.friendlyName
47
- }), i = l.asn1.toDer(n).getBytes();
48
- return re(i);
49
- }
50
- function G(e) {
51
- const t = [I("2.5.4.3", J(e.commonName))];
52
- return e.emailAddress && t.push(I("1.2.840.113549.1.9.1", X(e.emailAddress))), f(...t);
53
- }
54
- function I(e, t) {
55
- return M(f(D(e), t));
56
- }
57
- function f(...e) {
58
- return c(48, w(...e));
59
- }
60
- function M(...e) {
61
- return c(49, w(...e));
62
- }
63
- function W(e, t) {
64
- return c(160 + e, t);
65
- }
66
- function j(e) {
67
- return c(2, new Uint8Array([e]));
68
- }
69
- function Q() {
70
- return new Uint8Array([5, 0]);
71
- }
72
- function J(e) {
73
- return c(12, new TextEncoder().encode(e));
74
- }
75
- function X(e) {
76
- return c(22, new TextEncoder().encode(e));
77
- }
78
- function Y(e) {
79
- return c(3, w(new Uint8Array([0]), e));
80
- }
81
- function D(e) {
82
- const t = e.split(".").map((n) => parseInt(n, 10));
83
- if (t.length < 2 || t.some((n) => !Number.isFinite(n)))
84
- throw new Error(`Invalid OID: ${e}`);
85
- const r = [t[0] * 40 + t[1]];
86
- for (const n of t.slice(2)) {
87
- const i = [n & 127];
88
- let o = n >> 7;
89
- for (; o > 0; )
90
- i.unshift(o & 127 | 128), o >>= 7;
91
- r.push(...i);
92
- }
93
- return c(6, new Uint8Array(r));
94
- }
95
- function c(e, t) {
96
- return w(new Uint8Array([e]), Z(t.byteLength), t);
97
- }
98
- function Z(e) {
99
- if (e < 128)
100
- return new Uint8Array([e]);
101
- const t = [];
102
- let r = e;
103
- for (; r > 0; )
104
- t.unshift(r & 255), r >>= 8;
105
- return new Uint8Array([128 | t.length, ...t]);
106
- }
107
- function w(...e) {
108
- const t = e.reduce((i, o) => i + o.byteLength, 0), r = new Uint8Array(t);
109
- let n = 0;
110
- for (const i of e)
111
- r.set(i, n), n += i.byteLength;
112
- return r;
113
- }
114
- function ee(e, t) {
115
- const n = m(t).match(/.{1,64}/g) ?? [];
116
- return `-----BEGIN ${e}-----
117
- ${n.join(`
118
- `)}
119
- -----END ${e}-----
120
- `;
121
- }
122
- function te(e, t) {
123
- const r = t.match(/.{1,64}/g) ?? [];
124
- return `-----BEGIN ${e}-----
125
- ${r.join(`
126
- `)}
127
- -----END ${e}-----
128
- `;
129
- }
130
- function m(e) {
131
- let t = "";
132
- for (const r of e)
133
- t += String.fromCharCode(r);
134
- return btoa(t);
135
- }
136
- function re(e) {
137
- return btoa(e);
138
- }
139
- function ne(e) {
140
- return atob(e);
141
- }
142
- function ie(e) {
143
- const t = new Uint8Array(e.byteLength);
144
- return t.set(e), t.buffer;
145
- }
146
- async function s({
147
- relay: e,
148
- request: t,
149
- label: r = "Apple Developer Portal request",
150
- validatePortalResponse: n = !0,
151
- mapBody: i
152
- }) {
153
- const o = await g(e, t);
154
- return n && se(o.body, r), i ? i(o.body, o) : o;
155
- }
156
- async function ye(e) {
157
- return s({
158
- ...e,
159
- request: C(),
160
- label: "Apple Developer team list",
161
- mapBody: (t) => pe([
162
- ...t?.teams ?? [],
163
- ...t?.availableProviders ?? [],
164
- ...t?.provider ? [t.provider] : []
165
- ])
166
- });
167
- }
168
- async function Ae({
169
- certificateKind: e = "development",
170
- teamId: t = "",
171
- ...r
172
- }) {
173
- return s({
174
- ...r,
175
- request: e === "distribution" ? q(t) : B(t),
176
- label: "Apple Developer certificate list",
177
- mapBody: (n) => n?.certRequests ?? []
178
- });
179
- }
180
- async function me({
181
- certificateKind: e = "development",
182
- teamId: t = "",
183
- csrPEM: r,
184
- ...n
185
- }) {
186
- return s({
187
- ...n,
188
- request: e === "distribution" ? R({ csrPEM: r, teamID: t }) : T({ csrPEM: r, teamID: t }),
189
- label: e === "distribution" ? "Apple Distribution certificate creation" : "Apple Development certificate creation",
190
- mapBody: (i) => i?.certRequest
191
- });
192
- }
193
- async function ve({
194
- certificateKind: e = "development",
195
- certificateId: t,
196
- teamId: r = "",
197
- ...n
198
- }) {
199
- return s({
200
- ...n,
201
- request: e === "distribution" ? E(t, r) : K(t, r),
202
- label: "Apple certificate download",
203
- validatePortalResponse: !1,
204
- mapBody: (i, o) => o
205
- });
206
- }
207
- async function we({
208
- certificateKind: e = "development",
209
- certificateId: t,
210
- teamId: r = "",
211
- ...n
212
- }) {
213
- return s({
214
- ...n,
215
- request: {
216
- method: "POST",
217
- path: "/account/ios/certificate/revokeCertificate.action",
218
- payload: {
219
- teamId: r,
220
- certificateId: t,
221
- type: e === "distribution" ? "WXV89964HE" : "83Q87W3TGH"
222
- }
223
- },
224
- label: "Apple certificate deletion",
225
- mapBody: (i) => i
226
- });
227
- }
228
- async function be({
229
- teamId: e = "",
230
- search: t = "",
231
- ...r
232
- }) {
233
- const n = t.trim().toLowerCase();
234
- return s({
235
- ...r,
236
- request: $({ bundleID: t, teamID: e }),
237
- label: "Apple bundle ID list",
238
- // Apple's listAppIds.action returns the full paginated list and does not
239
- // honor a server-side search filter, so apply the `search` filter here.
240
- mapBody: (i) => {
241
- const o = i?.appIds ?? [];
242
- return n ? o.filter(
243
- (a) => [a.identifier, a.bundleId, a.name].some(
244
- (p) => typeof p == "string" && p.toLowerCase().includes(n)
245
- )
246
- ) : o;
247
- }
248
- });
249
- }
250
- async function Ie({
251
- teamId: e = "",
252
- bundleId: t,
253
- name: r,
254
- ...n
255
- }) {
256
- return s({
257
- ...n,
258
- request: k({ bundleID: t, teamID: e, name: r }),
259
- label: "Apple bundle ID creation",
260
- mapBody: (i) => i?.appId
261
- });
262
- }
263
- async function Se({
264
- teamId: e = "",
265
- appIdId: t,
266
- bundleId: r,
267
- name: n,
268
- ...i
269
- }) {
270
- return s({
271
- ...i,
272
- request: {
273
- method: "POST",
274
- path: "/account/ios/identifiers/updateAppId.action",
275
- payload: {
276
- teamId: e,
277
- appIdId: t,
278
- ...r ? { identifier: r } : {},
279
- ...n ? { name: n } : {}
280
- }
281
- },
282
- label: "Apple bundle ID update",
283
- mapBody: (o) => o?.appId
284
- });
285
- }
286
- async function De({ teamId: e = "", appIdId: t, ...r }) {
287
- return s({
288
- ...r,
289
- request: {
290
- method: "POST",
291
- path: "/account/ios/identifiers/deleteAppId.action",
292
- payload: { teamId: e, appIdId: t }
293
- },
294
- label: "Apple bundle ID deletion",
295
- mapBody: (n) => n
296
- });
297
- }
298
- async function he({
299
- teamId: e = "",
300
- deviceUDID: t = "",
301
- ...r
302
- }) {
303
- const n = S(t);
304
- return s({
305
- ...r,
306
- request: U({ deviceUDID: t, teamID: e }),
307
- label: "Apple device list",
308
- // Apple's listDevices.action returns the full paginated list and does not
309
- // honor a server-side UDID filter, so apply the `deviceUDID` filter here.
310
- mapBody: (i) => {
311
- const o = i?.devices ?? [];
312
- return n ? o.filter((a) => S(a.deviceNumber) === n) : o;
313
- }
314
- });
315
- }
316
- function S(e) {
317
- return (e ?? "").replace(/-/g, "").replace(/[^a-fA-F0-9]/g, "").toUpperCase();
318
- }
319
- async function Pe({
320
- teamId: e = "",
321
- deviceUDID: t,
322
- name: r,
323
- ...n
324
- }) {
325
- return s({
326
- ...n,
327
- request: L({ deviceUDID: t, teamID: e, name: r }),
328
- label: "Apple device registration",
329
- mapBody: (i) => i?.device
330
- });
331
- }
332
- async function ge({
333
- teamId: e = "",
334
- deviceId: t,
335
- name: r,
336
- ...n
337
- }) {
338
- return s({
339
- ...n,
340
- request: {
341
- method: "POST",
342
- path: "/account/ios/device/updateDevice.action",
343
- payload: { teamId: e, deviceId: t, ...r ? { name: r } : {} }
344
- },
345
- label: "Apple device update",
346
- mapBody: (i) => i?.device
347
- });
348
- }
349
- async function Ce({ teamId: e = "", deviceId: t, ...r }) {
350
- return s({
351
- ...r,
352
- request: {
353
- method: "POST",
354
- path: "/account/ios/device/deleteDevice.action",
355
- payload: { teamId: e, deviceId: t }
356
- },
357
- label: "Apple device deletion",
358
- mapBody: (n) => n
359
- });
360
- }
361
- async function qe({
362
- profileKind: e = "development",
363
- teamId: t = "",
364
- bundleId: r = "",
365
- ...n
366
- }) {
367
- return s({
368
- ...n,
369
- request: e === "adhoc" ? x({ bundleID: r, teamID: t }) : e === "appstore" ? N({ bundleID: r, teamID: t }) : O({ bundleID: r, teamID: t }),
370
- label: "Apple provisioning profile list",
371
- mapBody: (i) => i?.provisioningProfiles ?? []
372
- });
373
- }
374
- async function Be({
375
- profileKind: e = "development",
376
- teamId: t = "",
377
- bundleId: r,
378
- appIdId: n,
379
- certificateIds: i,
380
- deviceIds: o = [],
381
- name: a,
382
- ...p
383
- }) {
384
- const [u] = i;
385
- if (!u)
386
- throw new Error("At least one certificate ID is required to create an Apple provisioning profile.");
387
- let A;
388
- if (e === "appstore") {
389
- if (!a)
390
- throw new Error("An explicit name is required to create an App Store provisioning profile.");
391
- A = z({
392
- teamID: t,
393
- appIDID: n,
394
- certificateID: u,
395
- name: a
396
- });
397
- } else e === "adhoc" ? A = V({
398
- bundleID: r,
399
- teamID: t,
400
- appIDID: n,
401
- certificateID: u,
402
- deviceIDs: o,
403
- name: a
404
- }) : A = H({
405
- bundleID: r,
406
- teamID: t,
407
- appIDID: n,
408
- certificateID: u,
409
- deviceIDs: o,
410
- name: a
411
- });
412
- return s({
413
- ...p,
414
- request: A,
415
- label: "Apple provisioning profile creation",
416
- mapBody: (P) => P?.provisioningProfile
417
- });
418
- }
419
- async function Re({
420
- teamId: e = "",
421
- profileId: t,
422
- ...r
423
- }) {
424
- return s({
425
- ...r,
426
- request: F(t, e),
427
- label: "Apple provisioning profile download",
428
- validatePortalResponse: !1,
429
- mapBody: (n, i) => i
430
- });
431
- }
432
- async function Te({ teamId: e = "", profileId: t, ...r }) {
433
- return s({
434
- ...r,
435
- request: {
436
- method: "POST",
437
- path: "/account/ios/profile/deleteProvisioningProfile.action",
438
- payload: { teamId: e, provisioningProfileId: t }
439
- },
440
- label: "Apple provisioning profile deletion",
441
- mapBody: (n) => n
442
- });
443
- }
444
- async function Ee({
445
- relay: e,
446
- providerId: t
447
- }) {
448
- const r = Number(t), n = await d(e, {
449
- method: "POST",
450
- path: "/olympus/v1/session",
451
- payload: {
452
- provider: { providerId: Number.isNaN(r) ? t : r }
453
- }
454
- });
455
- if (n.status < 200 || n.status >= 300)
456
- throw new Error(
457
- `App Store Connect provider switch failed: HTTP ${n.status} ${n.rawBody ?? ""}`.trim()
458
- );
459
- return n;
460
- }
461
- async function Ke({ relay: e }) {
462
- const t = await d(e, {
463
- path: "/iris/v1/apiKeys"
464
- });
465
- return y(t, "App Store Connect API key list"), h(t.body?.data);
466
- }
467
- async function $e({
468
- relay: e,
469
- nickname: t,
470
- roles: r = ["APP_MANAGER"],
471
- allAppsVisible: n = !0
472
- }) {
473
- if (!t)
474
- throw new Error("A nickname is required to create an App Store Connect API key.");
475
- const i = await d(e, {
476
- method: "POST",
477
- path: "/iris/v1/apiKeys",
478
- payload: {
479
- data: {
480
- type: "apiKeys",
481
- attributes: {
482
- nickname: t,
483
- allAppsVisible: n,
484
- keyType: "PUBLIC_API",
485
- roles: r
486
- }
487
- }
488
- }
489
- });
490
- y(i, "App Store Connect API key creation");
491
- const o = b(i.body?.data);
492
- if (!o?.id)
493
- throw new Error("App Store Connect API key creation did not return a key ID.");
494
- return o;
495
- }
496
- async function ke({
497
- relay: e,
498
- keyId: t
499
- }) {
500
- const r = await d(e, {
501
- path: `/iris/v1/apiKeys/${encodeURIComponent(t)}`,
502
- query: { "fields[apiKeys]": "privateKey", include: "provider" }
503
- });
504
- y(r, "App Store Connect API key download");
505
- const n = b(r.body?.data), i = v(n?.attributes, "privateKey");
506
- if (!i)
507
- throw new Error(
508
- `App Store Connect API key ${t} returned no private key. Apple serves it only once; revoke the key and create a new one.`
509
- );
510
- const o = (r.body?.included ?? []).find((p) => p.type === "providers"), a = v(o?.attributes, "publicProviderId") ?? v(n?.attributes, "issuerId") ?? o?.id;
511
- return { privateKeyPem: i, issuerId: a };
512
- }
513
- async function oe({ relay: e, bundleId: t }) {
514
- const r = await d(e, {
515
- path: "/iris/v1/apps",
516
- query: { "filter[bundleId]": t }
517
- });
518
- return y(r, "App Store Connect app lookup"), h(r.body?.data).find(
519
- (n) => v(n.attributes, "bundleId") === t
520
- );
521
- }
522
- async function ae({
523
- relay: e,
524
- bundleId: t,
525
- name: r,
526
- sku: n,
527
- primaryLocale: i = "en-US",
528
- versionString: o = "1.0"
529
- }) {
530
- if (!r)
531
- throw new Error("An app name is required to create an App Store Connect app record.");
532
- const a = "IOS", p = await d(e, {
533
- method: "POST",
534
- path: "/iris/v1/apps",
535
- payload: {
536
- data: {
537
- type: "apps",
538
- attributes: {
539
- sku: n || t,
540
- primaryLocale: i,
541
- bundleId: t
542
- },
543
- relationships: {
544
- appStoreVersions: {
545
- data: [{ type: "appStoreVersions", id: `\${store-version-${a}}` }]
546
- },
547
- appInfos: {
548
- data: [{ type: "appInfos", id: "${new-appInfo-id}" }]
549
- }
550
- }
551
- },
552
- included: [
553
- {
554
- type: "appInfos",
555
- id: "${new-appInfo-id}",
556
- relationships: {
557
- appInfoLocalizations: {
558
- data: [{ type: "appInfoLocalizations", id: "${new-appInfoLocalization-id}" }]
559
- }
560
- }
561
- },
562
- {
563
- type: "appInfoLocalizations",
564
- id: "${new-appInfoLocalization-id}",
565
- attributes: { locale: i, name: r }
566
- },
567
- {
568
- type: "appStoreVersions",
569
- id: `\${store-version-${a}}`,
570
- attributes: { platform: a, versionString: o },
571
- relationships: {
572
- appStoreVersionLocalizations: {
573
- data: [
574
- { type: "appStoreVersionLocalizations", id: `\${new-${a}VersionLocalization-id}` }
575
- ]
576
- }
577
- }
578
- },
579
- {
580
- type: "appStoreVersionLocalizations",
581
- id: `\${new-${a}VersionLocalization-id}`,
582
- attributes: { locale: i }
583
- }
584
- ]
585
- }
586
- });
587
- y(p, "App Store Connect app creation");
588
- const u = b(p.body?.data);
589
- if (!u?.id)
590
- throw new Error("App Store Connect app creation did not return an app ID.");
591
- return u;
592
- }
593
- async function Ue(e) {
594
- const t = await oe({ relay: e.relay, bundleId: e.bundleId });
595
- return t ? { app: t, created: !1 } : { app: await ae(e), created: !0 };
596
- }
597
- function y(e, t) {
598
- const r = e.body?.errors;
599
- if (r && r.length > 0) {
600
- const n = r.map((i) => i.detail ?? i.title ?? i.code ?? i.status).filter(Boolean).join("; ");
601
- throw new Error(`${t} failed: ${n || `HTTP ${e.status}`}`);
602
- }
603
- if (e.status < 200 || e.status >= 300)
604
- throw new Error(`${t} failed: HTTP ${e.status} ${e.rawBody ?? ""}`.trim());
605
- }
606
- function h(e) {
607
- return e ? Array.isArray(e) ? e : [e] : [];
608
- }
609
- function b(e) {
610
- if (e)
611
- return Array.isArray(e) ? e[0] : e;
612
- }
613
- function v(e, t) {
614
- const r = e?.[t];
615
- return typeof r == "string" && r !== "" ? r : void 0;
616
- }
617
- function se(e, t) {
618
- if (!e)
619
- throw new Error(`${t} returned an empty response.`);
620
- if (e.resultCode !== void 0 && e.resultCode !== 0)
621
- throw new Error(
622
- `${t} failed: ${e.userString ?? e.resultString ?? e.resultCode}`
623
- );
624
- }
625
- function pe(e) {
626
- const t = /* @__PURE__ */ new Set(), r = [];
627
- for (const n of e) {
628
- const i = String(
629
- n.teamId ?? n.providerId ?? n.publicProviderId ?? n.name ?? JSON.stringify(n)
630
- );
631
- t.has(i) || (t.add(i), r.push(n));
632
- }
633
- return r;
634
- }
635
- export {
636
- Qe as AppleGsaSrpClient,
637
- Ne as AppleRelayWebSocketClient,
638
- y as assertAppStoreConnectResponseOK,
639
- se as assertAppleDeveloperPortalResponseOK,
640
- $e as createAppStoreConnectApiKey,
641
- ae as createAppStoreConnectApp,
642
- Ie as createAppleBundleID,
643
- me as createAppleCertificate,
644
- Be as createAppleProfile,
645
- De as deleteAppleBundleID,
646
- we as deleteAppleCertificate,
647
- Ce as deleteAppleDevice,
648
- Te as deleteAppleProfile,
649
- ke as downloadAppStoreConnectApiKeyPrivateKey,
650
- ve as downloadAppleCertificate,
651
- Re as downloadAppleProfile,
652
- Ue as ensureAppStoreConnectApp,
653
- fe as exportAppleCertificateP12,
654
- Oe as fetchAppleAccountSession,
655
- oe as findAppStoreConnectApp,
656
- de as generateAppleSigningKeyAndCSR,
657
- Ke as listAppStoreConnectApiKeys,
658
- be as listAppleBundleIDs,
659
- Ae as listAppleCertificates,
660
- he as listAppleDevices,
661
- qe as listAppleProfiles,
662
- ye as listAppleTeams,
663
- Fe as openAppleRelayWebSocket,
664
- d as proxyAppStoreConnectRequest,
665
- ze as proxyPhoneTwoFactorCode,
666
- Ve as proxySrpComplete,
667
- He as proxySrpInit,
668
- _e as proxyTwoFactorCode,
669
- Pe as registerAppleDevice,
670
- s as requestAppleProvisioning,
671
- Ge as startBrowserOwnedAppleIDLogin,
672
- Ee as switchAppStoreConnectProvider,
673
- Me as triggerPhoneTwoFactor,
674
- We as triggerTrustedDeviceTwoFactor,
675
- Se as updateAppleBundleID,
676
- ge as updateAppleDevice
677
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),y=require("../client-C9z_sgOf.js");require("../index-ChhtuQ7e.js");require("../gsa-srp-CCIfUz7Y.js");const w=require("../errors-BSkqS7U-.js");function m({registryApiUrl:i,token:u,organizationId:l}){const[g,o]=t.useState("idle"),[h,a]=t.useState(),[v,d]=t.useState(),[f,p]=t.useState(),[S,n]=t.useState(),r=t.useRef(void 0),b=t.useCallback(async()=>{await r.current?.close().catch(()=>{}),r.current=void 0,a(void 0),d(void 0),p(void 0),n(void 0),o("idle")},[]);t.useEffect(()=>()=>{r.current?.close(),r.current=void 0},[]);const C=t.useCallback(async({accountName:s,password:c})=>{o("authenticating"),n(void 0),await r.current?.close().catch(()=>{});try{const e=await y.startBrowserOwnedAppleIDLogin({registryApiUrl:i,token:u,organizationId:l,accountName:s,password:c});return r.current=e,a(e),d(e.completeResponse),p(e.twoFactorChallengeResponse),o(e.requiresTwoFactor?"two-factor-required":"authenticated"),e}catch(e){a(void 0),r.current=void 0,n(w.errorMessage(e)),o("error");return}},[i,l,u]),R=t.useCallback(async s=>{const c=r.current;if(!c)throw new Error("Start Apple ID login before submitting a two-factor code.");o("authenticating"),n(void 0);try{const e=await c.finishTwoFactor(s);return o("authenticated"),e}catch(e){n(w.errorMessage(e)),o("error");return}},[]),q=t.useCallback(async()=>{const s=r.current;if(!s)throw new Error("Start Apple ID login before finalizing the Apple session.");return s.finalize()},[]);return{status:g,session:h,completeResponse:v,twoFactorChallengeResponse:f,error:S,startLogin:C,submitTwoFactorCode:R,finalize:q,close:b}}exports.useAppleIDLogin=m;
@@ -1,15 +0,0 @@
1
- import { AppleIDLoginInput, AppleIDLoginResult, AppleRelayResponse } from './index';
2
- export type UseAppleIDLoginOptions = Pick<AppleIDLoginInput, 'registryApiUrl' | 'token' | 'organizationId'>;
3
- export type AppleIDLoginStatus = 'idle' | 'authenticating' | 'two-factor-required' | 'authenticated' | 'error';
4
- export type UseAppleIDLoginResult = {
5
- status: AppleIDLoginStatus;
6
- session?: AppleIDLoginResult;
7
- completeResponse?: AppleRelayResponse;
8
- twoFactorChallengeResponse?: AppleRelayResponse;
9
- error?: string;
10
- startLogin: (input: Pick<AppleIDLoginInput, 'accountName' | 'password'>) => Promise<AppleIDLoginResult | undefined>;
11
- submitTwoFactorCode: (code: string) => Promise<AppleRelayResponse | undefined>;
12
- finalize: () => Promise<AppleRelayResponse | undefined>;
13
- close: () => Promise<void>;
14
- };
15
- export declare function useAppleIDLogin({ registryApiUrl, token, organizationId, }: UseAppleIDLoginOptions): UseAppleIDLoginResult;