ordering-ui-react-native 0.17.41 → 0.17.42-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 (212) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/StripeMethodForm/index.tsx +136 -102
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +4 -4
  9. package/src/types/index.tsx +5 -0
  10. package/src/utils/index.tsx +7 -1
  11. package/themes/business/index.tsx +2 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  13. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  14. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  15. package/themes/business/src/components/Chat/index.tsx +125 -113
  16. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  17. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  18. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  19. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  20. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  21. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +49 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +92 -49
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  29. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  30. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  31. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  33. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  34. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  36. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  37. package/themes/business/src/components/ReviewCustomer/index.tsx +35 -18
  38. package/themes/business/src/components/StoresList/index.tsx +2 -2
  39. package/themes/business/src/components/shared/OLink.tsx +33 -13
  40. package/themes/business/src/components/shared/OModal.tsx +16 -9
  41. package/themes/business/src/components/shared/OText.tsx +8 -2
  42. package/themes/business/src/types/index.tsx +32 -2
  43. package/themes/business/src/utils/index.tsx +44 -1
  44. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  45. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  46. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  50. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  51. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  52. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  57. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  61. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  62. package/themes/kiosk/src/types/index.d.ts +13 -0
  63. package/themes/kiosk/src/utils/index.tsx +15 -0
  64. package/themes/original/index.tsx +6 -0
  65. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  66. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  67. package/themes/original/src/components/AddressList/index.tsx +26 -21
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  69. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  70. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +159 -90
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  73. package/themes/original/src/components/BusinessController/index.tsx +141 -67
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -2
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +351 -326
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -524
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -4
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +106 -79
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +102 -69
  92. package/themes/original/src/components/CartContent/index.tsx +115 -19
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +375 -179
  95. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  96. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  97. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  100. package/themes/original/src/components/Favorite/index.tsx +8 -9
  101. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  102. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  103. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  104. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  105. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  106. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  116. package/themes/original/src/components/Help/index.tsx +8 -8
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  120. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  121. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  122. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  123. package/themes/original/src/components/Home/index.tsx +13 -4
  124. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +139 -75
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +71 -28
  128. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +32 -10
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  134. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  139. package/themes/original/src/components/MyOrders/index.tsx +53 -51
  140. package/themes/original/src/components/NavBar/index.tsx +18 -18
  141. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  142. package/themes/original/src/components/Notifications/index.tsx +46 -50
  143. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +199 -359
  147. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  149. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  150. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  151. package/themes/original/src/components/OrderSummary/index.tsx +87 -59
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  155. package/themes/original/src/components/OrdersOption/index.tsx +70 -65
  156. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  157. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  160. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -4
  164. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  165. package/themes/original/src/components/ProductForm/index.tsx +116 -37
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -13
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +74 -19
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +42 -19
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  189. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  191. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  192. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  194. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  195. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  196. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  197. package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
  198. package/themes/original/src/components/UserProfile/index.tsx +5 -7
  199. package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
  200. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  201. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  202. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  203. package/themes/original/src/components/Wallets/index.tsx +67 -24
  204. package/themes/original/src/components/Wallets/styles.tsx +5 -4
  205. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  206. package/themes/original/src/components/shared/OButton.tsx +6 -2
  207. package/themes/original/src/components/shared/OInput.tsx +16 -2
  208. package/themes/original/src/components/shared/OModal.tsx +3 -3
  209. package/themes/original/src/layouts/Container.tsx +1 -1
  210. package/themes/original/src/types/index.tsx +38 -9
  211. package/themes/original/src/utils/index.tsx +364 -58
  212. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,96 @@
