@burdenoff/microfe-store 2026.510.113

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 (141) hide show
  1. package/README.md +217 -0
  2. package/dist/StoreAdminRoot.d.ts +22 -0
  3. package/dist/StoreAdminRoot.js +23 -0
  4. package/dist/StoreAdminRoot.js.map +1 -0
  5. package/dist/StoreAdminRoutes.d.ts +9 -0
  6. package/dist/StoreAdminRoutes.js +69 -0
  7. package/dist/StoreAdminRoutes.js.map +1 -0
  8. package/dist/StoreRoot.d.ts +31 -0
  9. package/dist/StoreRoot.js +139 -0
  10. package/dist/StoreRoot.js.map +1 -0
  11. package/dist/StoreRoutes.d.ts +12 -0
  12. package/dist/StoreRoutes.js +285 -0
  13. package/dist/StoreRoutes.js.map +1 -0
  14. package/dist/components/InstallAppModal.d.ts +26 -0
  15. package/dist/components/InstallAppModal.js +287 -0
  16. package/dist/components/InstallAppModal.js.map +1 -0
  17. package/dist/components/RouteGuards.d.ts +17 -0
  18. package/dist/components/RouteGuards.js +26 -0
  19. package/dist/components/RouteGuards.js.map +1 -0
  20. package/dist/components/cart/CartDrawer.d.ts +35 -0
  21. package/dist/components/cart/CartDrawer.js +162 -0
  22. package/dist/components/cart/CartDrawer.js.map +1 -0
  23. package/dist/components/index.d.ts +9 -0
  24. package/dist/components/index.js +3 -0
  25. package/dist/components/marketplace/ProductCard.d.ts +18 -0
  26. package/dist/components/marketplace/ProductCard.js +2 -0
  27. package/dist/dev/main.d.ts +1 -0
  28. package/dist/generated/global-operations.d.ts +2012 -0
  29. package/dist/generated/global-operations.js +1444 -0
  30. package/dist/generated/global-operations.js.map +1 -0
  31. package/dist/generated/global-types.d.ts +20856 -0
  32. package/dist/generated/global-types.js +14 -0
  33. package/dist/generated/global-types.js.map +1 -0
  34. package/dist/generated/wspace-operations.d.ts +1 -0
  35. package/dist/generated/wspace-types.d.ts +53362 -0
  36. package/dist/hooks/index.d.ts +12 -0
  37. package/dist/hooks/useBackendCart.d.ts +73 -0
  38. package/dist/hooks/useBackendCart.js +171 -0
  39. package/dist/hooks/useBackendCart.js.map +1 -0
  40. package/dist/hooks/useCart.d.ts +62 -0
  41. package/dist/hooks/useCart.js +90 -0
  42. package/dist/hooks/useCart.js.map +1 -0
  43. package/dist/hooks/useInstallations.d.ts +43 -0
  44. package/dist/hooks/useInstallations.js +140 -0
  45. package/dist/hooks/useInstallations.js.map +1 -0
  46. package/dist/hooks/useOrders.d.ts +40 -0
  47. package/dist/hooks/useOrders.js +73 -0
  48. package/dist/hooks/useOrders.js.map +1 -0
  49. package/dist/hooks/useProductSearch.d.ts +22 -0
  50. package/dist/hooks/useProductSearch.js +59 -0
  51. package/dist/hooks/useProductSearch.js.map +1 -0
  52. package/dist/hooks/useStoreGraphQL.d.ts +475 -0
  53. package/dist/hooks/useStoreGraphQL.js +751 -0
  54. package/dist/hooks/useStoreGraphQL.js.map +1 -0
  55. package/dist/hooks/useStoreGraphQLWithContext.d.ts +48 -0
  56. package/dist/hooks/useStoreGraphQLWithContext.js +39 -0
  57. package/dist/hooks/useStoreGraphQLWithContext.js.map +1 -0
  58. package/dist/hooks/useStorePermissions.d.ts +63 -0
  59. package/dist/hooks/useStorePermissions.js +88 -0
  60. package/dist/hooks/useStorePermissions.js.map +1 -0
  61. package/dist/index.d.ts +44 -0
  62. package/dist/index.js +13 -0
  63. package/dist/pages/AdminDashboardPage.d.ts +3 -0
  64. package/dist/pages/AdminDashboardPage.js +491 -0
  65. package/dist/pages/AdminDashboardPage.js.map +1 -0
  66. package/dist/pages/AdminReviewModerationPage.d.ts +3 -0
  67. package/dist/pages/AdminReviewModerationPage.js +247 -0
  68. package/dist/pages/AdminReviewModerationPage.js.map +1 -0
  69. package/dist/pages/AdminStoresPage.d.ts +3 -0
  70. package/dist/pages/AdminStoresPage.js +442 -0
  71. package/dist/pages/AdminStoresPage.js.map +1 -0
  72. package/dist/pages/AdminSubmissionsQueuePage.d.ts +3 -0
  73. package/dist/pages/AdminSubmissionsQueuePage.js +387 -0
  74. package/dist/pages/AdminSubmissionsQueuePage.js.map +1 -0
  75. package/dist/pages/AppDetailPage.d.ts +3 -0
  76. package/dist/pages/AppDetailPage.js +166 -0
  77. package/dist/pages/AppDetailPage.js.map +1 -0
  78. package/dist/pages/AppSettingsPage.d.ts +3 -0
  79. package/dist/pages/AppSettingsPage.js +100 -0
  80. package/dist/pages/AppSettingsPage.js.map +1 -0
  81. package/dist/pages/CartPage.d.ts +8 -0
  82. package/dist/pages/CartPage.js +259 -0
  83. package/dist/pages/CartPage.js.map +1 -0
  84. package/dist/pages/InstalledAppsPage.d.ts +8 -0
  85. package/dist/pages/InstalledAppsPage.js +290 -0
  86. package/dist/pages/InstalledAppsPage.js.map +1 -0
  87. package/dist/pages/MarketplaceHomePage.d.ts +3 -0
  88. package/dist/pages/MarketplaceHomePage.js +1118 -0
  89. package/dist/pages/MarketplaceHomePage.js.map +1 -0
  90. package/dist/pages/MyLicensesPage.d.ts +3 -0
  91. package/dist/pages/MyLicensesPage.js +146 -0
  92. package/dist/pages/MyLicensesPage.js.map +1 -0
  93. package/dist/pages/OrderConfirmationPage.d.ts +3 -0
  94. package/dist/pages/OrderConfirmationPage.js +178 -0
  95. package/dist/pages/OrderConfirmationPage.js.map +1 -0
  96. package/dist/pages/OrdersPage.d.ts +8 -0
  97. package/dist/pages/OrdersPage.js +358 -0
  98. package/dist/pages/OrdersPage.js.map +1 -0
  99. package/dist/pages/ProductCategoryPage.d.ts +3 -0
  100. package/dist/pages/ProductCategoryPage.js +83 -0
  101. package/dist/pages/ProductCategoryPage.js.map +1 -0
  102. package/dist/pages/ProductDetailPage.d.ts +8 -0
  103. package/dist/pages/ProductDetailPage.js +1205 -0
  104. package/dist/pages/ProductDetailPage.js.map +1 -0
  105. package/dist/pages/ProductReviewsPage.d.ts +3 -0
  106. package/dist/pages/ProductReviewsPage.js +86 -0
  107. package/dist/pages/ProductReviewsPage.js.map +1 -0
  108. package/dist/pages/PublisherDashboardPage.d.ts +3 -0
  109. package/dist/pages/PublisherDashboardPage.js +154 -0
  110. package/dist/pages/PublisherDashboardPage.js.map +1 -0
  111. package/dist/pages/PublisherRevenuePage.d.ts +3 -0
  112. package/dist/pages/PublisherRevenuePage.js +138 -0
  113. package/dist/pages/PublisherRevenuePage.js.map +1 -0
  114. package/dist/pages/PublisherSubmissionsPage.d.ts +3 -0
  115. package/dist/pages/PublisherSubmissionsPage.js +174 -0
  116. package/dist/pages/PublisherSubmissionsPage.js.map +1 -0
  117. package/dist/pages/PublisherSubmitPage.d.ts +3 -0
  118. package/dist/pages/PublisherSubmitPage.js +224 -0
  119. package/dist/pages/PublisherSubmitPage.js.map +1 -0
  120. package/dist/pages/SearchResultsPage.d.ts +3 -0
  121. package/dist/pages/SearchResultsPage.js +125 -0
  122. package/dist/pages/SearchResultsPage.js.map +1 -0
  123. package/dist/pages/StoresPage.d.ts +3 -0
  124. package/dist/pages/StoresPage.js +154 -0
  125. package/dist/pages/StoresPage.js.map +1 -0
  126. package/dist/providers/StoreProvider.d.ts +38 -0
  127. package/dist/providers/StoreProvider.js +51 -0
  128. package/dist/providers/StoreProvider.js.map +1 -0
  129. package/dist/store/storeStore.d.ts +69 -0
  130. package/dist/store/storeStore.js +68 -0
  131. package/dist/store/storeStore.js.map +1 -0
  132. package/dist/translations/en.d.ts +518 -0
  133. package/dist/translations/en.js +514 -0
  134. package/dist/translations/en.js.map +1 -0
  135. package/dist/types/index.d.ts +575 -0
  136. package/dist/utils/index.d.ts +67 -0
  137. package/dist/utils/index.js +114 -0
  138. package/dist/utils/index.js.map +1 -0
  139. package/dist/utils/nativeBridge.d.ts +2 -0
  140. package/dist/utils/nativeBridge.js +2 -0
  141. package/package.json +105 -0
