ordering-ui-react-native 0.15.36 → 0.15.38-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 (189) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +8 -2
  5. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -3
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +3 -1
  11. package/src/components/OrderDetails/index.tsx +2 -2
  12. package/src/components/PaymentOptions/index.tsx +9 -16
  13. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  14. package/src/components/SignupForm/index.tsx +3 -1
  15. package/src/components/SingleProductCard/index.tsx +16 -4
  16. package/src/components/StripeElementsForm/index.tsx +27 -48
  17. package/src/components/StripeMethodForm/index.tsx +1 -2
  18. package/src/components/UpsellingProducts/index.tsx +1 -1
  19. package/src/components/UserProfileForm/index.tsx +63 -6
  20. package/src/components/UserProfileForm/styles.tsx +8 -0
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/components/shared/OModal.tsx +1 -1
  23. package/src/config.json +0 -2
  24. package/src/hooks/useCountdownTimer.tsx +26 -0
  25. package/src/navigators/CheckoutNavigator.tsx +6 -0
  26. package/src/navigators/HomeNavigator.tsx +12 -0
  27. package/src/pages/BusinessProductsList.tsx +1 -0
  28. package/src/pages/BusinessesListing.tsx +1 -1
  29. package/src/pages/Checkout.tsx +1 -1
  30. package/src/pages/MultiCheckout.tsx +31 -0
  31. package/src/pages/MultiOrdersDetails.tsx +27 -0
  32. package/src/pages/Sessions.tsx +22 -0
  33. package/src/theme.json +0 -1
  34. package/src/types/index.tsx +5 -11
  35. package/src/utils/index.tsx +68 -1
  36. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  37. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  38. package/themes/business/src/components/Chat/index.tsx +38 -86
  39. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  40. package/themes/business/src/components/Home/index.tsx +128 -55
  41. package/themes/business/src/components/Home/styles.tsx +8 -1
  42. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  43. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  44. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  45. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  46. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  47. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  48. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  49. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  50. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  51. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  52. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  53. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/shared/OModal.tsx +1 -1
  56. package/themes/business/src/types/index.tsx +5 -1
  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/Cart/index.tsx +99 -25
  61. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  62. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  63. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  64. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  65. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  66. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  67. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  69. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +190 -1
  74. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  75. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  76. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  77. package/themes/original/src/components/AddressList/index.tsx +56 -18
  78. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  79. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  80. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  81. package/themes/original/src/components/BusinessController/index.tsx +56 -19
  82. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  83. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  84. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  86. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  87. package/themes/original/src/components/BusinessListingSearch/index.tsx +200 -58
  88. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  89. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  90. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  91. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  92. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  97. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  99. package/themes/original/src/components/BusinessesListing/index.tsx +127 -67
  100. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  101. package/themes/original/src/components/Cart/index.tsx +60 -43
  102. package/themes/original/src/components/CartContent/index.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +49 -35
  104. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  105. package/themes/original/src/components/Favorite/index.tsx +91 -0
  106. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  107. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  108. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  109. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  110. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  111. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  112. package/themes/original/src/components/Help/index.tsx +21 -4
  113. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  114. package/themes/original/src/components/Home/index.tsx +1 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  117. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  118. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  119. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  120. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  121. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  122. package/themes/original/src/components/Messages/index.tsx +6 -1
  123. package/themes/original/src/components/Messages/styles.tsx +1 -3
  124. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  125. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  126. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  128. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  129. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  130. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  132. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  133. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  134. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  135. package/themes/original/src/components/OrderDetails/index.tsx +50 -35
  136. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  137. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  138. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  139. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  140. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  141. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  142. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  143. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  144. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  145. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  146. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  147. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  148. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  149. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  150. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  153. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  154. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  157. package/themes/original/src/components/Promotions/index.tsx +250 -0
  158. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  159. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  160. package/themes/original/src/components/Sessions/index.tsx +160 -0
  161. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  162. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  165. package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  167. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  168. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  169. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  170. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  171. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  172. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  173. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  174. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  175. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  176. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  177. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  178. package/themes/original/src/components/Wallets/index.tsx +76 -9
  179. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  180. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  181. package/themes/original/src/components/shared/OModal.tsx +4 -2
  182. package/themes/original/src/components/shared/index.tsx +2 -0
  183. package/themes/original/src/config/constants.tsx +6 -6
  184. package/themes/original/src/types/index.tsx +132 -9
  185. package/themes/original/src/utils/index.tsx +28 -2
  186. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  187. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  188. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  189. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -5,147 +5,146 @@ import WebView from 'react-native-webview';
