sanity-plugin-dashboard-widget-vercel 3.1.1 → 3.1.3

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/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react$1 = require("@xstate/react"), reactQuery = require("@tanstack/react-query"), xstate = require("xstate"), react = require("react"), useDeepCompareEffect = require("use-deep-compare-effect"), hash = require("object-hash"), fetch = require("unfetch"), ReactTimeAgo = require("react-time-ago"), yup$1 = require("@hookform/resolvers/yup"), uuid = require("@sanity/uuid"), reactHookForm = require("react-hook-form"), yup = require("yup"), styledComponents = require("styled-components"), sanity = require("sanity"), TimeAgo = require("javascript-time-ago"), en = require("javascript-time-ago/locale/en");
3
+ var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react$1 = require("@xstate/react"), reactQuery = require("@tanstack/react-query"), xstate = require("xstate"), react = require("react"), useDeepCompareEffect = require("use-deep-compare-effect"), hash = require("object-hash"), ReactTimeAgo = require("react-time-ago"), yup$1 = require("@hookform/resolvers/yup"), reactHookForm = require("react-hook-form"), yup = require("yup"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), sanity = require("sanity"), TimeAgo = require("javascript-time-ago"), en = require("javascript-time-ago/locale/en");
4
4
  function _interopDefaultCompat(e) {
5
5
  return e && typeof e == "object" && "default" in e ? e : { default: e };
6
6
  }
@@ -19,89 +19,111 @@ function _interopNamespaceCompat(e) {
19
19
  }
20
20
  }), n.default = e, Object.freeze(n);
21
21
  }