1
+ import React, { useState } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { useLanguage } from 'ordering-components/native';
4
+ import Feather from 'react-native-vector-icons/Feather'
5
+ import { useTheme } from 'styled-components/native';
6
+ import { OText, OButton } from '../../shared';
7
+ import { OModal } from '../../../../../../src/components/shared';
8
+ import { PurchaseGiftCard } from '../PurchaseGiftCard'
9
+ import { RedeemGiftCard } from '../RedeemGiftCard'
10
+
11
+ import {
12
+ Container
13
+ } from './styles'
14
+
15
+ export const GiftCardUI = React.memo((props: any) => {
16
+ const {
17
+ navigation
18
+ } = props
19
+ const [, t] = useLanguage()
20
+ const theme = useTheme()
21
+ const [openModal, setOpenModal] = useState<any>(null)
22
+
23
+ const style = StyleSheet.create({
24
+ title: {
25
+ flexDirection: 'row',
26
+ alignItems: 'center'
27
+ },
28
+ actionWrapper: {
29
+ flexDirection: 'row',
30
+ alignItems: 'center',
31
+ marginTop: 10
32
+ },
33
+ btnStyle: {
34
+ borderRadius: 7.6,
35
+ paddingLeft: 0,
36
+ paddingRight: 0,
37
+ height: 44
38
+ }
39
+ })
40
+
41
+ const handleCustomGoToCheckout = (uuid: any) => {
42
+ setOpenModal(null)
43
+ navigation.navigate('CheckoutNavigator', {
44
+ screen: 'CheckoutPage',
45
+ cartUuid: uuid
46
+ })
47
+ }
48
+
49
+ return (
50
+ <Container>
51
+ <View style={style.title}>
52
+ <OText size={16} color={theme.colors.textNormal} weight='bold' mBottom={0} mRight={12}>{t('GIFT_CARD', 'Gift card')}</OText>
53
+ <Feather name='gift' color={theme.colors.textNormal} size={16} />
54
+ </View>
55
+
56
+ <View style={style.actionWrapper}>
57
+ <OButton
58
+ onClick={() => setOpenModal('purchase')}
59
+ text={t('PURCHASE_GIFT_CARD', 'Purchase gift card')}
60
+ bgColor={theme.colors.primary}
61
+ borderColor={theme.colors.primary}
62
+ textStyle={{ color: 'white', fontSize: 13 }}
63
+ imgRightSrc={null}
64
+ style={{ ...style.btnStyle, marginRight: 14 }}
65
+ />
66
+
67
+ <OButton
68
+ onClick={() => setOpenModal('redeem')}
69
+ text={t('REDEEM_GIFT_CARD', 'Redeem gift card')}
70
+ bgColor={theme.colors.lightPrimary}
71
+ borderColor={theme.colors.lightPrimary}
72
+ textStyle={{ color: theme.colors.primary, fontSize: 13 }}
73
+ imgRightSrc={null}
74
+ style={style.btnStyle}
75
+ />
76
+ </View>
77
+
78
+ <OModal
79
+ open={openModal === 'purchase'}
80
+ onClose={() => setOpenModal(null)}
81
+ entireModal
82
+ >
83
+ <PurchaseGiftCard handleCustomGoToCheckout={handleCustomGoToCheckout} />
84
+ </OModal>
85
+ <OModal
86
+ open={openModal === 'redeem'}
87
+ onClose={() => setOpenModal(null)}
88
+ entireModal
89
+ >
90
+ <RedeemGiftCard
91
+ onClose={() => setOpenModal(null)}
92
+ />
93
+ </OModal>
94
+ </Container>
95
+ )
96
+ })
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ width: 100%;
5
+ `
@@ -0,0 +1,100 @@
1
+ import React from 'react'
2
+ import {
3
+ useLanguage,
4
+ PurchaseGiftCard as PurchaseGiftCardController
5
+ } from 'ordering-components/native'
6
+ import { StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native'
7
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
8
+ import { useTheme } from 'styled-components/native';
9
+ import { OText, OButton, OIcon } from '../../shared';
10
+
11
+ import {
12
+ Container
13
+ } from './styles'
14
+
15
+ const PurchaseGiftCardUI = (props: any) => {
16
+ const {
17
+ productsListState,
18
+ selectedProduct,
19
+ setSelectedProduct,
20
+ handleAccept
21
+ } = props
22
+
23
+ const theme = useTheme()
24
+ const [, t] = useLanguage()
25
+
26
+ const style = StyleSheet.create({
27
+ itemStyle: {
28
+ flexDirection: 'row',
29
+ alignItems: 'center',
30
+ paddingVertical: 15,
31
+ borderBottomWidth: 1,
32
+ borderBottomColor: theme.colors.disabled
33
+ },
34
+ btnStyle: {
35
+ borderRadius: 7.6,
36
+ paddingLeft: 0,
37
+ paddingRight: 0,
38
+ height: 44,
39
+ marginTop: 50
40
+ }
41
+ })
42
+
43
+ return (
44
+ <Container>
45
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('PURCHASE_GIFT_CARD', 'Purchase gift card')}</OText>
46
+ <OText color={theme.colors.textNormal} size={14}>{t('SELECT_ONE_OPTION', 'Select one option')}</OText>
47
+ <ScrollView
48
+ contentContainerStyle={{
49
+ flexGrow: 1
50
+ }}
51
+ >
52
+ {productsListState.loading && (
53
+ [...Array(5).keys()].map(i => (
54
+ <View key={i} style={style.itemStyle}>
55
+ <Placeholder
56
+ Animation={Fade}
57
+ >
58
+ <PlaceholderLine width={80} height={20} style={{ marginBottom: 0 }} />
59
+ </Placeholder>
60
+ </View>
61
+ ))
62
+ )}
63
+ {productsListState.products.map(product => (
64
+ <TouchableOpacity
65
+ key={product.id}
66
+ style={style.itemStyle}
67
+ onPress={() => setSelectedProduct(product)}
68
+ >
69
+ <View style={{ marginRight: 10 }}>
70
+ {selectedProduct?.id === product.id ? (
71
+ <OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
72
+ ) : (
73
+ <OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
74
+ )}
75
+ </View>
76
+ <OText color={theme.colors.textNormal} size={14}>{product.name}</OText>
77
+ </TouchableOpacity>
78
+ ))}
79
+ </ScrollView>
80
+ <OButton
81
+ onClick={() => handleAccept()}
82
+ text={t('ACCEPT', 'Accept')}
83
+ bgColor={theme.colors.primary}
84
+ borderColor={theme.colors.primary}
85
+ textStyle={{ color: 'white', fontSize: 13 }}
86
+ imgRightSrc={null}
87
+ style={style.btnStyle}
88
+ isDisabled={!selectedProduct}
89
+ />
90
+ </Container>
91
+ )
92
+ }
93
+
94
+ export const PurchaseGiftCard = (props: any) => {
95
+ const purchaseGiftCardProps = {
96
+ ...props,
97
+ UIComponent: PurchaseGiftCardUI
98
+ }
99
+ return <PurchaseGiftCardController {...purchaseGiftCardProps} />
100
+ }
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ width: 100%;
5
+ padding-horizontal: 40px;
6
+ flex: 1;
7
+ padding-bottom: 30px;
8
+ `
@@ -0,0 +1,191 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import {
3
+ useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController
4
+ } from 'ordering-components/native'
5
+ import { useForm, Controller } from 'react-hook-form'
6
+ import { StyleSheet, View, Alert } from 'react-native';
7
+ import { useTheme } from 'styled-components/native';
8
+ import { OText, OButton, OInput } from '../../shared';
9
+
10
+ import {
11
+ Container,
12
+ FormController
13
+ } from './styles'
14
+
15
+ const RedeemGiftCardUI = (props: any) => {
16
+ const {
17
+ actionState,
18
+ redeemedGiftCard,
19
+ handleApply,
20
+ onClose,
21
+ setRedeemedGiftCard
22
+ } = props
23
+
24
+ const theme = useTheme()
25
+ const [, t] = useLanguage()
26
+ const { handleSubmit, control, errors } = useForm()
27
+ const [{ parsePrice }] = useUtils()
28
+
29
+ const [codeValue, setCodeValue] = useState('')
30
+
31
+ const style = StyleSheet.create({
32
+ btnStyle: {
33
+ borderRadius: 7.6,
34
+ height: 44,
35
+ marginTop: 20
36
+ },
37
+ inputStyle: {
38
+ borderWidth: 1,
39
+ borderColor: theme.colors.border,
40
+ borderRadius: 7.6,
41
+ },
42
+ })
43
+
44
+ const onSubmit = (values) => {
45
+ handleApply(values)
46
+ }
47
+
48
+ const handleChangeCode = (string: any) => {
49
+ string = string.replace(/-/g, '')
50
+ if (!string) return
51
+ const codeSlices = string.match(/.{1,4}/g)
52
+ string = codeSlices.join('-')
53
+ setCodeValue(string)
54
+ }
55
+
56
+ useEffect(() => {
57
+ if (Object.keys(errors).length > 0) {
58
+ const list = Object.values(errors)
59
+ let stringError = ''
60
+ list.map((item: any, i: number) => {
61
+ stringError += (i + 1) === list.length ? `- ${item.message}` : `- ${item.message}\n`
62
+ })
63
+ Alert.alert(
64
+ t('ERROR', 'Error'),
65
+ stringError,
66
+ [
67
+ { text: t('OK', 'oK'), onPress: () => {} }
68
+ ]
69
+ )
70
+ }
71
+ }, [errors])
72
+
73
+ useEffect(() => {
74
+ if (!actionState.error) return
75
+ let stringError = ''
76
+ if (typeof actionState.error === 'string') {
77
+ stringError = actionState.error
78
+ } else {
79
+ actionState.error.map(item => {
80
+ stringError += `- ${item}\n`
81
+ })
82
+ }
83
+ Alert.alert(
84
+ t('ERROR', 'Error'),
85
+ stringError,
86
+ [
87
+ { text: t('OK', 'oK'), onPress: () => {} }
88
+ ]
89
+ )
90
+ }, [actionState.error])
91
+
92
+ return (
93
+ <Container>
94
+ {!redeemedGiftCard ? (
95
+ <View>
96
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
97
+ <FormController>
98
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('GIFT_CARD_CODE', 'Gift card code')}</OText>
99
+ <Controller
100
+ control={control}
101
+ render={({ onChange, value }: any) => (
102
+ <OInput
103
+ placeholder='XXXX-XXXX-XXXX-XXXX'
104
+ value={codeValue}
105
+ onChange={(val: any) => {
106
+ onChange(val)
107
+ handleChangeCode(val)
108
+ }}
109
+ autoCapitalize='none'
110
+ autoCorrect={false}
111
+ blurOnSubmit={false}
112
+ style={style.inputStyle}
113
+ />
114
+ )}
115
+ name='code'
116
+ rules={{
117
+ required: t('VALIDATION_ERROR_REQUIRED', 'Code is required').replace('_attribute_', t('CODE', 'Code'))
118
+ }}
119
+ defaultValue=""
120
+ />
121
+ </FormController>
122
+ <FormController>
123
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('PASSWORD', 'Password')}</OText>
124
+ <Controller
125
+ control={control}
126
+ render={({ onChange, value }: any) => (
127
+ <OInput
128
+ isSecured
129
+ placeholder={t('PASSWORD', 'Password')}
130
+ value={value}
131
+ onChange={(val: any) => onChange(val)}
132
+ autoCapitalize='none'
133
+ autoCompleteType='password'
134
+ autoCorrect={false}
135
+ blurOnSubmit={false}
136
+ style={style.inputStyle}
137
+ />
138
+ )}
139
+ name='password'
140
+ rules={{
141
+ required: t('VALIDATION_ERROR_REQUIRED', 'Password is required').replace('_attribute_', t('PASSWORD', 'Password'))
142
+ }}
143
+ defaultValue=""
144
+ />
145
+ </FormController>
146
+ <OButton
147
+ onClick={handleSubmit(onSubmit)}
148
+ text={actionState?.loading ? t('LOADING', 'Loading') : t('APPLY_TO_YOUR_BALANCE', 'Apply to your balance')}
149
+ bgColor={theme.colors.primary}
150
+ borderColor={theme.colors.primary}
151
+ textStyle={{ color: 'white', fontSize: 13 }}
152
+ imgRightSrc={null}
153
+ style={style.btnStyle}
154
+ isDisabled={actionState.loading}
155
+ />
156
+ </View>
157
+ ) : (
158
+ <>
159
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('GIFT_CARD', 'Gift card')}</OText>
160
+ <View>
161
+ <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
162
+ <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('AMOUNT', 'Amount')}: {parsePrice(redeemedGiftCard?.amount)}</OText>
163
+ <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('FROM', 'From')}: {redeemedGiftCard?.receiver?.name} {redeemedGiftCard?.receiver?.lastname}</OText>
164
+ {!!redeemedGiftCard?.title && <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TITLE', 'Title')}: {redeemedGiftCard?.title}</OText>}
165
+ {!!redeemedGiftCard?.message && <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('MESSAGES', 'Messages')}: {redeemedGiftCard?.message}</OText>}
166
+ <OButton
167
+ onClick={() => {
168
+ setRedeemedGiftCard(null)
169
+ onClose()
170
+ }}
171
+ text={t('OK', 'Ok')}
172
+ bgColor={theme.colors.primary}
173
+ borderColor={theme.colors.primary}
174
+ textStyle={{ color: 'white', fontSize: 13 }}
175
+ imgRightSrc={null}
176
+ style={style.btnStyle}
177
+ />
178
+ </View>
179
+ </>
180
+ )}
181
+ </Container>
182
+ )
183
+ }
184
+
185
+ export const RedeemGiftCard = (props: any) => {
186
+ const redeemGiftCardProps = {
187
+ ...props,
188
+ UIComponent: RedeemGiftCardUI
189
+ }
190
+ return <RedeemGiftCardController {...redeemGiftCardProps} />
191
+ }
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ padding-horizontal: 40px;
5
+ `
6
+ export const FormController = styled.View`
7
+ margin-bottom: 25px;
8
+ `
@@ -0,0 +1,165 @@
1
+ import React, { useEffect } from 'react'
2
+ import { StyleSheet, Platform, Alert } from 'react-native';
3
+ import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components/native';
4
+ import { useTheme } from 'styled-components/native';
5
+ import { OText, OButton, OInput } from '../../shared';
6
+ import { useForm, Controller } from 'react-hook-form'
7
+
8
+ import {
9
+ Container,
10
+ FormController
11
+ } from './styles'
12
+
13
+
14
+ const SendGiftCardUI = (props: any) => {
15
+ const {
16
+ actionState,
17
+ handleSendGiftCard
18
+ } = props
19
+
20
+ const theme = useTheme()
21
+ const [, t] = useLanguage()
22
+
23
+ const { handleSubmit, control, errors } = useForm()
24
+
25
+ const style = StyleSheet.create({
26
+ btnStyle: {
27
+ borderRadius: 7.6,
28
+ height: 44,
29
+ marginTop: 20
30
+ },
31
+ inputStyle: {
32
+ borderWidth: 1,
33
+ borderColor: theme.colors.border,
34
+ borderRadius: 7.6,
35
+ },
36
+ })
37
+
38
+ const onSubmit = (values) => {
39
+ handleSendGiftCard(values)
40
+ }
41
+
42
+ useEffect(() => {
43
+ if (Object.keys(errors).length > 0) {
44
+ const list = Object.values(errors)
45
+ let stringError = ''
46
+ list.map((item: any, i: number) => {
47
+ stringError += (i + 1) === list.length ? `- ${item.message}` : `- ${item.message}\n`
48
+ })
49
+ Alert.alert(
50
+ t('ERROR', 'Error'),
51
+ stringError,
52
+ [
53
+ { text: t('OK', 'oK'), onPress: () => {} }
54
+ ]
55
+ )
56
+ }
57
+ }, [errors])
58
+
59
+ return (
60
+ <Container>
61
+ <OText color={theme.colors.textNormal} size={20} mBottom={10} style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold' }}>{t('GIFT_CARD_DETAILS', 'Gift Card details')}</OText>
62
+ <FormController>
63
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('TO', 'To')}</OText>
64
+ <Controller
65
+ control={control}
66
+ render={({ onChange, value }: any) => (
67
+ <OInput
68
+ placeholder={t('ENTER_AN_EMAIL', 'Enter an email')}
69
+ value={value}
70
+ onChange={(val: any) => onChange(val)}
71
+ autoCompleteType='email'
72
+ autoCapitalize='none'
73
+ autoCorrect={false}
74
+ type='email-address'
75
+ blurOnSubmit={false}
76
+ style={style.inputStyle}
77
+ />
78
+ )}
79
+ name='email'
80
+ rules={{
81
+ required: t('VALIDATION_ERROR_REQUIRED', 'To email is required').replace('_attribute_', t('EMAIL', 'EMail'))
82
+ }}
83
+ defaultValue=""
84
+ />
85
+ </FormController>
86
+ <FormController>
87
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('FROM', 'From')}</OText>
88
+ <Controller
89
+ control={control}
90
+ render={({ onChange, value }: any) => (
91
+ <OInput
92
+ placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
93
+ value={value}
94
+ onChange={(val: any) => onChange(val)}
95
+ autoCapitalize='none'
96
+ autoCorrect={false}
97
+ blurOnSubmit={false}
98
+ style={style.inputStyle}
99
+ />
100
+ )}
101
+ name='user_name'
102
+ defaultValue=""
103
+ />
104
+ </FormController>
105
+ <FormController>
106
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('TITLE', 'Title')}</OText>
107
+ <Controller
108
+ control={control}
109
+ render={({ onChange, value }: any) => (
110
+ <OInput
111
+ placeholder={t('TITLE', 'Title')}
112
+ value={value}
113
+ onChange={(val: any) => onChange(val)}
114
+ autoCapitalize='none'
115
+ autoCorrect={false}
116
+ blurOnSubmit={false}
117
+ style={style.inputStyle}
118
+ />
119
+ )}
120
+ name='title'
121
+ defaultValue=""
122
+ />
123
+ </FormController>
124
+ <FormController>
125
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('MESSAGES', 'Messages')}</OText>
126
+ <Controller
127
+ control={control}
128
+ render={({ onChange, value }: any) => (
129
+ <OInput
130
+ multiline
131
+ placeholder={t('TYPE_YOUR_MESSAGE_HERE', 'Type your message here')}
132
+ value={value}
133
+ onChange={(val: any) => onChange(val)}
134
+ autoCapitalize='none'
135
+ autoCorrect={false}
136
+ blurOnSubmit={false}
137
+ style={{ ...style.inputStyle, height: 100, alignItems: 'flex-start', }}
138
+ />
139
+ )}
140
+ name='message'
141
+ defaultValue=""
142
+ />
143
+ </FormController>
144
+ <OButton
145
+ onClick={handleSubmit(onSubmit)}
146
+ text={actionState?.loading ? t('LOADING', 'Loading') : t('SEND_GIFT_CARD', 'Send gift card')}
147
+ bgColor={theme.colors.primary}
148
+ borderColor={theme.colors.primary}
149
+ textStyle={{ color: 'white', fontSize: 13 }}
150
+ imgRightSrc={null}
151
+ style={style.btnStyle}
152
+ isDisabled={actionState.loading}
153
+ />
154
+ </Container>
155
+ )
156
+ }
157
+
158
+ export const SendGiftCard = (props: any) => {
159
+ const sendGiftCardProps = {
160
+ ...props,
161
+ showToastMsg: true,
162
+ UIComponent: SendGiftCardUI
163
+ }
164
+ return <SendGiftCardController {...sendGiftCardProps} />
165
+ }
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ padding-horizontal: 40px;
5
+ margin-bottom: 30px;
6
+ `
7
+ export const FormController = styled.View`
8
+ margin-bottom: 25px;
9
+ `
@@ -18,7 +18,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
18
18
  saveLocation,
