ordering-ui-react-native 0.17.71 → 0.17.72-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 (201) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -24
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +17 -15
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +186 -114
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +1 -1
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OLink.tsx +11 -3
  47. package/themes/business/src/components/shared/OModal.tsx +16 -9
  48. package/themes/business/src/components/shared/OText.tsx +6 -1
  49. package/themes/business/src/types/index.tsx +25 -10
  50. package/themes/business/src/utils/index.tsx +29 -2
  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/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  56. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  60. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/original/index.tsx +1 -1
  63. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  64. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  65. package/themes/original/src/components/AddressList/index.tsx +25 -24
  66. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  67. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  68. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  69. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  70. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  71. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  72. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  73. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  74. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  75. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  76. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  77. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  78. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  79. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  81. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  82. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  83. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  84. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  85. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -555
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +77 -79
  92. package/themes/original/src/components/CartContent/index.tsx +117 -20
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +356 -124
  95. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  96. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  97. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  98. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  99. package/themes/original/src/components/Favorite/index.tsx +2 -6
  100. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  101. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  102. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  103. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  104. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  106. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  107. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  108. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  109. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  110. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  113. package/themes/original/src/components/Help/index.tsx +2 -2
  114. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  115. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  116. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  117. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  119. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  120. package/themes/original/src/components/Home/index.tsx +13 -4
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  123. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  124. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  125. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  126. package/themes/original/src/components/Messages/index.tsx +14 -7
  127. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  128. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  129. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  131. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  132. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  133. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  135. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  136. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  137. package/themes/original/src/components/NavBar/index.tsx +20 -17
  138. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  139. package/themes/original/src/components/Notifications/index.tsx +42 -52
  140. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  141. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  142. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  143. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  144. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  146. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  147. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  150. package/themes/original/src/components/OrdersOption/index.tsx +68 -87
  151. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  152. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  153. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  154. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  155. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  157. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  158. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  159. package/themes/original/src/components/ProductForm/index.tsx +104 -29
  160. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -9
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  164. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  167. package/themes/original/src/components/Promotions/index.tsx +2 -2
  168. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  169. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  170. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  171. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  172. package/themes/original/src/components/Sessions/index.tsx +11 -8
  173. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  174. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  177. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  179. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  180. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  184. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  185. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  186. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  187. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  188. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  189. package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
  190. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  191. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  192. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  193. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  194. package/themes/original/src/components/Wallets/index.tsx +66 -30
  195. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  196. package/themes/original/src/components/shared/OButton.tsx +6 -2
  197. package/themes/original/src/components/shared/OInput.tsx +6 -1
  198. package/themes/original/src/components/shared/OModal.tsx +3 -3
  199. package/themes/original/src/types/index.tsx +41 -11
  200. package/themes/original/src/utils/index.tsx +273 -1
  201. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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
+ `
@@ -1,7 +1,7 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- margin-vertical: 20px;
4
+ margin-bottom: 20px;
5
5
  `
6
6
 