5
5
  import { ActivityIndicator } from 'react-native-paper';
6
6
 
7
7
  import {
8
- ToastType,
9
- useToast,
10
- useApi,
11
- useLanguage,
12
- useConfig
8
+ ToastType,
9
+ useToast,
10
+ useApi,
11
+ useLanguage,
12
+ useConfig
13
13
  } from 'ordering-components/native';
14
14
 
15
15
  import { OText } from '../shared';
16
16
 
17
17
  interface PaymentOptionsWebViewParams {
18
- onNavigationRedirect?: Function,
19
- uri?: any,
20
- user?: any,
21
- token?: any,
22
- cart?: any,
23
- currency?: any,
24
- webviewPaymethod?: any,
25
- setShowGateway?: any,
26
- setOpenOrderCreating?: any,
27
- locationId?: any
18
+ onNavigationRedirect?: Function,
19
+ uri?: any,
20
+ user?: any,
21
+ token?: any,
22
+ cart?: any,
23
+ currency?: any,
24
+ webviewPaymethod?: any,
25
+ setShowGateway?: any,
26
+ setOpenOrderCreating?: any,
27
+ locationId?: any
28
28
  }
29
29
  export const PaymentOptionsWebView = (props: PaymentOptionsWebViewParams) => {
30
- const {
31
- onNavigationRedirect,
32
- uri,
33
- user,
34
- token,
35
- cart,
36
- currency,
37
- webviewPaymethod,
38
- setShowGateway,
39
- setOpenOrderCreating,
40
- locationId
41
- } = props
30
+ const {
31
+ onNavigationRedirect,
32
+ uri,
33
+ user,
34
+ token,
35
+ cart,
36
+ currency,
37
+ webviewPaymethod,
38
+ setShowGateway,
39
+ setOpenOrderCreating,
40
+ locationId
41
+ } = props
42
42
 
43
- const webviewRef = useRef<any>(null)
44
- const [, { showToast }] = useToast();
45
- const [ordering] = useApi()
46
- const [{ configs }] = useConfig();
47
- const [, t] = useLanguage();
43
+ const webviewRef = useRef<any>(null)
44
+ const [, { showToast }] = useToast();
45
+ const [ordering] = useApi()
46
+ const [{ configs }] = useConfig();
47
+ const [, t] = useLanguage();
48
48
 
49
+
50
+ const [progClr, setProgClr] = useState('#424242');
51
+ const [prog, setProg] = useState(true);
49
52
 
50
- const [progClr, setProgClr] = useState('#424242');
51
- const [prog, setProg] = useState(true);
52
-
53
- const handleCloseWebview = () => {
53
+ const handleCloseWebview = () => {
54
54
  setProg(true);
55
55
  setShowGateway({ open: false, closedByUser: true })
56
56
  }
57
57
 
58
- const onMessage = (e: any) => {
59
- if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
60
- let payment = JSON.parse(e.nativeEvent.data);
58
+ const onMessage = (e: any) => {
59
+ if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
60
+ let payment = JSON.parse(e.nativeEvent.data);
61
61
 
62
- if (payment === 'api error') {
63
- setShowGateway({ closedByUser: true, open: false })
64
- setProg(true);
65
- }
62
+ if (payment === 'api error') {
63
+ setShowGateway({ closedByUser: true, open: false })
64
+ setProg(true);
65
+ }
66
66
 
67
- if (payment) {
68
- if (payment.error) {
69
- showToast(ToastType.Error, payment.result)
70
- setOpenOrderCreating && setOpenOrderCreating(false)
71
- } else if (payment?.result?.order?.uuid) {
72
- showToast(ToastType.Success, t('ORDER_PLACED_SUCCESSfULLY', 'The order was placed successfully'))
73
- onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: payment?.result?.order?.uuid, isFromCheckout: true })
67
+ if (payment) {
68
+ if (payment.error) {
69
+ showToast(ToastType.Error, payment.result)
70
+ setOpenOrderCreating && setOpenOrderCreating(false)
71
+ } else if (payment?.result?.order?.uuid) {
72
+ showToast(ToastType.Success, t('ORDER_PLACED_SUCCESSfULLY', 'The order was placed successfully'))
73
+ onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: payment?.result?.order?.uuid, isFromCheckout: true})
74
+ }
75
+ setProg(true);
76
+ setShowGateway({ closedByUser: false, open: false })
77
+ }
74
78
  }
75
- setProg(true);
76
- setShowGateway({ closedByUser: false, open: false })
77
- }
78
- }
79
- }
79
+ }
80
80
 
