@sanity/dashboard 2.30.1 → 3.0.0-sanity-v3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +123 -44
  2. package/lib/cjs/index.js +1002 -0
  3. package/lib/cjs/index.js.map +1 -0
  4. package/lib/esm/index.js +977 -0
  5. package/lib/esm/index.js.map +1 -0
  6. package/lib/types/index.d.ts +42 -0
  7. package/lib/types/index.d.ts.map +1 -0
  8. package/package.json +53 -14
  9. package/src/components/DashboardLayout.tsx +10 -0
  10. package/src/components/DashboardWidgetContainer.tsx +69 -0
  11. package/src/components/NotFoundWidget.tsx +30 -0
  12. package/src/components/WidgetGroup.tsx +108 -0
  13. package/src/containers/Dashboard.tsx +19 -0
  14. package/src/containers/DashboardContext.tsx +8 -0
  15. package/src/containers/WidgetContainer.tsx +21 -0
  16. package/src/index.tsx +62 -0
  17. package/src/types.ts +21 -0
  18. package/src/versionedClient.ts +7 -0
  19. package/src/widgets/projectInfo/ProjectInfo.tsx +233 -0
  20. package/src/widgets/projectInfo/index.ts +10 -0
  21. package/src/widgets/projectUsers/ProjectUsers.tsx +171 -0
  22. package/src/widgets/projectUsers/index.ts +10 -0
  23. package/src/widgets/sanityTutorials/SanityTutorials.tsx +77 -0
  24. package/src/widgets/sanityTutorials/Tutorial.tsx +111 -0
  25. package/src/widgets/sanityTutorials/dataAdapter.ts +48 -0
  26. package/src/widgets/sanityTutorials/index.ts +10 -0
  27. package/.babelrc +0 -4
  28. package/lib/DashboardTool.js +0 -59
  29. package/lib/components/DashboardLayout.js +0 -35
  30. package/lib/components/NotFoundWidget.js +0 -51
  31. package/lib/components/WidgetGroup.js +0 -67
  32. package/lib/components/dashboardWidget.js +0 -51
  33. package/lib/containers/Dashboard.js +0 -32
  34. package/lib/containers/WidgetContainer.js +0 -56
  35. package/lib/dashboardConfig.js +0 -16
  36. package/lib/legacyParts.js +0 -55
  37. package/lib/versionedClient.js +0 -20
  38. package/lib/widget.css +0 -62
  39. package/lib/widgets/projectInfo/ProjectInfo.js +0 -265
  40. package/lib/widgets/projectInfo/index.js +0 -19
  41. package/lib/widgets/projectUsers/ProjectUsers.js +0 -188
  42. package/lib/widgets/projectUsers/index.js +0 -16
  43. package/lib/widgets/sanityTutorials/SanityTutorials.js +0 -115
  44. package/lib/widgets/sanityTutorials/Tutorial.js +0 -111
  45. package/lib/widgets/sanityTutorials/dataAdapter.js +0 -28
  46. package/lib/widgets/sanityTutorials/index.js +0 -19
  47. package/sanity.json +0 -59
  48. package/tsconfig.json +0 -17
