@burdenoff/microfe-notification 2026.424.101 → 2026.513.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/components/NotificationCard.d.ts.map +1 -1
- package/dist/components/NotificationCard.js +62 -57
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/generated/global-operations.d.ts +556 -8
- package/dist/generated/global-operations.d.ts.map +1 -1
- package/dist/generated/global-operations.js +198 -155
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +2907 -153
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.d.ts +4521 -569
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/graphql/global-client.d.ts.map +1 -1
- package/dist/graphql/global-client.js +41 -23
- package/dist/graphql/global-client.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useNotificationAdmin.d.ts.map +1 -1
- package/dist/hooks/useNotificationPreferences.d.ts +12 -0
- package/dist/hooks/useNotificationPreferences.d.ts.map +1 -0
- package/dist/hooks/useNotificationPreferences.js +114 -0
- package/dist/hooks/useNotificationPreferences.js.map +1 -0
- package/dist/hooks/useNotifications.d.ts +6 -1
- package/dist/hooks/useNotifications.d.ts.map +1 -1
- package/dist/hooks/useNotifications.js +148 -99
- package/dist/hooks/useNotifications.js.map +1 -1
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +24 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
- package/dist/node_modules/@apollo/client/errors/utils.js +16 -0
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
- 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/dist/pages/CreateNotificationPage.d.ts.map +1 -1
- package/dist/pages/CreateNotificationPage.js +449 -448
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.d.ts.map +1 -1
- package/dist/pages/NotificationCenterPage.js +128 -123
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.d.ts.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +35 -37
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.d.ts.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +224 -79
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.d.ts.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +155 -141
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/providers/NotificationProvider.d.ts.map +1 -1
- package/dist/providers/NotificationProvider.js +6 -5
- package/dist/providers/NotificationProvider.js.map +1 -1
- package/dist/types/index.d.ts +36 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/nativeBridge.d.ts +3 -0
- package/dist/utils/nativeBridge.d.ts.map +1 -0
- package/dist/utils/nativeBridge.js +2 -0
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-client.d.ts","sourceRoot":"","sources":["../../src/graphql/global-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"global-client.d.ts","sourceRoot":"","sources":["../../src/graphql/global-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwC,MAAM,gBAAgB,CAAC;AAmCpF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,yDAAyD,CAAC;AAejG;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,CAAC,EAAE,MAAM,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,CAAC,OAAO,YAAY,CAAC,CA4GnC;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAOpD"}
|
|
@@ -1,38 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getMainDefinition as e } from "../node_modules/@apollo/client/utilities/internal/getMainDefinition.js";
|
|
2
|
+
import { GraphQLWsLink as t } from "../node_modules/@apollo/client/link/subscriptions/index.js";
|
|
3
|
+
import { createClient as n } from "../node_modules/graphql-ws/dist/client.js";
|
|
4
|
+
import { ApolloClient as r, HttpLink as i, InMemoryCache as a, from as o, split as s } from "@apollo/client";
|
|
5
|
+
import { setContext as c } from "@apollo/client/link/context";
|
|
6
|
+
import { onError as l } from "@apollo/client/link/error";
|
|
7
|
+
import { isAuthNetworkError as u, redirectToLogin as d } from "@burdenoff/fe-libs/shared/utils";
|
|
5
8
|
//#region src/graphql/global-client.ts
|
|
6
|
-
function
|
|
9
|
+
function f(e = []) {
|
|
7
10
|
return e.some((e) => {
|
|
8
11
|
let t = typeof e.extensions?.code == "string" ? e.extensions.code : "", n = typeof e.extensions?.errorCode == "string" ? e.extensions.errorCode : "", r = (e.message ?? "").toLowerCase();
|
|
9
12
|
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");
|
|
10
13
|
});
|
|
11
14
|
}
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
var p = null, m = null, h = null;
|
|
16
|
+
function g(e) {
|
|
17
|
+
let t = e.replace(/\/$/, "");
|
|
18
|
+
return t.endsWith("/graphql") ? t : t.endsWith("/global") ? `${t}/graphql` : `${t}/global/graphql`;
|
|
19
|
+
}
|
|
20
|
+
function _(e) {
|
|
21
|
+
return e.startsWith("https://") ? e.replace("https://", "wss://") : e.startsWith("http://") ? e.replace("http://", "ws://") : e;
|
|
22
|
+
}
|
|
23
|
+
function v(v, y) {
|
|
24
|
+
let b = g(v || "https://gw-global.local.burdenoff.com/global/graphql"), x = y ?? null;
|
|
25
|
+
if (p && m === b && h === x) return p;
|
|
26
|
+
m = b, h = x;
|
|
27
|
+
let S = new i({ uri: b }), C = typeof window < "u" ? new t(n({
|
|
28
|
+
url: _(b),
|
|
29
|
+
connectionParams: () => ({ authorization: y ? `Bearer ${y}` : "" }),
|
|
30
|
+
lazy: !0,
|
|
31
|
+
retryAttempts: 3
|
|
32
|
+
})) : null, w = c((e, t) => ({ headers: {
|
|
18
33
|
...t.headers,
|
|
19
|
-
authorization:
|
|
34
|
+
authorization: y ? `Bearer ${y}` : ""
|
|
20
35
|
} }));
|
|
21
|
-
return
|
|
22
|
-
link:
|
|
23
|
-
|
|
36
|
+
return p = new r({
|
|
37
|
+
link: o([
|
|
38
|
+
l(({ error: e }) => {
|
|
24
39
|
if (e) {
|
|
25
|
-
if (
|
|
26
|
-
|
|
40
|
+
if (f("errors" in e && Array.isArray(e.errors) ? e.errors : [])) {
|
|
41
|
+
d();
|
|
27
42
|
return;
|
|
28
43
|
}
|
|
29
|
-
e instanceof Error &&
|
|
44
|
+
e instanceof Error && u(e) && d();
|
|
30
45
|
}
|
|
31
46
|
}),
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
w,
|
|
48
|
+
C ? s(({ query: t }) => {
|
|
49
|
+
let n = e(t);
|
|
50
|
+
return n.kind === "OperationDefinition" && n.operation === "subscription";
|
|
51
|
+
}, C, S) : S
|
|
34
52
|
]),
|
|
35
|
-
cache: new
|
|
53
|
+
cache: new a({ typePolicies: {
|
|
36
54
|
Query: { fields: {
|
|
37
55
|
notifications: { merge(e, t) {
|
|
38
56
|
return t;
|
|
@@ -49,9 +67,9 @@ function f(f, p) {
|
|
|
49
67
|
query: { fetchPolicy: "network-only" },
|
|
50
68
|
mutate: { fetchPolicy: "network-only" }
|
|
51
69
|
}
|
|
52
|
-
}),
|
|
70
|
+
}), p;
|
|
53
71
|
}
|
|
54
72
|
//#endregion
|
|
55
|
-
export {
|
|
73
|
+
export { v as getGlobalNotificationClient };
|
|
56
74
|
|
|
57
75
|
//# sourceMappingURL=global-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-client.js","names":[],"sources":["../../src/graphql/global-client.ts"],"sourcesContent":["import { ApolloClient, InMemoryCache, HttpLink, from } from '@apollo/client';\nimport { setContext } from '@apollo/client/link/context';\nimport { onError } from '@apollo/client/link/error';\nimport { isAuthNetworkError, redirectToLogin } from '@burdenoff/fe-libs/shared/utils';\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{ message?: string; extensions?: Record<string, unknown> }> = []\n): boolean {\n return errors.some((error) => {\n const code = typeof error.extensions?.code === 'string' ? error.extensions.code : '';\n const errorCode =\n typeof error.extensions?.errorCode === 'string' ? error.extensions.errorCode : '';\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\
|
|
1
|
+
{"version":3,"file":"global-client.js","names":[],"sources":["../../src/graphql/global-client.ts"],"sourcesContent":["import { ApolloClient, InMemoryCache, HttpLink, from, split } from '@apollo/client';\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 { isAuthNetworkError, redirectToLogin } from '@burdenoff/fe-libs/shared/utils';\nimport { createClient } from 'graphql-ws';\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{ message?: string; extensions?: Record<string, unknown> }> = []\n): boolean {\n return errors.some((error) => {\n const code = typeof error.extensions?.code === 'string' ? error.extensions.code : '';\n const errorCode =\n typeof error.extensions?.errorCode === 'string' ? error.extensions.errorCode : '';\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\nlet globalClientInstance: InstanceType<typeof ApolloClient> | null = null;\nlet currentGlobalUrl: string | null = null;\nlet currentAuthToken: string | null = null;\n\n/**\n * Default Global Gateway URL\n * Notifications are a GLOBAL service and must use the global gateway\n */\nexport const DEFAULT_GLOBAL_GATEWAY_URL = 'https://gw-global.local.burdenoff.com/global/graphql';\n\nfunction toGraphqlUrl(url: string): string {\n const normalized = url.replace(/\\/$/, '');\n if (normalized.endsWith('/graphql')) return normalized;\n if (normalized.endsWith('/global')) return `${normalized}/graphql`;\n return `${normalized}/global/graphql`;\n}\n\nfunction toSubscriptionUrl(url: string): string {\n if (url.startsWith('https://')) return url.replace('https://', 'wss://');\n if (url.startsWith('http://')) return url.replace('http://', 'ws://');\n return url;\n}\n\n/**\n * Get or create the singleton Apollo client for global notification operations\n *\n * @param globalGatewayUrl - Global Gateway GraphQL URL (default: https://gw-global.local.burdenoff.com/global/graphql)\n * @param authToken - Optional JWT auth token\n */\nexport function getGlobalNotificationClient(\n globalGatewayUrl?: string,\n authToken?: string\n): InstanceType<typeof ApolloClient> {\n const url = toGraphqlUrl(globalGatewayUrl || DEFAULT_GLOBAL_GATEWAY_URL);\n const nextAuthToken = authToken ?? null;\n\n // Return existing instance if config hasn't changed\n if (globalClientInstance && currentGlobalUrl === url && currentAuthToken === nextAuthToken) {\n return globalClientInstance;\n }\n\n // Update current config\n currentGlobalUrl = url;\n currentAuthToken = nextAuthToken;\n\n const httpLink = new HttpLink({\n uri: url,\n });\n\n const wsLink =\n typeof window !== 'undefined'\n ? new GraphQLWsLink(\n createClient({\n url: toSubscriptionUrl(url),\n connectionParams: () => ({\n authorization: authToken ? `Bearer ${authToken}` : '',\n }),\n lazy: true,\n retryAttempts: 3,\n })\n )\n : null;\n\n const authLink = setContext((_, prevContext) => {\n return {\n headers: {\n ...(prevContext.headers as Record<string, string>),\n authorization: authToken ? `Bearer ${authToken}` : '',\n },\n };\n });\n\n const errorLink = onError(({ error }) => {\n if (!error) return;\n\n const graphQLErrors = '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 const transportLink = wsLink\n ? split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === 'OperationDefinition' && definition.operation === 'subscription'\n );\n },\n wsLink,\n httpLink\n )\n : httpLink;\n\n globalClientInstance = new ApolloClient({\n link: from([errorLink, authLink, transportLink]),\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n notifications: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n notificationTemplates: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n },\n },\n Notification: {\n keyFields: ['id'],\n },\n NotificationTemplate: {\n keyFields: ['id'],\n },\n },\n }),\n defaultOptions: {\n watchQuery: {\n fetchPolicy: 'cache-and-network',\n },\n query: {\n fetchPolicy: 'network-only',\n },\n mutate: {\n fetchPolicy: 'network-only',\n },\n },\n });\n\n return globalClientInstance;\n}\n\n/**\n * Reset the singleton client (useful for testing or re-initialization)\n */\nexport function resetGlobalNotificationClient(): void {\n if (globalClientInstance) {\n globalClientInstance.clearStore();\n globalClientInstance = null;\n currentGlobalUrl = null;\n currentAuthToken = null;\n }\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,EACP,IAAoF,EAAE,EAC7E;AACT,QAAO,EAAO,MAAM,MAAU;EAC5B,IAAM,IAAO,OAAO,EAAM,YAAY,QAAS,WAAW,EAAM,WAAW,OAAO,IAC5E,IACJ,OAAO,EAAM,YAAY,aAAc,WAAW,EAAM,WAAW,YAAY,IAC3E,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;;AAGJ,IAAI,IAAiE,MACjE,IAAkC,MAClC,IAAkC;AAQtC,SAAS,EAAa,GAAqB;CACzC,IAAM,IAAa,EAAI,QAAQ,OAAO,GAAG;AAGzC,QAFI,EAAW,SAAS,WAAW,GAAS,IACxC,EAAW,SAAS,UAAU,GAAS,GAAG,EAAW,YAClD,GAAG,EAAW;;AAGvB,SAAS,EAAkB,GAAqB;AAG9C,QAFI,EAAI,WAAW,WAAW,GAAS,EAAI,QAAQ,YAAY,SAAS,GACpE,EAAI,WAAW,UAAU,GAAS,EAAI,QAAQ,WAAW,QAAQ,GAC9D;;AAST,SAAgB,EACd,GACA,GACmC;CACnC,IAAM,IAAM,EAAa,KAAA,uDAA+C,EAClE,IAAgB,KAAa;AAGnC,KAAI,KAAwB,MAAqB,KAAO,MAAqB,EAC3E,QAAO;AAKT,CADA,IAAmB,GACnB,IAAmB;CAEnB,IAAM,IAAW,IAAI,EAAS,EAC5B,KAAK,GACN,CAAC,EAEI,IACJ,OAAO,SAAW,MACd,IAAI,EACF,EAAa;EACX,KAAK,EAAkB,EAAI;EAC3B,yBAAyB,EACvB,eAAe,IAAY,UAAU,MAAc,IACpD;EACD,MAAM;EACN,eAAe;EAChB,CAAC,CACH,GACD,MAEA,IAAW,GAAY,GAAG,OACvB,EACL,SAAS;EACP,GAAI,EAAY;EAChB,eAAe,IAAY,UAAU,MAAc;EACpD,EACF,EACD;AAqEF,QAvCA,IAAuB,IAAI,EAAa;EACtC,MAAM,EAAK;GA7BK,GAAS,EAAE,eAAY;AAClC,WAIL;SAAI,EAFkB,YAAY,KAAS,MAAM,QAAQ,EAAM,OAAO,GAAG,EAAM,SAAS,EAAE,CAEnD,EAAE;AACvC,SAAiB;AACjB;;AAGF,KAAI,aAAiB,SAAS,EAAmB,EAAM,IACrD,GAAiB;;KAEnB;GAgBuB;GAdH,IAClB,GACG,EAAE,eAAY;IACb,IAAM,IAAa,EAAkB,EAAM;AAC3C,WACE,EAAW,SAAS,yBAAyB,EAAW,cAAc;MAG1E,GACA,EACD,GACD;GAG6C,CAAC;EAChD,OAAO,IAAI,EAAc,EACvB,cAAc;GACZ,OAAO,EACL,QAAQ;IACN,eAAe,EACb,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACD,uBAAuB,EACrB,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACF,EACF;GACD,cAAc,EACZ,WAAW,CAAC,KAAK,EAClB;GACD,sBAAsB,EACpB,WAAW,CAAC,KAAK,EAClB;GACF,EACF,CAAC;EACF,gBAAgB;GACd,YAAY,EACV,aAAa,qBACd;GACD,OAAO,EACL,aAAa,gBACd;GACD,QAAQ,EACN,aAAa,gBACd;GACF;EACF,CAAC,EAEK"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useNotifications } from './useNotifications';
|
|
2
2
|
export { useNotificationAdmin } from './useNotificationAdmin';
|
|
3
|
+
export { useNotificationPreferences } from './useNotificationPreferences';
|
|
3
4
|
export { useNotificationTopics } from './useNotificationTopics';
|
|
4
5
|
export { useNotificationStore } from '../store/notificationStore';
|
|
5
6
|
export { useNotification } from '../providers/NotificationProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationAdmin.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotificationAdmin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AA8GvE,wBAAgB,oBAAoB;;;;;;;;;;;;;;sBA+
|
|
1
|
+
{"version":3,"file":"useNotificationAdmin.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotificationAdmin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AA8GvE,wBAAgB,oBAAoB;;;;;;;;;;;;;;sBA+Kq5a,CAAC;;;;;;;;mBAA6L,CAAC;;;;;;;;;;;;;;;;;;;uCA9G7lb,MAAM;0CA+BN,MAAM;4CAYN,MAAM;2DAYG,MAAM;sDAYN,MAAM,gBAAgB,MAAM,aAAa,MAAM;;EA0ClF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NotificationPreference, UpsertNotificationPreferenceInput } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare function useNotificationPreferences(): {
|
|
4
|
+
preferences: NotificationPreference[];
|
|
5
|
+
preferencesByKey: Map<string, NotificationPreference>;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
refetch: () => Promise<void>;
|
|
9
|
+
setPreference: (input: UpsertNotificationPreferenceInput) => Promise<NotificationPreference | null>;
|
|
10
|
+
deletePreference: (id: string) => Promise<boolean>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useNotificationPreferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationPreferences.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotificationPreferences.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,sBAAsB,EAEtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AA2ClB,wBAAgB,0BAA0B;;;;;;2BAuCxB,iCAAiC,KAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;2BAgE7E,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;EA2BvC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useNotification as e } from "../providers/NotificationProvider.js";
|
|
2
|
+
import { getGlobalNotificationClient as t } from "../graphql/global-client.js";
|
|
3
|
+
import { CreateNotificationPreferenceDocument as n, DeleteNotificationPreferenceDocument as r, GetNotificationPreferencesDocument as i, UpdateNotificationPreferenceDocument as a } from "../generated/global-operations.js";
|
|
4
|
+
import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
5
|
+
//#region src/hooks/useNotificationPreferences.ts
|
|
6
|
+
function u(e) {
|
|
7
|
+
return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
|
|
8
|
+
}
|
|
9
|
+
function d(e) {
|
|
10
|
+
return {
|
|
11
|
+
id: e.id,
|
|
12
|
+
userId: e.userId,
|
|
13
|
+
preferenceKey: e.preferenceKey,
|
|
14
|
+
scope: e.scope,
|
|
15
|
+
channel: e.channel ?? void 0,
|
|
16
|
+
type: e.type ?? void 0,
|
|
17
|
+
topicId: e.topicId ?? void 0,
|
|
18
|
+
enabled: e.enabled,
|
|
19
|
+
frequency: e.frequency,
|
|
20
|
+
quietHoursStart: e.quietHoursStart ?? void 0,
|
|
21
|
+
quietHoursEnd: e.quietHoursEnd ?? void 0,
|
|
22
|
+
timezone: e.timezone ?? void 0,
|
|
23
|
+
metadata: e.metadata ?? void 0,
|
|
24
|
+
createdAt: e.createdAt,
|
|
25
|
+
updatedAt: e.updatedAt,
|
|
26
|
+
topic: e.topic ? {
|
|
27
|
+
id: e.topic.id,
|
|
28
|
+
name: e.topic.name,
|
|
29
|
+
slug: e.topic.slug,
|
|
30
|
+
type: e.topic.type,
|
|
31
|
+
description: e.topic.description ?? void 0
|
|
32
|
+
} : void 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function f() {
|
|
36
|
+
let { authToken: f, apiGatewayUrl: p } = e(), [m, h] = l([]), [g, _] = l(!1), [v, y] = l(null), b = o(() => t(p ?? void 0, f ?? void 0), [p, f]), x = c(() => new Map(m.map((e) => [e.preferenceKey, e])), [m]), S = o(async () => {
|
|
37
|
+
_(!0), y(null);
|
|
38
|
+
try {
|
|
39
|
+
h(((await b().query({
|
|
40
|
+
query: i,
|
|
41
|
+
variables: {
|
|
42
|
+
limit: 100,
|
|
43
|
+
offset: 0
|
|
44
|
+
},
|
|
45
|
+
fetchPolicy: "network-only"
|
|
46
|
+
})).data?.notificationPreferences.items || []).map(d));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error("[useNotificationPreferences] Failed to fetch preferences:", e), y(e instanceof Error ? e.message : "Failed to fetch notification preferences");
|
|
49
|
+
} finally {
|
|
50
|
+
_(!1);
|
|
51
|
+
}
|
|
52
|
+
}, [b]);
|
|
53
|
+
return s(() => {
|
|
54
|
+
S();
|
|
55
|
+
}, [S]), {
|
|
56
|
+
preferences: m,
|
|
57
|
+
preferencesByKey: x,
|
|
58
|
+
isLoading: g,
|
|
59
|
+
error: v,
|
|
60
|
+
refetch: S,
|
|
61
|
+
setPreference: o(async (e) => {
|
|
62
|
+
let t = b(), r = u(e), i = x.get(r);
|
|
63
|
+
if (i) {
|
|
64
|
+
let n = (await t.mutate({
|
|
65
|
+
mutation: a,
|
|
66
|
+
variables: {
|
|
67
|
+
id: i.id,
|
|
68
|
+
input: {
|
|
69
|
+
scope: e.scope,
|
|
70
|
+
channel: e.channel,
|
|
71
|
+
type: e.type,
|
|
72
|
+
topicId: e.topicId,
|
|
73
|
+
enabled: e.enabled,
|
|
74
|
+
frequency: e.frequency,
|
|
75
|
+
quietHoursStart: e.quietHoursStart,
|
|
76
|
+
quietHoursEnd: e.quietHoursEnd,
|
|
77
|
+
timezone: e.timezone,
|
|
78
|
+
metadata: e.metadata
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
})).data?.updateNotificationPreference;
|
|
82
|
+
if (!n) return null;
|
|
83
|
+
let r = d(n);
|
|
84
|
+
return h((e) => e.map((e) => e.id === r.id ? r : e)), r;
|
|
85
|
+
}
|
|
86
|
+
let o = (await t.mutate({
|
|
87
|
+
mutation: n,
|
|
88
|
+
variables: { input: {
|
|
89
|
+
scope: e.scope,
|
|
90
|
+
channel: e.channel,
|
|
91
|
+
type: e.type,
|
|
92
|
+
topicId: e.topicId,
|
|
93
|
+
enabled: e.enabled,
|
|
94
|
+
frequency: e.frequency || "IMMEDIATE",
|
|
95
|
+
quietHoursStart: e.quietHoursStart,
|
|
96
|
+
quietHoursEnd: e.quietHoursEnd,
|
|
97
|
+
timezone: e.timezone,
|
|
98
|
+
metadata: e.metadata
|
|
99
|
+
} }
|
|
100
|
+
})).data?.createNotificationPreference;
|
|
101
|
+
if (!o) return null;
|
|
102
|
+
let s = d(o);
|
|
103
|
+
return h((e) => [s, ...e]), s;
|
|
104
|
+
}, [b, x]),
|
|
105
|
+
deletePreference: o(async (e) => (await b().mutate({
|
|
106
|
+
mutation: r,
|
|
107
|
+
variables: { id: e }
|
|
108
|
+
})).data?.deleteNotificationPreference ? (h((t) => t.filter((t) => t.id !== e)), !0) : !1, [b])
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { f as useNotificationPreferences };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=useNotificationPreferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationPreferences.js","names":[],"sources":["../../src/hooks/useNotificationPreferences.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport { useNotification } from '../providers/NotificationProvider';\nimport * as NotificationOps from '../generated/global-operations';\nimport type {\n CreateNotificationPreferenceMutation,\n CreateNotificationPreferenceMutationVariables,\n DeleteNotificationPreferenceMutation,\n DeleteNotificationPreferenceMutationVariables,\n GetNotificationPreferencesQuery,\n NotificationPreferenceFieldsFragment,\n UpdateNotificationPreferenceMutation,\n UpdateNotificationPreferenceMutationVariables,\n} from '../generated/global-operations';\nimport type {\n NotificationPreference,\n NotificationPreferenceScope,\n UpsertNotificationPreferenceInput,\n} from '../types';\n\nfunction buildPreferenceKey(input: {\n scope: NotificationPreferenceScope;\n channel?: string;\n type?: string;\n topicId?: string;\n}): string {\n if (input.scope === 'CHANNEL') return `CHANNEL:${input.channel || ''}`;\n if (input.scope === 'TYPE') return `TYPE:${input.type || ''}`;\n if (input.scope === 'TOPIC') return `TOPIC:${input.topicId || ''}`;\n return 'GLOBAL';\n}\n\nfunction mapPreference(preference: NotificationPreferenceFieldsFragment): NotificationPreference {\n return {\n id: preference.id,\n userId: preference.userId,\n preferenceKey: preference.preferenceKey,\n scope: preference.scope,\n channel: preference.channel ?? undefined,\n type: preference.type ?? undefined,\n topicId: preference.topicId ?? undefined,\n enabled: preference.enabled,\n frequency: preference.frequency,\n quietHoursStart: preference.quietHoursStart ?? undefined,\n quietHoursEnd: preference.quietHoursEnd ?? undefined,\n timezone: preference.timezone ?? undefined,\n metadata: preference.metadata ?? undefined,\n createdAt: preference.createdAt,\n updatedAt: preference.updatedAt,\n topic: preference.topic\n ? {\n id: preference.topic.id,\n name: preference.topic.name,\n slug: preference.topic.slug,\n type: preference.topic.type,\n description: preference.topic.description ?? undefined,\n }\n : undefined,\n };\n}\n\nexport function useNotificationPreferences() {\n const { authToken, apiGatewayUrl } = useNotification();\n const [preferences, setPreferences] = useState<NotificationPreference[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n const preferencesByKey = useMemo(() => {\n return new Map(preferences.map((preference) => [preference.preferenceKey, preference]));\n }, [preferences]);\n\n const fetchPreferences = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetNotificationPreferencesQuery>({\n query: NotificationOps.GetNotificationPreferencesDocument,\n variables: { limit: 100, offset: 0 },\n fetchPolicy: 'network-only',\n });\n setPreferences((result.data?.notificationPreferences.items || []).map(mapPreference));\n } catch (err) {\n console.error('[useNotificationPreferences] Failed to fetch preferences:', err);\n setError(err instanceof Error ? err.message : 'Failed to fetch notification preferences');\n } finally {\n setIsLoading(false);\n }\n }, [getClient]);\n\n useEffect(() => {\n fetchPreferences();\n }, [fetchPreferences]);\n\n const setPreference = useCallback(\n async (input: UpsertNotificationPreferenceInput): Promise<NotificationPreference | null> => {\n const client = getClient();\n const preferenceKey = buildPreferenceKey(input);\n const existing = preferencesByKey.get(preferenceKey);\n\n if (existing) {\n const result = await client.mutate<\n UpdateNotificationPreferenceMutation,\n UpdateNotificationPreferenceMutationVariables\n >({\n mutation: NotificationOps.UpdateNotificationPreferenceDocument,\n variables: {\n id: existing.id,\n input: {\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n enabled: input.enabled,\n frequency: input.frequency,\n quietHoursStart: input.quietHoursStart,\n quietHoursEnd: input.quietHoursEnd,\n timezone: input.timezone,\n metadata: input.metadata,\n } as UpdateNotificationPreferenceMutationVariables['input'],\n },\n });\n const updated = result.data?.updateNotificationPreference;\n if (!updated) return null;\n const mapped = mapPreference(updated);\n setPreferences((prev) => prev.map((item) => (item.id === mapped.id ? mapped : item)));\n return mapped;\n }\n\n const result = await client.mutate<\n CreateNotificationPreferenceMutation,\n CreateNotificationPreferenceMutationVariables\n >({\n mutation: NotificationOps.CreateNotificationPreferenceDocument,\n variables: {\n input: {\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n enabled: input.enabled,\n frequency: input.frequency || 'IMMEDIATE',\n quietHoursStart: input.quietHoursStart,\n quietHoursEnd: input.quietHoursEnd,\n timezone: input.timezone,\n metadata: input.metadata,\n } as CreateNotificationPreferenceMutationVariables['input'],\n },\n });\n const created = result.data?.createNotificationPreference;\n if (!created) return null;\n const mapped = mapPreference(created);\n setPreferences((prev) => [mapped, ...prev]);\n return mapped;\n },\n [getClient, preferencesByKey]\n );\n\n const deletePreference = useCallback(\n async (id: string): Promise<boolean> => {\n const client = getClient();\n const result = await client.mutate<\n DeleteNotificationPreferenceMutation,\n DeleteNotificationPreferenceMutationVariables\n >({\n mutation: NotificationOps.DeleteNotificationPreferenceDocument,\n variables: { id },\n });\n if (result.data?.deleteNotificationPreference) {\n setPreferences((prev) => prev.filter((preference) => preference.id !== id));\n return true;\n }\n return false;\n },\n [getClient]\n );\n\n return {\n preferences,\n preferencesByKey,\n isLoading,\n error,\n refetch: fetchPreferences,\n setPreference,\n deletePreference,\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Notification, NotificationFilter } from '../types';
|
|
2
2
|
|
|
3
|
+
interface UseNotificationsOptions {
|
|
4
|
+
baseFilter?: Partial<NotificationFilter>;
|
|
5
|
+
unreadFilter?: Record<string, unknown>;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Hook to manage notifications with real GraphQL backend integration.
|
|
5
9
|
*
|
|
@@ -11,7 +15,7 @@ import { Notification, NotificationFilter } from '../types';
|
|
|
11
15
|
* const { notifications, unreadCount, markAsRead } = useNotifications();
|
|
12
16
|
* ```
|
|
13
17
|
*/
|
|
14
|
-
export declare function useNotifications(): {
|
|
18
|
+
export declare function useNotifications(options?: UseNotificationsOptions): {
|
|
15
19
|
notifications: Notification[];
|
|
16
20
|
allNotifications: Notification[];
|
|
17
21
|
unreadCount: number;
|
|
@@ -33,4 +37,5 @@ export declare function useNotifications(): {
|
|
|
33
37
|
refetch: () => Promise<void>;
|
|
34
38
|
loadMore: () => Promise<void>;
|
|
35
39
|
};
|
|
40
|
+
export {};
|
|
36
41
|
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAmBjE,UAAU,uBAAuB;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAoMD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B;;;;;;;;;;iCAqH3C,MAAM;;0CAsCN,MAAM;mCAqBL,MAAM,EAAE;4CAoBT,MAAM;mCAoBN,MAAM,aAAa,MAAM;;;;;;EAwInD"}
|