@replyke/core 5.1.4 → 5.1.5-beta.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.
Files changed (103) hide show
  1. package/dist/cjs/context/index.d.ts +1 -0
  2. package/dist/cjs/context/index.js +3 -1
  3. package/dist/cjs/context/index.js.map +1 -1
  4. package/dist/cjs/context/replyke-context.d.ts +1 -0
  5. package/dist/cjs/context/replyke-context.js +3 -2
  6. package/dist/cjs/context/replyke-context.js.map +1 -1
  7. package/dist/cjs/context/replyke-store-context.d.ts +12 -0
  8. package/dist/cjs/context/replyke-store-context.js +20 -0
  9. package/dist/cjs/context/replyke-store-context.js.map +1 -0
  10. package/dist/cjs/hooks/app-notifications-redux/index.d.ts +4 -0
  11. package/dist/cjs/hooks/app-notifications-redux/index.js +14 -0
  12. package/dist/cjs/hooks/app-notifications-redux/index.js.map +1 -0
  13. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.d.ts +12 -0
  14. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js +208 -0
  15. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js.map +1 -0
  16. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +7 -0
  17. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +83 -0
  18. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +1 -0
  19. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +7 -0
  20. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js +30 -0
  21. package/dist/cjs/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -0
  22. package/dist/cjs/index.d.ts +4 -1
  23. package/dist/cjs/index.js +9 -2
  24. package/dist/cjs/index.js.map +1 -1
  25. package/dist/cjs/store/api/appNotificationsApi.d.ts +1687 -0
  26. package/dist/cjs/store/api/appNotificationsApi.js +169 -0
  27. package/dist/cjs/store/api/appNotificationsApi.js.map +1 -0
  28. package/dist/cjs/store/api/baseApi.d.ts +1 -0
  29. package/dist/cjs/store/api/baseApi.js +34 -0
  30. package/dist/cjs/store/api/baseApi.js.map +1 -0
  31. package/dist/cjs/store/api/index.d.ts +2 -0
  32. package/dist/cjs/store/api/index.js +27 -0
  33. package/dist/cjs/store/api/index.js.map +1 -0
  34. package/dist/cjs/store/index.d.ts +13 -0
  35. package/dist/cjs/store/index.js +49 -0
  36. package/dist/cjs/store/index.js.map +1 -0
  37. package/dist/cjs/store/middleware.d.ts +4 -0
  38. package/dist/cjs/store/middleware.js +44 -0
  39. package/dist/cjs/store/middleware.js.map +1 -0
  40. package/dist/cjs/store/rootReducer.d.ts +8 -0
  41. package/dist/cjs/store/rootReducer.js +15 -0
  42. package/dist/cjs/store/rootReducer.js.map +1 -0
  43. package/dist/cjs/store/slices/appNotificationsSlice.d.ts +57 -0
  44. package/dist/cjs/store/slices/appNotificationsSlice.js +127 -0
  45. package/dist/cjs/store/slices/appNotificationsSlice.js.map +1 -0
  46. package/dist/cjs/store/slices/index.d.ts +1 -0
  47. package/dist/cjs/store/slices/index.js +23 -0
  48. package/dist/cjs/store/slices/index.js.map +1 -0
  49. package/dist/cjs/store/types/index.d.ts +8 -0
  50. package/dist/cjs/store/types/index.js +3 -0
  51. package/dist/cjs/store/types/index.js.map +1 -0
  52. package/dist/esm/context/index.d.ts +1 -0
  53. package/dist/esm/context/index.js +1 -0
  54. package/dist/esm/context/index.js.map +1 -1
  55. package/dist/esm/context/replyke-context.d.ts +1 -0
  56. package/dist/esm/context/replyke-context.js +3 -2
  57. package/dist/esm/context/replyke-context.js.map +1 -1
  58. package/dist/esm/context/replyke-store-context.d.ts +12 -0
  59. package/dist/esm/context/replyke-store-context.js +16 -0
  60. package/dist/esm/context/replyke-store-context.js.map +1 -0
  61. package/dist/esm/hooks/app-notifications-redux/index.d.ts +4 -0
  62. package/dist/esm/hooks/app-notifications-redux/index.js +5 -0
  63. package/dist/esm/hooks/app-notifications-redux/index.js.map +1 -0
  64. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.d.ts +12 -0
  65. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js +202 -0
  66. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsActionsRedux.js.map +1 -0
  67. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.d.ts +7 -0
  68. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js +78 -0
  69. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsDataRedux.js.map +1 -0
  70. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.d.ts +7 -0
  71. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js +27 -0
  72. package/dist/esm/hooks/app-notifications-redux/useAppNotificationsRedux.js.map +1 -0
  73. package/dist/esm/index.d.ts +4 -1
  74. package/dist/esm/index.js +7 -1
  75. package/dist/esm/index.js.map +1 -1
  76. package/dist/esm/store/api/appNotificationsApi.d.ts +1687 -0
  77. package/dist/esm/store/api/appNotificationsApi.js +166 -0
  78. package/dist/esm/store/api/appNotificationsApi.js.map +1 -0
  79. package/dist/esm/store/api/baseApi.d.ts +1 -0
  80. package/dist/esm/store/api/baseApi.js +31 -0
  81. package/dist/esm/store/api/baseApi.js.map +1 -0
  82. package/dist/esm/store/api/index.d.ts +2 -0
  83. package/dist/esm/store/api/index.js +9 -0
  84. package/dist/esm/store/api/index.js.map +1 -0
  85. package/dist/esm/store/index.d.ts +13 -0
  86. package/dist/esm/store/index.js +32 -0
  87. package/dist/esm/store/index.js.map +1 -0
  88. package/dist/esm/store/middleware.d.ts +4 -0
  89. package/dist/esm/store/middleware.js +39 -0
  90. package/dist/esm/store/middleware.js.map +1 -0
  91. package/dist/esm/store/rootReducer.d.ts +8 -0
  92. package/dist/esm/store/rootReducer.js +12 -0
  93. package/dist/esm/store/rootReducer.js.map +1 -0
  94. package/dist/esm/store/slices/appNotificationsSlice.d.ts +57 -0
  95. package/dist/esm/store/slices/appNotificationsSlice.js +116 -0
  96. package/dist/esm/store/slices/appNotificationsSlice.js.map +1 -0
  97. package/dist/esm/store/slices/index.d.ts +1 -0
  98. package/dist/esm/store/slices/index.js +7 -0
  99. package/dist/esm/store/slices/index.js.map +1 -0
  100. package/dist/esm/store/types/index.d.ts +8 -0
  101. package/dist/esm/store/types/index.js +2 -0
  102. package/dist/esm/store/types/index.js.map +1 -0
  103. package/package.json +4 -2
