ordering-ui-react-native 0.21.48-test → 0.21.48-test-3

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 (41) hide show
  1. package/package.json +2 -3
  2. package/src/components/StripeMethodForm/index.tsx +3 -2
  3. package/themes/business/index.tsx +0 -5
  4. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  5. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  6. package/themes/business/src/components/MapView/index.tsx +6 -2
  7. package/themes/business/src/components/OrderDetails/Delivery.tsx +11 -6
  8. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +12 -0
  9. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  10. package/themes/business/src/components/OrderSummary/index.tsx +3 -10
  11. package/themes/business/src/components/OrdersOption/index.tsx +2 -0
  12. package/themes/business/src/components/PreviousOrders/OrderList.tsx +17 -12
  13. package/themes/business/src/components/PreviousOrders/index.tsx +77 -65
  14. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  15. package/themes/original/index.tsx +6 -2
  16. package/themes/original/src/components/BusinessInformation/index.tsx +0 -1
  17. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  18. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -1
  19. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  20. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  21. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  22. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +22 -402
  23. package/themes/original/src/components/Checkout/index.tsx +9 -1
  24. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  25. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  26. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  27. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  28. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  29. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  30. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  31. package/themes/original/src/components/MultiCheckout/index.tsx +138 -16
  32. package/themes/original/src/components/NavBar/index.tsx +0 -1
  33. package/themes/original/src/components/OrderDetails/index.tsx +8 -4
  34. package/themes/original/src/components/OrderProgress/index.tsx +2 -1
  35. package/themes/original/src/components/PaymentOptions/index.tsx +4 -2
  36. package/themes/original/src/components/ProductForm/index.tsx +1 -2
  37. package/themes/original/src/components/UserFormDetails/index.tsx +35 -1
  38. package/themes/original/src/components/Wallets/index.tsx +1 -0
  39. package/themes/original/src/components/Wallets/styles.tsx +0 -1
  40. package/themes/business/src/components/StarPrinter/SearchPrinter.tsx +0 -106
  41. package/themes/business/src/components/StarPrinter/index.tsx +0 -235
@@ -3,9 +3,10 @@ import {
3
3
  useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController
4
4
  } from 'ordering-components/native'
5
5
  import { useForm, Controller } from 'react-hook-form'
6
- import { StyleSheet, View, Alert } from 'react-native';
6
+ import { StyleSheet, View, Alert, Platform } from 'react-native';
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { OText, OButton, OInput } from '../../shared';
9
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
10
 
