ordering-ui-react-native 0.15.33 → 0.15.34-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 (169) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  16. package/src/components/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  47. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  48. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  49. package/themes/business/src/components/shared/OModal.tsx +1 -1
  50. package/themes/business/src/types/index.tsx +5 -1
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  55. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  56. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  57. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  58. package/themes/kiosk/src/components/Intro/index.tsx +12 -12
  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/OrderDetails/index.tsx +165 -65
  62. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  63. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  64. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  66. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/kiosk/src/types/index.d.ts +2 -0
  69. package/themes/original/index.tsx +184 -1
  70. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  71. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +56 -16
  78. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +125 -7
  82. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  83. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  86. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +111 -14
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  91. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  92. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  93. package/themes/original/src/components/BusinessesListing/index.tsx +85 -45
  94. package/themes/original/src/components/Cart/index.tsx +21 -17
  95. package/themes/original/src/components/CartContent/index.tsx +2 -2
  96. package/themes/original/src/components/Checkout/index.tsx +59 -48
  97. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  98. package/themes/original/src/components/Favorite/index.tsx +91 -0
  99. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  100. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  101. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  102. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  103. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  104. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  105. package/themes/original/src/components/Help/index.tsx +21 -4
  106. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  107. package/themes/original/src/components/Home/index.tsx +1 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  110. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  111. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  112. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  113. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  114. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  115. package/themes/original/src/components/Messages/index.tsx +6 -1
  116. package/themes/original/src/components/Messages/styles.tsx +1 -3
  117. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  118. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  119. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  120. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  121. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  122. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  123. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  124. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  125. package/themes/original/src/components/OrdersOption/index.tsx +57 -56
  126. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  127. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  128. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  129. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  130. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  131. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  132. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  133. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  134. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  135. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  136. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  137. package/themes/original/src/components/Promotions/index.tsx +250 -0
  138. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  139. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  140. package/themes/original/src/components/Sessions/index.tsx +160 -0
  141. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  142. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  143. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  144. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  145. package/themes/original/src/components/SingleProductCard/index.tsx +82 -30
  146. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  147. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  148. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  149. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  150. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  151. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  152. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  153. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  154. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  155. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  156. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  157. package/themes/original/src/components/Wallets/index.tsx +76 -9
  158. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  159. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  160. package/themes/original/src/components/shared/OModal.tsx +4 -2
  161. package/themes/original/src/components/shared/index.tsx +2 -0
  162. package/themes/original/src/config/constants.tsx +6 -6
  163. package/themes/original/src/types/index.tsx +107 -9
  164. package/themes/original/src/utils/index.tsx +28 -2
  165. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  166. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  167. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  168. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  169. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -1,9 +1,11 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
+ import { RefreshControl } from 'react-native'
2
3
  import { HelpParams } from '../../types'
3
4
  import { useLanguage } from 'ordering-components/native'
4
5
  import NavBar from '../NavBar'
5
6
  import { OText } from '../shared'
6
7
  import { LastOrders } from '../LastOrders'
8
+ import { Container } from '../../layouts/Container'
7
9
 
8
10
  import {
9
11
  HelpSubItem,
@@ -15,13 +17,28 @@ export const Help = (props: HelpParams) => {
15
17
  navigation
16
18
  } = props
17
19
  const [, t] = useLanguage()
20
+ const [refreshing] = useState(false);
21
+ const [refresh, setRefresh] = useState(false)
18
22
 
19
23
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
20
24
  const onRedirect = (route: string, params?: any) => {
21
25
  navigation.navigate(route, params)
22
26
  }
27
+
28
+ const handleOnRefresh = () => {
29
+ setRefresh(true)
30
+ }
31
+
23
32
  return (
24
- <>
33
+ <Container
34
+ noPadding
35
+ refreshControl={
36
+ <RefreshControl
37
+ refreshing={refreshing}
38
+ onRefresh={() => handleOnRefresh()}
39
+ />
40
+ }
41
+ >
25
42
  <NavBar
26
43
  title={t('HELP', 'Help')}
27
44
  titleAlign={'center'}
@@ -48,8 +65,8 @@ export const Help = (props: HelpParams) => {
48
65
 
49
66
  <LastOrdersContainer>
50
67
  <OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
51
- <LastOrders {...props} onRedirect={onRedirect} />
68
+ <LastOrders {...props} onRedirect={onRedirect} refresh={refresh} setRefresh={setRefresh} />
52
69
  </LastOrdersContainer>
53
- </>
70
+ </Container>
54
71
  )
55
72
  }
@@ -20,7 +20,10 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
20
20
  onBusinessClick,
21
21
  navigation,
22
22
  isLoading,
23
- getBusinesses
23
+ getBusinesses,
24
+ favoriteIds,
25
+ setFavoriteIds,
26
+ handleUpdateBusinessList
24
27
  } = props;
25
28
 
26
29
  const [, t] = useLanguage()
@@ -33,6 +36,17 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
33
36
  getBusinesses(true)
34
37
  }, [isLoading])
35
38
 