@@ -0,0 +1,8 @@
1
+ import type { Action, ThunkAction } from "@reduxjs/toolkit";
2
+ import type { RootState } from "../rootReducer";
3
+ import type { store } from "../index";
4
+ export type AppStore = typeof store;
5
+ export type { RootState };
6
+ export type AppDispatch = AppStore['dispatch'];
7
+ export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, Action<string>>;
8
+ export type TypedSelector<T> = (state: RootState) => T;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/store/types/index.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
1
  export { ReplykeProvider } from "./replyke-context";
2
+ export { ReplykeStoreProvider } from "./replyke-store-context";
2
3
  export { AuthProvider } from "./auth-context";
3
4
  export { EntityListProvider } from "./entity-list-context";
4
5
  export { EntityProvider } from "./entity-context";
@@ -1,4 +1,5 @@
1
1
  export { ReplykeProvider } from "./replyke-context";
2
+ export { ReplykeStoreProvider } from "./replyke-store-context";
2
3
  export { AuthProvider } from "./auth-context";
3
4
  export { EntityListProvider } from "./entity-list-context";
4
5
  export { EntityProvider } from "./entity-context";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { UseProjectDataProps, UseProjectDataValues } from "../hooks/projects/useProjectData";
3
3
  export interface ReplykeContextProps extends UseProjectDataProps {
4
4
  signedToken?: string | null | undefined;
5
+ enableRedux?: boolean;
5
6
  children: React.ReactNode;
6
7
  }
7
8
  export interface ReplykeContextValues extends UseProjectDataValues {
@@ -2,15 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext } from "react";
3
3
  import useProjectData from "../hooks/projects/useProjectData";
4
4
  import { AuthProvider } from "./auth-context";
5
+ import { ReplykeStoreProvider } from "./replyke-store-context";
5
6
  export var ReplykeContext = createContext({
6
7
  projectId: "",
7
8
  project: null,
8
9
  });