@@ -0,0 +1,285 @@
1
+ import { useStore as e } from "./providers/StoreProvider.js";
2
+ import { STORE_PERMISSIONS as t, useStorePermissions as n } from "./hooks/useStorePermissions.js";
3
+ import { AccessDenied as r, PageLoadingFallback as i } from "./components/RouteGuards.js";
4
+ import { MarketplaceHomePage as a } from "./pages/MarketplaceHomePage.js";
5
+ import { Suspense as o, lazy as s } from "react";
6
+ import { FeatureGate as c } from "@burdenoff/fe-libs/shared/feature-flags";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ import { Navigate as d, Route as f, Routes as p } from "react-router-dom";
9
+ //#region src/StoreRoutes.tsx
10
+ var m = s(() => import("./pages/InstalledAppsPage.js").then((e) => ({ default: e.InstalledAppsPage }))), h = s(() => import("./pages/ProductDetailPage.js").then((e) => ({ default: e.ProductDetailPage }))), g = s(() => import("./pages/CartPage.js").then((e) => ({ default: e.CartPage }))), _ = s(() => import("./pages/OrdersPage.js").then((e) => ({ default: e.OrdersPage }))), v = s(() => import("./pages/PublisherSubmitPage.js").then((e) => ({ default: e.PublisherSubmitPage }))), y = s(() => import("./pages/MyLicensesPage.js").then((e) => ({ default: e.MyLicensesPage }))), b = s(() => import("./pages/OrderConfirmationPage.js").then((e) => ({ default: e.OrderConfirmationPage }))), x = s(() => import("./pages/PublisherDashboardPage.js").then((e) => ({ default: e.PublisherDashboardPage }))), S = s(() => import("./pages/PublisherSubmissionsPage.js").then((e) => ({ default: e.PublisherSubmissionsPage }))), C = s(() => import("./pages/PublisherRevenuePage.js").then((e) => ({ default: e.PublisherRevenuePage }))), w = s(() => import("./pages/ProductCategoryPage.js").then((e) => ({ default: e.ProductCategoryPage }))), T = s(() => import("./pages/SearchResultsPage.js").then((e) => ({ default: e.SearchResultsPage }))), E = s(() => import("./pages/AppDetailPage.js").then((e) => ({ default: e.AppDetailPage }))), D = s(() => import("./pages/AppSettingsPage.js").then((e) => ({ default: e.AppSettingsPage }))), O = s(() => import("./pages/ProductReviewsPage.js").then((e) => ({ default: e.ProductReviewsPage }))), k = s(() => import("./pages/StoresPage.js").then((e) => ({ default: e.StoresPage })));
11
+ function A({ title: e, featureFlag: t }) {
12
+ return /* @__PURE__ */ l("div", {
13
+ className: "flex min-h-[400px] items-center justify-center p-6",
14
+ children: /* @__PURE__ */ u("div", {
15
+ className: "max-w-md rounded-lg border border-border bg-card p-6 text-center shadow-sm",
16
+ children: [/* @__PURE__ */ u("h2", {
17
+ className: "text-lg font-semibold text-foreground",
18
+ children: [e, " is not enabled"]
19
+ }), /* @__PURE__ */ u("p", {
20
+ className: "mt-2 text-sm text-muted-foreground",
21
+ children: [
22
+ "Ask an administrator to enable the ",
23
+ /* @__PURE__ */ l("span", {
24
+ className: "font-mono",
25
+ children: t
26
+ }),
27
+ " ",
28
+ "feature flag for this organization."
29
+ ]
30
+ })]
31
+ })
32
+ });
33
+ }
34
+ function j({ title: e, featureFlag: t, allowed: n, isLoading: a, children: o }) {
35
+ return a ? /* @__PURE__ */ l(i, {}) : /* @__PURE__ */ l(c, {
36
+ flag: t,
37
+ defaultValue: !0,
38
+ fallback: /* @__PURE__ */ l(A, {
39
+ title: e,
40
+ featureFlag: t
41
+ }),
42
+ children: n ? o : /* @__PURE__ */ l(r, {})
43
+ });
44
+ }
45
+ var M = () => {
46
+ let { basePath: r } = e(), { permissions: s, hasPermission: c, isLoading: A } = n();
47
+ return /* @__PURE__ */ u(p, { children: [
48
+ /* @__PURE__ */ l(f, {
49
+ index: !0,
50
+ element: /* @__PURE__ */ l(d, {
51
+ to: "marketplace",
52
+ replace: !0
53
+ })
54
+ }),
55
+ /* @__PURE__ */ l(f, {
56
+ path: "marketplace",
57
+ element: /* @__PURE__ */ l(j, {
58
+ title: "Marketplace",
59
+ featureFlag: "store.marketplace",
60
+ allowed: s.canBrowse,
61
+ isLoading: A,
62
+ children: /* @__PURE__ */ l(a, {})
63
+ })
64
+ }),
65
+ /* @__PURE__ */ l(f, {
66
+ path: "marketplace/category/:categorySlug",
67
+ element: /* @__PURE__ */ l(j, {
68
+ title: "Marketplace",
69
+ featureFlag: "store.marketplace",
70
+ allowed: s.canBrowse,
71
+ isLoading: A,
72
+ children: /* @__PURE__ */ l(o, {
73
+ fallback: /* @__PURE__ */ l(i, {}),
74
+ children: /* @__PURE__ */ l(w, {})
75
+ })
76
+ })
77
+ }),
78
+ /* @__PURE__ */ l(f, {
79
+ path: "marketplace/search",
80
+ element: /* @__PURE__ */ l(j, {
81
+ title: "Marketplace",
82
+ featureFlag: "store.marketplace",
83
+ allowed: s.canBrowse,
84
+ isLoading: A,
85
+ children: /* @__PURE__ */ l(o, {
86
+ fallback: /* @__PURE__ */ l(i, {}),
87
+ children: /* @__PURE__ */ l(T, {})
88
+ })
89
+ })
90
+ }),
91
+ /* @__PURE__ */ l(f, {
92
+ path: "marketplace/product/:productId",
93
+ element: /* @__PURE__ */ l(j, {
94
+ title: "Marketplace",
95
+ featureFlag: "store.marketplace",
96
+ allowed: s.canBrowse,
97
+ isLoading: A,
98
+ children: /* @__PURE__ */ l(o, {
99
+ fallback: /* @__PURE__ */ l(i, {}),
100
+ children: /* @__PURE__ */ l(h, {})
101
+ })
102
+ })
103
+ }),
104
+ /* @__PURE__ */ l(f, {
105
+ path: "cart",
106
+ element: /* @__PURE__ */ l(j, {
107
+ title: "Cart",
108
+ featureFlag: "store.cart",
109
+ allowed: s.canPurchase,
110
+ isLoading: A,
111
+ children: /* @__PURE__ */ l(o, {
112
+ fallback: /* @__PURE__ */ l(i, {}),
113
+ children: /* @__PURE__ */ l(g, {})
114
+ })
115
+ })
116
+ }),
117
+ /* @__PURE__ */ l(f, {
118
+ path: "orders/:orderId/confirmation",
119
+ element: /* @__PURE__ */ l(j, {
120
+ title: "Order confirmation",
121
+ featureFlag: "store.orders",
122
+ allowed: s.canPurchase,
123
+ isLoading: A,
124
+ children: /* @__PURE__ */ l(o, {
125
+ fallback: /* @__PURE__ */ l(i, {}),
126
+ children: /* @__PURE__ */ l(b, {})
127
+ })
128
+ })
129
+ }),
130
+ /* @__PURE__ */ l(f, {
131
+ path: "orders",
132
+ element: /* @__PURE__ */ l(j, {
133
+ title: "Orders",
134
+ featureFlag: "store.orders",
135
+ allowed: s.canPurchase,
136
+ isLoading: A,
137
+ children: /* @__PURE__ */ l(o, {
138
+ fallback: /* @__PURE__ */ l(i, {}),
139
+ children: /* @__PURE__ */ l(_, {})
140
+ })
141
+ })
142
+ }),
143
+ /* @__PURE__ */ l(f, {
144
+ path: "installed",
145
+ element: /* @__PURE__ */ l(j, {
146
+ title: "Installed apps",
147
+ featureFlag: "store.installed",
148
+ allowed: s.canInstall,
149
+ isLoading: A,
150
+ children: /* @__PURE__ */ l(o, {
151
+ fallback: /* @__PURE__ */ l(i, {}),
152
+ children: /* @__PURE__ */ l(m, {})
153
+ })
154
+ })
155
+ }),
156
+ /* @__PURE__ */ l(f, {
157
+ path: "installed/:installationId",
158
+ element: /* @__PURE__ */ l(j, {
159
+ title: "Installed apps",
160
+ featureFlag: "store.installed",
161
+ allowed: s.canInstall,
162
+ isLoading: A,
163
+ children: /* @__PURE__ */ l(o, {
164
+ fallback: /* @__PURE__ */ l(i, {}),
165
+ children: /* @__PURE__ */ l(E, {})
166
+ })
167
+ })
168
+ }),
169
+ /* @__PURE__ */ l(f, {
170
+ path: "installed/:installationId/settings",
171
+ element: /* @__PURE__ */ l(j, {
172
+ title: "Installed apps",
173
+ featureFlag: "store.installed",
174
+ allowed: s.canInstall,
175
+ isLoading: A,
176
+ children: /* @__PURE__ */ l(o, {
177
+ fallback: /* @__PURE__ */ l(i, {}),
178
+ children: /* @__PURE__ */ l(D, {})
179
+ })
180
+ })
181
+ }),
182
+ /* @__PURE__ */ l(f, {
183
+ path: "licenses",
184
+ element: /* @__PURE__ */ l(j, {
185
+ title: "Licenses",
186
+ featureFlag: "store.licenses",
187
+ allowed: s.canManageLicenses,
188
+ isLoading: A,
189
+ children: /* @__PURE__ */ l(o, {
190
+ fallback: /* @__PURE__ */ l(i, {}),
191
+ children: /* @__PURE__ */ l(y, {})
192
+ })
193
+ })
194
+ }),
195
+ /* @__PURE__ */ l(f, {
196
+ path: "stores",
197
+ element: /* @__PURE__ */ l(j, {
198
+ title: "Stores",
199
+ featureFlag: "store.stores",
200
+ allowed: s.canBrowse,
201
+ isLoading: A,
202
+ children: /* @__PURE__ */ l(o, {
203
+ fallback: /* @__PURE__ */ l(i, {}),
204
+ children: /* @__PURE__ */ l(k, {})
205
+ })
206
+ })
207
+ }),
208
+ /* @__PURE__ */ l(f, {
209
+ path: "publisher",
210
+ element: /* @__PURE__ */ l(j, {
211
+ title: "Publisher portal",
212
+ featureFlag: "store.publisher-portal",
213
+ allowed: s.canPublish,
214
+ isLoading: A,
215
+ children: /* @__PURE__ */ l(o, {
216
+ fallback: /* @__PURE__ */ l(i, {}),
217
+ children: /* @__PURE__ */ l(x, {})
218
+ })
219
+ })
220
+ }),
221
+ /* @__PURE__ */ l(f, {
222
+ path: "publisher/submit",
223
+ element: /* @__PURE__ */ l(j, {
224
+ title: "Publisher portal",
225
+ featureFlag: "store.publisher-portal",
226
+ allowed: s.canPublish,
227
+ isLoading: A,
228
+ children: /* @__PURE__ */ l(o, {
229
+ fallback: /* @__PURE__ */ l(i, {}),
230
+ children: /* @__PURE__ */ l(v, {})
231
+ })
232
+ })
233
+ }),
234
+ /* @__PURE__ */ l(f, {
235
+ path: "publisher/submissions",
236
+ element: /* @__PURE__ */ l(j, {
237
+ title: "Publisher portal",
238
+ featureFlag: "store.publisher-portal",
239
+ allowed: s.canPublish,
240
+ isLoading: A,
241
+ children: /* @__PURE__ */ l(o, {
242
+ fallback: /* @__PURE__ */ l(i, {}),
243
+ children: /* @__PURE__ */ l(S, {})
244
+ })
245
+ })
246
+ }),
247
+ /* @__PURE__ */ l(f, {
248
+ path: "publisher/revenue",
249
+ element: /* @__PURE__ */ l(j, {
250
+ title: "Publisher revenue",
251
+ featureFlag: "store.publisher-portal.revenue",
252
+ allowed: c(t.EARNINGS_READ),
253
+ isLoading: A,
254
+ children: /* @__PURE__ */ l(o, {
255
+ fallback: /* @__PURE__ */ l(i, {}),
256
+ children: /* @__PURE__ */ l(C, {})
257
+ })
258
+ })
259
+ }),
260
+ /* @__PURE__ */ l(f, {
261
+ path: "publisher/product/:productId/reviews",
262
+ element: /* @__PURE__ */ l(j, {
263
+ title: "Publisher portal",
264
+ featureFlag: "store.publisher-portal",
265
+ allowed: s.canPublish,
266
+ isLoading: A,
267
+ children: /* @__PURE__ */ l(o, {
268
+ fallback: /* @__PURE__ */ l(i, {}),
269
+ children: /* @__PURE__ */ l(O, {})
270
+ })
271
+ })
272
+ }),
273
+ /* @__PURE__ */ l(f, {
274
+ path: "*",
275
+ element: /* @__PURE__ */ l(d, {
276
+ to: `${r}/marketplace`,
277
+ replace: !0
278
+ })
279
+ })
280
+ ] });
281
+ };
282
+ //#endregion
283
+ export { M as StoreRoutes };
284
+
285
+ //# sourceMappingURL=StoreRoutes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoreRoutes.js","names":[],"sources":["../src/StoreRoutes.tsx"],"sourcesContent":["import { lazy, Suspense, type FC, type ReactNode } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useStore } from './providers/StoreProvider';\nimport { useStorePermissions, STORE_PERMISSIONS } from './hooks/useStorePermissions';\nimport { AccessDenied, PageLoadingFallback } from './components/RouteGuards';\n\n// Eager loaded - main entry point\nimport { MarketplaceHomePage } from './pages/MarketplaceHomePage';\n\n// Lazy loaded pages\nconst InstalledAppsPage = lazy(() =>\n import('./pages/InstalledAppsPage').then((m) => ({ default: m.InstalledAppsPage }))\n);\nconst ProductDetailPage = lazy(() =>\n import('./pages/ProductDetailPage').then((m) => ({ default: m.ProductDetailPage }))\n);\nconst CartPage = lazy(() => import('./pages/CartPage').then((m) => ({ default: m.CartPage })));\nconst OrdersPage = lazy(() =>\n import('./pages/OrdersPage').then((m) => ({ default: m.OrdersPage }))\n);\nconst PublisherSubmitPage = lazy(() =>\n import('./pages/PublisherSubmitPage').then((m) => ({ default: m.PublisherSubmitPage }))\n);\nconst MyLicensesPage = lazy(() =>\n import('./pages/MyLicensesPage').then((m) => ({ default: m.MyLicensesPage }))\n);\nconst OrderConfirmationPage = lazy(() =>\n import('./pages/OrderConfirmationPage').then((m) => ({ default: m.OrderConfirmationPage }))\n);\nconst PublisherDashboardPage = lazy(() =>\n import('./pages/PublisherDashboardPage').then((m) => ({ default: m.PublisherDashboardPage }))\n);\nconst PublisherSubmissionsPage = lazy(() =>\n import('./pages/PublisherSubmissionsPage').then((m) => ({ default: m.PublisherSubmissionsPage }))\n);\nconst PublisherRevenuePage = lazy(() =>\n import('./pages/PublisherRevenuePage').then((m) => ({ default: m.PublisherRevenuePage }))\n);\nconst ProductCategoryPage = lazy(() =>\n import('./pages/ProductCategoryPage').then((m) => ({ default: m.ProductCategoryPage }))\n);\nconst SearchResultsPage = lazy(() =>\n import('./pages/SearchResultsPage').then((m) => ({ default: m.SearchResultsPage }))\n);\nconst AppDetailPage = lazy(() =>\n import('./pages/AppDetailPage').then((m) => ({ default: m.AppDetailPage }))\n);\nconst AppSettingsPage = lazy(() =>\n import('./pages/AppSettingsPage').then((m) => ({ default: m.AppSettingsPage }))\n);\nconst ProductReviewsPage = lazy(() =>\n import('./pages/ProductReviewsPage').then((m) => ({ default: m.ProductReviewsPage }))\n);\nconst StoresPage = lazy(() =>\n import('./pages/StoresPage').then((m) => ({ default: m.StoresPage }))\n);\n\nfunction FeatureDisabled({ title, featureFlag }: { title: string; featureFlag: string }) {\n return (\n <div className=\"flex min-h-[400px] items-center justify-center p-6\">\n <div className=\"max-w-md rounded-lg border border-border bg-card p-6 text-center shadow-sm\">\n <h2 className=\"text-lg font-semibold text-foreground\">{title} is not enabled</h2>\n <p className=\"mt-2 text-sm text-muted-foreground\">\n Ask an administrator to enable the <span className=\"font-mono\">{featureFlag}</span>{' '}\n feature flag for this organization.\n </p>\n </div>\n </div>\n );\n}\n\ninterface StoreRouteGateProps {\n title: string;\n featureFlag: string;\n allowed: boolean;\n isLoading: boolean;\n children: ReactNode;\n}\n\nfunction StoreRouteGate({ title, featureFlag, allowed, isLoading, children }: StoreRouteGateProps) {\n if (isLoading) {\n return <PageLoadingFallback />;\n }\n return (\n <FeatureGate\n flag={featureFlag}\n defaultValue\n fallback={<FeatureDisabled title={title} featureFlag={featureFlag} />}\n >\n {allowed ? children : <AccessDenied />}\n </FeatureGate>\n );\n}\n\n/**\n * StoreRoutes component\n *\n * Internal routing for the Store microfrontend. Every route is gated by both\n * a live feature flag (via FeatureGate) and an RBAC permission check so that\n * features can be toggled per-org without a deployment.\n *\n * Flag namespace: store.*\n */\nexport const StoreRoutes: FC = () => {\n const { basePath } = useStore();\n const { permissions, hasPermission, isLoading } = useStorePermissions();\n\n return (\n <Routes>\n {/* Default redirect */}\n <Route index element={<Navigate to=\"marketplace\" replace />} />\n\n {/* Marketplace */}\n <Route\n path=\"marketplace\"\n element={\n <StoreRouteGate\n title=\"Marketplace\"\n featureFlag=\"store.marketplace\"\n allowed={permissions.canBrowse}\n isLoading={isLoading}\n >\n <MarketplaceHomePage />\n </StoreRouteGate>\n }\n />\n <Route\n path=\"marketplace/category/:categorySlug\"\n element={\n <StoreRouteGate\n title=\"Marketplace\"\n featureFlag=\"store.marketplace\"\n allowed={permissions.canBrowse}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <ProductCategoryPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"marketplace/search\"\n element={\n <StoreRouteGate\n title=\"Marketplace\"\n featureFlag=\"store.marketplace\"\n allowed={permissions.canBrowse}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <SearchResultsPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"marketplace/product/:productId\"\n element={\n <StoreRouteGate\n title=\"Marketplace\"\n featureFlag=\"store.marketplace\"\n allowed={permissions.canBrowse}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <ProductDetailPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Cart */}\n <Route\n path=\"cart\"\n element={\n <StoreRouteGate\n title=\"Cart\"\n featureFlag=\"store.cart\"\n allowed={permissions.canPurchase}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <CartPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Orders */}\n <Route\n path=\"orders/:orderId/confirmation\"\n element={\n <StoreRouteGate\n title=\"Order confirmation\"\n featureFlag=\"store.orders\"\n allowed={permissions.canPurchase}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <OrderConfirmationPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"orders\"\n element={\n <StoreRouteGate\n title=\"Orders\"\n featureFlag=\"store.orders\"\n allowed={permissions.canPurchase}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <OrdersPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Installed Apps */}\n <Route\n path=\"installed\"\n element={\n <StoreRouteGate\n title=\"Installed apps\"\n featureFlag=\"store.installed\"\n allowed={permissions.canInstall}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <InstalledAppsPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"installed/:installationId\"\n element={\n <StoreRouteGate\n title=\"Installed apps\"\n featureFlag=\"store.installed\"\n allowed={permissions.canInstall}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <AppDetailPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"installed/:installationId/settings\"\n element={\n <StoreRouteGate\n title=\"Installed apps\"\n featureFlag=\"store.installed\"\n allowed={permissions.canInstall}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <AppSettingsPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Licenses */}\n <Route\n path=\"licenses\"\n element={\n <StoreRouteGate\n title=\"Licenses\"\n featureFlag=\"store.licenses\"\n allowed={permissions.canManageLicenses}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <MyLicensesPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Multi-store browsing */}\n <Route\n path=\"stores\"\n element={\n <StoreRouteGate\n title=\"Stores\"\n featureFlag=\"store.stores\"\n allowed={permissions.canBrowse}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <StoresPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Publisher Portal */}\n <Route\n path=\"publisher\"\n element={\n <StoreRouteGate\n title=\"Publisher portal\"\n featureFlag=\"store.publisher-portal\"\n allowed={permissions.canPublish}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <PublisherDashboardPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"publisher/submit\"\n element={\n <StoreRouteGate\n title=\"Publisher portal\"\n featureFlag=\"store.publisher-portal\"\n allowed={permissions.canPublish}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <PublisherSubmitPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"publisher/submissions\"\n element={\n <StoreRouteGate\n title=\"Publisher portal\"\n featureFlag=\"store.publisher-portal\"\n allowed={permissions.canPublish}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <PublisherSubmissionsPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"publisher/revenue\"\n element={\n <StoreRouteGate\n title=\"Publisher revenue\"\n featureFlag=\"store.publisher-portal.revenue\"\n allowed={hasPermission(STORE_PERMISSIONS.EARNINGS_READ)}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <PublisherRevenuePage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n <Route\n path=\"publisher/product/:productId/reviews\"\n element={\n <StoreRouteGate\n title=\"Publisher portal\"\n featureFlag=\"store.publisher-portal\"\n allowed={permissions.canPublish}\n isLoading={isLoading}\n >\n <Suspense fallback={<PageLoadingFallback />}>\n <ProductReviewsPage />\n </Suspense>\n </StoreRouteGate>\n }\n />\n\n {/* Catch-all redirect */}\n <Route path=\"*\" element={<Navigate to={`${basePath}/marketplace`} replace />} />\n </Routes>\n );\n};\n"],"mappings":";;;;;;;;;AAWA,IAAM,IAAoB,QACxB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACpF,EACK,IAAoB,QACxB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACpF,EACK,IAAW,QAAW,OAAO,uBAAoB,MAAM,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EACxF,IAAa,QACjB,OAAO,yBAAsB,MAAM,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CACtE,EACK,IAAsB,QAC1B,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,CACxF,EACK,IAAiB,QACrB,OAAO,6BAA0B,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAC9E,EACK,IAAwB,QAC5B,OAAO,oCAAiC,MAAM,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAC5F,EACK,IAAyB,QAC7B,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC9F,EACK,IAA2B,QAC/B,OAAO,uCAAoC,MAAM,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAClG,EACK,IAAuB,QAC3B,OAAO,mCAAgC,MAAM,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAC1F,EACK,IAAsB,QAC1B,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,CACxF,EACK,IAAoB,QACxB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACpF,EACK,IAAgB,QACpB,OAAO,4BAAyB,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,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FC } from 'react';
2
+
3
+ export interface AppInfo {
4
+ id: string;
5
+ name: string;
6
+ slug?: string;
7
+ icon?: string;
8
+ type?: string;
9
+ version?: string;
10
+ }
11
+ interface InstallAppModalProps {
12
+ isOpen: boolean;
13
+ onClose: () => void;
14
+ app: AppInfo;
15
+ orderId?: string | null;
16
+ purchaseState?: 'free' | 'purchased';
17
+ onInstallSuccess?: (workspaceId: string, workspaceName: string) => void;
18
+ onInstallError?: (error: Error) => void;
19
+ }
20
+ /**
21
+ * InstallAppModal component
22
+ *
23
+ * Modal for selecting a workspace to install an app into
24
+ */
25
+ export declare const InstallAppModal: FC<InstallAppModalProps>;
26
+ export {};
@@ -0,0 +1,287 @@
1
+ import { useStore as e } from "../providers/StoreProvider.js";
2
+ import { useCallback as t, useEffect as n, useState as r } from "react";
3
+ import { AlertCircle as i, Building2 as a, CheckCircle as o, Info as s, Loader2 as c, User as l, X as u } from "lucide-react";
4
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
+ import { graphqlFetch as m } from "@burdenoff/fe-libs/shared/graphql";
6
+ //#region src/components/InstallAppModal.tsx
7
+ var h = "query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }", g = "mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }", _ = "mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }", v = "mutation InstallPurchasedApp($orderId: ID, $productId: String!, $workspaceId: String!) { installPurchasedApp(orderId: $orderId, productId: $productId, workspaceId: $workspaceId) { success alreadyInstalled installation { id productId workspaceId status version } error message } }", y = "mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }", b = new Set([
8
+ "VIBEMODULE",
9
+ "NODE",
10
+ "CONSOLE",
11
+ "DASHBOARD",
12
+ "PARSER",
13
+ "DATASINK"
14
+ ]);
15
+ function x(i) {
16
+ let { authToken: a } = e(), [o, s] = r([]), [c, l] = r(!1), [u, d] = r(null), f = t(async () => {
17
+ if (!i) {
18
+ l(!0), d(null);
19
+ try {
20
+ let e = await m({
21
+ gateway: "global",
22
+ query: h,
23
+ authToken: a || void 0
24
+ });
25
+ if (e.errors?.length) throw Error(e.errors[0]?.message ?? "GraphQL error");
26
+ s(e.data?.myWorkspaces?.items || []);
27
+ } catch (e) {
28
+ d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch workspaces"));
29
+ } finally {
30
+ l(!1);
31
+ }
32
+ }
33
+ }, [a, i]);
34
+ return n(() => {
35
+ f();
36
+ }, [f]), {
37
+ workspaces: o,
38
+ loading: c,
39
+ error: u,
40
+ refetch: f
41
+ };
42
+ }
43
+ var S = ({ isOpen: t, onClose: h, app: S, orderId: C, purchaseState: w = "free", onInstallSuccess: T, onInstallError: E }) => {
44
+ let { authToken: D, user: O } = e(), [k, A] = r(null), [j, M] = r(!1), [N, P] = r(null), [F, I] = r(null), { workspaces: L, loading: R, error: z } = x(!t);
45
+ n(() => {
46
+ t && (A(null), P(null), I(null));
47
+ }, [t]);
48
+ let B = L.filter((e) => e.status === "ACTIVE"), V = async () => {
49
+ if (!k) return;
50
+ let e = B.find((e) => e.id === k);
51
+ if (!e) return;
52
+ let t = O?.id;
53
+ M(!0), P(null), I(null);
54
+ try {
55
+ if (!C && w !== "purchased") {
56
+ if (!t) throw Error("Unable to identify the current user for license creation");
57
+ await m({
58
+ gateway: "global",
59
+ query: y,
60
+ variables: { input: {
61
+ productId: S.id,
62
+ purchasedBy: t,
63
+ workspaceId: e.id,
64
+ metadata: {
65
+ source: "store-ui",
66
+ productType: S.type
67
+ }
68
+ } },
69
+ authToken: D || void 0
70
+ });
71
+ }
72
+ let n = await m({
73
+ gateway: "global",
74
+ query: v,
75
+ variables: {
76
+ orderId: C ?? null,
77
+ productId: S.id,
78
+ workspaceId: e.id
79
+ },
80
+ authToken: D || void 0
81
+ });
82
+ if (n.errors?.length) throw Error(n.errors[0]?.message ?? "Installation failed");
83
+ let r = n.data?.installPurchasedApp;
84
+ if (r?.success) r.alreadyInstalled ? I(r.message || "Already installed on this workspace") : (T?.(e.id, e.name), h());
85
+ else {
86
+ let e = r?.error || "Installation failed";
87
+ P(e), E?.(Error(e));
88
+ }
89
+ } catch (e) {
90
+ let t = e instanceof Error ? e.message : "Installation failed";
91
+ P(t), E?.(Error(t));
92
+ } finally {
93
+ M(!1);
94
+ }
95
+ }, H = async () => {
96
+ if (!k) return;
97
+ let e = B.find((e) => e.id === k);
98
+ if (e) {
99
+ M(!0), P(null), I(null);
100
+ try {
101
+ let t = await m({
102
+ gateway: "workspace",
103
+ query: g,
104
+ variables: {
105
+ workspaceIds: [e.id],
106
+ input: {
107
+ appName: S.slug || S.name.toLowerCase().replace(/\s+/g, "-"),
108
+ displayName: S.name,
109
+ version: S.version || "1.0.0",
110
+ type: S.type || "app",
111
+ manifest: {
112
+ productId: S.id,
113
+ icon: S.icon
114
+ }
115
+ }
116
+ },
117
+ authToken: D || void 0
118
+ });
119
+ if (t.errors?.length) throw Error(t.errors[0]?.message ?? "Installation failed");
120
+ let n = t.data?.installWorkspaceApps;
121
+ if (n?.successCount && n.successCount > 0) {
122
+ try {
123
+ await m({
124
+ gateway: "global",
125
+ query: _,
126
+ variables: { input: {
127
+ productId: S.id,
128
+ workspaceId: e.id,
129
+ workspaceName: e.name,
130
+ workspaceType: e.type,
131
+ organizationId: e.organizationId,
132
+ version: S.version || "1.0.0",
133
+ manifest: {
134
+ productId: S.id,
135
+ icon: S.icon,
136
+ slug: S.slug,
137
+ type: S.type
138
+ }
139
+ } },
140
+ authToken: D || void 0
141
+ });
142
+ } catch (e) {
143
+ console.warn("Failed to record installation in store:", e);
144
+ }
145
+ T?.(e.id, e.name), h();
146
+ } else {
147
+ let e = n?.results?.[0]?.error || "Installation failed";
148
+ P(e), E?.(Error(e));
149
+ }
150
+ } catch (e) {
151
+ let t = e instanceof Error ? e.message : "Installation failed";
152
+ P(t), E?.(Error(t));
153
+ } finally {
154
+ M(!1);
155
+ }
156
+ }
157
+ };
158
+ return t ? /* @__PURE__ */ p("div", {
159
+ className: "fixed inset-0 z-50 flex items-center justify-center",
160
+ children: [/* @__PURE__ */ f("div", {
161
+ className: "absolute inset-0 bg-bg-overlay/50 backdrop-blur-sm",
162
+ onClick: h
163
+ }), /* @__PURE__ */ p("div", {
164
+ role: "dialog",
165
+ "aria-modal": "true",
166
+ "aria-labelledby": "install-app-modal-title",
167
+ className: "relative z-10 mx-4 w-full max-w-lg rounded-2xl border border-border-default bg-bg-surface shadow-2xl",
168
+ children: [
169
+ /* @__PURE__ */ p("div", {
170
+ className: "flex items-center justify-between border-b border-border-default px-6 py-4",
171
+ children: [/* @__PURE__ */ p("div", {
172
+ className: "flex items-center gap-3",
173
+ children: [S.icon ? /* @__PURE__ */ f("img", {
174
+ src: S.icon,
175
+ alt: S.name,
176
+ className: "h-10 w-10 rounded-lg object-cover"
177
+ }) : /* @__PURE__ */ f("div", {
178
+ className: "flex h-10 w-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted",
179
+ children: S.name.charAt(0)
180
+ }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h2", {
181
+ id: "install-app-modal-title",
182
+ className: "text-lg font-semibold text-text-primary",
183
+ children: "Install App"
184
+ }), /* @__PURE__ */ f("p", {
185
+ className: "text-sm text-text-muted",
186
+ children: S.name
187
+ })] })]
188
+ }), /* @__PURE__ */ f("button", {
189
+ onClick: h,
190
+ "aria-label": "Close install dialog",
191
+ className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
192
+ children: /* @__PURE__ */ f(u, { className: "h-5 w-5" })
193
+ })]
194
+ }),
195
+ /* @__PURE__ */ p("div", {
196
+ className: "px-6 py-4",
197
+ children: [/* @__PURE__ */ f("p", {
198
+ className: "mb-4 text-text-secondary",
199
+ children: "Select the workspace where you want to install this app:"
200
+ }), /* @__PURE__ */ f("div", {
201
+ className: "max-h-72 overflow-y-auto rounded-lg border border-border-default",
202
+ children: R ? /* @__PURE__ */ f("div", {
203
+ className: "flex items-center justify-center py-12",
204
+ children: /* @__PURE__ */ f(c, { className: "h-8 w-8 animate-spin text-text-muted" })
205
+ }) : z ? /* @__PURE__ */ p("div", {
206
+ className: "flex flex-col items-center justify-center py-12 text-center",
207
+ children: [
208
+ /* @__PURE__ */ f(i, { className: "mb-2 h-8 w-8 text-status-error-text" }),
209
+ /* @__PURE__ */ f("p", {
210
+ className: "text-sm text-status-error-text",
211
+ children: "Failed to load workspaces"
212
+ }),
213
+ /* @__PURE__ */ f("p", {
214
+ className: "text-xs text-text-muted mt-1",
215
+ children: z.message
216
+ })
217
+ ]
218
+ }) : B.length === 0 ? /* @__PURE__ */ p("div", {
219
+ className: "flex flex-col items-center justify-center py-12 text-center",
220
+ children: [/* @__PURE__ */ f(a, { className: "mb-2 h-8 w-8 text-text-muted" }), /* @__PURE__ */ f("p", {
221
+ className: "text-sm text-text-muted",
222
+ children: "No workspaces available"
223
+ })]
224
+ }) : /* @__PURE__ */ f("div", {
225
+ className: "divide-y divide-border-default",
226
+ children: B.map((e) => /* @__PURE__ */ p("button", {
227
+ onClick: () => A(e.id),
228
+ className: `w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${k === e.id ? "bg-action-primary-bg/10" : "transition-colors hover:bg-bg-sunken"}`,
229
+ children: [
230
+ /* @__PURE__ */ f("div", {
231
+ className: `flex h-10 w-10 items-center justify-center rounded-lg ${e.type === "user" ? "bg-status-info-bg-subtle text-status-info-text" : "bg-action-primary-bg/10 text-text-link"}`,
232
+ children: e.type === "user" ? /* @__PURE__ */ f(l, { className: "h-5 w-5" }) : /* @__PURE__ */ f(a, { className: "h-5 w-5" })
233
+ }),
234
+ /* @__PURE__ */ p("div", {
235
+ className: "flex-1 min-w-0",
236
+ children: [/* @__PURE__ */ f("p", {
237
+ className: "font-medium text-text-primary truncate",
238
+ children: e.name
239
+ }), /* @__PURE__ */ p("p", {
240
+ className: "text-xs text-text-muted",
241
+ children: [e.type === "user" ? "Personal" : "Team", " workspace"]
242
+ })]
243
+ }),
244
+ k === e.id && /* @__PURE__ */ f(o, { className: "h-5 w-5 flex-shrink-0 text-action-primary-bg" })
245
+ ]
246
+ }, e.id))
247
+ })
248
+ })]
249
+ }),
250
+ /* @__PURE__ */ p("div", {
251
+ className: "border-t border-border-default px-6 py-4",
252
+ children: [
253
+ F && /* @__PURE__ */ p("div", {
254
+ className: "mb-3 flex items-center gap-2 rounded-lg bg-status-info-bg-subtle px-3 py-2 text-sm text-status-info-text",
255
+ children: [/* @__PURE__ */ f(s, { className: "h-4 w-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: F })]
256
+ }),
257
+ N && /* @__PURE__ */ p("div", {
258
+ className: "mb-3 flex items-center gap-2 rounded-lg bg-status-error-bg-subtle/10 px-3 py-2 text-sm text-status-error-text",
259
+ children: [/* @__PURE__ */ f(i, { className: "h-4 w-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: N })]
260
+ }),
261
+ /* @__PURE__ */ p("div", {
262
+ className: "flex items-center justify-end gap-3",
263
+ children: [/* @__PURE__ */ f("button", {
264
+ onClick: h,
265
+ disabled: j,
266
+ className: "cursor-pointer rounded-lg border border-border-default px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
267
+ children: "Cancel"
268
+ }), /* @__PURE__ */ f("button", {
269
+ onClick: async () => {
270
+ let e = S.type?.toUpperCase() ?? "";
271
+ w === "purchased" || C || b.has(e) ? await V() : await H();
272
+ },
273
+ disabled: !k || j,
274
+ className: "cursor-pointer rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-opacity hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-2",
275
+ children: j ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(c, { className: "h-4 w-4 animate-spin" }), "Installing..."] }) : "Install App"
276
+ })]
277
+ })
278
+ ]
279
+ })
280
+ ]
281
+ })]
282
+ }) : null;
283
+ };
284
+ //#endregion
285
+ export { S as InstallAppModal };
286
+
287
+ //# sourceMappingURL=InstallAppModal.js.map