@@ -0,0 +1,1002 @@
1
+ var $7xGut$reactjsxruntime = require("react/jsx-runtime");
2
+ var $7xGut$react = require("react");
3
+ var $7xGut$sanity = require("sanity");
4
+ var $7xGut$sanityui = require("@sanity/ui");
5
+ var $7xGut$styledcomponents = require("styled-components");
6
+ var $7xGut$rxjsoperators = require("rxjs/operators");
7
+ var $7xGut$sanityicons = require("@sanity/icons");
8
+ var $7xGut$sanity_unstable = require("sanity/_unstable");
9
+ var $7xGut$sanityimageurl = require("@sanity/image-url");
10
+
11
+ function $parcel$export(e, n, v, s) {
12
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
+ }
14
+ function $parcel$exportWildcard(dest, source) {
15
+ Object.keys(source).forEach(function(key) {
16
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
17
+ return;
18
+ }
19
+
20
+ Object.defineProperty(dest, key, {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return source[key];
24
+ }
25
+ });
26
+ });
27
+
28
+ return dest;
29
+ }
30
+ function $parcel$interopDefault(a) {
31
+ return a && a.__esModule ? a.default : a;
32
+ }
33
+
34
+ $parcel$export(module.exports, "dashboardTool", () => $9233cea927cb9637$export$dd097bc0a3a5adbd);
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+ function $bfe45263a984c2cd$export$3469e8c87b54056a(props) {
43
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Container), {
44
+ width: 4,
45
+ padding: 4,
46
+ sizing: "border",
47
+ style: {
48
+ minHeight: "100%"
49
+ },
50
+ children: props.children
51
+ });
52
+ }
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+ const $30a13e5257f70f0a$export$3d9a716c82234f3d = /*#__PURE__*/ (0, $7xGut$react.createContext)({
63
+ widgets: []
64
+ });
65
+ function $30a13e5257f70f0a$export$f69a0df1904034e() {
66
+ return (0, $7xGut$react.useContext)($30a13e5257f70f0a$export$3d9a716c82234f3d);
67
+ }
68
+
69
+
70
+
71
+ function $940dba897c18ad3c$export$d320a48219c7c153(props) {
72
+ const config = (0, $30a13e5257f70f0a$export$f69a0df1904034e)();
73
+ const layout = (0, $7xGut$react.useMemo)(()=>({
74
+ ...props.layout || {},
75
+ ...config.layout || {}
76
+ }), [
77
+ props.layout,
78
+ config.layout
79
+ ]);
80
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Card), {
81
+ shadow: 1,
82
+ "data-width": layout.width,
83
+ "data-height": layout.height,
84
+ children: /*#__PURE__*/ (0, $7xGut$react.createElement)(props.component, {})
85
+ });
86
+ }
87
+
88
+
89
+ const $b73de53087845311$var$media = {
90
+ small: (...args)=>(0, $7xGut$styledcomponents.css)`
91
+ @media (min-width: ${({ theme: theme })=>theme.sanity.media[0]}px) {
92
+ ${(0, $7xGut$styledcomponents.css)(...args)}
93
+ }
94
+ `,
95
+ medium: (...args)=>(0, $7xGut$styledcomponents.css)`
96
+ @media (min-width: ${({ theme: theme })=>theme.sanity.media[2]}px) {
97
+ ${(0, $7xGut$styledcomponents.css)(...args)}
98
+ }
99
+ `
100
+ };
101
+ const $b73de53087845311$var$Root = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Grid))`
102
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
103
+
104
+ & > div {
105
+ overflow: hidden;
106
+ }
107
+
108
+ & > div[data-width='medium'] {
109
+ ${$b73de53087845311$var$media.small`
110
+ grid-column: span 2;
111
+ `}
112
+ }
113
+
114
+ & > div[data-width='large'] {
115
+ ${$b73de53087845311$var$media.small`
116
+ grid-column: span 2;
117
+ `}
118
+
119
+ ${$b73de53087845311$var$media.medium`
120
+ grid-column: span 3;
121
+ `}
122
+ }
123
+
124
+ & > div[data-width='full'] {
125
+ ${$b73de53087845311$var$media.small`
126
+ grid-column: 1 / -1;
127
+ `}
128
+ }
129
+
130
+ & > div[data-height='medium'] {
131
+ ${$b73de53087845311$var$media.small`
132
+ grid-row: span 2;
133
+ `}
134
+ }
135
+
136
+ & > div[data-height='large'] {
137
+ ${$b73de53087845311$var$media.small`
138
+ grid-row: span 2;
139
+ `}
140
+
141
+ ${$b73de53087845311$var$media.medium`
142
+ grid-row: span 3;
143
+ `}
144
+ }
145
+
146
+ & > div[data-height='full'] {
147
+ ${$b73de53087845311$var$media.medium`
148
+ grid-row: 1 / -1;
149
+ `}
150
+ }
151
+ `;
152
+ const $b73de53087845311$var$NO_WIDGETS = [];
153
+ const $b73de53087845311$var$NO_LAYOUT = {};
154
+ function $b73de53087845311$export$606a10b16bce9144(props) {
155
+ const { config: { layout: layout = $b73de53087845311$var$NO_LAYOUT , widgets: widgets = $b73de53087845311$var$NO_WIDGETS } , } = props;
156
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)($b73de53087845311$var$Root, {
157
+ autoFlow: "row dense",
158
+ "data-width": layout.width || "auto",
159
+ "data-height": layout.height || "auto",
160
+ gap: 4,
161
+ children: [
162
+ widgets.length ? null : /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Card), {
163
+ padding: 4,
164
+ shadow: 1,
165
+ tone: "primary",
166
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
167
+ align: "center",
168
+ children: "Add some widgets to populate this space."
169
+ })
170
+ }),
171
+ widgets.map((widgetConfig, index)=>{
172
+ if (widgetConfig.type === "__experimental_group") return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($b73de53087845311$export$606a10b16bce9144, {
173
+ config: widgetConfig
174
+ }, index);
175
+ if (widgetConfig.component) return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $940dba897c18ad3c$export$d320a48219c7c153), {
176
+ ...widgetConfig
177
+ }, index);
178
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Box), {
179
+ children: [
180
+ widgetConfig.name,
181
+ " is missing widget component"
182
+ ]
183
+ }, index);
184
+ })
185
+ ]
186
+ });
187
+ }
188
+
189
+
190
+
191
+ function $7aac5747647866ab$export$fe82a520fc33e5f4({ config: config }) {
192
+ if (!config) return null;
193
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $30a13e5257f70f0a$export$3d9a716c82234f3d).Provider, {
194
+ value: config,
195
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $bfe45263a984c2cd$export$3469e8c87b54056a), {
196
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $b73de53087845311$export$606a10b16bce9144), {
197
+ config: config
198
+ })
199
+ })
200
+ });
201
+ }
202
+
203
+
204
+
205
+ var $faefaad95e5fcca0$exports = {};
206
+
207
+
208
+ var $3e2e9c117db5b41e$exports = {};
209
+
210
+ $parcel$export($3e2e9c117db5b41e$exports, "DashboardWidgetContainer", () => $3e2e9c117db5b41e$export$67b2e85605d868b2);
211
+
212
+
213
+
214
+
215
+ const $3e2e9c117db5b41e$var$Root = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Card))`
216
+ display: flex;
217
+ flex-direction: column;
218
+ justify-content: stretch;
219
+ height: 100%;
220
+ box-sizing: border-box;
221
+ position: relative;
222
+ `;
223
+ const $3e2e9c117db5b41e$var$Header = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Card))`
224
+ position: sticky;
225
+ top: 0;
226
+ z-index: 2;
227
+ border-top-left-radius: inherit;
228
+ border-top-right-radius: inherit;
229
+ `;
230
+ const $3e2e9c117db5b41e$var$Footer = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Card))`
231
+ position: sticky;
232
+ overflow: hidden;
233
+ bottom: 0;
234
+ z-index: 2;
235
+ border-bottom-right-radius: inherit;
236
+ border-bottom-left-radius: inherit;
237
+ margin-top: auto;
238
+ `;
239
+ const $3e2e9c117db5b41e$var$Content = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Box))`
240
+ position: relative;
241
+ z-index: 1;
242
+ height: stretch;
243
+ min-height: 21.5em;
244
+
245
+ @media (min-width: ${({ theme: theme })=>theme.sanity.media[0]}px) {
246
+ overflow-y: auto;
247
+ outline: none;
248
+ }
249
+ `;
250
+ const $3e2e9c117db5b41e$export$67b2e85605d868b2 = /*#__PURE__*/ (0, $7xGut$react.forwardRef)(function DashboardWidgetContainer(props, ref) {
251
+ const { header: header , children: children , footer: footer } = props;
252
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)($3e2e9c117db5b41e$var$Root, {
253
+ radius: 3,
254
+ display: "flex",
255
+ ref: ref,
256
+ children: [
257
+ header && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($3e2e9c117db5b41e$var$Header, {
258
+ borderBottom: true,
259
+ paddingX: 3,
260
+ paddingY: 4,
261
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Heading), {
262
+ size: 1,
263
+ textOverflow: "ellipsis",
264
+ children: header
265
+ })
266
+ }),
267
+ children && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($3e2e9c117db5b41e$var$Content, {
268
+ children: children
269
+ }),
270
+ footer && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($3e2e9c117db5b41e$var$Footer, {
271
+ borderTop: true,
272
+ children: footer
273
+ })
274
+ ]
275
+ });
276
+ });
277
+
278
+
279
+ var $16473bba5204ab4f$exports = {};
280
+
281
+ $parcel$export($16473bba5204ab4f$exports, "projectInfoWidget", () => $16473bba5204ab4f$export$66362ea0e7ee12e);
282
+
283
+
284
+
285
+
286
+
287
+ function $c4f6885a0827c260$export$270fde7c7e72cf26() {
288
+ const client = (0, $7xGut$sanity.useClient)();
289
+ return (0, $7xGut$react.useMemo)(()=>client.withConfig({
290
+ apiVersion: "1"
291
+ }), [
292
+ client
293
+ ]);
294
+ }
295
+
296
+
297
+
298
+
299
+ function $2a231b520616890c$var$isUrl(url) {
300
+ return url && /^https?:\/\//.test(`${url}`);
301
+ }
302
+ function $2a231b520616890c$var$getGraphQlUrl(projectId, dataset) {
303
+ return `https://${projectId}.api.sanity.io/v1/graphql/${dataset}/default`;
304
+ }
305
+ function $2a231b520616890c$var$getGroqUrl(projectId, dataset) {
306
+ return `https://${projectId}.api.sanity.io/v1/groq/${dataset}`;
307
+ }
308
+ function $2a231b520616890c$var$getManageUrl(projectId) {
309
+ return `https://manage.sanity.io/projects/${projectId}`;
310
+ }
311
+ const $2a231b520616890c$var$NO_EXPERIMENTAL = [];
312
+ const $2a231b520616890c$var$NO_DATA = [];
313
+ function $2a231b520616890c$export$a1c9a67310a2d004(props) {
314
+ const { __experimental_before: __experimental_before = $2a231b520616890c$var$NO_EXPERIMENTAL , data: data = $2a231b520616890c$var$NO_DATA } = props;
315
+ const [studioHost, setStudioHost] = (0, $7xGut$react.useState)();
316
+ const [graphqlApi, setGraphQlApi] = (0, $7xGut$react.useState)();
317
+ const versionedClient = (0, $c4f6885a0827c260$export$270fde7c7e72cf26)();
318
+ const { projectId: projectId = "unknown" , dataset: dataset = "unknown" } = versionedClient.config();
319
+ (0, $7xGut$react.useEffect)(()=>{
320
+ const subscriptions = [];
321
+ subscriptions.push(versionedClient.observable.request({
322
+ uri: `/projects/${projectId}`
323
+ }).subscribe({
324
+ next: (result)=>{
325
+ const { studioHost: host } = result;
326
+ setStudioHost(host ? `https://${host}.sanity.studio` : undefined);
327
+ },
328
+ error: (error)=>{
329
+ console.error("Error while looking for studioHost", error);
330
+ setStudioHost({
331
+ error: "Something went wrong while looking up studioHost. See console."
332
+ });
333
+ }
334
+ }));
335
+ // ping assumed graphql endpoint
336
+ subscriptions.push(versionedClient.observable.request({
337
+ method: "HEAD",
338
+ uri: `/graphql/${dataset}/default`
339
+ }).subscribe({
340
+ next: ()=>setGraphQlApi($2a231b520616890c$var$getGraphQlUrl(projectId, dataset)),
341
+ error: (error)=>{
342
+ if (error.statusCode === 404) setGraphQlApi(undefined);
343
+ else {
344
+ console.error("Error while looking for graphqlApi", error);
345
+ setGraphQlApi({
346
+ error: "Something went wrong while looking up graphqlApi. See console."
347
+ });
348
+ }
349
+ }
350
+ }));
351
+ return ()=>{
352
+ subscriptions.forEach((s)=>s.unsubscribe());
353
+ };
354
+ }, [
355
+ dataset,
356
+ projectId,
357
+ versionedClient,
358
+ setGraphQlApi,
359
+ setStudioHost
360
+ ]);
361
+ const assembleTableRows = (0, $7xGut$react.useMemo)(()=>{
362
+ let result = [
363
+ {
364
+ title: "Sanity project",
365
+ rows: [
366
+ {
367
+ title: "Project ID",
368
+ value: projectId
369
+ },
370
+ {
371
+ title: "Dataset",
372
+ value: dataset
373
+ },
374
+ ]
375
+ },
376
+ ];
377
+ // Handle any apps
378
+ const apps = [
379
+ studioHost ? {
380
+ title: "Studio",
381
+ value: studioHost
382
+ } : null,
383
+ ...data.filter((item)=>item.category === "apps"),
384
+ ].filter((a)=>!!a);
385
+ if (apps.length > 0) result = result.concat([
386
+ {
387
+ title: "Apps",
388
+ rows: apps
389
+ }
390
+ ]);
391
+ // Handle APIs
392
+ result = result.concat([
393
+ {
394
+ title: "APIs",
395
+ rows: [
396
+ {
397
+ title: "GROQ",
398
+ value: $2a231b520616890c$var$getGroqUrl(projectId, dataset)
399
+ },
400
+ {
401
+ title: "GraphQL",
402
+ value: (typeof graphqlApi === "object" ? "Error" : graphqlApi) ?? "Not deployed"
403
+ },
404
+ ]
405
+ },
406
+ ], data.filter((item)=>item.category === "apis"));
407
+ // Handle whatever else there might be
408
+ const otherStuff = {};
409
+ data.forEach((item)=>{
410
+ if (item.category && item.category !== "apps" && item.category !== "apis") {
411
+ if (!otherStuff[item.category]) otherStuff[item.category] = [];
412
+ otherStuff[item.category].push(item);
413
+ }
414
+ });
415
+ Object.keys(otherStuff).forEach((category)=>{
416
+ result.push({
417
+ title: category,
418
+ rows: otherStuff[category]
419
+ });
420
+ });
421
+ return result;
422
+ }, [
423
+ graphqlApi,
424
+ studioHost,
425
+ projectId,
426
+ dataset,
427
+ data
428
+ ]);
429
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$reactjsxruntime.Fragment), {
430
+ children: [
431
+ __experimental_before.map((widgetConfig, idx)=>/*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $940dba897c18ad3c$export$d320a48219c7c153), {
432
+ ...widgetConfig
433
+ }, idx)),
434
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
435
+ height: "fill",
436
+ marginTop: __experimental_before?.length > 0 ? 4 : 0,
437
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $3e2e9c117db5b41e$export$67b2e85605d868b2), {
438
+ footer: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Button), {
439
+ style: {
440
+ width: "100%"
441
+ },
442
+ paddingX: 2,
443
+ paddingY: 4,
444
+ mode: "bleed",
445
+ tone: "primary",
446
+ text: "Manage project",
447
+ as: "a",
448
+ href: $2a231b520616890c$var$getManageUrl(projectId)
449
+ }),
450
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Card), {
451
+ paddingY: 4,
452
+ radius: 2,
453
+ role: "table",
454
+ "aria-label": "Project info",
455
+ "aria-describedby": "project_info_table",
456
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Stack), {
457
+ space: 4,
458
+ children: [
459
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
460
+ paddingX: 3,
461
+ as: "header",
462
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Heading), {
463
+ size: 1,
464
+ as: "h2",
465
+ id: "project_info_table",
466
+ children: "Project info"
467
+ })
468
+ }),
469
+ assembleTableRows.map((item)=>{
470
+ if (!item || !item.rows) return null;
471
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Stack), {
472
+ space: 3,
473
+ children: [
474
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Card), {
475
+ borderBottom: true,
476
+ padding: 3,
477
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Label), {
478
+ size: 0,
479
+ muted: true,
480
+ role: "columnheader",
481
+ children: item.title
482
+ })
483
+ }),
484
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Stack), {
485
+ space: 4,
486
+ paddingX: 3,
487
+ role: "rowgroup",
488
+ children: item.rows.map((row)=>{
489
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Grid), {
490
+ columns: 2,
491
+ role: "row",
492
+ children: [
493
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
494
+ weight: "medium",
495
+ role: "rowheader",
496
+ children: row.title
497
+ }),
498
+ typeof row.value === "object" && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
499
+ size: 1,
500
+ children: row.value?.error
501
+ }),
502
+ typeof row.value === "string" && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$reactjsxruntime.Fragment), {
503
+ children: $2a231b520616890c$var$isUrl(row.value) ? /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
504
+ size: 1,
505
+ role: "cell",
506
+ style: {
507
+ wordBreak: "break-word"
508
+ },
509
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("a", {
510
+ href: row.value,
511
+ children: row.value
512
+ })
513
+ }) : /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Code), {
514
+ size: 1,
515
+ role: "cell",
516
+ style: {
517
+ wordBreak: "break-word"
518
+ },
519
+ children: row.value
520
+ })
521
+ })
522
+ ]
523
+ }, row.title);
524
+ })
525
+ })
526
+ ]
527
+ }, item.title);
528
+ })
529
+ ]
530
+ })
531
+ })
532
+ })
533
+ })
534
+ ]
535
+ });
536
+ }
537
+
538
+
539
+ function $16473bba5204ab4f$export$66362ea0e7ee12e(config) {
540
+ return {
541
+ name: "project-info",
542
+ component: (0, $2a231b520616890c$export$a1c9a67310a2d004),
543
+ layout: config?.layout ?? {
544
+ width: "medium"
545
+ }
546
+ };
547
+ }
548
+
549
+
550
+ var $7997b902be105c46$exports = {};
551
+
552
+ $parcel$export($7997b902be105c46$exports, "projectUsersWidget", () => $7997b902be105c46$export$5c0e62d7539f632);
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+ const $78e6ba7dc9c8c794$var$AvatarWrapper = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Card))`
564
+ box-sizing: border-box;
565
+ border-radius: 50%;
566
+ border-color: transparent;
567
+ overflow: hidden;
568
+ width: 100%;
569
+ height: 100%;
570
+
571
+ & > img {
572
+ width: 100%;
573
+ height: auto;
574
+ }
575
+ `;
576
+ function $78e6ba7dc9c8c794$var$getInviteUrl(projectId) {
577
+ return `https://manage.sanity.io/projects/${projectId}/team/invite`;
578
+ }
579
+ function $78e6ba7dc9c8c794$export$2500e0068175e4b9() {
580
+ const [project, setProject] = (0, $7xGut$react.useState)();
581
+ const [users, setUsers] = (0, $7xGut$react.useState)();
582
+ const [error, setError] = (0, $7xGut$react.useState)();
583
+ const versionedClient = (0, $c4f6885a0827c260$export$270fde7c7e72cf26)();
584
+ const { __internal: { userStore: userStore } , } = (0, $7xGut$sanity.useSource)();
585
+ const fetchData = (0, $7xGut$react.useCallback)(()=>{
586
+ const { projectId: projectId } = versionedClient.config();
587
+ const subscription = versionedClient.observable.request({
588
+ uri: `/projects/${projectId}`
589
+ }).pipe((0, $7xGut$rxjsoperators.switchMap)((_project)=>userStore.observable.getUsers(_project.members.map((mem)=>mem.id)).pipe((0, $7xGut$rxjsoperators.map)((_users)=>({
590
+ project: _project,
591
+ users: _users
592
+ }))))).subscribe({
593
+ next: ({ users: _users , project: _project })=>{
594
+ setProject(_project);
595
+ setUsers((Array.isArray(_users) ? _users : [
596
+ _users
597
+ ]).sort((userA, userB)=>$78e6ba7dc9c8c794$var$sortUsersByRobotStatus(userA, userB, _project)));
598
+ },
599
+ error: (e)=>setError(e)
600
+ });
601
+ return ()=>subscription.unsubscribe();
602
+ }, [
603
+ userStore,
604
+ versionedClient
605
+ ]);
606
+ (0, $7xGut$react.useEffect)(()=>fetchData(), [
607
+ fetchData
608
+ ]);
609
+ const handleRetryFetch = (0, $7xGut$react.useCallback)(()=>fetchData(), [
610
+ fetchData
611
+ ]);
612
+ const isLoading = !users || !project;
613
+ if (error) return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $3e2e9c117db5b41e$export$67b2e85605d868b2), {
614
+ header: "Project users",
615
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
616
+ padding: 4,
617
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Text), {
618
+ children: [
619
+ "Something went wrong while fetching data. You could",
620
+ " ",
621
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("a", {
622
+ onClick: handleRetryFetch,
623
+ title: "Retry users fetch",
624
+ style: {
625
+ cursor: "pointer"
626
+ },
627
+ children: "retry"
628
+ }),
629
+ "..?"
630
+ ]
631
+ })
632
+ })
633
+ });
634
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $3e2e9c117db5b41e$export$67b2e85605d868b2), {
635
+ header: "Project users",
636
+ footer: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Button), {
637
+ style: {
638
+ width: "100%"
639
+ },
640
+ paddingX: 2,
641
+ paddingY: 4,
642
+ mode: "bleed",
643
+ tone: "primary",
644
+ text: "Invite members",
645
+ as: "a",
646
+ loading: isLoading,
647
+ href: isLoading ? undefined : $78e6ba7dc9c8c794$var$getInviteUrl(project.id)
648
+ }),
649
+ children: [
650
+ isLoading && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
651
+ paddingY: 5,
652
+ paddingX: 2,
653
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Stack), {
654
+ space: 4,
655
+ children: [
656
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
657
+ align: "center",
658
+ muted: true,
659
+ size: 1,
660
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Spinner), {})
661
+ }),
662
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
663
+ align: "center",
664
+ size: 1,
665
+ muted: true,
666
+ children: "Loading items..."
667
+ })
668
+ ]
669
+ })
670
+ }),
671
+ !isLoading && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Stack), {
672
+ space: 3,
673
+ padding: 3,
674
+ children: users?.map((user)=>{
675
+ const membership = project.members.find((member)=>member.id === user.id);
676
+ const media = membership?.isRobot ? /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
677
+ size: 3,
678
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityicons.RobotIcon), {})
679
+ }) : /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($78e6ba7dc9c8c794$var$AvatarWrapper, {
680
+ tone: "transparent",
681
+ children: user?.imageUrl && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("img", {
682
+ src: user.imageUrl,
683
+ alt: user?.displayName
684
+ })
685
+ });
686
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
687
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanity_unstable.DefaultPreview), {
688
+ title: user.displayName,
689
+ subtitle: membership?.role,
690
+ media: media
691
+ })
692
+ }, user.id);
693
+ })
694
+ })
695
+ ]
696
+ });
697
+ }
698
+ function $78e6ba7dc9c8c794$var$sortUsersByRobotStatus(userA, userB, project) {
699
+ const { members: members } = project;
700
+ const membershipA = members.find((member)=>member.id === userA?.id);
701
+ const membershipB = members.find((member)=>member.id === userB?.id);
702
+ if (membershipA?.isRobot) return 1;
703
+ if (membershipB?.isRobot) return -1;
704
+ return 0;
705
+ }
706
+
707
+
708
+ function $7997b902be105c46$export$5c0e62d7539f632(config) {
709
+ return {
710
+ name: "project-info",
711
+ component: (0, $78e6ba7dc9c8c794$export$2500e0068175e4b9),
712
+ layout: config?.layout
713
+ };
714
+ }
715
+
716
+
717
+ var $1606a83fb83c2d1a$exports = {};
718
+
719
+ $parcel$export($1606a83fb83c2d1a$exports, "sanityTutorialsWidget", () => $1606a83fb83c2d1a$export$b3552e87a7c5c47b);
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+ const $0fded2095eda9a02$var$PlayIconBox = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Box))`
729
+ position: absolute;
730
+ top: 50%;
731
+ left: 50%;
732
+ transform: translate(-50%, -50%);
733
+
734
+ &:before {
735
+ content: '';
736
+ position: absolute;
737
+ top: 50%;
738
+ left: 50%;
739
+ transform: translate(-50%, -50%);
740
+ width: 2.75em;
741
+ height: 2.75em;
742
+ border-radius: 50%;
743
+ background: ${({ theme: theme })=>theme.sanity.color.card.enabled.bg};
744
+ opacity: 0.75;
745
+ }
746
+ `;
747
+ const $0fded2095eda9a02$var$Root = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Flex))`
748
+ &:hover {
749
+ ${$0fded2095eda9a02$var$PlayIconBox} {
750
+ &:before {
751
+ opacity: 1;
752
+ }
753
+ }
754
+ }
755
+ `;
756
+ const $0fded2095eda9a02$var$PosterCard = (0, ($parcel$interopDefault($7xGut$styledcomponents)))((0, $7xGut$sanityui.Card))`
757
+ width: 100%;
758
+ padding-bottom: calc(9 / 16 * 100%);
759
+ position: relative;
760
+ `;
761
+ const $0fded2095eda9a02$var$Poster = (0, ($parcel$interopDefault($7xGut$styledcomponents))).img`
762
+ position: absolute;
763
+ top: 0;
764
+ left: 0;
765
+ height: 100%;
766
+ width: 100%;
767
+ object-fit: cover;
768
+ display: block;
769
+
770
+ &:not([src]) {
771
+ display: none;
772
+ }
773
+ `;
774
+ function $0fded2095eda9a02$export$825b76de5f2b0345(props) {
775
+ const { title: title , posterURL: posterURL , showPlayIcon: showPlayIcon , href: href , presenterName: presenterName , presenterSubtitle: presenterSubtitle } = props;
776
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($0fded2095eda9a02$var$Root, {
777
+ flex: 1,
778
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Card), {
779
+ sizing: "border",
780
+ flex: 1,
781
+ padding: 2,
782
+ radius: 2,
783
+ as: "a",
784
+ href: href,
785
+ target: "_blank",
786
+ rel: "noopener noreferrer",
787
+ style: {
788
+ position: "relative"
789
+ },
790
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Flex), {
791
+ direction: "column",
792
+ style: {
793
+ height: "100%"
794
+ },
795
+ children: [
796
+ posterURL && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)($0fded2095eda9a02$var$PosterCard, {
797
+ marginBottom: 1,
798
+ children: [
799
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($0fded2095eda9a02$var$Poster, {
800
+ src: posterURL
801
+ }),
802
+ showPlayIcon && /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)($0fded2095eda9a02$var$PlayIconBox, {
803
+ display: "flex",
804
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
805
+ align: "center",
806
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityicons.PlayIcon), {})
807
+ })
808
+ })
809
+ ]
810
+ }),
811
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Flex), {
812
+ direction: "column",
813
+ justify: "space-between",
814
+ paddingY: 2,
815
+ flex: 1,
816
+ children: [
817
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Heading), {
818
+ as: "h3",
819
+ size: 1,
820
+ children: title
821
+ }),
822
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Box), {
823
+ marginTop: 4,
824
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)((0, $7xGut$sanityui.Stack), {
825
+ space: 2,
826
+ flex: 1,
827
+ children: [
828
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
829
+ size: 1,
830
+ children: presenterName
831
+ }),
832
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Text), {
833
+ size: 0,
834
+ style: {
835
+ opacity: 0.7
836
+ },
837
+ children: presenterSubtitle
838
+ })
839
+ ]
840
+ })
841
+ })
842
+ ]
843
+ })
844
+ ]
845
+ })
846
+ })
847
+ });
848
+ }
849
+
850
+
851
+
852
+
853
+
854
+ const $9bf75aece3449dab$var$tutorialsProjectConfig = {
855
+ projectId: "3do82whm",
856
+ dataset: "next"
857
+ };
858
+ function $9bf75aece3449dab$export$144c6e577729d454() {
859
+ const versionedClient = (0, $c4f6885a0827c260$export$270fde7c7e72cf26)();
860
+ return (0, $7xGut$react.useMemo)(()=>({
861
+ getFeed: (templateRepoId)=>{
862
+ const uri = templateRepoId ? `/addons/dashboard?templateRepoId=${templateRepoId}` : "/addons/dashboard";
863
+ return versionedClient.observable.request({
864
+ uri: uri,
865
+ withCredentials: false
866
+ });
867
+ },
868
+ urlBuilder: (0, ($parcel$interopDefault($7xGut$sanityimageurl)))($9bf75aece3449dab$var$tutorialsProjectConfig)
869
+ }), [
870
+ versionedClient
871
+ ]);
872
+ }
873
+
874
+
875
+
876
+ function $a7c779803cabaa01$var$createUrl(slug, type) {
877
+ if (type === "tutorial") return `https://www.sanity.io/docs/tutorials/${slug.current}`;
878
+ else if (type === "guide") return `https://www.sanity.io/docs/guides/${slug.current}`;
879
+ return false;
880
+ }
881
+ function $a7c779803cabaa01$export$5f156cc357b8467f(props) {
882
+ const { templateRepoId: templateRepoId } = props;
883
+ const [feedItems, setFeedItems] = (0, $7xGut$react.useState)([]);
884
+ const { getFeed: getFeed , urlBuilder: urlBuilder } = (0, $9bf75aece3449dab$export$144c6e577729d454)();
885
+ (0, $7xGut$react.useEffect)(()=>{
886
+ const subscription = getFeed(templateRepoId).subscribe((response)=>{
887
+ setFeedItems(response.items);
888
+ });
889
+ return ()=>{
890
+ subscription.unsubscribe();
891
+ };
892
+ }, [
893
+ setFeedItems,
894
+ getFeed,
895
+ templateRepoId
896
+ ]);
897
+ const title = "Learn about Sanity";
898
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $3e2e9c117db5b41e$export$67b2e85605d868b2), {
899
+ header: title,
900
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Flex), {
901
+ as: "ul",
902
+ overflow: "auto",
903
+ align: "stretch",
904
+ paddingY: 2,
905
+ children: feedItems?.map((feedItem, index)=>{
906
+ if (!feedItem.title || !feedItem.guideOrTutorial && !feedItem.externalLink) return null;
907
+ const presenter = feedItem.presenter || feedItem.guideOrTutorial?.presenter || {};
908
+ const subtitle = feedItem.category;
909
+ const { guideOrTutorial: guideOrTutorial = {} } = feedItem;
910
+ const href = (guideOrTutorial.slug ? $a7c779803cabaa01$var$createUrl(guideOrTutorial.slug, guideOrTutorial._type) : feedItem.externalLink) || feedItem.externalLink;
911
+ return /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7xGut$sanityui.Flex), {
912
+ as: "li",
913
+ paddingRight: index < feedItems?.length - 1 ? 1 : 3,
914
+ paddingLeft: index === 0 ? 3 : 0,
915
+ align: "stretch",
916
+ style: {
917
+ minWidth: 272,
918
+ width: "30%"
919
+ },
920
+ children: /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $0fded2095eda9a02$export$825b76de5f2b0345), {
921
+ title: feedItem.title,
922
+ href: href ?? "",
923
+ presenterName: presenter.name,
924
+ presenterSubtitle: subtitle,
925
+ showPlayIcon: feedItem.hasVideo,
926
+ posterURL: feedItem.poster ? urlBuilder.image(feedItem.poster).height(360).url() : undefined
927
+ })
928
+ }, feedItem._id);
929
+ })
930
+ })
931
+ });
932
+ }
933
+
934
+
935
+ function $1606a83fb83c2d1a$export$b3552e87a7c5c47b(config) {
936
+ return {
937
+ name: "sanity-tutorials",
938
+ component: (0, $a7c779803cabaa01$export$5f156cc357b8467f),
939
+ layout: config?.layout ?? {
940
+ width: "full"
941
+ }
942
+ };
943
+ }
944
+
945
+
946
+ const $9233cea927cb9637$var$strokeStyle = {
947
+ stroke: "currentColor",
948
+ strokeWidth: 1.2
949
+ };
950
+ const $9233cea927cb9637$var$DashboardIcon = ()=>/*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsxs)("svg", {
951
+ "data-sanity-icon": true,
952
+ viewBox: "0 0 25 25",
953
+ fill: "none",
954
+ xmlns: "http://www.w3.org/2000/svg",
955
+ preserveAspectRatio: "xMidYMid",
956
+ width: "1em",
957
+ height: "1em",
958
+ children: [
959
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("path", {
960
+ d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
961
+ style: $9233cea927cb9637$var$strokeStyle
962
+ }),
963
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("path", {
964
+ d: "M5.5 12.5H19.5",
965
+ style: $9233cea927cb9637$var$strokeStyle
966
+ }),
967
+ /*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)("path", {
968
+ d: "M14.5 19.5V12.5M10.5 12.5V5.5",
969
+ style: $9233cea927cb9637$var$strokeStyle
970
+ })
971
+ ]
972
+ });
973
+ const $9233cea927cb9637$export$dd097bc0a3a5adbd = (0, $7xGut$sanity.createPlugin)((config = {})=>{
974
+ const pluginConfig = {
975
+ layout: config.defaultLayout ?? {},
976
+ widgets: config.widgets ?? []
977
+ };
978
+ return {
979
+ name: "dashboard",
980
+ tools: (prev, context)=>{
981
+ return [
982
+ ...prev,
983
+ {
984
+ title: "Dashboard",
985
+ name: "dashboard",
986
+ icon: $9233cea927cb9637$var$DashboardIcon,
987
+ component: ()=>/*#__PURE__*/ (0, $7xGut$reactjsxruntime.jsx)((0, $7aac5747647866ab$export$fe82a520fc33e5f4), {
988
+ config: pluginConfig
989
+ })
990
+ },
991
+ ];
992
+ }
993
+ };
994
+ });
995
+ $parcel$exportWildcard(module.exports, $faefaad95e5fcca0$exports);
996
+ $parcel$exportWildcard(module.exports, $3e2e9c117db5b41e$exports);
997
+ $parcel$exportWildcard(module.exports, $16473bba5204ab4f$exports);
998
+ $parcel$exportWildcard(module.exports, $7997b902be105c46$exports);
999
+ $parcel$exportWildcard(module.exports, $1606a83fb83c2d1a$exports);
1000
+
1001
+
1002
+ //# sourceMappingURL=index.js.map