ordering-ui-react-native 0.14.30 → 0.14.33

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.30",
3
+ "version": "0.14.33",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -5,6 +5,7 @@ import { _retrieveStoreData, _clearStoreData } from '../../providers/StoreUtil';
5
5
 
6
6
  import { OIcon, OText } from '../shared';
7
7
  import { useTheme } from 'styled-components/native';
8
+ import { GoogleSignin } from '@react-native-google-signin/google-signin';
8
9
 
9
10
  const LogoutButtonUI = (props: any) => {
10
11
  const { handleLogoutClick, formState } = props
@@ -19,6 +20,19 @@ const LogoutButtonUI = (props: any) => {
19
20
  if (res) {
20
21
  _clearStoreData({ excludedKeys: ['isTutorial'] })
21
22
  }
23
+ logoutWithGoogle()
24
+ }
25
+
26
+ const logoutWithGoogle = async () => {
27
+ const isSignedIn = await GoogleSignin.isSignedIn()
28
+ if (isSignedIn) {
29
+ try {
30
+ await GoogleSignin.revokeAccess();
31
+ await GoogleSignin.signOut();
32
+ } catch (error: any) {
33
+ showToast(ToastType.Error, error.message)
34
+ }
35
+ }
22
36
  }
23
37
 
24
38
  useEffect(() => {
@@ -82,7 +82,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
82
82
  paddingBottom: 15,
83
83
  borderBottomWidth: 1,
84
84
  borderColor: theme.colors.backgroundGray200,
85
- height: 90
85
+ height: 100
86
86
  },
87
87
  calendarHeaderContainer: {
88
88
  flex: 1,
@@ -400,6 +400,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
400
400
  iconStyle={{borderWidth: 1}}
401
401
  selectedDate={selectDate}
402
402
  datesWhitelist={datesWhitelist}
403
+ dayContainerStyle={{height: 40}}
403
404
  disabledDateNameStyle={styles.disabledDateName}
404
405
  disabledDateNumberStyle={styles.disabledDateNumber}
405
406
  disabledDateOpacity={0.6}
@@ -49,7 +49,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
49
49
  product={product}
50
50
  businessId={businessId}
51
51
  onProductClick={() => onProductClick(product)}
52
- productAddedToCart={currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)}
52
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
53
53
  />
54
54
  ))}
55
55
 
@@ -72,7 +72,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
72
72
  product={product}
73
73
  businessId={businessId}
74
74
  onProductClick={onProductClick}
75
- productAddedToCart={currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)}
75
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
76
76
  />
77
77
  ),
78
78
  )}
@@ -117,7 +117,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
117
117
  businessId={businessId}
118
118
  product={product}
119
119
  onProductClick={onProductClick}
120
- productAddedToCart={currentCart?.products?.find((Cproduct: any) => Cproduct.id === product.id)}
120
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
121
121
  />
122
122
  ))}
123
123
  </>
@@ -44,7 +44,7 @@ const DriverTipsUI = (props: any) => {
44
44
  borderWidth: 1,
45
45
  borderColor: theme.colors.inputDisabled,
46
46
  marginRight: 10,
47
- height: 44
47
+ height: 50
48
48
  }
49
49
  })
