@igstack/app-catalog-frontend-core 6.8.4 → 6.10.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 (88) hide show
  1. package/dist/esm/__tests__/modules/appCatalog/ui/detail/CommunitySection.feed.test.d.ts +0 -0
  2. package/dist/esm/__tests__/modules/appCatalog/ui/detail/CommunitySection.help.test.d.ts +0 -0
  3. package/dist/esm/__tests__/modules/appCatalog/ui/detail/CommunitySection.input.test.d.ts +0 -0
  4. package/dist/esm/__tests__/modules/appCatalog/ui/detail/composeComments.test.d.ts +1 -0
  5. package/dist/esm/__tests__/ui/detail/CommunityInput.test.d.ts +1 -0
  6. package/dist/esm/index.d.ts +1 -1
  7. package/dist/esm/modules/appCatalog/hooks/useUpdateApp.d.ts +8 -0
  8. package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js +22 -12
  9. package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js.map +1 -1
  10. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js +254 -232
  11. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js.map +1 -1
  12. package/dist/esm/modules/appCatalog/ui/detail/CommentsFeed.d.ts +17 -0
  13. package/dist/esm/modules/appCatalog/ui/detail/CommentsFeed.js +187 -0
  14. package/dist/esm/modules/appCatalog/ui/detail/CommentsFeed.js.map +1 -0
  15. package/dist/esm/modules/appCatalog/ui/detail/CommentsHelp.d.ts +9 -0
  16. package/dist/esm/modules/appCatalog/ui/detail/CommentsHelp.js +91 -0
  17. package/dist/esm/modules/appCatalog/ui/detail/CommentsHelp.js.map +1 -0
  18. package/dist/esm/modules/appCatalog/ui/detail/CommunityInput.d.ts +17 -0
  19. package/dist/esm/modules/appCatalog/ui/detail/CommunityInput.js +328 -0
  20. package/dist/esm/modules/appCatalog/ui/detail/CommunityInput.js.map +1 -0
  21. package/dist/esm/modules/appCatalog/ui/detail/CommunitySection.d.ts +15 -0
  22. package/dist/esm/modules/appCatalog/ui/detail/CommunitySection.js +26 -0
  23. package/dist/esm/modules/appCatalog/ui/detail/CommunitySection.js.map +1 -0
  24. package/dist/esm/modules/appCatalog/ui/detail/DetailTabs.d.ts +8 -19
  25. package/dist/esm/modules/appCatalog/ui/detail/DetailTabs.js +49 -37
  26. package/dist/esm/modules/appCatalog/ui/detail/DetailTabs.js.map +1 -1
  27. package/dist/esm/modules/appCatalog/ui/detail/communityDraft.d.ts +30 -0
  28. package/dist/esm/modules/appCatalog/ui/detail/communityDraft.js +50 -0
  29. package/dist/esm/modules/appCatalog/ui/detail/communityDraft.js.map +1 -0
  30. package/dist/esm/modules/appCatalog/ui/detail/communityError.d.ts +6 -0
  31. package/dist/esm/modules/appCatalog/ui/detail/communityError.js +8 -0
  32. package/dist/esm/modules/appCatalog/ui/detail/communityError.js.map +1 -0
  33. package/dist/esm/modules/appCatalog/ui/detail/composeComments.d.ts +27 -0
  34. package/dist/esm/modules/appCatalog/ui/detail/composeComments.js +66 -0
  35. package/dist/esm/modules/appCatalog/ui/detail/composeComments.js.map +1 -0
  36. package/dist/esm/modules/appCatalog/ui/detail/usePendingCount.d.ts +11 -0
  37. package/dist/esm/modules/appCatalog/ui/detail/usePendingCount.js +15 -0
  38. package/dist/esm/modules/appCatalog/ui/detail/usePendingCount.js.map +1 -0
  39. package/dist/esm/modules/extensions/features/resourceDetail.d.ts +54 -1
  40. package/dist/esm/modules/extensions/features/resourceDetail.js +4 -0
  41. package/dist/esm/modules/extensions/features/resourceDetail.js.map +1 -1
  42. package/dist/esm/modules/extensions/index.d.ts +20 -4
  43. package/dist/esm/modules/extensions/index.js +10 -4
  44. package/dist/esm/modules/extensions/index.js.map +1 -1
  45. package/dist/esm/modules/extensions/types.d.ts +1 -0
  46. package/dist/index.css +525 -49
  47. package/package.json +4 -4
  48. package/src/__tests__/modules/appCatalog/ui/catalog/AppDetailPanel.appSwitch.test.tsx +5 -2
  49. package/src/__tests__/modules/appCatalog/ui/catalog/AppDetailPanel.enter.test.tsx +5 -2
  50. package/src/__tests__/modules/appCatalog/ui/components/SubResourcesSection.adminColumn.test.tsx +41 -4
  51. package/src/__tests__/modules/appCatalog/ui/components/SubResourcesSection.test.tsx +34 -0
  52. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.background.test.tsx +9 -10
  53. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.behindThisCard.test.tsx +402 -0
  54. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.doorAndTabs.test.tsx +8 -4
  55. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.escape.test.tsx +5 -2
  56. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.knowMore.test.tsx +175 -0
  57. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.sectionOrder.test.tsx +5 -2
  58. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.subResourceTab.test.tsx +5 -2
  59. package/src/__tests__/modules/appCatalog/ui/detail/AppDetails.tags.test.tsx +5 -2
  60. package/src/__tests__/modules/appCatalog/ui/detail/CommunitySection.feed.test.tsx +281 -0
  61. package/src/__tests__/modules/appCatalog/ui/detail/CommunitySection.help.test.tsx +179 -0
  62. package/src/__tests__/modules/appCatalog/ui/detail/CommunitySection.input.test.tsx +423 -0
  63. package/src/__tests__/modules/appCatalog/ui/detail/composeComments.test.ts +170 -0
  64. package/src/__tests__/ui/detail/CommunityInput.test.tsx +39 -0
  65. package/src/index.css +525 -49
  66. package/src/index.tsx +2 -0
  67. package/src/modules/appCatalog/ui/components/SubResourcesSection.tsx +60 -36
  68. package/src/modules/appCatalog/ui/detail/AppDetails.tsx +310 -295
  69. package/src/modules/appCatalog/ui/detail/CommentsFeed.tsx +254 -0
  70. package/src/modules/appCatalog/ui/detail/CommentsHelp.tsx +102 -0
  71. package/src/modules/appCatalog/ui/detail/CommunityInput.tsx +419 -0
  72. package/src/modules/appCatalog/ui/detail/CommunitySection.tsx +41 -0
  73. package/src/modules/appCatalog/ui/detail/DetailTabs.tsx +77 -71
  74. package/src/modules/appCatalog/ui/detail/communityDraft.ts +80 -0
  75. package/src/modules/appCatalog/ui/detail/communityError.ts +10 -0
  76. package/src/modules/appCatalog/ui/detail/composeComments.ts +103 -0
  77. package/src/modules/appCatalog/ui/detail/usePendingCount.ts +26 -0
  78. package/src/modules/extensions/features/resourceDetail.ts +45 -1
  79. package/src/modules/extensions/index.ts +39 -2
  80. package/src/modules/extensions/types.ts +1 -0
  81. package/dist/esm/modules/appCatalog/ui/detail/FeedbackSection.d.ts +0 -13
  82. package/dist/esm/modules/appCatalog/ui/detail/FeedbackSection.js +0 -433
  83. package/dist/esm/modules/appCatalog/ui/detail/FeedbackSection.js.map +0 -1
  84. package/src/__tests__/modules/appCatalog/ui/detail/FeedbackSection.emptyState.test.tsx +0 -181
  85. package/src/__tests__/modules/appCatalog/ui/detail/FeedbackSection.reviewStatus.test.tsx +0 -131
  86. package/src/modules/appCatalog/ui/detail/FeedbackSection.tsx +0 -605
  87. /package/dist/esm/__tests__/modules/appCatalog/ui/detail/{FeedbackSection.emptyState.test.d.ts → AppDetails.behindThisCard.test.d.ts} +0 -0
  88. /package/dist/esm/__tests__/modules/appCatalog/ui/detail/{FeedbackSection.reviewStatus.test.d.ts → AppDetails.knowMore.test.d.ts} +0 -0
