ordering-ui-react-native 0.14.26 → 0.14.28-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.
- package/package.json +2 -2
- package/src/components/ProductForm/index.tsx +27 -19
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessProductsList/styles.tsx +1 -1
- package/themes/instacart/src/components/SingleProductCard/index.tsx +19 -24
- package/themes/instacart/src/components/SingleProductCard/styles.tsx +6 -4
- package/themes/original/index.tsx +0 -4
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +19 -25
- package/themes/original/src/components/Cart/index.tsx +9 -27
- package/themes/original/src/components/CartContent/index.tsx +0 -1
- package/themes/original/src/components/Checkout/index.tsx +4 -15
- package/themes/original/src/components/Checkout/styles.tsx +1 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/Home/index.tsx +5 -3
- package/themes/original/src/components/OrderDetails/index.tsx +3 -55
- package/themes/original/src/components/OrderProgress/index.tsx +2 -2
- package/themes/original/src/components/OrderSummary/index.tsx +3 -21
- package/themes/original/src/components/ProductForm/index.tsx +24 -7
- package/themes/original/src/components/UserProfile/index.tsx +0 -5
- package/themes/original/src/types/index.tsx +2 -4
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +0 -163
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +0 -38
- package/themes/original/src/components/WalletTransactionItem/index.tsx +0 -68
- package/themes/original/src/components/WalletTransactionItem/styles.tsx +0 -37
- package/themes/original/src/components/Wallets/index.tsx +0 -204
- package/themes/original/src/components/Wallets/styles.tsx +0 -43
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { useTheme } from 'styled-components/native'
|
|
4
|
-
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
|
-
import {
|
|
6
|
-
WalletList,
|
|
7
|
-
useLanguage,
|
|
8
|
-
useUtils,
|
|
9
|
-
useConfig
|
|
10
|
-
} from 'ordering-components/native'
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
Container,
|
|
14
|
-
BalanceElement,
|
|
15
|
-
TransactionsWrapper,
|
|
16
|
-
OTabs,
|
|
17
|
-
OTab,
|
|
18
|
-
SectionContent
|
|
19
|
-
} from './styles'
|
|
20
|
-
|
|
21
|
-
import NavBar from '../NavBar'
|
|
22
|
-
import { OIcon, OText } from '../shared';
|
|
23
|
-
import { NotFoundSource } from '../NotFoundSource';
|
|
24
|
-
import { WalletTransactionItem } from '../WalletTransactionItem'
|
|
25
|
-
|
|
26
|
-
const WalletsUI = (props: any) => {
|
|
27
|
-
const {
|
|
28
|
-
navigation,
|
|
29
|
-
walletList,
|
|
30
|
-
transactionsList,
|
|
31
|
-
setWalletSelected
|
|
32
|
-
} = props
|
|
33
|
-
|
|
34
|
-
const [, t] = useLanguage()
|
|
35
|
-
const theme = useTheme()
|
|
36
|
-
const [{ parsePrice, parseDate }] = useUtils()
|
|
37
|
-
const [{ configs }] = useConfig()
|
|
38
|
-
|
|
39
|
-
const [tabSelected, setTabSelected] = useState('cash')
|
|
40
|
-
|
|
41
|
-
const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
|
|
42
|
-
|
|
43
|
-
const walletName: any = {
|
|
44
|
-
cash: {
|
|
45
|
-
name: t('CASH_WALLET', 'Cash Wallet'),
|
|
46
|
-
value: 0
|
|
47
|
-
},
|
|
48
|
-
credit_point: {
|
|
49
|
-
name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
|
|
50
|
-
value: 1
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const handleChangeTab = (wallet: any) => {
|
|
55
|
-
setTabSelected(wallet.type)
|
|
56
|
-
setWalletSelected(wallet.id)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const goToBack = () => {
|
|
60
|
-
navigation?.canGoBack() && navigation.goBack()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<Container>
|
|
65
|
-
<NavBar
|
|
66
|
-
title={t('WALLETS', 'Wallets')}
|
|
67
|
-
titleAlign={'center'}
|
|
68
|
-
onActionLeft={goToBack}
|
|
69
|
-
showCall={false}
|
|
70
|
-
paddingTop={10}
|
|
71
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
72
|
-
/>
|
|
73
|
-
|
|
74
|
-
{!walletList.loading &&
|
|
75
|
-
!walletList.error &&
|
|
76
|
-
walletList.wallets?.length > 0 &&
|
|
77
|
-
(
|
|
78
|
-
<>
|
|
79
|
-
<OTabs>
|
|
80
|
-
{walletList.wallets?.map((wallet: any) =>(
|
|
81
|
-
<Pressable
|
|
82
|
-
key={wallet.id}
|
|
83
|
-
onPress={() => handleChangeTab(wallet)}
|
|
84
|
-
>
|
|
85
|
-
<OTab>
|
|
86
|
-
<OText size={18} color={tabSelected === wallet.type ? theme.colors.primary : theme.colors.disabled}>
|
|
87
|
-
{walletName[wallet.type]?.name}
|
|
88
|
-
</OText>
|
|
89
|
-
</OTab>
|
|
90
|
-
</Pressable>
|
|
91
|
-
))}
|
|
92
|
-
</OTabs>
|
|
93
|
-
|
|
94
|
-
<SectionContent>
|
|
95
|
-
<BalanceElement>
|
|
96
|
-
<OText size={20} style={{fontWeight: '600'}}>
|
|
97
|
-
{currentWalletSelected?.type === 'cash'
|
|
98
|
-
? parsePrice(currentWalletSelected?.balance)
|
|
99
|
-
: currentWalletSelected?.balance
|
|
100
|
-
}
|
|
101
|
-
</OText>
|
|
102
|
-
<OText style={{ paddingLeft: 5 }}>
|
|
103
|
-
{currentWalletSelected?.type === 'cash'
|
|
104
|
-
? configs?.stripe_currency?.value
|
|
105
|
-
: t('POINTS', 'Points')}
|
|
106
|
-
</OText>
|
|
107
|
-
</BalanceElement>
|
|
108
|
-
{console.log(transactionsList)}
|
|
109
|
-
|
|
110
|
-
<View style={{ marginTop: 20, width: '100%', paddingHorizontal: 1, paddingBottom: 40 }}>
|
|
111
|
-
{!transactionsList?.loading &&
|
|
112
|
-
!transactionsList?.error &&
|
|
113
|
-
transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length > 0 &&
|
|
114
|
-
(
|
|
115
|
-
<>
|
|
116
|
-
<OText style={{fontSize: 20}}>
|
|
117
|
-
{t('TRANSACTIONS_HISTORY', 'Transactions history')}
|
|
118
|
-
</OText>
|
|
119
|
-
<TransactionsWrapper>
|
|
120
|
-
{transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.map((transaction: any, i: number) =>(
|
|
121
|
-
<WalletTransactionItem
|
|
122
|
-
idx={i}
|
|
123
|
-
type={currentWalletSelected?.type}
|
|
124
|
-
key={transaction.id}
|
|
125
|
-
item={transaction}
|
|
126
|
-
/>
|
|
127
|
-
))}
|
|
128
|
-
</TransactionsWrapper>
|
|
129
|
-
</>
|
|
130
|
-
)}
|
|
131
|
-
|
|
132
|
-
{(transactionsList?.loading || !transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]) && (
|
|
133
|
-
<View>
|
|
134
|
-
{[...Array(4).keys()].map(i => (
|
|
135
|
-
<View style={{ marginBottom: 10 }} key={i}>
|
|
136
|
-
<Placeholder Animation={Fade}>
|
|
137
|
-
<PlaceholderLine width={100} height={100} style={{ marginBottom: 0, borderRadius: 8 }} />
|
|
138
|
-
</Placeholder>
|
|
139
|
-
</View>
|
|
140
|
-
))}
|
|
141
|
-
</View>
|
|
142
|
-
)}
|
|
143
|
-
|
|
144
|
-
{!(transactionsList?.loading && transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]) &&
|
|
145
|
-
(transactionsList?.error ||
|
|
146
|
-
!transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length) &&
|
|
147
|
-
(
|
|
148
|
-
<NotFoundSource
|
|
149
|
-
content={transactionsList?.error
|
|
150
|
-
? t('ERROR_NOT_FOUND_TRANSACTIONS', 'Sorry, an error has occurred')
|
|
151
|
-
: t('NOT_FOUND_TRANSACTIONS', 'No transactions to show at this time.')
|
|
152
|
-
}
|
|
153
|
-
/>
|
|
154
|
-
)}
|
|
155
|
-
</View>
|
|
156
|
-
</SectionContent>
|
|
157
|
-
</>
|
|
158
|
-
)}
|
|
159
|
-
|
|
160
|
-
{walletList?.loading && (
|
|
161
|
-
<>
|
|
162
|
-
<View>
|
|
163
|
-
<Placeholder Animation={Fade}>
|
|
164
|
-
<PlaceholderLine width={100} height={40} style={{ marginBottom: 0 }} />
|
|
165
|
-
</Placeholder>
|
|
166
|
-
</View>
|
|
167
|
-
<View style={{ marginTop: 10, marginBottom: 20 }}>
|
|
168
|
-
<Placeholder Animation={Fade}>
|
|
169
|
-
<PlaceholderLine width={100} height={40} style={{ marginBottom: 0 }} />
|
|
170
|
-
</Placeholder>
|
|
171
|
-
</View>
|
|
172
|
-
<View>
|
|
173
|
-
{[...Array(4).keys()].map(i => (
|
|
174
|
-
<View style={{ marginBottom: 10 }} key={i}>
|
|
175
|
-
<Placeholder Animation={Fade}>
|
|
176
|
-
<PlaceholderLine width={100} height={60} style={{ marginBottom: 0 }} />
|
|
177
|
-
</Placeholder>
|
|
178
|
-
</View>
|
|
179
|
-
))}
|
|
180
|
-
</View>
|
|
181
|
-
</>
|
|
182
|
-
)}
|
|
183
|
-
|
|
184
|
-
{!walletList?.loading && (walletList?.error || !walletList?.wallets?.length) && (
|
|
185
|
-
<NotFoundSource
|
|
186
|
-
content={walletList?.error
|
|
187
|
-
? t('ERROR_NOT_FOUND_WALLETS', 'Sorry, an error has occurred')
|
|
188
|
-
: t('NOT_FOUND_WALLETS', 'No wallets to show at this time.')
|
|
189
|
-
}
|
|
190
|
-
/>
|
|
191
|
-
)}
|
|
192
|
-
</Container>
|
|
193
|
-
)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export const Wallets = (props: any) => {
|
|
197
|
-
const walletsProps = {
|
|
198
|
-
...props,
|
|
199
|
-
UIComponent: WalletsUI
|
|
200
|
-
}
|
|
201
|
-
return (
|
|
202
|
-
<WalletList {...walletsProps} />
|
|
203
|
-
)
|
|
204
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const Container = styled.View`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
export const SectionContent = styled.View`
|
|
9
|
-
width: 100%;
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
margin-top: 20px;
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
export const TransactionsWrapper = styled.View`
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
border-left-width: 2px;
|
|
21
|
-
border-left-color: ${(props: any) => props.theme.colors.disabled};
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
export const BalanceElement = styled.View`
|
|
25
|
-
width: 100%;
|
|
26
|
-
padding: 10px 0;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: row;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
align-items: flex-end;
|
|
31
|
-
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
32
|
-
border-radius: 8px;
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
export const OTabs = styled.View`
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
width: 100%;
|
|
38
|
-
flex-wrap: wrap;
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
export const OTab = styled.View`
|
|
42
|
-
padding-horizontal: 10px;
|
|
43
|
-
`;
|