ordering-ui-react-native 0.21.13 → 0.21.14-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 (241) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  6. package/src/components/StripeMethodForm/index.tsx +4 -4
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/types/index.tsx +2 -1
  9. package/src/utils/index.tsx +2 -2
  10. package/themes/business/index.tsx +4 -0
  11. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  12. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  13. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  14. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  15. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  17. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  18. package/themes/business/src/components/Chat/index.tsx +41 -13
  19. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  20. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  21. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  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/PreviousMessages/FooterMessageComponent.tsx +103 -0
  37. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +26 -34
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  40. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  41. package/themes/business/src/components/PreviousOrders/index.tsx +194 -220
  42. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  43. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  44. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  45. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  46. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  47. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  48. package/themes/business/src/components/Sessions/index.tsx +187 -0
  49. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  50. package/themes/business/src/components/StoresList/index.tsx +5 -3
  51. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  52. package/themes/business/src/components/UserProfileForm/index.tsx +98 -43
  53. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  54. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  55. package/themes/business/src/components/shared/OInput.tsx +2 -0
  56. package/themes/business/src/hooks/useLocation.tsx +5 -4
  57. package/themes/business/src/types/index.tsx +21 -1
  58. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  60. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +9 -4
  68. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  69. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +4 -7
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +20 -12
  78. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  79. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  82. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  85. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  87. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  89. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  90. package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
  91. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  92. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  101. package/themes/original/src/components/Cart/index.tsx +32 -9
  102. package/themes/original/src/components/CartContent/index.tsx +96 -58
  103. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  104. package/themes/original/src/components/Checkout/index.tsx +190 -66
  105. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  106. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  107. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  108. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  109. package/themes/original/src/components/Favorite/index.tsx +4 -9
  110. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  111. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  112. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  114. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  117. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  119. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  120. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  121. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  122. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  123. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  124. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  125. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  126. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  128. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  129. package/themes/original/src/components/Home/index.tsx +1 -1
  130. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  131. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  132. package/themes/original/src/components/LoginForm/Otp/index.tsx +48 -39
  133. package/themes/original/src/components/LoginForm/index.tsx +5 -0
  134. package/themes/original/src/components/Messages/index.tsx +9 -4
  135. package/themes/original/src/components/Messages/styles.tsx +1 -1
  136. package/themes/original/src/components/MomentOption/index.tsx +3 -3
  137. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  138. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  139. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  140. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  141. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  142. package/themes/original/src/components/NavBar/index.tsx +3 -1
  143. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  144. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  145. package/themes/original/src/components/Notifications/index.tsx +4 -8
  146. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  147. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  148. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  149. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  150. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  151. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  152. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  156. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  157. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  158. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  160. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  164. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  165. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  166. package/themes/original/src/components/ProductForm/index.tsx +74 -165
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +19 -10
  168. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -1
  169. package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
  170. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
  171. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  172. package/themes/original/src/components/Promotions/index.tsx +4 -4
  173. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  174. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  175. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  176. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  177. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  178. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  179. package/themes/original/src/components/SingleOrderCard/index.tsx +5 -4
  180. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  181. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  182. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  183. package/themes/original/src/components/StripeElementsForm/index.tsx +9 -4
  184. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  185. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  187. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  188. package/themes/original/src/components/UserFormDetails/index.tsx +54 -8
  189. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  190. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  191. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  192. package/themes/original/src/components/UserVerification/index.tsx +3 -1
  193. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  194. package/themes/original/src/components/Wallets/index.tsx +8 -9
  195. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  196. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  197. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  198. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  199. package/themes/original/src/components/shared/OButton.tsx +5 -5
  200. package/themes/original/src/components/shared/OInput.tsx +1 -4
  201. package/themes/original/src/components/shared/OModal.tsx +12 -14
  202. package/themes/original/src/layouts/Container.tsx +5 -3
  203. package/themes/original/src/types/index.tsx +6 -1
  204. package/themes/original/src/utils/index.tsx +124 -0
  205. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  206. package/src/navigators/BottomNavigator.tsx +0 -117
  207. package/src/navigators/CheckoutNavigator.tsx +0 -66
  208. package/src/navigators/HomeNavigator.tsx +0 -202
  209. package/src/navigators/NavigationRef.tsx +0 -7
  210. package/src/navigators/RootNavigator.tsx +0 -269
  211. package/src/pages/Account.tsx +0 -34
  212. package/src/pages/AddressForm.tsx +0 -62
  213. package/src/pages/AddressList.tsx +0 -24
  214. package/src/pages/BusinessProductsList.tsx +0 -81
  215. package/src/pages/BusinessesListing.tsx +0 -43
  216. package/src/pages/CartList.tsx +0 -49
  217. package/src/pages/Checkout.tsx +0 -101
  218. package/src/pages/ForgotPassword.tsx +0 -24
  219. package/src/pages/Help.tsx +0 -23
  220. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  221. package/src/pages/HelpGuide.tsx +0 -23
  222. package/src/pages/HelpOrder.tsx +0 -23
  223. package/src/pages/Home.tsx +0 -36
  224. package/src/pages/IntroductoryTutorial.tsx +0 -170
  225. package/src/pages/Login.tsx +0 -47
  226. package/src/pages/MomentOption.tsx +0 -30
  227. package/src/pages/MultiCheckout.tsx +0 -31
  228. package/src/pages/MultiOrdersDetails.tsx +0 -27
  229. package/src/pages/MyOrders.tsx +0 -40
  230. package/src/pages/NetworkError.tsx +0 -24
  231. package/src/pages/NotFound.tsx +0 -22
  232. package/src/pages/OrderDetails.tsx +0 -25
  233. package/src/pages/ProductDetails.tsx +0 -55
  234. package/src/pages/Profile.tsx +0 -36
  235. package/src/pages/ReviewDriver.tsx +0 -30
  236. package/src/pages/ReviewOrder.tsx +0 -32
  237. package/src/pages/ReviewProducts.tsx +0 -30
  238. package/src/pages/Sessions.tsx +0 -22
  239. package/src/pages/Signup.tsx +0 -53
  240. package/src/pages/SpinnerLoader.tsx +0 -10
  241. package/src/pages/Splash.tsx +0 -21
