npm-pkg-hook 1.3.6 → 1.3.8

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 (97) hide show
  1. package/.eslintrc.js +38 -38
  2. package/.eslintrc.json +127 -127
  3. package/.github/pull_request_template.md +17 -17
  4. package/.github/workflows/pepeline.yaml +29 -29
  5. package/package.json +46 -46
  6. package/script.txt +6 -6
  7. package/src/config/client/index.js +1 -1
  8. package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -7
  9. package/src/hooks/getCategoriesWithProduct/index.js +62 -62
  10. package/src/hooks/getSession/index.js +18 -18
  11. package/src/hooks/handleLogin/index.js +10 -0
  12. package/src/hooks/index.js +1 -0
  13. package/src/hooks/useAnimationFrame/index.js +45 -45
  14. package/src/hooks/useAsideCart/index.js +155 -155
  15. package/src/hooks/useAsideCart/queries.js +10 -10
  16. package/src/hooks/useCart/index.js +2 -2
  17. package/src/hooks/useCart/queries.js +164 -164
  18. package/src/hooks/useCart/useCart/helpers/index.js +75 -75
  19. package/src/hooks/useCart/useCart/index.js +410 -410
  20. package/src/hooks/useCart/useGetCart/index.js +31 -31
  21. package/src/hooks/useCatWithProductClient/index.js +56 -56
  22. package/src/hooks/useCatWithProductClient/queries.js +55 -55
  23. package/src/hooks/useCategoriesProduct/index.js +12 -12
  24. package/src/hooks/useCategoriesProduct/queries.js +16 -16
  25. package/src/hooks/useCategoryInStore/queries.js +78 -78
  26. package/src/hooks/useChartData/useChartData/index.js +199 -199
  27. package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
  28. package/src/hooks/useCheckbox/index.js +115 -115
  29. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +52 -0
  30. package/src/hooks/useCreateProduct/index.js +8 -3
  31. package/src/hooks/useDeleteSubProductOptional/index.js +30 -30
  32. package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
  33. package/src/hooks/useDessert/helpers/index.js +51 -51
  34. package/src/hooks/useDevices/index.js +35 -35
  35. package/src/hooks/useDevices/queries.js +19 -19
  36. package/src/hooks/useDropzone/index.js +94 -94
  37. package/src/hooks/useDynamicAuth/index.js +13 -13
  38. package/src/hooks/useDynamicAuth/queries.js +24 -24
  39. package/src/hooks/useEditSubProductOptional/queries.js +10 -10
  40. package/src/hooks/useEvent/index.js +33 -33
  41. package/src/hooks/useFavoriteStores/index.js +19 -19
  42. package/src/hooks/useFavoriteStores/queries.js +47 -47
  43. package/src/hooks/useFetchJson/index.js +25 -25
  44. package/src/hooks/useFingerprintjs/index.js +172 -172
  45. package/src/hooks/useFullScreenMode/index.js +65 -65
  46. package/src/hooks/useGenerateNumberArray/index.js +17 -17
  47. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -14
  48. package/src/hooks/useGetFoodRecomended/index.js +32 -33
  49. package/src/hooks/useGetFoodRecomended/queries.js +47 -47
  50. package/src/hooks/useGetMinPrice/index.js +12 -12
  51. package/src/hooks/useGetMinPrice/queries.js +7 -7
  52. package/src/hooks/useGetOneStoreRating/index.js +40 -40
  53. package/src/hooks/useGetOneStoreRating/queries.js +18 -18
  54. package/src/hooks/useGoogleLogin/index.js +160 -160
  55. package/src/hooks/useGoogleLogin/loadScript.js +15 -15
  56. package/src/hooks/useGoogleLogin/removeScript.js +7 -7
  57. package/src/hooks/useHover/index.js +29 -29
  58. package/src/hooks/useImagesStore/index.js +5 -4
  59. package/src/hooks/useInnerHtml/index.js +39 -39
  60. package/src/hooks/useKeypress/index.js +28 -28
  61. package/src/hooks/useLocationNavigate/index.js +54 -54
  62. package/src/hooks/useLogout/index.js +29 -21
  63. package/src/hooks/useManageQueryParams/index.js +37 -36
  64. package/src/hooks/useMobile/index.js +39 -39
  65. package/src/hooks/useOrderClient/index.js +5 -5
  66. package/src/hooks/useProviders/index.js +3 -3
  67. package/src/hooks/useProviders/queries.js +31 -31
  68. package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -12
  69. package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
  70. package/src/hooks/useProvidersStore/index.js +24 -24
  71. package/src/hooks/useProvidersStore/queries.js +31 -31
  72. package/src/hooks/useRatingArrayData/index.js +54 -54
  73. package/src/hooks/useRatingArrayData/queries.js +19 -19
  74. package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
  75. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
  76. package/src/hooks/useRestaurant/index.js +19 -19
  77. package/src/hooks/useRestaurant/queries.js +80 -80
  78. package/src/hooks/useSales/useGetAllSales/index.js +25 -25
  79. package/src/hooks/useSchedule/index.js +72 -72
  80. package/src/hooks/useSchedule/index.jsx +22 -22
  81. package/src/hooks/useSchedule/queries.js +43 -43
  82. package/src/hooks/useScheduleData/index.js +123 -123
  83. package/src/hooks/useScroll/index.js +56 -56
  84. package/src/hooks/useScrollRotate/index.js +16 -16
  85. package/src/hooks/useStatusOpenStore/helpers/index.js +101 -101
  86. package/src/hooks/useStatusOpenStore/index.js +172 -172
  87. package/src/hooks/useStatusOrdersClient/queries.js +80 -80
  88. package/src/hooks/useStore/queries.js +163 -163
  89. package/src/hooks/useStoreCalendar/index.js +5 -5
  90. package/src/hooks/useStoreContacts/queries.js +1 -1
  91. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
  92. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -38
  93. package/src/hooks/useWindowSize/index.js +38 -38
  94. package/src/mock/dessert/index.js +16 -16
  95. package/src/mock/index.js +1 -1
  96. package/.vscode/extensions.json +0 -6
  97. package/.vscode/settings.json +0 -8
