ordering-ui-react-native 0.21.39-test → 0.21.39

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.21.39-test",
3
+ "version": "0.21.39",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -45,7 +45,6 @@
45
45
  "@react-native-firebase/analytics": "^12.9.3",
46
46
  "@react-native-firebase/app": "^12.9.3",
47
47
  "@react-native-google-signin/google-signin": "^7.0.1",
48
- "@react-native-picker/picker": "^2.4.10",
49
48
  "@react-navigation/drawer": "^5.10.2",
50
49
  "@react-navigation/material-bottom-tabs": "^5.3.14",
51
50
  "@react-navigation/native": "^5.7.6",
@@ -111,7 +110,6 @@
111
110
  "react-native-signature-canvas": "^4.3.0",
112
111
  "react-native-snap-carousel": "^3.9.1",
113
112
  "react-native-sound": "^0.11.1",
114
- "react-native-star-io10": "^1.3.0",
115
113
  "react-native-swipe-gestures": "^1.0.5",
116
114
  "react-native-swiper": "^1.6.0",
117
115
  "react-native-tracking-transparency": "^0.1.1",
@@ -42,8 +42,6 @@ import { NewOrderNotification } from './src/components/NewOrderNotification';
42
42
  import { DriverSchedule } from './src/components/DriverSchedule';
43
43
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
44
44
  import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
45
- import { HandleStarPrinter } from './src/components/StarPrinter';
46
- import { SearchStarPrinter } from './src/components/StarPrinter/SearchPrinter';
47
45
  //OComponents
48
46
  import {
49
47
  OText,
@@ -132,7 +130,4 @@ export {
132
130
  useLocation,
133
131
  // providers
134
132
  StoreMethods,
135
- //printer
136
- HandleStarPrinter,
137
- SearchStarPrinter,
138
133
  };
@@ -1,8 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { OText, OIconButton } from '../shared';
3
- import {
4
- StyleSheet, View, Platform, Alert
5
- } from 'react-native';
3
+ import { StyleSheet, View, Platform, Alert } from 'react-native';
6
4
  import {
7
5
  Content,
8
6
  OrderCustomer,
@@ -22,8 +20,8 @@ import { FloatingButton } from '../FloatingButton';
22
20
  import RNHTMLtoPDF from 'react-native-html-to-pdf';
23
21
  import RNPrint from 'react-native-print';
24
22
  import { useTheme } from 'styled-components/native';
25
- import { ProductItemAccordion } from '../ProductItemAccordion';
26
23
 
24
+ import { ProductItemAccordion } from '../ProductItemAccordion';
27
25
 
28
26
  export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermission, getPermissions, isGrantedPermissions, checkBluetoothPermission }: any) => {
29
27
  const handleArrowBack: any = () => {
@@ -36,7 +34,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
36
34
  selectedPrinter: { url: undefined },
37
35
  });
38
36
 
39
-
40
37
  const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
41
38
  if (name !== 'No') {
42
39
  const pos = position && position !== 'whole' ? `(${t(position.toUpperCase(), position)})` : '';
@@ -343,10 +340,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
343
340
  }
344
341
  };
345
342
 
346
- const openPrint = () => {
347
- navigation.navigate('HandleStarPrinter')
348
- }
349
-
350
343
  return (
351
344
  <>
352
345
  <Content>
@@ -686,7 +679,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
686
679
 
687
680
  <View style={{ marginBottom: 0 }}>
688
681
  <FloatingButton
689
- firstButtonClick={() => openPrint()}
682
+ firstButtonClick={() => handlePrint()}
690
683
  btnText={t('PRINT', 'Print')}
691
684
  color={theme.colors.green}
692
685
  widthButton={'100%'}
@@ -52,7 +52,7 @@ const LoginFormUI = (props: LoginParams) => {
52
52
  } = props;
53
53
 
54
54
  const theme = useTheme()
55
- const [{ configs }] = useConfig()
55
+ const [{ configs }, { refreshConfigs }] = useConfig()
56
56
  const [ordering, { setOrdering }] = useApi();
57
57
  const [, { showToast }] = useToast();
58
58
  const [, t] = useLanguage();
@@ -347,13 +347,16 @@ const LoginFormUI = (props: LoginParams) => {
347
347
  project: projectName
348
348
  })
349
349
  }
