ordering-ui-react-native 0.22.2 → 0.22.4
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 +1 -1
- package/src/components/StripeMethodForm/index.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +16 -4
- package/themes/business/src/components/PrinterSettings/index.tsx +34 -4
- package/themes/business/src/components/PrinterSettings/styles.tsx +7 -0
- package/themes/business/src/types/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +5 -5
- package/themes/original/src/components/ProductItemAccordion/index.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -1
package/package.json
CHANGED
|
@@ -152,7 +152,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
|
152
152
|
|
|
153
153
|
const { error, paymentMethod } = await presentApplePay({
|
|
154
154
|
cartItems: [{
|
|
155
|
-
label: t('
|
|
155
|
+
label: t('CART_APPLE_PAY_LABEL', 'Cart'),
|
|
156
156
|
amount: cartTotal?.toString?.() ?? cart?.balance?.toString() ?? cart?.total?.toString?.(),
|
|
157
157
|
paymentType: 'Immediate'
|
|
158
158
|
}],
|
|
@@ -48,7 +48,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
48
48
|
readMessages,
|
|
49
49
|
messagesReadList,
|
|
50
50
|
handleAssignDriver,
|
|
51
|
-
handleChangeOrderStatus,
|
|
52
51
|
isFromCheckout,
|
|
53
52
|
driverLocation,
|
|
54
53
|
actions,
|
|
@@ -76,6 +75,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
76
75
|
const [openModalForMapView, setOpenModalForMapView] = useState(false);
|
|
77
76
|
const [isDriverModalVisible, setIsDriverModalVisible] = useState(false);
|
|
78
77
|
const [printerSettings, setPrinterSettings] = useState('')
|
|
78
|
+
const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
|
|
79
79
|
|
|
80
80
|
if (order?.status === 7 || order?.status === 4) {
|
|
81
81
|
if (drivers?.length > 0 && drivers) {
|
|
@@ -126,6 +126,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
const handleChangeOrderStatus = async (status: any, isAcceptOrReject: any = {}) => {
|
|
130
|
+
if (props.handleChangeOrderStatus) {
|
|
131
|
+
const order: any = await props.handleChangeOrderStatus(status, isAcceptOrReject)
|
|
132
|
+
|
|
133
|
+
if (order?.status !== 0 && autoPrintEnabled && printerSettings) {
|
|
134
|
+
handleViewSummaryOrder()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
130
140
|
if (name !== 'No') {
|
|
131
141
|
const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : '';
|
|
@@ -412,12 +422,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
412
422
|
}, [driverLocation]);
|
|
413
423
|
|
|
414
424
|
useEffect(() => {
|
|
415
|
-
const
|
|
416
|
-
|
|
425
|
+
const getStorageData = async () => {
|
|
426
|
+
const printer = await _retrieveStoreData('printer')
|
|
427
|
+
const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
|
|
417
428
|
setPrinterSettings(printer)
|
|
429
|
+
setAutoPrintEnabled(!!autoPrint)
|
|
418
430
|
}
|
|
419
431
|
|
|
420
|
-
|
|
432
|
+
getStorageData()
|
|
421
433
|
}, [])
|
|
422
434
|
|
|
423
435
|
const styles = StyleSheet.create({
|
|
@@ -6,16 +6,18 @@ import FeatherIcon from 'react-native-vector-icons/Feather'
|
|
|
6
6
|
import MCIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
7
7
|
import FAIcons from 'react-native-vector-icons/FontAwesome'
|
|
8
8
|
import { useTheme } from 'styled-components/native'
|
|
9
|
+
import ToggleSwitch from 'toggle-switch-react-native';
|
|
9
10
|
import { useLanguage } from 'ordering-components/native'
|
|
10
11
|
|
|
11
12
|
import { _setStoreData, _retrieveStoreData } from '../../providers/StoreUtil'
|
|
12
|
-
import { Container } from './styles'
|
|
13
|
+
import { Container, EnabledAutoPrint } from './styles'
|
|
13
14
|
import { OText, OInput} from '../shared'
|
|
14
15
|
|
|
15
16
|
export const PrinterSettings = (props: any) => {
|
|
16
17
|
const { onClose } = props
|
|
17
18
|
|
|
18
19
|
const [currentPrinter, setCurrentPrinter] = useState<any>(null)
|
|
20
|
+
const [autoPrintEnabled, setAutoPrintEnabled] = useState<boolean>(false)
|
|
19
21
|
const [layoutWidth, setLayoutWidth] = useState<any>({ actionsBtns: 0 })
|
|
20
22
|
|
|
21
23
|
const WIDTH_SCREEN = Dimensions.get('window').width
|
|
@@ -58,6 +60,9 @@ export const PrinterSettings = (props: any) => {
|
|
|
58
60
|
borderWidth: 1,
|
|
59
61
|
borderRadius: 8,
|
|
60
62
|
},
|
|
63
|
+
label: {
|
|
64
|
+
color: theme.colors.textGray
|
|
65
|
+
},
|
|
61
66
|
})
|
|
62
67
|
|
|
63
68
|
const printerList = [
|
|
@@ -111,13 +116,20 @@ export const PrinterSettings = (props: any) => {
|
|
|
111
116
|
onClose && onClose()
|
|
112
117
|
}
|
|
113
118
|
|
|
119
|
+
const handleAutoPrint = async () => {
|
|
120
|
+
setAutoPrintEnabled(!autoPrintEnabled)
|
|
121
|
+
await _setStoreData('auto_print_after_accept_order', !autoPrintEnabled)
|
|
122
|
+
}
|
|
123
|
+
|
|
114
124
|
useEffect(() => {
|
|
115
|
-
const
|
|
125
|
+
const getStorageData = async () => {
|
|
116
126
|
const printer = await _retrieveStoreData('printer')
|
|
127
|
+
const autoPrint = await _retrieveStoreData('auto_print_after_accept_order')
|
|
117
128
|
setCurrentPrinter(printer)
|
|
129
|
+
setAutoPrintEnabled(!!autoPrint)
|
|
118
130
|
}
|
|
119
131
|
|
|
120
|
-
|
|
132
|
+
getStorageData()
|
|
121
133
|
}, [])
|
|
122
134
|
|
|
123
135
|
useEffect(() => {
|
|
@@ -131,7 +143,25 @@ export const PrinterSettings = (props: any) => {
|
|
|
131
143
|
<OText size={24} style={{ paddingLeft: 30 }}>
|
|
132
144
|
{t('PRINTER_SETTINGS', 'Printer Settings')}
|
|
133
145
|
</OText>
|
|
134
|
-
<
|
|
146
|
+
<EnabledAutoPrint>
|
|
147
|
+
<View style={{ flex: 1 }}>
|
|
148
|
+
<OText
|
|
149
|
+
numberOfLines={2}
|
|
150
|
+
adjustsFontSizeToFit
|
|
151
|
+
style={{ ...styles.label, paddingHorizontal: 0 }}>
|
|
152
|
+
{t('AUTO_PRINT_AFTER_ACCEPTING_ORDER', 'Auto print after accepting order')}
|
|
153
|
+
</OText>
|
|
154
|
+
</View>
|
|
155
|
+
<ToggleSwitch
|
|
156
|
+
isOn={autoPrintEnabled}
|
|
157
|
+
onColor={theme.colors.primary}
|
|
158
|
+
offColor={theme.colors.offColor}
|
|
159
|
+
size="small"
|
|
160
|
+
onToggle={() => handleAutoPrint()}
|
|
161
|
+
animationSpeed={200}
|
|
162
|
+
/>
|
|
163
|
+
</EnabledAutoPrint>
|
|
164
|
+
<View style={{ paddingHorizontal: 30 }}>
|
|
135
165
|
{printerList.map((item: any, i: number) => (
|
|
136
166
|
<Container
|
|
137
167
|
key={i}
|
|
@@ -8,3 +8,10 @@ export const Container = styled.View`
|
|
|
8
8
|
border-bottom-width: 1px;
|
|
9
9
|
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
10
10
|
`
|
|
11
|
+
|
|
12
|
+
export const EnabledAutoPrint = styled.View`
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
padding: 20px 30px 10px;
|
|
17
|
+
`;
|
|
@@ -392,7 +392,7 @@ export interface OrderDetailsParams {
|
|
|
392
392
|
urlToShare?: string;
|
|
393
393
|
messages?: any;
|
|
394
394
|
handleAssignDriver?: (id: any) => {};
|
|
395
|
-
handleChangeOrderStatus?: (status: any) => {};
|
|
395
|
+
handleChangeOrderStatus?: (status: any, isAcceptOrReject: any) => {};
|
|
396
396
|
order?: any;
|
|
397
397
|
isFromRoot?: any;
|
|
398
398
|
handleOrderRedirect?: () => {};
|
|
@@ -368,7 +368,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
368
368
|
methodPaySupported={methodPaySupported}
|
|
369
369
|
placeByMethodPay={placeByMethodPay}
|
|
370
370
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
371
|
-
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
371
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
372
372
|
/>
|
|
373
373
|
)}
|
|
374
374
|
|
|
@@ -413,7 +413,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
413
413
|
merchantId={merchantId}
|
|
414
414
|
urlscheme={urlscheme}
|
|
415
415
|
androidAppId={androidAppId}
|
|
416
|
-
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
416
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
417
417
|
/>
|
|
418
418
|
</KeyboardAvoidingView>
|
|
419
419
|
</OModal>
|
|
@@ -438,7 +438,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
438
438
|
onNavigationRedirect={onNavigationRedirect}
|
|
439
439
|
onCancel={() => handlePaymethodClick(null)}
|
|
440
440
|
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
441
|
-
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
441
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
442
442
|
/>
|
|
443
443
|
</View>
|
|
444
444
|
)}
|
|
@@ -463,7 +463,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
463
463
|
accountId={isOpenMethod?.paymethod?.credentials?.user}
|
|
464
464
|
onSelectCard={handlePaymethodDataChange}
|
|
465
465
|
onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
|
|
466
|
-
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
466
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
467
467
|
/>
|
|
468
468
|
</KeyboardAvoidingView>
|
|
469
469
|
</OModal>
|
|
@@ -491,7 +491,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
491
491
|
requirements={props.clientSecret}
|
|
492
492
|
onSelectCard={handlePaymethodDataChange}
|
|
493
493
|
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
494
|
-
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
494
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
495
495
|
/>
|
|
496
496
|
</KeyboardAvoidingView>
|
|
497
497
|
</OModal>
|
|
@@ -280,7 +280,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
280
280
|
)}
|
|
281
281
|
</Accordion>
|
|
282
282
|
|
|
283
|
-
<View style={{ display: isActive ? 'flex' : 'none', paddingStart: 40 }}>
|
|
283
|
+
<View style={{ display: isActive ? 'flex' : 'none', paddingStart: isFromCheckout ? 100 : 40, marginTop: isFromCheckout ? -80 : -30 }}>
|
|
284
284
|
<Animated.View>
|
|
285
285
|
<AccordionContent>
|
|
286
286
|
{productInfo().ingredients.length > 0 && productInfo().ingredients.some((ingredient: any) => !ingredient.selected) && (
|