ordering-ui-react-native 0.15.62 → 0.15.65-test

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.15.62",
3
+ "version": "0.15.65-test",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -90,7 +90,7 @@
90
90
  "react-native-linear-gradient": "^2.5.6",
91
91
  "react-native-loading-spinner-overlay": "^2.0.0",
92
92
  "react-native-map-link": "^2.8.2",
93
- "react-native-maps": "^0.28.0",
93
+ "react-native-maps": "0.31.1",
94
94
  "react-native-modal-dropdown": "^1.0.1",
95
95
  "react-native-onesignal": "^4.1.1",
96
96
  "react-native-paper": "^4.7.2",
@@ -45,7 +45,7 @@ export const AppleLogin = (props: any) => {
45
45
  handleLoading && handleLoading(false)
46
46
  }
47
47
  } else {
48
- showToast(ToastType.Error, `Error login on apple from api Code: ${code} ${Platform.OS}`, 10000)
48
+ handleErrors && handleErrors(result)
49
49
  handleLoading && handleLoading(false)
50
50
  }
51
51
  } catch (err: any) {
@@ -158,9 +158,6 @@ export const AppleLogin = (props: any) => {
158
158
 
159
159
  return (
160
160
  <Container>
161
- {credentialStateForUser !== -1 && (
162
- <Text>{credentialStateForUser}</Text>
163
- )}
164
161
  {canShowButton() &&
165
162
  <AppleButton
166
163
  onPress={() => Platform.OS == 'android' ? onAndroidButtonPress() : onIOSButtonPress(updateCredentialStateForUser)}
@@ -4,7 +4,7 @@ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText, OModal } from '../shared';
6
6
  import { BusinessBasicInformationParams } from '../../types';
7
- import { convertHoursToMinutes } from '../../utils';
7
+ import { convertHoursToMinutes, shape } from '../../utils';
8
8
  import dayjs from 'dayjs';
9
9
  import timezone from 'dayjs/plugin/timezone';
10
10
  import isBetween from 'dayjs/plugin/isBetween';
@@ -255,7 +255,7 @@ const CartUI = (props: any) => {
255
255
  <OSRow>
256
256
  <OText size={12} lineHeight={18} numberOfLines={1}>
257
257
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
258
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
258
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
259
259
  </OText>
260
260
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
261
261
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
4
4
  import {
5
5
  useLanguage,
6
6
  useConfig,
7
+ useUtils,
7
8
  useOrder,
8
9
  MomentOption as MomentOptionController,
9
10
  } from 'ordering-components/native';
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
132
133
 
133
134
  const [, t] = useLanguage();
134
135
  const [{ configs }] = useConfig();
136
+ const [{ parseTime }] = useUtils()
135
137
  const [orderState] = useOrder();
136
138
  const [optionSelected, setOptionSelected] = useState({
137
139
  isAsap: false,
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
143
145
  });
144
146
  const { bottom } = useSafeAreaInsets();
145
147
 
148
+ const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
149
+
146
150
  const [selectedTime, setSelectedTime] = useState(null);
147
151
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
148
152
  const [selectDate, setSelectedDate] = useState<any>(null)
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
338
342
  style={{
339
343
  lineHeight: 24
340
344
  }}
341
- >{time.startTime}</OText>
345
+ >{is12hours ? (
346
+ time.startTime.includes('12')
347
+ ? `${time.startTime}PM`
348
+ : parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
349
+ ) : time.startTime
350
+ }</OText>
342
351
  </TimeItem>
343
352
  </TouchableOpacity>
344
353
  ))}
@@ -18,7 +18,7 @@ export const OrderTimeWrapper = styled.View`
18
18
 
19
19
  export const TimeListWrapper = styled.ScrollView`
20
20
  margin-top: 30px;
21
- max-height: 160px;
21
+ max-height: 210px;
22
22
  `
23
23
 
24
24
  export const TimeContentWrapper = styled.View`
@@ -898,7 +898,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
898
898
  <OSRow>
899
899
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
900
900
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
901
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
901
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
902
902
  </OText>
903
903
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
904
904
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -1,12 +1,14 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Pressable, View } from 'react-native';
2
+ import { Pressable, StyleSheet, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+ import FastImage from 'react-native-fast-image'
5
6
  import {
6
7
  WalletList,
7
8
  useLanguage,
8
9
  useUtils,
9
- useConfig
10
+ useConfig,
11
+ useSession
10
12
  } from 'ordering-components/native'
11
13
 
12
14
  import {
@@ -15,7 +17,10 @@ import {
15
17
  TransactionsWrapper,
16
18
  OTabs,
17
19
  OTab,
18
- SectionContent
20
+ SectionContent,
21
+ LoyaltyContent,
22
+ LoyaltyWrapp,
23
+ LoyaltyImg
19
24
  } from './styles'
20
25
 
21
26
  import NavBar from '../NavBar'
@@ -34,16 +39,32 @@ const WalletsUI = (props: any) => {
34
39
  } = props
35
40
 
36
41
  const [, t] = useLanguage()
42
+ const [{ user }] = useSession()
37
43
  const theme = useTheme()
38
44
  const [{ parsePrice }] = useUtils()
39
45
  const [{ configs }] = useConfig()
40
46
 
47
+ const styles = StyleSheet.create({
48
+ logoStyle: {
49
+ width: 120,
50
+ height: 120,
51
+ borderRadius: 8,
52
+ borderWidth: 1,
53
+ borderColor: theme.colors.border,
54
+ flexDirection: 'column',
55
+ justifyContent: 'center',
56
+ alignItems: 'center',
57
+ }
58
+ });
59
+
41
60
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
42
61
 
43
62
  const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
44
63
 
45
64
  const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
46
65
 
66
+ const loyaltyLevel = Object.keys(user?.loyalty_level).length > 0 && user?.loyalty_level
67
+
47
68
  const walletName: any = {
48
69
  cash: {
49
70
  name: t('CASH_WALLET', 'Cash Wallet'),
@@ -106,6 +127,39 @@ const WalletsUI = (props: any) => {
106
127
  </OTabs>
107
128
 
108
129
  <SectionContent>
130
+ {!!loyaltyLevel && (
131
+ <LoyaltyContent>
132
+ <LoyaltyWrapp>
133
+ <OText size={20}>
134
+ {`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
135
+ </OText>
136
+ {loyaltyLevel.image ? (
137
+ <FastImage
138
+ style={styles.logoStyle}
139
+ source={{
140
+ uri: loyaltyLevel.image,
141
+ priority: FastImage.priority.high,
142
+ cache:FastImage.cacheControl.web
143
+ }}
144
+ resizeMode={FastImage.resizeMode.contain}
145
+ />
146
+ ) : (
147
+ <LoyaltyImg
148
+ source={theme.images.dummies.loyaltyLevel}
149
+ resizeMode='contain'
150
+ />
151
+ )}
152
+ <OText
153
+ size={22}
154
+ weight='bold'
155
+ style={{ textTransform: 'uppercase' }}
156
+ color={theme.colors.primary}
157
+ >
158
+ {loyaltyLevel.name}
159
+ </OText>
160
+ </LoyaltyWrapp>
161
+ </LoyaltyContent>
162
+ )}
109
163
  <BalanceElement>
110
164
  <OText size={20} style={{fontWeight: '600'}}>
111
165
  {currentWalletSelected?.type === 'cash'
@@ -41,3 +41,24 @@ export const OTabs = styled.View`
41
41
  export const OTab = styled.View`
42
42
  padding-horizontal: 10px;
43
43
  `;
44
+
45
+ export const LoyaltyContent = styled.View`
46
+ width: 100%;
47
+ margin-bottom: 20px;
48
+ `
49
+
50
+ export const LoyaltyWrapp = styled.View`
51
+ flex-direction: column;
52
+ justify-content: center;
53
+ align-items: center;
54
+ `
55
+
56
+ export const LoyaltyImg = styled.ImageBackground`
57
+ position: relative;
58
+ height: 150px;
59
+ width: 100%;
60
+ display: flex;
61
+ flex-direction: column;
62
+ justify-content: center;
63
+ align-items: center;
64
+ `