19
19
  setSaveLocation,
20
20
  handleToggleMap,
21
- locations
21
+ locations,
22
+ isIntGeoCoder
22
23
  } = props
23
24
 
24
25
  const [, t] = useLanguage()
@@ -43,7 +44,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
43
44
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
44
45
  }
45
46
 
46
- const geocodePosition = (pos: { latitude: number, longitude: number }) => {
47
+ const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion ?: boolean) => {
47
48
  Geocoder.from({
48
49
  latitude: pos.latitude,
49
50
  longitude: pos.longitude
@@ -68,7 +69,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
68
69
  }
69
70
  handleChangeAddressMap && handleChangeAddressMap(address, details)
70
71
  setSaveLocation && setSaveLocation(false)
71
- handleToggleMap && handleToggleMap()
72
+ if(!isMovingRegion){
73
+ handleToggleMap && handleToggleMap()
74
+ }
72
75
  } else {
73
76
  setMapErrors && setMapErrors('ERROR_NOT_FOUND_ADDRESS')
74
77
  }
@@ -92,6 +95,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
92
95
  const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
93
96
 
94
97
  if (distance <= _maxLimitLocation) {
98
+ if (!aproxEqual(curPos.latitude, center.lat) || !aproxEqual(curPos.longitude, center.lng)){
99
+ geocodePosition(curPos, true)
100
+ }
95
101
  setMarkerPosition(curPos)
96
102
  setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
97
103
  } else {
@@ -100,6 +106,10 @@ export const GoogleMap = (props: GoogleMapsParams) => {
100
106
  }
101
107
  }
102
108
 
109
+ const aproxEqual = (n1 : number, n2 : number, epsilon = 0.000001) => {
110
+ return Math.abs(n1 - n2) < epsilon
111
+ }
112
+
103
113
  const calculateDistance = (pointA: { lat: number, lng: number }, pointB: { latitude: number, longitude: number }) => {
104
114
 
105
115
  const lat1 = pointA.lat;
@@ -152,8 +162,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
152
162
  }
153
163
 
154
164
  useEffect(() => {
165
+ if (isIntGeoCoder) return
155
166
  Geocoder.init(googleMapsApiKey)
156
- }, [])
167
+ }, [isIntGeoCoder])
157
168
 
