@burdenoff/microfe-store 2026.703.2 → 2026.704.1

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.
@@ -1,18 +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, ShieldCheck as u } from "lucide-react";
4
- import { graphqlFetch as d } from "@burdenoff/fe-libs/shared/graphql";
5
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
6
- import { Dialog as h, DialogContent as g, DialogDescription as _, DialogFooter as v, DialogHeader as y, DialogTitle as b } from "@burdenoff/fe-libs/ui";
3
+ import { AlertCircle as a, ArrowLeft as o, Building2 as s, CheckCircle as c, ChevronRight as l, Info as u, Loader2 as d, ShieldCheck as f } from "lucide-react";
4
+ import { graphqlFetch as p } from "@burdenoff/fe-libs/shared/graphql";
5
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
6
+ import { Dialog as _, DialogContent as v, DialogDescription as ee, DialogFooter as y, DialogHeader as b, DialogTitle as x } from "@burdenoff/fe-libs/ui";
7
7
  //#region src/components/InstallAppModal.tsx
8
- var x = "query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }", S = "mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }", C = "mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }", w = "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 } }", T = "mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }", E = new Set([
8
+ var S = "query MyWorkspaces { myWorkspaces { items { id name slug type status organizationId } total } }", C = "mutation InstallWorkspaceApps($workspaceIds: [ID!]!, $input: InstallWorkspaceAppInput!) { installWorkspaceApps(workspaceIds: $workspaceIds, input: $input) { successCount failedCount results { success workspaceId error } } }", w = "mutation RecordAppInstallation($input: RecordAppInstallationInput!) { recordAppInstallation(input: $input) { id status workspaceId version } }", T = "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 } }", E = "mutation CreateProductEntitlement($input: CreateProductEntitlementInput!) { createProductEntitlement(input: $input) { id status productId workspaceId } }", D = "mutation InstallAppDevportal($input: InstallAppInput!) { installApp(input: $input) { id status workspaceId application { oauthAuthUrl } } }", O = new Set([
9
9
  "VIBEMODULE",
10
10
  "NODE",
11
11
  "CONSOLE",
12
12
  "DASHBOARD",
13
13
  "PARSER",
14
14
  "DATASINK"
15
- ]), D = {
15
+ ]), k = new Set(["INTEGRATION", "API_INTEGRATION"]), A = {
16
16
  ALREADY_INSTALLED: "This app is already installed in the selected workspace.",
17
17
  QUOTA_EXCEEDED: "Installation limit reached. Please upgrade your plan or contact support.",
18
18
  PERMISSION_DENIED: "You do not have permission to install apps in this workspace.",
@@ -21,23 +21,34 @@ var x = "query MyWorkspaces { myWorkspaces { items { id name slug type status or
21
21
  ENTITLEMENT_EXPIRED: "Your license for this app has expired.",
22
22
  UNSUPPORTED_TYPE: "This product type cannot be installed in the selected workspace."
23
23
  };
24
- function O(e) {
25
- for (let [t, n] of Object.entries(D)) if (e.toUpperCase().includes(t)) return n;
24
+ function j(e) {
25
+ for (let [t, n] of Object.entries(A)) if (e.toUpperCase().includes(t)) return n;
26
26
  return "Installation failed. Please try again or contact support.";
27
27
  }
28
- var k = {
28
+ var M = {
29
+ step: "workspace",
29
30
  selectedWorkspace: null,
30
31
  installing: !1,
31
32
  installError: null,
32
33
  installInfo: null
33
34
  };
34
- function A(e, t) {
35
+ function N(e, t) {
35
36
  switch (t.type) {
36
- case "reset": return k;
37
+ case "reset": return M;
37
38
  case "selectWorkspace": return {
38
39
  ...e,
39
40
  selectedWorkspace: t.workspaceId
40
41
  };
42
+ case "advanceToConsent": return {
43
+ ...e,
44
+ step: "consent",
45
+ installError: null
46
+ };
47
+ case "backToWorkspace": return {
48
+ ...e,
49
+ step: "workspace",
50
+ installError: null
51
+ };
41
52
  case "startInstall": return {
42
53
  ...e,
43
54
  installing: !0,
@@ -59,300 +70,428 @@ function A(e, t) {
59
70
  default: return e;
60
71
  }
61
72
  }
62
- function j(r) {
63
- let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [u, f] = i(null), p = t(async () => {
73
+ function P(r) {
74
+ let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [u, d] = i(null), f = t(async () => {
64
75
  if (!r) {
65
- l(!0), f(null);
76
+ l(!0), d(null);
66
77
  try {
67
- let e = await d({
78
+ let e = await p({
68
79
  gateway: "global",
69
- query: x,
80
+ query: S,
70
81
  authToken: a || void 0
71
82
  });
72
83
  if (e.errors?.length) throw Error(e.errors[0]?.message ?? "GraphQL error");
73
84
  s(e.data?.myWorkspaces?.items || []);
74
85
  } catch (e) {
75
- f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch workspaces"));
86
+ d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch workspaces"));
76
87
  } finally {
77
88
  l(!1);
78
89
  }
79
90
  }
80
91
  }, [a, r]);
81
92
  return n(() => {
82
- p();
83
- }, [p]), {
93
+ f();
94
+ }, [f]), {
84
95
  workspaces: o,
85
96
  loading: c,
86
97
  error: u,
87
- refetch: p
98
+ refetch: f
88
99
  };
89
100
  }
90
- var M = ({ isOpen: t, onClose: n, app: i, orderId: x, purchaseState: D = "free", onInstallSuccess: M, onInstallError: N }) => {
91
- let { authToken: P, user: F } = e(), [I, L] = r(A, k), { selectedWorkspace: R, installing: z, installError: B, installInfo: V } = I, { workspaces: H, loading: U, error: W } = j(!t), G = H.filter((e) => e.status === "ACTIVE"), K = async () => {
92
- if (!R) return;
93
- let e = G.find((e) => e.id === R);
101
+ var F = ({ isOpen: t, onClose: i, app: S, orderId: A, purchaseState: F = "free", onInstallSuccess: I, onInstallError: L }) => {
102
+ let { authToken: R, user: te } = e(), [z, B] = r(N, M), { step: V, selectedWorkspace: H, installing: U, installError: W, installInfo: G } = z, K = S.type?.toUpperCase() ?? "", q = k.has(K), { workspaces: J, loading: Y, error: X } = P(!t);
103
+ n(() => {
104
+ t || B({ type: "reset" });
105
+ }, [t]);
106
+ let Z = J.filter((e) => e.status === "ACTIVE"), ne = async () => {
107
+ if (!H) return;
108
+ let e = Z.find((e) => e.id === H);
94
109
  if (!e) return;
95
- let t = F?.id;
96
- L({ type: "startInstall" });
110
+ let t = te?.id;
111
+ B({ type: "startInstall" });
97
112
  try {
98
- if (!x && D !== "purchased") {
113
+ if (!A && F !== "purchased") {
99
114
  if (!t) throw Error("Unable to identify the current user for license creation");
100
- await d({
115
+ await p({
101
116
  gateway: "global",
102
- query: T,
117
+ query: E,
103
118
  variables: { input: {
104
- productId: i.id,
119
+ productId: S.id,
105
120
  purchasedBy: t,
106
121
  workspaceId: e.id,
107
122
  metadata: {
108
123
  source: "store-ui",
109
- productType: i.type
124
+ productType: S.type
110
125
  }
111
126
  } },
112
- authToken: P || void 0
127
+ authToken: R || void 0
113
128
  });
114
129
  }
115
- let r = await d({
130
+ let n = await p({
116
131
  gateway: "global",
117
- query: w,
132
+ query: T,
118
133
  variables: {
119
- orderId: x ?? null,
120
- productId: i.id,
134
+ orderId: A ?? null,
135
+ productId: S.id,
121
136
  workspaceId: e.id
122
137
  },
123
- authToken: P || void 0
138
+ authToken: R || void 0
124
139
  });
125
- if (r.errors?.length) throw Error(r.errors[0]?.message ?? "Installation failed");
126
- let a = r.data?.installPurchasedApp;
127
- if (a?.success) a.alreadyInstalled ? L({
140
+ if (n.errors?.length) throw Error(n.errors[0]?.message ?? "Installation failed");
141
+ let r = n.data?.installPurchasedApp;
142
+ if (r?.success) r.alreadyInstalled ? B({
128
143
  type: "setInfo",
129
- info: a.message || "Already installed on this workspace"
130
- }) : (M?.(e.id, e.name), n());
144
+ info: r.message || "Already installed on this workspace"
145
+ }) : (I?.(e.id, e.name), i());
131
146
  else {
132
- let e = a?.error || "Installation failed";
133
- L({
147
+ let e = r?.error || "Installation failed";
148
+ B({
134
149
  type: "setError",
135
- error: O(e)
136
- }), N?.(Error(e));
150
+ error: j(e)
151
+ }), L?.(Error(e));
137
152
  }
138
153
  } catch (e) {
139
154
  let t = e instanceof Error ? e.message : "Installation failed";
140
- L({
155
+ B({
141
156
  type: "setError",
142
- error: O(t)
143
- }), N?.(Error(t));
157
+ error: j(t)
158
+ }), L?.(Error(t));
144
159
  } finally {
145
- L({ type: "finishInstall" });
160
+ B({ type: "finishInstall" });
146
161
  }
147
- }, q = async () => {
148
- if (!R) return;
149
- let e = G.find((e) => e.id === R);
162
+ }, re = async () => {
163
+ if (!H) return;
164
+ let e = Z.find((e) => e.id === H);
150
165
  if (e) {
151
- L({ type: "startInstall" });
166
+ B({ type: "startInstall" });
152
167
  try {
153
- let t = await d({
168
+ let t = await p({
154
169
  gateway: "workspace",
155
- query: S,
170
+ query: C,
156
171
  variables: {
157
172
  workspaceIds: [e.id],
158
173
  input: {
159
- appName: i.slug || i.name.toLowerCase().replace(/\s+/g, "-"),
160
- displayName: i.name,
161
- version: i.version || "1.0.0",
162
- type: i.type || "app",
174
+ appName: S.slug || S.name.toLowerCase().replace(/\s+/g, "-"),
175
+ displayName: S.name,
176
+ version: S.version || "1.0.0",
177
+ type: S.type || "app",
163
178
  manifest: {
164
- productId: i.id,
165
- icon: i.icon
179
+ productId: S.id,
180
+ icon: S.icon
166
181
  }
167
182
  }
168
183
  },
169
- authToken: P || void 0,
184
+ authToken: R || void 0,
170
185
  workspaceId: e.id,
171
186
  workspaceToken: !0
172
187
  });
173
188
  if (t.errors?.length) throw Error(t.errors[0]?.message ?? "Installation failed");
174
- let r = t.data?.installWorkspaceApps;
175
- if (r?.successCount && r.successCount > 0) {
189
+ let n = t.data?.installWorkspaceApps;
190
+ if (n?.successCount && n.successCount > 0) {
176
191
  try {
177
- await d({
192
+ await p({
178
193
  gateway: "global",
179
- query: C,
194
+ query: w,
180
195
  variables: { input: {
181
- productId: i.id,
196
+ productId: S.id,
182
197
  workspaceId: e.id,
183
198
  workspaceName: e.name,
184
199
  workspaceType: e.type,
185
200
  organizationId: e.organizationId,
186
- version: i.version || "1.0.0",
201
+ version: S.version || "1.0.0",
187
202
  manifest: {
188
- productId: i.id,
189
- icon: i.icon,
190
- slug: i.slug,
191
- type: i.type
203
+ name: S.name,
204
+ productId: S.id,
205
+ icon: S.icon,
206
+ slug: S.slug,
207
+ type: S.type
192
208
  }
193
209
  } },
194
- authToken: P || void 0
210
+ authToken: R || void 0
195
211
  });
196
212
  } catch {}
197
- M?.(e.id, e.name), n();
213
+ I?.(e.id, e.name), i();
198
214
  } else {
199
- let e = r?.results?.[0]?.error || "Installation failed";
200
- L({
215
+ let e = n?.results?.[0]?.error || "Installation failed";
216
+ B({
201
217
  type: "setError",
202
- error: O(e)
203
- }), N?.(Error(e));
218
+ error: j(e)
219
+ }), L?.(Error(e));
204
220
  }
205
221
  } catch (e) {
206
222
  let t = e instanceof Error ? e.message : "Installation failed";
207
- L({
223
+ B({
208
224
  type: "setError",
209
- error: O(t)
210
- }), N?.(Error(t));
225
+ error: j(t)
226
+ }), L?.(Error(t));
211
227
  } finally {
212
- L({ type: "finishInstall" });
228
+ B({ type: "finishInstall" });
213
229
  }
214
230
  }
215
- };
216
- return /* @__PURE__ */ p(h, {
231
+ }, ie = () => {
232
+ q ? B({ type: "advanceToConsent" }) : Q();
233
+ }, ae = async () => {
234
+ if (!H) return;
235
+ let e = Z.find((e) => e.id === H);
236
+ if (e) {
237
+ B({ type: "startInstall" });
238
+ try {
239
+ let t = await p({
240
+ gateway: "global",
241
+ query: D,
242
+ variables: { input: {
243
+ applicationId: S.applicationId ?? S.id,
244
+ scope: "WORKSPACE",
245
+ workspaceId: e.id,
246
+ consentedPermissions: S.permissions ?? []
247
+ } },
248
+ authToken: R || void 0
249
+ });
250
+ if (t.errors?.length) throw Error(t.errors[0]?.message ?? "Installation failed");
251
+ let n = t.data?.installApp;
252
+ if (!n) throw Error("Installation failed");
253
+ try {
254
+ await p({
255
+ gateway: "global",
256
+ query: w,
257
+ variables: { input: {
258
+ productId: S.id,
259
+ workspaceId: e.id,
260
+ workspaceName: e.name,
261
+ workspaceType: e.type,
262
+ organizationId: e.organizationId,
263
+ version: S.version || "1.0.0",
264
+ manifest: {
265
+ name: S.name,
266
+ applicationId: S.applicationId,
267
+ productId: S.id,
268
+ icon: S.icon,
269
+ slug: S.slug,
270
+ type: S.type,
271
+ installationId: n.id
272
+ }
273
+ } },
274
+ authToken: R || void 0
275
+ });
276
+ } catch {}
277
+ let r = n.application?.oauthAuthUrl;
278
+ r && window.open(`${r}?installation_id=${n.id}`, "_blank"), I?.(e.id, e.name), i();
279
+ } catch (e) {
280
+ let t = e instanceof Error ? e.message : "Installation failed";
281
+ B({
282
+ type: "setError",
283
+ error: j(t)
284
+ }), L?.(Error(t));
285
+ } finally {
286
+ B({ type: "finishInstall" });
287
+ }
288
+ }
289
+ }, Q = async () => {
290
+ k.has(K) ? await ae() : F === "purchased" || A || O.has(K) ? await ne() : await re();
291
+ }, $ = Z.find((e) => e.id === H);
292
+ return /* @__PURE__ */ h(_, {
217
293
  open: t,
218
- onOpenChange: (e) => !e && n(),
219
- children: /* @__PURE__ */ m(g, {
294
+ onOpenChange: (e) => !e && i(),
295
+ children: /* @__PURE__ */ g(v, {
220
296
  className: "mx-4 w-full max-w-lg gap-0 p-0",
221
297
  children: [
222
- /* @__PURE__ */ p(y, {
298
+ /* @__PURE__ */ g(b, {
223
299
  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__ */ m("div", {
300
+ children: [/* @__PURE__ */ g("div", {
225
301
  className: "flex items-center gap-3",
226
- children: [i.icon ? /* @__PURE__ */ p("img", {
227
- src: i.icon,
228
- alt: i.name,
302
+ children: [S.icon ? /* @__PURE__ */ h("img", {
303
+ src: S.icon,
304
+ alt: S.name,
229
305
  className: "size-10 rounded-lg object-cover"
230
- }) : /* @__PURE__ */ p("div", {
306
+ }) : /* @__PURE__ */ h("div", {
231
307
  className: "flex size-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted",
232
- children: i.name.charAt(0)
233
- }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(b, {
308
+ children: S.name.charAt(0)
309
+ }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h(x, {
234
310
  className: "text-lg font-semibold text-text-primary",
235
- children: "Install App"
236
- }), /* @__PURE__ */ p(_, {
311
+ children: V === "consent" ? "Review Permissions" : "Install App"
312
+ }), /* @__PURE__ */ h(ee, {
237
313
  className: "text-sm text-text-muted",
238
- children: i.name
314
+ children: S.name
239
315
  })] })]
240
- })
316
+ }), q && /* @__PURE__ */ g("div", {
317
+ className: "flex items-center gap-1.5 text-xs text-text-muted shrink-0",
318
+ children: [
319
+ /* @__PURE__ */ h("span", {
320
+ className: V === "workspace" ? "font-semibold text-text-primary" : "",
321
+ children: "1"
322
+ }),
323
+ /* @__PURE__ */ h(l, { className: "size-3" }),
324
+ /* @__PURE__ */ h("span", {
325
+ className: V === "consent" ? "font-semibold text-text-primary" : "",
326
+ children: "2"
327
+ })
328
+ ]
329
+ })]
241
330
  }),
242
- /* @__PURE__ */ m("div", {
331
+ V === "workspace" && /* @__PURE__ */ g("div", {
243
332
  className: "px-6 py-4",
244
- children: [
245
- i.permissions && i.permissions.length > 0 && /* @__PURE__ */ m("div", {
246
- className: "mb-5 rounded-lg border border-border-seam bg-bg-surface px-4 py-3",
333
+ children: [/* @__PURE__ */ h("p", {
334
+ className: "mb-4 text-text-secondary",
335
+ children: "Select the workspace where you want to install this app:"
336
+ }), /* @__PURE__ */ h("div", {
337
+ className: "max-h-72 overflow-y-auto rounded-lg border border-border-seam",
338
+ children: Y ? /* @__PURE__ */ h("div", {
339
+ className: "flex items-center justify-center py-12",
340
+ children: /* @__PURE__ */ h(d, { className: "size-8 animate-spin text-text-muted" })
341
+ }) : X ? /* @__PURE__ */ g("div", {
342
+ className: "flex flex-col items-center justify-center py-12 text-center",
247
343
  children: [
248
- /* @__PURE__ */ m("div", {
249
- className: "mb-2 flex items-center gap-2",
250
- children: [/* @__PURE__ */ p(u, { className: "size-4 text-status-success-text" }), /* @__PURE__ */ p("p", {
251
- className: "text-sm font-medium text-text-primary",
252
- children: "Permissions requested"
253
- })]
254
- }),
255
- /* @__PURE__ */ p("p", {
256
- className: "mb-3 text-xs text-text-secondary",
257
- children: "By installing, you grant this app access to the following in the selected workspace:"
344
+ /* @__PURE__ */ h(a, { className: "mb-2 size-8 text-status-error-text" }),
345
+ /* @__PURE__ */ h("p", {
346
+ className: "text-sm text-status-error-text",
347
+ children: "Failed to load workspaces"
258
348
  }),
259
- /* @__PURE__ */ p("ul", {
260
- className: "space-y-1.5",
261
- children: i.permissions.map((e) => /* @__PURE__ */ m("li", {
262
- className: "flex items-center gap-2 text-sm text-text-primary",
263
- children: [/* @__PURE__ */ p("span", { className: "size-1.5 rounded-full bg-action-primary-bg flex-shrink-0" }), e]
264
- }, e))
349
+ /* @__PURE__ */ h("p", {
350
+ className: "text-xs text-text-muted mt-1",
351
+ children: X.message
265
352
  })
266
353
  ]
354
+ }) : Z.length === 0 ? /* @__PURE__ */ g("div", {
355
+ className: "flex flex-col items-center justify-center py-12 text-center",
356
+ children: [/* @__PURE__ */ h(s, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ h("p", {
357
+ className: "text-sm text-text-muted",
358
+ children: "No workspaces available"
359
+ })]
360
+ }) : /* @__PURE__ */ h("div", {
361
+ className: "divide-y divide-border-default",
362
+ children: Z.map((e) => /* @__PURE__ */ g("button", {
363
+ type: "button",
364
+ onClick: () => B({
365
+ type: "selectWorkspace",
366
+ workspaceId: e.id
367
+ }),
368
+ className: `w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${H === e.id ? "bg-action-primary-bg/10" : "hover:bg-bg-sunken"}`,
369
+ children: [
370
+ /* @__PURE__ */ h("div", {
371
+ className: "flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link",
372
+ children: /* @__PURE__ */ h(s, { className: "size-5" })
373
+ }),
374
+ /* @__PURE__ */ g("div", {
375
+ className: "flex-1 min-w-0",
376
+ children: [/* @__PURE__ */ h("p", {
377
+ className: "font-medium text-text-primary truncate",
378
+ children: e.name
379
+ }), e.slug ? /* @__PURE__ */ g("p", {
380
+ className: "text-xs text-text-muted truncate",
381
+ children: ["/", e.slug]
382
+ }) : null]
383
+ }),
384
+ H === e.id && /* @__PURE__ */ h(c, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
385
+ ]
386
+ }, e.id))
387
+ })
388
+ })]
389
+ }),
390
+ V === "consent" && /* @__PURE__ */ g("div", {
391
+ className: "px-6 py-4",
392
+ children: [
393
+ $ && /* @__PURE__ */ g("div", {
394
+ className: "mb-4 flex items-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2",
395
+ children: [/* @__PURE__ */ h(s, { className: "size-4 shrink-0 text-text-muted" }), /* @__PURE__ */ g("span", {
396
+ className: "text-sm text-text-secondary",
397
+ children: [
398
+ "Installing into",
399
+ " ",
400
+ /* @__PURE__ */ h("span", {
401
+ className: "font-medium text-text-primary",
402
+ children: $.name
403
+ })
404
+ ]
405
+ })]
267
406
  }),
268
- /* @__PURE__ */ p("p", {
269
- className: "mb-4 text-text-secondary",
270
- children: "Select the workspace where you want to install this app:"
407
+ /* @__PURE__ */ g("div", {
408
+ className: "mb-4 flex items-center gap-2",
409
+ children: [/* @__PURE__ */ h(f, { className: "size-5 text-status-success-text" }), /* @__PURE__ */ h("p", {
410
+ className: "text-sm font-semibold text-text-primary",
411
+ children: "Permissions requested"
412
+ })]
271
413
  }),
272
- /* @__PURE__ */ p("div", {
273
- className: "max-h-72 overflow-y-auto rounded-lg border border-border-seam",
274
- children: U ? /* @__PURE__ */ p("div", {
275
- className: "flex items-center justify-center py-12",
276
- children: /* @__PURE__ */ p(l, { className: "size-8 animate-spin text-text-muted" })
277
- }) : W ? /* @__PURE__ */ m("div", {
278
- className: "flex flex-col items-center justify-center py-12 text-center",
414
+ /* @__PURE__ */ g("p", {
415
+ className: "mb-4 text-sm text-text-secondary",
416
+ children: [
417
+ "By clicking ",
418
+ /* @__PURE__ */ h("strong", { children: "Accept & Install" }),
419
+ ", you grant",
420
+ " ",
421
+ /* @__PURE__ */ h("strong", { children: S.name }),
422
+ " access to the following in the selected workspace:"
423
+ ]
424
+ }),
425
+ /* @__PURE__ */ h("div", {
426
+ className: "rounded-lg border border-border-seam bg-bg-surface px-4 py-3",
427
+ children: S.permissions && S.permissions.length > 0 ? /* @__PURE__ */ h("ul", {
428
+ className: "space-y-2",
429
+ children: S.permissions.map((e) => /* @__PURE__ */ g("li", {
430
+ className: "flex items-center gap-2.5 text-sm text-text-primary",
431
+ children: [/* @__PURE__ */ h(c, { className: "size-4 shrink-0 text-status-success-text" }), e]
432
+ }, e))
433
+ }) : /* @__PURE__ */ g("ul", {
434
+ className: "space-y-2",
279
435
  children: [
280
- /* @__PURE__ */ p(a, { className: "mb-2 size-8 text-status-error-text" }),
281
- /* @__PURE__ */ p("p", {
282
- className: "text-sm text-status-error-text",
283
- children: "Failed to load workspaces"
436
+ /* @__PURE__ */ g("li", {
437
+ className: "flex items-center gap-2.5 text-sm text-text-primary",
438
+ children: [/* @__PURE__ */ h(c, { className: "size-4 shrink-0 text-status-success-text" }), "Read and write data within this workspace on your behalf"]
439
+ }),
440
+ /* @__PURE__ */ g("li", {
441
+ className: "flex items-center gap-2.5 text-sm text-text-primary",
442
+ children: [/* @__PURE__ */ h(c, { className: "size-4 shrink-0 text-status-success-text" }), "Receive webhook events for workspace activity"]
284
443
  }),
285
- /* @__PURE__ */ p("p", {
286
- className: "text-xs text-text-muted mt-1",
287
- children: W.message
444
+ /* @__PURE__ */ g("li", {
445
+ className: "flex items-center gap-2.5 text-sm text-text-primary",
446
+ children: [/* @__PURE__ */ h(c, { className: "size-4 shrink-0 text-status-success-text" }), "Act as an authorized integration within this workspace"]
288
447
  })
289
448
  ]
290
- }) : G.length === 0 ? /* @__PURE__ */ m("div", {
291
- className: "flex flex-col items-center justify-center py-12 text-center",
292
- children: [/* @__PURE__ */ p(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ p("p", {
293
- className: "text-sm text-text-muted",
294
- children: "No workspaces available"
295
- })]
296
- }) : /* @__PURE__ */ p("div", {
297
- className: "divide-y divide-border-default",
298
- children: G.map((e) => /* @__PURE__ */ m("button", {
299
- type: "button",
300
- onClick: () => L({
301
- type: "selectWorkspace",
302
- workspaceId: e.id
303
- }),
304
- className: `w-full cursor-pointer flex items-center gap-3 px-4 py-3 text-left transition-colors ${R === e.id ? "bg-action-primary-bg/10" : "transition-colors hover:bg-bg-sunken"}`,
305
- children: [
306
- /* @__PURE__ */ p("div", {
307
- className: "flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link",
308
- children: /* @__PURE__ */ p(o, { className: "size-5" })
309
- }),
310
- /* @__PURE__ */ m("div", {
311
- className: "flex-1 min-w-0",
312
- children: [/* @__PURE__ */ p("p", {
313
- className: "font-medium text-text-primary truncate",
314
- children: e.name
315
- }), e.slug ? /* @__PURE__ */ m("p", {
316
- className: "text-xs text-text-muted truncate",
317
- children: ["/", e.slug]
318
- }) : null]
319
- }),
320
- R === e.id && /* @__PURE__ */ p(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
321
- ]
322
- }, e.id))
323
449
  })
450
+ }),
451
+ /* @__PURE__ */ h("p", {
452
+ className: "mt-3 text-xs text-text-muted",
453
+ children: "You can revoke access at any time from your Installed Apps settings."
324
454
  })
325
455
  ]
326
456
  }),
327
- /* @__PURE__ */ m(v, {
457
+ /* @__PURE__ */ g(y, {
328
458
  className: "block border-t border-border-default px-6 py-4 sm:flex-col sm:items-stretch sm:space-x-0",
329
459
  children: [
330
- V && /* @__PURE__ */ m("div", {
460
+ G && /* @__PURE__ */ g("div", {
331
461
  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",
332
- children: [/* @__PURE__ */ p(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ p("span", { children: V })]
462
+ children: [/* @__PURE__ */ h(u, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ h("span", { children: G })]
333
463
  }),
334
- B && /* @__PURE__ */ m("div", {
464
+ W && /* @__PURE__ */ g("div", {
335
465
  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",
336
- children: [/* @__PURE__ */ p(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ p("span", { children: B })]
466
+ children: [/* @__PURE__ */ h(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ h("span", { children: W })]
337
467
  }),
338
- /* @__PURE__ */ m("div", {
468
+ /* @__PURE__ */ h("div", {
339
469
  className: "flex items-center justify-end gap-3",
340
- children: [/* @__PURE__ */ p("button", {
470
+ children: V === "consent" ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("button", {
471
+ type: "button",
472
+ onClick: () => B({ type: "backToWorkspace" }),
473
+ disabled: U,
474
+ className: "cursor-pointer inline-flex items-center gap-1.5 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",
475
+ children: [/* @__PURE__ */ h(o, { className: "size-4" }), "Back"]
476
+ }), /* @__PURE__ */ h("button", {
341
477
  type: "button",
342
- onClick: n,
343
- disabled: z,
478
+ onClick: () => void Q(),
479
+ disabled: U,
480
+ 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",
481
+ children: U ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(d, { className: "size-4 animate-spin" }), "Installing…"] }) : "Accept & Install"
482
+ })] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("button", {
483
+ type: "button",
484
+ onClick: i,
485
+ disabled: U,
344
486
  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",
345
487
  children: "Cancel"
346
- }), /* @__PURE__ */ p("button", {
488
+ }), /* @__PURE__ */ h("button", {
347
489
  type: "button",
348
- onClick: async () => {
349
- let e = i.type?.toUpperCase() ?? "";
350
- D === "purchased" || x || E.has(e) ? await K() : await q();
351
- },
352
- disabled: !R || z,
490
+ onClick: ie,
491
+ disabled: !H || U,
353
492
  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",
354
- children: z ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
355
- })]
493
+ children: U ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(d, { className: "size-4 animate-spin" }), "Installing…"] }) : q ? /* @__PURE__ */ g(m, { children: ["Continue", /* @__PURE__ */ h(l, { className: "size-4" })] }) : "Install App"
494
+ })] })
356
495
  })
357
496
  ]
358
497
  })
@@ -361,6 +500,6 @@ var M = ({ isOpen: t, onClose: n, app: i, orderId: x, purchaseState: D = "free",
361
500
  });
362
501
  };
363
502
  //#endregion
364
- export { M as InstallAppModal };
503
+ export { F as InstallAppModal };
365
504
 
366
505
  //# sourceMappingURL=InstallAppModal.js.map