10
11
  import {
11
12
  Container,
@@ -93,7 +94,38 @@ const RedeemGiftCardUI = (props: any) => {
93
94
  <Container>
94
95
  {!redeemedGiftCard ? (
95
96
  <View>
96
- <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
97
+ <View style={{
98
+ marginBottom: 40,
99
+ marginTop: Platform.OS === 'ios' ? 30 : 50,
100
+ display: 'flex',
101
+ flexDirection: 'row',
102
+ alignItems: 'center',
103
+ }}>
104
+ <OButton
105
+ imgLeftStyle={{ width: 18 }}
106
+ imgRightSrc={null}
107
+ style={{
108
+ borderWidth: 0,
109
+ width: 26,
110
+ height: 26,
111
+ backgroundColor: '#FFF',
112
+ borderColor: '#FFF',
113
+ shadowColor: '#FFF',
114
+ paddingLeft: 0,
115
+ paddingRight: 0,
116
+ }}
117
+ onClick={onClose}
118
+ icon={AntDesignIcon}
119
+ iconProps={{
120
+ name: 'arrowleft',
121
+ size: 26,
122
+ style: {
123
+ color: theme.colors.textNormal
124
+ }
125
+ }}
126
+ />
127
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
128
+ </View>
97
129
  <FormController>
98
130
  <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('GIFT_CARD_CODE', 'Gift card code')}</OText>
99
131
  <Controller
@@ -106,7 +138,7 @@ const RedeemGiftCardUI = (props: any) => {
106
138
  onChange(val)
107
139
  handleChangeCode(val)
108
140
  }}
109
- autoCapitalize='none'
141
+ autoCapitalize='characters'
110
142
  autoCorrect={false}
111
143
  blurOnSubmit={false}
112
144
  style={style.inputStyle}
@@ -156,7 +188,38 @@ const RedeemGiftCardUI = (props: any) => {
156
188
  </View>
157
189
  ) : (
158
190
  <>
159
- <OText color={theme.colors.textNormal} weight='bold' size={20} mBottom={40}>{t('GIFT_CARD', 'Gift card')}</OText>
191
+ <View style={{
192
+ marginBottom: 40,
193
+ marginTop: Platform.OS === 'ios' ? 30 : 50,
194
+ display: 'flex',
195
+ flexDirection: 'row',
196
+ alignItems: 'center',
197
+ }}>
198
+ <OButton
199
+ imgLeftStyle={{ width: 18 }}
200
+ imgRightSrc={null}
201
+ style={{
202
+ borderWidth: 0,
203
+ width: 26,
204
+ height: 26,
205
+ backgroundColor: '#FFF',
206
+ borderColor: '#FFF',
207
+ shadowColor: '#FFF',
208
+ paddingLeft: 0,
209
+ paddingRight: 0,
210
+ }}
211
+ onClick={onClose}
212
+ icon={AntDesignIcon}
213
+ iconProps={{
214
+ name: 'arrowleft',
215
+ size: 26,
216
+ style: {
217
+ color: theme.colors.textNormal
218
+ }
219
+ }}
220
+ />
221
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
222
+ </View>
160
223
  <View>
161
224
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
162
225
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('AMOUNT', 'Amount')}: {parsePrice(redeemedGiftCard?.amount)}</OText>
@@ -129,7 +129,8 @@ export const LastOrder = (props: OrdersOptionParams) => {
129
129
  initialPage: 1,
130
130
  pageSize: 3,
131
131
  controlType: 'infinity'
132
- }
132
+ },
133
+ noGiftCardOrders: true
133
134
  }
134
135
 
135
136
  return <OrderList {...MyOrdersProps} />
@@ -117,7 +117,8 @@ export const LastOrders = (props: any) => {
117
117
  initialPage: 1,
118
118
  pageSize: 3,
119
119
  controlType: 'infinity'
120
- }
120
+ },
121
+ noGiftCardOrders: true
121
122
  }
122
123
  return <OrderListController {...helpProps} />
123
124
  }
@@ -10,11 +10,11 @@ import {
10
10
  ToastType,
11
11
  MultiCheckout as MultiCheckoutController
12
12
  } from 'ordering-components/native'
13
- import { View, StyleSheet, Platform } from 'react-native'
13
+ import { View, StyleSheet, Platform, ScrollView } from 'react-native'
14
14
  import { useTheme } from 'styled-components/native';
15
15
  import { Container } from '../../layouts/Container';
16
16
  import NavBar from '../NavBar';
17
- import { OText, OIcon, OModal } from '../shared';
17
+ import { OText, OIcon, OModal, OButton } from '../shared';
18
18
  import { getTypesText } from '../../utils';
19
19
  import { UserDetails } from '../UserDetails'
20
20
  import { AddressDetails } from '../AddressDetails'
@@ -26,6 +26,8 @@ import { DriverTips } from '../DriverTips'
26
26
  import { CouponControl } from '../CouponControl';
27
27
  import { DriverTipsContainer } from '../Cart/styles'
28
28
  import { OSTable, OSCoupon } from '../OrderSummary/styles';
29
+ import { SignupForm } from '../SignupForm'
30
+ import { LoginForm } from '../LoginForm'
29
31
 