9
10
  export var ReplykeProvider = function (_a) {
10
- var projectId = _a.projectId, signedToken = _a.signedToken, children = _a.children;
11
+ var projectId = _a.projectId, signedToken = _a.signedToken, _b = _a.enableRedux, enableRedux = _b === void 0 ? false : _b, children = _a.children;
11
12
  var data = useProjectData({ projectId: projectId });
12
13
  if (!projectId)
13
14
  throw new Error("projectId in ReplykeProvider is " + typeof projectId);
14
- return (_jsx(ReplykeContext.Provider, { value: data, children: _jsx(AuthProvider, { signedToken: signedToken, children: children }) }));
15
+ return (_jsx(ReplykeContext.Provider, { value: data, children: _jsx(AuthProvider, { signedToken: signedToken, children: enableRedux ? (_jsx(ReplykeStoreProvider, { children: children })) : (children) }) }));
15
16
  };
16
17
  //# sourceMappingURL=replyke-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"replyke-context.js","sourceRoot":"","sources":["../../../src/context/replyke-context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,cAGN,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,MAAM,CAAC,IAAM,cAAc,GAAG,aAAa,CAAuB;IAChE,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,eAAe,GAAkC,UAAC,EAIzC;QAHpB,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,QAAQ,cAAA;IAER,IAAM,IAAI,GAAG,cAAc,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3C,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,OAAO,SAAS,CAAC,CAAC;IAEzE,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAClC,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,YAAG,QAAQ,GAAgB,GACzC,CAC3B,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"replyke-context.js","sourceRoot":"","sources":["../../../src/context/replyke-context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,cAGN,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAU/D,MAAM,CAAC,IAAM,cAAc,GAAG,aAAa,CAAuB;IAChE,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,eAAe,GAAkC,UAAC,EAKzC;QAJpB,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,mBAAmB,EAAnB,WAAW,mBAAG,KAAK,KAAA,EACnB,QAAQ,cAAA;IAER,IAAM,IAAI,GAAG,cAAc,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3C,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,OAAO,SAAS,CAAC,CAAC;IAEzE,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAClC,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,YACnC,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,oBAAoB,cAAE,QAAQ,GAAwB,CACxD,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACY,GACS,CAC3B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import type { ReactNode } from "react";
