ordering-ui-react-native 0.12.55 → 0.12.56

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 (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +8 -0
  7. package/themes/business/src/layouts/Container.tsx +3 -1
  8. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  9. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  10. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  11. package/themes/doordash/src/layouts/Container.tsx +1 -1
  12. package/themes/franchises/src/components/Cart/index.tsx +257 -223
  13. package/themes/franchises/src/components/OrderDetails/index.tsx +723 -715
  14. package/themes/franchises/src/components/OrderSummary/index.tsx +188 -154
  15. package/themes/franchises/src/layouts/Container.tsx +1 -1
  16. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  17. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  18. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  19. package/themes/instacart/src/layouts/Container.tsx +1 -1
  20. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  21. package/themes/original/src/components/Cart/index.tsx +268 -234
  22. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  23. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  24. package/themes/original/src/layouts/Container.tsx +1 -1
  25. package/themes/single-business/src/layouts/Container.tsx +1 -1
  26. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  27. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  28. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  29. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { View } from 'react-native'
2
+ import { ActivityIndicator, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import AntIcon from 'react-native-vector-icons/AntDesign'
@@ -34,7 +34,9 @@ const OrderSummaryUI = (props: any) => {
34
34
  offsetDisabled,
35
35
  removeProduct,
36
36
  isCartPending,
37
- isFromCheckout
37
+ isFromCheckout,
38
+ commentState,
39
+ handleChangeComment
38
40
  } = props;
39
41
 
40
42
  const theme = useTheme()
@@ -188,6 +190,38 @@ const OrderSummaryUI = (props: any) => {
188
190
  </OSTable>
189
191
  </View>
190
192
  )}
193
+ {cart?.status !== 2 && (
194
+ <OSTable>
195
+ <View style={{ width: '100%', marginTop: 20 }}>
196
+ <OText size={12}>{t('COMMENTS', 'Comments')}</OText>
197
+ <View style={{ flex: 1, width: '100%' }}>
198
+ <OInput
199
+ value={cart?.comment}
200
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
201
+ onChange={(value: string) => handleChangeComment(value)}
202
+ style={{
203
+ alignItems: 'flex-start',
204
+ width: '100%',
205
+ height: 100,
206
+ borderColor: theme.colors.textSecondary,
207
+ paddingRight: 50,
208
+ marginTop: 10
209
+ }}
210
+ multiline
211
+ />
212
+ {commentState?.loading && (
213
+ <View style={{ position: 'absolute', right: 20 }}>
214
+ <ActivityIndicator
215
+ size='large'
216
+ style={{ height: 100 }}
217
+ color={theme.colors.primary}
218
+ />
219
+ </View>
220
+ )}
221
+ </View>
222
+ </View>
223
+ </OSTable>
224
+ )}
191
225
  </OSBill>
192
226
  )}
193
227
  <OModal