30
32
  import {
31
33
  ChContainer,
@@ -74,7 +76,11 @@ const MultiCheckoutUI = (props: any) => {
74
76
  paddingLeft: 40,
75
77
  paddingRight: 40
76
78
  },
77
- wrapperNavbar: { paddingHorizontal: 40 }
79
+ wrapperNavbar: { paddingHorizontal: 40 },
80
+ detailWrapper: {
81
+ paddingHorizontal: 40,
82
+ width: '100%'
83
+ },
78
84
  })
79
85
 
80
86
  const [, { showToast }] = useToast();
@@ -83,7 +89,7 @@ const MultiCheckoutUI = (props: any) => {
83
89
  const [{ parsePrice, parseDate }] = useUtils();
84
90
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
85
91
  const [validationFields] = useValidationFields();
86
- const [{ user }] = useSession()
92
+ const [{ user }, { login }] = useSession()
87
93
 
88
94
  const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
89
95
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
@@ -134,6 +140,11 @@ const MultiCheckoutUI = (props: any) => {
134
140
  const [phoneUpdate, setPhoneUpdate] = useState(false);
135
141
  const [userErrors, setUserErrors] = useState<any>([]);
136
142
  const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
143
+ const [allowedGuest, setAllowedGuest] = useState(false)
144
+ const [isOpen, setIsOpen] = useState(false)
145
+ const [requiredFields, setRequiredFields] = useState<any>([])
146
+ const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
147
+ const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
137
148
  const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
138
149
  const methodsPay = ['global_google_pay', 'global_apple_pay']
139
150
  const isDisablePlaceOrderButton = cartGroup?.loading || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
@@ -151,11 +162,12 @@ const MultiCheckoutUI = (props: any) => {
151
162
  setUserErrors([])
152
163
  const errors = []
153
164
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
165
+ const _requiredFields: any = []
154
166
 
155
167
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
156
168
  if (field?.required && !notFields.includes(field.code)) {
157
169
  if (!user[field?.code]) {
158
- errors.push(t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `The field ${field?.name} is required`))
170
+ _requiredFields.push(field?.code)
159
171
  }
160
172
  }
161
173
  })
@@ -166,8 +178,9 @@ const MultiCheckoutUI = (props: any) => {
166
178
  validationFields?.fields?.checkout?.cellphone?.required) ||
167
179
  configs?.verification_phone_required?.value === '1')
168
180
  ) {
169
- errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
181
+ _requiredFields.push('cellphone')
170
182
  }
183
+ setRequiredFields(_requiredFields)
171
184
 
172
185
  if (phoneUpdate) {
173
186
  errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
@@ -181,10 +194,19 @@ const MultiCheckoutUI = (props: any) => {
181
194
  }
182
195
 
183
196
  const handlePlaceOrder = (confirmPayment?: any) => {
184
- if (!userErrors.length) {
197
+ if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
198
+ setOpenModal({ ...openModal, signup: true, isGuest: true })
199
+ return
200
+ }
201
+
202
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest)) {
185
203
  handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
186
204
  return
187
205
  }
206
+ if (requiredFields?.length) {
207
+ setIsOpen(true)
208
+ return
209
+ }
188
210
  let stringError = ''
