ordering-ui-react-native 0.21.22 → 0.21.23-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 (235) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +4 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +2 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/Home/index.tsx +5 -1
  21. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  22. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
  26. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  32. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  33. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  35. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  36. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  39. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  46. package/themes/business/src/components/Sessions/index.tsx +187 -0
  47. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  48. package/themes/business/src/components/StoresList/index.tsx +5 -3
  49. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  50. package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
  51. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  52. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  53. package/themes/business/src/components/shared/OInput.tsx +2 -0
  54. package/themes/business/src/hooks/useLocation.tsx +5 -4
  55. package/themes/business/src/types/index.tsx +15 -2
  56. package/themes/business/src/utils/index.tsx +5 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/original/index.tsx +9 -4
  67. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  68. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  69. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  71. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  72. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  75. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  76. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  77. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  79. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  80. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  81. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  82. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  83. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  86. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  87. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +52 -19
  89. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  90. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  98. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  99. package/themes/original/src/components/Cart/index.tsx +32 -9
  100. package/themes/original/src/components/CartContent/index.tsx +96 -58
  101. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  102. package/themes/original/src/components/Checkout/index.tsx +190 -66
  103. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  104. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  105. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  106. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  107. package/themes/original/src/components/Favorite/index.tsx +4 -9
  108. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  109. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  110. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  111. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  118. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  119. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  120. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  121. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  122. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  123. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  124. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  125. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  126. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  127. package/themes/original/src/components/Home/index.tsx +2 -1
  128. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  129. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  131. package/themes/original/src/components/Messages/index.tsx +2 -1
  132. package/themes/original/src/components/Messages/styles.tsx +1 -1
  133. package/themes/original/src/components/MomentOption/index.tsx +4 -3
  134. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  135. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  136. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  138. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  139. package/themes/original/src/components/NavBar/index.tsx +3 -1
  140. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  141. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  142. package/themes/original/src/components/Notifications/index.tsx +4 -8
  143. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  144. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  145. package/themes/original/src/components/OrderDetails/index.tsx +717 -669
  146. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  147. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  148. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  149. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  150. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  151. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  152. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  154. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  155. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  159. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  160. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  161. package/themes/original/src/components/ProductForm/index.tsx +68 -156
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  163. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +105 -91
  165. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  166. package/themes/original/src/components/Promotions/index.tsx +4 -4
  167. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  168. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  169. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  170. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  171. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  172. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  173. package/themes/original/src/components/SignupForm/index.tsx +60 -58
  174. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  175. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  177. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  178. package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
  179. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  180. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  181. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  182. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  183. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  184. package/themes/original/src/components/UserFormDetails/index.tsx +123 -75
  185. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  186. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  187. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  188. package/themes/original/src/components/Wallets/index.tsx +3 -4
  189. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  190. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  191. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  192. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  193. package/themes/original/src/components/shared/OButton.tsx +5 -5
  194. package/themes/original/src/components/shared/OInput.tsx +1 -4
  195. package/themes/original/src/components/shared/OModal.tsx +12 -14
  196. package/themes/original/src/layouts/Container.tsx +5 -3
  197. package/themes/original/src/types/index.tsx +1 -0
  198. package/themes/original/src/utils/index.tsx +125 -1
  199. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  200. package/src/navigators/BottomNavigator.tsx +0 -117
  201. package/src/navigators/CheckoutNavigator.tsx +0 -66
  202. package/src/navigators/HomeNavigator.tsx +0 -202
  203. package/src/navigators/NavigationRef.tsx +0 -7
  204. package/src/navigators/RootNavigator.tsx +0 -269
  205. package/src/pages/Account.tsx +0 -34
  206. package/src/pages/AddressForm.tsx +0 -62
  207. package/src/pages/AddressList.tsx +0 -24
  208. package/src/pages/BusinessProductsList.tsx +0 -81
  209. package/src/pages/BusinessesListing.tsx +0 -43
  210. package/src/pages/CartList.tsx +0 -49
  211. package/src/pages/Checkout.tsx +0 -101
  212. package/src/pages/ForgotPassword.tsx +0 -24
  213. package/src/pages/Help.tsx +0 -23
  214. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  215. package/src/pages/HelpGuide.tsx +0 -23
  216. package/src/pages/HelpOrder.tsx +0 -23
  217. package/src/pages/Home.tsx +0 -36
  218. package/src/pages/IntroductoryTutorial.tsx +0 -170
  219. package/src/pages/Login.tsx +0 -47
  220. package/src/pages/MomentOption.tsx +0 -30
  221. package/src/pages/MultiCheckout.tsx +0 -31
  222. package/src/pages/MultiOrdersDetails.tsx +0 -27
  223. package/src/pages/MyOrders.tsx +0 -40
  224. package/src/pages/NetworkError.tsx +0 -24
  225. package/src/pages/NotFound.tsx +0 -22
  226. package/src/pages/OrderDetails.tsx +0 -25
  227. package/src/pages/ProductDetails.tsx +0 -55
  228. package/src/pages/Profile.tsx +0 -36
  229. package/src/pages/ReviewDriver.tsx +0 -30
  230. package/src/pages/ReviewOrder.tsx +0 -32
  231. package/src/pages/ReviewProducts.tsx +0 -30
  232. package/src/pages/Sessions.tsx +0 -22
  233. package/src/pages/Signup.tsx +0 -53
  234. package/src/pages/SpinnerLoader.tsx +0 -10
  235. package/src/pages/Splash.tsx +0 -21