7
7
  export const GoogleButton = styled.TouchableOpacity`
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { Dimensions, StyleSheet, View, Platform } from 'react-native';
3
- import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, } from 'react-native-maps'
3
+ import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, Polygon, Circle } from 'react-native-maps'
4
4
  import Geocoder from 'react-native-geocoding';
5
5
  import { useLanguage, useConfig } from 'ordering-components/native'
6
6
  import { GoogleMapsParams } from '../../types';
@@ -18,7 +18,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
18
18
  saveLocation,
19
19
  setSaveLocation,
20
20
  handleToggleMap,
21
- locations
21
+ locations,
22
+ isIntGeoCoder,
23
+ businessZones
22
24
  } = props
23
25
 
24
26
  const [, t] = useLanguage()
@@ -43,7 +45,20 @@ export const GoogleMap = (props: GoogleMapsParams) => {
43
45
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
44
46
  }
45
47
 
46
- const geocodePosition = (pos: { latitude: number, longitude: number }) => {
48
+ const units: any = {
49
+ mi: 1609,
50
+ km: 1000
51
+ }
52
+
53
+ const types: any = [1, 2, 5]
54
+
55
+ const fillStyles = {
56
+ fillColor: 'rgba(44, 123, 229, 0.3)',
57
+ strokeColor: 'rgba(44, 123, 229, 1)',
58
+ strokeWidth: 2
59
+ }
60
+
61
+ const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion ?: boolean) => {
47
62
  Geocoder.from({
48
63
  latitude: pos.latitude,
49
64
  longitude: pos.longitude
@@ -68,7 +83,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
68
83
  }
69
84
  handleChangeAddressMap && handleChangeAddressMap(address, details)
70
85
  setSaveLocation && setSaveLocation(false)
71
- handleToggleMap && handleToggleMap()
86
+ if(!isMovingRegion){
87
+ handleToggleMap && handleToggleMap()
88
+ }
72
89
  } else {
73
90
  setMapErrors && setMapErrors('ERROR_NOT_FOUND_ADDRESS')
74
91
  }
@@ -92,6 +109,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
92
109
  const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
93
110
 
94
111
  if (distance <= _maxLimitLocation) {
112
+ if (!aproxEqual(curPos.latitude, center.lat) || !aproxEqual(curPos.longitude, center.lng)){
113
+ geocodePosition(curPos, true)
114
+ }
95
115
  setMarkerPosition(curPos)
96
116
  setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
97
117
  } else {
@@ -100,6 +120,10 @@ export const GoogleMap = (props: GoogleMapsParams) => {
100
120
  }
101
121
  }
102
122
 
123
+ const aproxEqual = (n1 : number, n2 : number, epsilon = 0.000001) => {
124
+ return Math.abs(n1 - n2) < epsilon
125
+ }
126
+
103
127
  const calculateDistance = (pointA: { lat: number, lng: number }, pointB: { latitude: number, longitude: number }) => {
104
128
 
105
129
  const lat1 = pointA.lat;
@@ -152,8 +176,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
152
176
  }
153
177
 
154
178
  useEffect(() => {
179
+ if (isIntGeoCoder) return
155
180
  Geocoder.init(googleMapsApiKey)
156
- }, [])
181
+ }, [isIntGeoCoder])
157
182
 
158
183
  useEffect(() => {
159
184
  mapRef.current.animateToRegion({
@@ -219,6 +244,36 @@ export const GoogleMap = (props: GoogleMapsParams) => {
219
244
  title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
220
245
  />
221
246
  )}
247
+ {businessZones?.length > 0 && businessZones.filter((item: any) => types.includes(item?.type)).map((businessZone: any, i: number) => (
248
+ <React.Fragment key={i}>
249
+ {businessZone?.type === 2 && Array.isArray(businessZone?.data) && (
250
+ <Polygon
251
+ coordinates={businessZone?.data.map((item: any) => ({ latitude: item.lat, longitude: item.lng}))}
252
+ fillColor={fillStyles.fillColor}
253
+ strokeColor={fillStyles.strokeColor}
254
+ strokeWidth={fillStyles.strokeWidth}
255
+ />
256
+ )}
257
+ {(businessZone.type === 1 && businessZone?.data?.center && businessZone?.data?.radio) && (
258
+ <Circle
259
+ center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
260
+ radius={businessZone?.data.radio * 1000}
261
+ fillColor={fillStyles.fillColor}
262
+ strokeColor={fillStyles.strokeColor}
263
+ strokeWidth={fillStyles.strokeWidth}
264
+ />
265
+ )}
266
+ {(businessZone.type === 5 && businessZone?.data?.distance) && (
267
+ <Circle
268
+ center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
269
+ radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
270
+ fillColor={fillStyles.fillColor}
271
+ strokeColor={fillStyles.strokeColor}
272
+ strokeWidth={fillStyles.strokeWidth}
273
+ />
274
+ )}
275
+ </React.Fragment>
276
+ ))}
222
277
  </MapView>
223
278
  <Alert
224
279
  open={alertState.open}
@@ -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,7 +31,7 @@ export const Help = (props: HelpParams) => {
31
31
 
32
32
  return (
33
33
  <Container
34
- pt={10}
34
+ pt={Platform.OS === 'ios' ? 20 : 10}
35
35
  noPadding
36
36
  refreshControl={
37
37
  <RefreshControl
@@ -9,8 +9,9 @@ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
9
 
10
10
  import {
11
11
  Content,
12
- HeaderWrapper
12
+ Container
13
13
  } from './styles'
14
+ import NavBar from '../NavBar'
14
15
 
15
16
  export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
16
17
  const {
@@ -20,15 +21,6 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
20
21
  const theme = useTheme()
21
22
 
22
23
  const styles = StyleSheet.create({
23
- btnBackArrow: {
24
- borderWidth: 0,
25
- backgroundColor: theme.colors.white,
26
- borderColor: theme.colors.white,
27
- shadowColor: theme.colors.white,
28
- display: 'flex',
29
- justifyContent: 'flex-start',
30
- paddingLeft: 0,
31
- },
32
24
  imageStyle: {
33
25
  width: '100%',
34
26
  height: 300,
@@ -39,26 +31,13 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
39
31
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
40
32
 
41
33
  return (
42
- <>
43
- <HeaderWrapper>
44
- <OButton
45
- imgRightSrc={null}
46
- style={styles.btnBackArrow}
47
- onClick={() => goToBack()}
48
- icon={AntDesignIcon}
49
- iconProps={{
50
- name: 'arrowleft',
51
- size: 26
52
- }}
53
- />
54
- <OText
55
- size={24}
56
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
57
- color={theme.colors.textNormal}
58
- >
59
- {t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}
60
- </OText>
61
- </HeaderWrapper>
34
+ <Container>
35
+ <NavBar
36
+ title={t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}
37
+ onActionLeft={goToBack}
38
+ btnStyle={{ paddingLeft: 0 }}
39
+ showCall={false}
40
+ />
62
41
  <Content>
63
42
  <OText mBottom={20}>
64
43
  -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vel in congue nisl, nisi. Mauris, condimentum auctor sed cras cursus arcu pellentesque.
@@ -78,6 +57,6 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
78
57
  cover
79
58
  />
80
59
  </Content>
81
- </>
60
+ </Container>
82
61
  )
83
62
  }
@@ -4,7 +4,9 @@ export const Content = styled.View`
4
4
  padding-vertical: 20px;