350
- if (isDeviceLoginEnabled) {
351
- props.handleChangeTab('device_code')
352
- }
353
350
  }, 1500)
354
351
  return () => clearTimeout(projectInputTimeout);
355
352
  }, [projectName, isDeviceLoginEnabled])
356
353
 
354
+ useEffect(() => {
355
+ if (ordering?.project) {
356
+ refreshConfigs()
357
+ }
358
+ }, [ordering?.project])
359
+
357
360
  const logo = (
358
361
  <LogoWrapper>
359
362
  <OIcon src={theme.images.logos.logotype} style={styles.logo} />
@@ -106,7 +106,6 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
106
106
  location={businessLocation.location}
107
107
  markerTitle={businessState?.business?.name}
108
108
  businessZones={businessState?.business?.zones}
109
- delta={30}
110
109
  />
111
110
  </WrapBusinessMap>
112
111
  )}
@@ -192,7 +192,11 @@ const CheckoutUI = (props: any) => {
192
192
  }, cart?.subtotal)
193
193
 
194
194
  const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
195
- const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required && !paymethodSelected?.data?.card?.zipcode
195
+ const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
196
+ validationFields?.fields?.card?.zipcode?.required &&
197
+ paymethodSelected?.data?.card &&
198
+ !paymethodSelected?.data?.card?.zipcode &&
199
+ paymethodSelected?.gateway === 'stripe'
196
200
 
197
201
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
198
202
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
@@ -106,7 +106,7 @@ const RedeemGiftCardUI = (props: any) => {
106
106
  onChange(val)
107
107
  handleChangeCode(val)
108
108
  }}
109
- autoCapitalize='none'
109
+ autoCapitalize='characters'
110
110
  autoCorrect={false}
111
111
  blurOnSubmit={false}
112
112
  style={style.inputStyle}
@@ -129,7 +129,8 @@ export const LastOrder = (props: OrdersOptionParams) => {
129
129
  initialPage: 1,
130
130
  pageSize: 3,
131
131
  controlType: 'infinity'
132
- }
132
+ },
133
+ noGiftCardOrders: true
133
134
  }
134
135
 
135
136
  return <OrderList {...MyOrdersProps} />
@@ -117,7 +117,8 @@ export const LastOrders = (props: any) => {
117
117
  initialPage: 1,
118
118
  pageSize: 3,
119
119
  controlType: 'infinity'
120
- }
120
+ },
121
+ noGiftCardOrders: true
121
122
  }
122
123
  return <OrderListController {...helpProps} />
123
124
  }
@@ -208,7 +208,8 @@ export const OrderProgress = (props: any) => {
208
208
  initialPage: 1,
209
209
  pageSize: 10,
210
210
  controlType: 'infinity'
211
- }
211
+ },
212
+ noGiftCardOrders: true
212
213
  }
213
214
 
214
215
  return <OrderList {...orderProgressProps} />
@@ -11,6 +11,7 @@ import {
11
11
  useLanguage,
12
12
  ToastType,
13
13
  useToast,
14
+ useSession
14
15
  } from 'ordering-components/native';
15
16
  import { useTheme } from 'styled-components/native';
16
17
  import { PaymentOptionCash } from '../PaymentOptionCash';