3
+ export interface ReplykeStoreProviderProps {
4
+ children: ReactNode;
5
+ }
6
+ /**
7
+ * Redux store provider for Replyke
8
+ * This component provides the Redux store to all child components
9
+ * Can be used standalone or wrapped around the existing ReplykeProvider
10
+ */
11
+ export declare const ReplykeStoreProvider: React.FC<ReplykeStoreProviderProps>;
12
+ export default ReplykeStoreProvider;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Provider } from "react-redux";
3
+ import { replykeStore } from "../store";
4
+ /**
5
+ * Redux store provider for Replyke
6
+ * This component provides the Redux store to all child components
7
+ * Can be used standalone or wrapped around the existing ReplykeProvider
8
+ */
9
+ export var ReplykeStoreProvider = function (_a) {
10
+ var children = _a.children;
11
+ return (_jsx(Provider, { store: replykeStore, children: children }));
12
+ };
13
+ // ReplykeProviderWithRedux has been deprecated
14
+ // Use ReplykeProvider with enableRedux={true} instead
15
+ export default ReplykeStoreProvider;
16
+ //# sourceMappingURL=replyke-store-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAOxC;;;;GAIG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAwC,UAAC,EAEzE;QADC,QAAQ,cAAA;IAER,OAAO,CACL,KAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC1B,QAAQ,GACA,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,+CAA+C;AAC/C,sDAAsD;AAEtD,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { default as useAppNotificationsRedux } from "./useAppNotificationsRedux";
2
+ export { default as useAppNotificationsDataRedux } from "./useAppNotificationsDataRedux";
3
+ export { default as useAppNotificationsActionsRedux } from "./useAppNotificationsActionsRedux";
4
+ export type { UseAppNotificationsDataProps, UseAppNotificationsDataValues, } from "../app-notifications/useAppNotificationsData";
@@ -0,0 +1,5 @@
1
+ // Export Redux-powered app notifications hooks
2
+ export { default as useAppNotificationsRedux } from "./useAppNotificationsRedux";
3
+ export { default as useAppNotificationsDataRedux } from "./useAppNotificationsDataRedux";
4
+ export { default as useAppNotificationsActionsRedux } from "./useAppNotificationsActionsRedux";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/app-notifications-redux/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hook that provides Redux-powered actions for app notifications
3
+ * Integrates RTK Query with Redux slice actions
4
+ */
5
+ export declare function useAppNotificationsActionsRedux(): {
6
+ loadMore: () => void;
7
+ markNotificationAsRead: (notificationId: string) => Promise<void>;
8
+ resetAppNotifications: () => Promise<void>;
9
+ fetchMoreNotifications: (pageToFetch: number) => Promise<void>;
10
+ updateUnreadCount: () => Promise<void>;
11
+ };
12
+ export default useAppNotificationsActionsRedux;
@@ -0,0 +1,202 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { useCallback } from "react";
38
+ import { useDispatch, useSelector } from "react-redux";
39
+ import { loadMore as loadMoreAction, resetNotifications, setLoading, addNotifications, markAsReadLocally, setUnreadCount, selectCurrentProjectId, selectAppNotificationsPage, selectAppNotificationsLimit, selectNotificationTemplates, } from "../../store/slices/appNotificationsSlice";
40
+ import { useLazyFetchAppNotificationsQuery, useMarkNotificationAsReadMutation, useLazyCountUnreadNotificationsQuery, } from "../../store/api/appNotificationsApi";
41
+ import { handleError } from "../../utils/handleError";
42
+ import addNotificationsMessages from "../../helpers/addNotificationsMessages";
43
+ import useProject from "../projects/useProject";
44
+ import useUser from "../users/useUser";
45
+ /**
46
+ * Hook that provides Redux-powered actions for app notifications
47
+ * Integrates RTK Query with Redux slice actions
48
+ */
49
+ export function useAppNotificationsActionsRedux() {
50
+ var _this = this;
51
+ var dispatch = useDispatch();
52
+ // Get current state for actions
53
+ var projectIdFromSlice = useSelector(function (state) { return selectCurrentProjectId(state); });
54
+ var page = useSelector(function (state) { return selectAppNotificationsPage(state); });
55
+ var limit = useSelector(function (state) { return selectAppNotificationsLimit(state); });
56
+ var notificationTemplates = useSelector(function (state) { return selectNotificationTemplates(state); });
57
+ // Get project and user context (fallback to current hooks)
58
+ var projectIdFromHook = useProject().projectId;
59
+ var user = useUser().user;
60
+ // Use project ID from slice if available, otherwise from hook
61
+ var projectId = projectIdFromSlice || projectIdFromHook;
62
+ // RTK Query hooks
63
+ var triggerFetchNotifications = useLazyFetchAppNotificationsQuery()[0];
64
+ var markNotificationAsReadMutation = useMarkNotificationAsReadMutation()[0];
65
+ var triggerCountUnread = useLazyCountUnreadNotificationsQuery()[0];
66
+ // Load more action
67
+ var loadMore = useCallback(function () {
68
+ dispatch(loadMoreAction());
69
+ }, [dispatch]);
70
+ // Mark notification as read action
71
+ var markNotificationAsRead = useCallback(function (notificationId) { return __awaiter(_this, void 0, void 0, function () {
72
+ var error_1;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ if (!projectId || !user) {
77
+ throw new Error("No project ID or authenticated user available");
78
+ }
79
+ _a.label = 1;
80
+ case 1:
81
+ _a.trys.push([1, 3, , 4]);
82
+ // Optimistic update
83
+ dispatch(markAsReadLocally(notificationId));
84
+ // Make API call
85
+ return [4 /*yield*/, markNotificationAsReadMutation({ projectId: projectId, notificationId: notificationId }).unwrap()];
86
+ case 2:
87
+ // Make API call
88
+ _a.sent();
89
+ return [3 /*break*/, 4];
90
+ case 3:
91
+ error_1 = _a.sent();
92
+ handleError(error_1, "Failed to mark notification as read:");
93
+ throw error_1;
94
+ case 4: return [2 /*return*/];
95
+ }
96
+ });
97
+ }); }, [dispatch, projectId, user, markNotificationAsReadMutation]);
98
+ // Reset notifications action
99
+ var resetAppNotifications = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
100
+ var result, completeNotifications, error_2;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0:
104
+ if (!projectId || !user) {
105
+ throw new Error("No project ID or authenticated user available");
106
+ }
107
+ _a.label = 1;
108
+ case 1:
109
+ _a.trys.push([1, 3, , 4]);
110
+ dispatch(setLoading(true));
111
+ dispatch(resetNotifications());
112
+ return [4 /*yield*/, triggerFetchNotifications({
113
+ projectId: projectId,
114
+ page: 1,
115
+ limit: limit,
116
+ }).unwrap()];
117
+ case 2:
118
+ result = _a.sent();
119
+ if (result) {
120
+ completeNotifications = addNotificationsMessages(result, notificationTemplates);
121
+ dispatch(addNotifications({ notifications: completeNotifications, isFirstPage: true }));
122
+ }
123
+ return [3 /*break*/, 4];
124
+ case 3:
125
+ error_2 = _a.sent();
126
+ handleError(error_2, "Failed to refresh notifications:");
127
+ throw error_2;
128
+ case 4: return [2 /*return*/];
129
+ }
130
+ });
131
+ }); }, [dispatch, projectId, user, triggerFetchNotifications, limit, notificationTemplates]);
132
+ // Fetch more notifications (internal action triggered by page changes)
133
+ var fetchMoreNotifications = useCallback(function (pageToFetch) { return __awaiter(_this, void 0, void 0, function () {
134
+ var result, completeNotifications, error_3;
135
+ return __generator(this, function (_a) {
136
+ switch (_a.label) {
137
+ case 0:
138
+ if (!projectId || !user)
139
+ return [2 /*return*/];
140
+ _a.label = 1;
141
+ case 1:
142
+ _a.trys.push([1, 3, 4, 5]);
143
+ dispatch(setLoading(true));
144
+ return [4 /*yield*/, triggerFetchNotifications({
145
+ projectId: projectId,
146
+ page: pageToFetch,
147
+ limit: limit,
148
+ }).unwrap()];
149
+ case 2:
150
+ result = _a.sent();
151
+ if (result) {
152
+ completeNotifications = addNotificationsMessages(result, notificationTemplates);
153
+ dispatch(addNotifications({ notifications: completeNotifications }));
154
+ }
155
+ return [3 /*break*/, 5];
156
+ case 3:
157
+ error_3 = _a.sent();
158
+ handleError(error_3, "Loading more app notifications failed:");
159
+ return [3 /*break*/, 5];
160
+ case 4:
161
+ dispatch(setLoading(false));
162
+ return [7 /*endfinally*/];
163
+ case 5: return [2 /*return*/];
164
+ }
165
+ });
166
+ }); }, [dispatch, projectId, user, triggerFetchNotifications, limit, notificationTemplates]);
167
+ // Update unread count
168
+ var updateUnreadCount = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
169
+ var count, error_4;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0:
173
+ if (!projectId || !user)
174
+ return [2 /*return*/];
175
+ _a.label = 1;
176
+ case 1:
177
+ _a.trys.push([1, 3, , 4]);
178
+ return [4 /*yield*/, triggerCountUnread({ projectId: projectId }).unwrap()];
179
+ case 2:
180
+ count = _a.sent();
181
+ if (typeof count === 'number') {
182
+ dispatch(setUnreadCount(count));
183
+ }
184
+ return [3 /*break*/, 4];
185
+ case 3:
186
+ error_4 = _a.sent();
187
+ handleError(error_4, "Failed to fetch unread count:");
188
+ return [3 /*break*/, 4];
189
+ case 4: return [2 /*return*/];
190
+ }
191
+ });
192
+ }); }, [dispatch, projectId, user, triggerCountUnread]);
193
+ return {
194
+ loadMore: loadMore,
195
+ markNotificationAsRead: markNotificationAsRead,
196
+ resetAppNotifications: resetAppNotifications,
197
+ fetchMoreNotifications: fetchMoreNotifications, // Internal action
198
+ updateUnreadCount: updateUnreadCount,
199
+ };
200
+ }
201
+ export default useAppNotificationsActionsRedux;
202
+ //# sourceMappingURL=useAppNotificationsActionsRedux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppNotificationsActionsRedux.js","sourceRoot":"","sources":["../../../../src/hooks/app-notifications-redux/useAppNotificationsActionsRedux.ts"],"names":[],"mappings":";;;;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AAW,CAAC,OAAK,EAAE,wCAAwC,CAAC,CAAC;;;oBAE7D,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;;;;;SAE/B,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,yBAAyB,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEzF,sBAAsB;IACtB,IAAM,iBAAiB,GAAG,WAAW,CAAC;;;;;oBACpC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI;wBAAE,sBAAO;;;;oBAGhB,qBAAM,kBAAkB,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC,MAAM,EAAE,EAAA;;oBAAxD,KAAK,GAAG,SAAgD;oBAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;oBAClC,CAAC;;;;oBAED,WAAW,CAAC,OAAK,EAAE,+BAA+B,CAAC,CAAC;;;;;SAEvD,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEpD,OAAO;QACL,QAAQ,UAAA;QACR,sBAAsB,wBAAA;QACtB,qBAAqB,uBAAA;QACrB,sBAAsB,wBAAA,EAAE,kBAAkB;QAC1C,iBAAiB,mBAAA;KAClB,CAAC;AACJ,CAAC;AAED,eAAe,+BAA+B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { UseAppNotificationsDataProps, UseAppNotificationsDataValues } from "../app-notifications/useAppNotificationsData";
2
+ /**
3
+ * Redux-powered hook that provides the exact same interface as useAppNotificationsData()
4
+ * This is a drop-in replacement for the Context-based hook
5
+ */
6
+ declare function useAppNotificationsDataRedux({ limit, notificationTemplates, }?: UseAppNotificationsDataProps): UseAppNotificationsDataValues;
7
+ export default useAppNotificationsDataRedux;
@@ -0,0 +1,78 @@
1
+ import { useEffect, useMemo } from "react";
2
+ import { useDispatch, useSelector } from "react-redux";
3
+ import { setProjectContext, setLimit, setNotificationTemplates, selectAppNotifications, selectUnreadCount, selectAppNotificationsLoading, selectAppNotificationsHasMore, selectAppNotificationsPage, selectCurrentProjectId, } from "../../store/slices/appNotificationsSlice";
4
+ import { useAppNotificationsActionsRedux } from "./useAppNotificationsActionsRedux";
5
+ import useProject from "../projects/useProject";
6
+ import useUser from "../users/useUser";
7
+ /**
8
+ * Redux-powered hook that provides the exact same interface as useAppNotificationsData()
9
+ * This is a drop-in replacement for the Context-based hook
10
+ */
11
+ function useAppNotificationsDataRedux(_a) {
12
+ var _b = _a === void 0 ? {} : _a, _c = _b.limit, limit = _c === void 0 ? 10 : _c, notificationTemplates = _b.notificationTemplates;
13
+ var dispatch = useDispatch();
14
+ // Get external context
15
+ var projectId = useProject().projectId;
16
+ var user = useUser().user;
17
+ // Get Redux state
18
+ var appNotifications = useSelector(function (state) { return selectAppNotifications(state); });
19
+ var unreadAppNotificationsCount = useSelector(function (state) { return selectUnreadCount(state); });
20
+ var loading = useSelector(function (state) { return selectAppNotificationsLoading(state); });
21
+ var hasMore = useSelector(function (state) { return selectAppNotificationsHasMore(state); });
22
+ var currentPage = useSelector(function (state) { return selectAppNotificationsPage(state); });
23
+ var currentProjectId = useSelector(function (state) { return selectCurrentProjectId(state); });
24
+ // Get actions
25
+ var _d = useAppNotificationsActionsRedux(), loadMore = _d.loadMore, markNotificationAsRead = _d.markNotificationAsRead, resetAppNotifications = _d.resetAppNotifications, fetchMoreNotifications = _d.fetchMoreNotifications, updateUnreadCount = _d.updateUnreadCount;
26
+ // Update Redux state when props change
27
+ useEffect(function () {
28
+ if (projectId && projectId !== currentProjectId) {
29
+ dispatch(setProjectContext(projectId));
30
+ }
31
+ }, [dispatch, projectId, currentProjectId]);
32
+ useEffect(function () {
33
+ dispatch(setLimit(limit));
34
+ }, [dispatch, limit]);
35
+ useEffect(function () {
36
+ if (notificationTemplates) {
37
+ dispatch(setNotificationTemplates(notificationTemplates));
38
+ }
39
+ }, [dispatch, notificationTemplates]);
40
+ // Fetch unread count on mount and when dependencies change
41
+ useEffect(function () {
42
+ if (projectId && user) {
43
+ updateUnreadCount();
44
+ }
45
+ }, [updateUnreadCount, projectId, user]);
46
+ // Reset and fetch initial notifications when dependencies change
47
+ useEffect(function () {
48
+ if (projectId && user) {
49
+ resetAppNotifications();
50
+ }
51
+ }, [resetAppNotifications, projectId, user]);
52
+ // Handle page changes (load more notifications)
53
+ useEffect(function () {
54
+ if (currentPage > 1 && projectId && user) {
55
+ fetchMoreNotifications(currentPage);
56
+ }
57
+ }, [currentPage, fetchMoreNotifications, projectId, user]);
58
+ // Return the same interface as the original hook
59
+ return useMemo(function () { return ({
60
+ appNotifications: appNotifications,
61
+ unreadAppNotificationsCount: unreadAppNotificationsCount,
62
+ loading: loading,
63
+ hasMore: hasMore,
64
+ loadMore: loadMore,
65
+ markNotificationAsRead: markNotificationAsRead,
66
+ resetAppNotifications: resetAppNotifications,
67
+ }); }, [
68
+ appNotifications,
69
+ unreadAppNotificationsCount,
70
+ loading,
71
+ hasMore,
72
+ loadMore,
73
+ markNotificationAsRead,
74
+ resetAppNotifications,
75
+ ]);
76
+ }
77
+ export default useAppNotificationsDataRedux;
78
+ //# sourceMappingURL=useAppNotificationsDataRedux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppNotificationsDataRedux.js","sourceRoot":"","sources":["../../../../src/hooks/app-notifications-redux/useAppNotificationsDataRedux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,+B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OAAO,CAAC,cAAM,OAAA,CAAC;QACpB,gBAAgB,kBAAA;QAChB,2BAA2B,6BAAA;QAC3B,OAAO,SAAA;QACP,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,sBAAsB,wBAAA;QACtB,qBAAqB,uBAAA;KACtB,CAAC,EARmB,CAQnB,EAAE;QACF,gBAAgB;QAChB,2BAA2B;QAC3B,OAAO;QACP,OAAO;QACP,QAAQ;QACR,sBAAsB;QACtB,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC;AAED,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { UseAppNotificationsDataValues } from "../app-notifications/useAppNotificationsData";
2
+ /**
3
+ * Redux-powered hook that provides the same interface as useAppNotifications()
4
+ * Returns the current app notifications state and actions
5
+ */
6
+ export declare function useAppNotificationsRedux(): Partial<UseAppNotificationsDataValues>;
7
+ export default useAppNotificationsRedux;
@@ -0,0 +1,27 @@
1
+ import { useSelector } from "react-redux";
2
+ import { selectAppNotifications, selectUnreadCount, selectAppNotificationsLoading, selectAppNotificationsHasMore, } from "../../store/slices/appNotificationsSlice";
3
+ import { useAppNotificationsActionsRedux } from "./useAppNotificationsActionsRedux";
4
+ /**
5
+ * Redux-powered hook that provides the same interface as useAppNotifications()
6
+ * Returns the current app notifications state and actions
7
+ */
8
+ export function useAppNotificationsRedux() {
9
+ // Select data from Redux store
10
+ var appNotifications = useSelector(function (state) { return selectAppNotifications(state); });
11
+ var unreadAppNotificationsCount = useSelector(function (state) { return selectUnreadCount(state); });
12
+ var loading = useSelector(function (state) { return selectAppNotificationsLoading(state); });
13
+ var hasMore = useSelector(function (state) { return selectAppNotificationsHasMore(state); });
14
+ // Get actions
15
+ var _a = useAppNotificationsActionsRedux(), loadMore = _a.loadMore, markNotificationAsRead = _a.markNotificationAsRead, resetAppNotifications = _a.resetAppNotifications;
16
+ return {
17
+ appNotifications: appNotifications,
18
+ unreadAppNotificationsCount: unreadAppNotificationsCount,
19
+ loading: loading,
20
+ hasMore: hasMore,
21
+ loadMore: loadMore,
22
+ markNotificationAsRead: markNotificationAsRead,
23
+ resetAppNotifications: resetAppNotifications,
24
+ };
25
+ }
26
+ export default useAppNotificationsRedux;
27
+ //# sourceMappingURL=useAppNotificationsRedux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppNotificationsRedux.js","sourceRoot":"","sources":["../../../../src/hooks/app-notifications-redux/useAppNotificationsRedux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACtC,+BAA+B;IAC/B,IAAM,gBAAgB,GAAG,WAAW,CAAC,UAAC,KAAgB,IAAK,OAAA,sBAAsB,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,CAAC;IAC1F,IAAM,2BAA2B,GAAG,WAAW,CAAC,UAAC,KAAgB,IAAK,OAAA,iBAAiB,CAAC,KAAK,CAAC,EAAxB,CAAwB,CAAC,CAAC;IAChG,IAAM,OAAO,GAAG,WAAW,CAAC,UAAC,KAAgB,IAAK,OAAA,6BAA6B,CAAC,KAAK,CAAC,EAApC,CAAoC,CAAC,CAAC;IACxF,IAAM,OAAO,GAAG,WAAW,CAAC,UAAC,KAAgB,IAAK,OAAA,6BAA6B,CAAC,KAAK,CAAC,EAApC,CAAoC,CAAC,CAAC;IAExF,cAAc;IACR,IAAA,KAA8D,+BAA+B,EAAE,EAA7F,QAAQ,cAAA,EAAE,sBAAsB,4BAAA,EAAE,qBAAqB,2BAAsC,CAAC;IAEtG,OAAO;QACL,gBAAgB,kBAAA;QAChB,2BAA2B,6BAAA;QAC3B,OAAO,SAAA;QACP,OAAO,SAAA;QACP,QAAQ,UAAA;QACR,sBAAsB,wBAAA;QACtB,qBAAqB,uBAAA;KACtB,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -4,11 +4,14 @@ export { getUserName } from "./helpers/getUserName";
4
4
  export { default as getPublicFileUrl } from "./helpers/getPublicFileUrl";