22
- var useDeepCompareEffect__default = /* @__PURE__ */ _interopDefaultCompat(useDeepCompareEffect), hash__default = /* @__PURE__ */ _interopDefaultCompat(hash), fetch__default = /* @__PURE__ */ _interopDefaultCompat(fetch), ReactTimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(ReactTimeAgo), yup__namespace = /* @__PURE__ */ _interopNamespaceCompat(yup), TimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(TimeAgo), en__default = /* @__PURE__ */ _interopDefaultCompat(en);
22
+ var useDeepCompareEffect__default = /* @__PURE__ */ _interopDefaultCompat(useDeepCompareEffect), hash__default = /* @__PURE__ */ _interopDefaultCompat(hash), ReactTimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(ReactTimeAgo), yup__namespace = /* @__PURE__ */ _interopNamespaceCompat(yup), TimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(TimeAgo), en__default = /* @__PURE__ */ _interopDefaultCompat(en);
23
23
  const API_ENDPOINT_DEPLOYMENTS = "https://api.vercel.com/v5/now/deployments", API_ENDPOINT_ALIASES = "https://api.vercel.com/v3/now/aliases", API_VERSION = "1", DEPLOYMENT_TARGET_DOCUMENT_TYPE = "vercel.deploymentTarget", VERCEL_STATUS_COLORS = {
24
24
  BUILDING: "#f5a623",
25
25
  CANCELED: "#ff0000",
26
26
  ERROR: "#ff0000",
27
27
  READY: "#50e3c2",
28
28
  QUEUED: "#333"
29
- }, WIDGET_NAME = "Vercel (dashboard)", Z_INDEX_DIALOG = 600001, Z_INDEX_TOAST_PROVIDER = 600002, StateDebug = (props) => null, sortByTargetName = (items) => items.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0), deploymentTargetListMachine = () => xstate.Machine(
30
- {
31
- context: {
32
- message: "",
33
- results: []
29
+ }, WIDGET_NAME = "Vercel (dashboard)", Z_INDEX_DIALOG = 600001, Z_INDEX_TOAST_PROVIDER = 600002, StateDebug = (props) => null, sortByTargetName = (items) => items.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0), deploymentTargetListMachine = xstate.setup({
30
+ types: {},
31
+ actions: {
32
+ targetCreate: xstate.assign({
33
+ results: ({ context, event }) => (xstate.assertEvent(event, "CREATE"), sortByTargetName([...context.results, event.deploymentTarget]))
34
+ }),
35
+ targetDelete: xstate.assign({
36
+ results: ({ context, event }) => (xstate.assertEvent(event, "DELETE"), context.results.filter((target) => target._id !== event.id))
37
+ }),
38
+ targetUpdate: xstate.assign({
39
+ results: ({ context, event }) => {
40
+ xstate.assertEvent(event, "UPDATE");
41
+ const { deploymentTarget } = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id), updatedResults = Object.assign([], context.results, {
42
+ [index]: deploymentTarget
43
+ });
44
+ return sortByTargetName(updatedResults);
45
+ }
46
+ })
47
+ },
48
+ guards: {
49
+ hasData: ({ context }) => context?.results?.length > 0,
50
+ hasNoData: ({ context }) => context?.results?.length === 0
51
+ },
52
+ actors: {
53
+ "fetch data": xstate.fromPromise(
54
+ ({ input, signal }) => input.client.fetch(
55
+ "*[_type == $type] | order(name asc)",
56
+ {
57
+ type: DEPLOYMENT_TARGET_DOCUMENT_TYPE
58
+ },
59
+ { signal }
60
+ ).catch((error) => {
61
+ if (error instanceof Error && error.name === "AbortError")
62
+ return [];
63
+ throw console.error("Failed to fetch deployment targets", error), error;
64
+ })
65
+ )
66
+ }
67
+ }).createMachine({
68
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgAcx8ICoBiCAe0JIIDcGBrMEgMzABccAEXT90AbQAMAXUSgyDWLn64mckAA9EAZkkBOEgHYAjAA5DAFgBsFgEwnJAVkMAaEAE9Ep4yUeT-klbGesbaoYaGAL6RbmhYeISkFFQ0tGAATukM6eQANqI82ai8AsKiEjLqCkoqakiaOvpGZpY29sZOrh6IxpYkFo5h2oaOpnqOxraSFtGxGDgExCTpYOgQ7rQAwgBKAKIAggAqu1Ky9dXKqvjqWggWHSS9eoaS9ibao6aObp4IVh8kL56OzGII2PT-WYgOILRLLVbrWhCXYAGV2x1OVUUlzqoFu90kRm8tlM2gsL1eJJ+iEGBj0gVsFm0YWmVkctihMISSxWaw2AFUAApCI4nSrnbG1a71fGSUz9WzBezTFWvb7dO5MkjjMITZykwxjTnzbmkXnrEgAV3wHHwDAA7vhaJiJTUrjces9fFZGc9TLYrGqA9SEM9CcT7sznH5HHpjfFFmaEe4rTa7Y7ncYzvJJe6ZZ7DN7fYaA0GrCHvD4xs4S+yPnGYtCTYn4XySPblNgRGJneKc27cQ0EI4BiQ2T77noAzXyxrTIESGFGd4rP9DONTPHYTzk+3OwxLfxu+he9mQBcpR7h6Px4ylWyIrPfl9bIvJhZJIYA-7zFZoo27QgOB1C5RMsQHaU8UQABaYIQ2gv9G1AuFkmofAoHAnFIKHOwQz0bRtUMcd-j8WwpnuLdTVbdZMMvfMEFsPQQxMeViQmZkLC+f0oiQ5s4XNFNrVtB1sIvPMoIQCIK1BIsmXXWxtFJcZKJbAS934Ltylo8ShysfDHl9PRxjlekrC6Z9BhIBk5MkXpzFBFT+N3DsNIPI8tNdLCr20L0Wmscw5V0e5pMJYwBiI8kwrDRC5gTOEeHQXBckgbTB1uZwQw6RwrEBd9bEcQZYzsRDoiAA */
69
+ context: ({ input }) => ({
70
+ client: input.client,
71
+ results: []
72
+ }),
73
+ initial: "pending",
74
+ states: {
75
+ pending: {
76
+ invoke: {
77
+ src: "fetch data",
78
+ id: "fetchData",
79
+ input: ({ context }) => ({ client: context.client }),
80
+ onDone: {
81
+ actions: xstate.assign({ results: ({ event }) => event.output }),
82
+ target: "ready"
83
+ },
84
+ onError: {
85
+ target: "failed"
86
+ }
87
+ }
34
88
  },
35
- initial: "pending",
36
- states: {
37
- pending: {
38
- invoke: {
39
- src: "fetchDataService",
40
- onDone: { actions: ["setResults"], target: "ready" },
41
- onError: { actions: ["setMessage"], target: "failed" }
89
+ ready: {
90
+ initial: "unknown",
91
+ on: {
92
+ CREATE: {
93
+ actions: "targetCreate"
94
+ },
95
+ DELETE: {
96
+ actions: "targetDelete"
97
+ },
98
+ UPDATE: {
99
+ actions: "targetUpdate"
42
100
  }
43
101
  },
44
- ready: {
45
- initial: "unknown",
46
- on: {
47
- CREATE: { actions: ["targetCreate"] },
48
- DELETE: { actions: ["targetDelete"] },
49
- UPDATE: { actions: ["targetUpdate"] }
102
+ states: {
103
+ unknown: {
104
+ always: [
105
+ { target: "withData", guard: "hasData" },
106
+ { target: "withoutData", guard: "hasNoData" }
107
+ ]
50
108
  },
51
- states: {
52
- unknown: {
53
- always: [
54
- { cond: "hasData", target: "withData" },
55
- { cond: "hasNoData", target: "withoutData" }
56
- ]
57
- },
58
- withData: {
59
- always: [{ cond: "hasNoData", target: "withoutData" }]
60
- },
61
- withoutData: {
62
- always: [{ cond: "hasData", target: "withData" }]
63
- }
109
+ withData: {
110
+ always: [{ target: "withoutData", guard: "hasNoData" }]
111
+ },
112
+ withoutData: {
113
+ always: [{ target: "withData", guard: "hasData" }]
64
114
  }
65
- },
66
- failed: {
67
- type: "final"
68
115
  }
69
- }
70
- },
71
- {
72
- actions: {
73
- setMessage: xstate.assign((_context, event) => ({
74
- message: event.data.details.description
75
- })),
76
- setResults: xstate.assign((_context, event) => ({
77
- results: event.data
78
- })),
79
- targetCreate: xstate.assign((context, event) => ({
80
- results: sortByTargetName([...context.results, event.deploymentTarget])
81
- })),
82
- targetDelete: xstate.assign((context, event) => ({
83
- results: context.results.filter((target) => target._id !== event.id)
84
- })),
85
- targetUpdate: xstate.assign((context, event) => {
86
- const { deploymentTarget } = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id), updatedResults = Object.assign([], context.results, {
87
- [index]: event.deploymentTarget
88
- });
89
- return {
90
- results: sortByTargetName(updatedResults)
91
- };
92
- })
93
116
  },
94
- guards: {
95
- hasData: (context) => context?.results?.length > 0,
96
- hasNoData: (context) => context?.results?.length === 0
117
+ failed: {
118
+ type: "final"
97
119
  }
98
120
  }
99
- ), fetcher = (deploymentTarget) => async (url, extraParams) => {
121
+ }), fetcher = (deploymentTarget) => async (url, extraParams) => {
100
122
  const params = new URLSearchParams();
101
123
  if (params.set("projectId", deploymentTarget.projectId), deploymentTarget.teamId && params.set("teamId", deploymentTarget.teamId), extraParams)
102
124
  for (const [k, v] of extraParams.entries())
103
125
  params.append(k, v);
104
- const response = await fetch__default.default(`${url}?${params.toString()}`, {
126
+ const response = await fetch(`${url}?${params.toString()}`, {
105
127
  headers: {
106
128
  Authorization: `Bearer ${deploymentTarget.token}`
107
129
  }
@@ -163,28 +185,43 @@ const API_ENDPOINT_DEPLOYMENTS = "https://api.vercel.com/v5/now/deployments", AP
163
185
  isSuccess: aliasesIsSuccess && deploymentsIsSuccess,
164
186
  refetch
165
187
  };
166
- }, refreshMachine = xstate.Machine({
188
+ }, refreshMachine = xstate.setup({
189
+ types: {
190
+ events: {}
191
+ }
192
+ }).createMachine({
193
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAJQFEAxBgZQAkBtABgF1FQADgHtYuAC64h+fiAAeiAIwAmAGwkuGrkoAsAZhVKlAVm0KAHABoQAT0QBOJSRN27XFXaMmz2twF9fVmhYeISkAE5gAGYRsCFQ1PS0tADytNx8SCDCohJSMvIIPnYkxhpKXGZ22kY6xla2CAq6CiQudgDsRnYqKroVfe3+gRg4BMQkEdFwcXRMrGz0ACLpMtniktKZBUUlRmUVVTXadTaISrqObUY97QodvWa6QyBBo6ETUTHYkLPM9OwrTJrXKbUDbJTFLjtMzmWraOx3doqeqKMyOeHdXp3BTHXTVZ6vELjMBhMJCMK-eaAwQidZ5LaIY6Q6Gw47wxHI04IGEkDFma5NbTtY7ufwBED4IQQOAyQljIirWkg-KIAC0nIa6oJIyJpHIVEVOQ2KsKShRCDsunUGLcHi8PhU2uC8o+U1iBCghrpoLkZ2uTk0XCq7SRRl0Zg19itXHhIZ85lMEaUTre40mX0gXuVDIQnmKRhZKk6PmaVXN2PUaLsZhj2hUOJU-JTupIJLJYSzxpzeacheLXFL2nNrkrfW8SKFnhDYt8QA */
167
194
  initial: "idle",
168
195
  states: {
169
196
  idle: {
170
197
  on: {
171
- REFRESH: "refreshing"
198
+ REFRESH: {
199
+ target: "refreshing"
200
+ }
172
201
  }
173
202
  },
174
203
  refreshing: {
175
204
  on: {
176
- ERROR: "error",
177
- REFRESHED: "refreshed"
205
+ ERROR: {
206
+ target: "error"
207
+ },
208
+ REFRESHED: {
209
+ target: "refreshed"
210
+ }
178
211
  }
179
212
  },
180
213
  refreshed: {
181
214
  on: {
182
- REFRESH: "refreshing"
215
+ REFRESH: {
216
+ target: "refreshing"
217
+ }
183
218
  }
184
219
  },
185
220
  error: {
186
221
  on: {
187
- REFRESH: "refreshing"
222
+ REFRESH: {
223
+ target: "refreshing"
224
+ }
188
225
  }
189
226
  }
190
227
  }
@@ -305,88 +342,98 @@ const TableCell = (props) => {
305
342
  }
306
343
  ) }) })
307
344
  ] });
308
- }, deployMachine = (deployHook) => xstate.Machine(
309
- // Machine
310
- {
311
- id: "deploy",
312
- initial: "idle",
313
- context: {
314
- disabled: !1,
315
- feedback: void 0,
316
- label: void 0,
317
- error: void 0
318
- },
319
- states: {
320
- idle: {
321
- entry: xstate.assign({
322
- feedback: () => {
323
- },
324
- label: () => "Deploy"
325
- }),
326
- on: {
327
- DEPLOY: "deploying"
345
+ }, deployMachine = xstate.setup({
346
+ types: {
347
+ context: {},
348
+ events: {},
349
+ input: {}
350
+ },
351
+ actors: {
352
+ deploy: xstate.fromPromise(async ({ input, signal }) => {
353
+ try {
354
+ if (!input.deployHook)
355
+ throw new Error("No deployHook URL defined");
356
+ const res = await fetch(input.deployHook, { method: "POST", signal }), data = await res.json();
357
+ if (!res.ok)
358
+ throw (data?.error).message || res.statusText;
359
+ } catch (err) {
360
+ throw typeof err == "string" ? err : (console.error("Unable to deploy with error:", err), new Error("Please check the developer console for more information"));
361
+ }
362
+ })
363
+ }
364
+ }).createMachine({
365
+ /** @xstate-layout N4IgpgJg5mDOIC5QTABwDYHsCeA6AlhOmAMQAiAogAoAyA8gJoDaADALqKiqaz4Au+TADtOIAB6IATCxa4AnADYAHAHYArArUslAZjksNAGhDZEARk3yVmhSxVyHC-QBYAvq+MoMOXF6zZ8ISgSCGEwAiEAN0wAa3C-HwSAoIRA6IBjAEMBYVY2PNFuXhyRJHFENTMzXElFJSUzNTVnWx0FY1MESXVcZzUdM2k1OTUVBoV3TzR-X2mcQOCwACclzCXcDGyAMzWAW1nvPCSF1KjMLJK8grKi-kFS0AkESura5QamlpY2jvMB+QcDkqLH0wxYEw8ICSuFgAFd0uk4LByNR6Mx2IUeHdhKIns1ZN9BtYQVpRnJfl1JM55P1BnY1Ep9CpGpMoXM8MtVksUbRGNcuFiSriKs4CQNurYRgZ7BSGr1ASNupIzEo+kp3JChJgUPAyklMcV7sKEABadomRAmtQAhW2wE6VnQwjEA3Yh7lBDOSQUsxeqyaPoWYbWFSO9kHfwLV1CspPHSSHQ1ZyA1UKJzJlQ+iz+5oKewKWrfNyQ6FwhFI6NG2OINOSXDiypKAxtMyZi1dEE1Qk6L0FpTSUMl8OctaVnHVhC1+uDRvNhStin6XDaHQ9liSXTJiUa1xAA */
366
+ id: "deploy",
367
+ initial: "idle",
368
+ context: ({ input }) => ({
369
+ disabled: !1,
370
+ feedback: void 0,
371
+ label: void 0,
372
+ error: void 0,
373
+ deployHook: input.deployHook
374
+ }),
375
+ states: {
376
+ idle: {
377
+ entry: xstate.assign({
378
+ feedback: () => {
379
+ },
380
+ label: () => "Deploy"
381
+ }),
382
+ on: {
383
+ DEPLOY: {
384
+ target: "deploying"
328
385
  }
329
- },
330
- deploying: {
331
- entry: xstate.assign({
332
- disabled: () => !0,
333
- label: () => "Deploying"
334
- }),
335
- exit: xstate.assign({
336
- disabled: () => !1,
337
- label: () => "Deploy"
338
- }),
339
- invoke: {
340
- onDone: {
341
- target: "success"
342
- },
343
- onError: {
344
- target: "error",
345
- actions: xstate.assign({
346
- error: (_context, event) => event.data
347
- })
348
- },
349
- src: "deploy"
386
+ }
387
+ },
388
+ deploying: {
389
+ entry: xstate.assign({
390
+ disabled: () => !0,
391
+ label: () => "Deploying"
392
+ }),
393
+ exit: xstate.assign({
394
+ disabled: () => !1,
395
+ label: () => "Deploy"
396
+ }),
397
+ invoke: {
398
+ src: "deploy",
399
+ input: ({ context }) => ({ deployHook: context.deployHook }),
400
+ onDone: {
401
+ target: "success"
402
+ },
403
+ onError: {
404
+ target: "error",
405
+ actions: xstate.assign({
406
+ error: ({ event }) => "error" in event ? event.error : "Unknown error"
407
+ })
350
408
  }
351
- },
352
- success: {
353
- entry: [xstate.assign({ feedback: () => "Succesfully started!" })],
354
- exit: xstate.assign({
355
- feedback: () => {
356
- }
357
- }),
358
- on: {
359
- DEPLOY: "deploying"
409
+ }
410
+ },
411
+ success: {
412
+ entry: xstate.assign({
413
+ feedback: () => "Successfully started!"
414
+ }),
415
+ exit: xstate.assign({
416
+ feedback: () => {
360
417
  }
361
- },
362
- error: {
363
- on: {
364
- DEPLOY: "deploying"
418
+ }),
419
+ on: {
420
+ DEPLOY: {
421
+ target: "deploying"
365
422
  }
366
423
  }
367
- }
368
- },
369
- // Config
370
- {
371
- services: {
372
- deploy: () => new Promise(async (resolve, reject) => {
373
- try {
374
- if (!deployHook)
375
- return reject(new Error("No deployHook URL defined"));
376
- const res = await fetch__default.default(deployHook, { method: "POST" }), data = await res.json();
377
- if (!res.ok) {
378
- const errorMessage = (data?.error).message || res.statusText;
379
- return reject(errorMessage);
380
- }
381
- return resolve();
382
- } catch (err) {
383
- return console.error("Unable to deploy with error:", err), reject(new Error("Please check the developer console for more information"));
424
+ },
425
+ error: {
426
+ on: {
427
+ DEPLOY: {
428
+ target: "deploying"
384
429
  }
385
- })
430
+ }
386
431
  }
387
432
  }
388
- ), DeployButton = (props) => {
389
- const { deployHook, onDeploySuccess, targetName } = props, machine = react.useMemo(() => deployMachine(deployHook), [deployHook]), [deployState, deployStateTransition, deployStateInterpreter] = react$1.useMachine(machine), toast = ui.useToast(), isError = deployState.matches("error"), isSuccess = deployState.matches("success"), handleDeploy = () => {
433
+ }), DeployButton = (props) => {
434
+ const { deployHook, onDeploySuccess, targetName } = props, [deployState, deployStateTransition, deployStateInterpreter] = react$1.useMachine(deployMachine, {
435
+ input: { deployHook }
436
+ }), toast = ui.useToast(), isError = deployState.matches("error"), isSuccess = deployState.matches("success"), handleDeploy = () => {
390
437
  deployStateTransition({ type: "DEPLOY" });
391
438
  };
392
439
  return react.useEffect(() => {
@@ -404,9 +451,10 @@ const TableCell = (props) => {
404
451
  title: WIDGET_NAME
405
452
  });
406
453
  }, [isError, isSuccess, toast, targetName, deployState.context.error]), react.useEffect(() => {
407
- deployStateInterpreter.onTransition((state) => {
454
+ const subscription = deployStateInterpreter.subscribe((state) => {
408
455
  state.value === "success" && onDeploySuccess && onDeploySuccess();
409
456
  });
457
+ return () => subscription.unsubscribe();
410
458
  }, [deployStateInterpreter, onDeploySuccess]), /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, style: { position: "relative" }, children: [
411
459
  /* @__PURE__ */ jsxRuntime.jsx(StateDebug, { name: "Deploy", state: deployState }),
412
460
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -551,88 +599,100 @@ const TableCell = (props) => {
551
599
  }, DeploymentTargets = (props) => {
552
600
  const { items, onDialogEdit } = props;
553
601
  return /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 5, children: items?.map((item) => /* @__PURE__ */ jsxRuntime.jsx(DeploymentTarget, { item, onDialogEdit }, item._id)) });
554
- }, formMachine = xstate.Machine(
555
- {
556
- context: {
557
- formData: {},
558
- message: ""
559
- },
560
- initial: "idle",
561
- states: {
562
- idle: {
563
- on: {
564
- CREATE: {
565
- actions: ["createDocument"],
566
- target: "creating"
567
- },
568
- DELETE: {
569
- actions: ["deleteDocument"],
570
- target: "deleting"
571
- },
572
- UPDATE: {
573
- actions: ["updateDocument"],
574
- target: "updating"
575
- }
576
- }
577
- },
578
- creating: {
579
- invoke: {
580
- src: "createDocumentService",
581
- onDone: { target: "success" },
582
- onError: { actions: ["setMessage"], target: "error" }
583
- },
584
- on: {
585
- RESOLVE: "success",
586
- REJECT: "error"
587
- }
588
- },
589
- updating: {
590
- invoke: {
591
- src: "updateDocumentService",
592
- onDone: { target: "success" },
593
- onError: { actions: ["setMessage"], target: "error" }
602
+ }, formMachine = xstate.setup({
603
+ types: {},
604
+ actions: {
605
+ setId: xstate.assign({
606
+ id: ({ event }) => (xstate.assertEvent(event, ["UPDATE", "DELETE"]), event.id)
607
+ }),
608
+ setFormData: xstate.assign({
609
+ formData: ({ event }) => (xstate.assertEvent(event, ["CREATE", "UPDATE"]), event.formData)
610
+ }),
611
+ setMessage: xstate.assign({
612
+ message: ({ event }) => "data" in event && event.data && typeof event.data == "object" && "details" in event.data && event.data.details && typeof event.data.details == "object" && "description" in event.data.details ? event.data.details.description : "An error occurred"
613
+ }),
614
+ setDocument: xstate.assign({
615
+ document: ({ event }) => event.output
616
+ })
617
+ },
618
+ actors: {
619
+ "create document": xstate.fromPromise(
620
+ ({ input }) => input.client.create({
621
+ _id: `vercel.${uuid.uuid()}`,
622
+ _type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
623
+ ...input.formData
624
+ })
625
+ ),
626
+ "update document": xstate.fromPromise(
627
+ ({ input }) => input.client.patch(input.id).set(input.formData).commit()
628
+ ),
629
+ "delete document": xstate.fromPromise(({ input }) => input.client.delete(input.id))
630
+ }
631
+ }).createMachine({
632
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAIwBmAGwkuGjQFYALAE4AHACYdWgwYA0IAJ6IjKgOwkdXFUYVa9h-Ua5KAvv5WaFh4hKTkVNQAqgAKACJsnLwywqISUjLyCMpqmtr6xqbmVrYIBgokWvlGWkpaCgZeKoHBGDgExGSUNPGMADKM7Nx8SCBp4pLSY9m56vm6hiZmljaIOipqdXpcDk1aWiYqBlqtICEd4SSYAE5g6BL4UNQQUmBk+ABuQgDW77f3MRgeJCTAAV1QYHwYmYmDEQhuI1SIkmmRmiGOShIDiUOh0SiaCgUegcDj0pTsjhI5iMewUpPsTSMZwuYS6AIeBGeYBuNwRJAEFAeADMEahrncHsDQRCoTC4QikWMJhlpqBspjsbj8YTiaTyWsEKouNT6noiX5zUpiQEgud2mzSGCBBBOU8Xm8Pt8-iRna6gSDwZDobD4YiUsqUaqshiDFicXiCea9WSKeVKiSVIclEYlIY-BUWQ7Ok6XW7ubz+YKRWLfWWAzLg-Kw0rBFGpjGEJqEzrkyTU4b6ToSHojHos7VXEc6kXQiWSBAwFRHs9XoQvb93ovl9Kg3LQ4qI230h30V241rE7r+wayro1A4dO4VHotA5fPTTnbWfPt2AV9QPJ8jcApCmIoo3OKf4NnuIYKuGozHqiapyLG8bakmRI3mmpjxk0XAuEoXAHI+DgtGc+BCIu8BjD+4TIieaLqogAC0Khpmxs6XF0kRgAxyGdk+aYKLSVR7Fweg6A4IkGFwChcY6EqAly-HRmeY7DnSY5GHGL4qFwRhpjpJpmriDjVMRLgGAp84ckCECqaezEIHoObUuZuwKH4xGPgoRnmCQpmOAcqhmPJ37Flcfrlo5TGoQgY4mgYHkeAS+iqH5hqSc4dSuCo+I6SoSjvjZUX1pAsUodkrlGO51TSd5b46JlZRebVuG7IcjRmA05FtHOVzQSpkaMVVdivs4CibHGxg6biSg4ZsJD2AccaFEVGwOKVXTQRVI0CWeNV1Z5jW+WmujDj4HjmMRnhEttpBAQilWdkdyX1V5RFNS1iAEpU1pHER9JWjogSBEAA */
633
+ context: ({ input }) => ({
634
+ client: input.client,
635
+ formData: {},
636
+ message: ""
637
+ }),
638
+ initial: "idle",
639
+ states: {
640
+ idle: {
641
+ on: {
642
+ CREATE: {
643
+ actions: ["setFormData"],
644
+ target: "creating"
594
645
  },
595
- on: {
596
- RESOLVE: "success",
597
- REJECT: "error"
598
- }
599
- },
600
- deleting: {
601
- invoke: {
602
- src: "deleteDocumentService",
603
- onDone: { target: "success" },
604
- onError: { actions: ["setMessage"], target: "error" }
646
+ UPDATE: {
647
+ actions: ["setId", "setFormData"],
648
+ target: "updating"
605
649
  },
606
- on: {
607
- RESOLVE: "success",
608
- REJECT: "error"
609
- }
610
- },
611
- success: {
612
- invoke: {
613
- src: "formSubmittedService"
650
+ DELETE: {
651
+ actions: "setId",
652
+ target: "deleting"
614
653
  }
615
- },
616
- error: {}
617
- }
618
- },
619
- {
620
- actions: {
621
- setMessage: xstate.assign((_context, event) => ({
622
- message: event.data.details.description
623
- })),
624
- createDocument: xstate.assign((_context, event) => ({
625
- formData: event.formData
626
- })),
627
- deleteDocument: xstate.assign(() => ({
628
- // id: event.id,
629
- })),
630
- updateDocument: xstate.assign((_context, event) => ({
631
- formData: event.formData
632
- }))
633
- }
654
+ }
655
+ },
656
+ creating: {
657
+ tags: ["busy"],
658
+ invoke: {
659
+ src: "create document",
660
+ id: "createDocumentActor",
661
+ input: ({ context }) => ({ client: context.client, formData: context.formData }),
662
+ onDone: { actions: "setDocument", target: "created" },
663
+ onError: { actions: "setMessage", target: "error" }
664
+ }
665
+ },
666
+ created: { type: "final" },
667
+ updating: {
668
+ tags: ["busy"],
669
+ invoke: {
670
+ src: "update document",
671
+ id: "updateDocumentActor",
672
+ input: ({ context }) => ({
673
+ client: context.client,
674
+ id: context.id,
675
+ formData: context.formData
676
+ }),
677
+ onDone: { actions: "setDocument", target: "updated" },
678
+ onError: { actions: "setMessage", target: "error" }
679
+ }
680
+ },
681
+ updated: { type: "final" },
682
+ deleting: {
683
+ tags: ["busy"],
684
+ invoke: {
685
+ src: "delete document",
686
+ id: "deleteDocumentActor",
687
+ input: ({ context }) => ({ client: context.client, id: context.id }),
688
+ onDone: { target: "deleted" },
689
+ onError: { actions: "setMessage", target: "error" }
690
+ }
691
+ },
692
+ deleted: { type: "final" },
693
+ error: { type: "final" }
634
694
  }
635
- ), sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
695
+ }), sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
636
696
  const val = formData[key];
637
697
  return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
638
698
  }, {}), StyledErrorOutlineIcon = styledComponents.styled(icons.ErrorOutlineIcon)(({ theme }) => ({
@@ -659,7 +719,7 @@ const TableCell = (props) => {
659
719
  description && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
660
720
  ] });
661
721
  }, FormFieldInputText = react.forwardRef((props, ref) => {
662
- const { description, disabled, error, label, name, placeholder, value } = props;
722
+ const { description, disabled, error, label, name, placeholder, value, onChange, onBlur } = props;
663
723
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
664
724
  /* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
665
725
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -672,6 +732,8 @@ const TableCell = (props) => {
672
732
  id: name,
673
733
  name,
674
734
  placeholder,
735
+ onChange,
736
+ onBlur,
675
737
  ref
676
738
  }
677
739
  )
@@ -688,77 +750,48 @@ const formSchema = yup__namespace.object().shape({
688
750
  teamId: yup__namespace.string(),
689
751
  token: yup__namespace.string().required("Vercel Account Token cannot be empty")
690
752
  }), DialogForm = (props) => {
691
- const { deploymentTarget, onClose, onCreate, onDelete, onUpdate } = props, client = useSanityClient(), [formState, formStateTransition] = react$1.useMachine(formMachine, {
692
- services: {
693
- formSubmittedService: async () => {
694
- onClose();
695
- },
696
- // TODO: refactor
697
- createDocumentService: async (_context, event) => {
698
- let document;
699
- try {
700
- return document = await client.create({
701
- _id: `vercel.${uuid.uuid()}`,
702
- _type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
703
- ...event.formData
704
- }), onCreate && onCreate(document), Promise.resolve();
705
- } catch (e) {
706
- return Promise.reject(e);
707
- }
708
- },
709
- // TODO: refactor
710
- deleteDocumentService: async () => {
711
- if (deploymentTarget)
712
- try {
713
- return await client.delete(deploymentTarget._id), onDelete && onDelete(deploymentTarget._id), Promise.resolve();
714
- } catch (e) {
715
- return Promise.reject(e);
716
- }
717
- return Promise.resolve();
718
- },
719
- // TODO: refactor
720
- updateDocumentService: async (_context, event) => {
721
- let document;
722
- if (deploymentTarget)
723
- try {
724
- return document = await client.patch(deploymentTarget._id).set(event.formData).commit(), onUpdate && onUpdate(document), Promise.resolve();
725
- } catch (e) {
726
- return Promise.reject(e);
727
- }
728
- return Promise.resolve();
729
- }
730
- }
731
- }), formUpdating = formState.matches("creating") || formState.matches("deleting") || formState.matches("updating"), {
732
- // Read the formState before render to subscribe the form state through Proxy
753
+ const { deploymentTarget, onClose, onCreate, onDelete, onUpdate } = props, client = useSanityClient(), toast = ui.useToast(), [formState, formStateTransition, formStateActorRef] = react$1.useActor(formMachine, {
754
+ input: { client }
755
+ }), formUpdating = formState.hasTag("busy"), {
733
756
  formState: { errors, isDirty, isValid },
734
757
  handleSubmit,
735
758
  register
736
759
  } = reactHookForm.useForm({
760
+ // @ts-expect-error - fix typings later
737
761
  defaultValues: {
738
762
  deployHook: deploymentTarget?.deployHook || "",
739
763
  deployLimit: deploymentTarget?.deployLimit || 5,
740
- name: deploymentTarget?.name,
741
- projectId: deploymentTarget?.projectId,
764
+ name: deploymentTarget?.name || "",
765
+ projectId: deploymentTarget?.projectId || "",
742
766
  teamId: deploymentTarget?.teamId || "",
743
- token: deploymentTarget?.token
767
+ token: deploymentTarget?.token || ""
744
768
  },
745
769
  mode: "onChange",
746
770
  resolver: yup$1.yupResolver(formSchema)
747
- }), onSubmit = async (formData) => {
771
+ });
772
+ react.useEffect(() => {
773
+ formState.matches("error") && toast.push({
774
+ status: "error",
775
+ title: formState.context.message || "An error occurred"
776
+ }), formState.status === "done" && onClose();
777
+ }, [formState, onClose, toast]);
778
+ const onSubmit = async (formData) => {
748
779
  const sanitizedFormData = sanitizeFormData(formData);
749
- await formStateTransition(deploymentTarget ? "UPDATE" : "CREATE", {
750
- formData: sanitizedFormData
751
- });
752
- }, handleDelete = () => {
753
- formStateTransition("DELETE", { id: deploymentTarget?._id });
780
+ formStateTransition(deploymentTarget ? { type: "UPDATE", id: deploymentTarget._id, formData: sanitizedFormData } : { type: "CREATE", formData: sanitizedFormData }), await xstate.toPromise(formStateActorRef);
781
+ const snapshot = formStateActorRef.getSnapshot(), { document } = snapshot.context;
782
+ document && (snapshot.matches("created") ? onCreate?.(document) : snapshot.matches("updated") && onUpdate?.(document));
783
+ }, handleDelete = async () => {
784
+ const id = deploymentTarget._id;
785
+ formStateTransition({ type: "DELETE", id }), await xstate.toPromise(formStateActorRef), formStateActorRef.getSnapshot().matches("deleted") && onDelete?.(id);
754
786
  };
755
787
  return /* @__PURE__ */ jsxRuntime.jsx(
756
788
  ui.Dialog,
757
789
  {
758
- footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: deploymentTarget ? "space-between" : "flex-end", children: [
790
+ footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: deploymentTarget ? "space-between" : "flex-end", children: [
759
791
  deploymentTarget && /* @__PURE__ */ jsxRuntime.jsx(
760
792
  ui.Button,
761
793
  {
794
+ loading: formState.matches("deleting"),
762
795
  disabled: formUpdating,
763
796
  fontSize: 1,
764
797
  mode: "bleed",
@@ -770,14 +803,15 @@ const formSchema = yup__namespace.object().shape({
770
803
  /* @__PURE__ */ jsxRuntime.jsx(
771
804
  ui.Button,
772
805
  {
773
- disabled: formUpdating || !isDirty || !isValid,
806
+ loading: formState.matches("creating") || formState.matches("updating"),
807
+ disabled: !isDirty || !isValid,
774
808
  fontSize: 1,
775
809
  onClick: handleSubmit(onSubmit),
776
810
  text: deploymentTarget ? "Update and close" : "Create",
777
811
  tone: "primary"
778
812
  }
779
813
  )
780
- ] }) }), {}),
814
+ ] }) }),
781
815
  header: `${deploymentTarget ? "Edit" : "Create"} deployment target`,
782
816
  id: "create",
783
817
  onClose,
@@ -793,8 +827,7 @@ const formSchema = yup__namespace.object().shape({
793
827
  description: "Name displayed in this plugin (e.g. production, staging)",
794
828
  error: errors?.name,
795
829
  label: "Name",
796
- name: "name",
797
- ref: register
830
+ ...register("name")
798
831
  }
799
832
  ),
800
833
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -803,8 +836,7 @@ const formSchema = yup__namespace.object().shape({
803
836
  disabled: formUpdating,
804
837
  error: errors?.token,
805
838
  label: "Vercel Account Token",
806
- name: "token",
807
- ref: register
839
+ ...register("token")
808
840
  }
809
841
  ),
810
842
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -813,8 +845,7 @@ const formSchema = yup__namespace.object().shape({
813
845
  disabled: formUpdating,
814
846
  error: errors?.projectId,
815
847
  label: "Vercel Project ID",
816
- name: "projectId",
817
- ref: register
848
+ ...register("projectId")
818
849
  }
819
850
  ),
820
851
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -824,8 +855,7 @@ const formSchema = yup__namespace.object().shape({
824
855
  disabled: formUpdating,
825
856
  error: errors?.teamId,
826
857
  label: "Vercel Team ID (optional)",
827
- name: "teamId",
828
- ref: register
858
+ ...register("teamId")
829
859
  }
830
860
  ),
831
861
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -835,8 +865,7 @@ const formSchema = yup__namespace.object().shape({
835
865
  disabled: formUpdating,
836
866
  error: errors?.deployHook,
837
867
  label: "Vercel Deploy Hook (optional)",
838
- name: "deployHook",
839
- ref: register
868
+ ...register("deployHook")
840
869
  }
841
870
  ),
842
871
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -845,80 +874,83 @@ const formSchema = yup__namespace.object().shape({
845
874
  disabled: formUpdating,
846
875
  error: errors?.deployLimit,
847
876
  label: "Number of deploys to display",
848
- name: "deployLimit",
849
- ref: register({ valueAsNumber: !0 })
877
+ ...register("deployLimit", { valueAsNumber: !0 })
850
878
  }
851
879
  )
852
880
  ] })
853
881
  ] })
854
882
  }
855
883
  );
856
- }, dialogMachine = () => xstate.Machine(
857
- {
858
- context: {
859
- editDeploymentTarget: void 0
860
- },
861
- initial: "idle",
862
- states: {
863
- idle: {
864
- entry: xstate.assign({
865
- editDeploymentTarget: () => {
866
- }
867
- }),
868
- on: {
869
- CREATE: "create",
870
- EDIT: {
871
- actions: ["setEditDeploymentTarget"],
872
- target: "edit"
873
- }
884
+ }, dialogMachine = xstate.setup({
885
+ types: {
886
+ context: {},
887
+ events: {}
888
+ },
889
+ actions: {
890
+ setEditDeploymentTarget: xstate.assign({
891
+ editDeploymentTarget: ({ event }) => (xstate.assertEvent(event, "EDIT"), event.deploymentTarget)
892
+ })
893
+ }
894
+ }).createMachine({
895
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAEwKArCQCcANgAcAdmUbNOhVx0BGLQBoQAT0SmAzApJcXXexoAsW5fbWaFAL4BVmhYeISk5FTUjAAiAJKs3HxIIMKiElIy8ghKqpq6+obGZpY2ivb2zq4e5moeXKZc3kEhGDgExCSQ4nQAMgDyAMqcvDLp4pLSqTn2DSQefn7uyq5aWvZWtgjmTqsuvnU6XMoK9q0goR0RJJgATmDoYjS0gyPJ4yKTWTOIc1wLJZqFZrDZbRBaUwkfZuew6SFcepuILBED4IQQOAyK7hYifDJTbKIAC0GnBCFJFxxnUilDA+O+01AOQ8CnJGxIGn29lMpjUxhcCh0VPauNIPTEDMyTLkiA8PhIxh5Cg8DS8pgM5L5UOalSMah0cP05hFYRptweT3pqQm0qJCHlVSVphVashmvKCDUAN17j0XNMqrUyhRASAA */
896
+ context: {
897
+ editDeploymentTarget: void 0
898
+ },
899
+ initial: "idle",
900
+ states: {
901
+ idle: {
902
+ entry: xstate.assign({
903
+ editDeploymentTarget: () => {
874
904
  }
875
- },
876
- edit: {
877
- on: {
878
- CLOSE: "idle"
905
+ }),
906
+ on: {
907
+ CREATE: {
908
+ target: "create"
909
+ },
910
+ EDIT: {
911
+ actions: "setEditDeploymentTarget",
912
+ target: "edit"
879
913
  }
880
- },
881
- create: {
882
- on: {
883
- CLOSE: "idle"
914
+ }
915
+ },
916
+ edit: {
917
+ on: {
918
+ CLOSE: {
919
+ target: "idle"
920
+ }
921
+ }
922
+ },
923
+ create: {
924
+ on: {
925
+ CLOSE: {
926
+ target: "idle"
884
927
  }
885
928
  }
886
929
  }
887
- },
888
- {
889
- actions: {
890
- setEditDeploymentTarget: xstate.assign((_context, event) => ({
891
- editDeploymentTarget: event.deploymentTarget
892
- }))
930
+ }
931
+ }), queryClient = new reactQuery.QueryClient({
932
+ defaultOptions: {
933
+ queries: {
934
+ gcTime: 0,
935
+ staleTime: 0
893
936
  }
894
937
  }
895
- ), Widget = () => {
938
+ }), Widget = () => {
896
939
  const client = useSanityClient(), [deploymentTargetListState, deploymentTargetListStateTransition] = react$1.useMachine(
897
940
  deploymentTargetListMachine,
898
- {
899
- services: {
900
- fetchDataService: () => client.fetch(`*[_type == "${DEPLOYMENT_TARGET_DOCUMENT_TYPE}"] | order(name asc)`).then((result) => result)
901
- }
902
- }
903
- ), [dialogState, dialogStateTransition] = react$1.useMachine(dialogMachine), queryClient = new reactQuery.QueryClient({
904
- defaultOptions: {
905
- queries: {
906
- gcTime: 0,
907
- staleTime: 0
908
- }
909
- }
910
- }), handleDialogClose = () => {
911
- dialogStateTransition("CLOSE");
941
+ { input: { client } }
942
+ ), [dialogState, dialogStateTransition] = react$1.useMachine(dialogMachine), handleDialogClose = () => {
943
+ dialogStateTransition({ type: "CLOSE" });
912
944
  }, handleDialogShowCreate = () => {
913
- dialogStateTransition("CREATE");
945
+ dialogStateTransition({ type: "CREATE" });
914
946
  }, handleDialogShowEdit = (deploymentTarget) => {
915
- dialogStateTransition("EDIT", { deploymentTarget });
947
+ dialogStateTransition({ type: "EDIT", deploymentTarget });
916
948
  }, handleTargetCreate = (deploymentTarget) => {
917
- deploymentTargetListStateTransition("CREATE", { deploymentTarget });
949
+ deploymentTargetListStateTransition({ type: "CREATE", deploymentTarget });
918
950
  }, handleTargetDelete = (id) => {
919
- deploymentTargetListStateTransition("DELETE", { id });
951
+ deploymentTargetListStateTransition({ type: "DELETE", id });
920
952
  }, handleTargetUpdate = (deploymentTarget) => {
921
- deploymentTargetListStateTransition("UPDATE", { deploymentTarget });
953
+ deploymentTargetListStateTransition({ type: "UPDATE", deploymentTarget });
922
954
  };
923
955
  return /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, { zOffset: Z_INDEX_TOAST_PROVIDER, children: /* @__PURE__ */ jsxRuntime.jsxs(reactQuery.QueryClientProvider, { client: queryClient, children: [
924
956
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { radius: 2, style: { overflow: "hidden " }, children: [
@@ -936,12 +968,12 @@ const formSchema = yup__namespace.object().shape({
936
968
  ] }),
937
969
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
938
970
  deploymentTargetListState.matches("pending") && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading..." }) }),
939
- deploymentTargetListState.matches("ready.withoutData") && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
971
+ deploymentTargetListState.matches({ ready: "withoutData" }) && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
940
972
  "No deployment targets found.",
941
973
  " ",
942
974
  /* @__PURE__ */ jsxRuntime.jsx("a", { onClick: handleDialogShowCreate, style: { cursor: "pointer" }, children: "Create a new target?" })
943
975
  ] }) }),
944
- deploymentTargetListState.matches("ready.withData") && /* @__PURE__ */ jsxRuntime.jsx(
976
+ deploymentTargetListState.matches({ ready: "withData" }) && /* @__PURE__ */ jsxRuntime.jsx(
945
977
  DeploymentTargets,
946
978
  {
947
979
  items: deploymentTargetListState.context.results,