npm-pkg-hook 1.2.2 → 1.2.4
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/package.json
CHANGED
|
@@ -50,15 +50,16 @@ export const useDessert = ({
|
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
// Transform initialData using useMemo to prevent unnecessary re-computation
|
|
54
|
-
const transformedData = useMemo(() => transformDataToDessert(initialData), [initialData])
|
|
55
|
-
|
|
56
53
|
// Use useEffect to update the data state when the initialData prop changes
|
|
57
54
|
useEffect(() => {
|
|
58
55
|
if (initialData) {
|
|
59
|
-
|
|
56
|
+
// Only update the data state if it's different from initialData
|
|
57
|
+
if (JSON.stringify(data) !== JSON.stringify(transformDataToDessert(initialData))) {
|
|
58
|
+
const transformedInitialData = transformDataToDessert(initialData);
|
|
59
|
+
setData(transformedInitialData);
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
|
-
}, [])
|
|
62
|
+
}, [initialData]); // Include data as a dependency
|
|
62
63
|
|
|
63
64
|
// Filter the 'listIds' from 'data' and store the filtered result in 'dataListIds'
|
|
64
65
|
// Here, it seems to exclude a specific list ID ('01list') from the listIds.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export function convertToIntegerOrFloat(numberString) {
|
|
2
2
|
if (!numberString) return 0;
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
// Convierte a número (entero o flotante)
|
|
5
5
|
const numericValue = parseFloat(numberString);
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
return isNaN(numericValue) ? 0 : numericValue; // Maneja valores no numéricos como 0
|
|
8
8
|
}
|
|
9
|
-
|
|
@@ -347,6 +347,11 @@ export const useSales = ({
|
|
|
347
347
|
...values,
|
|
348
348
|
[name]: value ?? ''
|
|
349
349
|
})
|
|
350
|
+
sendNotification({
|
|
351
|
+
backgroundColor: 'sucess',
|
|
352
|
+
title: 'Comentario eliminado',
|
|
353
|
+
description: 'Has eliminado el comentario!'
|
|
354
|
+
})
|
|
350
355
|
return dispatch({
|
|
351
356
|
type: 'PUT_COMMENT',
|
|
352
357
|
payload: pId,
|
|
@@ -647,6 +652,14 @@ export const useSales = ({
|
|
|
647
652
|
|
|
648
653
|
// COMMENT_FREE_PRODUCT
|
|
649
654
|
function commentProducts (state, action, deleteValue) {
|
|
655
|
+
if (values.comment) {
|
|
656
|
+
sendNotification({
|
|
657
|
+
backgroundColor: 'success',
|
|
658
|
+
title: deleteValue ? 'Comentario eliminado' : 'Producto comentado',
|
|
659
|
+
description: deleteValue ? 'Has eliminado el comentario!' : 'Has comentado!'
|
|
660
|
+
})
|
|
661
|
+
}
|
|
662
|
+
setOpenCommentModal(!openCommentModal)
|
|
650
663
|
return {
|
|
651
664
|
...state,
|
|
652
665
|
PRODUCT: state?.PRODUCT?.map((items) => {
|
|
@@ -834,7 +847,9 @@ export const useSales = ({
|
|
|
834
847
|
const { registerSalesStore } = data || {}
|
|
835
848
|
const { Response } = registerSalesStore || {}
|
|
836
849
|
if (Response && Response.success === true) {
|
|
837
|
-
|
|
850
|
+
dispatch({ type: 'REMOVE_ALL_PRODUCTS' })
|
|
851
|
+
setValues({})
|
|
852
|
+
setPrint(false)
|
|
838
853
|
client.query({
|
|
839
854
|
query: GET_ALL_COUNT_SALES,
|
|
840
855
|
fetchPolicy: 'network-only',
|
|
@@ -855,7 +870,8 @@ export const useSales = ({
|
|
|
855
870
|
fields: {
|
|
856
871
|
getAllOrdersFromStore (existingOrders = []) {
|
|
857
872
|
try {
|
|
858
|
-
|
|
873
|
+
const newGetAllOrdersFromStore = updateExistingOrders(existingOrders, inComingCodeRef, 4, currentSale)
|
|
874
|
+
return newGetAllOrdersFromStore
|
|
859
875
|
} catch (e) {
|
|
860
876
|
return existingOrders
|
|
861
877
|
}
|
|
@@ -874,7 +890,6 @@ export const useSales = ({
|
|
|
874
890
|
undefined,
|
|
875
891
|
{ shallow: true }
|
|
876
892
|
)
|
|
877
|
-
setValues({})
|
|
878
893
|
}
|
|
879
894
|
}
|
|
880
895
|
setLoadingSale(false)
|
|
@@ -882,8 +897,10 @@ export const useSales = ({
|
|
|
882
897
|
.catch(() => {
|
|
883
898
|
setLoadingSale(false)
|
|
884
899
|
setErrorSale(true)
|
|
900
|
+
setPrint(false)
|
|
885
901
|
})
|
|
886
902
|
.finally(() => {
|
|
903
|
+
setPrint(false)
|
|
887
904
|
setLoadingSale(false)
|
|
888
905
|
})
|
|
889
906
|
}
|