@burdenoff/microfe-store 2026.703.1 → 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 } from "lucide-react";
4
- import { graphqlFetch as u } from "@burdenoff/fe-libs/shared/graphql";
5
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
- import { Dialog as m, DialogContent as h, DialogDescription as g, DialogFooter as _, DialogHeader as v, DialogTitle as y } 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 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
+ 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
- ]), E = {
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 b = "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 D(e) {
25
- for (let [t, n] of Object.entries(E)) 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 O = {
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 k(e, t) {
35
+ function N(e, t) {
35
36
  switch (t.type) {
36
- case "reset": return O;
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,274 +70,428 @@ function k(e, t) {
59
70
  default: return e;
60
71
  }
61
72
  }
62
- function A(r) {
63
- let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [d, 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 u({
78
+ let e = await p({
68
79
  gateway: "global",
69
- query: b,
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
- error: d,
87
- refetch: p
97
+ error: u,
98
+ refetch: f
88
99
  };
89
100
  }
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);
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 = P?.id;
96
- I({ type: "startInstall" });
110
+ let t = te?.id;
111
+ B({ type: "startInstall" });
97
112
  try {
98
- if (!b && E !== "purchased") {
113
+ if (!A && F !== "purchased") {
99
114
  if (!t) throw Error("Unable to identify the current user for license creation");
100
- await u({
115
+ await p({
101
116
  gateway: "global",
102
- query: w,
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: N || void 0
127
+ authToken: R || void 0
113
128
  });
114
129
  }
115
- let r = await u({
130
+ let n = await p({
116
131
  gateway: "global",
117
- query: C,
132
+ query: T,
118
133
  variables: {
119
- orderId: b ?? null,
120
- productId: i.id,
134
+ orderId: A ?? null,
135
+ productId: S.id,
121
136
  workspaceId: e.id
122
137
  },
123
- authToken: N || 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 ? I({
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
- }) : (j?.(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
- I({
147
+ let e = r?.error || "Installation failed";
148
+ B({
134
149
  type: "setError",
135
- error: D(e)
136
- }), M?.(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
- I({
155
+ B({
141
156
  type: "setError",
142
- error: D(t)
143
- }), M?.(Error(t));
157
+ error: j(t)
158
+ }), L?.(Error(t));
144
159
  } finally {
145
- I({ type: "finishInstall" });
160
+ B({ type: "finishInstall" });
146
161
  }
147
- }, K = async () => {
148
- if (!L) return;
149
- let e = W.find((e) => e.id === L);
162
+ }, re = async () => {
163
+ if (!H) return;
164
+ let e = Z.find((e) => e.id === H);
150
165
  if (e) {
151
- I({ type: "startInstall" });
166
+ B({ type: "startInstall" });
152
167
  try {
153
- let t = await u({
168
+ let t = await p({
154
169
  gateway: "workspace",
155
- query: x,
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: N || 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 u({
192
+ await p({
178
193
  gateway: "global",
179
- query: S,
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: N || void 0
210
+ authToken: R || void 0
195
211
  });
196
212
  } catch {}
197
- j?.(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
- I({
215
+ let e = n?.results?.[0]?.error || "Installation failed";
216
+ B({
201
217
  type: "setError",
202
- error: D(e)
203
- }), M?.(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
- I({
223
+ B({
208
224
  type: "setError",
209
- error: D(t)
210
- }), M?.(Error(t));
225
+ error: j(t)
226
+ }), L?.(Error(t));
211
227
  } finally {
212
- I({ type: "finishInstall" });
228
+ B({ type: "finishInstall" });
213
229
  }
214
230
  }
215
- };
216
- return /* @__PURE__ */ f(m, {
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__ */ p(h, {
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__ */ f(v, {
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__ */ p("div", {
300
+ children: [/* @__PURE__ */ g("div", {
225
301
  className: "flex items-center gap-3",
226
- children: [i.icon ? /* @__PURE__ */ f("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__ */ f("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__ */ p("div", { children: [/* @__PURE__ */ f(y, {
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__ */ f(g, {
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__ */ p("div", {
331
+ V === "workspace" && /* @__PURE__ */ g("div", {
243
332
  className: "px-6 py-4",
244
- children: [/* @__PURE__ */ f("p", {
333
+ children: [/* @__PURE__ */ h("p", {
245
334
  className: "mb-4 text-text-secondary",
246
335
  children: "Select the workspace where you want to install this app:"
247
- }), /* @__PURE__ */ f("div", {
336
+ }), /* @__PURE__ */ h("div", {
248
337
  className: "max-h-72 overflow-y-auto rounded-lg border border-border-seam",
249
- children: H ? /* @__PURE__ */ f("div", {
338
+ children: Y ? /* @__PURE__ */ h("div", {
250
339
  className: "flex items-center justify-center py-12",
251
- children: /* @__PURE__ */ f(l, { className: "size-8 animate-spin text-text-muted" })
252
- }) : U ? /* @__PURE__ */ p("div", {
340
+ children: /* @__PURE__ */ h(d, { className: "size-8 animate-spin text-text-muted" })
341
+ }) : X ? /* @__PURE__ */ g("div", {
253
342
  className: "flex flex-col items-center justify-center py-12 text-center",
254
343
  children: [
255
- /* @__PURE__ */ f(a, { className: "mb-2 size-8 text-status-error-text" }),
256
- /* @__PURE__ */ f("p", {
344
+ /* @__PURE__ */ h(a, { className: "mb-2 size-8 text-status-error-text" }),
345
+ /* @__PURE__ */ h("p", {
257
346
  className: "text-sm text-status-error-text",
258
347
  children: "Failed to load workspaces"
259
348
  }),
260
- /* @__PURE__ */ f("p", {
349
+ /* @__PURE__ */ h("p", {
261
350
  className: "text-xs text-text-muted mt-1",
262
- children: U.message
351
+ children: X.message
263
352
  })
264
353
  ]
265
- }) : W.length === 0 ? /* @__PURE__ */ p("div", {
354
+ }) : Z.length === 0 ? /* @__PURE__ */ g("div", {
266
355
  className: "flex flex-col items-center justify-center py-12 text-center",
267
- children: [/* @__PURE__ */ f(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ f("p", {
356
+ children: [/* @__PURE__ */ h(s, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ h("p", {
268
357
  className: "text-sm text-text-muted",
269
358
  children: "No workspaces available"
270
359
  })]
271
- }) : /* @__PURE__ */ f("div", {
360
+ }) : /* @__PURE__ */ h("div", {
272
361
  className: "divide-y divide-border-default",
273
- children: W.map((e) => /* @__PURE__ */ p("button", {
362
+ children: Z.map((e) => /* @__PURE__ */ g("button", {
274
363
  type: "button",
275
- onClick: () => I({
364
+ onClick: () => B({
276
365
  type: "selectWorkspace",
277
366
  workspaceId: e.id
278
367
  }),
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"}`,
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"}`,
280
369
  children: [
281
- /* @__PURE__ */ f("div", {
370
+ /* @__PURE__ */ h("div", {
282
371
  className: "flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link",
283
- children: /* @__PURE__ */ f(o, { className: "size-5" })
372
+ children: /* @__PURE__ */ h(s, { className: "size-5" })
284
373
  }),
285
- /* @__PURE__ */ p("div", {
374
+ /* @__PURE__ */ g("div", {
286
375
  className: "flex-1 min-w-0",
287
- children: [/* @__PURE__ */ f("p", {
376
+ children: [/* @__PURE__ */ h("p", {
288
377
  className: "font-medium text-text-primary truncate",
289
378
  children: e.name
290
- }), e.slug ? /* @__PURE__ */ p("p", {
379
+ }), e.slug ? /* @__PURE__ */ g("p", {
291
380
  className: "text-xs text-text-muted truncate",
292
381
  children: ["/", e.slug]
293
382
  }) : null]
294
383
  }),
295
- L === e.id && /* @__PURE__ */ f(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
384
+ H === e.id && /* @__PURE__ */ h(c, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
296
385
  ]
297
386
  }, e.id))
298
387
  })
299
388
  })]
300
389
  }),
301
- /* @__PURE__ */ p(_, {
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
+ })]
406
+ }),
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
+ })]
413
+ }),
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",
435
+ children: [
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"]
443
+ }),
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"]
447
+ })
448
+ ]
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."
454
+ })
455
+ ]
456
+ }),
457
+ /* @__PURE__ */ g(y, {
302
458
  className: "block border-t border-border-default px-6 py-4 sm:flex-col sm:items-stretch sm:space-x-0",
303
459
  children: [
304
- B && /* @__PURE__ */ p("div", {
460
+ G && /* @__PURE__ */ g("div", {
305
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",
306
- children: [/* @__PURE__ */ f(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: B })]
462
+ children: [/* @__PURE__ */ h(u, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ h("span", { children: G })]
307
463
  }),
308
- z && /* @__PURE__ */ p("div", {
464
+ W && /* @__PURE__ */ g("div", {
309
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",
310
- children: [/* @__PURE__ */ f(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: z })]
466
+ children: [/* @__PURE__ */ h(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ h("span", { children: W })]
311
467
  }),
312
- /* @__PURE__ */ p("div", {
468
+ /* @__PURE__ */ h("div", {
313
469
  className: "flex items-center justify-end gap-3",
314
- children: [/* @__PURE__ */ f("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", {
315
477
  type: "button",
316
- onClick: n,
317
- disabled: R,
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,
318
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",
319
487
  children: "Cancel"
320
- }), /* @__PURE__ */ f("button", {
488
+ }), /* @__PURE__ */ h("button", {
321
489
  type: "button",
322
- onClick: async () => {
323
- let e = i.type?.toUpperCase() ?? "";
324
- E === "purchased" || b || T.has(e) ? await G() : await K();
325
- },
326
- disabled: !L || R,
490
+ onClick: ie,
491
+ disabled: !H || U,
327
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",
328
- children: R ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
329
- })]
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
+ })] })
330
495
  })
331
496
  ]
332
497
  })
@@ -335,6 +500,6 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
335
500
  });
336
501
  };
337
502
  //#endregion
338
- export { j as InstallAppModal };
503
+ export { F as InstallAppModal };
339
504
 
340
505
  //# sourceMappingURL=InstallAppModal.js.map