ordering-ui-react-native 0.22.14 → 0.22.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.14",
3
+ "version": "0.22.15",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -54,7 +54,7 @@ export const usePrinterCommands = () => {
54
54
  const deliveryDate = (order: any) => {
55
55
  const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
56
56
  const currentDate = new Date();
57
- const receivedDate: any = new Date(dateString);
57
+ const receivedDate: any = new Date(order?.delivery_datetime);
58
58
 
59
59
  const formattedDate = receivedDate <= currentDate
60
60
  ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
@@ -124,6 +124,29 @@ export const usePrinterCommands = () => {
124
124
  return list
125
125
  }
126
126
 
127
+ const replaceChars = (string: string) => {
128
+ const accents: any = {
129
+ 'á': 'a',
130
+ 'é': 'e',
131
+ 'í': 'i',
132
+ 'ó': 'o',
133
+ 'ú': 'u',
134
+ 'Á': 'A',
135
+ 'É': 'E',
136
+ 'Í': 'I',
137
+ 'Ó': 'O',
138
+ 'Ú': 'U',
139
+ 'ü': 'u',
140
+ 'Ü': 'U',
141
+ 'ñ': 'n',
142
+ 'Ñ': 'N',
143
+ "'": '',
144
+ "’": '',
145
+ "`": '',
146
+ };
147
+ return string.replace(/[áéíóúÁÉÍÓÚüÜñÑ'’`]/g, (match: any) => accents[match])
148
+ }
149
+
127
150
  const generateCommands = (order: any, printMode: string = 'append') => {
128
151
  let commands: any = [];
129
152
 
@@ -183,7 +206,7 @@ export const usePrinterCommands = () => {
183
206
  return append === '_separator_'
184
207
  ? { [printMode]: `---------------------------------------${endLine}` }
185
208
  : {
186
- [printMode]: append?.text ?? append,
209
+ [printMode]: replaceChars(append?.text ?? append),
187
210
  ...textProps,
188
211
  ...append?.props
189
212
  }