189
211
  Object.values(userErrors).map((item: any, i: number) => {
190
212
  stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
@@ -193,6 +215,24 @@ const MultiCheckoutUI = (props: any) => {
193
215
  setIsUserDetailsEdit(true)
194
216
  }
195
217
 
218
+ const handlePlaceOrderAsGuest = () => {
219
+ setIsOpen(false)
220
+ handleGroupPlaceOrder && handleGroupPlaceOrder()
221
+ }
222
+
223
+ const handleSuccessSignup = (user: any) => {
224
+ login({
225
+ user,
226
+ token: user?.session?.access_token
227
+ })
228
+ openModal?.isGuest && handlePlaceOrderAsGuest()
229
+ setOpenModal({ ...openModal, signup: false, isGuest: false })
230
+ }
231
+
232
+ const handleSuccessLogin = (user: any) => {
233
+ if (user) setOpenModal({ ...openModal, login: false })
234
+ }
235
+
196
236
  useEffect(() => {
197
237
  if (validationFields && validationFields?.fields?.checkout) {
198
238
  checkValidationFields()
@@ -285,15 +325,45 @@ const MultiCheckoutUI = (props: any) => {
285
325
 
286
326
  <ChSection>
287
327
  <ChUserDetails>
288
- <UserDetails
289
- isUserDetailsEdit={isUserDetailsEdit}
290
- useValidationFields
291
- useDefualtSessionManager
292
- useSessionUser
293
- isCheckout
294
- phoneUpdate={phoneUpdate}
295
- togglePhoneUpdate={togglePhoneUpdate}
296
- />
328
+ {(user?.guest_id && !allowedGuest) ? (
329
+ <View>
330
+ <OText size={14} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textNormal}>
331
+ {t('CUSTOMER_DETAILS', 'Customer details')}
332
+ </OText>
333
+ <OButton
334
+ text={t('SIGN_UP', 'Sign up')}
335
+ textStyle={{ color: theme.colors.white }}
336
+ style={{ borderRadius: 7.6, marginTop: 20 }}
337
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
338
+ />
339
+ <OButton
340
+ text={t('LOGIN', 'Login')}
341
+ textStyle={{ color: theme.colors.primary }}
342
+ bgColor={theme.colors.white}
343
+ borderColor={theme.colors.primary}
344
+ style={{ borderRadius: 7.6, marginTop: 20 }}
345
+ onClick={() => setOpenModal({ ...openModal, login: true })}
346
+ />
347
+ <OButton
348
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
349
+ textStyle={{ color: theme.colors.black }}
350
+ bgColor={theme.colors.white}
351
+ borderColor={theme.colors.black}
352
+ style={{ borderRadius: 7.6, marginTop: 20 }}
353
+ onClick={() => setAllowedGuest(true)}
354
+ />
355
+ </View>
356
+ ) : (
357
+ <UserDetails
358
+ isUserDetailsEdit={isUserDetailsEdit}
359
+ useValidationFields
360
+ useDefualtSessionManager
361
+ useSessionUser
362
+ isCheckout
363
+ phoneUpdate={phoneUpdate}
364
+ togglePhoneUpdate={togglePhoneUpdate}
365
+ />
366
+ )}
297
367
  </ChUserDetails>
298
368
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
299
369
  </ChSection>
@@ -484,6 +554,58 @@ const MultiCheckoutUI = (props: any) => {
484
554
  </OText>
485
555
  )}
486
556
  </ChContainer>
557
+ <OModal
558
+ open={openModal.signup}
559
+ onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
560
+ >
561
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
562
+ <SignupForm
563
+ handleSuccessSignup={handleSuccessSignup}
564
+ isGuest
565
+ signupButtonText={t('SIGNUP', 'Signup')}
566
+ useSignupByEmail
567
+ useChekoutFileds
568
+ />
569
+ </ScrollView>
570
+ </OModal>
571
+ <OModal
572
+ open={openModal.login}
573
+ onClose={() => setOpenModal({ ...openModal, login: false })}
574
+ >
575
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
576
+ <LoginForm
577
+ handleSuccessLogin={handleSuccessLogin}
578
+ isGuest
579
+ loginButtonText={t('LOGIN', 'Login')}
580
+ loginButtonBackground={theme.colors.primary}
581
+ />
582
+ </ScrollView>
583
+ </OModal>
584
+ <OModal
585
+ open={isOpen}
586
+ onClose={() => setIsOpen(false)}
587
+ >
588
+ <View style={styles.detailWrapper}>
589
+ <UserDetails
590
+ isUserDetailsEdit
591
+ useValidationFields
592
+ useDefualtSessionManager
593
+ useSessionUser
594
+ isCheckout
595
+ isEdit
596
+ phoneUpdate={phoneUpdate}
597
+ togglePhoneUpdate={togglePhoneUpdate}
598
+ requiredFields={requiredFields}
599
+ hideUpdateButton
600
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
601
+ onClose={() => {
602
+ setIsOpen(false)
603
+ handlePlaceOrder()
604
+ }}
605
+ setIsOpen={setIsOpen}
606
+ />
607
+ </View>
608
+ </OModal>
487
609
  </Container>
488
610
 
489
611
  <FloatingButton
@@ -92,7 +92,6 @@ const NavBar = (props: Props) => {
92
92
  <TitleWrapper style={{ ...{ paddingHorizontal: props.isVertical ? 0 : 10 }, ...props.titleWrapStyle }}>
93
93
  <OText
94
94
  size={20}
95
- lineHeight={36}
96
95
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
97
96
  style={
98
97
  {
@@ -125,6 +125,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
125
125
  const directionTypes = [2, 3, 4, 5]
126
126
  const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
127
127
  const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
128
+ const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
128
129
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
129
130
  const isGiftCardOrder = !order?.business_id
130
131
  const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
@@ -138,6 +139,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
138
139
  const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
139
140
  const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
140
141
  const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
142
+ const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
141
143
  const walletName: any = {
142
144
  cash: {
143
145
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
@@ -346,7 +348,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
346
348
  }
347
349
  }, [props?.order?.error, props?.order?.loading])
348
350
 
349
- const progressBarObjt = order?.delivery_type && props.order?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
351
+
352
+ useEffect(() => {
353
+ if (!order?.delivery_type) return
354
+ setIsPickup(order?.delivery_type === 2)
355
+ }, [order?.delivery_type])
350
356
 
351
357
  return (
352
358
  <OrderDetailsContainer
@@ -1022,9 +1028,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1022
1028
  )} */}
1023
1029
  </View>
1024
1030
  <OText>
1025
- {configs.currency_position?.value === 'left'
1026
- ? `${configs.format_number_currency?.value} -${parseNumber(event.amount, { isTruncable: true })}`
1027
- : `-${parsePrice(event.amount, { isTruncable: true })}`}
1031
+ -{parsePrice(event.amount, { isTruncable: true })}
1028
1032
  </OText>
1029
1033
  </View>
1030
1034
  ))}
@@ -208,7 +208,8 @@ export const OrderProgress = (props: any) => {
208
208
  initialPage: 1,
209
209
  pageSize: 10,
210
210
  controlType: 'infinity'
211
- }
211
+ },
212
+ noGiftCardOrders: true
212
213
  }