5
5
  margin-bottom: 20px;
6
6
  `
7
- export const HeaderWrapper = styled.View`
8
- padding: 10px 20px 20px 0;
9
- flex-direction: row;
7
+
8
+ export const Container = styled.ScrollView`
9
+ position: relative;
10
+ flex: 1;
11
+ margin: 10px 0;
10
12
  `
@@ -1,14 +1,14 @@
1
1
  import React from 'react'
2
2
  import { useLanguage } from 'ordering-components/native'
3
3
  import { HelpGuideParams } from '../../types'
4
- import { OText, OButton, OIcon } from '../shared'
4
+ import { OText, OIcon } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { StyleSheet, TouchableOpacity } from 'react-native'
6
+ import { Platform, StyleSheet } from 'react-native'
7
7
  import NavBar from '../NavBar'
8
8
  import {
9
- Content
9
+ Content,
10
+ Container
10
11
  } from './styles'
11
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
12
12
 
13
13
  export const HelpGuide = (props: HelpGuideParams) => {
14
14
  const {
@@ -37,7 +37,7 @@ export const HelpGuide = (props: HelpGuideParams) => {
37
37
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
38
38
 
39
39
  return (
40
- <>
40
+ <Container pdng={Platform.OS === 'ios' ? '10px' : '0px'}>
41
41
  <NavBar
42
42
  title={t('GUIDE_TO_ORDERING', 'Guide to Ordering')}
43
43
  onActionLeft={goToBack}
@@ -63,6 +63,6 @@ export const HelpGuide = (props: HelpGuideParams) => {
63
63
  cover
64
64
  />
65
65
  </Content>
66
- </>
66
+ </Container>
67
67
  )
68
68
  }
@@ -4,3 +4,9 @@ export const Content = styled.View`
4
4
  padding-vertical: 20px;
5
5
  margin-bottom: 20px;
6
6
  `
7
+ export const Container = styled.ScrollView`
8
+ position: relative;
9
+ flex: 1;
10
+ margin: 10px 0;
11
+ padding-top: ${(props: any) => props.pdng}
12
+ `