ordering-ui-react-native 0.21.35-test → 0.21.35

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.35-test",
3
+ "version": "0.21.35",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -110,7 +110,6 @@
110
110
  "react-native-signature-canvas": "^4.3.0",
111
111
  "react-native-snap-carousel": "^3.9.1",
112
112
  "react-native-sound": "^0.11.1",
113
- "react-native-star-io10": "^1.3.0",
114
113
  "react-native-swipe-gestures": "^1.0.5",
115
114
  "react-native-swiper": "^1.6.0",
116
115
  "react-native-tracking-transparency": "^0.1.1",
@@ -20,14 +20,8 @@ import { FloatingButton } from '../FloatingButton';
20
20
  import RNHTMLtoPDF from 'react-native-html-to-pdf';
21
21
  import RNPrint from 'react-native-print';
22
22
  import { useTheme } from 'styled-components/native';
23
- import { ProductItemAccordion } from '../ProductItemAccordion';
24
- import {
25
- InterfaceType,
26
- StarConnectionSettings,
27
- StarXpandCommand,
28
- StarPrinter
29
- } from 'react-native-star-io10';
30
23
 
24
+ import { ProductItemAccordion } from '../ProductItemAccordion';
31
25
 
32
26
  export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermission, getPermissions, isGrantedPermissions, checkBluetoothPermission }: any) => {
33
27
  const handleArrowBack: any = () => {
@@ -39,11 +33,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
39
33
  const [state, setState] = useState({
40
34
  selectedPrinter: { url: undefined },
41
35
  });
42
- const [printState] = useState({
43
- interfaceType: InterfaceType.Bluetooth,
44
- identifier: '00:11:62:00:00:00',
45
- imageBase64: ''
46
- });
47
36
 
48
37
  const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
49
38
  if (name !== 'No') {
@@ -351,95 +340,6 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
351
340
  }
352
341
  };
353
342
 
354
- const _onPressPrintButton = async () => {
355
-
356
- let settings = new StarConnectionSettings();
357
- settings.interfaceType = printState.interfaceType;
358
- settings.identifier = printState.identifier;
359
-
360
- let printer = new StarPrinter(settings);
361
-
362
- try {
363
- let builder = new StarXpandCommand.StarXpandCommandBuilder();
364
- builder.addDocument(new StarXpandCommand.DocumentBuilder()
365
- .addPrinter(new StarXpandCommand.PrinterBuilder()
366
- .actionPrintImage(new StarXpandCommand.Printer.ImageParameter("logo_01.png", 406))
367
- .styleInternationalCharacter(StarXpandCommand.Printer.InternationalCharacterType.Usa)
368
- .styleCharacterSpace(0)
369
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
370
- .actionPrintText("Star Clothing Boutique\n" +
371
- "123 Star Road\n" +
372
- "City, State 12345\n" +
373
- "\n")
374
- .styleAlignment(StarXpandCommand.Printer.Alignment.Left)
375
- .actionPrintText("Date:MM/DD/YYYY Time:HH:MM PM\n" +
376
- "--------------------------------\n" +
377
- "\n")
378
- .actionPrintText("SKU Description Total\n" +
379
- "300678566 PLAIN T-SHIRT 10.99\n" +
380
- "300692003 BLACK DENIM 29.99\n" +
381
- "300651148 BLUE DENIM 29.99\n" +
382
- "300642980 STRIPED DRESS 49.99\n" +
383
- "300638471 BLACK BOOTS 35.99\n" +
384
- "\n" +
385
- "Subtotal 156.95\n" +
386
- "Tax 0.00\n" +
387
- "--------------------------------\n")
388
- .actionPrintText("Total ")
389
- .add(new StarXpandCommand.PrinterBuilder()
390
- .styleMagnification(new StarXpandCommand.MagnificationParameter(2, 2))
391
- .actionPrintText(" $156.95\n")
392
- )
393
- .actionPrintText("--------------------------------\n" +
394
- "\n" +
395
- "Charge\n" +
396
- "156.95\n" +
397
- "Visa XXXX-XXXX-XXXX-0123\n" +
398
- "\n")
399
- .add(new StarXpandCommand.PrinterBuilder()
400
- .styleInvert(true)
401
- .actionPrintText("Refunds and Exchanges\n")
402
- )
403
- .actionPrintText("Within ")
404
- .add(new StarXpandCommand.PrinterBuilder()
405
- .styleUnderLine(true)
406
- .actionPrintText("30 days")
407
- )
408
- .actionPrintText(" with receipt\n")
409
- .actionPrintText("And tags attached\n" +
410
- "\n")
411
- .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
412
- .actionPrintBarcode(new StarXpandCommand.Printer.BarcodeParameter('0123456',
413
- StarXpandCommand.Printer.BarcodeSymbology.Jan8)
414
- .setBarDots(3)
415
- .setBarRatioLevel(StarXpandCommand.Printer.BarcodeBarRatioLevel.Level0)
416
- .setHeight(5)
417
- .setPrintHri(true))
418
- .actionFeedLine(1)
419
- .actionPrintQRCode(new StarXpandCommand.Printer.QRCodeParameter('Hello World.\n')
420
- .setModel(StarXpandCommand.Printer.QRCodeModel.Model2)
421
- .setLevel(StarXpandCommand.Printer.QRCodeLevel.L)
422
- .setCellSize(8))
423
- .actionCut(StarXpandCommand.Printer.CutType.Partial)
424
- )
425
- );
426
-
427
- let commands = await builder.getCommands();
428
-
429
- await printer.open();
430
- await printer.print(commands);
431
-
432
- console.log(`Success`);
433
- }
434
- catch (error) {
435
- console.log(`Error: ${String(error)}`);
436
- }
437
- finally {
438
- await printer.close();
439
- await printer.dispose();
440
- }
441
- }
442
-
443
343
  return (
444
344
  <>
445
345
  <Content>
@@ -779,7 +679,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
779
679
 
780
680
  <View style={{ marginBottom: 0 }}>
781
681
  <FloatingButton
782
- firstButtonClick={() => _onPressPrintButton()}
682
+ firstButtonClick={() => handlePrint()}
783
683
  btnText={t('PRINT', 'Print')}
784
684
  color={theme.colors.green}
785
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();
@@ -354,6 +354,12 @@ const LoginFormUI = (props: LoginParams) => {
354
354
  return () => clearTimeout(projectInputTimeout);
355
355
  }, [projectName, isDeviceLoginEnabled])
356
356
 
357
+ useEffect(() => {
358
+ if (ordering?.project) {
359
+ refreshConfigs()
360
+ }
361
+ }, [ordering?.project])
362
+
357
363
  const logo = (
358
364
  <LogoWrapper>
359
365
  <OIcon src={theme.images.logos.logotype} style={styles.logo} />
@@ -508,7 +508,7 @@ export const ProductOptionsUI = (props: any) => {
508
508
  <PlaceholderLine width={60} height={20} />
509
509
  </Placeholder>
510
510
  ) : (
511
- <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
511
+ <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
512
512
  )}
513
513
  </TouchableOpacity>
514
514
  )}
@@ -602,7 +602,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
602
602
  <PlaceholderLine width={60} height={20} />
603
603
  </Placeholder>
604
604
  ) : (
605
- <OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
605
+ <OText color={theme.colors.primary} size={13}>{t('AS_GUEST_USER', 'As guest user')}</OText>
606
606
  )}
607
607
  </TouchableOpacity>
608
608
  )}