ordering-ui-react-native 0.22.14 → 0.22.16
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
|
@@ -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(
|
|
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
|
}
|
|
@@ -232,7 +232,7 @@ export const BusinessControllerUI = React.memo((props: BusinessControllerParams)
|
|
|
232
232
|
</View>
|
|
233
233
|
)}
|
|
234
234
|
{!hideBusinessOffer && (
|
|
235
|
-
getBusinessOffer((business?.offers)) &&
|
|
235
|
+
!!getBusinessOffer((business?.offers)) &&
|
|
236
236
|
<OfferBox
|
|
237
237
|
isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
|
|
238
238
|
isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
|
|
@@ -244,7 +244,7 @@ export const BusinessControllerUI = React.memo((props: BusinessControllerParams)
|
|
|
244
244
|
numberOfLines={2}
|
|
245
245
|
ellipsizeMode='tail'
|
|
246
246
|
lineHeight={13}
|
|
247
|
-
>{t('DISCOUNT', 'Discount')}{' '}{getBusinessOffer((business?.offers))
|
|
247
|
+
>{t('DISCOUNT', 'Discount')}{' '}{getBusinessOffer((business?.offers))}</OText>
|
|
248
248
|
</OfferBox>
|
|
249
249
|
)}
|
|
250
250
|
<BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
|