158
169
  useEffect(() => {
159
170
  mapRef.current.animateToRegion({
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { RefreshControl } from 'react-native'
2
+ import { Platform, RefreshControl } from 'react-native'
3
3
  import { HelpParams } from '../../types'
4
4
  import { useLanguage } from 'ordering-components/native'
5
5
  import NavBar from '../NavBar'
@@ -31,20 +31,20 @@ export const Help = (props: HelpParams) => {
31
31
 
32
32
  return (
33
33
  <Container
34
+ pt={Platform.OS === 'ios' ? 20 : 10}
34
35
  noPadding
35
36
  refreshControl={
36
- <RefreshControl
37
- refreshing={refreshing}
38
- onRefresh={() => handleOnRefresh()}
39
- />
40
- }
37
+ <RefreshControl
38
+ refreshing={refreshing}
39
+ onRefresh={() => handleOnRefresh()}
40
+ />
41
+ }
41
42
  >
42
43
  <NavBar
43
44
  title={t('HELP', 'Help')}
44
45
  titleAlign={'center'}
45
46
  onActionLeft={goToBack}
46
47
  showCall={false}
47
- paddingTop={10}
48
48
  btnStyle={{ paddingLeft: 0 }}
49
49
  />
50
50
  <HelpSubItem
@@ -53,7 +53,7 @@ export const Help = (props: HelpParams) => {
53
53
  <OText size={14}>{t('HELP_WITH_ORDER', 'Help with an order')}</OText>
54
54
  </HelpSubItem>
55
55
  <HelpSubItem
56
- onPress={() => onRedirect('HelpAccountAndPayment')}
56
+ onPress={() => onRedirect('HelpAccountAndPayment')}
57
57
  >
58
58
  <OText size={14}>{t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}</OText>
59
59
  </HelpSubItem>