@stapel/listings-react 0.3.0 → 0.4.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/CHANGELOG.md +53 -0
  2. package/MODULE.md +26 -10
  3. package/README.md +33 -17
  4. package/dist/api/generated/schema.d.ts +127 -1
  5. package/dist/api/generated/schema.d.ts.map +1 -1
  6. package/dist/api/listingsApi.d.ts +35 -22
  7. package/dist/api/listingsApi.d.ts.map +1 -1
  8. package/dist/api/listingsApi.js +17 -0
  9. package/dist/api/listingsApi.js.map +1 -1
  10. package/dist/api/types.d.ts +43 -2
  11. package/dist/api/types.d.ts.map +1 -1
  12. package/dist/api/types.js.map +1 -1
  13. package/dist/default/ListingDetailPane.d.ts.map +1 -1
  14. package/dist/default/ListingDetailPane.js +1 -1
  15. package/dist/default/ListingDetailPane.js.map +1 -1
  16. package/dist/default/MyListingsPane.d.ts +24 -11
  17. package/dist/default/MyListingsPane.d.ts.map +1 -1
  18. package/dist/default/MyListingsPane.js +26 -10
  19. package/dist/default/MyListingsPane.js.map +1 -1
  20. package/dist/headless/MyListings.d.ts +27 -12
  21. package/dist/headless/MyListings.d.ts.map +1 -1
  22. package/dist/headless/MyListings.js +29 -7
  23. package/dist/headless/MyListings.js.map +1 -1
  24. package/dist/i18n/es.d.ts.map +1 -1
  25. package/dist/i18n/es.js +8 -3
  26. package/dist/i18n/es.js.map +1 -1
  27. package/dist/i18n/generated/errors.es.gen.d.ts +1 -1
  28. package/dist/i18n/generated/errors.es.gen.js +1 -1
  29. package/dist/i18n/generated/errors.gen.d.ts +6 -0
  30. package/dist/i18n/generated/errors.gen.d.ts.map +1 -1
  31. package/dist/i18n/generated/errors.gen.js +3 -0
  32. package/dist/i18n/generated/errors.gen.js.map +1 -1
  33. package/dist/i18n/generated/errors.ru.gen.d.ts +1 -1
  34. package/dist/i18n/generated/errors.ru.gen.js +1 -1
  35. package/dist/i18n/keys.d.ts +12 -2
  36. package/dist/i18n/keys.d.ts.map +1 -1
  37. package/dist/i18n/keys.js +18 -4
  38. package/dist/i18n/keys.js.map +1 -1
  39. package/dist/i18n/ru.d.ts.map +1 -1
  40. package/dist/i18n/ru.js +8 -3
  41. package/dist/i18n/ru.js.map +1 -1
  42. package/dist/index.d.ts +8 -6
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +8 -6
  45. package/dist/index.js.map +1 -1
  46. package/dist/model/mine.d.ts +44 -0
  47. package/dist/model/mine.d.ts.map +1 -0
  48. package/dist/model/mine.js +52 -0
  49. package/dist/model/mine.js.map +1 -0
  50. package/dist/model/mineSource.d.ts +39 -34
  51. package/dist/model/mineSource.d.ts.map +1 -1
  52. package/dist/model/mineSource.js +10 -41
  53. package/dist/model/mineSource.js.map +1 -1
  54. package/dist/model/mutations.d.ts.map +1 -1
  55. package/dist/model/mutations.js +11 -4
  56. package/dist/model/mutations.js.map +1 -1
  57. package/dist/model/queryKeys.d.ts +7 -2
  58. package/dist/model/queryKeys.d.ts.map +1 -1
  59. package/dist/model/queryKeys.js +2 -0
  60. package/dist/model/queryKeys.js.map +1 -1
  61. package/dist/model/status.d.ts +12 -31
  62. package/dist/model/status.d.ts.map +1 -1
  63. package/dist/model/status.js +44 -0
  64. package/dist/model/status.js.map +1 -1
  65. package/llms.txt +6 -4
  66. package/manifest.json +38 -6
  67. package/nav-manifest.json +1 -1
  68. package/package.json +4 -4
  69. package/src/analytics/generated/events.json +1 -1
  70. package/src/api/generated/schema.ts +127 -1
  71. package/src/api/listingsApi.ts +60 -21
  72. package/src/api/types.ts +46 -2
  73. package/src/default/ListingDetailPane.tsx +6 -1
  74. package/src/default/MyListingsPane.tsx +98 -34
  75. package/src/headless/MyListings.tsx +62 -22
  76. package/src/i18n/es.ts +11 -4
  77. package/src/i18n/generated/errors.es.gen.ts +1 -1
  78. package/src/i18n/generated/errors.gen.ts +3 -0
  79. package/src/i18n/generated/errors.json +9 -0
  80. package/src/i18n/generated/errors.ru.gen.ts +1 -1
  81. package/src/i18n/keys.ts +20 -5
  82. package/src/i18n/ru.ts +11 -4
  83. package/src/index.ts +16 -5
  84. package/src/model/mine.ts +70 -0
  85. package/src/model/mineSource.ts +46 -41
  86. package/src/model/mutations.ts +11 -4
  87. package/src/model/queryKeys.ts +9 -2
  88. package/src/model/status.ts +15 -0
