@burdenoff/microfe-devportal 2026.608.1 → 2026.609.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.
- package/dist/devportal/hooks/useGraphQL.js +49 -36
- package/dist/devportal/hooks/useGraphQL.js.map +1 -1
- package/dist/devportal/pages/StoreSubmissionPage.js +98 -76
- package/dist/devportal/pages/StoreSubmissionPage.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +52 -0
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -0
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +41 -0
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -0
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +34 -0
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +16 -0
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +19 -0
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +21 -0
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +17 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +8 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +8 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +23 -0
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +57 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -0
- package/dist/node_modules/@apollo/client/version.js +6 -0
- package/dist/node_modules/@apollo/client/version.js.map +1 -0
- package/dist/node_modules/@wry/caches/lib/weak.js +67 -0
- package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -0
- package/dist/node_modules/@wry/trie/lib/index.js +53 -0
- package/dist/node_modules/@wry/trie/lib/index.js.map +1 -0
- package/dist/node_modules/graphql-ws/dist/client.js +272 -0
- package/dist/node_modules/graphql-ws/dist/client.js.map +1 -0
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +62 -0
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +21 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +78 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +117 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +93 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +12 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +16 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +22 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +6 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +14 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -0
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js +52 -0
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +1 -0
- package/package.json +2 -1
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import "../../generated/global-operations.js";
|
|
2
2
|
import { CombinedGraphQLErrors as e } from "../../node_modules/@apollo/client/errors/CombinedGraphQLErrors.js";
|
|
3
3
|
import { ServerError as t } from "../../node_modules/@apollo/client/errors/ServerError.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { getMainDefinition as n } from "../../node_modules/@apollo/client/utilities/internal/getMainDefinition.js";
|
|
5
|
+
import { GraphQLWsLink as r } from "../../node_modules/@apollo/client/link/subscriptions/index.js";
|
|
6
|
+
import { createClient as i } from "../../node_modules/graphql-ws/dist/client.js";
|
|
7
|
+
import { ApolloClient as a, InMemoryCache as o, createHttpLink as s, from as c, split as l } from "@apollo/client/core";
|
|
8
|
+
import { setContext as u } from "@apollo/client/link/context";
|
|
9
|
+
import { onError as d } from "@apollo/client/link/error";
|
|
10
|
+
import { isAuthNetworkError as f, redirectToLogin as p } from "@burdenoff/fe-libs/shared/utils";
|
|
8
11
|
//#region src/devportal/hooks/useGraphQL.ts
|
|
9
|
-
function
|
|
12
|
+
function m(e = []) {
|
|
10
13
|
return e.some((e) => {
|
|
11
14
|
let t = typeof e.extensions?.code == "string" ? e.extensions.code : "", n = typeof e.extensions?.errorCode == "string" ? e.extensions.errorCode : "", r = (e.message ?? "").toLowerCase();
|
|
12
15
|
return t === "UNAUTHENTICATED" || n === "TOKEN_EXPIRED" || r.includes("token_expired") || r.includes("token expired") || r.includes("session expired") || r.includes("unauthorized") || r.includes("unauthenticated") || r.includes("authentication required") || r.includes("workspace context missing");
|
|
13
16
|
});
|
|
14
17
|
}
|
|
15
|
-
var
|
|
18
|
+
var h = !1, g = h ? "/devportal-graphql" : "http://localhost:4015/graphql", _ = h ? "/auth-graphql" : "http://localhost:4011/graphql", v = new Set([
|
|
16
19
|
"CurrentUserApps",
|
|
17
20
|
"GetAuthApp",
|
|
18
21
|
"AppsActingAsCurrentUser",
|
|
@@ -33,28 +36,38 @@ var f = !1, p = f ? "/devportal-graphql" : "http://localhost:4015/graphql", m =
|
|
|
33
36
|
"RevokeAPIKeyAuth",
|
|
34
37
|
"RotateAPIKeyAuth",
|
|
35
38
|
"AuthenticateAPIKey"
|
|
36
|
-
]),
|
|
39
|
+
]), y = "dev-user-001", b = "user";
|
|
40
|
+
function x(e) {
|
|
41
|
+
return e.replace(/^https/, "wss").replace(/^http/, "ws");
|
|
42
|
+
}
|
|
43
|
+
var S = s({ uri: g }), C = l(({ operationName: e }) => e ? v.has(e) : !1, s({ uri: _ }), S), w = u((e, { headers: t }) => {
|
|
37
44
|
let n = typeof window < "u" ? localStorage.getItem("auth_token") : null, r = { ...t };
|
|
38
|
-
if (n && (r.authorization = `Bearer ${n}`),
|
|
39
|
-
let e = typeof window < "u" && localStorage.getItem("dev_actor_id") ||
|
|
45
|
+
if (n && (r.authorization = `Bearer ${n}`), h) {
|
|
46
|
+
let e = typeof window < "u" && localStorage.getItem("dev_actor_id") || y, t = typeof window < "u" && localStorage.getItem("dev_actor_type") || b;
|
|
40
47
|
r["x-actor-id"] = e, r["x-actor-type"] = t;
|
|
41
48
|
}
|
|
42
49
|
return { headers: r };
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
}), T = d(({ error: e }) => {
|
|
51
|
+
if (e) {
|
|
52
|
+
if (m("errors" in e && Array.isArray(e.errors) ? e.errors : [])) {
|
|
53
|
+
p();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e instanceof Error && f(e) && p();
|
|
57
|
+
}
|
|
58
|
+
}), E = new a({
|
|
59
|
+
link: l(({ query: e }) => {
|
|
60
|
+
let t = n(e);
|
|
61
|
+
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
62
|
+
}, new r(i({
|
|
63
|
+
url: x(g),
|
|
64
|
+
connectionParams: () => ({ authorization: "" })
|
|
65
|
+
})), c([
|
|
66
|
+
T,
|
|
67
|
+
w,
|
|
68
|
+
C
|
|
69
|
+
])),
|
|
70
|
+
cache: new o({ typePolicies: {
|
|
58
71
|
Query: { fields: {
|
|
59
72
|
developerOrganizations: {
|
|
60
73
|
keyArgs: [
|
|
@@ -178,7 +191,7 @@ var f = !1, p = f ? "/devportal-graphql" : "http://localhost:4015/graphql", m =
|
|
|
178
191
|
query: { fetchPolicy: "cache-first" }
|
|
179
192
|
}
|
|
180
193
|
});
|
|
181
|
-
function
|
|
194
|
+
function D(n) {
|
|
182
195
|
return n instanceof e ? n.errors.map((e) => ({
|
|
183
196
|
message: e.message,
|
|
184
197
|
code: e.extensions?.code,
|
|
@@ -195,22 +208,22 @@ function S(n) {
|
|
|
195
208
|
code: "UNKNOWN_ERROR"
|
|
196
209
|
}];
|
|
197
210
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
211
|
+
function O(e) {
|
|
212
|
+
return D(e).map((e) => e.message).join(", ");
|
|
200
213
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
214
|
+
function k(e) {
|
|
215
|
+
return D(e).some((e) => e.code === "UNAUTHENTICATED" || e.code === "FORBIDDEN");
|
|
203
216
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
217
|
+
function A(e) {
|
|
218
|
+
return D(e).some((e) => e.code === "BAD_USER_INPUT" || e.code === "VALIDATION_ERROR");
|
|
206
219
|
}
|
|
207
|
-
async function
|
|
208
|
-
await
|
|
220
|
+
async function j() {
|
|
221
|
+
await E.clearStore();
|
|
209
222
|
}
|
|
210
|
-
async function
|
|
211
|
-
await
|
|
223
|
+
async function M() {
|
|
224
|
+
await E.resetStore();
|
|
212
225
|
}
|
|
213
226
|
//#endregion
|
|
214
|
-
export {
|
|
227
|
+
export { E as apolloClient, j as clearApolloCache, O as getErrorMessage, k as isAuthError, A as isValidationError, D as parseGraphQLError, M as resetApolloStore };
|
|
215
228
|
|
|
216
229
|
//# sourceMappingURL=useGraphQL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGraphQL.js","names":[],"sources":["../../../src/devportal/hooks/useGraphQL.ts"],"sourcesContent":["/**\n * Apollo Client hooks and utilities for DevPortal\n *\n * This file provides the GraphQL client setup and custom hooks for the Developer Portal.\n * It wraps the generated Apollo hooks with additional functionality like error handling,\n * loading states, and authentication context.\n */\n\nimport {\n ApolloClient,\n InMemoryCache,\n createHttpLink,\n from,\n split,\n} from \"@apollo/client/core\";\nimport { CombinedGraphQLErrors, ServerError } from \"@apollo/client/errors\";\nimport { setContext } from \"@apollo/client/link/context\";\nimport { onError } from \"@apollo/client/link/error\";\nimport {\n isAuthNetworkError,\n redirectToLogin,\n} from \"@burdenoff/fe-libs/shared/utils\";\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{\n message?: string;\n extensions?: Record<string, unknown>;\n }> = [],\n): boolean {\n return errors.some((error) => {\n const code =\n typeof error.extensions?.code === \"string\" ? error.extensions.code : \"\";\n const errorCode =\n typeof error.extensions?.errorCode === \"string\"\n ? error.extensions.errorCode\n : \"\";\n const message = (error.message ?? \"\").toLowerCase();\n\n return (\n code === \"UNAUTHENTICATED\" ||\n errorCode === \"TOKEN_EXPIRED\" ||\n message.includes(\"token_expired\") ||\n message.includes(\"token expired\") ||\n message.includes(\"session expired\") ||\n message.includes(\"unauthorized\") ||\n message.includes(\"unauthenticated\") ||\n message.includes(\"authentication required\") ||\n message.includes(\"workspace context missing\")\n );\n });\n}\n\n// Re-export all generated hooks for direct use\nexport * from \"../../generated/global-operations\";\n\n// Vite environment variable declaration\ndeclare global {\n interface ImportMeta {\n readonly env: {\n readonly VITE_GRAPHQL_ENDPOINT?: string;\n readonly VITE_AUTH_GRAPHQL_ENDPOINT?: string;\n readonly VITE_DEV_ACTOR_ID?: string;\n readonly VITE_DEV_ACTOR_TYPE?: string;\n readonly DEV?: boolean;\n [key: string]: string | boolean | undefined;\n };\n }\n}\n\n// Development mode check\nconst isDevelopment =\n typeof import.meta !== \"undefined\" && import.meta.env?.DEV === true;\n\n// Default GraphQL endpoints - can be overridden via environment.\n// In standalone dev mode we route through same-origin Vite proxies to avoid CORS.\nconst DEFAULT_GRAPHQL_ENDPOINT =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_GRAPHQL_ENDPOINT) ||\n (isDevelopment ? \"/devportal-graphql\" : \"http://localhost:4015/graphql\");\n\nconst DEFAULT_AUTH_GRAPHQL_ENDPOINT =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_AUTH_GRAPHQL_ENDPOINT) ||\n (isDevelopment ? \"/auth-graphql\" : \"http://localhost:4011/graphql\");\n\nconst AUTH_OPERATION_NAMES = new Set([\n \"CurrentUserApps\",\n \"GetAuthApp\",\n \"AppsActingAsCurrentUser\",\n \"CreateAuthApp\",\n \"UpdateAuthApp\",\n \"DeactivateApp\",\n \"RotateAppSecret\",\n \"AuthenticateApp\",\n \"GenerateAppToken\",\n \"GenerateAppAsUserToken\",\n \"ExchangeToken\",\n \"CurrentUserDelegations\",\n \"CurrentUserGrantedDelegations\",\n \"GrantDelegation\",\n \"RevokeDelegation\",\n \"MyApiKeys\",\n \"GenerateAPIKey\",\n \"RevokeAPIKeyAuth\",\n \"RotateAPIKeyAuth\",\n \"AuthenticateAPIKey\",\n]);\n\n// Development actor ID - simulates gateway-injected headers\n// In production, the gateway adds these after JWT verification\nconst DEV_ACTOR_ID =\n (typeof import.meta !== \"undefined\" && import.meta.env?.VITE_DEV_ACTOR_ID) ||\n \"dev-user-001\";\n\nconst DEV_ACTOR_TYPE =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_DEV_ACTOR_TYPE) ||\n \"user\";\n\n// Create the HTTP links\nconst devportalHttpLink = createHttpLink({\n uri: DEFAULT_GRAPHQL_ENDPOINT,\n});\n\nconst authHttpLink = createHttpLink({\n uri: DEFAULT_AUTH_GRAPHQL_ENDPOINT,\n});\n\nconst httpLink = split(\n ({ operationName }) => {\n if (!operationName) {\n return false;\n }\n\n return AUTH_OPERATION_NAMES.has(operationName);\n },\n authHttpLink,\n devportalHttpLink,\n);\n\n// Auth link to add authentication headers\nconst authLink = setContext((_, { headers }) => {\n // Get auth token from storage or context\n const token =\n typeof window !== \"undefined\" ? localStorage.getItem(\"auth_token\") : null;\n\n // Build headers\n const authHeaders: Record<string, string> = {\n ...headers,\n };\n\n if (token) {\n authHeaders[\"authorization\"] = `Bearer ${token}`;\n }\n\n // In development mode, add actor headers to simulate gateway behavior\n // In production, the API Gateway adds these headers after JWT verification\n if (isDevelopment) {\n // Use actor ID from localStorage (set by dev tools) or fall back to env/default\n const actorId =\n (typeof window !== \"undefined\" && localStorage.getItem(\"dev_actor_id\")) ||\n DEV_ACTOR_ID;\n const actorType =\n (typeof window !== \"undefined\" &&\n localStorage.getItem(\"dev_actor_type\")) ||\n DEV_ACTOR_TYPE;\n\n authHeaders[\"x-actor-id\"] = actorId;\n authHeaders[\"x-actor-type\"] = actorType;\n }\n\n return { headers: authHeaders };\n});\n\nconst errorLink = onError(({ error }) => {\n if (!error) return;\n\n const graphQLErrors =\n \"errors\" in error && Array.isArray(error.errors) ? error.errors : [];\n\n if (hasSessionAuthErrors(graphQLErrors)) {\n redirectToLogin();\n return;\n }\n\n if (error instanceof Error && isAuthNetworkError(error)) {\n redirectToLogin();\n }\n});\n\n// Create the Apollo Client instance\n// NOTE: defaultOptions.errorPolicy is intentionally omitted. Apollo Client v4\n// guards it behind a DeclareDefaultOptions module augmentation that does not\n// resolve reliably in CI's frozen install, so it is left at the v4 default\n// (\"none\"). Per-operation errorPolicy: \"all\" can be set on individual hooks\n// where partial-data-on-error handling is required.\nexport const apolloClient = new ApolloClient({\n link: from([errorLink, authLink, httpLink]),\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n // Pagination policies for connection types\n developerOrganizations: {\n keyArgs: [\"tier\", \"isVerified\", \"isCertified\", \"partnerTier\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n applications: {\n keyArgs: [\"status\", \"visibility\", \"developerId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgSales: {\n keyArgs: [\n \"organizationId\",\n \"applicationId\",\n \"status\",\n \"pricingModel\",\n \"isPaidOut\",\n ],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgPayouts: {\n keyArgs: [\"organizationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgMembers: {\n keyArgs: [\"organizationId\", \"role\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgInvitations: {\n keyArgs: [\"organizationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n webhooks: {\n keyArgs: [\"applicationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n webhookDeliveries: {\n keyArgs: [\"webhookId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n auditLogs: {\n keyArgs: [\"resource\", \"resourceId\", \"actorId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n applicationVersions: {\n // TODO(phase1-backend): Switch to ApplicationVersionConnection cursor pagination\n // once backend ships connection type. See stability tracker.\n keyArgs: [\"applicationId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n if (Array.isArray(incoming) && Array.isArray(existing)) {\n return [...existing, ...incoming];\n }\n return incoming;\n },\n },\n },\n },\n WebhookDelivery: {\n keyFields: [\"id\"],\n },\n ApplicationVersion: {\n keyFields: [\"id\"],\n },\n DeveloperOrganization: {\n keyFields: [\"id\"],\n },\n Application: {\n keyFields: [\"id\"],\n },\n DeveloperOrgMember: {\n keyFields: [\"id\"],\n },\n DeveloperOrgInvitation: {\n keyFields: [\"id\"],\n },\n Webhook: {\n keyFields: [\"id\"],\n },\n ApiKey: {\n keyFields: [\"id\"],\n },\n OAuthClient: {\n keyFields: [\"id\"],\n },\n },\n }),\n defaultOptions: {\n watchQuery: {\n fetchPolicy: \"cache-and-network\",\n },\n query: {\n fetchPolicy: \"cache-first\",\n },\n },\n});\n\n/**\n * Error handling utilities\n */\nexport interface GraphQLErrorInfo {\n message: string;\n code?: string;\n path?: readonly (string | number)[];\n}\n\n// Type for Apollo errors (can be CombinedGraphQLErrors, ServerError, or Error)\nexport type ApolloErrorLike = Error & {\n graphQLErrors?: readonly {\n message: string;\n extensions?: { code?: string };\n path?: readonly (string | number)[];\n }[];\n networkError?: Error | null;\n};\n\nexport function parseGraphQLError(error: ApolloErrorLike): GraphQLErrorInfo[] {\n if (error instanceof CombinedGraphQLErrors) {\n return error.errors.map((err) => ({\n message: err.message,\n code: err.extensions?.code as string | undefined,\n path: err.path,\n }));\n }\n\n if (error.graphQLErrors && error.graphQLErrors.length > 0) {\n return error.graphQLErrors.map((err) => ({\n message: err.message,\n code: err.extensions?.code as string | undefined,\n path: err.path,\n }));\n }\n\n if (error instanceof ServerError || error.networkError) {\n return [\n {\n message: \"Network error. Please check your connection and try again.\",\n code: \"NETWORK_ERROR\",\n },\n ];\n }\n\n return [\n {\n message: error.message || \"An unexpected error occurred\",\n code: \"UNKNOWN_ERROR\",\n },\n ];\n}\n\n/**\n * Get a user-friendly error message from an Apollo error\n */\nexport function getErrorMessage(error: ApolloErrorLike): string {\n const errors = parseGraphQLError(error);\n return errors.map((e) => e.message).join(\", \");\n}\n\n/**\n * Check if an error is an authentication error\n */\nexport function isAuthError(error: ApolloErrorLike): boolean {\n const errors = parseGraphQLError(error);\n return errors.some(\n (e) => e.code === \"UNAUTHENTICATED\" || e.code === \"FORBIDDEN\",\n );\n}\n\n/**\n * Check if an error is a validation error\n */\nexport function isValidationError(error: ApolloErrorLike): boolean {\n const errors = parseGraphQLError(error);\n return errors.some(\n (e) => e.code === \"BAD_USER_INPUT\" || e.code === \"VALIDATION_ERROR\",\n );\n}\n\n/**\n * Clear Apollo cache (useful for logout)\n */\nexport async function clearApolloCache(): Promise<void> {\n await apolloClient.clearStore();\n}\n\n/**\n * Reset Apollo store and refetch queries\n */\nexport async function resetApolloStore(): Promise<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gB,EAAY,GAAiC;AAE3D,QADe,EAAkB,EAAM,CACzB,MACX,MAAM,EAAE,SAAS,qBAAqB,EAAE,SAAS,YACnD;;AAMH,SAAgB,EAAkB,GAAiC;AAEjE,QADe,EAAkB,EAAM,CACzB,MACX,MAAM,EAAE,SAAS,oBAAoB,EAAE,SAAS,mBAClD;;AAMH,eAAsB,IAAkC;AACtD,OAAM,EAAa,YAAY;;AAMjC,eAAsB,IAAkC;AACtD,OAAM,EAAa,YAAY"}
|
|
1
|
+
{"version":3,"file":"useGraphQL.js","names":[],"sources":["../../../src/devportal/hooks/useGraphQL.ts"],"sourcesContent":["/**\n * Apollo Client hooks and utilities for DevPortal\n *\n * This file provides the GraphQL client setup and custom hooks for the Developer Portal.\n * It wraps the generated Apollo hooks with additional functionality like error handling,\n * loading states, and authentication context.\n */\n\nimport {\n ApolloClient,\n InMemoryCache,\n createHttpLink,\n from,\n split,\n} from \"@apollo/client/core\";\nimport { CombinedGraphQLErrors, ServerError } from \"@apollo/client/errors\";\nimport { setContext } from \"@apollo/client/link/context\";\nimport { onError } from \"@apollo/client/link/error\";\nimport { GraphQLWsLink } from \"@apollo/client/link/subscriptions\";\nimport { getMainDefinition } from \"@apollo/client/utilities\";\nimport { createClient as createWsClient } from \"graphql-ws\";\nimport {\n isAuthNetworkError,\n redirectToLogin,\n} from \"@burdenoff/fe-libs/shared/utils\";\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{\n message?: string;\n extensions?: Record<string, unknown>;\n }> = [],\n): boolean {\n return errors.some((error) => {\n const code =\n typeof error.extensions?.code === \"string\" ? error.extensions.code : \"\";\n const errorCode =\n typeof error.extensions?.errorCode === \"string\"\n ? error.extensions.errorCode\n : \"\";\n const message = (error.message ?? \"\").toLowerCase();\n\n return (\n code === \"UNAUTHENTICATED\" ||\n errorCode === \"TOKEN_EXPIRED\" ||\n message.includes(\"token_expired\") ||\n message.includes(\"token expired\") ||\n message.includes(\"session expired\") ||\n message.includes(\"unauthorized\") ||\n message.includes(\"unauthenticated\") ||\n message.includes(\"authentication required\") ||\n message.includes(\"workspace context missing\")\n );\n });\n}\n\n// Re-export all generated hooks for direct use\nexport * from \"../../generated/global-operations\";\n\n// Vite environment variable declaration\ndeclare global {\n interface ImportMeta {\n readonly env: {\n readonly VITE_GRAPHQL_ENDPOINT?: string;\n readonly VITE_AUTH_GRAPHQL_ENDPOINT?: string;\n readonly VITE_DEV_ACTOR_ID?: string;\n readonly VITE_DEV_ACTOR_TYPE?: string;\n readonly DEV?: boolean;\n [key: string]: string | boolean | undefined;\n };\n }\n}\n\n// Development mode check\nconst isDevelopment =\n typeof import.meta !== \"undefined\" && import.meta.env?.DEV === true;\n\n// Default GraphQL endpoints - can be overridden via environment.\n// In standalone dev mode we route through same-origin Vite proxies to avoid CORS.\nconst DEFAULT_GRAPHQL_ENDPOINT =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_GRAPHQL_ENDPOINT) ||\n (isDevelopment ? \"/devportal-graphql\" : \"http://localhost:4015/graphql\");\n\nconst DEFAULT_AUTH_GRAPHQL_ENDPOINT =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_AUTH_GRAPHQL_ENDPOINT) ||\n (isDevelopment ? \"/auth-graphql\" : \"http://localhost:4011/graphql\");\n\nconst AUTH_OPERATION_NAMES = new Set([\n \"CurrentUserApps\",\n \"GetAuthApp\",\n \"AppsActingAsCurrentUser\",\n \"CreateAuthApp\",\n \"UpdateAuthApp\",\n \"DeactivateApp\",\n \"RotateAppSecret\",\n \"AuthenticateApp\",\n \"GenerateAppToken\",\n \"GenerateAppAsUserToken\",\n \"ExchangeToken\",\n \"CurrentUserDelegations\",\n \"CurrentUserGrantedDelegations\",\n \"GrantDelegation\",\n \"RevokeDelegation\",\n \"MyApiKeys\",\n \"GenerateAPIKey\",\n \"RevokeAPIKeyAuth\",\n \"RotateAPIKeyAuth\",\n \"AuthenticateAPIKey\",\n]);\n\n// Development actor ID - simulates gateway-injected headers\n// In production, the gateway adds these after JWT verification\nconst DEV_ACTOR_ID =\n (typeof import.meta !== \"undefined\" && import.meta.env?.VITE_DEV_ACTOR_ID) ||\n \"dev-user-001\";\n\nconst DEV_ACTOR_TYPE =\n (typeof import.meta !== \"undefined\" &&\n import.meta.env?.VITE_DEV_ACTOR_TYPE) ||\n \"user\";\n\nfunction toWsUrl(httpUrl: string): string {\n return httpUrl.replace(/^https/, \"wss\").replace(/^http/, \"ws\");\n}\n\n// Create the HTTP links\nconst devportalHttpLink = createHttpLink({\n uri: DEFAULT_GRAPHQL_ENDPOINT,\n});\n\nconst authHttpLink = createHttpLink({\n uri: DEFAULT_AUTH_GRAPHQL_ENDPOINT,\n});\n\nconst httpLink = split(\n ({ operationName }) => {\n if (!operationName) {\n return false;\n }\n\n return AUTH_OPERATION_NAMES.has(operationName);\n },\n authHttpLink,\n devportalHttpLink,\n);\n\n// Auth link to add authentication headers\nconst authLink = setContext((_, { headers }) => {\n // Get auth token from storage or context\n const token =\n typeof window !== \"undefined\" ? localStorage.getItem(\"auth_token\") : null;\n\n // Build headers\n const authHeaders: Record<string, string> = {\n ...headers,\n };\n\n if (token) {\n authHeaders[\"authorization\"] = `Bearer ${token}`;\n }\n\n // In development mode, add actor headers to simulate gateway behavior\n // In production, the API Gateway adds these headers after JWT verification\n if (isDevelopment) {\n // Use actor ID from localStorage (set by dev tools) or fall back to env/default\n const actorId =\n (typeof window !== \"undefined\" && localStorage.getItem(\"dev_actor_id\")) ||\n DEV_ACTOR_ID;\n const actorType =\n (typeof window !== \"undefined\" &&\n localStorage.getItem(\"dev_actor_type\")) ||\n DEV_ACTOR_TYPE;\n\n authHeaders[\"x-actor-id\"] = actorId;\n authHeaders[\"x-actor-type\"] = actorType;\n }\n\n return { headers: authHeaders };\n});\n\nconst errorLink = onError(({ error }) => {\n if (!error) return;\n\n const graphQLErrors =\n \"errors\" in error && Array.isArray(error.errors) ? error.errors : [];\n\n if (hasSessionAuthErrors(graphQLErrors)) {\n redirectToLogin();\n return;\n }\n\n if (error instanceof Error && isAuthNetworkError(error)) {\n redirectToLogin();\n }\n});\n\nconst wsLink = new GraphQLWsLink(\n createWsClient({\n url: toWsUrl(DEFAULT_GRAPHQL_ENDPOINT),\n connectionParams: () => {\n // Grab the auth token from the auth link's context builder for WS handshake\n return { authorization: \"\" }; // token injected server-side from cookie/session\n },\n }),\n);\n\nconst splitLink = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === \"OperationDefinition\" &&\n definition.operation === \"subscription\"\n );\n },\n wsLink,\n from([errorLink, authLink, httpLink]),\n);\n\n// Create the Apollo Client instance\n// NOTE: defaultOptions.errorPolicy is intentionally omitted. Apollo Client v4\n// guards it behind a DeclareDefaultOptions module augmentation that does not\n// resolve reliably in CI's frozen install, so it is left at the v4 default\n// (\"none\"). Per-operation errorPolicy: \"all\" can be set on individual hooks\n// where partial-data-on-error handling is required.\nexport const apolloClient = new ApolloClient({\n link: splitLink,\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n // Pagination policies for connection types\n developerOrganizations: {\n keyArgs: [\"tier\", \"isVerified\", \"isCertified\", \"partnerTier\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n applications: {\n keyArgs: [\"status\", \"visibility\", \"developerId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgSales: {\n keyArgs: [\n \"organizationId\",\n \"applicationId\",\n \"status\",\n \"pricingModel\",\n \"isPaidOut\",\n ],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgPayouts: {\n keyArgs: [\"organizationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) {\n return incoming;\n }\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgMembers: {\n keyArgs: [\"organizationId\", \"role\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n developerOrgInvitations: {\n keyArgs: [\"organizationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n webhooks: {\n keyArgs: [\"applicationId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n webhookDeliveries: {\n keyArgs: [\"webhookId\", \"status\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n auditLogs: {\n keyArgs: [\"resource\", \"resourceId\", \"actorId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n return {\n ...incoming,\n edges: [...(existing?.edges || []), ...incoming.edges],\n };\n },\n },\n applicationVersions: {\n // TODO(phase1-backend): Switch to ApplicationVersionConnection cursor pagination\n // once backend ships connection type. See stability tracker.\n keyArgs: [\"applicationId\"],\n merge(existing, incoming, { args }) {\n if (!args?.offset || args.offset === 0) return incoming;\n if (Array.isArray(incoming) && Array.isArray(existing)) {\n return [...existing, ...incoming];\n }\n return incoming;\n },\n },\n },\n },\n WebhookDelivery: {\n keyFields: [\"id\"],\n },\n ApplicationVersion: {\n keyFields: [\"id\"],\n },\n DeveloperOrganization: {\n keyFields: [\"id\"],\n },\n Application: {\n keyFields: [\"id\"],\n },\n DeveloperOrgMember: {\n keyFields: [\"id\"],\n },\n DeveloperOrgInvitation: {\n keyFields: [\"id\"],\n },\n Webhook: {\n keyFields: [\"id\"],\n },\n ApiKey: {\n keyFields: [\"id\"],\n },\n OAuthClient: {\n keyFields: [\"id\"],\n },\n },\n }),\n defaultOptions: {\n watchQuery: {\n fetchPolicy: \"cache-and-network\",\n },\n query: {\n fetchPolicy: \"cache-first\",\n },\n },\n});\n\n/**\n * Error handling utilities\n */\nexport interface GraphQLErrorInfo {\n message: string;\n code?: string;\n path?: readonly (string | number)[];\n}\n\n// Type for Apollo errors (can be CombinedGraphQLErrors, ServerError, or Error)\nexport type ApolloErrorLike = Error & {\n graphQLErrors?: readonly {\n message: string;\n extensions?: { code?: string };\n path?: readonly (string | number)[];\n }[];\n networkError?: Error | null;\n};\n\nexport function parseGraphQLError(error: ApolloErrorLike): GraphQLErrorInfo[] {\n if (error instanceof CombinedGraphQLErrors) {\n return error.errors.map((err) => ({\n message: err.message,\n code: err.extensions?.code as string | undefined,\n path: err.path,\n }));\n }\n\n if (error.graphQLErrors && error.graphQLErrors.length > 0) {\n return error.graphQLErrors.map((err) => ({\n message: err.message,\n code: err.extensions?.code as string | undefined,\n path: err.path,\n }));\n }\n\n if (error instanceof ServerError || error.networkError) {\n return [\n {\n message: \"Network error. Please check your connection and try again.\",\n code: \"NETWORK_ERROR\",\n },\n ];\n }\n\n return [\n {\n message: error.message || \"An unexpected error occurred\",\n code: \"UNKNOWN_ERROR\",\n },\n ];\n}\n\n/**\n * Get a user-friendly error message from an Apollo error\n */\nexport function getErrorMessage(error: ApolloErrorLike): string {\n const errors = parseGraphQLError(error);\n return errors.map((e) => e.message).join(\", \");\n}\n\n/**\n * Check if an error is an authentication error\n */\nexport function isAuthError(error: ApolloErrorLike): boolean {\n const errors = parseGraphQLError(error);\n return errors.some(\n (e) => e.code === \"UNAUTHENTICATED\" || e.code === \"FORBIDDEN\",\n );\n}\n\n/**\n * Check if an error is a validation error\n */\nexport function isValidationError(error: ApolloErrorLike): boolean {\n const errors = parseGraphQLError(error);\n return errors.some(\n (e) => e.code === \"BAD_USER_INPUT\" || e.code === \"VALIDATION_ERROR\",\n );\n}\n\n/**\n * Clear Apollo cache (useful for logout)\n */\nexport async function clearApolloCache(): Promise<void> {\n await apolloClient.clearStore();\n}\n\n/**\n * Reset Apollo store and refetch queries\n */\nexport async function resetApolloStore(): Promise<void> {\n await apolloClient.resetStore();\n}\n"],"mappings":";;;;;;;;;;;AA0BA,SAAS,EACP,IAGK,EAAE,EACE;AACT,QAAO,EAAO,MAAM,MAAU;EAC5B,IAAM,IACJ,OAAO,EAAM,YAAY,QAAS,WAAW,EAAM,WAAW,OAAO,IACjE,IACJ,OAAO,EAAM,YAAY,aAAc,WACnC,EAAM,WAAW,YACjB,IACA,KAAW,EAAM,WAAW,IAAI,aAAa;AAEnD,SACE,MAAS,qBACT,MAAc,mBACd,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,eAAe,IAChC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,0BAA0B,IAC3C,EAAQ,SAAS,4BAA4B;GAE/C;;AAqBJ,IAAM,IACkC,IAIlC,IAGH,IAAgB,uBAAuB,iCAEpC,IAGH,IAAgB,kBAAkB,iCAE/B,IAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,EAII,IAEJ,gBAEI,IAGJ;AAEF,SAAS,EAAQ,GAAyB;AACxC,QAAO,EAAQ,QAAQ,UAAU,MAAM,CAAC,QAAQ,SAAS,KAAK;;AAIhE,IAAM,IAAoB,EAAe,EACvC,KAAK,GACN,CAAC,EAMI,IAAW,GACd,EAAE,uBACI,IAIE,EAAqB,IAAI,EAAc,GAHrC,IAPQ,EAAe,EAClC,KAAK,GACN,CAAC,EAWA,EACD,EAGK,IAAW,G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,CAAC;AAqBF,SAAgB,EAAkB,GAA4C;AA0B5E,QAzBI,aAAiB,IACZ,EAAM,OAAO,KAAK,OAAS;EAChC,SAAS,EAAI;EACb,MAAM,EAAI,YAAY;EACtB,MAAM,EAAI;EACX,EAAE,GAGD,EAAM,iBAAiB,EAAM,cAAc,SAAS,IAC/C,EAAM,cAAc,KAAK,OAAS;EACvC,SAAS,EAAI;EACb,MAAM,EAAI,YAAY;EACtB,MAAM,EAAI;EACX,EAAE,GAGD,aAAiB,KAAe,EAAM,eACjC,CACL;EACE,SAAS;EACT,MAAM;EACP,CACF,GAGI,CACL;EACE,SAAS,EAAM,WAAW;EAC1B,MAAM;EACP,CACF;;AAMH,SAAgB,EAAgB,GAAgC;AAE9D,QADe,EAAkB,EAAM,CACzB,KAAK,MAAM,EAAE,QAAQ,CAAC,KAAK,KAAK;;AAMhD,SAAgB,EAAY,GAAiC;AAE3D,QADe,EAAkB,EAAM,CACzB,MACX,MAAM,EAAE,SAAS,qBAAqB,EAAE,SAAS,YACnD;;AAMH,SAAgB,EAAkB,GAAiC;AAEjE,QADe,EAAkB,EAAM,CACzB,MACX,MAAM,EAAE,SAAS,oBAAoB,EAAE,SAAS,mBAClD;;AAMH,eAAsB,IAAkC;AACtD,OAAM,EAAa,YAAY;;AAMjC,eAAsB,IAAkC;AACtD,OAAM,EAAa,YAAY"}
|
|
@@ -8,9 +8,11 @@ import { AlertTriangle as o, ArrowLeft as s, CheckCircle2 as c, Clock as l, Refr
|
|
|
8
8
|
import { useNavigate as p, useParams as m } from "react-router-dom";
|
|
9
9
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
10
|
import { graphqlFetch as _ } from "@burdenoff/fe-libs/shared/graphql";
|
|
11
|
+
import { useApolloClient as v } from "@apollo/client/react";
|
|
12
|
+
import { gql as y } from "@apollo/client/core";
|
|
11
13
|
//#region src/devportal/pages/StoreSubmissionPage.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
+
var b = "\n query DevportalAppForSubmission($id: ID!) {\n application(id: $id) {\n id\n name\n slug\n status\n reviewStatus\n iconUrl\n metadata\n }\n }\n", x = "\n mutation DevportalSubmitForReview($id: ID!, $notes: String) {\n submitApplicationForReview(id: $id, notes: $notes) {\n id\n status\n submittedAt\n metadata\n }\n }\n";
|
|
15
|
+
function S(e) {
|
|
14
16
|
if (!e) return null;
|
|
15
17
|
let t = e.metadata ?? {}, n = typeof t.storeProductId == "string" ? t.storeProductId : "", r = typeof t.storeSubmissionStatus == "string" ? t.storeSubmissionStatus : null;
|
|
16
18
|
return {
|
|
@@ -23,7 +25,7 @@ function b(e) {
|
|
|
23
25
|
rejectedReason: null
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
var
|
|
28
|
+
var C = {
|
|
27
29
|
DRAFT: {
|
|
28
30
|
i18nKey: "devportal.storeSubmission.status.draft",
|
|
29
31
|
fallback: "Draft",
|
|
@@ -54,53 +56,73 @@ var x = {
|
|
|
54
56
|
icon: o,
|
|
55
57
|
tone: "text-text-tertiary"
|
|
56
58
|
}
|
|
57
|
-
},
|
|
58
|
-
let { appId: o } = m(), f = p(),
|
|
59
|
+
}, w = () => {
|
|
60
|
+
let { appId: o } = m(), f = p(), w = e(), T = r(), E = n(t.APP_SUBMIT), [D, O] = a(null), [k, A] = a(!0), [j, M] = a(null), [N, P] = a(!1), [F, I] = a(""), L = v(), R = async () => {
|
|
59
61
|
if (o) {
|
|
60
|
-
|
|
62
|
+
A(!0), M(null);
|
|
61
63
|
try {
|
|
62
64
|
let e = await _({
|
|
63
65
|
gateway: "global",
|
|
64
|
-
query:
|
|
66
|
+
query: b,
|
|
65
67
|
variables: { id: o }
|
|
66
68
|
});
|
|
67
|
-
if (e.errors?.length) throw Error(e.errors[0]?.message ??
|
|
68
|
-
|
|
69
|
+
if (e.errors?.length) throw Error(e.errors[0]?.message ?? T("devportal.storeSubmission.errors.loadFailed", "Failed to load application"));
|
|
70
|
+
O(e.data?.application ?? null);
|
|
69
71
|
} catch (e) {
|
|
70
|
-
|
|
72
|
+
M(e instanceof Error ? e.message : T("devportal.storeSubmission.errors.loadFailed", "Failed to load application"));
|
|
71
73
|
} finally {
|
|
72
|
-
|
|
74
|
+
A(!1);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
};
|
|
76
78
|
i(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
R();
|
|
80
|
+
}, [o]), i(() => {
|
|
81
|
+
if (!o) return;
|
|
82
|
+
let e = L.subscribe({
|
|
83
|
+
query: y`
|
|
84
|
+
subscription ApplicationStoreStatusChanged($applicationId: ID!) {
|
|
85
|
+
applicationStoreStatusChanged(applicationId: $applicationId) {
|
|
86
|
+
applicationId
|
|
87
|
+
status
|
|
88
|
+
reviewNotes
|
|
89
|
+
rejectedReason
|
|
90
|
+
updatedAt
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`,
|
|
94
|
+
variables: { applicationId: o }
|
|
95
|
+
}).subscribe({
|
|
96
|
+
next: () => {
|
|
97
|
+
R();
|
|
98
|
+
},
|
|
99
|
+
error: (e) => {
|
|
100
|
+
console.warn("[StoreSubmissionPage] subscription error:", e);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return () => e.unsubscribe();
|
|
104
|
+
}, [o, L]);
|
|
105
|
+
let z = async () => {
|
|
84
106
|
if (o) {
|
|
85
|
-
|
|
107
|
+
P(!0), M(null);
|
|
86
108
|
try {
|
|
87
109
|
let e = await _({
|
|
88
110
|
gateway: "global",
|
|
89
|
-
query:
|
|
111
|
+
query: x,
|
|
90
112
|
variables: {
|
|
91
113
|
id: o,
|
|
92
|
-
notes:
|
|
114
|
+
notes: F || null
|
|
93
115
|
}
|
|
94
116
|
});
|
|
95
|
-
if (e.errors?.length) throw Error(e.errors[0]?.message ??
|
|
96
|
-
|
|
117
|
+
if (e.errors?.length) throw Error(e.errors[0]?.message ?? T("devportal.storeSubmission.errors.submitFailed", "Submission failed"));
|
|
118
|
+
w.emit("devportal.app.submitted", { appId: o }), await R();
|
|
97
119
|
} catch (e) {
|
|
98
|
-
|
|
120
|
+
M(e instanceof Error ? e.message : T("devportal.storeSubmission.errors.submitFailed", "Submission failed"));
|
|
99
121
|
} finally {
|
|
100
|
-
|
|
122
|
+
P(!1);
|
|
101
123
|
}
|
|
102
124
|
}
|
|
103
|
-
},
|
|
125
|
+
}, B = S(D), V = B ? C[B.status] : C.UNKNOWN, H = V.icon;
|
|
104
126
|
return /* @__PURE__ */ g("main", {
|
|
105
127
|
className: "min-h-screen bg-surface-default",
|
|
106
128
|
"aria-labelledby": "store-submission-heading",
|
|
@@ -117,7 +139,7 @@ var x = {
|
|
|
117
139
|
children: [/* @__PURE__ */ h(s, {
|
|
118
140
|
className: "h-4 w-4",
|
|
119
141
|
"aria-hidden": "true"
|
|
120
|
-
}),
|
|
142
|
+
}), T("devportal.common.back", "Back")]
|
|
121
143
|
}), /* @__PURE__ */ g("div", {
|
|
122
144
|
className: "flex items-center gap-2",
|
|
123
145
|
children: [/* @__PURE__ */ h(d, {
|
|
@@ -126,23 +148,23 @@ var x = {
|
|
|
126
148
|
}), /* @__PURE__ */ h("h1", {
|
|
127
149
|
id: "store-submission-heading",
|
|
128
150
|
className: "text-xl font-semibold text-text-primary",
|
|
129
|
-
children:
|
|
151
|
+
children: T("devportal.storeSubmission.title", "Store submission")
|
|
130
152
|
})]
|
|
131
153
|
})]
|
|
132
154
|
})
|
|
133
155
|
})
|
|
134
156
|
}), /* @__PURE__ */ g("div", {
|
|
135
157
|
className: "mx-auto max-w-3xl px-6 py-6",
|
|
136
|
-
children: [
|
|
158
|
+
children: [j && /* @__PURE__ */ h("div", {
|
|
137
159
|
role: "alert",
|
|
138
160
|
className: "mb-4 rounded-md border border-border-danger bg-surface-danger-muted px-4 py-3 text-sm text-text-danger",
|
|
139
|
-
children:
|
|
140
|
-
}),
|
|
161
|
+
children: j
|
|
162
|
+
}), k && !D ? /* @__PURE__ */ h("div", {
|
|
141
163
|
className: "py-16 text-center text-text-secondary",
|
|
142
164
|
role: "status",
|
|
143
165
|
"aria-live": "polite",
|
|
144
|
-
children:
|
|
145
|
-
}) :
|
|
166
|
+
children: T("devportal.storeSubmission.loading", "Loading application…")
|
|
167
|
+
}) : D ? /* @__PURE__ */ g("div", {
|
|
146
168
|
className: "space-y-4",
|
|
147
169
|
children: [
|
|
148
170
|
/* @__PURE__ */ h("div", {
|
|
@@ -150,49 +172,49 @@ var x = {
|
|
|
150
172
|
children: /* @__PURE__ */ g("div", {
|
|
151
173
|
className: "flex items-center gap-3",
|
|
152
174
|
children: [
|
|
153
|
-
|
|
154
|
-
src:
|
|
175
|
+
D.iconUrl ? /* @__PURE__ */ h("img", {
|
|
176
|
+
src: D.iconUrl,
|
|
155
177
|
alt: "",
|
|
156
178
|
className: "h-14 w-14 flex-shrink-0 rounded-md object-cover"
|
|
157
179
|
}) : /* @__PURE__ */ h("div", {
|
|
158
180
|
className: "flex h-14 w-14 flex-shrink-0 items-center justify-center rounded-md bg-surface-muted text-text-secondary",
|
|
159
|
-
children:
|
|
181
|
+
children: D.name.slice(0, 2).toUpperCase()
|
|
160
182
|
}),
|
|
161
183
|
/* @__PURE__ */ g("div", {
|
|
162
184
|
className: "min-w-0 flex-1",
|
|
163
185
|
children: [/* @__PURE__ */ h("h2", {
|
|
164
186
|
className: "text-lg font-semibold text-text-primary",
|
|
165
|
-
children:
|
|
187
|
+
children: D.name
|
|
166
188
|
}), /* @__PURE__ */ h("p", {
|
|
167
189
|
className: "font-mono text-xs text-text-tertiary",
|
|
168
|
-
children:
|
|
190
|
+
children: D.slug
|
|
169
191
|
})]
|
|
170
192
|
}),
|
|
171
193
|
/* @__PURE__ */ g("div", {
|
|
172
|
-
className: `flex items-center gap-1.5 ${
|
|
194
|
+
className: `flex items-center gap-1.5 ${V.tone}`,
|
|
173
195
|
role: "status",
|
|
174
|
-
children: [/* @__PURE__ */ h(
|
|
196
|
+
children: [/* @__PURE__ */ h(H, {
|
|
175
197
|
className: "h-5 w-5",
|
|
176
198
|
"aria-hidden": "true"
|
|
177
199
|
}), /* @__PURE__ */ h("span", {
|
|
178
200
|
className: "text-sm font-medium",
|
|
179
|
-
children:
|
|
201
|
+
children: T(V.i18nKey, V.fallback)
|
|
180
202
|
})]
|
|
181
203
|
})
|
|
182
204
|
]
|
|
183
205
|
})
|
|
184
206
|
}),
|
|
185
|
-
|
|
207
|
+
B && B.status !== "UNKNOWN" && /* @__PURE__ */ g("div", {
|
|
186
208
|
className: "rounded-lg border border-border-default bg-surface-raised p-4",
|
|
187
209
|
children: [
|
|
188
210
|
/* @__PURE__ */ h("h3", {
|
|
189
211
|
className: "mb-3 text-sm font-semibold text-text-primary",
|
|
190
|
-
children:
|
|
212
|
+
children: T("devportal.storeSubmission.timeline", "Submission timeline")
|
|
191
213
|
}),
|
|
192
214
|
/* @__PURE__ */ g("ul", {
|
|
193
215
|
className: "space-y-2 text-sm",
|
|
194
216
|
children: [
|
|
195
|
-
|
|
217
|
+
B.submittedAt && /* @__PURE__ */ g("li", {
|
|
196
218
|
className: "flex items-center gap-2",
|
|
197
219
|
children: [
|
|
198
220
|
/* @__PURE__ */ h(l, {
|
|
@@ -201,15 +223,15 @@ var x = {
|
|
|
201
223
|
}),
|
|
202
224
|
/* @__PURE__ */ h("span", {
|
|
203
225
|
className: "text-text-secondary",
|
|
204
|
-
children:
|
|
226
|
+
children: T("devportal.storeSubmission.submitted", "Submitted:")
|
|
205
227
|
}),
|
|
206
228
|
/* @__PURE__ */ h("span", {
|
|
207
229
|
className: "text-text-primary",
|
|
208
|
-
children: new Date(
|
|
230
|
+
children: new Date(B.submittedAt).toLocaleString()
|
|
209
231
|
})
|
|
210
232
|
]
|
|
211
233
|
}),
|
|
212
|
-
|
|
234
|
+
B.reviewedAt && /* @__PURE__ */ g("li", {
|
|
213
235
|
className: "flex items-center gap-2",
|
|
214
236
|
children: [
|
|
215
237
|
/* @__PURE__ */ h(c, {
|
|
@@ -218,15 +240,15 @@ var x = {
|
|
|
218
240
|
}),
|
|
219
241
|
/* @__PURE__ */ h("span", {
|
|
220
242
|
className: "text-text-secondary",
|
|
221
|
-
children:
|
|
243
|
+
children: T("devportal.storeSubmission.reviewed", "Reviewed:")
|
|
222
244
|
}),
|
|
223
245
|
/* @__PURE__ */ h("span", {
|
|
224
246
|
className: "text-text-primary",
|
|
225
|
-
children: new Date(
|
|
247
|
+
children: new Date(B.reviewedAt).toLocaleString()
|
|
226
248
|
})
|
|
227
249
|
]
|
|
228
250
|
}),
|
|
229
|
-
|
|
251
|
+
B.publishedAt && /* @__PURE__ */ g("li", {
|
|
230
252
|
className: "flex items-center gap-2",
|
|
231
253
|
children: [
|
|
232
254
|
/* @__PURE__ */ h(c, {
|
|
@@ -235,99 +257,99 @@ var x = {
|
|
|
235
257
|
}),
|
|
236
258
|
/* @__PURE__ */ h("span", {
|
|
237
259
|
className: "text-text-secondary",
|
|
238
|
-
children:
|
|
260
|
+
children: T("devportal.storeSubmission.published", "Published:")
|
|
239
261
|
}),
|
|
240
262
|
/* @__PURE__ */ h("span", {
|
|
241
263
|
className: "text-text-primary",
|
|
242
|
-
children: new Date(
|
|
264
|
+
children: new Date(B.publishedAt).toLocaleString()
|
|
243
265
|
})
|
|
244
266
|
]
|
|
245
267
|
})
|
|
246
268
|
]
|
|
247
269
|
}),
|
|
248
|
-
|
|
270
|
+
B.reviewNotes && /* @__PURE__ */ g("div", {
|
|
249
271
|
className: "mt-3 rounded-md bg-surface-muted p-3",
|
|
250
272
|
children: [/* @__PURE__ */ h("p", {
|
|
251
273
|
className: "text-xs font-medium text-text-secondary",
|
|
252
|
-
children:
|
|
274
|
+
children: T("devportal.storeSubmission.reviewerNotes", "Reviewer notes")
|
|
253
275
|
}), /* @__PURE__ */ h("p", {
|
|
254
276
|
className: "mt-1 text-sm text-text-primary",
|
|
255
|
-
children:
|
|
277
|
+
children: B.reviewNotes
|
|
256
278
|
})]
|
|
257
279
|
}),
|
|
258
|
-
|
|
280
|
+
B.rejectedReason && /* @__PURE__ */ g("div", {
|
|
259
281
|
className: "mt-3 rounded-md border border-border-danger bg-surface-danger-muted p-3",
|
|
260
282
|
role: "alert",
|
|
261
283
|
children: [/* @__PURE__ */ h("p", {
|
|
262
284
|
className: "text-xs font-medium text-text-danger",
|
|
263
|
-
children:
|
|
285
|
+
children: T("devportal.storeSubmission.rejectionReason", "Rejection reason")
|
|
264
286
|
}), /* @__PURE__ */ h("p", {
|
|
265
287
|
className: "mt-1 text-sm text-text-primary",
|
|
266
|
-
children:
|
|
288
|
+
children: B.rejectedReason
|
|
267
289
|
})]
|
|
268
290
|
})
|
|
269
291
|
]
|
|
270
292
|
}),
|
|
271
|
-
(!
|
|
293
|
+
(!B || B.status === "UNKNOWN" || B.status === "DRAFT" || B.status === "REJECTED") && /* @__PURE__ */ g("div", {
|
|
272
294
|
className: "rounded-lg border border-border-default bg-surface-raised p-4",
|
|
273
295
|
children: [
|
|
274
296
|
/* @__PURE__ */ h("h3", {
|
|
275
297
|
className: "mb-2 text-sm font-semibold text-text-primary",
|
|
276
|
-
children:
|
|
298
|
+
children: B?.status === "REJECTED" ? T("devportal.storeSubmission.resubmitForReview", "Resubmit for review") : T("devportal.storeSubmission.submitForReview", "Submit for review")
|
|
277
299
|
}),
|
|
278
300
|
/* @__PURE__ */ h("p", {
|
|
279
301
|
className: "mb-3 text-sm text-text-secondary",
|
|
280
|
-
children:
|
|
302
|
+
children: T("devportal.storeSubmission.help", "Your application will be sent to the store's review queue. Whether it's auto-published or requires admin approval depends on the target store's configuration.")
|
|
281
303
|
}),
|
|
282
304
|
/* @__PURE__ */ h("label", {
|
|
283
305
|
className: "block",
|
|
284
306
|
htmlFor: "store-submission-notes",
|
|
285
307
|
children: /* @__PURE__ */ h("span", {
|
|
286
308
|
className: "sr-only",
|
|
287
|
-
children:
|
|
309
|
+
children: T("devportal.storeSubmission.notesLabel", "Notes for the reviewer (optional)")
|
|
288
310
|
})
|
|
289
311
|
}),
|
|
290
312
|
/* @__PURE__ */ h("textarea", {
|
|
291
313
|
id: "store-submission-notes",
|
|
292
|
-
value:
|
|
293
|
-
onChange: (e) =>
|
|
314
|
+
value: F,
|
|
315
|
+
onChange: (e) => I(e.target.value),
|
|
294
316
|
rows: 3,
|
|
295
|
-
placeholder:
|
|
317
|
+
placeholder: T("devportal.storeSubmission.notesLabel", "Notes for the reviewer (optional)"),
|
|
296
318
|
className: "mb-3 w-full rounded-md border border-border-default bg-surface-default px-3 py-2 text-sm text-text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
|
|
297
319
|
}),
|
|
298
320
|
/* @__PURE__ */ g("button", {
|
|
299
321
|
type: "button",
|
|
300
|
-
onClick: () => void
|
|
301
|
-
disabled:
|
|
302
|
-
"aria-disabled":
|
|
303
|
-
title:
|
|
322
|
+
onClick: () => void z(),
|
|
323
|
+
disabled: N || !E.allowed,
|
|
324
|
+
"aria-disabled": N || !E.allowed,
|
|
325
|
+
title: E.allowed ? void 0 : T("devportal.common.noPermission", "You do not have permission to perform this action"),
|
|
304
326
|
className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text hover:opacity-90 disabled:opacity-60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
305
|
-
children: [
|
|
327
|
+
children: [N && /* @__PURE__ */ h(u, {
|
|
306
328
|
className: "h-4 w-4 animate-spin",
|
|
307
329
|
"aria-hidden": "true"
|
|
308
|
-
}),
|
|
330
|
+
}), B?.status === "REJECTED" ? T("devportal.storeSubmission.resubmit", "Resubmit") : T("devportal.storeSubmission.submitForReview", "Submit for review")]
|
|
309
331
|
})
|
|
310
332
|
]
|
|
311
333
|
}),
|
|
312
|
-
|
|
334
|
+
B?.productId && /* @__PURE__ */ g("div", {
|
|
313
335
|
className: "rounded-lg border border-border-default bg-surface-raised p-4",
|
|
314
336
|
children: [/* @__PURE__ */ h("p", {
|
|
315
337
|
className: "text-xs font-medium text-text-secondary",
|
|
316
|
-
children:
|
|
338
|
+
children: T("devportal.storeSubmission.storeProductId", "Store product ID")
|
|
317
339
|
}), /* @__PURE__ */ h("code", {
|
|
318
340
|
className: "mt-1 block break-all font-mono text-xs text-text-primary",
|
|
319
|
-
children:
|
|
341
|
+
children: B.productId
|
|
320
342
|
})]
|
|
321
343
|
})
|
|
322
344
|
]
|
|
323
345
|
}) : /* @__PURE__ */ h("div", {
|
|
324
346
|
className: "py-16 text-center text-text-secondary",
|
|
325
|
-
children:
|
|
347
|
+
children: T("devportal.storeSubmission.notFound", "Application not found.")
|
|
326
348
|
})]
|
|
327
349
|
})]
|
|
328
350
|
});
|
|
329
351
|
};
|
|
330
352
|
//#endregion
|
|
331
|
-
export {
|
|
353
|
+
export { w as StoreSubmissionPage };
|
|
332
354
|
|
|
333
355
|
//# sourceMappingURL=StoreSubmissionPage.js.map
|