@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,169 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ 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);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
+ if (ar || !(i in from)) {
52
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
+ ar[i] = from[i];
54
+ }
55
+ }
56
+ return to.concat(ar || Array.prototype.slice.call(from));
57
+ };
58
+ var _a;
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.countUnreadNotifications = exports.markNotificationAsRead = exports.fetchAppNotifications = exports.useLazyCountUnreadNotificationsQuery = exports.useCountUnreadNotificationsQuery = exports.useMarkNotificationAsReadMutation = exports.useLazyFetchAppNotificationsQuery = exports.useFetchAppNotificationsQuery = exports.appNotificationsApi = void 0;
61
+ var baseApi_1 = require("./baseApi");
62
+ // Extended API with app notifications endpoints
63
+ exports.appNotificationsApi = baseApi_1.baseApi.injectEndpoints({
64
+ endpoints: function (builder) { return ({
65
+ // Fetch paginated app notifications
66
+ fetchAppNotifications: builder.query({
67
+ query: function (_a) {
68
+ var projectId = _a.projectId, page = _a.page, limit = _a.limit;
69
+ return ({
70
+ url: "/".concat(projectId, "/app-notifications"),
71
+ method: 'GET',
72
+ params: {
73
+ page: page,
74
+ limit: limit,
75
+ },
76
+ });
77
+ },
78
+ providesTags: function (result, error, _a) {
79
+ var _b;
80
+ var projectId = _a.projectId;
81
+ return __spreadArray([
82
+ { type: 'AppNotification', id: "".concat(projectId, "-LIST") }
83
+ ], ((_b = result === null || result === void 0 ? void 0 : result.map(function (_a) {
84
+ var id = _a.id;
85
+ return ({ type: 'AppNotification', id: id });
86
+ })) !== null && _b !== void 0 ? _b : []), true);
87
+ },
88
+ // Transform response to ensure dates are properly parsed
89
+ transformResponse: function (response) {
90
+ return response.map(function (notification) { return (__assign(__assign({}, notification), { createdAt: new Date(notification.createdAt) })); });
91
+ },
92
+ }),
93
+ // Mark a notification as read
94
+ markNotificationAsRead: builder.mutation({
95
+ query: function (_a) {
96
+ var projectId = _a.projectId, notificationId = _a.notificationId;
97
+ return ({
98
+ url: "/".concat(projectId, "/app-notifications/").concat(notificationId, "/mark-as-read"),
99
+ method: 'PATCH',
100
+ body: {},
101
+ });
102
+ },
103
+ // Optimistically update the cache
104
+ onQueryStarted: function (_a, _b) {
105
+ return __awaiter(this, arguments, void 0, function (_c, _d) {
106
+ var patches, _e;
107
+ var projectId = _c.projectId, notificationId = _c.notificationId;
108
+ var dispatch = _d.dispatch, queryFulfilled = _d.queryFulfilled;
109
+ return __generator(this, function (_f) {
110
+ switch (_f.label) {
111
+ case 0:
112
+ patches = [];
113
+ dispatch(exports.appNotificationsApi.util.updateQueryData('fetchAppNotifications',
114
+ // We need to find all queries for this projectId - this is a simplified approach
115
+ { projectId: projectId, page: 1, limit: 10 }, // This should be more dynamic in practice
116
+ function (draft) {
117
+ var notification = draft.find(function (n) { return n.id === notificationId; });
118
+ if (notification) {
119
+ notification.isRead = true;
120
+ }
121
+ }));
122
+ _f.label = 1;
123
+ case 1:
124
+ _f.trys.push([1, 3, , 4]);
125
+ return [4 /*yield*/, queryFulfilled];
126
+ case 2:
127
+ _f.sent();
128
+ return [3 /*break*/, 4];
129
+ case 3:
130
+ _e = _f.sent();
131
+ // Revert optimistic update on failure
132
+ patches.forEach(function (patch) { return patch.undo(); });
133
+ return [3 /*break*/, 4];
134
+ case 4: return [2 /*return*/];
135
+ }
136
+ });
137
+ });
138
+ },
139
+ invalidatesTags: function (result, error, _a) {
140
+ var projectId = _a.projectId, notificationId = _a.notificationId;
141
+ return [
142
+ { type: 'AppNotification', id: notificationId },
143
+ { type: 'AppNotification', id: "".concat(projectId, "-LIST") },
144
+ ];
145
+ },
146
+ }),
147
+ // Count unread notifications
148
+ countUnreadNotifications: builder.query({
149
+ query: function (_a) {
150
+ var projectId = _a.projectId;
151
+ return ({
152
+ url: "/".concat(projectId, "/app-notifications/count"),
153
+ method: 'GET',
154
+ });
155
+ },
156
+ providesTags: function (result, error, _a) {
157
+ var projectId = _a.projectId;
158
+ return [
159
+ { type: 'AppNotification', id: "".concat(projectId, "-COUNT") },
160
+ ];
161
+ },
162
+ }),
163
+ }); },
164
+ });
165
+ // Export hooks for use in components
166
+ exports.useFetchAppNotificationsQuery = exports.appNotificationsApi.useFetchAppNotificationsQuery, exports.useLazyFetchAppNotificationsQuery = exports.appNotificationsApi.useLazyFetchAppNotificationsQuery, exports.useMarkNotificationAsReadMutation = exports.appNotificationsApi.useMarkNotificationAsReadMutation, exports.useCountUnreadNotificationsQuery = exports.appNotificationsApi.useCountUnreadNotificationsQuery, exports.useLazyCountUnreadNotificationsQuery = exports.appNotificationsApi.useLazyCountUnreadNotificationsQuery;
167
+ // Export for manual cache management
168
+ exports.fetchAppNotifications = (_a = exports.appNotificationsApi.endpoints, _a.fetchAppNotifications), exports.markNotificationAsRead = _a.markNotificationAsRead, exports.countUnreadNotifications = _a.countUnreadNotifications;
169
+ //# sourceMappingURL=appNotificationsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appNotificationsApi.js","sourceRoot":"","sources":["../../../../src/store/api/appNotificationsApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAmBpC,gDAAgD;AACnC,QAAA,mBAAmB,GAAG,iBAAO,CAAC,eAAe,CAAC;IACzD,SAAS,EAAE,UAAC,OAAO,IAAK,OAAA,CAAC;QACvB,oCAAoC;QACpC,qBAAqB,EAAE,OAAO,CAAC,KAAK,CAAwD;YAC1F,KAAK,EAAE,UAAC,EAA0B;oBAAxB,SAAS,eAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA;gBAAO,OAAA,CAAC;oBACtC,GAAG,EAAE,WAAI,SAAS,uBAAoB;oBACtC,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE;wBACN,IAAI,MAAA;wBACJ,KAAK,OAAA;qBACN;iBACF,CAAC;YAPqC,CAOrC;YACF,YAAY,EAAE,UAAC,MAAM,EAAE,KAAK,EAAE,EAAa;;oBAAX,SAAS,eAAA;gBAAO;oBAC9C,EAAE,IAAI,EAAE,iBAA0B,EAAE,EAAE,EAAE,UAAG,SAAS,UAAO,EAAE;mBAC1D,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,UAAC,EAAM;wBAAJ,EAAE,QAAA;oBAAO,OAAA,CAAC,EAAE,IAAI,EAAE,iBAA0B,EAAE,EAAE,IAAA,EAAE,CAAC;gBAA1C,CAA0C,CAAC,mCAAI,EAAE,CAAC,QAC/E;aAAA;YACD,yDAAyD;YACzD,iBAAiB,EAAE,UAAC,QAAkC;gBACpD,OAAO,QAAQ,CAAC,GAAG,CAAC,UAAA,YAAY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D,eAAe,EAAE,UAAC,MAAM,EAAE,KAAK,EAAE,EAA6B;oBAA3B,SAAS,eAAA,EAAE,cAAc,oBAAA;gBAAO,OAAA;oBACjE,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,cAAc,EAAE;oBAC/C,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAG,SAAS,UAAO,EAAE;iBACrD;YAHkE,CAGlE;SACF,CAAC;QAEF,6BAA6B;QAC7B,wBAAwB,EAAE,OAAO,CAAC,KAAK,CAAyC;YAC9E,KAAK,EAAE,UAAC,EAAa;oBAAX,SAAS,eAAA;gBAAO,OAAA,CAAC;oBACzB,GAAG,EAAE,WAAI,SAAS,6BAA0B;oBAC5C,MAAM,EAAE,KAAK;iBACd,CAAC;YAHwB,CAGxB;YACF,YAAY,EAAE,UAAC,MAAM,EAAE,KAAK,EAAE,EAAa;oBAAX,SAAS,eAAA;gBAAO,OAAA;oBAC9C,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAG,SAAS,WAAQ,EAAE;iBACtD;YAF+C,CAE/C;SACF,CAAC;KACH,CAAC,EAzEsB,CAyEtB;CACH,CAAC,CAAC;AAEH,qCAAqC;AAEnC,QAAA,6BAA6B,GAK3B,2BAAmB,gCAJrB,QAAA,iCAAiC,GAI/B,2BAAmB,oCAHrB,QAAA,iCAAiC,GAG/B,2BAAmB,oCAFrB,QAAA,gCAAgC,GAE9B,2BAAmB,mCADrB,QAAA,oCAAoC,GAClC,2BAAmB,sCAAC;AAExB,qCAAqC;AAEnC,QAAA,qBAAqB,IADV,KAIT,2BAAmB,CAAC,SAAS,6BAF/B,QAAA,sBAAsB,8BACtB,QAAA,wBAAwB,+BACQ"}
@@ -0,0 +1 @@
1
+ export declare const baseApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, {}, "api", "AppNotification", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/dist/query/react").reactHooksModuleName>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.baseApi = void 0;
5
+ var react_1 = require("@reduxjs/toolkit/query/react");
6
+ // Base query that uses the current project context and auth
7
+ var createBaseQuery = function () {
8
+ return (0, react_1.fetchBaseQuery)({
9
+ baseUrl: process.env.REACT_APP_API_BASE_URL || 'https://api.replyke.com',
10
+ credentials: 'include', // Equivalent to withCredentials: true
11
+ prepareHeaders: function (headers) {
12
+ // Headers are prepared but don't need auth tokens since we use credentials: 'include'
13
+ // This matches the existing pattern in the Context-based hooks
14
+ return headers;
15
+ },
16
+ });
17
+ };
18
+ // Create the base API slice
19
+ exports.baseApi = (0, react_1.createApi)({
20
+ reducerPath: 'api',
21
+ baseQuery: createBaseQuery(),
22
+ tagTypes: [
23
+ 'AppNotification',
24
+ // Future tag types:
25
+ // 'Entity',
26
+ // 'Comment',
27
+ // 'List',
28
+ // 'User',
29
+ ],
30
+ endpoints: function () { return ({}); }, // Endpoints will be injected by feature APIs
31
+ });
32
+ // Export hooks for use in components (will be populated by injected endpoints)
33
+ exports._b = _a = exports.baseApi;
34
+ //# sourceMappingURL=baseApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../../src/store/api/baseApi.ts"],"names":[],"mappings":";;;;AAAA,sDAAyE;AAEzE,4DAA4D;AAC5D,IAAM,eAAe,GAAG;IACtB,OAAO,IAAA,sBAAc,EAAC;QACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,yBAAyB;QACxE,WAAW,EAAE,SAAS,EAAE,sCAAsC;QAC9D,cAAc,EAAE,UAAC,OAAO;YACtB,sFAAsF;YACtF,+DAA+D;YAC/D,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4BAA4B;AACf,QAAA,OAAO,GAAG,IAAA,iBAAS,EAAC;IAC/B,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,eAAe,EAAE;IAC5B,QAAQ,EAAE;QACR,iBAAiB;QACjB,oBAAoB;QACpB,YAAY;QACZ,cAAc;QACd,UAAU;QACV,UAAU;KACX;IACD,SAAS,EAAE,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,EAAE,6CAA6C;CACrE,CAAC,CAAC;AAEH,+EAA+E;AAC/E,aAAa,KAAK,eAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { baseApi } from "./baseApi";
2
+ export * from "./appNotificationsApi";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.baseApi = void 0;
18
+ // Export the base API
19
+ var baseApi_1 = require("./baseApi");
20
+ Object.defineProperty(exports, "baseApi", { enumerable: true, get: function () { return baseApi_1.baseApi; } });
21
+ // Export app notifications API
22
+ __exportStar(require("./appNotificationsApi"), exports);
23
+ // Future API exports will go here:
24
+ // export * from "./entitiesApi";
25
+ // export * from "./listsApi";
26
+ // export * from "./commentsApi";
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/store/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sBAAsB;AACtB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,+BAA+B;AAC/B,wDAAsC;AAEtC,mCAAmC;AACnC,iCAAiC;AACjC,+BAA+B;AAC/B,iCAAiC"}
@@ -0,0 +1,13 @@
1
+ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
2
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api">;
3
+ appNotifications: import("./slices").AppNotificationsState;
4
+ }, import("@reduxjs/toolkit").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
5
+ dispatch: import("@reduxjs/toolkit").ThunkDispatch<{
6
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api">;
7
+ appNotifications: import("./slices").AppNotificationsState;
8
+ }, undefined, import("@reduxjs/toolkit").UnknownAction>;
9
+ }>, import("@reduxjs/toolkit").StoreEnhancer]>>;
10
+ export type { RootState, AppDispatch, AppStore, AppThunk } from "./types";
11
+ export { store as replykeStore };
12
+ export { rootReducer } from "./rootReducer";
13
+ export * from "./types";
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.rootReducer = exports.replykeStore = exports.store = void 0;
18
+ var toolkit_1 = require("@reduxjs/toolkit");
19
+ var rootReducer_1 = require("./rootReducer");
20
+ var middleware_1 = require("./middleware");
21
+ var baseApi_1 = require("./api/baseApi");
22
+ // Configure the Redux store
23
+ exports.store = (0, toolkit_1.configureStore)({
24
+ reducer: rootReducer_1.rootReducer,
25
+ middleware: function (getDefaultMiddleware) {
26
+ return getDefaultMiddleware({
27
+ serializableCheck: {
28
+ // Ignore these action types for serializable check
29
+ ignoredActions: ['persist/PERSIST', 'persist/REHYDRATE'],
30
+ // Ignore these field paths in all actions
31
+ ignoredActionsPaths: ['meta.arg', 'payload.timestamp'],
32
+ // Ignore these paths in the state
33
+ ignoredPaths: ['items.dates'],
34
+ },
35
+ })
36
+ // Add RTK Query middleware
37
+ .concat(baseApi_1.baseApi.middleware)
38
+ // Add custom middleware
39
+ .concat(middleware_1.customMiddleware);
40
+ },
41
+ // Enable Redux DevTools in development
42
+ devTools: process.env.NODE_ENV !== 'production',
43
+ });
44
+ exports.replykeStore = exports.store;
45
+ // Export for advanced users who need direct access
46
+ var rootReducer_2 = require("./rootReducer");
47
+ Object.defineProperty(exports, "rootReducer", { enumerable: true, get: function () { return rootReducer_2.rootReducer; } });
48
+ __exportStar(require("./types"), exports);
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAAkD;AAClD,6CAA4C;AAC5C,2CAAgD;AAChD,yCAAwC;AAExC,4BAA4B;AACf,QAAA,KAAK,GAAG,IAAA,wBAAc,EAAC;IAClC,OAAO,EAAE,yBAAW;IACpB,UAAU,EAAE,UAAC,oBAAoB;QAC/B,OAAA,oBAAoB,CAAC;YACnB,iBAAiB,EAAE;gBACjB,mDAAmD;gBACnD,cAAc,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;gBACxD,0CAA0C;gBAC1C,mBAAmB,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC;gBACtD,kCAAkC;gBAClC,YAAY,EAAE,CAAC,aAAa,CAAC;aAC9B;SACF,CAAC;YACA,2BAA2B;aAC1B,MAAM,CAAC,iBAAO,CAAC,UAAU,CAAC;YAC3B,wBAAwB;aACvB,MAAM,CAAC,6BAAgB,CAAC;IAb3B,CAa2B;IAE7B,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;CAChD,CAAC,CAAC;AAMe,uBA1BL,aAAK,CA0BY;AAE9B,mDAAmD;AACnD,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,0CAAwB"}
@@ -0,0 +1,4 @@
1
+ import { Middleware } from "@reduxjs/toolkit";
2
+ export declare const errorMiddleware: Middleware;
3
+ export declare const loggerMiddleware: Middleware;
4
+ export declare const customMiddleware: Middleware<{}, any, import("@reduxjs/toolkit").Dispatch<import("@reduxjs/toolkit").UnknownAction>>[];
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.customMiddleware = exports.loggerMiddleware = exports.errorMiddleware = void 0;
13
+ var handleError_1 = require("../utils/handleError");
14
+ // Error handling middleware for Redux actions
15
+ var errorMiddleware = function (store) { return function (next) { return function (action) {
16
+ try {
17
+ return next(action);
18
+ }
19
+ catch (error) {
20
+ (0, handleError_1.handleError)(error, "Redux action failed: ".concat(action.type));
21
+ throw error;
22
+ }
23
+ }; }; };
24
+ exports.errorMiddleware = errorMiddleware;
25
+ // Logger middleware for development
26
+ var loggerMiddleware = function (store) { return function (next) { return function (action) {
27
+ if (process.env.NODE_ENV === 'development') {
28
+ console.group("\uD83D\uDD04 Redux Action: ".concat(action.type));
29
+ console.log('Previous State:', store.getState());
30
+ console.log('Action:', action);
31
+ }
32
+ var result = next(action);
33
+ if (process.env.NODE_ENV === 'development') {
34
+ console.log('Next State:', store.getState());
35
+ console.groupEnd();
36
+ }
37
+ return result;
38
+ }; }; };
39
+ exports.loggerMiddleware = loggerMiddleware;
40
+ // Combine all custom middleware
41
+ exports.customMiddleware = __spreadArray([
42
+ exports.errorMiddleware
43
+ ], (process.env.NODE_ENV === 'development' ? [exports.loggerMiddleware] : []), true);
44
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/store/middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAAmD;AAEnD,8CAA8C;AACvC,IAAM,eAAe,GAAe,UAAC,KAAK,IAAK,OAAA,UAAC,IAAI,IAAK,OAAA,UAAC,MAAW;IAC1E,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,yBAAW,EAAC,KAAK,EAAE,+BAAwB,MAAM,CAAC,IAAI,CAAE,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,EAP+D,CAO/D,EAPqD,CAOrD,CAAC;AAPW,QAAA,eAAe,mBAO1B;AAEF,oCAAoC;AAC7B,IAAM,gBAAgB,GAAe,UAAC,KAAK,IAAK,OAAA,UAAC,IAAI,IAAK,OAAA,UAAC,MAAW;IAC3E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,qCAAoB,MAAM,CAAC,IAAI,CAAE,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAE5B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,EAfgE,CAehE,EAfsD,CAetD,CAAC;AAfW,QAAA,gBAAgB,oBAe3B;AAEF,gCAAgC;AACnB,QAAA,gBAAgB;IAC3B,uBAAe;GACZ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,wBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QACrE"}
@@ -0,0 +1,8 @@
1
+ export declare const rootReducer: import("@reduxjs/toolkit").Reducer<{
2
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api">;
3
+ appNotifications: import("./slices/appNotificationsSlice").AppNotificationsState;
4
+ }, import("@reduxjs/toolkit").UnknownAction, Partial<{
5
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api"> | undefined;
6
+ appNotifications: import("./slices/appNotificationsSlice").AppNotificationsState | undefined;
7
+ }>>;
8
+ export type RootState = ReturnType<typeof rootReducer>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.rootReducer = void 0;
5
+ var toolkit_1 = require("@reduxjs/toolkit");
6
+ var baseApi_1 = require("./api/baseApi");
7
+ var appNotificationsSlice_1 = require("./slices/appNotificationsSlice");
8
+ // Combine all reducers
9
+ exports.rootReducer = (0, toolkit_1.combineReducers)((_a = {},
10
+ // API slice reducer (manages RTK Query cache)
11
+ _a[baseApi_1.baseApi.reducerPath] = baseApi_1.baseApi.reducer,
12
+ // Feature slices
13
+ _a.appNotifications = appNotificationsSlice_1.appNotificationsSlice.reducer,
14
+ _a));
15
+ //# sourceMappingURL=rootReducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootReducer.js","sourceRoot":"","sources":["../../../src/store/rootReducer.ts"],"names":[],"mappings":";;;;AAAA,4CAAmD;AACnD,yCAAwC;AACxC,wEAAuE;AAEvE,uBAAuB;AACV,QAAA,WAAW,GAAG,IAAA,yBAAe;IACxC,8CAA8C;IAC9C,GAAC,iBAAO,CAAC,WAAW,IAAG,iBAAO,CAAC,OAAO;IAEtC,iBAAiB;IACjB,mBAAgB,GAAE,6CAAqB,CAAC,OAAO;QAM/C,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { PayloadAction } from "@reduxjs/toolkit";
2
+ import type { UnifiedAppNotification, NotificationTemplates } from "../../interfaces/models/AppNotification";
3
+ export interface AppNotificationsState {
4
+ notifications: UnifiedAppNotification[];
5
+ unreadCount: number;
6
+ loading: boolean;
7
+ hasMore: boolean;
8
+ page: number;
9
+ limit: number;
10
+ notificationTemplates?: Partial<NotificationTemplates>;
11
+ currentProjectId?: string;
12
+ }
13
+ export declare const appNotificationsSlice: import("@reduxjs/toolkit").Slice<AppNotificationsState, {
14
+ setProjectContext: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<string>) => void;
15
+ setLimit: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<number>) => void;
16
+ setNotificationTemplates: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<Partial<NotificationTemplates>>) => void;
17
+ resetNotifications: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>) => void;
18
+ loadMore: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>) => void;
19
+ setLoading: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<boolean>) => void;
20
+ addNotifications: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<{
21
+ notifications: UnifiedAppNotification[];
22
+ isFirstPage?: boolean;
23
+ }>) => void;
24
+ markAsReadLocally: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<string>) => void;
25
+ setUnreadCount: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>, action: PayloadAction<number>) => void;
26
+ handleError: (state: import("@reduxjs/toolkit").WritableDraft<AppNotificationsState>) => void;
27
+ }, "appNotifications", "appNotifications", import("@reduxjs/toolkit").SliceSelectors<AppNotificationsState>>;
28
+ export declare const setProjectContext: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "appNotifications/setProjectContext">, setLimit: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "appNotifications/setLimit">, setNotificationTemplates: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<NotificationTemplates>, "appNotifications/setNotificationTemplates">, resetNotifications: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"appNotifications/resetNotifications">, loadMore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"appNotifications/loadMore">, setLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "appNotifications/setLoading">, addNotifications: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
29
+ notifications: UnifiedAppNotification[];
30
+ isFirstPage?: boolean;
31
+ }, "appNotifications/addNotifications">, markAsReadLocally: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "appNotifications/markAsReadLocally">, setUnreadCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "appNotifications/setUnreadCount">, handleError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"appNotifications/handleError">;
32
+ declare const _default: import("@reduxjs/toolkit").Reducer<AppNotificationsState>;
33
+ export default _default;
34
+ export declare const selectAppNotifications: (state: {
35
+ appNotifications: AppNotificationsState;
36
+ }) => UnifiedAppNotification[];
37
+ export declare const selectUnreadCount: (state: {
38
+ appNotifications: AppNotificationsState;
39
+ }) => number;
40
+ export declare const selectAppNotificationsLoading: (state: {
41
+ appNotifications: AppNotificationsState;
42
+ }) => boolean;
43
+ export declare const selectAppNotificationsHasMore: (state: {
44
+ appNotifications: AppNotificationsState;
45
+ }) => boolean;
46
+ export declare const selectAppNotificationsPage: (state: {
47
+ appNotifications: AppNotificationsState;
48
+ }) => number;
49
+ export declare const selectAppNotificationsLimit: (state: {
50
+ appNotifications: AppNotificationsState;
51
+ }) => number;
52
+ export declare const selectNotificationTemplates: (state: {
53
+ appNotifications: AppNotificationsState;
54
+ }) => Partial<NotificationTemplates> | undefined;
55
+ export declare const selectCurrentProjectId: (state: {
56
+ appNotifications: AppNotificationsState;
57
+ }) => string | undefined;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.selectCurrentProjectId = exports.selectNotificationTemplates = exports.selectAppNotificationsLimit = exports.selectAppNotificationsPage = exports.selectAppNotificationsHasMore = exports.selectAppNotificationsLoading = exports.selectUnreadCount = exports.selectAppNotifications = exports.handleError = exports.setUnreadCount = exports.markAsReadLocally = exports.addNotifications = exports.setLoading = exports.loadMore = exports.resetNotifications = exports.setNotificationTemplates = exports.setLimit = exports.setProjectContext = exports.appNotificationsSlice = void 0;
5
+ var toolkit_1 = require("@reduxjs/toolkit");
6
+ // Initial state
7
+ var initialState = {
8
+ notifications: [],
9
+ unreadCount: 0,
10
+ loading: false,
11
+ hasMore: true,
12
+ page: 1,
13
+ limit: 10,
14
+ notificationTemplates: undefined,
15
+ currentProjectId: undefined,
16
+ };
17
+ // Create the slice
18
+ exports.appNotificationsSlice = (0, toolkit_1.createSlice)({
19
+ name: 'appNotifications',
20
+ initialState: initialState,
21
+ reducers: {
22
+ // Set the current project context
23
+ setProjectContext: function (state, action) {
24
+ state.currentProjectId = action.payload;
25
+ },
26
+ // Set pagination limit
27
+ setLimit: function (state, action) {
28
+ state.limit = action.payload;
29
+ },
30
+ // Set notification templates
31
+ setNotificationTemplates: function (state, action) {
32
+ state.notificationTemplates = action.payload;
33
+ },
34
+ // Reset notifications (clear all and restart pagination)
35
+ resetNotifications: function (state) {
36
+ state.notifications = [];
37
+ state.page = 1;
38
+ state.hasMore = true;
39
+ state.loading = false;
40
+ },
41
+ // Load more notifications (increment page)
42
+ loadMore: function (state) {
43
+ if (state.hasMore && !state.loading) {
44
+ state.page += 1;
45
+ }
46
+ },
47
+ // Set loading state
48
+ setLoading: function (state, action) {
49
+ state.loading = action.payload;
50
+ },
51
+ // Add new notifications (for pagination)
52
+ addNotifications: function (state, action) {
53
+ var _a;
54
+ var _b = action.payload, notifications = _b.notifications, _c = _b.isFirstPage, isFirstPage = _c === void 0 ? false : _c;
55
+ if (isFirstPage) {
56
+ state.notifications = notifications;
57
+ }
58
+ else {
59
+ // Prevent duplicates when adding new pages
60
+ var existingIds_1 = new Set(state.notifications.map(function (n) { return n.id; }));
61
+ var newNotifications = notifications.filter(function (n) { return !existingIds_1.has(n.id); });
62
+ (_a = state.notifications).push.apply(_a, newNotifications);
63
+ }
64
+ // Update hasMore based on returned count vs limit
65
+ if (notifications.length < state.limit) {
66
+ state.hasMore = false;
67
+ }
68
+ state.loading = false;
69
+ },
70
+ // Mark notification as read locally (optimistic update)
71
+ markAsReadLocally: function (state, action) {
72
+ var notificationId = action.payload;
73
+ var notification = state.notifications.find(function (n) { return n.id === notificationId; });
74
+ if (notification && !notification.isRead) {
75
+ notification.isRead = true;
76
+ // Decrease unread count
77
+ state.unreadCount = Math.max(state.unreadCount - 1, 0);
78
+ }
79
+ },
80
+ // Set unread count
81
+ setUnreadCount: function (state, action) {
82
+ state.unreadCount = action.payload;
83
+ },
84
+ // Handle errors by stopping loading
85
+ handleError: function (state) {
86
+ state.loading = false;
87
+ },
88
+ },
89
+ });
90
+ // Export actions
91
+ exports.setProjectContext = (_a = exports.appNotificationsSlice.actions, _a.setProjectContext), exports.setLimit = _a.setLimit, exports.setNotificationTemplates = _a.setNotificationTemplates, exports.resetNotifications = _a.resetNotifications, exports.loadMore = _a.loadMore, exports.setLoading = _a.setLoading, exports.addNotifications = _a.addNotifications, exports.markAsReadLocally = _a.markAsReadLocally, exports.setUnreadCount = _a.setUnreadCount, exports.handleError = _a.handleError;
92
+ // Export reducer
93
+ exports.default = exports.appNotificationsSlice.reducer;
94
+ // Selectors
95
+ var selectAppNotifications = function (state) {
96
+ return state.appNotifications.notifications;
97
+ };
98
+ exports.selectAppNotifications = selectAppNotifications;
99
+ var selectUnreadCount = function (state) {
100
+ return state.appNotifications.unreadCount;
101
+ };
102
+ exports.selectUnreadCount = selectUnreadCount;
103
+ var selectAppNotificationsLoading = function (state) {
104
+ return state.appNotifications.loading;
105
+ };
106
+ exports.selectAppNotificationsLoading = selectAppNotificationsLoading;
107
+ var selectAppNotificationsHasMore = function (state) {
108
+ return state.appNotifications.hasMore;
109
+ };
110
+ exports.selectAppNotificationsHasMore = selectAppNotificationsHasMore;
111
+ var selectAppNotificationsPage = function (state) {
112
+ return state.appNotifications.page;
113
+ };
114
+ exports.selectAppNotificationsPage = selectAppNotificationsPage;
115
+ var selectAppNotificationsLimit = function (state) {
116
+ return state.appNotifications.limit;
117
+ };
118
+ exports.selectAppNotificationsLimit = selectAppNotificationsLimit;
119
+ var selectNotificationTemplates = function (state) {
120
+ return state.appNotifications.notificationTemplates;
121
+ };
122
+ exports.selectNotificationTemplates = selectNotificationTemplates;
123
+ var selectCurrentProjectId = function (state) {
124
+ return state.appNotifications.currentProjectId;
125
+ };
126
+ exports.selectCurrentProjectId = selectCurrentProjectId;
127
+ //# sourceMappingURL=appNotificationsSlice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appNotificationsSlice.js","sourceRoot":"","sources":["../../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BAA6B,GAAG,UAAC,KAAkD;IAC9F,OAAA,KAAK,CAAC,gBAAgB,CAAC,OAAO;AAA9B,CAA8B,CAAC;AADpB,QAAA,6BAA6B,iCACT;AAE1B,IAAM,0BAA0B,GAAG,UAAC,KAAkD;IAC3F,OAAA,KAAK,CAAC,gBAAgB,CAAC,IAAI;AAA3B,CAA2B,CAAC;AADjB,QAAA,0BAA0B,8BACT;AAEvB,IAAM,2BAA2B,GAAG,UAAC,KAAkD;IAC5F,OAAA,KAAK,CAAC,gBAAgB,CAAC,KAAK;AAA5B,CAA4B,CAAC;AADlB,QAAA,2BAA2B,+BACT;AAExB,IAAM,2BAA2B,GAAG,UAAC,KAAkD;IAC5F,OAAA,KAAK,CAAC,gBAAgB,CAAC,qBAAqB;AAA5C,CAA4C,CAAC;AADlC,QAAA,2BAA2B,+BACO;AAExC,IAAM,sBAAsB,GAAG,UAAC,KAAkD;IACvF,OAAA,KAAK,CAAC,gBAAgB,CAAC,gBAAgB;AAAvC,CAAuC,CAAC;AAD7B,QAAA,sBAAsB,0BACO"}
@@ -0,0 +1 @@
1
+ export * from "./appNotificationsSlice";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Export app notifications slice
18
+ __exportStar(require("./appNotificationsSlice"), exports);
19
+ // Future slice exports will go here:
20
+ // export * from "./entitiesSlice";
21
+ // export * from "./listsSlice";
22
+ // export * from "./commentsSlice";
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/store/slices/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,0DAAwC;AAExC,qCAAqC;AACrC,mCAAmC;AACnC,gCAAgC;AAChC,mCAAmC"}