39
+ useEffect(() => {
40
+ if (!businessesList?.businesses?.length) return
41
+ const ids = [...favoriteIds]
42
+ businessesList.businesses.forEach(business => {
43
+ if (business?.favorite) {
44
+ ids.push(business.id)
45
+ }
46
+ })
47
+ setFavoriteIds([...new Set(ids)])
48
+ }, [businessesList?.businesses?.length])
49
+
36
50
  return (
37
51
  <>
38
52
 
@@ -123,6 +137,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
123
137
  handleCustomClick={onBusinessClick}
124
138
  orderType={orderState?.options?.type}
125
139
  navigation={navigation}
140
+ favoriteIds={favoriteIds}
141
+ setFavoriteIds={setFavoriteIds}
142
+ handleUpdateBusinessList={handleUpdateBusinessList}
126
143
  />
127
144
  </View>
128
145
  )
@@ -36,7 +36,7 @@ export const Home = (props: any) => {
36
36
  {t('WELCOME', 'Welcome!')}
37
37
  </OText>
38
38
  <OText color={theme.colors.white} size={14} style={{ marginBottom: 46 }}>
39
- {t('LETS_START_ORDER', "Let's start to order now")}
39
+ {t('SUBTITLE_HOME', "Let's start to order now")}
40
40
  </OText>
41
41
  <OButton
42
42
  text={t('LOGIN_NOW', 'Login now')}
@@ -18,11 +18,15 @@ import {
18
18
  OrderContainer,
19
19
  OrderInfo
20
20
  } from './styles'
21
+ import { useEffect } from 'react'
21
22
 
22
23
  const LastOrdersUI = (props: LastOrdersParams) => {
23
24
  const {
24
25
  orderList,
25
- onRedirect
26
+ onRedirect,
27
+ loadOrders,
28
+ refresh,
29
+ setRefresh
26
30
  } = props
27
31
  const { loading, error, orders } = orderList
28
32
 
@@ -46,6 +50,13 @@ const LastOrdersUI = (props: LastOrdersParams) => {
46
50
  onRedirect && onRedirect('OrderDetails', { orderId: uuid })
47
51
  }
48
52
 
53
+ useEffect(() => {
54
+ if(refresh){
55
+ loadOrders(false, false, false, true)
56
+ setRefresh && setRefresh(false)
57
+ }
58
+ }, [refresh])
59
+
49
60
  return (
50
61
  <>
51
62
  {loading ? (
@@ -0,0 +1,90 @@
1
+ import React, { useEffect } from 'react'
2
+ import { formatSeconds } from '../../../utils'
3
+ import { StyleSheet, TouchableOpacity } from 'react-native';
4
+ import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
5
+ import { useLanguage } from 'ordering-components/native';
6
+ import { OTPContainer } from './styles';
7
+ import { OText, OButton } from '../../shared';
8
+ import OTPInputView from '@twotalltotems/react-native-otp-input'
9
+ import { useTheme } from 'styled-components/native';
10
+ import { otpParams } from '../../../types'
11
+
12
+ export const Otp = (props: otpParams) => {
13
+ const {
14
+ willVerifyOtpState,
15
+ setWillVerifyOtpState,
16
+ onSubmit,
17
+ handleLoginOtp,
18
+ setAlertState
19
+ } = props
20
+
21
+ const theme = useTheme();
22
+ const [, t] = useLanguage();
23
+ const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
24
+ 600, willVerifyOtpState)
25
+
26
+
27
+ const handleOnSubmit = () => {
28
+ setAlertState({
29
+ open: true,
30
+ title: t('CODE_SENT', 'The code has been sent'),
31
+ })
32
+ resetOtpLeftTime()
33
+ onSubmit()
34
+ }
35
+
36
+ useEffect(() => {
37
+ if (otpLeftTime === 0) {
38
+ setAlertState({
39
+ open: true,
40
+ title: t('TIME_IS_UP', 'Time is up'),
41
+ content: t('PLEASE_RESEND_CODE', 'Please resend code again')
42
+ })
43
+ }
44
+ }, [otpLeftTime])
45
+
46
+ const loginStyle = StyleSheet.create({
47
+ underlineStyleBase: {
48
+ width: 45,
49
+ height: 60,
50
+ borderWidth: 1,
51
+ fontSize: 16
52
+ },
53
+ underlineStyleHighLighted: {
54
+ borderColor: theme.colors.primary,
55
+ color: theme.colors.primary,
56
+ fontSize: 16
57
+ },
58
+ });
59
+
60
+ return (
61
+ <>
62
+ <OTPContainer>
63
+ <OText size={24}>
64
+ {formatSeconds(otpLeftTime)}
65
+ </OText>
66
+ <OTPInputView
67
+ style={{ width: '100%', height: 150 }}
68
+ pinCount={6}
69
+ codeInputFieldStyle={loginStyle.underlineStyleBase}
70
+ codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
71
+ onCodeFilled={(code: string) => handleLoginOtp(code)}
72
+ selectionColor={theme.colors.primary}
73
+ />
74
+ <TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
75
+ <OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
76
+ {t('RESEND_CODE', 'Resend code')}
77
+ </OText>
78
+ </TouchableOpacity>
79
+ <OButton
80
+ onClick={() => setWillVerifyOtpState(false)}
81
+ bgColor={theme.colors.white}
82
+ borderColor={theme.colors.primary}
83
+ textStyle={{ color: theme.colors.primary }}
84
+ style={{ borderRadius: 8, width: '100%' }}
85
+ text={t('CANCEL', 'Cancel')}
86
+ />
87
+ </OTPContainer>
88
+ </>
89
+ )
90
+ }
@@ -0,0 +1,7 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const OTPContainer = styled.View`
4
+ padding: 20px;
5
+ align-items: center;
6
+ flex: 1
7
+ `