@react-pakistan/util-functions 1.24.27 → 1.24.29
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.
|
@@ -130,7 +130,7 @@ var postQuotesInvoices = function (_a) { return __awaiter(void 0, [_a], void 0,
|
|
|
130
130
|
}); };
|
|
131
131
|
exports.postQuotesInvoices = postQuotesInvoices;
|
|
132
132
|
var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
133
|
-
var quoteInvoice, mappedServices, foundQuoteInvoice, filteredEditServices, filteredCreateServices
|
|
133
|
+
var quoteInvoice, mappedServices, foundQuoteInvoice, filteredEditServices, filteredCreateServices;
|
|
134
134
|
var _c, _d;
|
|
135
135
|
var address = _b.address, category = _b.category, city = _b.city, companyId = _b.companyId, country = _b.country, currency = _b.currency, customerId = _b.customerId, date = _b.date, discount = _b.discount, discountUnit = _b.discountUnit, email = _b.email, expiryDate = _b.expiryDate, firstName = _b.firstName, id = _b.id, invoiceStatus = _b.invoiceStatus, lastName = _b.lastName, mode = _b.mode, note = _b.note, phone = _b.phone, prisma = _b.prisma, products = _b.products, quoteStatus = _b.quoteStatus, ref = _b.ref, services = _b.services, subTotal = _b.subTotal, taxRate = _b.taxRate, total = _b.total;
|
|
136
136
|
return __generator(this, function (_e) {
|
|
@@ -211,16 +211,13 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
211
211
|
quoteInvoice = _e.sent();
|
|
212
212
|
_e.label = 5;
|
|
213
213
|
case 5:
|
|
214
|
-
if (!(mode === 'Edit')) return [3 /*break*/,
|
|
215
|
-
_e.label = 6;
|
|
216
|
-
case 6:
|
|
217
|
-
_e.trys.push([6, 11, , 12]);
|
|
214
|
+
if (!(mode === 'Edit')) return [3 /*break*/, 10];
|
|
218
215
|
return [4 /*yield*/, prisma.quoteInvoice.findUnique({
|
|
219
216
|
where: {
|
|
220
217
|
id: id,
|
|
221
218
|
},
|
|
222
219
|
})];
|
|
223
|
-
case
|
|
220
|
+
case 6:
|
|
224
221
|
foundQuoteInvoice = _e.sent();
|
|
225
222
|
filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
|
|
226
223
|
var _mode = _a.mode;
|
|
@@ -258,27 +255,23 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
258
255
|
});
|
|
259
256
|
}); });
|
|
260
257
|
}
|
|
261
|
-
if (!(filteredCreateServices === null || filteredCreateServices === void 0 ? void 0 : filteredCreateServices.length)) return [3 /*break*/,
|
|
258
|
+
if (!(filteredCreateServices === null || filteredCreateServices === void 0 ? void 0 : filteredCreateServices.length)) return [3 /*break*/, 8];
|
|
262
259
|
return [4 /*yield*/, prisma.stellarService.createMany({
|
|
263
260
|
data: filteredCreateServices,
|
|
264
261
|
})];
|
|
265
|
-
case
|
|
262
|
+
case 7:
|
|
266
263
|
_e.sent();
|
|
267
|
-
_e.label =
|
|
268
|
-
case
|
|
264
|
+
_e.label = 8;
|
|
265
|
+
case 8: return [4 /*yield*/, prisma.quoteInvoice.update({
|
|
269
266
|
where: {
|
|
270
267
|
id: id,
|
|
271
268
|
},
|
|
272
269
|
data: __assign(__assign({}, foundQuoteInvoice), { category: category, companyId: companyId, currency: currency, customerId: customerId, date: date, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxRate: taxRate, total: total }),
|
|
273
270
|
})];
|
|
274
|
-
case
|
|
271
|
+
case 9:
|
|
275
272
|
quoteInvoice = _e.sent();
|
|
276
|
-
|
|
277
|
-
case
|
|
278
|
-
err_1 = _e.sent();
|
|
279
|
-
console.log('err lib', err_1);
|
|
280
|
-
return [3 /*break*/, 12];
|
|
281
|
-
case 12: return [2 /*return*/, quoteInvoice];
|
|
273
|
+
_e.label = 10;
|
|
274
|
+
case 10: return [2 /*return*/, quoteInvoice];
|
|
282
275
|
}
|
|
283
276
|
});
|
|
284
277
|
}); };
|
package/hooks/use-fetch.js
CHANGED
|
@@ -148,7 +148,7 @@ var useFetch = function (url, config, deps) {
|
|
|
148
148
|
callback
|
|
149
149
|
], deps, true));
|
|
150
150
|
(0, react_1.useEffect)(function () {
|
|
151
|
-
if (autoFetch) {
|
|
151
|
+
if (autoFetch && Object.values(function (value) { return !!value; })) {
|
|
152
152
|
fetchNow();
|
|
153
153
|
}
|
|
154
154
|
}, [fetchNow, autoFetch]);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-pakistan/util-functions",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.29",
|
|
4
4
|
"description": "A library of all util functions",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"add:tags": "scripts/add-tags.sh",
|
|
8
|
-
"build": "yarn clean:build && yarn build:ts && cp package.json lib && cp README.md lib",
|
|
8
|
+
"build": "yarn clean:build && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
|
|
9
9
|
"build:ts": "tsc --project tsconfig.json",
|
|
10
10
|
"clean:badges": "yarn rimraf ./badges",
|
|
11
11
|
"clean:build": "yarn rimraf ./lib",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"url": "https://github.com/react-pakistan/util-functions/issues"
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/react-pakistan/util-functions#readme",
|
|
41
|
-
"dependencies": {},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@appcorp/app-corp-vista": "^0.1.20",
|
|
44
43
|
"@babel/core": "^7.24.5",
|
|
@@ -76,5 +75,6 @@
|
|
|
76
75
|
"engines": {
|
|
77
76
|
"npm": ">=10.0.0",
|
|
78
77
|
"node": ">=20.0.0"
|
|
79
|
-
}
|
|
78
|
+
},
|
|
79
|
+
"packageManager": "yarn@4.9.2"
|
|
80
80
|
}
|
package/module/my-module.d.ts
DELETED
|
File without changes
|
package/module/my-module.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// /* eslint-disable */
|
|
2
|
-
// import React, { useReducer, createContext, useContext } from 'react';
|
|
3
|
-
// // 1. Define your state shape and actions
|
|
4
|
-
// type State = {
|
|
5
|
-
// // Your state properties here
|
|
6
|
-
// count: number;
|
|
7
|
-
// isLoading: boolean;
|
|
8
|
-
// };
|
|
9
|
-
// type Action =
|
|
10
|
-
// | { type: 'INCREMENT' }
|
|
11
|
-
// | { type: 'DECREMENT' }
|
|
12
|
-
// | { type: 'SET_LOADING'; payload: boolean };
|
|
13
|
-
// // 2. Create a context for your module
|
|
14
|
-
// const MyModuleContext = createContext<{
|
|
15
|
-
// state: State;
|
|
16
|
-
// dispatch: React.Dispatch<Action>;
|
|
17
|
-
// } | undefined>(undefined);
|
|
18
|
-
// // 3. Reducer function
|
|
19
|
-
// const reducer = (state: State, action: Action): State => {
|
|
20
|
-
// switch (action.type) {
|
|
21
|
-
// case 'INCREMENT':
|
|
22
|
-
// return { ...state, count: state.count + 1 };
|
|
23
|
-
// case 'DECREMENT':
|
|
24
|
-
// return { ...state, count: state.count - 1 };
|
|
25
|
-
// case 'SET_LOADING':
|
|
26
|
-
// return { ...state, isLoading: action.payload };
|
|
27
|
-
// default:
|
|
28
|
-
// return state;
|
|
29
|
-
// }
|
|
30
|
-
// };
|
|
31
|
-
// // 4. Provider component
|
|
32
|
-
// type MyModuleProviderProps = {
|
|
33
|
-
// children: React.ReactNode;
|
|
34
|
-
// initialState?: Partial<State>;
|
|
35
|
-
// };
|
|
36
|
-
// export const MyModuleProvider: React.FC<MyModuleProviderProps> = ({
|
|
37
|
-
// children,
|
|
38
|
-
// initialState,
|
|
39
|
-
// }) => {
|
|
40
|
-
// const [state, dispatch] = useReducer(reducer, {
|
|
41
|
-
// count: 0,
|
|
42
|
-
// isLoading: false,
|
|
43
|
-
// ...initialState,
|
|
44
|
-
// });
|
|
45
|
-
// return (
|
|
46
|
-
// <MyModuleContext.Provider value={{ state, dispatch }}>
|
|
47
|
-
// {children}
|
|
48
|
-
// </MyModuleContext.Provider>
|
|
49
|
-
// );
|
|
50
|
-
// };
|
|
51
|
-
// // 5. Custom hook to access the context
|
|
52
|
-
// export const useMyModule = () => {
|
|
53
|
-
// const context = useContext(MyModuleContext);
|
|
54
|
-
// if (context === undefined) {
|
|
55
|
-
// throw new Error('useMyModule must be used within a MyModuleProvider');
|
|
56
|
-
// }
|
|
57
|
-
// return context;
|
|
58
|
-
// };
|
|
59
|
-
// // 6. Your actual module components
|
|
60
|
-
// export const Counter: React.FC = () => {
|
|
61
|
-
// const { state, dispatch } = useMyModule();
|
|
62
|
-
// return (
|
|
63
|
-
// <div>
|
|
64
|
-
// <button onClick={() => dispatch({ type: 'DECREMENT' })}>-</button>
|
|
65
|
-
// <span>{state.count}</span>
|
|
66
|
-
// <button onClick={() => dispatch({ type: 'INCREMENT' })}>+</button>
|
|
67
|
-
// </div>
|
|
68
|
-
// );
|
|
69
|
-
// };
|