213
214
 
214
215
  return <OrderList {...orderProgressProps} />
@@ -11,6 +11,7 @@ import {
11
11
  useLanguage,
12
12
  ToastType,
13
13
  useToast,
14
+ useSession
14
15
  } from 'ordering-components/native';
15
16
  import { useTheme } from 'styled-components/native';
16
17
  import { PaymentOptionCash } from '../PaymentOptionCash';
@@ -78,6 +79,7 @@ const PaymentOptionsUI = (props: any) => {
78
79
 
79
80
  const theme = useTheme();
80
81
  const [, { showToast }] = useToast();
82
+ const [{ user }] = useSession()
81
83
  const { confirmApplePayPayment } = useApplePay()
82
84
 
83
85
  const getPayIcon = (method: string) => {
@@ -120,7 +122,7 @@ const PaymentOptionsUI = (props: any) => {
120
122
  const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
121
123
 
122
124
  const handlePaymentMethodClick = (paymethod: any) => {
123
- if (cart?.balance > 0) {
125
+ if (cart?.balance > 0 || !!user?.guest_id) {
124
126
  if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
125
127
  openUserModal && openUserModal(true)
126
128
  setPaymethodClicked({
@@ -397,7 +399,7 @@ const PaymentOptionsUI = (props: any) => {
397
399
  >
398
400
  <StripeElementsForm
399
401
  cart={cart}
400
- paymethod={isOpenMethod?.paymethod?.gateway}
402
+ paymethod={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
401
403
  methodsPay={methodsPay}
402
404
  businessId={props.businessId}
403
405
  publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
@@ -139,7 +139,6 @@ export const ProductOptionsUI = (props: any) => {
139
139
  flex: 1,
140
140
  alignItems: 'center',
141
141
  width: '100%',
142
- marginLeft: 32
143
142
  },
144
143
  mainSwiper: {
145
144
  height: 258,
@@ -505,7 +504,7 @@ export const ProductOptionsUI = (props: any) => {
505
504
  <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
506
505
  {actionStatus?.loading ? (
507
506
  <Placeholder Animation={Fade}>
508
- <PlaceholderLine width={60} height={20} />
507
+ <PlaceholderLine height={20} />
509
508
  </Placeholder>
510
509
  ) : (
511
510
  <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
@@ -13,6 +13,8 @@ import { OAlert } from '../../../../../src/components/shared'
13
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
14
14
  import { sortInputFields } from '../../utils';
15
15
  import { ListItem } from '../UserProfile/styles';
16
+ import moment from 'moment';
17
+ import { DatePickerUI } from '../DatePicker';
16
18
 
17
19
  export const UserFormDetailsUI = (props: any) => {
18
20
  const {
@@ -81,6 +83,8 @@ export const UserFormDetailsUI = (props: any) => {
81
83
  const [isValid, setIsValid] = useState(false)
82
84
  const [isChanged, setIsChanged] = useState(false)
83
85
  const [isModalOpen, setIsModalOpen] = useState(false)
86
+ const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
87
+ const [showDatePicker, setShowDatePicker] = useState(false)
84
88
  const [phoneInputData, setPhoneInputData] = useState({
85
89
  error: '',
86
90
  phone: {
@@ -92,6 +96,7 @@ export const UserFormDetailsUI = (props: any) => {
92
96
 
93
97
  const isAdmin = user?.level === 0
94
98
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
99
+ const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
95
100
 
96
101
  const handleSuccessSignup = (user: any) => {
97
102
  login({
@@ -206,6 +211,13 @@ export const UserFormDetailsUI = (props: any) => {
206
211
  handleChangeInput(countryCode, true);
207
212
  }
208
213
 
214
+ const _handleChangeDate = (date: any) => {
215
+ setBirthdate(date)
216
+ const _birthdate = moment(date).format('YYYY-MM-DD')
217
+ handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
218
+ setShowDatePicker(false)
219
+ }
220
+
209
221
  const onRemoveAccount = () => {
210
222
  setConfirm({
211
223
  open: true,
@@ -268,6 +280,14 @@ export const UserFormDetailsUI = (props: any) => {
268
280
  }
269
281
  }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
270
282
 
283
+ useEffect(() => {
284
+ if (!validationFields.loading && birthdate) {
285
+ setValue('birthdate', formState?.result?.result
286
+ ? formState?.result?.result?.birthdate
287
+ : formState?.changes?.birthdate ?? (user && user?.birthdate) ?? '')
288
+ }
289
+ }, [validationFields, birthdate])
290
+
271
291
  useEffect(() => {
272
292
  if (!requiredFields || formState?.changes?.length === 0) return
273
293
  const _isValid = requiredFields.every((key: any) => formState?.changes[key])
@@ -359,7 +379,21 @@ export const UserFormDetailsUI = (props: any) => {
359
379
  </React.Fragment>
360
380
  ),
361
381
  )}
362
-
382
+ {showInputBirthday && (
383
+ <WrapperPhone>
384
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
385
+ {t('BIRTHDATE', 'Birthdate')}
386
+ </OText>
387
+ <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
388
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
389
+ {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
390
+ </OText>
391
+ </TouchableOpacity>
392
+ {showDatePicker && (
393
+ <DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
394
+ )}
395
+ </WrapperPhone>
396
+ )}
363
397
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
364
398
  <WrapperPhone>
365
399
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
@@ -141,6 +141,7 @@ const WalletsUI = (props: any) => {
141
141
  showCall={false}
142
142
  paddingTop={10}
143
143
  btnStyle={{ paddingLeft: 0 }}
144
+ isVertical={!hideWalletsTheme}
144
145
  hideArrowLeft={!hideWalletsTheme}
145
146
  />
146
147
  {isChewLayout && !openHistory && (
@@ -1,7 +1,6 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- padding-horizontal: 20px;
5
4
  padding-bottom: 20px;
6
5
  padding-top: ${(props: any) => props.pdng};
7
6
  `
@@ -1,106 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- View,
4
- Text,
5
- Button,
6
- FlatList,
7
- PermissionsAndroid,
8
- Platform
9
- } from 'react-native';
10
-
11
- import {
12
- InterfaceType,
13
- StarDeviceDiscoveryManager,
14
- StarDeviceDiscoveryManagerFactory,
15
- StarPrinter
16
- } from 'react-native-star-io10';
17
- import { useTheme } from 'styled-components';
18
- import { OIconButton } from '../shared';
19
-
20
- const SearchStarPrinter = ({ navigation }: any) => {
21
- let _manager: StarDeviceDiscoveryManager;
22
- const theme = useTheme();
23
-
24
- const [state, setState] = useState({
25
- bluetoothIsEnabled: true,
26
- bluetoothLeIsEnabled: true,
27
- printers: [],
28
- })
29
-
30
- const _onPressDiscoveryButton = async () => {
31
-
32
- setState({
33
- ...state,
34
- printers: [],
35
- });
36
-
37
- try {
38
- await _manager?.stopDiscovery()
39
-
40
- const interfaceTypes: Array<InterfaceType> = []
41
-
42
- if (state.bluetoothIsEnabled) {
43
- interfaceTypes.push(InterfaceType.Bluetooth);
44
- }
45
- if (state.bluetoothLeIsEnabled) {
46
- interfaceTypes.push(InterfaceType.BluetoothLE);
47
- }
48
-
49
- _manager = await StarDeviceDiscoveryManagerFactory.create(interfaceTypes);
50
- _manager.discoveryTime = 10000;
51
-
52
- _manager.onPrinterFound = (printer: StarPrinter) => {
53
- const printers = state.printers;
54
- printers.push(printer);
55
- setState({
56
- ...state,
57
- printers: printers
58
- });
59
-
60
- console.log(`Found printer: ${printer.connectionSettings.identifier}.`);
61
- };
62
-
63
- _manager.onDiscoveryFinished = () => {
64
- console.log(`Discovery finished.`);
65
- };
66
-
67
-
68
- await _manager.startDiscovery();
69
- }
70
- catch (error) {
71
- console.log(`Error: ${String(error)}`);
72
- }
73
- }
74
-
75
- const handleArrowBack = () => {
76
- navigation?.canGoBack() && navigation.goBack();
77
- };
78
-
79
- return (
80
- <View style={{ margin: 50 }}>
81
- <OIconButton
82
- icon={theme.images.general.arrow_left}
83
- iconStyle={{ width: 20, height: 20 }}
84
- borderColor={theme.colors.clear}
85
- style={{ maxWidth: 40, justifyContent: 'flex-end' }}
86
- onClick={() => handleArrowBack()}
87
- />
88
- <Text>Interface</Text>
89
-
90
- <View
91
- style={{ width: 100, marginTop: 30 }}>
92
- <Button
93
- title="Discovery"
94
- onPress={async () => await _onPressDiscoveryButton()}
95
- />
96
- </View>
97
- <FlatList
98
- style={{ marginTop: 30 }}
99
- data={state.printers}
100
- renderItem={({ item }) => <Text>{item.connectionSettings.interfaceType} : {item.connectionSettings.identifier}</Text>}
101
- keyExtractor={(item, index) => index.toString()} />
102
- </View>
103
- );
104
- };
105
-
106
- export default SearchStarPrinter;