ordering-ui-react-native 0.22.21 → 0.22.22-release

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 (164) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/Checkout/index.tsx +40 -39
  5. package/src/components/StripeMethodForm/index.tsx +4 -2
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/context/OfflineActions/index.tsx +236 -0
  8. package/src/types/index.tsx +2 -1
  9. package/themes/business/index.tsx +2 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  11. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  12. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  13. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  14. package/themes/business/src/components/Chat/index.tsx +15 -3
  15. package/themes/business/src/components/DriverMap/index.tsx +49 -26
  16. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  17. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  18. package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
  19. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  20. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  21. package/themes/business/src/components/MapView/index.tsx +36 -17
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
  23. package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +128 -41
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
  27. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  28. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  30. package/themes/business/src/components/OrderSummary/index.tsx +6 -4
  31. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  32. package/themes/business/src/components/OrdersOption/index.tsx +217 -156
  33. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  34. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  35. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
  36. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  37. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  38. package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
  39. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  40. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +162 -174
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/StoresList/index.tsx +2 -2
  46. package/themes/business/src/components/UserProfileForm/index.tsx +55 -22
  47. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  49. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  50. package/themes/business/src/config/currency.tsx +1010 -0
  51. package/themes/business/src/hooks/useLocation.tsx +16 -12
  52. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  53. package/themes/business/src/types/index.tsx +16 -4
  54. package/themes/business/src/utils/index.tsx +33 -3
  55. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  57. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/original/index.tsx +11 -0
  64. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  65. package/themes/original/src/components/AddressList/index.tsx +8 -7
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
  68. package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
  71. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
  73. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
  77. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  78. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +46 -14
  82. package/themes/original/src/components/CartContent/index.tsx +2 -4
  83. package/themes/original/src/components/Checkout/index.tsx +127 -77
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  87. package/themes/original/src/components/Favorite/index.tsx +1 -5
  88. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  90. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  91. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  92. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  93. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  94. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  95. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  96. package/themes/original/src/components/Help/index.tsx +2 -0
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  98. package/themes/original/src/components/Home/index.tsx +3 -11
  99. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  100. package/themes/original/src/components/LoginForm/index.tsx +12 -9
  101. package/themes/original/src/components/MessageListing/index.tsx +2 -1
  102. package/themes/original/src/components/Messages/index.tsx +27 -19
  103. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  104. package/themes/original/src/components/MomentOption/index.tsx +80 -51
  105. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  106. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  107. package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
  108. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  109. package/themes/original/src/components/MyOrders/index.tsx +2 -2
  110. package/themes/original/src/components/NavBar/index.tsx +7 -4
  111. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  112. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  113. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  114. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
  115. package/themes/original/src/components/OrderDetails/index.tsx +44 -21
  116. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  117. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  118. package/themes/original/src/components/OrderSummary/index.tsx +29 -10
  119. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  120. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  121. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  122. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  123. package/themes/original/src/components/PaymentOptions/index.tsx +4 -3
  124. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  125. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  126. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  127. package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
  128. package/themes/original/src/components/ProductForm/index.tsx +107 -102
  129. package/themes/original/src/components/ProductItemAccordion/index.tsx +50 -43
  130. package/themes/original/src/components/ProductItemAccordion/styles.tsx +0 -3
  131. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  132. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  133. package/themes/original/src/components/Promotions/index.tsx +6 -9
  134. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  135. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  136. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  137. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  138. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  139. package/themes/original/src/components/Sessions/index.tsx +3 -3
  140. package/themes/original/src/components/SignupForm/index.tsx +102 -88
  141. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
  142. package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
  143. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  144. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  145. package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
  146. package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
  147. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  148. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  149. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  151. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  152. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  153. package/themes/original/src/components/UserFormDetails/index.tsx +164 -135
  154. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  155. package/themes/original/src/components/UserVerification/index.tsx +15 -4
  156. package/themes/original/src/components/Wallets/index.tsx +6 -3
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  158. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  159. package/themes/original/src/components/shared/OButton.tsx +5 -4
  160. package/themes/original/src/components/shared/OInput.tsx +4 -8
  161. package/themes/original/src/components/shared/OModal.tsx +7 -2
  162. package/themes/original/src/types/index.tsx +10 -3
  163. package/themes/original/src/utils/index.tsx +30 -1
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,431 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { StarPRNT } from 'react-native-star-prnt';
3
+ import { ActivityIndicator, Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
4
+ import SelectDropdown from 'react-native-select-dropdown'
5
+ import { useLanguage } from 'ordering-components/native'
6
+ import { useTheme } from 'styled-components/native'
7
+ import { useForm, Controller } from 'react-hook-form';
8
+ import FAIcons from 'react-native-vector-icons/FontAwesome'
9
+ import MCIcons from 'react-native-vector-icons/MaterialCommunityIcons'
10
+ import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
11
+ import FeatherIcon from 'react-native-vector-icons/Feather'
12
+ import {
13
+ ContainerEdition,
14
+ BackArrowWrapper,
15
+ BackArrow,
16
+ WrapperIcons,
17
+ WrapperHeader,
18
+ WrapperIcon
19
+ } from './styles'
20
+
21
+ import { Container } from '../../layouts/Container'
22
+ import { OText, OInput, OIcon, OButton } from '../shared'
23
+
24
+ import { PRINTERS } from './printerList'
25
+ import { MessageAlert } from './MessageAlert'
26
+
27
+ const printerList = PRINTERS.map(printer => ({
28
+ ...printer,
29
+ ip: '',
30
+ type: 1,
31
+ nickname: printer.model,
32
+ portName1: `BT:${printer.model.split(' ')[0]}`,
33
+ bt: `BT:${printer.model.split(' ')[0]}`
34
+ }))
35
+
36
+ export const PrinterEdition = (props: any) => {
37
+ const { printer, onClose } = props
38
+
39
+ const HEIGHT_SCREEN = Dimensions.get('window').height
40
+ const [, t] = useLanguage()
41
+ const theme = useTheme()
42
+ const { control, setValue, watch } = useForm()
43
+
44
+ const [currentPrinter, setCurrentPrinter] = useState(printer)
45
+ const [discoverPort, setDiscoverPort] = useState({ loading: false, msg: null })
46
+
47
+ const watchIp = watch('ip')
48
+ const watchBt = watch('bt')
49
+ const watchNickname = watch('nickname')
50
+ const errorIP = !/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(watchIp)
51
+ const errorBT = !/^[^\n]*$/i.test(watchBt) || !watchBt
52
+ const isErrorInput = currentPrinter?.type === 2 ? errorIP : errorBT
53
+ const isErrorNickname = watchNickname && !/^[^\n]*$/i.test(watchNickname)
54
+
55
+ const styles = StyleSheet.create({
56
+ icons: {
57
+ maxWidth: 40,
58
+ height: 40,
59
+ padding: 10,
60
+ alignItems: 'flex-end'
61
+ },
62
+ optionIcons: {
63
+ paddingRight: 10
64
+ },
65
+ inputStyle: {
66
+ borderWidth: 1,
67
+ borderRadius: 8,
68
+ color: theme.colors.arrowColor,
69
+ borderColor: theme.colors.inputSignup,
70
+ backgroundColor: theme.colors.transparent,
71
+ minHeight: 50,
72
+ maxHeight: 50
73
+ },
74
+ savePrinterBtnText: {
75
+ color: theme.colors.white,
76
+ fontSize: 18,
77
+ },
78
+ savePrinterBtn: {
79
+ height: 44,
80
+ borderRadius: 8,
81
+ marginHorizontal: 20
82
+ }
83
+ })
84
+
85
+ const handleChangePrinter = (values: any) => {
86
+ props.handleChangePrinter({
87
+ ...values,
88
+ index: currentPrinter?.index ?? null,
89
+ type: currentPrinter?.type,
90
+ ip: currentPrinter?.ip,
91
+ item: currentPrinter
92
+ })
93
+ }
94
+
95
+ const portDiscovery = async () => {
96
+ try {
97
+ setDiscoverPort({ ...discoverPort, loading: true })
98
+ let printers = await StarPRNT.portDiscovery('Bluetooth');
99
+
100
+ if (printers?.length) {
101
+ setValue('bt', printers[0]?.portName)
102
+ setCurrentPrinter({
103
+ ...currentPrinter,
104
+ ['bt']: printers[0]?.portName
105
+ })
106
+ }
107
+ setTimeout(() => {
108
+ setDiscoverPort({
109
+ ...discoverPort,
110
+ loading: false,
111
+ msg: !printers?.length
112
+ ? t('NO_PRINTERS_FOUND', 'No printers found')
113
+ : null
114
+ })
115
+ }, 1000);
116
+ } catch (e) {
117
+ setValue('bt', currentPrinter?.portName)
118
+ setCurrentPrinter({
119
+ ...currentPrinter,
120
+ ['bt']: currentPrinter?.portName
121
+ })
122
+ }
123
+ }
124
+
125
+ const onSubmit = () => {
126
+ handleChangePrinter({ edit: !!printer, isAdd: !printer })
127
+ onClose && onClose()
128
+ }
129
+
130
+ useEffect(() => {
131
+ currentPrinter?.ip && setValue('ip', currentPrinter?.ip)
132
+ currentPrinter?.bt && setValue('bt', currentPrinter?.bt)
133
+ currentPrinter?.nickname && setValue('nickname', currentPrinter?.nickname)
134
+ }, [currentPrinter?.type])
135
+
136
+ useEffect(() => {
137
+ setCurrentPrinter(printer)
138
+ }, [printer])
139
+
140
+ return (
141
+ <SafeAreaView style={{ flex: 1, marginBottom: 20 }}>
142
+ <Container>
143
+ <ContainerEdition>
144
+ <BackArrowWrapper>
145
+ <BackArrow activeOpacity={1} onPress={() => onClose()}>
146
+ <OIcon
147
+ src={theme.images.general.arrow_left}
148
+ color={theme.colors.textGray}
149
+ />
150
+ </BackArrow>
151
+ </BackArrowWrapper>
152
+ <WrapperHeader>
153
+ <SimpleLineIcons
154
+ name='printer'
155
+ color={theme.colors.textGray}
156
+ size={20}
157
+ style={{
158
+ ...styles.icons,
159
+ paddingLeft: 0,
160
+ color: theme.colors.primary
161
+ }}
162
+ />
163
+ <OText
164
+ size={22}
165
+ style={{ paddingTop: 0 }}
166
+ >
167
+ {t('PRINTER_CONFIGURE', 'Printer Configure')}
168
+ </OText>
169
+ </WrapperHeader>
170
+
171
+ <SelectDropdown
172
+ data={printerList}
173
+ defaultValueByIndex={printerList.findIndex(p => p.model === currentPrinter?.model)}
174
+ dropdownOverlayColor='transparent'
175
+ defaultButtonText={t('SELECT_PRINTER', 'Select printer')}
176
+ buttonTextAfterSelection={item => item.model}
177
+ rowTextForSelection={item => item.model}
178
+ renderDropdownIcon={() => dropDownIcon()}
179
+ buttonStyle={{
180
+ width: '100%',
181
+ backgroundColor: theme.colors.primary,
182
+ borderRadius: 8,
183
+ flexDirection: 'row-reverse',
184
+ justifyContent: 'space-between',
185
+ alignItems: 'center',
186
+ height: 44,
187
+ marginTop: 20,
188
+ }}
189
+ buttonTextStyle={{
190
+ color: theme.colors.white,
191
+ fontSize: 18,
192
+ textAlign: 'left',
193
+ marginHorizontal: 0
194
+ }}
195
+ dropdownStyle={{
196
+ borderRadius: 8,
197
+ borderColor: theme.colors.primary,
198
+ maxHeight: HEIGHT_SCREEN * 0.3
199
+ }}
200
+ rowStyle={{
201
+ borderBottomColor: theme.colors.disabled,
202
+ backgroundColor: theme.colors.gray100,
203
+ height: 40,
204
+ flexDirection: 'column',
205
+ alignItems: 'flex-start',
206
+ paddingTop: 8,
207
+ paddingHorizontal: 14,
208
+ width: '100%'
209
+ }}
210
+ rowTextStyle={{
211
+ marginHorizontal: 0,
212
+ fontSize: 14,
213
+ }}
214
+ onSelect={item => setCurrentPrinter(item)}
215
+ />
216
+ {!!currentPrinter && (
217
+ <WrapperIcons>
218
+ <OText
219
+ size={20}
220
+ style={{ paddingTop: 0, marginBottom: 10 }}
221
+ >
222
+ {`${t('PRINTER_NICKNAME', 'Nickname')}:`}
223
+ </OText>
224
+ <Controller
225
+ control={control}
226
+ name={'nickname'}
227
+ rules={{
228
+ pattern: {
229
+ value: /^[a-zA-Z0-9\s]+$/i,
230
+ message: t('INVALID_ERROR_PRINTER_NICKNAME', 'Invalid Nickname')
231
+ }
232
+ }}
233
+ defaultValue={currentPrinter?.ip ?? ''}
234
+ render={() => (
235
+ <OInput
236
+ placeholder={`${t('EXAMPLE_SHORT', 'Ex:')} ${t('NICKNAME_EXAMPLE_TEXT', 'Kitchen printer')}`}
237
+ placeholderTextColor={theme.colors.arrowColor}
238
+ style={{
239
+ ...styles.inputStyle,
240
+ borderColor: isErrorNickname ? theme.colors.danger500 : theme.colors.tabBar,
241
+ marginBottom: 10
242
+ }}
243
+ value={currentPrinter?.nickname ?? ''}
244
+ selectionColor={theme.colors.primary}
245
+ color={theme.colors.textGray}
246
+ onChange={(value: any) => {
247
+ setValue('nickname', value)
248
+ setCurrentPrinter({
249
+ ...currentPrinter,
250
+ nickname: value
251
+ })
252
+ }}
253
+ />
254
+ )}
255
+ />
256
+ <OText
257
+ size={20}
258
+ style={{ paddingTop: 0, marginBottom: 10 }}
259
+ >
260
+ {`${t('CONNECTION_TYPE', 'Connection type')}:`}
261
+ </OText>
262
+ <WrapperIcon
263
+ activeOpacity={1}
264
+ style={{
265
+ borderColor: currentPrinter?.type === 1 ? theme.colors.primary : theme.colors.textGray
266
+ }}
267
+ onPress={() => {
268
+ setCurrentPrinter({
269
+ ...currentPrinter,
270
+ type: 1,
271
+ ip: '',
272
+ portName: currentPrinter?.portName1
273
+ })
274
+ }}
275
+ >
276
+ <FAIcons
277
+ name='bluetooth'
278
+ size={22}
279
+ {...(currentPrinter?.type === 1 ? { color: theme.colors.primary } : {})}
280
+ style={styles.optionIcons}
281
+ />
282
+ <OText
283
+ size={18}
284
+ style={{ paddingTop: 0 }}
285
+ >
286
+ {t('CONNECTION_VIA_BLUETOOTH', 'Via Bluetooth')}
287
+ </OText>
288
+ </WrapperIcon>
289
+ <WrapperIcon
290
+ activeOpacity={1}
291
+ style={{
292
+ borderColor: currentPrinter?.type === 2 ? theme.colors.primary : theme.colors.textGray
293
+ }}
294
+ onPress={() => setCurrentPrinter({ ...currentPrinter, type: 2 })}
295
+ >
296
+ <MCIcons
297
+ name='access-point-network'
298
+ size={22}
299
+ {...(currentPrinter?.type === 2 ? { color: theme.colors.primary } : {})}
300
+ style={styles.optionIcons}
301
+ />
302
+ <OText
303
+ size={18}
304
+ style={{ paddingTop: 0 }}
305
+ >
306
+ {t('CONNECTION_VIA_LAN', 'Via LAN')}
307
+ </OText>
308
+ </WrapperIcon>
309
+ <View style={{ flexDirection: 'column', marginTop: 30 }}>
310
+ {currentPrinter?.type === 1 && (
311
+ <OText
312
+ size={14}
313
+ color={theme.colors.toastInfo}
314
+ style={{ marginBottom: 10 }}
315
+ >
316
+ {t('SEARCH_AVAILABLE_PRINTER_MESSAGE', 'Use the search icon to find an available printer')}
317
+ </OText>
318
+ )}
319
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
320
+ <Controller
321
+ control={control}
322
+ name={currentPrinter?.type === 2 ? 'ip' : 'bt'}
323
+ rules={{
324
+ required: currentPrinter?.type === 2
325
+ ? t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required')
326
+ : t('VALIDATION_ERROR_BLUETOOTH_PORN_REQUIRED', 'Bluetooth port name is required'),
327
+ pattern: {
328
+ value: currentPrinter?.type === 2
329
+ ? /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i
330
+ : /^[a-zA-Z0-9]+$/i,
331
+ message: currentPrinter?.type === 2
332
+ ? t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
333
+ : t('INVALID_ERROR_BLUETOOTH_PORT_NAME', 'Invalid bluetooth port name')
334
+ }
335
+ }}
336
+ defaultValue={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
337
+ render={() => (
338
+ <OInput
339
+ placeholder={currentPrinter?.type === 2
340
+ ? t('IP_ADDRESS', 'Ip address')
341
+ : t('BLUETOOTH_PORT', 'Bluetooth port')
342
+ }
343
+ placeholderTextColor={theme.colors.arrowColor}
344
+ style={{
345
+ ...styles.inputStyle,
346
+ borderColor: isErrorInput ? theme.colors.danger500 : theme.colors.tabBar
347
+ }}
348
+ value={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
349
+ selectionColor={theme.colors.primary}
350
+ color={theme.colors.textGray}
351
+ onChange={(value: any) => {
352
+ setValue(currentPrinter?.type === 2 ? 'ip' : 'bt', value)
353
+ setCurrentPrinter({
354
+ ...currentPrinter,
355
+ [currentPrinter?.type === 2 ? 'ip' : 'bt']: value
356
+ })
357
+ }}
358
+ />
359
+ )}
360
+ />
361
+ {currentPrinter?.type === 1 && (
362
+ <>
363
+ {!discoverPort.loading ? (
364
+ <FAIcons
365
+ name='search'
366
+ size={22}
367
+ color={theme.colors.primary}
368
+ style={{ marginLeft: 10 }}
369
+ onPress={() => portDiscovery()}
370
+ />
371
+ ) : (
372
+ <ActivityIndicator
373
+ size="small"
374
+ style={{ marginLeft: 10 }}
375
+ color={theme.colors.primary}
376
+ />
377
+ )}
378
+ </>
379
+ )}
380
+ </View>
381
+ </View>
382
+ <OText
383
+ size={14}
384
+ color={theme.colors.tabBar}
385
+ style={{ paddingTop: 5, paddingLeft: 10 }}
386
+ >
387
+ {discoverPort.msg ? (
388
+ <MessageAlert
389
+ message={discoverPort.msg}
390
+ resetMsg={() => setDiscoverPort({ ...discoverPort, msg: null })}
391
+ />
392
+ ) : (
393
+ `${t('EXAMPLE_SHORT', 'Ex:')} ${currentPrinter?.type === 2 ? '8.8.8.8' : currentPrinter?.portName1}`
394
+ )}
395
+ </OText>
396
+ </WrapperIcons>
397
+ )}
398
+ </ContainerEdition>
399
+ </Container>
400
+ <View>
401
+ <OButton
402
+ text={t('SAVE_PRINTER', 'Save Printer')}
403
+ imgRightSrc={null}
404
+ textStyle={styles.savePrinterBtnText}
405
+ style={styles.savePrinterBtn}
406
+ bgColor={theme.colors.primary}
407
+ borderColor={theme.colors.primary}
408
+ isDisabled={
409
+ isErrorNickname ||
410
+ !currentPrinter?.model ||
411
+ currentPrinter?.type === 1 && !currentPrinter?.bt ||
412
+ currentPrinter?.type === 2 && !currentPrinter?.ip
413
+ }
414
+ onClick={() => onSubmit()}
415
+ />
416
+ </View>
417
+ </SafeAreaView>
418
+ )
419
+ }
420
+
421
+ const dropDownIcon = () => {
422
+ const theme = useTheme()
423
+
424
+ return (
425
+ <FeatherIcon
426
+ name='chevron-down'
427
+ size={20}
428
+ color={theme.colors.white}
429
+ />
430
+ )
431
+ }
@@ -0,0 +1,23 @@
1
+ export const PRINTERS = [
2
+ { model: 'mPOP', emulation: 'StarPRNT', printMode: 'append' },
3
+ { model: 'FVP10', emulation: 'StarLine', printMode: 'append' },
4
+ { model: 'TSP100', emulation: 'StarGraphic', printMode: 'appendBitmapText' },
5
+ { model: 'TSP100IV', emulation: 'StarLine', printMode: 'append' },
6
+ { model: 'TSP65011', emulation: 'StarLine', printMode: 'append' },
7
+ { model: 'TSP7001', emulation: 'StarLine', printMode: 'append' },
8
+ { model: 'TSP80011', emulation: 'StarLine', printMode: 'append' },
9
+ { model: 'SP700', emulation: 'StarDotImpact', printMode: 'append' },
10
+ { model: 'SM-S210i', emulation: 'EscPosMobile', printMode: 'append' },
11
+ { model: 'SM-S220i', emulation: 'EscPosMobile', printMode: 'append' },
12
+ { model: 'SM-S230i', emulation: 'EscosMobile', printMode: 'append' },
13
+ { model: 'SM-T300i/T300', emulation: 'EscPosMobile', printMode: 'append' },
14
+ { model: 'SM-T400i', emulation: 'EscosMobile', printMode: 'append' },
15
+ { model: 'SM-L200', emulation: 'StarPRNT', printMode: 'append' },
16
+ { model: 'SM-L300', emulation: 'StarPRNT', printMode: 'append' },
17
+ { model: 'BSC10', emulation: 'EscPos', bt: 'BT:BSC10', printMode: 'append' },
18
+ { model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
19
+ { model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
20
+ { model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
21
+ { model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
22
+ { model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
23
+ ]
@@ -0,0 +1,61 @@
1
+ import styled from "styled-components/native";
2
+
3
+ export const ContainerEdition = styled.View`
4
+ margin-bottom: 50px;
5
+ `
6
+
7
+ export const BackArrowWrapper = styled.View`
8
+ align-items: center;
9
+ flex-direction: row;
10
+ min-height: 33px;
11
+ `
12
+
13
+ export const BackArrow = styled.TouchableOpacity`
14
+ border-width: 0;
15
+ width: 32px;
16
+ height: 32px;
17
+ tint-color: ${(props: any) => props.theme.colors.textGray};
18
+ background-color: ${(props: any) => props.theme.colors.clear};
19
+ border-color: ${(props: any) => props.theme.colors.clear};
20
+ shadow-color: ${(props: any) => props.theme.colors.clear};
21
+ padding-left: 0;
22
+ padding-right: 0;
23
+ `
24
+
25
+ export const WrapperHeader = styled.View`
26
+ flex-direction: row;
27
+ justify-content: flex-start;
28
+ align-items: center;
29
+ width: 100%;
30
+ `
31
+
32
+ export const WrapperIcons = styled.View`
33
+ flex-direction: column;
34
+ justify-content: flex-start;
35
+ margin-top: 20px;
36
+ `
37
+
38
+ export const WrapperIcon = styled.TouchableOpacity`
39
+ flex-direction: row;
40
+ justify-content: flex-start;
41
+ padding: 8px;
42
+ border-width: 1px;
43
+ border-radius: 8px;
44
+ margin-bottom: 10px;
45
+ `
46
+
47
+ export const ContainerList = styled.View`
48
+ flex-direction: row;
49
+ justify-content: space-between;
50
+ width: 100%;
51
+ padding: 5px 5px 5px 0;
52
+ border-bottom-width: 1px;
53
+ border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
54
+ `
55
+
56
+ export const EnabledAutoPrint = styled.View`
57
+ flex-direction: row;
58
+ justify-content: space-between;
59
+ align-items: center;
60
+ padding: 20px 0px 10px;
61
+ `;