5
5
  export { reportReasons } from "./constants/reportReasons";
6
6
  export type { ReportReasonKey } from "./constants/reportReasons";
7
- export { ReplykeProvider, EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
7
+ export { ReplykeProvider, // Now includes optional Redux support via enableRedux prop
8
+ EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
9
+ export { ReplykeStoreProvider, } from "./context";
8
10
  export { useProject, useProjectData } from "./hooks/projects";
9
11
  export { useSignTestingJwt } from "./hooks/crypto";
10
12
  export { useAuth, useAuthData, useRequestNewAccessToken, useSignUpWithEmailAndPassword, useSignInWithEmailAndPassword, useSignOut, useChangePassword, useVerifyExternalUser, } from "./hooks/auth";
11
13
  export { useAppNotifications, useAppNotificationsData, useCountUnreadNotifications, useFetchAppNotifications, useMarkNotificationAsRead, } from "./hooks/app-notifications";
14
+ export { useAppNotificationsRedux, useAppNotificationsDataRedux, type UseAppNotificationsDataProps, type UseAppNotificationsDataValues, } from "./hooks/app-notifications-redux";
12
15
  export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
13
16
  export { useCommentSection, useCommentSectionData, useCreateComment, useFetchManyComments, useFetchComment, useFetchCommentByForeignId, useReplies, useUpdateComment, useCommentVotes, useDeleteComment, useEntityComments, useProfileComments, } from "./hooks/comments";
14
17
  export { useLists, useListsData, useCreateList, useFetchRootList, useFetchSubLists, useIsEntitySaved, useUpdateList, useAddToList, useRemoveFromList, useDeleteList, } from "./hooks/lists";
package/dist/esm/index.js CHANGED
@@ -6,7 +6,11 @@ export { default as getPublicFileUrl } from "./helpers/getPublicFileUrl";
6
6
  // Constants
7
7
  export { reportReasons } from "./constants/reportReasons";
8
8
  // Context providers
9
- export { ReplykeProvider, EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
9
+ export { ReplykeProvider, // Now includes optional Redux support via enableRedux prop
10
+ EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
11
+ // Advanced Redux providers (for advanced use cases)
12
+ export { ReplykeStoreProvider, // Standalone Redux provider
13
+ } from "./context";
10
14
  // -- projects
11
15
  export { useProject, useProjectData } from "./hooks/projects";
12
16
  // -- crypto
@@ -15,6 +19,8 @@ export { useSignTestingJwt } from "./hooks/crypto";
15
19
  export { useAuth, useAuthData, useRequestNewAccessToken, useSignUpWithEmailAndPassword, useSignInWithEmailAndPassword, useSignOut, useChangePassword, useVerifyExternalUser, } from "./hooks/auth";
16
20
  // -- app notifications
17
21
  export { useAppNotifications, useAppNotificationsData, useCountUnreadNotifications, useFetchAppNotifications, useMarkNotificationAsRead, } from "./hooks/app-notifications";
22
+ // -- app notifications (Redux-powered)
23
+ export { useAppNotificationsRedux, useAppNotificationsDataRedux, } from "./hooks/app-notifications-redux";
18
24
  // -- entities
19
25
  export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
20
26
  // -- comments
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,O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