@@ -18,7 +18,7 @@ const SafeAreaStyled = styled.SafeAreaView`
18
18
  export const Container = (props: any) => {
19
19
  return (
20
20
  <SafeAreaStyled>
21
- <ContainerStyled keyboardShouldPersistTaps='handled' {...props} style={{...props.style}}>
21
+ <ContainerStyled {...props} ref={props?.forwardRef} keyboardShouldPersistTaps='handled' style={{...props.style}}>
22
22
  {props.children}
23
23
  </ContainerStyled>
24
24
  </SafeAreaStyled>
@@ -15,7 +15,7 @@ const SafeAreaStyled = styled.SafeAreaView`
15
15
  export const Container = (props: any) => {
16
16
  return (
17
17
  <SafeAreaStyled>
18
- <ContainerStyled keyboardShouldPersistTaps='handled' {...props} style={{...props.style}}>
18
+ <ContainerStyled {...props} keyboardShouldPersistTaps='handled' ref={props?.forwardRef} style={{...props.style}}>
19
19
  {props.children}
20
20
  </ContainerStyled>
21
21
  </SafeAreaStyled>
@@ -16,14 +16,14 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OInput, OModal, OText } from '../shared';
20
20
  import { ProductForm } from '../ProductForm';
21
21
  import { UpsellingProducts } from '../UpsellingProducts';
22
22
  import { verifyDecimals } from '../../utils';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
25
25
  import { TaxInformation } from '../TaxInformation';
26
- import { TouchableOpacity } from 'react-native';
26
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
27
27
 
28
28
  const CartUI = (props: any) => {
29
29
  const {
@@ -36,7 +36,9 @@ const CartUI = (props: any) => {
36
36
  handleCartOpen,
37
37
  setIsCartsLoading,
38
38
  isForceOpenCart,
39
- isBusinessCart
39
+ isBusinessCart,
40
+ handleChangeComment,
41
+ commentState
40
42
  } = props
41
43
 
42
44
  const theme = useTheme()
@@ -235,6 +237,38 @@ const CartUI = (props: any) => {
235
237
  </OText>
236
238
  </OSTable>
237
239
  </OSTotal>
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
238
272
  </OSBill>
239
273
  )}
240
274
  </CartContent>
@@ -410,6 +410,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
410
410
  <OText style={styles.textBold} color={theme.colors.primary}>{parsePrice(order?.summary?.total || order?.total)}</OText>
411
411
  </Table>
412
412
  </Total>
413
+ {order?.comment && (
414
+ <Table>
415
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
416
+ <OText style={{ maxWidth: '70%' }}>
417
+ {order?.comment}
418
+ </OText>
419
+ </Table>
420
+ )}
413
421
  </OrderBill>
414
422
  <OrderCustomer>
415
423
  <OText size={18} mBottom={5} style={{ textAlign: 'left' }}>{t('CUSTOMER', 'Customer')}</OText>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import { useTheme } from 'styled-components/native';
@@ -34,7 +34,9 @@ const OrderSummaryUI = (props: any) => {
34
34
  offsetDisabled,
35
35
  removeProduct,
36
36
  isCartPending,
37
- isFromCheckout
37
+ isFromCheckout,
38
+ handleChangeComment,
39
+ commentState
38
40
  } = props;
39
41
 
40
42
  const theme = useTheme();
@@ -158,9 +160,9 @@ const OrderSummaryUI = (props: any) => {
158
160
  {cart?.driver_tip_rate > 0 &&
159
161
  parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
160
162
  !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
161
- (
162
- `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
163
- )}
163
+ (
164
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
165
+ )}
164
166
  </OText>
165
167
  <OText size={16}>{parsePrice(cart?.driver_tip)}</OText>
166
168
  </OSTable>
@@ -187,6 +189,38 @@ const OrderSummaryUI = (props: any) => {
187
189
  </OSTable>
188
190
  </View>
189
191
  )}
192
+ {cart?.status !== 2 && (
193
+ <OSTable>
194
+ <View style={{ width: '100%', marginTop: 20 }}>
195
+ <OText>{t('COMMENTS', 'Comments')}</OText>
196
+ <View style={{ flex: 1, width: '100%' }}>
197
+ <OInput
198
+ value={cart?.comment}
199
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
200
+ onChange={(value: string) => handleChangeComment(value)}
201
+ style={{
202
+ alignItems: 'flex-start',
203
+ width: '100%',
204
+ height: 100,
205
+ borderColor: theme.colors.textSecondary,
206
+ paddingRight: 50,
207
+ marginTop: 10
208
+ }}
209
+ multiline
210
+ />
211
+ {commentState?.loading && (
212
+ <View style={{ position: 'absolute', right: 20 }}>
213
+ <ActivityIndicator
214
+ size='large'
215
+ style={{ height: 100 }}
216
+ color={theme.colors.primary}
217
+ />
218
+ </View>
219
+ )}
220
+ </View>
221
+ </View>
222
+ </OSTable>
223
+ )}
190
224
  </OSBill>
191
225
  )}
192
226
  <OModal
@@ -18,7 +18,7 @@ const ContentView = styled.View`
18
18
  export const Container = (props: any) => {
19
19
  return (
20
20
  <SafeAreaStyled>
21
- <ContainerStyled keyboardShouldPersistTaps='handled'>
21
+ <ContainerStyled ref={props?.forwardRef} keyboardShouldPersistTaps='handled'>
22
22
  <ContentView>
23
23
  {props.children}
24
24
  </ContentView>