@burdenoff/microfe-store 2026.624.1 → 2026.624.2

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.
@@ -4,7 +4,7 @@ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
4
  var r = () => {
5
5
  let { t: r } = e();
6
6
  return /* @__PURE__ */ t("div", {
7
- className: "flex items-center justify-center min-h-[400px] animate-in fade-in duration-300",
7
+ className: "flex items-center justify-center min-h-[400px] animate-in fade-in duration-200",
8
8
  children: /* @__PURE__ */ n("div", {
9
9
  className: "text-center",
10
10
  children: [/* @__PURE__ */ t("h1", {
@@ -1 +1 @@
1
- {"version":3,"file":"AccessDenied.js","names":[],"sources":["../../src/components/AccessDenied.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * Access denied page shown when user lacks permission for a route\n */\nexport const AccessDenied: FC = () => {\n const { t } = useI18n();\n return (\n <div className=\"flex items-center justify-center min-h-[400px] animate-in fade-in duration-300\">\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-semibold text-text-primary mb-2\">\n {t('common.accessDenied', { defaultValue: 'Access Denied' })}\n </h1>\n <p className=\"text-text-secondary\">\n {t('common.accessDeniedDescription', {\n defaultValue: 'You do not have permission to access this section.',\n })}\n </p>\n </div>\n </div>\n );\n};\n"],"mappings":";;;AAMA,IAAa,UAAyB;CACpC,IAAM,EAAE,SAAM,GAAS;AACvB,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,MAAD;IAAI,WAAU;cACX,EAAE,uBAAuB,EAAE,cAAc,iBAAiB,CAAC;IACzD,CAAA,EACL,kBAAC,KAAD;IAAG,WAAU;cACV,EAAE,kCAAkC,EACnC,cAAc,sDACf,CAAC;IACA,CAAA,CACA;;EACF,CAAA"}
1
+ {"version":3,"file":"AccessDenied.js","names":[],"sources":["../../src/components/AccessDenied.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * Access denied page shown when user lacks permission for a route\n */\nexport const AccessDenied: FC = () => {\n const { t } = useI18n();\n return (\n <div className=\"flex items-center justify-center min-h-[400px] animate-in fade-in duration-200\">\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-semibold text-text-primary mb-2\">\n {t('common.accessDenied', { defaultValue: 'Access Denied' })}\n </h1>\n <p className=\"text-text-secondary\">\n {t('common.accessDeniedDescription', {\n defaultValue: 'You do not have permission to access this section.',\n })}\n </p>\n </div>\n </div>\n );\n};\n"],"mappings":";;;AAMA,IAAa,UAAyB;CACpC,IAAM,EAAE,SAAM,GAAS;AACvB,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,MAAD;IAAI,WAAU;cACX,EAAE,uBAAuB,EAAE,cAAc,iBAAiB,CAAC;IACzD,CAAA,EACL,kBAAC,KAAD;IAAG,WAAU;cACV,EAAE,kCAAkC,EACnC,cAAc,sDACf,CAAC;IACA,CAAA,CACA;;EACF,CAAA"}
@@ -1,17 +1,18 @@
1
1
  import { useStore as e } from "../providers/StoreProvider.js";
2
2
  import { useCallback as t, useEffect as n, useReducer as r, useState as i } from "react";
3
- import { AlertCircle as a, Building2 as o, CheckCircle as s, Info as c, Loader2 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";
3
+ import { AlertCircle as a, Building2 as o, CheckCircle as s, Info as c, Loader2 as l } from "lucide-react";
4
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { graphqlFetch as p } from "@burdenoff/fe-libs/shared/graphql";
6
+ import { Dialog as m, DialogContent as h, DialogDescription as g, DialogFooter as _, DialogHeader as v, DialogTitle as y } from "@burdenoff/fe-libs/ui";
6
7
  //#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
+ var b = "query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }", x = "mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }", S = "mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }", C = "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 } }", w = "mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }", T = new Set([
8
9
  "VIBEMODULE",
9
10
  "NODE",
10
11
  "CONSOLE",
11
12
  "DASHBOARD",
12
13
  "PARSER",
13
14
  "DATASINK"
14
- ]), x = {
15
+ ]), E = {
15
16
  ALREADY_INSTALLED: "This app is already installed in the selected workspace.",
16
17
  QUOTA_EXCEEDED: "Installation limit reached. Please upgrade your plan or contact support.",
17
18
  PERMISSION_DENIED: "You do not have permission to install apps in this workspace.",
@@ -20,19 +21,19 @@ var h = "query MyWorkspaces { myWorkspaces { items { id name slug type status or
20
21
  ENTITLEMENT_EXPIRED: "Your license for this app has expired.",
21
22
  UNSUPPORTED_TYPE: "This product type cannot be installed in the selected workspace."
22
23
  };
23
- function S(e) {
24
- for (let [t, n] of Object.entries(x)) if (e.toUpperCase().includes(t)) return n;
24
+ function D(e) {
25
+ for (let [t, n] of Object.entries(E)) if (e.toUpperCase().includes(t)) return n;
25
26
  return "Installation failed. Please try again or contact support.";
26
27
  }
27
- var C = {
28
+ var O = {
28
29
  selectedWorkspace: null,
29
30
  installing: !1,
30
31
  installError: null,
31
32
  installInfo: null
32
33
  };
33
- function w(e, t) {
34
+ function k(e, t) {
34
35
  switch (t.type) {
35
- case "reset": return C;
36
+ case "reset": return O;
36
37
  case "selectWorkspace": return {
37
38
  ...e,
38
39
  selectedWorkspace: t.workspaceId
@@ -58,14 +59,14 @@ function w(e, t) {
58
59
  default: return e;
59
60
  }
60
61
  }
61
- function T(r) {
62
+ function A(r) {
62
63
  let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [u, d] = i(null), f = t(async () => {
63
64
  if (!r) {
64
65
  l(!0), d(null);
65
66
  try {
66
- let e = await m({
67
+ let e = await p({
67
68
  gateway: "global",
68
- query: h,
69
+ query: b,
69
70
  authToken: a || void 0
70
71
  });
71
72
  if (e.errors?.length) throw Error(e.errors[0]?.message ?? "GraphQL error");
@@ -86,19 +87,19 @@ function T(r) {
86
87
  refetch: f
87
88
  };
88
89
  }
89
- var E = ({ isOpen: t, onClose: n, app: i, orderId: h, purchaseState: x = "free", onInstallSuccess: E, onInstallError: D }) => {
90
- let { authToken: O, user: k } = e(), [A, j] = r(w, C), { selectedWorkspace: M, installing: N, installError: P, installInfo: F } = A, { workspaces: I, loading: L, error: R } = T(!t), z = I.filter((e) => e.status === "ACTIVE"), B = async () => {
91
- if (!M) return;
92
- let e = z.find((e) => e.id === M);
90
+ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free", onInstallSuccess: j, onInstallError: M }) => {
91
+ let { authToken: N, user: P } = e(), [F, I] = r(k, O), { selectedWorkspace: L, installing: R, installError: z, installInfo: B } = F, { workspaces: V, loading: H, error: U } = A(!t), W = V.filter((e) => e.status === "ACTIVE"), G = async () => {
92
+ if (!L) return;
93
+ let e = W.find((e) => e.id === L);
93
94
  if (!e) return;
94
- let t = k?.id;
95
- j({ type: "startInstall" });
95
+ let t = P?.id;
96
+ I({ type: "startInstall" });
96
97
  try {
97
- if (!h && x !== "purchased") {
98
+ if (!b && E !== "purchased") {
98
99
  if (!t) throw Error("Unable to identify the current user for license creation");
99
- await m({
100
+ await p({
100
101
  gateway: "global",
101
- query: y,
102
+ query: w,
102
103
  variables: { input: {
103
104
  productId: i.id,
104
105
  purchasedBy: t,
@@ -108,50 +109,50 @@ var E = ({ isOpen: t, onClose: n, app: i, orderId: h, purchaseState: x = "free",
108
109
  productType: i.type
109
110
  }
110
111
  } },
111
- authToken: O || void 0
112
+ authToken: N || void 0
112
113
  });
113
114
  }
114
- let r = await m({
115
+ let r = await p({
115
116
  gateway: "global",
116
- query: v,
117
+ query: C,
117
118
  variables: {
118
- orderId: h ?? null,
119
+ orderId: b ?? null,
119
120
  productId: i.id,
120
121
  workspaceId: e.id
121
122
  },
122
- authToken: O || void 0
123
+ authToken: N || void 0
123
124
  });
124
125
  if (r.errors?.length) throw Error(r.errors[0]?.message ?? "Installation failed");
125
126
  let a = r.data?.installPurchasedApp;
126
- if (a?.success) a.alreadyInstalled ? j({
127
+ if (a?.success) a.alreadyInstalled ? I({
127
128
  type: "setInfo",
128
129
  info: a.message || "Already installed on this workspace"
129
- }) : (E?.(e.id, e.name), n());
130
+ }) : (j?.(e.id, e.name), n());
130
131
  else {
131
132
  let e = a?.error || "Installation failed";
132
- j({
133
+ I({
133
134
  type: "setError",
134
- error: S(e)
135
- }), D?.(Error(e));
135
+ error: D(e)
136
+ }), M?.(Error(e));
136
137
  }
137
138
  } catch (e) {
138
139
  let t = e instanceof Error ? e.message : "Installation failed";
139
- j({
140
+ I({
140
141
  type: "setError",
141
- error: S(t)
142
- }), D?.(Error(t));
142
+ error: D(t)
143
+ }), M?.(Error(t));
143
144
  } finally {
144
- j({ type: "finishInstall" });
145
+ I({ type: "finishInstall" });
145
146
  }
146
- }, V = async () => {
147
- if (!M) return;
148
- let e = z.find((e) => e.id === M);
147
+ }, K = async () => {
148
+ if (!L) return;
149
+ let e = W.find((e) => e.id === L);
149
150
  if (e) {
150
- j({ type: "startInstall" });
151
+ I({ type: "startInstall" });
151
152
  try {
152
- let t = await m({
153
+ let t = await p({
153
154
  gateway: "workspace",
154
- query: g,
155
+ query: x,
155
156
  variables: {
156
157
  workspaceIds: [e.id],
157
158
  input: {
@@ -165,7 +166,7 @@ var E = ({ isOpen: t, onClose: n, app: i, orderId: h, purchaseState: x = "free",
165
166
  }
166
167
  }
167
168
  },
168
- authToken: O || void 0,
169
+ authToken: N || void 0,
169
170
  workspaceId: e.id,
170
171
  workspaceToken: !0
171
172
  });
@@ -173,9 +174,9 @@ var E = ({ isOpen: t, onClose: n, app: i, orderId: h, purchaseState: x = "free",
173
174
  let r = t.data?.installWorkspaceApps;
174
175
  if (r?.successCount && r.successCount > 0) {
175
176
  try {
176
- await m({
177
+ await p({
177
178
  gateway: "global",
178
- query: _,
179
+ query: S,
179
180
  variables: { input: {
180
181
  productId: i.id,
181
182
  workspaceId: e.id,
@@ -190,164 +191,150 @@ var E = ({ isOpen: t, onClose: n, app: i, orderId: h, purchaseState: x = "free",
190
191
  type: i.type
191
192
  }
192
193
  } },
193
- authToken: O || void 0
194
+ authToken: N || void 0
194
195
  });
195
196
  } catch {}
196
- E?.(e.id, e.name), n();
197
+ j?.(e.id, e.name), n();
197
198
  } else {
198
199
  let e = r?.results?.[0]?.error || "Installation failed";
199
- j({
200
+ I({
200
201
  type: "setError",
201
- error: S(e)
202
- }), D?.(Error(e));
202
+ error: D(e)
203
+ }), M?.(Error(e));
203
204
  }
204
205
  } catch (e) {
205
206
  let t = e instanceof Error ? e.message : "Installation failed";
206
- j({
207
+ I({
207
208
  type: "setError",
208
- error: S(t)
209
- }), D?.(Error(t));
209
+ error: D(t)
210
+ }), M?.(Error(t));
210
211
  } finally {
211
- j({ type: "finishInstall" });
212
+ I({ type: "finishInstall" });
212
213
  }
213
214
  }
214
215
  };
215
- return t ? /* @__PURE__ */ p("div", {
216
- className: "fixed inset-0 z-50 flex items-center justify-center",
217
- children: [/* @__PURE__ */ f("button", {
218
- type: "button",
219
- "aria-label": "Close modal",
220
- className: "absolute inset-0 bg-bg-overlay/50 backdrop-blur-sm",
221
- onClick: n
222
- }), /* @__PURE__ */ p("dialog", {
223
- open: !0,
224
- "aria-modal": "true",
225
- "aria-labelledby": "install-app-modal-title",
226
- className: "relative z-10 mx-4 w-full max-w-lg rounded-2xl border border-border-default bg-bg-surface shadow-2xl",
216
+ return /* @__PURE__ */ d(m, {
217
+ open: t,
218
+ onOpenChange: (e) => !e && n(),
219
+ children: /* @__PURE__ */ f(h, {
220
+ className: "mx-4 w-full max-w-lg gap-0 p-0",
227
221
  children: [
228
- /* @__PURE__ */ p("div", {
229
- className: "flex items-center justify-between border-b border-border-default px-6 py-4",
230
- children: [/* @__PURE__ */ p("div", {
222
+ /* @__PURE__ */ d(v, {
223
+ className: "flex flex-row items-center justify-between space-y-0 border-b border-border-default px-6 py-4 text-left",
224
+ children: /* @__PURE__ */ f("div", {
231
225
  className: "flex items-center gap-3",
232
- children: [i.icon ? /* @__PURE__ */ f("img", {
226
+ children: [i.icon ? /* @__PURE__ */ d("img", {
233
227
  src: i.icon,
234
228
  alt: i.name,
235
229
  className: "size-10 rounded-lg object-cover"
236
- }) : /* @__PURE__ */ f("div", {
230
+ }) : /* @__PURE__ */ d("div", {
237
231
  className: "flex size-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted",
238
232
  children: i.name.charAt(0)
239
- }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h2", {
240
- id: "install-app-modal-title",
233
+ }), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d(y, {
241
234
  className: "text-lg font-semibold text-text-primary",
242
235
  children: "Install App"
243
- }), /* @__PURE__ */ f("p", {
236
+ }), /* @__PURE__ */ d(g, {
244
237
  className: "text-sm text-text-muted",
245
238
  children: i.name
246
239
  })] })]
247
- }), /* @__PURE__ */ f("button", {
248
- type: "button",
249
- onClick: n,
250
- "aria-label": "Close install dialog",
251
- className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
252
- children: /* @__PURE__ */ f(u, { className: "size-5" })
253
- })]
240
+ })
254
241
  }),
255
- /* @__PURE__ */ p("div", {
242
+ /* @__PURE__ */ f("div", {
256
243
  className: "px-6 py-4",
257
- children: [/* @__PURE__ */ f("p", {
244
+ children: [/* @__PURE__ */ d("p", {
258
245
  className: "mb-4 text-text-secondary",
259
246
  children: "Select the workspace where you want to install this app:"
260
- }), /* @__PURE__ */ f("div", {
247
+ }), /* @__PURE__ */ d("div", {
261
248
  className: "max-h-72 overflow-y-auto rounded-lg border border-border-default",
262
- children: L ? /* @__PURE__ */ f("div", {
249
+ children: H ? /* @__PURE__ */ d("div", {
263
250
  className: "flex items-center justify-center py-12",
264
- children: /* @__PURE__ */ f(l, { className: "size-8 animate-spin text-text-muted" })
265
- }) : R ? /* @__PURE__ */ p("div", {
251
+ children: /* @__PURE__ */ d(l, { className: "size-8 animate-spin text-text-muted" })
252
+ }) : U ? /* @__PURE__ */ f("div", {
266
253
  className: "flex flex-col items-center justify-center py-12 text-center",
267
254
  children: [
268
- /* @__PURE__ */ f(a, { className: "mb-2 size-8 text-status-error-text" }),
269
- /* @__PURE__ */ f("p", {
255
+ /* @__PURE__ */ d(a, { className: "mb-2 size-8 text-status-error-text" }),
256
+ /* @__PURE__ */ d("p", {
270
257
  className: "text-sm text-status-error-text",
271
258
  children: "Failed to load workspaces"
272
259
  }),
273
- /* @__PURE__ */ f("p", {
260
+ /* @__PURE__ */ d("p", {
274
261
  className: "text-xs text-text-muted mt-1",
275
- children: R.message
262
+ children: U.message
276
263
  })
277
264
  ]
278
- }) : z.length === 0 ? /* @__PURE__ */ p("div", {
265
+ }) : W.length === 0 ? /* @__PURE__ */ f("div", {
279
266
  className: "flex flex-col items-center justify-center py-12 text-center",
280
- children: [/* @__PURE__ */ f(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ f("p", {
267
+ children: [/* @__PURE__ */ d(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ d("p", {
281
268
  className: "text-sm text-text-muted",
282
269
  children: "No workspaces available"
283
270
  })]
284
- }) : /* @__PURE__ */ f("div", {
271
+ }) : /* @__PURE__ */ d("div", {
285
272
  className: "divide-y divide-border-default",
286
- children: z.map((e) => /* @__PURE__ */ p("button", {
273
+ children: W.map((e) => /* @__PURE__ */ f("button", {
287
274
  type: "button",
288
- onClick: () => j({
275
+ onClick: () => I({
289
276
  type: "selectWorkspace",
290
277
  workspaceId: e.id
291
278
  }),
292
- className: `w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${M === e.id ? "bg-action-primary-bg/10" : "transition-colors hover:bg-bg-sunken"}`,
279
+ className: `w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${L === e.id ? "bg-action-primary-bg/10" : "transition-colors hover:bg-bg-sunken"}`,
293
280
  children: [
294
- /* @__PURE__ */ f("div", {
281
+ /* @__PURE__ */ d("div", {
295
282
  className: "flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link",
296
- children: /* @__PURE__ */ f(o, { className: "size-5" })
283
+ children: /* @__PURE__ */ d(o, { className: "size-5" })
297
284
  }),
298
- /* @__PURE__ */ p("div", {
285
+ /* @__PURE__ */ f("div", {
299
286
  className: "flex-1 min-w-0",
300
- children: [/* @__PURE__ */ f("p", {
287
+ children: [/* @__PURE__ */ d("p", {
301
288
  className: "font-medium text-text-primary truncate",
302
289
  children: e.name
303
- }), e.slug ? /* @__PURE__ */ p("p", {
290
+ }), e.slug ? /* @__PURE__ */ f("p", {
304
291
  className: "text-xs text-text-muted truncate",
305
292
  children: ["/", e.slug]
306
293
  }) : null]
307
294
  }),
308
- M === e.id && /* @__PURE__ */ f(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
295
+ L === e.id && /* @__PURE__ */ d(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
309
296
  ]
310
297
  }, e.id))
311
298
  })
312
299
  })]
313
300
  }),
314
- /* @__PURE__ */ p("div", {
315
- className: "border-t border-border-default px-6 py-4",
301
+ /* @__PURE__ */ f(_, {
302
+ className: "block border-t border-border-default px-6 py-4 sm:flex-col sm:items-stretch sm:space-x-0",
316
303
  children: [
317
- F && /* @__PURE__ */ p("div", {
304
+ B && /* @__PURE__ */ f("div", {
318
305
  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",
319
- children: [/* @__PURE__ */ f(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: F })]
306
+ children: [/* @__PURE__ */ d(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ d("span", { children: B })]
320
307
  }),
321
- P && /* @__PURE__ */ p("div", {
308
+ z && /* @__PURE__ */ f("div", {
322
309
  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",
323
- children: [/* @__PURE__ */ f(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: P })]
310
+ children: [/* @__PURE__ */ d(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ d("span", { children: z })]
324
311
  }),
325
- /* @__PURE__ */ p("div", {
312
+ /* @__PURE__ */ f("div", {
326
313
  className: "flex items-center justify-end gap-3",
327
- children: [/* @__PURE__ */ f("button", {
314
+ children: [/* @__PURE__ */ d("button", {
328
315
  type: "button",
329
316
  onClick: n,
330
- disabled: N,
317
+ disabled: R,
331
318
  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",
332
319
  children: "Cancel"
333
- }), /* @__PURE__ */ f("button", {
320
+ }), /* @__PURE__ */ d("button", {
334
321
  type: "button",
335
322
  onClick: async () => {
336
323
  let e = i.type?.toUpperCase() ?? "";
337
- x === "purchased" || h || b.has(e) ? await B() : await V();
324
+ E === "purchased" || b || T.has(e) ? await G() : await K();
338
325
  },
339
- disabled: !M || N,
326
+ disabled: !L || R,
340
327
  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",
341
- children: N ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
328
+ children: R ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
342
329
  })]
343
330
  })
344
331
  ]
345
332
  })
346
333
  ]
347
- })]
348
- }) : null;
334
+ })
335
+ });
349
336
  };
350
337
  //#endregion
351
- export { E as InstallAppModal };
338
+ export { j as InstallAppModal };
352
339
 
353
340
  //# sourceMappingURL=InstallAppModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstallAppModal.js","names":[],"sources":["../../src/components/InstallAppModal.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useState, useEffect, useCallback, useReducer } from 'react';\nimport { X, Loader2, Building2, CheckCircle, AlertCircle, Info } from 'lucide-react';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { useStore } from '../providers/StoreProvider';\n\n// Local type definitions for workspace operations\ninterface Workspace {\n id: string;\n name: string;\n slug: string;\n type?: string;\n status?: string;\n organizationId?: string;\n}\n\ninterface WorkspaceList {\n items: Workspace[];\n total: number;\n}\n\ninterface InstallWorkspaceAppsResult {\n successCount: number;\n failedCount: number;\n results: Array<{\n success: boolean;\n workspaceId: string;\n app?: unknown;\n error?: string;\n }>;\n}\n\n// String queries for graphqlFetch\nconst MY_WORKSPACES_STRING = `query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }`;\nconst INSTALL_WORKSPACE_APPS_STRING = `mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }`;\nconst RECORD_APP_INSTALLATION_STRING = `mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }`;\nconst INSTALL_PURCHASED_APP_STRING = `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 } }`;\nconst CREATE_PRODUCT_ENTITLEMENT_STRING = `mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }`;\nconst STORE_DISTRIBUTED_TYPES = new Set([\n 'VIBEMODULE',\n 'NODE',\n 'CONSOLE',\n 'DASHBOARD',\n 'PARSER',\n 'DATASINK',\n]);\n\nconst INSTALL_ERROR_MESSAGES: Record<string, string> = {\n ALREADY_INSTALLED: 'This app is already installed in the selected workspace.',\n QUOTA_EXCEEDED: 'Installation limit reached. Please upgrade your plan or contact support.',\n PERMISSION_DENIED: 'You do not have permission to install apps in this workspace.',\n NOT_FOUND: 'The app or workspace could not be found.',\n WORKSPACE_INACTIVE: 'The selected workspace is inactive.',\n ENTITLEMENT_EXPIRED: 'Your license for this app has expired.',\n UNSUPPORTED_TYPE: 'This product type cannot be installed in the selected workspace.',\n};\n\nfunction mapInstallError(raw: string): string {\n for (const [code, message] of Object.entries(INSTALL_ERROR_MESSAGES)) {\n if (raw.toUpperCase().includes(code)) return message;\n }\n return 'Installation failed. Please try again or contact support.';\n}\n\ninterface InstallState {\n selectedWorkspace: string | null;\n installing: boolean;\n installError: string | null;\n installInfo: string | null;\n}\n\ntype InstallAction =\n | { type: 'reset' }\n | { type: 'selectWorkspace'; workspaceId: string }\n | { type: 'startInstall' }\n | { type: 'finishInstall' }\n | { type: 'setError'; error: string }\n | { type: 'setInfo'; info: string };\n\nconst initialInstallState: InstallState = {\n selectedWorkspace: null,\n installing: false,\n installError: null,\n installInfo: null,\n};\n\nfunction installReducer(state: InstallState, action: InstallAction): InstallState {\n switch (action.type) {\n case 'reset':\n return initialInstallState;\n case 'selectWorkspace':\n return { ...state, selectedWorkspace: action.workspaceId };\n case 'startInstall':\n return { ...state, installing: true, installError: null, installInfo: null };\n case 'finishInstall':\n return { ...state, installing: false };\n case 'setError':\n return { ...state, installError: action.error };\n case 'setInfo':\n return { ...state, installInfo: action.info };\n default:\n return state;\n }\n}\n\nexport interface AppInfo {\n id: string;\n name: string;\n slug?: string;\n icon?: string;\n type?: string;\n version?: string;\n}\n\ninterface InstallAppModalProps {\n isOpen: boolean;\n onClose: () => void;\n app: AppInfo;\n orderId?: string | null; // For purchased apps from orders page\n purchaseState?: 'free' | 'purchased';\n onInstallSuccess?: (workspaceId: string, workspaceName: string) => void;\n onInstallError?: (error: Error) => void;\n}\n\ninterface UseWorkspacesResult {\n workspaces: Workspace[];\n loading: boolean;\n error: Error | null;\n refetch: () => void;\n}\n\n// NOTE: Inline Apollo clients removed. All GraphQL calls now use graphqlFetch\n// from fe-libs which automatically resolves gateway URLs and injects auth + locale headers.\n\n/**\n * Hook to fetch user's workspaces using graphqlFetch from fe-libs\n */\nfunction useWorkspaces(skip: boolean): UseWorkspacesResult {\n const { authToken } = useStore();\n const [workspaces, setWorkspaces] = useState<Workspace[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchWorkspaces = useCallback(async () => {\n if (skip) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const result = await graphqlFetch<{ myWorkspaces: WorkspaceList }>({\n gateway: 'global',\n query: MY_WORKSPACES_STRING,\n authToken: authToken || undefined,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'GraphQL error');\n }\n\n setWorkspaces(result.data?.myWorkspaces?.items || []);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to fetch workspaces'));\n } finally {\n setLoading(false);\n }\n }, [authToken, skip]);\n\n useEffect(() => {\n fetchWorkspaces();\n }, [fetchWorkspaces]);\n\n return {\n workspaces,\n loading,\n error,\n refetch: fetchWorkspaces,\n };\n}\n\n/**\n * InstallAppModal component\n *\n * Modal for selecting a workspace to install an app into\n */\nexport const InstallAppModal: FC<InstallAppModalProps> = ({\n isOpen,\n onClose,\n app,\n orderId,\n purchaseState = 'free',\n onInstallSuccess,\n onInstallError,\n}) => {\n const { authToken, user } = useStore();\n const [installState, dispatchInstall] = useReducer(installReducer, initialInstallState);\n const { selectedWorkspace, installing, installError, installInfo } = installState;\n\n const { workspaces, loading, error } = useWorkspaces(!isOpen);\n\n // Filter workspaces by status (only show active)\n const filteredWorkspaces = workspaces.filter((ws) => ws.status === 'ACTIVE');\n\n /**\n * Install purchased app via Store Service (NEW FLOW)\n * Used when installing from orders page or any already-purchased product\n */\n const handleInstallFromStore = async () => {\n if (!selectedWorkspace) return;\n\n const workspace = filteredWorkspaces.find((ws) => ws.id === selectedWorkspace);\n if (!workspace) return;\n const purchasedBy = user?.id;\n\n dispatchInstall({ type: 'startInstall' });\n\n try {\n if (!orderId && purchaseState !== 'purchased') {\n if (!purchasedBy) {\n throw new Error('Unable to identify the current user for license creation');\n }\n\n await graphqlFetch({\n gateway: 'global',\n query: CREATE_PRODUCT_ENTITLEMENT_STRING,\n variables: {\n input: {\n productId: app.id,\n purchasedBy,\n workspaceId: workspace.id,\n metadata: {\n source: 'store-ui',\n productType: app.type,\n },\n },\n },\n authToken: authToken || undefined,\n });\n }\n\n // Call Store Service to install the purchased app\n const result = await graphqlFetch<{\n installPurchasedApp: {\n success: boolean;\n alreadyInstalled?: boolean;\n installation?: {\n id: string;\n productId: string;\n workspaceId: string;\n status: string;\n version: string;\n };\n error?: string;\n message?: string;\n };\n }>({\n gateway: 'global', // Store Service\n query: INSTALL_PURCHASED_APP_STRING,\n variables: {\n orderId: orderId ?? null,\n productId: app.id,\n workspaceId: workspace.id,\n },\n authToken: authToken || undefined,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'Installation failed');\n }\n\n const installResult = result.data?.installPurchasedApp;\n\n if (installResult?.success) {\n if (installResult.alreadyInstalled) {\n dispatchInstall({\n type: 'setInfo',\n info: installResult.message || 'Already installed on this workspace',\n });\n } else {\n onInstallSuccess?.(workspace.id, workspace.name);\n onClose();\n }\n } else {\n const rawMsg = installResult?.error || 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n }\n } catch (err) {\n const rawMsg = err instanceof Error ? err.message : 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n } finally {\n dispatchInstall({ type: 'finishInstall' });\n }\n };\n\n /**\n * Install app via Workspace Service (LEGACY FLOW)\n * Used for free apps or when installing without order\n */\n const handleInstallViaWorkspace = async () => {\n if (!selectedWorkspace) return;\n\n const workspace = filteredWorkspaces.find((ws) => ws.id === selectedWorkspace);\n if (!workspace) return;\n\n dispatchInstall({ type: 'startInstall' });\n\n try {\n // Step 1: Install to workspace service via graphqlFetch\n const installVars = {\n workspaceIds: [workspace.id],\n input: {\n appName: app.slug || app.name.toLowerCase().replace(/\\s+/g, '-'),\n displayName: app.name,\n version: app.version || '1.0.0',\n type: app.type || 'app',\n manifest: {\n productId: app.id,\n icon: app.icon,\n },\n },\n };\n\n const result = await graphqlFetch<{\n installWorkspaceApps: InstallWorkspaceAppsResult;\n }>({\n gateway: 'workspace',\n query: INSTALL_WORKSPACE_APPS_STRING,\n variables: installVars,\n authToken: authToken || undefined,\n workspaceId: workspace.id,\n workspaceToken: true,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'Installation failed');\n }\n\n const installResult = result.data?.installWorkspaceApps;\n if (installResult?.successCount && installResult.successCount > 0) {\n // Step 2: Record installation in store service (for tracking)\n try {\n await graphqlFetch({\n gateway: 'global',\n query: RECORD_APP_INSTALLATION_STRING,\n variables: {\n input: {\n productId: app.id,\n workspaceId: workspace.id,\n workspaceName: workspace.name,\n workspaceType: workspace.type,\n organizationId: workspace.organizationId,\n version: app.version || '1.0.0',\n manifest: {\n productId: app.id,\n icon: app.icon,\n slug: app.slug,\n type: app.type,\n },\n },\n },\n authToken: authToken || undefined,\n });\n } catch {\n // Non-fatal: workspace installation succeeded; store record will sync later.\n }\n\n onInstallSuccess?.(workspace.id, workspace.name);\n onClose();\n } else {\n const rawMsg = installResult?.results?.[0]?.error || 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n }\n } catch (err) {\n const rawMsg = err instanceof Error ? err.message : 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n } finally {\n dispatchInstall({ type: 'finishInstall' });\n }\n };\n\n /**\n * Main install handler - routes to appropriate install function\n */\n const handleInstall = async () => {\n const appType = app.type?.toUpperCase() ?? '';\n\n if (purchaseState === 'purchased' || orderId || STORE_DISTRIBUTED_TYPES.has(appType)) {\n // Purchased products install through the store service.\n await handleInstallFromStore();\n } else {\n // Free products install through the workspace service.\n await handleInstallViaWorkspace();\n }\n };\n\n if (!isOpen) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <button\n type=\"button\"\n aria-label=\"Close modal\"\n className=\"absolute inset-0 bg-bg-overlay/50 backdrop-blur-sm\"\n onClick={onClose}\n />\n\n {/* Modal */}\n <dialog\n open\n aria-modal=\"true\"\n aria-labelledby=\"install-app-modal-title\"\n className=\"relative z-10 mx-4 w-full max-w-lg rounded-2xl border border-border-default bg-bg-surface shadow-2xl\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between border-b border-border-default px-6 py-4\">\n <div className=\"flex items-center gap-3\">\n {app.icon ? (\n <img src={app.icon} alt={app.name} className=\"size-10 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex size-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted\">\n {app.name.charAt(0)}\n </div>\n )}\n <div>\n <h2 id=\"install-app-modal-title\" className=\"text-lg font-semibold text-text-primary\">\n Install App\n </h2>\n <p className=\"text-sm text-text-muted\">{app.name}</p>\n </div>\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close install dialog\"\n className=\"cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n >\n <X className=\"size-5\" />\n </button>\n </div>\n\n {/* Content */}\n <div className=\"px-6 py-4\">\n <p className=\"mb-4 text-text-secondary\">\n Select the workspace where you want to install this app:\n </p>\n\n {/* Workspace List */}\n <div className=\"max-h-72 overflow-y-auto rounded-lg border border-border-default\">\n {loading ? (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 className=\"size-8 animate-spin text-text-muted\" />\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <AlertCircle className=\"mb-2 size-8 text-status-error-text\" />\n <p className=\"text-sm text-status-error-text\">Failed to load workspaces</p>\n <p className=\"text-xs text-text-muted mt-1\">{error.message}</p>\n </div>\n ) : filteredWorkspaces.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <Building2 className=\"mb-2 size-8 text-text-muted\" />\n <p className=\"text-sm text-text-muted\">No workspaces available</p>\n </div>\n ) : (\n <div className=\"divide-y divide-border-default\">\n {filteredWorkspaces.map((workspace) => (\n <button\n type=\"button\"\n key={workspace.id}\n onClick={() =>\n dispatchInstall({ type: 'selectWorkspace', workspaceId: workspace.id })\n }\n className={`w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${\n selectedWorkspace === workspace.id\n ? 'bg-action-primary-bg/10'\n : 'transition-colors hover:bg-bg-sunken'\n }`}\n >\n {/* Workspace Icon */}\n <div className=\"flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link\">\n <Building2 className=\"size-5\" />\n </div>\n\n {/* Workspace Info */}\n <div className=\"flex-1 min-w-0\">\n <p className=\"font-medium text-text-primary truncate\">{workspace.name}</p>\n {workspace.slug ? (\n <p className=\"text-xs text-text-muted truncate\">/{workspace.slug}</p>\n ) : null}\n </div>\n\n {/* Selection Indicator */}\n {selectedWorkspace === workspace.id && (\n <CheckCircle className=\"size-5 flex-shrink-0 text-action-primary-bg\" />\n )}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Footer */}\n <div className=\"border-t border-border-default px-6 py-4\">\n {/* Already-installed info */}\n {installInfo && (\n <div 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\">\n <Info className=\"size-4 flex-shrink-0\" />\n <span>{installInfo}</span>\n </div>\n )}\n {/* Error message */}\n {installError && (\n <div 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\">\n <AlertCircle className=\"size-4 flex-shrink-0\" />\n <span>{installError}</span>\n </div>\n )}\n <div className=\"flex items-center justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n disabled={installing}\n 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\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleInstall}\n disabled={!selectedWorkspace || installing}\n 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\"\n >\n {installing ? (\n <>\n <Loader2 className=\"size-4 animate-spin\" />\n Installing…\n </>\n ) : (\n 'Install App'\n )}\n </button>\n </div>\n </div>\n </dialog>\n </div>\n );\n};\n"],"mappings":";;;;;;AAiCA,IAAM,IAAuB,mGACvB,IAAgC,mOAChC,IAAiC,kJACjC,IAA+B,2RAC/B,IAAoC,6JACpC,IAA0B,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,EAEI,IAAiD;CACrD,mBAAmB;CACnB,gBAAgB;CAChB,mBAAmB;CACnB,WAAW;CACX,oBAAoB;CACpB,qBAAqB;CACrB,kBAAkB;CACnB;AAED,SAAS,EAAgB,GAAqB;AAC5C,MAAK,IAAM,CAAC,GAAM,MAAY,OAAO,QAAQ,EAAuB,CAClE,KAAI,EAAI,aAAa,CAAC,SAAS,EAAK,CAAE,QAAO;AAE/C,QAAO;;AAkBT,IAAM,IAAoC;CACxC,mBAAmB;CACnB,YAAY;CACZ,cAAc;CACd,aAAa;CACd;AAED,SAAS,EAAe,GAAqB,GAAqC;AAChF,SAAQ,EAAO,MAAf;EACE,KAAK,QACH,QAAO;EACT,KAAK,kBACH,QAAO;GAAE,GAAG;GAAO,mBAAmB,EAAO;GAAa;EAC5D,KAAK,eACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAM,cAAc;GAAM,aAAa;GAAM;EAC9E,KAAK,gBACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAO;EACxC,KAAK,WACH,QAAO;GAAE,GAAG;GAAO,cAAc,EAAO;GAAO;EACjD,KAAK,UACH,QAAO;GAAE,GAAG;GAAO,aAAa,EAAO;GAAM;EAC/C,QACE,QAAO;;;AAoCb,SAAS,EAAc,GAAoC;CACzD,IAAM,EAAE,iBAAc,GAAU,EAC1B,CAAC,GAAY,KAAiB,EAAsB,EAAE,CAAC,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,GAAD,EAAS,WAAU,uBAAwB,CAAA,EAAA,cAE1C,EAAA,CAAA,GAEH;QAEK,CAAA,CACL;;MACF;;IACC;KACL;MAvJY"}
1
+ {"version":3,"file":"InstallAppModal.js","names":[],"sources":["../../src/components/InstallAppModal.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useState, useEffect, useCallback, useReducer } from 'react';\nimport { Loader2, Building2, CheckCircle, AlertCircle, Info } from 'lucide-react';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { useStore } from '../providers/StoreProvider';\n\n// Local type definitions for workspace operations\ninterface Workspace {\n id: string;\n name: string;\n slug: string;\n type?: string;\n status?: string;\n organizationId?: string;\n}\n\ninterface WorkspaceList {\n items: Workspace[];\n total: number;\n}\n\ninterface InstallWorkspaceAppsResult {\n successCount: number;\n failedCount: number;\n results: Array<{\n success: boolean;\n workspaceId: string;\n app?: unknown;\n error?: string;\n }>;\n}\n\n// String queries for graphqlFetch\nconst MY_WORKSPACES_STRING = `query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }`;\nconst INSTALL_WORKSPACE_APPS_STRING = `mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }`;\nconst RECORD_APP_INSTALLATION_STRING = `mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }`;\nconst INSTALL_PURCHASED_APP_STRING = `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 } }`;\nconst CREATE_PRODUCT_ENTITLEMENT_STRING = `mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }`;\nconst STORE_DISTRIBUTED_TYPES = new Set([\n 'VIBEMODULE',\n 'NODE',\n 'CONSOLE',\n 'DASHBOARD',\n 'PARSER',\n 'DATASINK',\n]);\n\nconst INSTALL_ERROR_MESSAGES: Record<string, string> = {\n ALREADY_INSTALLED: 'This app is already installed in the selected workspace.',\n QUOTA_EXCEEDED: 'Installation limit reached. Please upgrade your plan or contact support.',\n PERMISSION_DENIED: 'You do not have permission to install apps in this workspace.',\n NOT_FOUND: 'The app or workspace could not be found.',\n WORKSPACE_INACTIVE: 'The selected workspace is inactive.',\n ENTITLEMENT_EXPIRED: 'Your license for this app has expired.',\n UNSUPPORTED_TYPE: 'This product type cannot be installed in the selected workspace.',\n};\n\nfunction mapInstallError(raw: string): string {\n for (const [code, message] of Object.entries(INSTALL_ERROR_MESSAGES)) {\n if (raw.toUpperCase().includes(code)) return message;\n }\n return 'Installation failed. Please try again or contact support.';\n}\n\ninterface InstallState {\n selectedWorkspace: string | null;\n installing: boolean;\n installError: string | null;\n installInfo: string | null;\n}\n\ntype InstallAction =\n | { type: 'reset' }\n | { type: 'selectWorkspace'; workspaceId: string }\n | { type: 'startInstall' }\n | { type: 'finishInstall' }\n | { type: 'setError'; error: string }\n | { type: 'setInfo'; info: string };\n\nconst initialInstallState: InstallState = {\n selectedWorkspace: null,\n installing: false,\n installError: null,\n installInfo: null,\n};\n\nfunction installReducer(state: InstallState, action: InstallAction): InstallState {\n switch (action.type) {\n case 'reset':\n return initialInstallState;\n case 'selectWorkspace':\n return { ...state, selectedWorkspace: action.workspaceId };\n case 'startInstall':\n return { ...state, installing: true, installError: null, installInfo: null };\n case 'finishInstall':\n return { ...state, installing: false };\n case 'setError':\n return { ...state, installError: action.error };\n case 'setInfo':\n return { ...state, installInfo: action.info };\n default:\n return state;\n }\n}\n\nexport interface AppInfo {\n id: string;\n name: string;\n slug?: string;\n icon?: string;\n type?: string;\n version?: string;\n}\n\ninterface InstallAppModalProps {\n isOpen: boolean;\n onClose: () => void;\n app: AppInfo;\n orderId?: string | null; // For purchased apps from orders page\n purchaseState?: 'free' | 'purchased';\n onInstallSuccess?: (workspaceId: string, workspaceName: string) => void;\n onInstallError?: (error: Error) => void;\n}\n\ninterface UseWorkspacesResult {\n workspaces: Workspace[];\n loading: boolean;\n error: Error | null;\n refetch: () => void;\n}\n\n// NOTE: Inline Apollo clients removed. All GraphQL calls now use graphqlFetch\n// from fe-libs which automatically resolves gateway URLs and injects auth + locale headers.\n\n/**\n * Hook to fetch user's workspaces using graphqlFetch from fe-libs\n */\nfunction useWorkspaces(skip: boolean): UseWorkspacesResult {\n const { authToken } = useStore();\n const [workspaces, setWorkspaces] = useState<Workspace[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchWorkspaces = useCallback(async () => {\n if (skip) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const result = await graphqlFetch<{ myWorkspaces: WorkspaceList }>({\n gateway: 'global',\n query: MY_WORKSPACES_STRING,\n authToken: authToken || undefined,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'GraphQL error');\n }\n\n setWorkspaces(result.data?.myWorkspaces?.items || []);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to fetch workspaces'));\n } finally {\n setLoading(false);\n }\n }, [authToken, skip]);\n\n useEffect(() => {\n fetchWorkspaces();\n }, [fetchWorkspaces]);\n\n return {\n workspaces,\n loading,\n error,\n refetch: fetchWorkspaces,\n };\n}\n\n/**\n * InstallAppModal component\n *\n * Modal for selecting a workspace to install an app into\n */\nexport const InstallAppModal: FC<InstallAppModalProps> = ({\n isOpen,\n onClose,\n app,\n orderId,\n purchaseState = 'free',\n onInstallSuccess,\n onInstallError,\n}) => {\n const { authToken, user } = useStore();\n const [installState, dispatchInstall] = useReducer(installReducer, initialInstallState);\n const { selectedWorkspace, installing, installError, installInfo } = installState;\n\n const { workspaces, loading, error } = useWorkspaces(!isOpen);\n\n // Filter workspaces by status (only show active)\n const filteredWorkspaces = workspaces.filter((ws) => ws.status === 'ACTIVE');\n\n /**\n * Install purchased app via Store Service (NEW FLOW)\n * Used when installing from orders page or any already-purchased product\n */\n const handleInstallFromStore = async () => {\n if (!selectedWorkspace) return;\n\n const workspace = filteredWorkspaces.find((ws) => ws.id === selectedWorkspace);\n if (!workspace) return;\n const purchasedBy = user?.id;\n\n dispatchInstall({ type: 'startInstall' });\n\n try {\n if (!orderId && purchaseState !== 'purchased') {\n if (!purchasedBy) {\n throw new Error('Unable to identify the current user for license creation');\n }\n\n await graphqlFetch({\n gateway: 'global',\n query: CREATE_PRODUCT_ENTITLEMENT_STRING,\n variables: {\n input: {\n productId: app.id,\n purchasedBy,\n workspaceId: workspace.id,\n metadata: {\n source: 'store-ui',\n productType: app.type,\n },\n },\n },\n authToken: authToken || undefined,\n });\n }\n\n // Call Store Service to install the purchased app\n const result = await graphqlFetch<{\n installPurchasedApp: {\n success: boolean;\n alreadyInstalled?: boolean;\n installation?: {\n id: string;\n productId: string;\n workspaceId: string;\n status: string;\n version: string;\n };\n error?: string;\n message?: string;\n };\n }>({\n gateway: 'global', // Store Service\n query: INSTALL_PURCHASED_APP_STRING,\n variables: {\n orderId: orderId ?? null,\n productId: app.id,\n workspaceId: workspace.id,\n },\n authToken: authToken || undefined,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'Installation failed');\n }\n\n const installResult = result.data?.installPurchasedApp;\n\n if (installResult?.success) {\n if (installResult.alreadyInstalled) {\n dispatchInstall({\n type: 'setInfo',\n info: installResult.message || 'Already installed on this workspace',\n });\n } else {\n onInstallSuccess?.(workspace.id, workspace.name);\n onClose();\n }\n } else {\n const rawMsg = installResult?.error || 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n }\n } catch (err) {\n const rawMsg = err instanceof Error ? err.message : 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n } finally {\n dispatchInstall({ type: 'finishInstall' });\n }\n };\n\n /**\n * Install app via Workspace Service (LEGACY FLOW)\n * Used for free apps or when installing without order\n */\n const handleInstallViaWorkspace = async () => {\n if (!selectedWorkspace) return;\n\n const workspace = filteredWorkspaces.find((ws) => ws.id === selectedWorkspace);\n if (!workspace) return;\n\n dispatchInstall({ type: 'startInstall' });\n\n try {\n // Step 1: Install to workspace service via graphqlFetch\n const installVars = {\n workspaceIds: [workspace.id],\n input: {\n appName: app.slug || app.name.toLowerCase().replace(/\\s+/g, '-'),\n displayName: app.name,\n version: app.version || '1.0.0',\n type: app.type || 'app',\n manifest: {\n productId: app.id,\n icon: app.icon,\n },\n },\n };\n\n const result = await graphqlFetch<{\n installWorkspaceApps: InstallWorkspaceAppsResult;\n }>({\n gateway: 'workspace',\n query: INSTALL_WORKSPACE_APPS_STRING,\n variables: installVars,\n authToken: authToken || undefined,\n workspaceId: workspace.id,\n workspaceToken: true,\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message ?? 'Installation failed');\n }\n\n const installResult = result.data?.installWorkspaceApps;\n if (installResult?.successCount && installResult.successCount > 0) {\n // Step 2: Record installation in store service (for tracking)\n try {\n await graphqlFetch({\n gateway: 'global',\n query: RECORD_APP_INSTALLATION_STRING,\n variables: {\n input: {\n productId: app.id,\n workspaceId: workspace.id,\n workspaceName: workspace.name,\n workspaceType: workspace.type,\n organizationId: workspace.organizationId,\n version: app.version || '1.0.0',\n manifest: {\n productId: app.id,\n icon: app.icon,\n slug: app.slug,\n type: app.type,\n },\n },\n },\n authToken: authToken || undefined,\n });\n } catch {\n // Non-fatal: workspace installation succeeded; store record will sync later.\n }\n\n onInstallSuccess?.(workspace.id, workspace.name);\n onClose();\n } else {\n const rawMsg = installResult?.results?.[0]?.error || 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n }\n } catch (err) {\n const rawMsg = err instanceof Error ? err.message : 'Installation failed';\n const errorMsg = mapInstallError(rawMsg);\n dispatchInstall({ type: 'setError', error: errorMsg });\n onInstallError?.(new Error(rawMsg));\n } finally {\n dispatchInstall({ type: 'finishInstall' });\n }\n };\n\n /**\n * Main install handler - routes to appropriate install function\n */\n const handleInstall = async () => {\n const appType = app.type?.toUpperCase() ?? '';\n\n if (purchaseState === 'purchased' || orderId || STORE_DISTRIBUTED_TYPES.has(appType)) {\n // Purchased products install through the store service.\n await handleInstallFromStore();\n } else {\n // Free products install through the workspace service.\n await handleInstallViaWorkspace();\n }\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"mx-4 w-full max-w-lg gap-0 p-0\">\n {/* Header */}\n <DialogHeader className=\"flex flex-row items-center justify-between space-y-0 border-b border-border-default px-6 py-4 text-left\">\n <div className=\"flex items-center gap-3\">\n {app.icon ? (\n <img src={app.icon} alt={app.name} className=\"size-10 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex size-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted\">\n {app.name.charAt(0)}\n </div>\n )}\n <div>\n <DialogTitle className=\"text-lg font-semibold text-text-primary\">\n Install App\n </DialogTitle>\n <DialogDescription className=\"text-sm text-text-muted\">\n {app.name}\n </DialogDescription>\n </div>\n </div>\n </DialogHeader>\n\n {/* Content */}\n <div className=\"px-6 py-4\">\n <p className=\"mb-4 text-text-secondary\">\n Select the workspace where you want to install this app:\n </p>\n\n {/* Workspace List */}\n <div className=\"max-h-72 overflow-y-auto rounded-lg border border-border-default\">\n {loading ? (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 className=\"size-8 animate-spin text-text-muted\" />\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <AlertCircle className=\"mb-2 size-8 text-status-error-text\" />\n <p className=\"text-sm text-status-error-text\">Failed to load workspaces</p>\n <p className=\"text-xs text-text-muted mt-1\">{error.message}</p>\n </div>\n ) : filteredWorkspaces.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <Building2 className=\"mb-2 size-8 text-text-muted\" />\n <p className=\"text-sm text-text-muted\">No workspaces available</p>\n </div>\n ) : (\n <div className=\"divide-y divide-border-default\">\n {filteredWorkspaces.map((workspace) => (\n <button\n type=\"button\"\n key={workspace.id}\n onClick={() =>\n dispatchInstall({ type: 'selectWorkspace', workspaceId: workspace.id })\n }\n className={`w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${\n selectedWorkspace === workspace.id\n ? 'bg-action-primary-bg/10'\n : 'transition-colors hover:bg-bg-sunken'\n }`}\n >\n {/* Workspace Icon */}\n <div className=\"flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link\">\n <Building2 className=\"size-5\" />\n </div>\n\n {/* Workspace Info */}\n <div className=\"flex-1 min-w-0\">\n <p className=\"font-medium text-text-primary truncate\">{workspace.name}</p>\n {workspace.slug ? (\n <p className=\"text-xs text-text-muted truncate\">/{workspace.slug}</p>\n ) : null}\n </div>\n\n {/* Selection Indicator */}\n {selectedWorkspace === workspace.id && (\n <CheckCircle className=\"size-5 flex-shrink-0 text-action-primary-bg\" />\n )}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Footer */}\n <DialogFooter className=\"block border-t border-border-default px-6 py-4 sm:flex-col sm:items-stretch sm:space-x-0\">\n {/* Already-installed info */}\n {installInfo && (\n <div 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\">\n <Info className=\"size-4 flex-shrink-0\" />\n <span>{installInfo}</span>\n </div>\n )}\n {/* Error message */}\n {installError && (\n <div 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\">\n <AlertCircle className=\"size-4 flex-shrink-0\" />\n <span>{installError}</span>\n </div>\n )}\n <div className=\"flex items-center justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n disabled={installing}\n 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\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleInstall}\n disabled={!selectedWorkspace || installing}\n 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\"\n >\n {installing ? (\n <>\n <Loader2 className=\"size-4 animate-spin\" />\n Installing…\n </>\n ) : (\n 'Install App'\n )}\n </button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n"],"mappings":";;;;;;;AAyCA,IAAM,IAAuB,mGACvB,IAAgC,mOAChC,IAAiC,kJACjC,IAA+B,2RAC/B,IAAoC,6JACpC,IAA0B,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,EAEI,IAAiD;CACrD,mBAAmB;CACnB,gBAAgB;CAChB,mBAAmB;CACnB,WAAW;CACX,oBAAoB;CACpB,qBAAqB;CACrB,kBAAkB;CACnB;AAED,SAAS,EAAgB,GAAqB;AAC5C,MAAK,IAAM,CAAC,GAAM,MAAY,OAAO,QAAQ,EAAuB,CAClE,KAAI,EAAI,aAAa,CAAC,SAAS,EAAK,CAAE,QAAO;AAE/C,QAAO;;AAkBT,IAAM,IAAoC;CACxC,mBAAmB;CACnB,YAAY;CACZ,cAAc;CACd,aAAa;CACd;AAED,SAAS,EAAe,GAAqB,GAAqC;AAChF,SAAQ,EAAO,MAAf;EACE,KAAK,QACH,QAAO;EACT,KAAK,kBACH,QAAO;GAAE,GAAG;GAAO,mBAAmB,EAAO;GAAa;EAC5D,KAAK,eACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAM,cAAc;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G9B,MAAM,GAA2B;;QAsHzB,UAAU,CAAC,KAAqB;QAChC,WAAU;kBAET,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAS,WAAU,uBAAwB,CAAA,EAAA,cAE1C,EAAA,CAAA,GAEH;QAEK,CAAA,CACL;;MACO;;IACD;;EACT,CAAA"}
@@ -23,7 +23,7 @@ var l = ({ isOpen: l, onClose: u, onCheckout: d, cartItems: f, itemCount: p, sub
23
23
  children: "Shopping Cart"
24
24
  }),
25
25
  p > 0 && /* @__PURE__ */ s("span", {
26
- className: "rounded-full bg-bg-accent px-2 py-0.5 text-xs font-medium text-text-link",
26
+ className: "rounded-full bg-bg-accent px-2 py-0.5 text-xs font-medium tabular-nums text-text-link",
27
27
  children: p
28
28
  })
29
29
  ]
@@ -125,7 +125,7 @@ var l = ({ isOpen: l, onClose: u, onCheckout: d, cartItems: f, itemCount: p, sub
125
125
  /* @__PURE__ */ s("div", {
126
126
  className: "mt-2 text-right",
127
127
  children: /* @__PURE__ */ s("span", {
128
- className: "font-semibold text-text-primary",
128
+ className: "font-semibold tabular-nums text-text-primary",
129
129
  children: e(a.subtotal)
130
130
  })
131
131
  })
@@ -145,7 +145,7 @@ var l = ({ isOpen: l, onClose: u, onCheckout: d, cartItems: f, itemCount: p, sub
145
145
  className: "text-text-muted",
146
146
  children: "Subtotal"
147
147
  }), /* @__PURE__ */ s("span", {
148
- className: "font-medium text-text-primary",
148
+ className: "font-medium tabular-nums text-text-primary",
149
149
  children: e(m)
150
150
  })]
151
151
  }),
@@ -155,7 +155,7 @@ var l = ({ isOpen: l, onClose: u, onCheckout: d, cartItems: f, itemCount: p, sub
155
155
  className: "text-text-muted",
156
156
  children: "Tax"
157
157
  }), /* @__PURE__ */ s("span", {
158
- className: "font-medium text-text-primary",
158
+ className: "font-medium tabular-nums text-text-primary",
159
159
  children: e(h)
160
160
  })]
161
161
  }),
@@ -165,7 +165,7 @@ var l = ({ isOpen: l, onClose: u, onCheckout: d, cartItems: f, itemCount: p, sub
165
165
  className: "font-semibold text-text-primary",
166
166
  children: "Total"
167
167
  }), /* @__PURE__ */ s("span", {
168
- className: "text-lg font-bold text-text-primary",
168
+ className: "text-lg font-bold tabular-nums text-text-primary",
169
169
  children: e(g)
170
170
  })]
171
171
  })