@@ -49,12 +49,17 @@ export const listingsQueryKeys: {
49
49
  myFavorites(
50
50
  page: ListingPageKey
51
51
  ): readonly ["listings", "my", "favorites", ListingPageKey];
52
- /** The owner's own rows, per tab see `headless/MyListings.tsx` for why
53
- * this read goes through an injected source. */
52
+ /** The owner's own rows, per tab (`GET my/listings/?status=…`). */
54
53
  mine(
55
54
  tab: string,
56
55
  page: ListingPageKey
57
56
  ): readonly ["listings", "my", "listings", string, ListingPageKey];
57
+ /** The owner's rows no tab folds in — a takedown. A sibling of `mine` and
58
+ * not one of its tabs, because it answers a different question and must not
59
+ * be evicted when a tab pages. */
60
+ mineUntabbed(): readonly ["listings", "my", "listings", "untabbed"];
61
+ /** Every owner-row page, for an invalidation after a write. */
62
+ allMine(): readonly ["listings", "my", "listings"];
58
63
  /** `GET /{pk}/validate-draft/` — the dry run of a publish. */
59
64
  validateDraft(id: number): readonly ["listings", "validate-draft", number];
60
65
  /** Every favourites PAGE, for an invalidation after a toggle — the cursor
@@ -70,6 +75,8 @@ export const listingsQueryKeys: {
70
75
  myCounters: () => [ROOT, "my", "counters"],
71
76
  myFavorites: (page) => [ROOT, "my", "favorites", page],
72
77
  mine: (tab, page) => [ROOT, "my", "listings", tab, page],
78
+ mineUntabbed: () => [ROOT, "my", "listings", "untabbed"],
79
+ allMine: () => [ROOT, "my", "listings"],
73
80
  validateDraft: (id) => [ROOT, "validate-draft", id],
74
81
  allFavorites: () => [ROOT, "my", "favorites"],
75
82
  allLists: () => [ROOT, "list"],
@@ -29,6 +29,7 @@
29
29
  * asserts the whole 9 × 4 table, so a state added upstream is a red test and
30
30
  * not a bare enum value on a page.
31
31
  */
32
+ import { LISTING_STATUSES } from "../api/types.js";
32
33
  import type {
33
34
  ListingLifecycleStatus,
34
35
  ListingModerationStatus,
@@ -277,3 +278,17 @@ export function tabOf(
277
278
  }
278
279
  return undefined;
279
280
  }
281
+
282
+ /**
283
+ * The statuses no tab folds in — `blocked`, and nothing else today.
284
+ *
285
+ * DERIVED, not written down a second time: a status added upstream and left
286
+ * out of the counter groupings lands here automatically and gets shown, which
287
+ * is the opposite of what a hardcoded `["blocked"]` would do the day it goes
288
+ * stale. The dashboard renders these rows OUTSIDE the tabs (see
289
+ * `default/MyListingsPane.tsx`) rather than folding them into one, because a
290
+ * tab's rows and its `my/counters` badge have to describe the same set — and
291
+ * `my/counters` counts a takedown in no tab at all.
292
+ */
293
+ export const MY_LISTINGS_UNTABBED_STATUSES: readonly ListingLifecycleStatus[] =
294
+ LISTING_STATUSES.filter((status) => tabOf(status) === undefined);