@@ -1,101 +1,101 @@
1
- export const getDayFromOpeningKey = (key) => {
2
- const days = {
3
- openingSun: 0,
4
- openingMon: 1,
5
- openingTue: 2,
6
- openingWed: 3,
7
- openingThu: 4,
8
- openingFri: 5,
9
- openingSat: 6
10
- }
11
- return days[key] !== undefined ? days[key] : -1
12
- }
13
-
14
- // Función para convertir el objeto de tiempo en una cadena de tiempo
15
- export function getTimeString (timeStr) {
16
- return timeStr || '00:00' // Return '00:00' for empty time strings
17
- }
18
-
19
- export function getCurrentDayAndTime () {
20
- try {
21
- const date = new Date()
22
- const currentTime = date.getHours() * 60 + date.getMinutes()
23
- const currentDayOfWeek = date.getDay()
24
- return { currentTime, currentDayOfWeek }
25
- } catch (error) {
26
- return {
27
-
28
- }
29
- }
30
- }
31
-
32
- export function getTimeObject (timeStr) {
33
- try {
34
- if (!timeStr || !/\d{2}:\d{2}/.test(timeStr)) {
35
- return { hours: 0, minutes: 0 } // Return default values for invalid input
36
- }
37
- const [hours, minutes] = timeStr.split(':').map(str => parseInt(str))
38
- return { hours, minutes }
39
- } catch (e) {
40
- return { hours: 0, minutes: 0 } // Return default values on error
41
- }
42
- }
43
-
44
- export function sortOpeningsByDay (openings) {
45
- const days = [
46
- 'openingSun',
47
- 'openingMon',
48
- 'openingTue',
49
- 'openingWed',
50
- 'openingThu',
51
- 'openingFri',
52
- 'openingSat'
53
- ]
54
- const sortedOpenings = {}
55
-
56
- days.forEach((day) => {
57
- sortedOpenings[day] = openings[day] || '00:00 - 00:00' // Agregar horario vacío para los días faltantes
58
- })
59
-
60
- return sortedOpenings
61
- }
62
-
63
- // Función para obtener la clave de openings a partir del día de la semana
64
- export function getOpeningKeyFromDay (day) {
65
- const days = {
66
- 0: 'openingSun',
67
- 1: 'openingMon',
68
- 2: 'openingTue',
69
- 3: 'openingWed',
70
- 4: 'openingThu',
71
- 5: 'openingFri',
72
- 6: 'openingSat'
73
- }
74
- return days[day]
75
- }
76
-
77
- export const weekDays = [
78
- 'Domingo',
79
- 'Lunes',
80
- 'Martes',
81
- 'Miércoles',
82
- 'Jueves',
83
- 'Viernes',
84
- 'Sábado'
85
- ]
86
-
87
- export function timeToInt (text) {
88
- const hour = parseInt(text.substring(0, 2))
89
- const minute = parseInt(text.substring(3))
90
- return hour * 60 + minute
91
- }
92
-
93
- export const days = {
94
- Monday: 'Lunes',
95
- Tuesday: 'Martes',
96
- Wednesday: 'Miércoles',
97
- Thursday: 'Jueves',
98
- Friday: 'Viernes',
99
- Saturday: 'Sábado',
100
- Sunday: 'Domingo'
101
- }
1
+ export const getDayFromOpeningKey = (key) => {
2
+ const days = {
3
+ openingSun: 0,
4
+ openingMon: 1,
5
+ openingTue: 2,
6
+ openingWed: 3,
7
+ openingThu: 4,
8
+ openingFri: 5,
9
+ openingSat: 6
10
+ }
11
+ return days[key] !== undefined ? days[key] : -1
12
+ }
13
+
14
+ // Función para convertir el objeto de tiempo en una cadena de tiempo
15
+ export function getTimeString (timeStr) {
16
+ return timeStr || '00:00' // Return '00:00' for empty time strings
17
+ }
18
+
19
+ export function getCurrentDayAndTime () {
20
+ try {
21
+ const date = new Date()
22
+ const currentTime = date.getHours() * 60 + date.getMinutes()
23
+ const currentDayOfWeek = date.getDay()
24
+ return { currentTime, currentDayOfWeek }
25
+ } catch (error) {
26
+ return {
27
+
28
+ }
29
+ }
30
+ }
31
+
32
+ export function getTimeObject (timeStr) {
33
+ try {
34
+ if (!timeStr || !/\d{2}:\d{2}/.test(timeStr)) {
35
+ return { hours: 0, minutes: 0 } // Return default values for invalid input
36
+ }
37
+ const [hours, minutes] = timeStr.split(':').map(str => parseInt(str))
38
+ return { hours, minutes }
39
+ } catch (e) {
40
+ return { hours: 0, minutes: 0 } // Return default values on error
41
+ }
42
+ }
43
+
44
+ export function sortOpeningsByDay (openings) {
45
+ const days = [
46
+ 'openingSun',
47
+ 'openingMon',
48
+ 'openingTue',
49
+ 'openingWed',
50
+ 'openingThu',
51
+ 'openingFri',
52
+ 'openingSat'
53
+ ]
54
+ const sortedOpenings = {}
55
+
56
+ days.forEach((day) => {
57
+ sortedOpenings[day] = openings[day] || '00:00 - 00:00' // Agregar horario vacío para los días faltantes
58
+ })
59
+
60
+ return sortedOpenings
61
+ }
62
+
63
+ // Función para obtener la clave de openings a partir del día de la semana
64
+ export function getOpeningKeyFromDay (day) {
65
+ const days = {
66
+ 0: 'openingSun',
67
+ 1: 'openingMon',
68
+ 2: 'openingTue',
69
+ 3: 'openingWed',
70
+ 4: 'openingThu',
71
+ 5: 'openingFri',
72
+ 6: 'openingSat'
73
+ }
74
+ return days[day]
75
+ }
76
+
77
+ export const weekDays = [
78
+ 'Domingo',
79
+ 'Lunes',
80
+ 'Martes',
81
+ 'Miércoles',
82
+ 'Jueves',
83
+ 'Viernes',
84
+ 'Sábado'
85
+ ]
86
+
87
+ export function timeToInt (text) {
88
+ const hour = parseInt(text.substring(0, 2))
89
+ const minute = parseInt(text.substring(3))
90
+ return hour * 60 + minute
91
+ }
92
+
93
+ export const days = {
94
+ Monday: 'Lunes',
95
+ Tuesday: 'Martes',
96
+ Wednesday: 'Miércoles',
97
+ Thursday: 'Jueves',
98
+ Friday: 'Viernes',
99
+ Saturday: 'Sábado',
100
+ Sunday: 'Domingo'
101
+ }
@@ -1,172 +1,172 @@
1
- import { useEffect, useState } from 'react'
2
- import {
3
- getDayFromOpeningKey,
4
- getCurrentDayAndTime,
5
- getOpeningKeyFromDay,
6
- getTimeString,
7
- sortOpeningsByDay,
8
- weekDays,
9
- timeToInt,
10
- days,
11
- getTimeObject
12
- } from './helpers'
13
- import { useFormatDate } from '../useFormatDate'
14
-
15
- export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
16
- const [open, setOpen] = useState('')
17
- const [openNow, setOpenNow] = useState(false)
18
- const { handleHourPmAM } = useFormatDate({})
19
-
20
- const handleMessageHour = (message, open) => {
21
- setOpen(message)
22
- setOpenNow(open)
23
- }
24
-
25
- function getNextDaySchedule (dataSchedules, currentDayOfWeek) {
26
- const today = new Date()
27
- const tomorrow = new Date(today)
28
- tomorrow.setDate(today.getDate() + 1)
29
- const dayOfWeekTomorrow = tomorrow.getDay()
30
-
31
- const findNextDay = dataSchedules?.length
32
- ? dataSchedules?.some((schedule) => schedule?.schDay === dayOfWeekTomorrow)
33
- : false
34
-
35
- const findDataNextDay = dataSchedules?.length
36
- ? dataSchedules?.find((schedule) => schedule?.schDay === dayOfWeekTomorrow)
37
- : {}
38
-
39
- return { findNextDay, findDataNextDay, dayOfWeekTomorrow }
40
- }
41
-
42
- function getOpeningStatus (openings, currentTime, currentDayOfWeek) {
43
- const weekDayLookup = [
44
- 'Sunday',
45
- 'Monday',
46
- 'Tuesday',
47
- 'Wednesday',
48
- 'Thursday',
49
- 'Friday',
50
- 'Saturday'
51
- ]
52
-
53
- const ceroHours = '00:00 - 00:00'
54
- let dayOfWeek = currentDayOfWeek
55
-
56
- for (let i = 0; i < 7; i++) {
57
- const dayName = weekDayLookup[dayOfWeek % 7]
58
- const opening = openings && openings['opening' + dayName.substring(0, 3)]
59
- const timeSpans = opening?.split(';').map((item) => item.trim())
60
-
61
- for (const span of timeSpans) {
62
- const hours = span.split('-').map((item) => item.trim())
63
- const openTime = timeToInt(hours[0])
64
- const closeTime = timeToInt(hours[1])
65
-
66
- if (currentTime >= openTime && currentTime <= closeTime) {
67
- return handleMessageHour(
68
- 'Abierto Ahora - Cierra a las: ' + handleHourPmAM(hours[1]),
69
- true
70
- )
71
- }
72
-
73
- if (currentTime < openTime && dayOfWeek === currentDayOfWeek) {
74
- return handleMessageHour(
75
- 'Aun temprano - Abre hoy a las: ' + handleHourPmAM(hours[0]),
76
- false
77
- )
78
- }
79
-
80
- if (currentTime >= closeTime - 30 * 60000 && currentTime < closeTime && dayOfWeek === currentDayOfWeek) {
81
- return handleMessageHour(
82
- 'Pronto por cerrar - Cierra hoy a las: ' + handleHourPmAM(hours[1]),
83
- true
84
- )
85
- }
86
-
87
- const { findNextDay, findDataNextDay, dayOfWeekTomorrow } = getNextDaySchedule(
88
- dataSchedules,
89
- currentDayOfWeek
90
- )
91
-
92
- if (findNextDay && findDataNextDay?.schHoSta) {
93
- const nameOfDayTomorrow = weekDays[dayOfWeekTomorrow]
94
- return handleMessageHour(
95
- `Cerrado - Mañana ${nameOfDayTomorrow} ${!!findDataNextDay?.schHoSta && 'a las'} ${
96
- findDataNextDay?.schHoSta ? findDataNextDay?.schHoSta : ''
97
- }`,
98
- false
99
- )
100
- }
101
-
102
- const nextDayName = weekDayLookup[(dayOfWeek + 1) % 7]
103
- const nextOpening = openings && openings['opening' + nextDayName.substring(0, 3)]
104
- const nextHours = nextOpening?.split(';')?.map((item) => item?.trim())
105
-
106
- if (nextHours[0] !== ceroHours) {
107
- return handleMessageHour(
108
- 'Cerrado - Abre el ' + days[nextDayName] + ' a las ' + nextHours[0],
109
- false
110
- )
111
- }
112
- }
113
-
114
- dayOfWeek++
115
- }
116
-
117
- return handleMessageHour('Cerrado', false)
118
- }
119
-
120
- function getIsOpening (openings) {
121
- const { currentTime, currentDayOfWeek } = getCurrentDayAndTime()
122
- return getOpeningStatus(openings, currentTime, currentDayOfWeek)
123
- }
124
-
125
- useEffect(() => {
126
- (() => {
127
- // Crear el objeto openings a partir del existStoreSchedule
128
- const openings = {}
129
- const existStoreSchedule = dataSchedules || []
130
- existStoreSchedule?.forEach((schedule) => {
131
- const day = schedule.schDay
132
- const openingKey = getOpeningKeyFromDay(day)
133
- const schHoSta = getTimeString(schedule?.schHoSta)
134
- const schHoEnd = getTimeString(schedule?.schHoEnd)
135
- openings[openingKey] = `${schHoSta} - ${schHoEnd}`
136
- })
137
-
138
- for (let i = 0; i < 7; i++) {
139
- const openingKey = getOpeningKeyFromDay(i)
140
- // eslint-disable-next-line no-prototype-builtins
141
- if (!openings.hasOwnProperty(openingKey)) {
142
- openings[openingKey] = '00:00 - 00:00' // Horario vacío para el día faltante
143
- }
144
- }
145
-
146
- // Ejemplo de uso con el objeto proporcionado
147
- const sortedOpenings = sortOpeningsByDay(openings)
148
-
149
- // Crear el array completo con objetos de tiempo
150
- // eslint-disable-next-line no-unused-vars
151
- const fullArray = Object.keys(sortedOpenings).map((key) => {
152
- const day = getDayFromOpeningKey(key)
153
- const [schHoSta, schHoEnd] = openings[key].split(' - ').map(timeStr => getTimeObject(timeStr))
154
- return {
155
- __typename: 'StoreSchedule',
156
- schId: '',
157
- idStore: '',
158
- schDay: day,
159
- schHoSta: `${schHoSta?.hours?.toString().padStart(2, '0')}:${schHoSta?.minutes?.toString().padStart(2, '0')}`,
160
- schHoEnd: `${schHoEnd?.hours?.toString().padStart(2, '0')}:${schHoEnd?.minutes?.toString().padStart(2, '0')}`,
161
- schState: 1
162
- }
163
- })
164
- getIsOpening(sortedOpenings)
165
- })()
166
- }, [dataSchedules])
167
-
168
- return {
169
- open,
170
- openNow
171
- }
172
- }
1
+ import { useEffect, useState } from 'react'
2
+ import {
3
+ getDayFromOpeningKey,
4
+ getCurrentDayAndTime,
5
+ getOpeningKeyFromDay,
6
+ getTimeString,
7
+ sortOpeningsByDay,
8
+ weekDays,
9
+ timeToInt,
10
+ days,
11
+ getTimeObject
12
+ } from './helpers'
13
+ import { useFormatDate } from '../useFormatDate'
14
+
15
+ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
16
+ const [open, setOpen] = useState('')
17
+ const [openNow, setOpenNow] = useState(false)
18
+ const { handleHourPmAM } = useFormatDate({})
19
+
20
+ const handleMessageHour = (message, open) => {
21
+ setOpen(message)
22
+ setOpenNow(open)
23
+ }
24
+
25
+ function getNextDaySchedule (dataSchedules, currentDayOfWeek) {
26
+ const today = new Date()
27
+ const tomorrow = new Date(today)
28
+ tomorrow.setDate(today.getDate() + 1)
29
+ const dayOfWeekTomorrow = tomorrow.getDay()
30
+
31
+ const findNextDay = dataSchedules?.length
32
+ ? dataSchedules?.some((schedule) => schedule?.schDay === dayOfWeekTomorrow)
33
+ : false
34
+
35
+ const findDataNextDay = dataSchedules?.length
36
+ ? dataSchedules?.find((schedule) => schedule?.schDay === dayOfWeekTomorrow)
37
+ : {}
38
+
39
+ return { findNextDay, findDataNextDay, dayOfWeekTomorrow }
40
+ }
41
+
42
+ function getOpeningStatus (openings, currentTime, currentDayOfWeek) {
43
+ const weekDayLookup = [
44
+ 'Sunday',
45
+ 'Monday',
46
+ 'Tuesday',
47
+ 'Wednesday',
48
+ 'Thursday',
49
+ 'Friday',
50
+ 'Saturday'
51
+ ]
52
+
53
+ const ceroHours = '00:00 - 00:00'
54
+ let dayOfWeek = currentDayOfWeek
55
+
56
+ for (let i = 0; i < 7; i++) {
57
+ const dayName = weekDayLookup[dayOfWeek % 7]
58
+ const opening = openings && openings['opening' + dayName.substring(0, 3)]
59
+ const timeSpans = opening?.split(';').map((item) => item.trim())
60
+
61
+ for (const span of timeSpans) {
62
+ const hours = span.split('-').map((item) => item.trim())
63
+ const openTime = timeToInt(hours[0])
64
+ const closeTime = timeToInt(hours[1])
65
+
66
+ if (currentTime >= openTime && currentTime <= closeTime) {
67
+ return handleMessageHour(
68
+ 'Abierto Ahora - Cierra a las: ' + handleHourPmAM(hours[1]),
69
+ true
70
+ )
71
+ }
72
+
73
+ if (currentTime < openTime && dayOfWeek === currentDayOfWeek) {
74
+ return handleMessageHour(
75
+ 'Aun temprano - Abre hoy a las: ' + handleHourPmAM(hours[0]),
76
+ false
77
+ )
78
+ }
79
+
80
+ if (currentTime >= closeTime - 30 * 60000 && currentTime < closeTime && dayOfWeek === currentDayOfWeek) {
81
+ return handleMessageHour(
82
+ 'Pronto por cerrar - Cierra hoy a las: ' + handleHourPmAM(hours[1]),
83
+ true
84
+ )
85
+ }
86
+
87
+ const { findNextDay, findDataNextDay, dayOfWeekTomorrow } = getNextDaySchedule(
88
+ dataSchedules,
89
+ currentDayOfWeek
90
+ )
91
+
92
+ if (findNextDay && findDataNextDay?.schHoSta) {
93
+ const nameOfDayTomorrow = weekDays[dayOfWeekTomorrow]
94
+ return handleMessageHour(
95
+ `Cerrado - Mañana ${nameOfDayTomorrow} ${!!findDataNextDay?.schHoSta && 'a las'} ${
96
+ findDataNextDay?.schHoSta ? findDataNextDay?.schHoSta : ''
97
+ }`,
98
+ false
99
+ )
100
+ }
101
+
102
+ const nextDayName = weekDayLookup[(dayOfWeek + 1) % 7]
103
+ const nextOpening = openings && openings['opening' + nextDayName.substring(0, 3)]
104
+ const nextHours = nextOpening?.split(';')?.map((item) => item?.trim())
105
+
106
+ if (nextHours[0] !== ceroHours) {
107
+ return handleMessageHour(
108
+ 'Cerrado - Abre el ' + days[nextDayName] + ' a las ' + nextHours[0],
109
+ false
110
+ )
111
+ }
112
+ }
113
+
114
+ dayOfWeek++
115
+ }
116
+
117
+ return handleMessageHour('Cerrado', false)
118
+ }
119
+
120
+ function getIsOpening (openings) {
121
+ const { currentTime, currentDayOfWeek } = getCurrentDayAndTime()
122
+ return getOpeningStatus(openings, currentTime, currentDayOfWeek)
123
+ }
124
+
125
+ useEffect(() => {
126
+ (() => {
127
+ // Crear el objeto openings a partir del existStoreSchedule
128
+ const openings = {}
129
+ const existStoreSchedule = dataSchedules || []
130
+ existStoreSchedule?.forEach((schedule) => {
131
+ const day = schedule.schDay
132
+ const openingKey = getOpeningKeyFromDay(day)
133
+ const schHoSta = getTimeString(schedule?.schHoSta)
134
+ const schHoEnd = getTimeString(schedule?.schHoEnd)
135
+ openings[openingKey] = `${schHoSta} - ${schHoEnd}`
136
+ })
137
+
138
+ for (let i = 0; i < 7; i++) {
139
+ const openingKey = getOpeningKeyFromDay(i)
140
+ // eslint-disable-next-line no-prototype-builtins
141
+ if (!openings.hasOwnProperty(openingKey)) {
142
+ openings[openingKey] = '00:00 - 00:00' // Horario vacío para el día faltante
143
+ }
144
+ }
145
+
146
+ // Ejemplo de uso con el objeto proporcionado
147
+ const sortedOpenings = sortOpeningsByDay(openings)
148
+
149
+ // Crear el array completo con objetos de tiempo
150
+ // eslint-disable-next-line no-unused-vars
151
+ const fullArray = Object.keys(sortedOpenings).map((key) => {
152
+ const day = getDayFromOpeningKey(key)
153
+ const [schHoSta, schHoEnd] = openings[key].split(' - ').map(timeStr => getTimeObject(timeStr))
154
+ return {
155
+ __typename: 'StoreSchedule',
156
+ schId: '',
157
+ idStore: '',
158
+ schDay: day,
159
+ schHoSta: `${schHoSta?.hours?.toString().padStart(2, '0')}:${schHoSta?.minutes?.toString().padStart(2, '0')}`,
160
+ schHoEnd: `${schHoEnd?.hours?.toString().padStart(2, '0')}:${schHoEnd?.minutes?.toString().padStart(2, '0')}`,
161
+ schState: 1
162
+ }
163
+ })
164
+ getIsOpening(sortedOpenings)
165
+ })()
166
+ }, [dataSchedules])
167
+
168
+ return {
169
+ open,
170
+ openNow
171
+ }
172
+ }