81
- return (
81
+ return (
82
82
  <View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
83
- <Icon
84
- name="x"
85
- size={35}
86
- style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
87
- onPress={handleCloseWebview}
88
- />
89
- <OText
90
- style={{
91
- textAlign: 'center',
92
- fontSize: 16,
93
- fontWeight: 'bold',
94
- color: '#00457C',
95
- marginBottom: 5,
96
- marginTop: 10
97
- }}>
98
- {webviewPaymethod?.gateway === 'paypal' ? (t('PAYPAL_GATEWAY', 'PayPal GateWay')) : (t('SQUARE_PAYMENT', 'Square payment'))}
99
- </OText>
100
- <View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
101
- <ActivityIndicator size={24} color={progClr} />
102
- </View>
103
- <WebView
104
- source={{ uri: uri }}
105
- onMessage={onMessage}
106
- ref={webviewRef}
107
- javaScriptEnabled={true}
108
- javaScriptEnabledAndroid={true}
109
- cacheEnabled={false}
110
- cacheMode='LOAD_NO_CACHE'
111
- style={{ flex: 1 }}
112
- onShouldStartLoadWithRequest={() => true}
113
- onLoadStart={() => {
114
- setProg(true);
115
- setProgClr('#424242');
116
- }}
117
- onLoadProgress={() => {
118
- setProg(true);
119
- setProgClr('#00457C');
120
- }}
121
- onLoad={() => {
122
- setProg(true);
123
- setProgClr('#00457C');
124
- }}
125
- onLoadEnd={(e) => {
126
- const messageParams = locationId ? { locationId, clientId: webviewPaymethod?.credentials?.application_id } : {}
127
- const message = {
128
- action: 'init',
129
- data: {
130
- urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
131
- urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
132
- payData: {
133
- paymethod_id: webviewPaymethod?.id,
134
- amount: cart?.balance ?? cart?.total,
135
- delivery_zone_id: cart?.delivery_zone_id,
136
- user_id: user?.id,
137
- user_name: user?.name
138
- },
139
- currency: configs?.stripe_currency?.value || currency,
140
- userToken: token,
141
- clientId: webviewPaymethod?.credentials?.client_id,
142
- ...messageParams
143
- }
144
- }
145
- setProg(false);
146
- webviewRef?.current?.postMessage?.(JSON.stringify(message))
147
- }}
148
- />
83
+ <Icon
84
+ name="x"
85
+ size={35}
86
+ style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
87
+ onPress={handleCloseWebview}
88
+ />
89
+ <OText
90
+ style={{
91
+ textAlign: 'center',
92
+ fontSize: 16,
93
+ fontWeight: 'bold',
94
+ color: '#00457C',
95
+ marginBottom: 5,
96
+ marginTop: 10
97
+ }}>
98
+ {webviewPaymethod?.gateway === 'paypal' ? (t('PAYPAL_GATEWAY', 'PayPal GateWay')) : (t('SQUARE_PAYMENT', 'Square payment'))}
99
+ </OText>
100
+ <View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
101
+ <ActivityIndicator size={24} color={progClr} />
102
+ </View>
103
+ <WebView
104
+ source={{ uri: uri }}
105
+ onMessage={onMessage}
106
+ ref={webviewRef}
107
+ javaScriptEnabled={true}
108
+ javaScriptEnabledAndroid={true}
109
+ cacheEnabled={false}
110
+ cacheMode='LOAD_NO_CACHE'
111
+ style={{ flex: 1 }}
112
+ onShouldStartLoadWithRequest={() => true}
113
+ onLoadStart={() => {
114
+ setProg(true);
115
+ setProgClr('#424242');
116
+ }}
117
+ onLoadProgress={() => {
118
+ setProg(true);
119
+ setProgClr('#00457C');
120
+ }}
121
+ onLoad={() => {
122
+ setProg(true);
123
+ setProgClr('#00457C');
124
+ }}
125
+ onLoadEnd={(e) => {
126
+ const messageParams = locationId ? { locationId } : {}
127
+ const message = {
128
+ action: 'init',
129
+ data: {
130
+ urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
131
+ urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
132
+ payData: {
133
+ paymethod_id: webviewPaymethod?.id,
134
+ amount: cart?.balance ?? cart?.total,
135
+ delivery_zone_id: cart?.delivery_zone_id,
136
+ user_id: user?.id,
137
+ user_name: user?.name
138
+ },
139
+ currency: configs?.stripe_currency?.value || currency,
140
+ userToken: token,
141
+ clientId: webviewPaymethod?.credentials?.client_id,
142
+ ...messageParams
143
+ }
144
+ }
145
+ setProg(false);
146
+ webviewRef?.current?.postMessage?.(JSON.stringify(message))
147
+ }}
148
+ />
149
149
  </View>
150
- )
151
- }
150
+ )}
@@ -115,6 +115,8 @@ const SignupFormUI = (props: SignupParams) => {
115
115
  const phoneRef = useRef<any>(null)
116
116
  const passwordRef = useRef<any>(null)
117
117
 
118
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
119
+
118
120
  const anySocialButtonActivated = ((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
119
121
  (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) ||
120
122
  (configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null)
@@ -543,7 +545,7 @@ const SignupFormUI = (props: SignupParams) => {
543
545
  handleSuccessFacebookLogin={handleSuccessFacebook}
544
546
  />
545
547
  )}
546
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
548
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
547
549
  <GoogleLogin
548
550
  notificationState={notificationState}
549
551
  webClientId={configs?.google_login_client_id?.value}
@@ -10,6 +10,7 @@ import {
10
10
  import { StyleSheet } from 'react-native'
11
11
  import { OText, OIcon } from '../shared'
12
12
  import { useTheme } from 'styled-components/native'
13
+ import FastImage from 'react-native-fast-image'
13
14
 
14
15
  export const SingleProductCard = (props: SingleProductCardParams) => {
15
16
  const {
@@ -77,10 +78,21 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
77
78
  activeOpacity={1}
78
79
  onPress={() => onProductClick?.(product)}
79
80
  >
80
- <OIcon
81
- url={optimizeImage(product?.images, 'h_200,c_limit')}
82
- style={styles.productStyle}
83
- />
81
+ {product?.images ? (
82
+ <FastImage
83
+ style={styles.productStyle}
84
+ source={{
85
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
86
+ priority: FastImage.priority.normal,
87
+ }}
88
+ resizeMode={FastImage.resizeMode.cover}
89
+ />
90
+ ) : (
91
+ <OIcon
92
+ src={theme?.images?.dummies?.product}
93
+ style={styles.productStyle}
94
+ />
95
+ )}
84
96
  <CardInfo>
85
97
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
86
98
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
@@ -7,11 +7,10 @@ import {
7
7
  useConfirmSetupIntent,
8
8
  createPaymentMethod
9
9
  } from '@stripe/stripe-react-native';
10
- import configs from '../../config.json'
10
+
11
11
  import { ErrorMessage } from './styles';
12
12
 
13
13
  import { StripeElementsForm as StripeFormController } from './naked';
14
- import { StripeMethodForm } from '../StripeMethodForm';
15
14
  import { OButton, OText } from '../shared';
16
15
  import { useTheme } from 'styled-components/native';
17
16
 
@@ -23,10 +22,6 @@ const StripeElementsFormUI = (props: any) => {
23
22
  businessId,
24
23
  requirements,
25
24
  stripeTokenHandler,
26
- methodsPay,
27
- paymethod,
28
- onCancel,
29
- cart
30
25
  } = props;
31
26
 
32
27
  const theme = useTheme();
@@ -126,49 +121,33 @@ const StripeElementsFormUI = (props: any) => {
126
121
  <View style={styles.container}>
127
122
  {publicKey ? (
128
123
  <View style={{ flex: 1 }}>
129
- <StripeProvider
130
- publishableKey={publicKey}
131
- merchantIdentifier={`merchant.${configs.apple_app_id}`}
132
- >
133
- {methodsPay?.includes(paymethod) ? (
134
- <StripeMethodForm
135
- handleSource={handleSource}
136
- onCancel={onCancel}
137
- cart={cart}
138
- setErrors={setErrors}
139
- paymethod={paymethod}
140
- devMode={publicKey?.includes('test')}
141
- />
142
- ) : (
143
- <CardField
144
- postalCodeEnabled={true}
145
- cardStyle={{
146
- backgroundColor: '#FFFFFF',
147
- textColor: '#000000',
148
- }}
149
- style={{
150
- width: '100%',
151
- height: 50,
152
- marginVertical: 30,
153
- zIndex: 9999,
154
- }}
155
- onCardChange={(cardDetails: any) => setCard(cardDetails)}
156
- />
157
- )}
158
- </StripeProvider>
159
- {!methodsPay?.includes(paymethod) && (
160
- <OButton
161
- text={t('SAVE_CARD', 'Save card')}
162
- bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
163
- borderColor={isCompleted ? theme.colors.primary :theme.colors.backgroundGray}
164
- style={styles.btnAddStyle}
165
- textStyle={{color: 'white'}}
166
- imgRightSrc={null}
167
- onClick={() => handleSaveCard()}
168
- isDisabled={!isCompleted}
169
- isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
124
+ <StripeProvider publishableKey={publicKey}>
125
+ <CardField
126
+ postalCodeEnabled={true}
127
+ cardStyle={{
128
+ backgroundColor: '#FFFFFF',
129
+ textColor: '#000000',
130
+ }}
131
+ style={{
132
+ width: '100%',
133
+ height: 50,
134
+ marginVertical: 30,
135
+ zIndex: 9999,
136
+ }}
137
+ onCardChange={(cardDetails: any) => setCard(cardDetails)}
170
138
  />
171
- )}
139
+ </StripeProvider>
140
+ <OButton
141
+ text={t('SAVE_CARD', 'Save card')}
142
+ bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
143
+ borderColor={isCompleted ? theme.colors.primary :theme.colors.backgroundGray}
144
+ style={styles.btnAddStyle}
145
+ textStyle={{color: 'white'}}
146
+ imgRightSrc={null}
147
+ onClick={() => handleSaveCard()}
148
+ isDisabled={!isCompleted}
149
+ isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
150
+ />
172
151
  {!!errors && (
173
152
  <ErrorMessage>
174
153
  <OText
@@ -102,7 +102,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
102
102
  shippingMethods: [
103
103
  {
104
104
  amount: cart?.balance?.toString() ?? cart?.total?.toString?.(),
105
- identifier: 'DPS',
105
+ identifier: 'standard',
106
106
  label: 'Courier',
107
107
  detail: 'Delivery',
108
108
  type: 'final',
@@ -125,7 +125,6 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
125
125
  last4: paymentMethod.Card.last4
126
126
  }
127
127
  })
128
- onCancel()
129
128
  }
130
129
  }
131
130
 
@@ -37,7 +37,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
37
37
  imageStyle: {
38
38
  width: 120,
39
39
  height: 90,
40
- resizeMode: 'cover',
40
+ resizeMode: 'contain',
41
41
  borderRadius: 10
42
42
  },
43
43
  closeUpsellingButton: {
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import {
3
+ UserFormDetails as UserProfileController,
3
4
  useSession,
4
5
  useLanguage,
5
6
  } from 'ordering-components/native';
@@ -13,6 +14,7 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
13
14
  import Ionicons from 'react-native-vector-icons/Ionicons'
14
15
 
15
16
  import {
17
+ OAlert,
16
18
  OIcon,
17
19
  OText
18
20
  } from '../shared';
@@ -20,18 +22,24 @@ import {
20
22
  Container,
21
23
  Names,
22
24
  UserInfoContainer,
23
- LanguageContainer
25
+ LanguageContainer,
26
+ RemoveAccountContainer
24
27
  } from './styles';
25
28
 
26
- export const UserProfileForm = (props: ProfileParams) => {
29
+ export const UserProfileFormUI = (props: ProfileParams) => {
27
30
  const {
28
- navigation
31
+ navigation,
32
+ handleRemoveAccount,
33
+ removeAccountState
29
34
  } = props;
30
35
 
31
36
  const theme = useTheme();
32
- const [{ user }] = useSession();
37
+ const [{ user }, { logout }] = useSession();
33
38
  const [, t] = useLanguage();
34
39
 
40
+ const isAdmin = user?.level === 0
41
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
42
+
35
43
  const styles = StyleSheet.create({
36
44
  linkStyle: {
37
45
  color: theme.colors.primary,
@@ -44,6 +52,9 @@ export const UserProfileForm = (props: ProfileParams) => {
44
52
  },
45
53
  iconStyle: {
46
54
  fontSize: 24
55
+ },
56
+ removeAccount: {
57
+ flexDirection: 'row'
47
58
  }
48
59
  });
49
60
 
@@ -78,13 +89,31 @@ export const UserProfileForm = (props: ProfileParams) => {
78
89
  },
79
90
  chevronUp: {
80
91
  display: 'none'
81
- }
92
+ },
82
93
  })
83
94
 
84
95
  const onRedirect = (route: string, params?: any) => {
85
96
  navigation.navigate(route, params)
86
97
  }
87
98
 
99
+ const onRemoveAccount = () => {
100
+ setConfirm({
101
+ open: true,
102
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
103
+ title: t('ACCOUNT_ALERT', 'Account alert'),
104
+ handleOnAccept: () => {
105
+ setConfirm({ ...confirm, open: false })
106
+ handleRemoveAccount && handleRemoveAccount(user?.id)
107
+ }
108
+ })
109
+ }
110
+
111
+ useEffect(() => {
112
+ if (removeAccountState?.result === 'OK') {
113
+ logout()
114
+ }
115
+ }, [removeAccountState])
116
+
88
117
  return (
89
118
  <Container>
90
119
  <View>
@@ -134,7 +163,35 @@ export const UserProfileForm = (props: ProfileParams) => {
134
163
  <LanguageSelector pickerStyle={_pickerStyle} />
135
164
  </LanguageContainer>
136
165
  <LogoutButton />
166
+ <RemoveAccountContainer>
167
+ <TouchableOpacity
168
+ disabled={isAdmin}
169
+ style={styles.removeAccount}
170
+ onPress={() => onRemoveAccount()}
171
+ activeOpacity={0.7}
172
+ >
173
+ <OIcon src={theme.images.general.user} width={20} color={theme.colors.black} style={{ marginEnd: 14 }} />
174
+ <OText size={14} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1, top: 1 }} color={theme.colors.red}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
175
+ </TouchableOpacity>
176
+ </RemoveAccountContainer>
137
177
  </View>
178
+ <OAlert
179
+ open={confirm.open}
180
+ title={confirm.title}
181
+ content={confirm.content}
182
+ onAccept={confirm.handleOnAccept}
183
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
184
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
185
+ />
138
186
  </Container>
139
187
  );
140
188
  };
189
+
190
+ export const UserProfileForm = (props: any) => {
191
+ const profileProps = {
192
+ ...props,
193
+ UIComponent: UserProfileFormUI,
194
+ useSessionUser: true
195
+ };
196
+ return <UserProfileController {...profileProps} />;
197
+ };
@@ -35,3 +35,11 @@ export const LanguageContainer = styled.View`
35
35
  align-items: center;
36
36
  margin-bottom: 10px;
37
37
  `
38
+
39
+ export const RemoveAccountContainer = styled.View`
40
+ flex-direction: row;
41
+ justify-content: flex-start;
42
+ align-items: center;
43
+ margin-bottom: 10px;
44
+ margin-top: 15px;
45
+ `
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 43px;
5
+ padding: 0 30px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
- flex-wrap: wrap;
24
23
  `
25
24
 
26
25
  export const WrappCountdown = styled.View`
@@ -78,7 +78,7 @@ const OModal = (props: Props): React.ReactElement => {
78
78
  animationType="slide"
79
79
  transparent={isTransparent}
80
80
  visible={open}
81
- onRequestClose={() => { onClose() }}
81
+ onRequestClose={() => { onClose && onClose() }}
82
82
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
83
83
  >
84
84
  {isAvoidKeyBoardView ? (
package/src/config.json CHANGED
@@ -3,8 +3,6 @@
3
3
  "notification_app": "orderingapp",
4
4
  "app_name": "Ordering",
5
5
  "project": "reactdemo",
6
- "apple_app_id": "com.delivery",
7
- "android_app_id": "com.delivery",
8
6
  "api": {
9
7
  "url": "https://apiv4.ordering.co",
10
8
  "language": "en",
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState } from 'react'
2
+
3
+ /**
4
+ * Hook for countdown seconds
5
+ * @param {int} initialCount
6
+ * @param {boolean} start
7
+ */
8
+ export function useCountdownTimer (initialCount : number, start : boolean) {
9
+ const [count, setCount] = useState(initialCount)
10
+
11
+ useEffect(() => {
12
+ if (start) {
13
+ const secondsLeft = setInterval(() => {
14
+ setCount(c => c - (c === 0 ? 0 : 1))
15
+ }, 1000)
16
+ return () => clearInterval(secondsLeft)
17
+ }
18
+ }, [start])
19
+
20
+ return [
21
+ count,
22
+ setCount,
23
+ /** reset */
24
+ () => { setCount(initialCount) }
25
+ ]
26
+ }
@@ -6,6 +6,7 @@ import AddressForm from '../pages/AddressForm'
6
6
  import CartList from '../pages/CartList'
7
7
  import CheckoutPage from '../pages/Checkout';
8
8
  import BusinessProductsList from '../pages/BusinessProductsList';
9
+ import MultiCheckout from '../pages/MultiCheckout';
9
10
 
10
11
  const Stack = createStackNavigator();
11
12
 
@@ -53,6 +54,11 @@ const CheckoutNavigator = (props: any) => {
53
54
  component={AddressForm}
54
55
  options={{ headerShown: false }}
55
56
  />
57
+ <Stack.Screen
58
+ name="MultiCheckout"
59
+ children={() => <MultiCheckout {...checkoutProps} />}
60
+ options={{ headerShown: false }}
61
+ />
56
62
  </Stack.Navigator>
57
63
  );
58
64
  }