@@ -5,7 +5,7 @@ import { useTheme } from 'styled-components/native';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { SignupForm } from '../SignupForm'
7
7
 
8
- import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
8
+ import { UDForm, UDLoader, UDWrapper, WrapperPhone, WrapperBirthdate } from './styles';
9
9
 
10
10
  import { OText, OButton, OInput, OModal, OIcon } from '../shared';
11
11
  import { OAlert } from '../../../../../src/components/shared'
@@ -13,6 +13,8 @@ import { OAlert } from '../../../../../src/components/shared'
13
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
14
14
  import { sortInputFields } from '../../utils';
15
15
  import { ListItem } from '../UserProfile/styles';
16
+ import moment from 'moment';
17
+ import { DatePickerUI } from '../DatePicker';
16
18
 
17
19
  export const UserFormDetailsUI = (props: any) => {
18
20
  const {
@@ -81,6 +83,8 @@ export const UserFormDetailsUI = (props: any) => {
81
83
  const [isValid, setIsValid] = useState(false)
82
84
  const [isChanged, setIsChanged] = useState(false)
83
85
  const [isModalOpen, setIsModalOpen] = useState(false)
86
+ const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
87
+ const [showDatePicker, setShowDatePicker] = useState(false)
84
88
  const [phoneInputData, setPhoneInputData] = useState({
85
89
  error: '',
86
90
  phone: {
@@ -92,6 +96,7 @@ export const UserFormDetailsUI = (props: any) => {
92
96
 
93
97
  const isAdmin = user?.level === 0
94
98
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
99
+ const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
95
100
 
96
101
  const handleSuccessSignup = (user: any) => {
97
102
  login({
@@ -206,6 +211,13 @@ export const UserFormDetailsUI = (props: any) => {
206
211
  handleChangeInput(countryCode, true);
207
212
  }
208
213
 
214
+ const _handleChangeDate = (date: any) => {
215
+ setBirthdate(date)
216
+ const _birthdate = moment(date).format('YYYY-MM-DD')
217
+ handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
218
+ setShowDatePicker(false)
219
+ }
220
+
209
221
  const onRemoveAccount = () => {
210
222
  setConfirm({
211
223
  open: true,
@@ -268,6 +280,14 @@ export const UserFormDetailsUI = (props: any) => {
268
280
  }
269
281
  }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
270
282
 
283
+ useEffect(() => {
284
+ if (!validationFields.loading && birthdate) {
285
+ setValue('birthdate', formState?.result?.result
286
+ ? formState?.result?.result?.birthdate
287
+ : formState?.changes?.birthdate ?? (user && user?.birthdate) ?? '')
288
+ }
289
+ }, [validationFields, birthdate])
290
+
271
291
  useEffect(() => {
272
292
  if (!requiredFields || formState?.changes?.length === 0) return
273
293
  const _isValid = requiredFields.every((key: any) => formState?.changes[key])
@@ -284,82 +304,98 @@ export const UserFormDetailsUI = (props: any) => {
284
304
  {sortInputFields({
285
305
  values: validationFields.fields?.checkout,
286
306
  }).map(
287
- (field: any) =>
288
- showField &&
289
- showField(field.code) && ((requiredFields && requiredFields.includes(field.code)) || !requiredFields) && (
290
- <React.Fragment key={field.id}>
291
- <Controller
292
- key={field.id}
293
- control={control}
294
- render={() => (
295
- <>
296
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
297
- {t(field?.code?.toUpperCase(), field?.name)}
298
- </OText>
299
- <OInput
300
- name={field.code}
301
- placeholder={t(
302
- field.code.toUpperCase(),
303
- field?.name,
304
- )}
305
- inputStyle={styles.inputStyle}
306
- style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
307
- autoCapitalize={
308
- field.code === 'email' ? 'none' : 'sentences'
309
- }
310
- isDisabled={false}
311
- value={
312
- formState?.changes[field.code] ??
313
- (user && user[field.code]) ??
314
- ''
315
- }
316
- onChange={(val: any) => {
317
- field.code !== 'email'
318
- ? setValue(field.code, val.target.value)
319
- : setValue(
320
- field.code,
321
- val.target.value
322
- .toLowerCase()
323
- .replace(
324
- /[&,()%";:ç?<>{}\\[\]\s]/g,
325
- '',
326
- ),
327
- );
328
- field.code !== 'email'
329
- ? handleChangeInput(val)
330
- : handleChangeInput({
331
- target: {
332
- name: 'email',
333
- value: val.target.value
307
+ (item: any) => {
308
+ const field = item?.validation_field || item
309
+ return (showField &&
310
+ showField(field.code) && ((requiredFields && requiredFields.includes(field.code)) || !requiredFields) && (
311
+ <React.Fragment key={field.id}>
312
+ <Controller
313
+ key={field.id}
314
+ control={control}
315
+ render={() => (
316
+ <>
317
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
318
+ {t(field?.code?.toUpperCase(), field?.name)}
319
+ </OText>
320
+ <OInput
321
+ name={field.code}
322
+ placeholder={t(
323
+ field.code.toUpperCase(),
324
+ field?.name,
325
+ )}
326
+ inputStyle={styles.inputStyle}
327
+ style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
328
+ autoCapitalize={
329
+ field.code === 'email' ? 'none' : 'sentences'
330
+ }
331
+ isDisabled={false}
332
+ value={
333
+ formState?.changes[field.code] ??
334
+ (user && user[field.code]) ??
335
+ ''
336
+ }
337
+ onChange={(val: any) => {
338
+ field.code !== 'email'
339
+ ? setValue(field.code, val.target.value)
340
+ : setValue(
341
+ field.code,
342
+ val.target.value
334
343
  .toLowerCase()
335
344
  .replace(
336
345
  /[&,()%";:ç?<>{}\\[\]\s]/g,
337
346
  '',
338
347
  ),
339
- },
340
- });
341
- }}
342
- autoCorrect={field.code === 'email' && false}
343
- type={
344
- field.code === 'email'
345
- ? 'email-address'
346
- : 'default'
347
- }
348
- returnKeyType="done"
349
- autoCompleteType={
350
- field.code === 'email' ? 'email' : 'off'
351
- }
352
- />
353
- </>
354
- )}
355
- name={field.code}
356
- rules={getInputRules(field)}
357
- defaultValue={user && user[field.code]}
358
- />
359
- </React.Fragment>
360
- ),
348
+ );
349
+ field.code !== 'email'
350
+ ? handleChangeInput(val)
351
+ : handleChangeInput({
352
+ target: {
353
+ name: 'email',
354
+ value: val.target.value
355
+ .toLowerCase()
356
+ .replace(
357
+ /[&,()%";:ç?<>{}\\[\]\s]/g,
358
+ '',
359
+ ),
360
+ },
361
+ });
362
+ }}
363
+ autoCorrect={field.code === 'email' && false}
364
+ type={
365
+ field.code === 'email'
366
+ ? 'email-address'
367
+ : 'default'
368
+ }
369
+ returnKeyType="done"
370
+ autoCompleteType={
371
+ field.code === 'email' ? 'email' : 'off'
372
+ }
373
+ />
374
+ </>
375
+ )}
376
+ name={field.code}
377
+ rules={getInputRules(field)}
378
+ defaultValue={user && user[field.code]}
379
+ />
380
+ </React.Fragment>
381
+ ))
382
+ },
383
+ )}
384
+ {showInputBirthday && (
385
+ <>
386
+ <WrapperBirthdate>
387
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
388
+ {t('BIRTHDATE', 'Birthdate')}
389
+ </OText>
390
+ <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
391
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6 }}>
392
+ {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
393
+ </OText>
394
+ </TouchableOpacity>
395
+ </WrapperBirthdate>
396
+ <DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
397
+ </>
361
398
  )}
362
-
363
399
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
364
400
  <WrapperPhone>
365
401
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
@@ -468,12 +504,25 @@ export const UserFormDetailsUI = (props: any) => {
468
504
  ? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
469
505
  : t('CONTINUE', 'Continue'))
470
506
  }
471
- bgColor={theme.colors.white}
472
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
507
+ bgColor={theme.colors.primary}
508
+ textStyle={{
509
+ color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
510
+ fontSize: 14
511
+ }}
473
512
  borderColor={theme.colors.primary}
474
513
  isDisabled={!user?.guest_id && (formState.loading || !isValid)}
475
514
  imgRightSrc={null}
476
- style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
515
+ style={{
516
+ borderRadius: 7.6,
517
+ shadowOpacity: 0,
518
+ width: '100%',
519
+ borderWidth: 1,
520
+ marginTop: 20,
521
+ marginBottom: 20,
522
+ backgroundColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.lightGray : theme.colors.primary,
523
+ borderColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.white : theme.colors.primary,
524
+ opacity: !user?.guest_id && (formState.loading || !isValid) ? 0.3 : 1,
525
+ }}
477
526
  onClick={!user?.guest_id ? handleSubmit(onSubmit) : () => setIsModalOpen(true)}
478
527
  />
479
528
  )}
@@ -507,4 +556,3 @@ export const UserFormDetailsUI = (props: any) => {
507
556
  </>
508
557
  );
509
558
  };
510
-
@@ -32,3 +32,10 @@ export const WrapperPhone = styled.View`
32
32
  border-bottom-width: 1px;
33
33
  border-bottom-color: ${(props: any) => props.theme.colors.border};
34
34
  `
35
+
36
+ export const WrapperBirthdate = styled.View`
37
+ margin-bottom: 25px;
38
+ width: 100%;
39
+ border-bottom-width: 1px;
40
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
41
+ `
@@ -20,7 +20,7 @@ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
20
20
  import FontAwesome from 'react-native-vector-icons/FontAwesome'
21
21
  import FastImage from 'react-native-fast-image'
22
22
  import { OAlert } from '../../../../../src/components/shared'
23
-
23
+ import { WebsocketStatus } from '../WebsocketStatus'
24
24
  import {
25
25
  OIcon,
26
26
  OText,
@@ -101,7 +101,7 @@ const ProfileListUI = (props: ProfileParams) => {
101
101
  marginEnd: 14
102
102
  },
103
103
  pagePadding: {
104
- paddingHorizontal: isChewLayout ? 20 : 40
104
+ paddingHorizontal: 20
105
105
  },
106
106
  messageIconStyle: {
107
107
  fontSize: 18,
@@ -270,6 +270,7 @@ const ProfileListUI = (props: ProfileParams) => {
270
270
  <View style={{ height: 17 }} />
271
271
  </Actions>
272
272
  </ListWrap>
273
+ <WebsocketStatus />
273
274
  <OAlert
274
275
  open={confirm.open}
275
276
  title={confirm.title}
@@ -3,6 +3,7 @@ import styled from 'styled-components/native'
3
3
  export const Container = styled.View`
4
4
  display: flex;
5
5
  flex-direction: column;
6
+ width: 100%;
6
7
  `
7
8
 
8
9
  export const TransactionsWrapper = styled.View`
@@ -120,9 +120,7 @@ const WalletsUI = (props: any) => {
120
120
 
121
121
  return (
122
122
  <>
123
- <Container
124
- pdng={Platform.OS === 'ios' ? '10px' : '0'}
125
- >
123
+ <Container>
126
124
  <Header>
127
125
  <View style={{
128
126
  ...{
@@ -131,7 +129,7 @@ const WalletsUI = (props: any) => {
131
129
  flexDirection: !hideWalletsTheme ? 'column' : 'row',
132
130
  justifyContent: !hideWalletsTheme ? 'flex-start' : 'space-between',
133
131
  alignItems: !hideWalletsTheme ? 'flex-start' : 'center',
134
- marginTop: !hideWalletsTheme ? 0 : 10,
132
+ marginTop: !hideWalletsTheme ? Platform.OS === 'ios' ? 20 : 30 : 10,
135
133
  },
136
134
  }}>
137
135
  <NavBar
@@ -141,6 +139,7 @@ const WalletsUI = (props: any) => {
141
139
  showCall={false}
142
140
  paddingTop={10}
143
141
  btnStyle={{ paddingLeft: 0 }}
142
+ isVertical={!hideWalletsTheme}
144
143
  hideArrowLeft={!hideWalletsTheme}
145
144
  />
146
145
  {isChewLayout && !openHistory && (
@@ -3,7 +3,7 @@ import styled from 'styled-components/native'
3
3
  export const Container = styled.View`
4
4
  padding-horizontal: 20px;
5
5
  padding-bottom: 20px;
6
- padding-top: ${(props: any) => props.pdng};
6
+ padding-top: ${(props: any) => props.pdng || 0};
7
7
  `
8
8
  export const Header = styled.View`
9
9
  flex-direction: row;
@@ -0,0 +1,172 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components/native'
3
+ import { TouchableOpacity, View, StyleSheet } from 'react-native'
4
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
5
+ import { useTheme } from 'styled-components/native'
6
+ import RNRestart from 'react-native-restart'
7
+ import { OModal, OButton, OText, OIcon } from '../shared'
8
+
9
+ import {
10
+ Container,
11
+ ModalContainer,
12
+ ModalTitle,
13
+ StatusItemWrapper,
14
+ StatusText
15
+ } from './styles'
16
+
17
+ const SocketStatusUI = (props: any) => {
18
+ const {
19
+ socketStatus,
20
+ connectedDate
21
+ } = props
22
+
23
+ const theme = useTheme()
24
+ const [, t] = useLanguage()
25
+ const [{ parseDate }] = useUtils()
26
+ const [openModal, setOpenModal] = useState(false)
27
+
28
+ const styles = StyleSheet.create({
29
+ btnBackArrow: {
30
+ borderWidth: 0,
31
+ width: 32,
32
+ height: 32,
33
+ tintColor: theme.colors.textGray,
34
+ backgroundColor: theme.colors.clear,
35
+ borderColor: theme.colors.clear,
36
+ shadowColor: theme.colors.clear,
37
+ paddingLeft: 0,
38
+ paddingRight: 0,
39
+ marginBottom: 30,
40
+ marginTop: 30
41
+ },
42
+ })
43
+
44
+ const getStatusColor = (status: number) => {
45
+ switch (status) {
46
+ case 0:
47
+ return '#FF9922';
48
+ case 1:
49
+ return '#00D27A';
50
+ case 2:
51
+ return '#E63757';
52
+ default:
53
+ return '#FF9922';
54
+ }
55
+ }
56
+
57
+ return (
58
+ <Container>
59
+ <TouchableOpacity
60
+ style={{
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ justifyContent: 'center',
64
+ backgroundColor: theme.colors.inputChat,
65
+ borderRadius: 7.6,
66
+ marginVertical: 10,
67
+ paddingVertical: 10,
68
+ paddingHorizontal: 15,
69
+ marginHorizontal: 15
70
+ }}
71
+ activeOpacity={0.6}
72
+ onPress={() => setOpenModal(true)}
73
+ >
74
+ <OText
75
+ style={{ color: theme.colors.backArrow, fontSize: 16, marginBottom: 0, lineHeight: 16 }}
76
+ >
77
+ {t('CONNECTION_STATUS', 'Status')}
78
+ </OText>
79
+ <MaterialIcon
80
+ name='circle'
81
+ size={12}
82
+ color={getStatusColor(socketStatus)}
83
+ style={{ marginLeft: 8 }}
84
+ />
85
+ </TouchableOpacity>
86
+
87
+ <OModal
88
+ open={openModal}
89
+ onClose={() => setOpenModal(false)}
90
+ entireModal
91
+ customClose
92
+ >
93
+ <ModalContainer nestedScrollEnabled={true}>
94
+ <TouchableOpacity
95
+ onPress={() => setOpenModal(false)}
96
+ style={styles.btnBackArrow}
97
+ >
98
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
99
+ </TouchableOpacity>
100
+ <View>
101
+ <ModalTitle>{t('CONNECTION_STATUS', 'Connection status')}</ModalTitle>
102
+ <OText style={{ marginBottom: 20 }}>
103
+ {t('LAST_UPDATE', 'Last update')}: {parseDate(connectedDate)}
104
+ </OText>
105
+ <StatusItemWrapper>
106
+ <MaterialIcon
107
+ name='circle'
108
+ size={12}
109
+ color={getStatusColor(1)}
110
+ style={{ marginTop: 10, marginHorizontal: 8 }}
111
+ />
112
+ <View style={{ marginLeft: 16 }}>
113
+ <StatusText>{t('OK', 'Ok')}</StatusText>
114
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_OK', 'The websocket works normally.')}</OText>
115
+ </View>
116
+ </StatusItemWrapper>
117
+ <StatusItemWrapper>
118
+ <MaterialIcon
119
+ name='circle'
120
+ size={12}
121
+ color={getStatusColor(0)}
122
+ style={{ marginTop: 10, marginHorizontal: 8 }}
123
+ />
124
+ <View style={{ marginLeft: 16 }}>
125
+ <StatusText>{t('CONNECTING', 'Connecting')}</StatusText>
126
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_CONNECTING', 'The websocket is connecting.')}</OText>
127
+ </View>
128
+ </StatusItemWrapper>
129
+ <StatusItemWrapper>
130
+ <MaterialIcon
131
+ name='circle'
132
+ size={12}
133
+ color={getStatusColor(2)}
134
+ style={{ marginTop: 10, marginHorizontal: 8 }}
135
+ />
136
+ <View style={{ marginLeft: 16 }}>
137
+ <StatusText>{t('DISCONNECTED', 'Disconnected')}</StatusText>
138
+ <OText style={{ color: theme.colors.backArrow, fontSize: 14 }}>{t('WEBSOCKET_DISCONNECTED', 'The server is slow, please reload.')}</OText>
139
+ </View>
140
+ </StatusItemWrapper>
141
+
142
+ <View style={{ flexDirection: 'row', marginTop: 50 }}>
143
+ <OButton
144
+ onClick={() => setOpenModal(false)}
145
+ bgColor={theme.colors.white}
146
+ borderColor={theme.colors.primary}
147
+ textStyle={{ color: theme.colors.primary }}
148
+ style={{ borderRadius: 8, height: 48 }}
149
+ text={t('CLOSE', 'Close')}
150
+ />
151
+ <OButton
152
+ onClick={() => RNRestart.Restart()}
153
+ borderColor={theme.colors.primary}
154
+ textStyle={{ color: theme.colors.white }}
155
+ style={{ borderRadius: 8, marginLeft: 16, height: 48 }}
156
+ text={t('UPDATE', 'Update')}
157
+ />
158
+ </View>
159
+ </View>
160
+ </ModalContainer>
161
+ </OModal>
162
+ </Container>
163
+ )
164
+ }
165
+
166
+ export const WebsocketStatus = (props: any) => {
167
+ const socketProps = {
168
+ ...props,
169
+ UIComponent: SocketStatusUI
170
+ }
171
+ return <WebsocketStatusController {...socketProps} />
172
+ }
@@ -0,0 +1,28 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ display: flex;
5
+ flex-direction: column;
6
+ `
7
+ export const ModalContainer = styled.ScrollView`
8
+ padding: 0px 30px;
9
+ `
10
+ export const ModalTitle = styled.Text`
11
+ font-family: Poppins;
12
+ font-style: normal;
13
+ font-weight: bold;
14
+ font-size: 20px;
15
+ color: ${(props: any) => props.theme.colors.textGray};
16
+ margin-bottom: 10px;
17
+ `
18
+ export const StatusItemWrapper = styled.View`
19
+ flex-direction: row;
20
+ margin-bottom: 16px;
21
+ `
22
+ export const StatusText = styled.Text`
23
+ font-family: Poppins;
24
+ font-style: normal;
25
+ font-weight: 500;
26
+ font-size: 18px;
27
+ color: ${(props: any) => props.theme.colors.textGray};
28
+ `
@@ -13,7 +13,7 @@ const HeaderTitle = (props: any) => {
13
13
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
14
14
  style={style ?? {
15
15
  marginTop: Platform.OS === 'android' ? 50 : 30,
16
- paddingHorizontal: props.ph ?? 40,
16
+ paddingHorizontal: props.ph ?? 20,
17
17
  textTransform: 'capitalize',
18
18
  color: props.titleColor || theme.colors.textNormal,
19
19
  }}
@@ -27,9 +27,9 @@ const StyledButton = styled.View<Props>`
27
27
  padding-left: 20px;
28
28
  padding-right: 20px;
29
29
  position: relative;
30
- ${(props: any) => props?.theme?.general?.components?.buttons?.borderRadius && css`
31
- border-radius: ${props?.theme?.general?.components?.buttons?.borderRadius}px;
32
- `}
30
+ ${(props: any) => props?.borderRadius && css`
31
+ border-radius: ${typeof props?.borderRadius === 'string' ? props?.borderRadius : `${props?.borderRadius}px`};
32
+ `}
33
33
  `
34
34
  const StyledButtonDisabled = styled(StyledButton)`
35
35
  background-color: ${(props: any) => props.theme.colors.disabled};
@@ -119,7 +119,7 @@ const OButton = (props: Props): React.ReactElement => {
119
119
  style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
120
120
  disabled={props.isDisabledWithSameStyles}
121
121
  >
122
- <StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius } : { ...props.style, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
122
+ <StyledButton style={{ ...props.style, backgroundColor: theme?.general?.components?.buttons?.color ?? props.bgColor, borderColor: theme?.general?.components?.buttons?.color ?? props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
123
123
  {props.icon ? (
124
124
  <props.icon {...props.iconProps} />
125
125
  ) : null}
@@ -127,7 +127,7 @@ const OButton = (props: Props): React.ReactElement => {
127
127
  <OIcon style={props.imgLeftStyle} src={props.imgLeftSrc} color={theme.colors.textNormal} />
128
128
  ) : null}
129
129
  {props.text ? (
130
- <StyledText style={props.textStyle}>{props.text}</StyledText>
130
+ <StyledText style={{ ...props.textStyle, color: theme?.general?.components?.buttons?.buttonTextColor ?? props?.textStyle?.color }}>{props.text}</StyledText>
131
131
  ) : null}
132
132
  {props.imgRightSrc ? (
133
133
  <EndImage style={props.imgRightStyle} source={props.imgRightSrc} />
@@ -3,7 +3,7 @@ import { ImageSourcePropType, ImageStyle, ViewStyle, TextInputProps, TextStyle }
3
3
  import styled from 'styled-components/native';
4
4
  import OIcon from './OIcon';
5
5
  import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
6
- import { useTheme, css } from 'styled-components/native';
6
+ import { useTheme } from 'styled-components/native';
7
7
 
8
8
  const Input = styled.TextInput`
9
9
  flex-grow: 1;
@@ -53,9 +53,6 @@ const Wrapper = styled.Pressable`
53
53
  align-items: center;
54
54
  justify-content: center;
55
55
  width: 100%;
56
- ${(props: any) => props.theme?.general?.components?.inputs?.borderRadius && css`
57
- border-radius: ${props?.theme?.general?.components?.inputs?.borderRadius};
58
- `}
59
56
  `;
60
57
 
61
58
  const OInput = (props: Props): React.ReactElement => {