ordering-ui-react-native 0.22.34 → 0.22.36
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
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
useToast,
|
|
12
12
|
useLanguage,
|
|
13
13
|
useUtils,
|
|
14
|
-
useConfig
|
|
14
|
+
useConfig,
|
|
15
|
+
useValidationFields
|
|
15
16
|
} from 'ordering-components/native';
|
|
16
17
|
import {
|
|
17
18
|
CenterView,
|
|
@@ -57,7 +58,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
57
58
|
const [, t] = useLanguage();
|
|
58
59
|
const [, { showToast }] = useToast();
|
|
59
60
|
const [{ optimizeImage }] = useUtils();
|
|
60
|
-
const [{ configs }] = useConfig()
|
|
61
|
+
const [{ configs }] = useConfig();
|
|
62
|
+
const [{ loading }, { loadOriginalValidationFields }] = useValidationFields()
|
|
61
63
|
const { errors } = useForm();
|
|
62
64
|
const theme = useTheme();
|
|
63
65
|
|
|
@@ -262,15 +264,17 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
262
264
|
|
|
263
265
|
return (
|
|
264
266
|
<>
|
|
265
|
-
{validationFields?.error && (
|
|
267
|
+
{validationFields?.error && !loading && (
|
|
266
268
|
<NotFoundSource
|
|
267
269
|
content={
|
|
268
|
-
validationFields?.error[0] ||
|
|
269
|
-
validationFields?.error[0]?.message ||
|
|
270
|
+
validationFields?.error?.[0] ||
|
|
271
|
+
validationFields?.error?.[0]?.message ||
|
|
270
272
|
t('NETWORK_ERROR', 'Network Error')
|
|
271
273
|
}
|
|
272
274
|
image={theme.images.general.notFound}
|
|
273
275
|
conditioned={false}
|
|
276
|
+
onClickButton={() => loadOriginalValidationFields({ forceLoading: true })}
|
|
277
|
+
btnTitle={t('REFRESH_PROFILE', 'Refresh profile')}
|
|
274
278
|
/>
|
|
275
279
|
)}
|
|
276
280
|
|
|
@@ -31,7 +31,8 @@ const CheckoutUI = (props: any) => {
|
|
|
31
31
|
paymethodSelected,
|
|
32
32
|
handlePaymethodChange,
|
|
33
33
|
handlerClickPlaceOrder,
|
|
34
|
-
onNavigationRedirect
|
|
34
|
+
onNavigationRedirect,
|
|
35
|
+
isKiosk
|
|
35
36
|
} = props
|
|
36
37
|
|
|
37
38
|
const [errorCash, setErrorCash] = useState(false);
|
|
@@ -68,6 +69,7 @@ const CheckoutUI = (props: any) => {
|
|
|
68
69
|
isLoading={cartState.loading || businessDetails.loading}
|
|
69
70
|
paymethods={businessDetails?.business?.paymethods}
|
|
70
71
|
setErrorCash={setErrorCash}
|
|
72
|
+
isKiosk={isKiosk}
|
|
71
73
|
/>
|
|
72
74
|
</>
|
|
73
75
|
)
|
|
@@ -84,7 +86,7 @@ export const Checkout = (props: any) => {
|
|
|
84
86
|
const [, { showToast }] = useToast();
|
|
85
87
|
const [{ token }] = useSession();
|
|
86
88
|
const [ordering] = useApi();
|
|
87
|
-
const [,{ confirmCart }] = useOrder();
|
|
89
|
+
const [, { confirmCart }] = useOrder();
|
|
88
90
|
|
|
89
91
|
const [cartState, setCartState] = useState<any>({ loading: true, error: [], cart: null });
|
|
90
92
|
|
|
@@ -109,7 +111,7 @@ export const Checkout = (props: any) => {
|
|
|
109
111
|
const confirmCartRes = await confirmCart(cartUuid)
|
|
110
112
|
if (confirmCartRes.error) {
|
|
111
113
|
showToast(ToastType.Error, confirmCartRes.error.message)
|
|
112
|
-
}getOrder
|
|
114
|
+
} getOrder
|
|
113
115
|
getOrder
|
|
114
116
|
if (confirmCartRes.result.order?.uuid) {
|
|
115
117
|
onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
|
|
@@ -81,7 +81,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
81
81
|
<OButton
|
|
82
82
|
text={t('SKIP', 'Skip')}
|
|
83
83
|
onClick={onSkip}
|
|
84
|
-
textStyle={{ color: theme.colors.primary, fontSize:
|
|
84
|
+
textStyle={{ color: theme.colors.primary, fontSize: 18 }}
|
|
85
85
|
parentStyle={{
|
|
86
86
|
height: orientationState?.orientation === PORTRAIT
|
|
87
87
|
? 50 : 100
|
|
@@ -24,11 +24,6 @@ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
|
24
24
|
|
|
25
25
|
const PaymentOptionsUI = (props: any) => {
|
|
26
26
|
const {
|
|
27
|
-
cart,
|
|
28
|
-
onNavigationRedirect,
|
|
29
|
-
isDisabled,
|
|
30
|
-
paymethodData,
|
|
31
|
-
handlePaymethodDataChange,
|
|
32
27
|
errorCash,
|
|
33
28
|
isLoading,
|
|
34
29
|
paymethodsList,
|
|
@@ -48,11 +43,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
48
43
|
const [orientationState] = useDeviceOrientation();
|
|
49
44
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
50
45
|
const [isOpenModal, setIsOpenModal] = useState(false)
|
|
51
|
-
const paymethodSelected =
|
|
52
|
-
|
|
46
|
+
const paymethodSelected = paySelected || props.paymethodSelected || isOpenMethod.paymethod;
|
|
47
|
+
const includePaymethods = ['cash', 'card_delivery'];
|
|
53
48
|
|
|
54
49
|
useEffect(() => {
|
|
55
|
-
if (paymethodsList
|
|
50
|
+
if (paymethodsList?.paymethods?.length === 1) {
|
|
56
51
|
handlePaymethodClick &&
|
|
57
52
|
handlePaymethodClick(paymethodsList.paymethods[0]);
|
|
58
53
|
}
|
|
@@ -85,23 +80,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
85
80
|
}
|
|
86
81
|
}, [isOpenMethod.paymethod, placing, isLoading, paySelected]);
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
const includePaymethods = ['cash', 'card_delivery'];
|
|
90
|
-
|
|
91
|
-
const supportedMethods = paymethodsList.paymethods.filter((p: any) =>
|
|
83
|
+
const supportedMethods = paymethodsList?.paymethods?.filter((p: any) =>
|
|
92
84
|
includePaymethods.includes(p.gateway),
|
|
93
85
|
);
|
|
94
86
|
|
|
95
|
-
const
|
|
96
|
-
(item: any) => item?.gateway === 'cash',
|
|
97
|
-
);
|
|
98
|
-
const cardOnDeliveryIndex = supportedMethods?.findIndex(
|
|
99
|
-
(item: any) => item?.gateway === 'card_delivery',
|
|
100
|
-
);
|
|
101
|
-
const stripeIndex = supportedMethods?.findIndex(
|
|
102
|
-
(item: any) => item?.gateway === 'stripe',
|
|
103
|
-
);
|
|
104
|
-
const onSelectPaymethod = (paymethod: any, isPopupMethod: boolean) => {
|
|
87
|
+
const onSelectPaymethod = (paymethod: any) => {
|
|
105
88
|
handlePaymethodClick(paymethod);
|
|
106
89
|
};
|
|
107
90
|
|
|
@@ -132,57 +115,15 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
132
115
|
: orientationState?.dimensions?.height * 0.55,
|
|
133
116
|
};
|
|
134
117
|
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
),
|
|
145
|
-
bgImage: theme.images.general.cash,
|
|
146
|
-
callToActionText: t('LETS_GO', 'LETS_GO'),
|
|
147
|
-
VectorIcon: () => <AntIconDesign name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
148
|
-
onClick: () =>
|
|
149
|
-
onSelectPaymethod(supportedMethods[cashIndex], false),
|
|
150
|
-
...supportedMethods[cashIndex],
|
|
151
|
-
}
|
|
152
|
-
: null,
|
|
153
|
-
|
|
154
|
-
CARD_ON_DELIVERY_ID:
|
|
155
|
-
cardOnDeliveryIndex !== -1
|
|
156
|
-
? {
|
|
157
|
-
style: cardStyle,
|
|
158
|
-
title: t('CARD', supportedMethods[cardOnDeliveryIndex]?.name),
|
|
159
|
-
description: t(
|
|
160
|
-
'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
|
|
161
|
-
'We accept every debit or credit card',
|
|
162
|
-
),
|
|
163
|
-
bgImage: theme.images.general.carddelivery,
|
|
164
|
-
callToActionText: t("LETS_GO", "Let's go"),
|
|
165
|
-
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
166
|
-
onClick: () => onSelectPaymethod(supportedMethods[cardOnDeliveryIndex], false),
|
|
167
|
-
...supportedMethods[cardOnDeliveryIndex],
|
|
168
|
-
}
|
|
169
|
-
: null,
|
|
170
|
-
STRIPE:
|
|
171
|
-
stripeIndex !== -1
|
|
172
|
-
? {
|
|
173
|
-
style: cardStyle,
|
|
174
|
-
title: t('STRIPE', supportedMethods[stripeIndex]?.name),
|
|
175
|
-
description: t('STRIPE', 'Stripe'),
|
|
176
|
-
bgImage: theme.images.general.carddelivery,
|
|
177
|
-
callToActionText: t('INSERT_INFO', 'Test info'),
|
|
178
|
-
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
179
|
-
onClick: () => {
|
|
180
|
-
onSelectPaymethod(supportedMethods[stripeIndex], false);
|
|
181
|
-
setIsOpenModal(true)
|
|
182
|
-
},
|
|
183
|
-
...supportedMethods[stripeIndex],
|
|
184
|
-
}
|
|
185
|
-
: null,
|
|
118
|
+
const description = {
|
|
119
|
+
cash: t(
|
|
120
|
+
'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
|
|
121
|
+
'Pay with cash in the front counter',
|
|
122
|
+
),
|
|
123
|
+
card_delivery: t(
|
|
124
|
+
'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
|
|
125
|
+
'We accept every debit or credit card',
|
|
126
|
+
),
|
|
186
127
|
};
|
|
187
128
|
|
|
188
129
|
const goToBack = () => navigation?.goBack();
|
|
@@ -192,47 +133,40 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
192
133
|
<Spinner visible={isLoading || placing || paymethodsList?.loading} />
|
|
193
134
|
|
|
194
135
|
<Container nestedScrollEnabled>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
{
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
orientationState?.orientation === PORTRAIT
|
|
230
|
-
? orientationState?.dimensions?.height * 0.018
|
|
231
|
-
: 1,
|
|
232
|
-
}}
|
|
233
|
-
/>
|
|
234
|
-
|
|
235
|
-
{propsOfItems?.CASH_ID && <OptionCard {...propsOfItems?.CASH_ID} />}
|
|
136
|
+
<NavBar
|
|
137
|
+
title={t('PAYMENT_METHODS', 'Payment methods')}
|
|
138
|
+
onActionLeft={goToBack}
|
|
139
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<View
|
|
143
|
+
style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
144
|
+
<OText size={orientationState?.dimensions?.width * 0.048}>
|
|
145
|
+
{t('HOW_WOULD_YOU', 'How would you')} {'\n'}
|
|
146
|
+
<OText
|
|
147
|
+
size={orientationState?.dimensions?.width * 0.048}
|
|
148
|
+
weight={'700'}>
|
|
149
|
+
{`${t('LIKE_TO_PAY', 'like to pay')}?`}
|
|
150
|
+
</OText>
|
|
151
|
+
</OText>
|
|
152
|
+
</View>
|
|
153
|
+
|
|
154
|
+
<GridContainer style={{ justifyContent: 'space-between' }}>
|
|
155
|
+
{supportedMethods?.length > 0 ? (supportedMethods?.map((paymethod: any, i: number) => (
|
|
156
|
+
<>
|
|
157
|
+
<View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
|
|
158
|
+
<OptionCard
|
|
159
|
+
{...{
|
|
160
|
+
style: cardStyle,
|
|
161
|
+
title: t(`${paymethod.gateway.toUpperCase().replace(/\s/g, '_')}`, paymethod.name),
|
|
162
|
+
description: description[paymethod.gateway] ?? t(`${paymethod.gateway.toUpperCase().replace(/\s/g, '_')}`, paymethod.name),
|
|
163
|
+
bgImage: paymethod.name === 'Cash' ? theme.images.general.cash : theme.images.general.carddelivery,
|
|
164
|
+
callToActionText: paymethod.name === 'Cash' ? t('LETS_GO', 'LETS_GO') : t('INSERT_INFO', 'Test info'),
|
|
165
|
+
VectorIcon: () => paymethod.name === 'Cash' ? <AntIconDesign name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} /> : <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
166
|
+
onClick: () => onSelectPaymethod(paymethod, false),
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
236
170
|
|
|
237
171
|
<View
|
|
238
172
|
style={{
|
|
@@ -246,13 +180,15 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
246
180
|
: 1,
|
|
247
181
|
}}
|
|
248
182
|
/>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
183
|
+
</>
|
|
184
|
+
))) : (
|
|
185
|
+
<OText
|
|
186
|
+
size={orientationState?.dimensions?.width * 0.048}
|
|
187
|
+
weight={'700'}>
|
|
188
|
+
{`${t('NO_PAYMETHODS_AVAILABLES', 'No paymethods availables')}`}
|
|
189
|
+
</OText>
|
|
190
|
+
)}
|
|
191
|
+
</GridContainer>
|
|
256
192
|
<View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
|
|
257
193
|
<OModal
|
|
258
194
|
open={isOpenModal}
|