@burdenoff/microfe-store 2026.626.2 → 2026.703.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,8 +1,8 @@
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
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";
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
6
  import { Dialog as m, DialogContent as h, DialogDescription as g, DialogFooter as _, DialogHeader as v, DialogTitle as y } from "@burdenoff/fe-libs/ui";
7
7
  //#region src/components/InstallAppModal.tsx
8
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([
@@ -60,11 +60,11 @@ function k(e, t) {
60
60
  }
61
61
  }
62
62
  function A(r) {
63
- let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [u, d] = i(null), f = t(async () => {
63
+ let { authToken: a } = e(), [o, s] = i([]), [c, l] = i(!1), [d, f] = i(null), p = t(async () => {
64
64
  if (!r) {
65
- l(!0), d(null);
65
+ l(!0), f(null);
66
66
  try {
67
- let e = await p({
67
+ let e = await u({
68
68
  gateway: "global",
69
69
  query: b,
70
70
  authToken: a || void 0
@@ -72,19 +72,19 @@ function A(r) {
72
72
  if (e.errors?.length) throw Error(e.errors[0]?.message ?? "GraphQL error");
73
73
  s(e.data?.myWorkspaces?.items || []);
74
74
  } catch (e) {
75
- d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch workspaces"));
75
+ f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch workspaces"));
76
76
  } finally {
77
77
  l(!1);
78
78
  }
79
79
  }
80
80
  }, [a, r]);
81
81
  return n(() => {
82
- f();
83
- }, [f]), {
82
+ p();
83
+ }, [p]), {
84
84
  workspaces: o,
85
85
  loading: c,
86
- error: u,
87
- refetch: f
86
+ error: d,
87
+ refetch: p
88
88
  };
89
89
  }
90
90
  var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free", onInstallSuccess: j, onInstallError: M }) => {
@@ -97,7 +97,7 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
97
97
  try {
98
98
  if (!b && E !== "purchased") {
99
99
  if (!t) throw Error("Unable to identify the current user for license creation");
100
- await p({
100
+ await u({
101
101
  gateway: "global",
102
102
  query: w,
103
103
  variables: { input: {
@@ -112,7 +112,7 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
112
112
  authToken: N || void 0
113
113
  });
114
114
  }
115
- let r = await p({
115
+ let r = await u({
116
116
  gateway: "global",
117
117
  query: C,
118
118
  variables: {
@@ -150,7 +150,7 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
150
150
  if (e) {
151
151
  I({ type: "startInstall" });
152
152
  try {
153
- let t = await p({
153
+ let t = await u({
154
154
  gateway: "workspace",
155
155
  query: x,
156
156
  variables: {
@@ -174,7 +174,7 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
174
174
  let r = t.data?.installWorkspaceApps;
175
175
  if (r?.successCount && r.successCount > 0) {
176
176
  try {
177
- await p({
177
+ await u({
178
178
  gateway: "global",
179
179
  query: S,
180
180
  variables: { input: {
@@ -213,64 +213,64 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
213
213
  }
214
214
  }
215
215
  };
216
- return /* @__PURE__ */ d(m, {
216
+ return /* @__PURE__ */ f(m, {
217
217
  open: t,
218
218
  onOpenChange: (e) => !e && n(),
219
- children: /* @__PURE__ */ f(h, {
219
+ children: /* @__PURE__ */ p(h, {
220
220
  className: "mx-4 w-full max-w-lg gap-0 p-0",
221
221
  children: [
222
- /* @__PURE__ */ d(v, {
222
+ /* @__PURE__ */ f(v, {
223
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", {
224
+ children: /* @__PURE__ */ p("div", {
225
225
  className: "flex items-center gap-3",
226
- children: [i.icon ? /* @__PURE__ */ d("img", {
226
+ children: [i.icon ? /* @__PURE__ */ f("img", {
227
227
  src: i.icon,
228
228
  alt: i.name,
229
229
  className: "size-10 rounded-lg object-cover"
230
- }) : /* @__PURE__ */ d("div", {
230
+ }) : /* @__PURE__ */ f("div", {
231
231
  className: "flex size-10 items-center justify-center rounded-lg bg-bg-sunken text-lg font-bold text-text-muted",
232
232
  children: i.name.charAt(0)
233
- }), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d(y, {
233
+ }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f(y, {
234
234
  className: "text-lg font-semibold text-text-primary",
235
235
  children: "Install App"
236
- }), /* @__PURE__ */ d(g, {
236
+ }), /* @__PURE__ */ f(g, {
237
237
  className: "text-sm text-text-muted",
238
238
  children: i.name
239
239
  })] })]
240
240
  })
241
241
  }),
242
- /* @__PURE__ */ f("div", {
242
+ /* @__PURE__ */ p("div", {
243
243
  className: "px-6 py-4",
244
- children: [/* @__PURE__ */ d("p", {
244
+ children: [/* @__PURE__ */ f("p", {
245
245
  className: "mb-4 text-text-secondary",
246
246
  children: "Select the workspace where you want to install this app:"
247
- }), /* @__PURE__ */ d("div", {
247
+ }), /* @__PURE__ */ f("div", {
248
248
  className: "max-h-72 overflow-y-auto rounded-lg border border-border-seam",
249
- children: H ? /* @__PURE__ */ d("div", {
249
+ children: H ? /* @__PURE__ */ f("div", {
250
250
  className: "flex items-center justify-center py-12",
251
- children: /* @__PURE__ */ d(l, { className: "size-8 animate-spin text-text-muted" })
252
- }) : U ? /* @__PURE__ */ f("div", {
251
+ children: /* @__PURE__ */ f(l, { className: "size-8 animate-spin text-text-muted" })
252
+ }) : U ? /* @__PURE__ */ p("div", {
253
253
  className: "flex flex-col items-center justify-center py-12 text-center",
254
254
  children: [
255
- /* @__PURE__ */ d(a, { className: "mb-2 size-8 text-status-error-text" }),
256
- /* @__PURE__ */ d("p", {
255
+ /* @__PURE__ */ f(a, { className: "mb-2 size-8 text-status-error-text" }),
256
+ /* @__PURE__ */ f("p", {
257
257
  className: "text-sm text-status-error-text",
258
258
  children: "Failed to load workspaces"
259
259
  }),
260
- /* @__PURE__ */ d("p", {
260
+ /* @__PURE__ */ f("p", {
261
261
  className: "text-xs text-text-muted mt-1",
262
262
  children: U.message
263
263
  })
264
264
  ]
265
- }) : W.length === 0 ? /* @__PURE__ */ f("div", {
265
+ }) : W.length === 0 ? /* @__PURE__ */ p("div", {
266
266
  className: "flex flex-col items-center justify-center py-12 text-center",
267
- children: [/* @__PURE__ */ d(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ d("p", {
267
+ children: [/* @__PURE__ */ f(o, { className: "mb-2 size-8 text-text-muted" }), /* @__PURE__ */ f("p", {
268
268
  className: "text-sm text-text-muted",
269
269
  children: "No workspaces available"
270
270
  })]
271
- }) : /* @__PURE__ */ d("div", {
271
+ }) : /* @__PURE__ */ f("div", {
272
272
  className: "divide-y divide-border-default",
273
- children: W.map((e) => /* @__PURE__ */ f("button", {
273
+ children: W.map((e) => /* @__PURE__ */ p("button", {
274
274
  type: "button",
275
275
  onClick: () => I({
276
276
  type: "selectWorkspace",
@@ -278,46 +278,46 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
278
278
  }),
279
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"}`,
280
280
  children: [
281
- /* @__PURE__ */ d("div", {
281
+ /* @__PURE__ */ f("div", {
282
282
  className: "flex size-10 items-center justify-center rounded-lg bg-action-primary-bg/10 text-text-link",
283
- children: /* @__PURE__ */ d(o, { className: "size-5" })
283
+ children: /* @__PURE__ */ f(o, { className: "size-5" })
284
284
  }),
285
- /* @__PURE__ */ f("div", {
285
+ /* @__PURE__ */ p("div", {
286
286
  className: "flex-1 min-w-0",
287
- children: [/* @__PURE__ */ d("p", {
287
+ children: [/* @__PURE__ */ f("p", {
288
288
  className: "font-medium text-text-primary truncate",
289
289
  children: e.name
290
- }), e.slug ? /* @__PURE__ */ f("p", {
290
+ }), e.slug ? /* @__PURE__ */ p("p", {
291
291
  className: "text-xs text-text-muted truncate",
292
292
  children: ["/", e.slug]
293
293
  }) : null]
294
294
  }),
295
- L === e.id && /* @__PURE__ */ d(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
295
+ L === e.id && /* @__PURE__ */ f(s, { className: "size-5 flex-shrink-0 text-action-primary-bg" })
296
296
  ]
297
297
  }, e.id))
298
298
  })
299
299
  })]
300
300
  }),
301
- /* @__PURE__ */ f(_, {
301
+ /* @__PURE__ */ p(_, {
302
302
  className: "block border-t border-border-default px-6 py-4 sm:flex-col sm:items-stretch sm:space-x-0",
303
303
  children: [
304
- B && /* @__PURE__ */ f("div", {
304
+ B && /* @__PURE__ */ p("div", {
305
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",
306
- children: [/* @__PURE__ */ d(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ d("span", { children: B })]
306
+ children: [/* @__PURE__ */ f(c, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: B })]
307
307
  }),
308
- z && /* @__PURE__ */ f("div", {
308
+ z && /* @__PURE__ */ p("div", {
309
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",
310
- children: [/* @__PURE__ */ d(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ d("span", { children: z })]
310
+ children: [/* @__PURE__ */ f(a, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ f("span", { children: z })]
311
311
  }),
312
- /* @__PURE__ */ f("div", {
312
+ /* @__PURE__ */ p("div", {
313
313
  className: "flex items-center justify-end gap-3",
314
- children: [/* @__PURE__ */ d("button", {
314
+ children: [/* @__PURE__ */ f("button", {
315
315
  type: "button",
316
316
  onClick: n,
317
317
  disabled: R,
318
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",
319
319
  children: "Cancel"
320
- }), /* @__PURE__ */ d("button", {
320
+ }), /* @__PURE__ */ f("button", {
321
321
  type: "button",
322
322
  onClick: async () => {
323
323
  let e = i.type?.toUpperCase() ?? "";
@@ -325,7 +325,7 @@ var j = ({ isOpen: t, onClose: n, app: i, orderId: b, purchaseState: E = "free",
325
325
  },
326
326
  disabled: !L || R,
327
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",
328
- children: R ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
328
+ children: R ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(l, { className: "size-4 animate-spin" }), "Installing…"] }) : "Install App"
329
329
  })]
330
330
  })
331
331
  ]