@@ -67,6 +67,16 @@ interface SubResourcesSectionProps {
67
67
  childrenLabel?: string
68
68
  }
69
69
 
70
+ /**
71
+ * The AWS account a child stands for, if it is one. `extra` is nullable on a
72
+ * served resource, so the optional chain is load-bearing: dereferencing it threw
73
+ * the moment anything typed into the filter met a child without it.
74
+ */
75
+ function awsAccountIdOf(sr: Resource): string | undefined {
76
+ return (sr.extra as Record<string, unknown> | null | undefined)
77
+ ?.awsAccountId as string | undefined
78
+ }
79
+
70
80
  function getTierBadgeVariant(
71
81
  tierSlug: string,
72
82
  ): 'default' | 'secondary' | 'destructive' | 'outline' {
@@ -105,6 +115,8 @@ interface SubResourceRowProps {
105
115
  * derived from `showAdminColumn` in one place above.
106
116
  */
107
117
  adminParent?: Resource
118
+ /** Whether the AWS Account column is rendered — `showAccountColumn` above. */
119
+ showAccount: boolean
108
120
  user: ReturnType<typeof usePluginUser>
109
121
  isHighlighted: boolean
110
122
  /** Set only when the body is virtualized: lets the virtualizer measure the row. */
@@ -133,6 +145,7 @@ function SubResourceRowBase({
133
145
  resource: sr,
134
146
  parentSlug,
135
147
  adminParent,
148
+ showAccount,
136
149
  user,
137
150
  isHighlighted,
138
151
  measureRef,
@@ -140,8 +153,7 @@ function SubResourceRowBase({
140
153
  }: SubResourceRowProps) {
141
154
  // Approvers are Person OR Group slugs; the badge resolves both.
142
155
  const approvers = [...new Set(sr.approverSlugs ?? [])]
143
- const accountId = (sr.extra as Record<string, unknown> | null | undefined)
144
- ?.awsAccountId as string | undefined
156
+ const accountId = awsAccountIdOf(sr)
145
157
 
146
158
  return (
147
159
  <TableRow
@@ -202,27 +214,29 @@ function SubResourceRowBase({
202
214
  <span className="text-muted-foreground">-</span>
203
215
  )}
204
216
  </TableCell>
205
- <TableCell>
206
- {!accountId ? (
207
- <span className="text-muted-foreground">—</span>
208
- ) : // The account id is what people copy; when the resource also
209
- // carries its own `appUrl` that is the console deep link for THAT
210
- // account, so the id doubles as the launch affordance.
211
- sr.appUrl ? (
212
- <a
213
- href={sr.appUrl}
214
- target="_blank"
215
- rel="noopener noreferrer"
216
- className="font-mono text-xs text-muted-foreground hover:text-primary hover:underline select-text"
217
- >
218
- {accountId}
219
- </a>
220
- ) : (
221
- <span className="font-mono text-xs text-muted-foreground select-text">
222
- {accountId}
223
- </span>
224
- )}
225
- </TableCell>
217
+ {showAccount && (
218
+ <TableCell>
219
+ {!accountId ? (
220
+ <span className="text-muted-foreground">—</span>
221
+ ) : // The account id is what people copy; when the resource also
222
+ // carries its own `appUrl` that is the console deep link for THAT
223
+ // account, so the id doubles as the launch affordance.
224
+ sr.appUrl ? (
225
+ <a
226
+ href={sr.appUrl}
227
+ target="_blank"
228
+ rel="noopener noreferrer"
229
+ className="font-mono text-xs text-muted-foreground hover:text-primary hover:underline select-text"
230
+ >
231
+ {accountId}
232
+ </a>
233
+ ) : (
234
+ <span className="font-mono text-xs text-muted-foreground select-text">
235
+ {accountId}
236
+ </span>
237
+ )}
238
+ </TableCell>
239
+ )}
226
240
  {adminParent !== undefined && (
227
241
  // `relative`, so a contribution can position something against the
228
242
  // cell — a resting-state glyph under a hover-revealed control, for
@@ -326,9 +340,19 @@ export function SubResourcesSection({
326
340
  // ONE flag for the header, the cells and the empty row's colSpan. Deriving it
327
341
  // separately per site is how a header appears over a column with no cells —
328
342
  // the parent check only guarded the cells at first, and the header rendered
329
- // anyway.
330
- const showAdminColumn =
331
- useSlotFilled('resourceSubResourceRowActions') && parent !== undefined
343
+ // anyway. The scope lets a plugin that serves only some parents keep the
344
+ // column off every other parent's table; no parent means nothing to decide.
345
+ const showAdminColumn = useSlotFilled(
346
+ 'resourceSubResourceRowActions',
347
+ parent ? { parent } : undefined,
348
+ )
349
+ // Same rule from the data side: only a family of AWS accounts has an account
350
+ // id to show. Decided on the UNFILTERED list, so typing a filter that happens
351
+ // to hide every account does not make the column jump.
352
+ const showAccountColumn = useMemo(
353
+ () => subResources.some((sr) => awsAccountIdOf(sr) !== undefined),
354
+ [subResources],
355
+ )
332
356
  const user = usePluginUser()
333
357
  // `?sub=<slug>` — the one sub-resource the user asked for, by clicking its row
334
358
  // in the search results. It wins over the query-seeded filter below: a query
@@ -436,13 +460,7 @@ export function SubResourcesSection({
436
460
  sr.displayName.toLowerCase().includes(q) ||
437
461
  (sr.aliases ?? []).some((a) => a.toLowerCase().includes(q)) ||
438
462
  (sr.description?.toLowerCase().includes(q) ?? false) ||
439
- // `extra` is nullable on a served resource, and the cast hid that:
440
- // dereferencing it threw a TypeError the moment anything typed into
441
- // this box met a child without it, taking the whole table down.
442
- (
443
- (sr.extra as Record<string, unknown> | null | undefined)
444
- ?.awsAccountId as string | undefined
445
- )?.includes(q) === true,
463
+ awsAccountIdOf(sr)?.includes(q) === true,
446
464
  )
447
465
  }
448
466
 
@@ -458,7 +476,9 @@ export function SubResourcesSection({
458
476
  // Keyed on the unfiltered size so a big table keeps one layout while it is
459
477
  // filtered below the threshold, rather than jumping as the user types.
460
478
  const fixedLayout = subResources.length > VIRTUALIZE_ABOVE
461
- const columnCount = showAdminColumn ? 6 : 5
479
+ // Name, Tier, Owner, Approvers, then the two optional columns.
480
+ const columnCount =
481
+ 4 + (showAccountColumn ? 1 : 0) + (showAdminColumn ? 1 : 0)
462
482
 
463
483
  if (subResources.length === 0) return null
464
484
 
@@ -563,7 +583,9 @@ export function SubResourcesSection({
563
583
  <TableHead className={fixedLayout ? 'w-[230px]' : undefined}>
564
584
  Approvers
565
585
  </TableHead>
566
- <TableHead className="w-[140px]">AWS Account</TableHead>
586
+ {showAccountColumn && (
587
+ <TableHead className="w-[140px]">AWS Account</TableHead>
588
+ )}
567
589
  {/* Only when something fills it: an empty column with a header and
568
590
  no cells is worse than no column, and the open-source build
569
591
  registers no plugins at all. */}
@@ -576,7 +598,7 @@ export function SubResourcesSection({
576
598
  {filtered.length === 0 ? (
577
599
  <TableRow>
578
600
  <TableCell
579
- colSpan={showAdminColumn ? 6 : 5}
601
+ colSpan={columnCount}
580
602
  className="text-center text-muted-foreground py-8"
581
603
  >
582
604
  No resources match your filters
@@ -596,6 +618,7 @@ export function SubResourcesSection({
596
618
  resource={sr}
597
619
  parentSlug={parentSlug}
598
620
  adminParent={showAdminColumn ? parent : undefined}
621
+ showAccount={showAccountColumn}
599
622
  user={user}
600
623
  isHighlighted={sr.slug === highlightSlug}
601
624
  measureRef={measureElement}
@@ -617,6 +640,7 @@ export function SubResourcesSection({
617
640
  // `showAdminColumn` already implies `parent !== undefined`,
618
641
  // so this cannot disagree with the header or the colSpan.
619
642
  adminParent={showAdminColumn ? parent : undefined}
643
+ showAccount={showAccountColumn}
620
644
  user={user}
621
645
  isHighlighted={sr.slug === highlightSlug}
622
646
  />