@@ -36,7 +36,8 @@ export const UserFormDetailsUI = (props: any) => {
36
36
  handleCancelEdit,
37
37
  toggleIsEdit,
38
38
  isCheckout,
39
- isAlsea
39
+ isAlsea,
40
+ allowDriverUpdateData
40
41
  } = props;
41
42
 
42
43
  const theme = useTheme();
@@ -66,9 +67,9 @@ export const UserFormDetailsUI = (props: any) => {
66
67
  const rules: any = {
67
68
  required: isRequiredField(field.code)
68
69
  ? t(
69
- `VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
70
- `${field.name} is required`,
71
- ).replace('_attribute_', t(field.name, field.code))
70
+ `VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
71
+ `${field.name} is required`,
72
+ ).replace('_attribute_', t(field.name, field.code))
72
73
  : null,
73
74
  };
74
75
  if (field.code && field.code === 'email') {
@@ -261,90 +262,93 @@ export const UserFormDetailsUI = (props: any) => {
261
262
  sortInputFields({ values: validationFields?.fields?.checkout })
262
263
  .length > 0 && (
263
264
  <UDWrapper>
264
- {sortInputFields({
265
- values: validationFields.fields?.checkout,
266
- }).map(
267
- (field: any) =>
268
- showField &&
269
- showField(field.code) &&
270
- !isAlsea
271
- && (
272
- <React.Fragment key={field.id}>
273
- <OText style={styles.label}>
274
- {t(field?.code.toUpperCase(), field?.name)}
275
- </OText>
265
+ {allowDriverUpdateData && (
266
+ <>
267
+ {sortInputFields({
268
+ values: validationFields.fields?.checkout,
269
+ }).map(
270
+ (field: any) =>
271
+ showField &&
272
+ showField(field.code) &&
273
+ !isAlsea
274
+ && (
275
+ <React.Fragment key={field.id}>
276
+ <OText style={styles.label}>
277
+ {t(field?.code.toUpperCase(), field?.name)}
278
+ </OText>
276
279
 
277
- <Controller
278
- key={field.id}
279
- control={control}
280
- render={() => (
281
- <OInput
282
- name={field.code}
283
- placeholder={t(
284
- field.code.toUpperCase(),
285
- field?.name,
286
- )}
287
- placeholderTextColor={theme.colors.arrowColor}
288
- style={styles.inputStyle}
289
- icon={
290
- field.code === 'email'
291
- ? theme.images.general.email
292
- : theme.images.general.user
293
- }
294
- autoCapitalize={
295
- field.code === 'email' ? 'none' : 'sentences'
296
- }
297
- isDisabled={!isEdit}
298
- value={
299
- formState?.changes[field.code] ??
300
- (user && user[field.code]) ??
301
- ''
302
- }
303
- onChange={(val: any) => {
304
- field.code !== 'email'
305
- ? setValue(field.code, val.target.value)
306
- : setValue(
307
- field.code,
308
- val.target.value
309
- .toLowerCase()
310
- .replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
311
- );
312
- field.code !== 'email'
313
- ? handleChangeInput(val)
314
- : handleChangeInput({
315
- target: {
316
- name: 'email',
317
- value: val.target.value
280
+ <Controller
281
+ key={field.id}
282
+ control={control}
283
+ render={() => (
284
+ <OInput
285
+ name={field.code}
286
+ placeholder={t(
287
+ field.code.toUpperCase(),
288
+ field?.name,
289
+ )}
290
+ placeholderTextColor={theme.colors.arrowColor}
291
+ style={styles.inputStyle}
292
+ icon={
293
+ field.code === 'email'
294
+ ? theme.images.general.email
295
+ : theme.images.general.user
296
+ }
297
+ autoCapitalize={
298
+ field.code === 'email' ? 'none' : 'sentences'
299
+ }
300
+ isDisabled={!isEdit}
301
+ value={
302
+ formState?.changes[field.code] ??
303
+ (user && user[field.code]) ??
304
+ ''
305
+ }
306
+ onChange={(val: any) => {
307
+ field.code !== 'email'
308
+ ? setValue(field.code, val.target.value)
309
+ : setValue(
310
+ field.code,
311
+ val.target.value
318
312
  .toLowerCase()
319
- .replace(
320
- /[&,()%";:ç?<>{}\\[\]\s]/g,
321
- '',
322
- ),
323
- },
324
- });
325
- }}
326
- autoCorrect={field.code === 'email' && false}
327
- type={
328
- field.code === 'email'
329
- ? 'email-address'
330
- : 'default'
331
- }
332
- returnKeyType="done"
333
- autoCompleteType={
334
- field.code === 'email' ? 'email' : 'off'
335
- }
336
- selectionColor={theme.colors.primary}
337
- color={theme.colors.textGray}
313
+ .replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''),
314
+ );
315
+ field.code !== 'email'
316
+ ? handleChangeInput(val)
317
+ : handleChangeInput({
318
+ target: {
319
+ name: 'email',
320
+ value: val.target.value
321
+ .toLowerCase()
322
+ .replace(
323
+ /[&,()%";:ç?<>{}\\[\]\s]/g,
324
+ '',
325
+ ),
326
+ },
327
+ });
328
+ }}
329
+ autoCorrect={field.code === 'email' && false}
330
+ type={
331
+ field.code === 'email'
332
+ ? 'email-address'
333
+ : 'default'
334
+ }
335
+ returnKeyType="done"
336
+ autoCompleteType={
337
+ field.code === 'email' ? 'email' : 'off'
338
+ }
339
+ selectionColor={theme.colors.primary}
340
+ color={theme.colors.textGray}
341
+ />
342
+ )}
343
+ name={field.code}
344
+ rules={getInputRules(field)}
345
+ defaultValue={user && user[field.code]}
338
346
  />
339
- )}
340
- name={field.code}
341
- rules={getInputRules(field)}
342
- defaultValue={user && user[field.code]}
343
- />
344
- </React.Fragment>
345
- ),
347
+ </React.Fragment>
348
+ ),
349
+ )}
350
+ </>
346
351
  )}
347
-
348
352
  <OText style={styles.label}>{t('PASSWORD', 'Password')}</OText>
349
353
 
350
354
  <Controller
@@ -445,7 +449,7 @@ export const UserFormDetailsUI = (props: any) => {
445
449
  </OText>
446
450
  )}
447
451
 
448
- {!!showInputPhoneNumber && !isAlsea && (
452
+ {!!showInputPhoneNumber && !isAlsea && allowDriverUpdateData && (
449
453
  <WrapperPhone>
450
454
  <PhoneInputNumber
451
455
  data={phoneInputData}
@@ -487,28 +491,28 @@ export const UserFormDetailsUI = (props: any) => {
487
491
  isEdit) ||
488
492
  (watchPassword?.length > 0 && watchConfirmPassword?.length > 0) ||
489
493
  formState?.loading) && (
490
- <View style={{ flex: 1, marginLeft: 5 }}>
491
- <OButton
492
- text={
493
- formState.loading
494
- ? t('UPDATING', 'Updating')
495
- : t('UPDATE', 'Update')
496
- }
497
- bgColor={theme.colors.primary}
498
- textStyle={{
499
- ...styles.btnText,
500
- color: formState.loading
501
- ? theme.colors.textGray
502
- : theme.colors.white,
503
- }}
504
- borderColor={theme.colors.primary}
505
- isDisabled={formState.loading}
506
- imgRightSrc={null}
507
- style={styles.editButton}
508
- onClick={handleSubmit(onSubmit)}
509
- />
510
- </View>
511
- )}
494
+ <View style={{ flex: 1, marginLeft: 5 }}>
495
+ <OButton
496
+ text={
497
+ formState.loading
498
+ ? t('UPDATING', 'Updating')
499
+ : t('UPDATE', 'Update')
500
+ }
501
+ bgColor={theme.colors.primary}
502
+ textStyle={{
503
+ ...styles.btnText,
504
+ color: formState.loading
505
+ ? theme.colors.textGray
506
+ : theme.colors.white,
507
+ }}
508
+ borderColor={theme.colors.primary}
509
+ isDisabled={formState.loading}
510
+ imgRightSrc={null}
511
+ style={styles.editButton}
512
+ onClick={handleSubmit(onSubmit)}
513
+ />
514
+ </View>
515
+ )}
512
516
  </EditButton>
513
517
  )}
514
518
  </>
@@ -11,6 +11,7 @@ import {
11
11
  useToast,
12
12
  useLanguage,
13
13
  useUtils,
14
+ useConfig
14
15
  } from 'ordering-components/native';
15
16
  import {
16
17
  CenterView,
@@ -23,6 +24,7 @@ import { LogoutButton } from '../LogoutButton';
23
24
  import { LanguageSelector } from '../LanguageSelector';
24
25
  import { UserFormDetailsUI } from '../UserFormDetails';
25
26
  import { DriverSchedule } from '../DriverSchedule'
27
+ import { PrinterSettings } from '../PrinterSettings'
26
28
  import ToggleSwitch from 'toggle-switch-react-native';
27
29
  import { UDWrapper } from '../UserFormDetails/styles';
28
30
  import {
@@ -39,7 +41,6 @@ import { NotFoundSource } from '../NotFoundSource';
39
41
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
40
42
  const ProfileUI = (props: ProfileParams) => {
41
43
  const {
42
- navigation,
43
44
  formState,
44
45
  isEdit,
45
46
  validationFields,
@@ -47,15 +48,16 @@ const ProfileUI = (props: ProfileParams) => {
47
48
  toggleIsEdit,
48
49
  cleanFormState,
49
50
  handleToggleAvalaibleStatusDriver,
50
- userState,
51
- isAvailableLoading,
52
- isAlsea
51
+ isAlsea,
52
+ isShowDriverStatus,
53
+ navigation
53
54
  } = props;
54
55
 
55
- const [{ user }] = useSession();
56
- const [state, t] = useLanguage();
56
+ const [{ user, sessionLoading }] = useSession();
57
+ const [, t] = useLanguage();
57
58
  const [, { showToast }] = useToast();
58
59
  const [{ optimizeImage }] = useUtils();
60
+ const [{ configs }] = useConfig()
59
61
  const { errors } = useForm();
60
62
  const theme = useTheme();
61
63
 
@@ -67,10 +69,11 @@ const ProfileUI = (props: ProfileParams) => {
67
69
  },
68
70
  });
69
71
  const [phoneUpdate, setPhoneUpdate] = useState(false);
72
+ const [userState, setUserState] = useState(props.userState)
70
73
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
71
74
  const [phoneToShow, setPhoneToShow] = useState('');
72
75
  const [openModal, setOpenModal] = useState(false)
73
-
76
+ const allowDriverUpdateData = user?.level !== 4 || configs?.allow_driver_update_data?.value === "1"
74
77
  useEffect(() => {
75
78
  if (phoneInputData.phone.cellphone) {
76
79
  const codeNumberPhone = phoneInputData.phone.cellphone.slice(0, 3);
@@ -115,14 +118,15 @@ const ProfileUI = (props: ProfileParams) => {
115
118
  maxWidth: 200,
116
119
  includeBase64: true,
117
120
  },
118
- (response: any) => {
119
- if (response.didCancel) {
121
+ (image: any) => {
122
+ const response = image?.assets?.[0];
123
+ if (response?.didCancel) {
120
124
  console.log('User cancelled image picker');
121
- } else if (response.errorMessage) {
125
+ } else if (response?.errorMessage) {
122
126
  console.log('ImagePicker Error: ', response.errorMessage);
123
127
  showToast(ToastType.Error, response.errorMessage);
124
128
  } else {
125
- if (response.uri) {
129
+ if (response?.uri) {
126
130
  const url = `data:${response.type};base64,${response.base64}`;
127
131
  handleButtonUpdateClick(null, true, url);
128
132
  } else {
@@ -206,6 +210,22 @@ const ProfileUI = (props: ProfileParams) => {
206
210
  }
207
211
  }, [user?.country_phone_code]);
208
212
 
213
+ useEffect(() => {
214
+ setUserState({ ...userState, ...props.userState })
215
+ }, [props.userState])
216
+
217
+ useEffect(() => {
218
+ if (!user?.id) return
219
+
220
+ setUserState({
221
+ ...userState,
222
+ result: {
223
+ error: true,
224
+ result: user
225
+ }
226
+ })
227
+ }, [user, props.isFocused])
228
+
209
229
  const styles = StyleSheet.create({
210
230
  label: {
211
231
  color: theme.colors.textGray,
@@ -254,7 +274,7 @@ const ProfileUI = (props: ProfileParams) => {
254
274
  />
255
275
  )}
256
276
 
257
- {(formState?.loading || state?.loading) && !validationFields.error && (
277
+ {(formState?.loading || sessionLoading) && !validationFields.error && (
258
278
  <View
259
279
  style={{
260
280
  backgroundColor: theme.colors.backgroundLight,
@@ -325,7 +345,7 @@ const ProfileUI = (props: ProfileParams) => {
325
345
  </View>
326
346
  )}
327
347
 
328
- {!formState?.loading && !state?.loading && !validationFields.error && (
348
+ {!(formState?.loading || sessionLoading) && !validationFields.error && (
329
349
  <ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
330
350
  <CenterView>
331
351
  <OIcon
@@ -335,14 +355,15 @@ const ProfileUI = (props: ProfileParams) => {
335
355
  height={150}
336
356
  style={{ borderRadius: 7.2 }}
337
357
  />
338
-
339
- <OIconButton
340
- icon={theme.images.general.camera}
341
- borderColor={theme.colors.clear}
342
- iconStyle={{ width: 21, height: 21 }}
343
- style={{ maxWidth: 40 }}
344
- onClick={() => handleImagePicker()}
345
- />
358
+ {allowDriverUpdateData && (
359
+ <OIconButton
360
+ icon={theme.images.general.camera}
361
+ borderColor={theme.colors.clear}
362
+ iconStyle={{ width: 21, height: 21 }}
363
+ style={{ maxWidth: 40 }}
364
+ onClick={() => handleImagePicker()}
365
+ />
366
+ )}
346
367
  </CenterView>
347
368
 
348
369
  {user?.level === 4 && (
@@ -353,29 +374,33 @@ const ProfileUI = (props: ProfileParams) => {
353
374
  adjustsFontSizeToFit
354
375
  style={{ ...styles.label, paddingHorizontal: 0 }}>
355
376
  {t(
356
- 'AVAILABLE_TO_RECEIVE_ORDERS',
357
- 'Available to receive orders',
377
+ `${!isShowDriverStatus ? 'NOT_' : ''}AVAILABLE_TO_RECEIVE_ORDERS`,
378
+ `${!isShowDriverStatus ? 'You are not ' : ''}Available to receive orders`
358
379
  )}
359
380
  </OText>
360
381
  </View>
361
382
 
362
- {userState.loadingDriver ? (
363
- <ActivityIndicator size="small" color={theme.colors.primary} />
364
- ) : (
365
- <ToggleSwitch
366
- isOn={userState?.result?.result?.available}
367
- onColor={theme.colors.primary}
368
- offColor={theme.colors.offColor}
369
- size="small"
370
- onToggle={() =>
371
- handleToggleAvalaibleStatusDriver &&
372
- handleToggleAvalaibleStatusDriver(
373
- !userState?.result?.result?.available,
374
- )
375
- }
376
- disabled={userState?.loading}
377
- animationSpeed={200}
378
- />
383
+ {isShowDriverStatus && (
384
+ <>
385
+ {userState.loadingDriver ? (
386
+ <ActivityIndicator size="small" color={theme.colors.primary} />
387
+ ) : (
388
+ <ToggleSwitch
389
+ isOn={userState?.result?.result?.available}
390
+ onColor={theme.colors.primary}
391
+ offColor={theme.colors.offColor}
392
+ size="small"
393
+ onToggle={() =>
394
+ handleToggleAvalaibleStatusDriver &&
395
+ handleToggleAvalaibleStatusDriver(
396
+ !userState?.result?.result?.available,
397
+ )
398
+ }
399
+ disabled={userState?.loading}
400
+ animationSpeed={200}
401
+ />
402
+ )}
403
+ </>
379
404
  )}
380
405
  </EnabledStatusDriver>
381
406
  )}
@@ -461,6 +486,7 @@ const ProfileUI = (props: ProfileParams) => {
461
486
  handleCancelEdit={handleCancelEdit}
462
487
  toggleIsEdit={toggleIsEdit}
463
488
  isAlsea={isAlsea}
489
+ allowDriverUpdateData={allowDriverUpdateData}
464
490
  />
465
491
  </View>
466
492
  )}
@@ -478,9 +504,34 @@ const ProfileUI = (props: ProfileParams) => {
478
504
  />
479
505
  </EditButton>
480
506
  )}
481
- <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
507
+ {!props.isBusinessApp ? (
508
+ <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
509
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
510
+ <OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
511
+ <AntDesignIcon size={18} name='right' />
512
+ </View>
513
+ <View style={{
514
+ borderBottomColor: theme.colors.tabBar,
515
+ borderBottomWidth: 1,
516
+ marginTop: 10
517
+ }} />
518
+ </Pressable>
519
+ ) : (
520
+ <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
521
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
522
+ <OText size={16}>{t('PRINTER_SETTINGS', 'Printer Settings')}</OText>
523
+ <AntDesignIcon size={18} name='right' />
524
+ </View>
525
+ <View style={{
526
+ borderBottomColor: theme.colors.tabBar,
527
+ borderBottomWidth: 1,
528
+ marginTop: 10
529
+ }} />
530
+ </Pressable>
531
+ )}
532
+ <Pressable style={{ marginBottom: 10 }} onPress={() => navigation.navigate('Sessions')}>
482
533
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
483
- <OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
534
+ <OText size={16}>{t('SESSIONS', 'Sessions')}</OText>
484
535
  <AntDesignIcon size={18} name='right' />
485
536
  </View>
486
537
  <View style={{
@@ -500,7 +551,11 @@ const ProfileUI = (props: ProfileParams) => {
500
551
  entireModal
501
552
  hideIcons
502
553
  >
503
- <DriverSchedule schedule={user?.schedule} />
554
+ {props.isBusinessApp ? (
555
+ <PrinterSettings onClose={() => setOpenModal(false)} />
556
+ ) : (
557
+ <DriverSchedule schedule={user?.schedule} />
558
+ )}
504
559
  </OModal>
505
560
  </ScrollView>
506
561
  )}