@appcorp/stellar-solutions-modules 0.1.68 → 0.1.70
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/constants.d.ts +8 -0
- package/constants.js +11 -0
- package/global-modules/bank/cache.d.ts +23 -0
- package/global-modules/bank/cache.js +45 -0
- package/global-modules/bank/context.js +89 -6
- package/global-modules/branch/cache.d.ts +23 -0
- package/global-modules/branch/cache.js +45 -0
- package/global-modules/branch/context.js +89 -5
- package/global-modules/currency/cache.d.ts +23 -0
- package/global-modules/currency/cache.js +47 -0
- package/global-modules/currency/context.js +89 -5
- package/global-modules/payment-mode/cache.d.ts +23 -0
- package/global-modules/payment-mode/cache.js +49 -0
- package/global-modules/payment-mode/context.js +89 -5
- package/global-modules/preferences/cache.d.ts +23 -0
- package/global-modules/preferences/cache.js +47 -0
- package/global-modules/preferences/context.js +97 -51
- package/global-modules/preferences/types.d.ts +0 -1
- package/global-modules/tax/cache.d.ts +23 -0
- package/global-modules/tax/cache.js +45 -0
- package/global-modules/tax/context.js +105 -5
- package/i18n/routing.d.ts +1 -1
- package/package.json +6 -6
|
@@ -75,6 +75,42 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
75
75
|
return result;
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
79
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
80
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
81
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
82
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
83
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
84
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
88
|
+
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);
|
|
89
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
90
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
91
|
+
function step(op) {
|
|
92
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
93
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
94
|
+
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;
|
|
95
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
96
|
+
switch (op[0]) {
|
|
97
|
+
case 0: case 1: t = op; break;
|
|
98
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
99
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
100
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
101
|
+
default:
|
|
102
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
103
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
104
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
105
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
106
|
+
if (t[2]) _.ops.pop();
|
|
107
|
+
_.trys.pop(); continue;
|
|
108
|
+
}
|
|
109
|
+
op = body.call(thisArg, _);
|
|
110
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
111
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
112
|
+
}
|
|
113
|
+
};
|
|
78
114
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
115
|
exports.useTaxStateContext = exports.TaxStateContextProvider = exports.TaxStateContext = void 0;
|
|
80
116
|
var react_1 = __importStar(require("react"));
|
|
@@ -88,6 +124,7 @@ var types_1 = require("./types");
|
|
|
88
124
|
var toast_utils_1 = require("@appcorp/shadcn/lib/toast-utils");
|
|
89
125
|
var validate_1 = require("./validate");
|
|
90
126
|
var context_1 = require("../preferences/context");
|
|
127
|
+
var cache_1 = require("./cache");
|
|
91
128
|
// ============================================================================
|
|
92
129
|
// MAIN HOOK
|
|
93
130
|
// ============================================================================
|
|
@@ -170,6 +207,8 @@ var useTaxState = function () {
|
|
|
170
207
|
}
|
|
171
208
|
if (data) {
|
|
172
209
|
showSuccessToast(t("messagesTaxUpdated"));
|
|
210
|
+
// Invalidate cache to force fresh data on next fetch
|
|
211
|
+
(0, cache_1.invalidateTaxesCache)();
|
|
173
212
|
dispatch({
|
|
174
213
|
type: actions_1.TAX_ACTION_TYPES.RESET_FORM,
|
|
175
214
|
});
|
|
@@ -207,6 +246,8 @@ var useTaxState = function () {
|
|
|
207
246
|
}
|
|
208
247
|
if (data) {
|
|
209
248
|
showSuccessToast(t("messagesTaxDeleted"));
|
|
249
|
+
// Invalidate cache to force fresh data on next fetch
|
|
250
|
+
(0, cache_1.invalidateTaxesCache)();
|
|
210
251
|
dispatch({
|
|
211
252
|
type: actions_1.TAX_ACTION_TYPES.RESET_FORM,
|
|
212
253
|
});
|
|
@@ -229,14 +270,73 @@ var useTaxState = function () {
|
|
|
229
270
|
updateCallback: updateCallback,
|
|
230
271
|
updateDeps: [state],
|
|
231
272
|
updateParams: updateParams,
|
|
232
|
-
}), byIdError = _b.byIdError, byIdFetchNow = _b.byIdFetchNow, byIdLoading = _b.byIdLoading, deleteError = _b.deleteError, deleteFetchNow = _b.deleteFetchNow, deleteLoading = _b.deleteLoading, listError = _b.listError,
|
|
273
|
+
}), byIdError = _b.byIdError, byIdFetchNow = _b.byIdFetchNow, byIdLoading = _b.byIdLoading, deleteError = _b.deleteError, deleteFetchNow = _b.deleteFetchNow, deleteLoading = _b.deleteLoading, listError = _b.listError, listLoading = _b.listLoading, updateError = _b.updateError, updateFetchNow = _b.updateFetchNow, updateLoading = _b.updateLoading;
|
|
233
274
|
// ---------------------------------------------------------------------------
|
|
234
|
-
// EFFECTS
|
|
275
|
+
// EFFECTS
|
|
235
276
|
// ---------------------------------------------------------------------------
|
|
277
|
+
// useEffect(() => {
|
|
278
|
+
// if (!workspace?.id) return;
|
|
279
|
+
// (async () => {
|
|
280
|
+
// try {
|
|
281
|
+
// const { count, items } = await getCachedAttendances({
|
|
282
|
+
// params: listParams,
|
|
283
|
+
// });
|
|
284
|
+
// dispatch({
|
|
285
|
+
// type: ATTENDANCE_ACTION_TYPES.SET_ATTENDANCES,
|
|
286
|
+
// payload: { attendances: items, count },
|
|
287
|
+
// });
|
|
288
|
+
// } catch {
|
|
289
|
+
// toastNetworkError();
|
|
290
|
+
// }
|
|
291
|
+
// })();
|
|
292
|
+
// }, [listParams, toastNetworkError, workspace?.id]);
|
|
293
|
+
/**
|
|
294
|
+
* Cache loading effect
|
|
295
|
+
*
|
|
296
|
+
* Loads taxes from cache for instant UI feedback.
|
|
297
|
+
* Falls back to API if cache miss occurs.
|
|
298
|
+
*
|
|
299
|
+
* Triggers on:
|
|
300
|
+
* - debouncedQuery change (search)
|
|
301
|
+
* - currentPage change (pagination)
|
|
302
|
+
* - pageLimit change (items per page)
|
|
303
|
+
*
|
|
304
|
+
* Implementation:
|
|
305
|
+
* - Fetches from cache asynchronously
|
|
306
|
+
* - Applies client-side search filtering
|
|
307
|
+
* - Slices data for client-side pagination
|
|
308
|
+
* - Updates count for pagination controls
|
|
309
|
+
* - Handles errors with toast notifications
|
|
310
|
+
*/
|
|
236
311
|
(0, react_1.useEffect)(function () {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
312
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
+
var _a, count, items, error_1;
|
|
314
|
+
return __generator(this, function (_b) {
|
|
315
|
+
switch (_b.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
_b.trys.push([0, 2, , 3]);
|
|
318
|
+
return [4 /*yield*/, (0, cache_1.getCachedTaxes)({
|
|
319
|
+
params: listParams,
|
|
320
|
+
})];
|
|
321
|
+
case 1:
|
|
322
|
+
_a = _b.sent(), count = _a.count, items = _a.items;
|
|
323
|
+
dispatch({
|
|
324
|
+
type: actions_1.TAX_ACTION_TYPES.SET_TAXES,
|
|
325
|
+
payload: { taxes: items },
|
|
326
|
+
});
|
|
327
|
+
dispatch({
|
|
328
|
+
type: actions_1.TAX_ACTION_TYPES.SET_COUNT,
|
|
329
|
+
payload: { count: count },
|
|
330
|
+
});
|
|
331
|
+
return [3 /*break*/, 3];
|
|
332
|
+
case 2:
|
|
333
|
+
error_1 = _b.sent();
|
|
334
|
+
return [3 /*break*/, 3];
|
|
335
|
+
case 3: return [2 /*return*/];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}); })();
|
|
339
|
+
}, [listParams]);
|
|
240
340
|
// ---------------------------------------------------------------------------
|
|
241
341
|
// DRAWER & MODAL HANDLERS
|
|
242
342
|
// ---------------------------------------------------------------------------
|
package/i18n/routing.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const routing: {
|
|
|
6
6
|
localeCookie?: boolean | {
|
|
7
7
|
name?: string | undefined;
|
|
8
8
|
path?: string | undefined | undefined;
|
|
9
|
-
maxAge?: number | undefined | undefined;
|
|
10
9
|
priority?: "low" | "medium" | "high" | undefined | undefined;
|
|
10
|
+
maxAge?: number | undefined | undefined;
|
|
11
11
|
domain?: string | undefined | undefined;
|
|
12
12
|
secure?: boolean | undefined | undefined;
|
|
13
13
|
sameSite?: true | false | "lax" | "strict" | "none" | undefined | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/stellar-solutions-modules",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.70",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"automate": "./automate.sh",
|
|
6
6
|
"build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"upgrade:own": "ncu -f '@appcorp/app-corp-vista, @appcorp/shadcn, @react-pakistan/util-functions' -u"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@appcorp/app-corp-vista": "^0.3.
|
|
23
|
-
"@appcorp/shadcn": "^1.1.
|
|
22
|
+
"@appcorp/app-corp-vista": "^0.3.89",
|
|
23
|
+
"@appcorp/shadcn": "^1.1.31",
|
|
24
24
|
"@dnd-kit/core": "^6.3.1",
|
|
25
25
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
26
26
|
"@eslint/eslintrc": "^3",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@radix-ui/react-separator": "^1.1.7",
|
|
36
36
|
"@radix-ui/react-slot": "^1.2.3",
|
|
37
37
|
"@radix-ui/react-switch": "^1.2.6",
|
|
38
|
-
"@react-pakistan/util-functions": "^1.
|
|
38
|
+
"@react-pakistan/util-functions": "^1.25.18",
|
|
39
39
|
"@supabase/supabase-js": "^2",
|
|
40
40
|
"@tailwindcss/forms": "^0",
|
|
41
41
|
"@tailwindcss/postcss": "^4",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"dayjs": "^1",
|
|
55
55
|
"embla-carousel-react": "^8.6.0",
|
|
56
56
|
"eslint": "^9",
|
|
57
|
-
"eslint-config-next": "^
|
|
57
|
+
"eslint-config-next": "^16",
|
|
58
58
|
"husky": "^9",
|
|
59
59
|
"jotai": "^2.15.0",
|
|
60
60
|
"libphonenumber-js": "^1",
|
|
61
61
|
"lodash.throttle": "^4.1.1",
|
|
62
62
|
"lucide-react": "^0.545.0",
|
|
63
63
|
"motion": "^12.23.22",
|
|
64
|
-
"next": "^
|
|
64
|
+
"next": "^16",
|
|
65
65
|
"next-intl": "^4",
|
|
66
66
|
"next-themes": "^0.4.6",
|
|
67
67
|
"radix-ui": "^1.4.3",
|