50
50
 
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
63
63
  return (
64
64
  <DTContainer>
65
65
  <DTWrapperTips>
66
- {driverTipsOptions.map((option: any, i: number) => (
66
+ {driverTipsOptions.map((option: any, i: number) => (
67
67
  <TouchableOpacity
68
68
  key={i}
69
69
  onPress={() => handlerChangeOption(option)}
@@ -72,7 +72,7 @@ const DriverTipsUI = (props: any) => {
72
72
  style={style.circle}
73
73
  isActive={option === optionSelected}
74
74
  >
75
- <OText size={13} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
75
+ <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
76
76
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
77
77
  </OText>
78
78
  </DTCard>
@@ -15,7 +15,7 @@ export const DTWrapperTips = styled.View`
15
15
  width: 100%;
16
16
  justify-content: space-evenly;
17
17
  align-items: center;
18
- flex-wrap: nowrap;
18
+ flex-wrap: wrap;
19
19
  `
20
20
 
21
21
  export const DTCard = styled.View`
@@ -24,10 +24,10 @@ export const DTCard = styled.View`
24
24
  align-items: center;
25
25
  border: 1px solid ${(props: any) => props.isActive ? props.theme.colors.primary : props.theme.colors.border};
26
26
  text-transform: capitalize;
27
- min-height: 48px;
28
- min-width: 48px;
29
- max-width: 48px;
30
- max-height: 48px;
27
+ min-height: 55px;
28
+ min-width: 55px;
29
+ max-width: 55px;
30
+ max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
@@ -423,17 +423,6 @@ export const ProductOptionsUI = (props: any) => {
423
423
  </OText>
424
424
  )}
425
425
  </View>
426
- <View style={{ flexDirection: 'row', marginBottom: 10 }}>
427
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
428
- {product?.offer_price && (
429
- <OText style={{ fontSize: 14,
430
- color: '#808080',
431
- textDecorationLine: 'line-through',
432
- marginLeft: 7,
433
- marginRight: 7
434
- }}>{parsePrice(product?.offer_price)}</OText>
435
- )}
436
- </View>
437
426
  {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
438
427
  <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
439
428
  {
@@ -449,11 +438,20 @@ export const ProductOptionsUI = (props: any) => {
449
438
  </OText>
450
439
  )}
451
440
  {isHaveWeight ? (
452
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
441
+ <OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
453
442
  ) : (
454
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
455
- {productCart.price ? parsePrice(productCart.price) : ''}
456
- </OText>
443
+ <View style={{ flexDirection: 'row', marginBottom: 10 }}>
444
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
445
+ {product?.offer_price && (
446
+ <OText style={{
447
+ fontSize: 14,
448
+ color: '#808080',
449
+ textDecorationLine: 'line-through',
450
+ marginLeft: 7,
451
+ marginRight: 7
452
+ }}>{parsePrice(product?.offer_price)}</OText>
453
+ )}
454
+ </View>
457
455
  )}
458
456
  </>
459
457
  )}
@@ -212,8 +212,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
212
212
  </View>
213
213
  {((isCartProduct && !isCartPending && product?.valid_menu && !product?.valid_quantity) ||
214
214
  (!product?.valid_menu && isCartProduct && !isCartPending)) && (
215
- <View style={{ alignItems: 'flex-end', width: '100%' }}>
216
- <OText size={14} color={theme.colors.red} style={{ textAlign: 'right', bottom: 20 }}>
215
+ <View style={{ alignItems: 'flex-end', width: '100%', }}>
216
+ <OText size={14} color={theme.colors.red} style={{ textAlign: 'right', marginTop: 5 }}>
217
217
  {t('NOT_AVAILABLE', 'Not available')}
218
218
  </OText>
219
219
  </View>
@@ -13,7 +13,7 @@ import { OText, OIcon } from '../shared';
13
13
  import FastImage from 'react-native-fast-image'
14
14
 
15
15
  export const SingleProductCard = (props: SingleProductCardParams) => {
16
- const { businessId, product, isSoldOut, onProductClick, productAddedToCart } = props;
16
+ const { businessId, product, isSoldOut, onProductClick, productAddedToCartLength } = props;
17
17
 
18
18
  const theme = useTheme();
19
19
 
@@ -90,7 +90,6 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
90
90
  maxCartProductConfig,
91
91
  maxCartProductInventory,
92
92
  );
93
-
94
93
  return (
95
94
  <CardContainer
96
95
  style={[
@@ -98,11 +97,11 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
98
97
  (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
99
98
  ]}
100
99
  onPress={() => onProductClick?.(product)}>
101
- {productAddedToCart && productAddedToCart?.quantity > 0 && (
100
+ {productAddedToCartLength > 0 && (
102
101
  <QuantityContainer style={[styles.quantityContainer, {
103
102
  transform: [{ translateX: 10 }, { translateY: -10 }],
104
103
  }]}>
105
- <OText color={theme.colors.white}>{productAddedToCart?.quantity}</OText>
104
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
106
105
  </QuantityContainer>
107
106
  )}
108
107
  <CardInfo>
@@ -24,4 +24,6 @@ export const SoldOut = styled.View`
24
24
 
25
25
  export const QuantityContainer = styled.View`
26
26
  background: ${({ theme } : any) => theme.colors.primary};
27
- `
27
+ align-items: center;
28
+ justify-content: center;
29
+ `
@@ -221,7 +221,7 @@ export interface SingleProductCardParams {
221
221
  product: any;
222
222
  isSoldOut: boolean;
223
223
  onProductClick: any;
224
- productAddedToCart?: any
224
+ productAddedToCartLength: number
225
225
  }
226
226
  export interface BusinessInformationParams {
227
227
  navigation?: any,