@@ -78,6 +79,7 @@ const PaymentOptionsUI = (props: any) => {
78
79
 
79
80
  const theme = useTheme();
80
81
  const [, { showToast }] = useToast();
82
+ const [{ user }] = useSession()
81
83
  const { confirmApplePayPayment } = useApplePay()
82
84
 
83
85
  const getPayIcon = (method: string) => {
@@ -120,7 +122,7 @@ const PaymentOptionsUI = (props: any) => {
120
122
  const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
121
123
 
122
124
  const handlePaymentMethodClick = (paymethod: any) => {
123
- if (cart?.balance > 0) {
125
+ if (cart?.balance > 0 || !!user?.guest_id) {
124
126
  if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
125
127
  openUserModal && openUserModal(true)
126
128
  setPaymethodClicked({
@@ -505,7 +505,7 @@ export const ProductOptionsUI = (props: any) => {
505
505
  <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
506
506
  {actionStatus?.loading ? (
507
507
  <Placeholder Animation={Fade}>
508
- <PlaceholderLine width={60} height={20} />
508
+ <PlaceholderLine height={20} />
509
509
  </Placeholder>
510
510
  ) : (
511
511
  <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
@@ -1,80 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- View,
4
- Text,
5
- Button,
6
- FlatList,
7
- } from 'react-native';
8
-
9
- import {
10
- InterfaceType,
11
- StarDeviceDiscoveryManager,
12
- StarDeviceDiscoveryManagerFactory,
13
- StarPrinter
14
- } from 'react-native-star-io10';
15
-
16
- export const SearchStarPrinter = () => {
17
-
18
- let _manager: StarDeviceDiscoveryManager;
19
-
20
- const [state, setState] = useState({
21
- bluetoonabled: true,
22
- printers: [],
23
- })
24
-
25
- let _onPressDiscoveryButton = async () => {
26
- setState({
27
- ...state,
28
- printers: [],
29
- });
30
-
31
- try {
32
- await _manager?.stopDiscovery()
33
-
34
- var interfaceTypes: Array<InterfaceType> = []
35
- if (state.bluetoonabled) {
36
- interfaceTypes.push(InterfaceType.Bluetooth);
37
- }
38
-
39
- _manager = await StarDeviceDiscoveryManagerFactory.create(interfaceTypes);
40
- _manager.discoveryTime = 10000;
41
-
42
- _manager.onPrinterFound = (printer: StarPrinter) => {
43
- const printers = state.printers;
44
- printers.push(printer);
45
- setState({
46
- ...state,
47
- printers: printers
48
- });
49
-
50
- console.log(`Found printer: ${printer.connectionSettings.identifier}.`);
51
- };
52
-
53
- _manager.onDiscoveryFinished = () => {
54
- console.log(`Discovery finished.`);
55
- };
56
-
57
- await _manager.startDiscovery();
58
- }
59
- catch (error) {
60
- console.log(`Error: ${String(error)}`);
61
- }
62
- }
63
-
64
- return (
65
- <View style={{ margin: 50 }}>
66
- <View
67
- style={{ width: 100, marginTop: 30 }}>
68
- <Button
69
- title="Discovery"
70
- onPress={_onPressDiscoveryButton}
71
- />
72
- </View>
73
- <FlatList
74
- style={{ marginTop: 30 }}
75
- data={state.printers}
76
- renderItem={({ item }) => <Text>{item.connectionSettings.interfaceType} : {item.connectionSettings.identifier}</Text>}
77
- keyExtractor={(item, index) => index.toString()} />
78
- </View>
79
- );
80
- };
@@ -1,156 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- InterfaceType,
4
- StarConnectionSettings,
5
- StarXpandCommand,
6
- StarPrinter
7
- } from 'react-native-star-io10';
8
- import { Picker } from '@react-native-picker/picker';
9
- import {
10
- View,
11
- Text,
12
- Button,
13
- TextInput,
14
- } from 'react-native';
15
-
16
-
17
- export const HandleStarPrinter = ({ navigation }: any) => {
18
-
19
- const [printState, setPrintState] = useState({
20
- interfaceType: InterfaceType.Bluetooth,
21
- identifier: '',
22
- imageBase64: ''
23
- });
24
-
25
- const _onPressPrintButton = async () => {
26
-
27
- let settings = new StarConnectionSettings();
28
- settings.interfaceType = printState.interfaceType;
29
- settings.identifier = printState.identifier;
30
-
31
- let printer = new StarPrinter(settings);
32
-
33
- try {
34
- let builder = new StarXpandCommand.StarXpandCommandBuilder();
35
- builder.addDocument(new StarXpandCommand.DocumentBuilder()
36
- .addPrinter(new StarXpandCommand.PrinterBuilder()
37
- .actionPrintImage(new StarXpandCommand.Printer.ImageParameter("logo_01.png", 406))
38
- .styleInternationalCharacter(StarXpandCommand.Printer.InternationalCharacterType.Usa)
39
- .styleCharacterSpace(0)
40
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
41
- .actionPrintText("Star Clothing Boutique\n" +
42
- "123 Star Road\n" +
43
- "City, State 12345\n" +
44
- "\n")
45
- .styleAlignment(StarXpandCommand.Printer.Alignment.Left)
46
- .actionPrintText("Date:MM/DD/YYYY Time:HH:MM PM\n" +
47
- "--------------------------------\n" +
48
- "\n")
49
- .actionPrintText("SKU Description Total\n" +
50
- "300678566 PLAIN T-SHIRT 10.99\n" +
51
- "300692003 BLACK DENIM 29.99\n" +
52
- "300651148 BLUE DENIM 29.99\n" +
53
- "300642980 STRIPED DRESS 49.99\n" +
54
- "300638471 BLACK BOOTS 35.99\n" +
55
- "\n" +
56
- "Subtotal 156.95\n" +
57
- "Tax 0.00\n" +
58
- "--------------------------------\n")
59
- .actionPrintText("Total ")
60
- .add(new StarXpandCommand.PrinterBuilder()
61
- .styleMagnification(new StarXpandCommand.MagnificationParameter(2, 2))
62
- .actionPrintText(" $156.95\n")
63
- )
64
- .actionPrintText("--------------------------------\n" +
65
- "\n" +
66
- "Charge\n" +
67
- "156.95\n" +
68
- "Visa XXXX-XXXX-XXXX-0123\n" +
69
- "\n")
70
- .add(new StarXpandCommand.PrinterBuilder()
71
- .styleInvert(true)
72
- .actionPrintText("Refunds and Exchanges\n")
73
- )
74
- .actionPrintText("Within ")
75
- .add(new StarXpandCommand.PrinterBuilder()
76
- .styleUnderLine(true)
77
- .actionPrintText("30 days")
78
- )
79
- .actionPrintText(" with receipt\n")
80
- .actionPrintText("And tags attached\n" +
81
- "\n")
82
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
83
- .actionPrintBarcode(new StarXpandCommand.Printer.BarcodeParameter('0123456',
84
- StarXpandCommand.Printer.BarcodeSymbology.Jan8)
85
- .setBarDots(3)
86
- .setBarRatioLevel(StarXpandCommand.Printer.BarcodeBarRatioLevel.Level0)
87
- .setHeight(5)
88
- .setPrintHri(true))
89
- .actionFeedLine(1)
90
- .actionPrintQRCode(new StarXpandCommand.Printer.QRCodeParameter('Hello World.\n')
91
- .setModel(StarXpandCommand.Printer.QRCodeModel.Model2)
92
- .setLevel(StarXpandCommand.Printer.QRCodeLevel.L)
93
- .setCellSize(8))
94
- .actionCut(StarXpandCommand.Printer.CutType.Partial)
95
- )
96
- );
97
-
98
- let commands = await builder.getCommands();
99
-
100
- await printer.open();
101
- await printer.print(commands);
102
-
103
- console.log(`Success`);
104
- }
105
- catch (error) {
106
- console.log(`Error: ${String(error)}`);
107
- }
108
- finally {
109
- await printer.close();
110
- await printer.dispose();
111
- }
112
- }
113
-
114
- const onSearchPrint = () => {
115
- navigation.navigate('HandleStarPrinter')
116
- }
117
-
118
- return (
119
- <View style={{ margin: 50 }}>
120
- <View style={{ flexDirection: 'row' }}>
121
- <Text style={{ width: 100 }}>Interface</Text>
122
- <Picker
123
- style={{ width: 200, marginLeft: 20, justifyContent: 'center' }}
124
- selectedValue={printState.interfaceType}
125
- onValueChange={(value) => {
126
- setPrintState({ interfaceType: value });
127
- }}>
128
- <Picker.Item label='Bluetooth' value={InterfaceType.Bluetooth} />
129
- </Picker>
130
- </View>
131
- <View style={{ flexDirection: 'row', marginTop: 30 }}>
132
- <Text style={{ width: 100 }}>Identifier</Text>
133
- <TextInput
134
- style={{ width: 200, marginLeft: 20 }}
135
- value={printState.identifier}
136
- onChangeText={(value) => {
137
- setPrintState({ identifier: value });
138
- }}
139
- />
140
- <View style={{ width: 100, marginTop: 20 }}>
141
- <Button
142
- title="Search Printer"
143
- onPress={onSearchPrint}
144
- />
145
- </View>
146
- </View>
147
- <View style={{ width: 100, marginTop: 20 }}>
148
- <Button
149
- title="Print"
150
- onPress={_onPressPrintButton}
151
- />
152
- </View>
153
- </View>
154
- );
155
- };
156
-