PluginProbe
Packeta / 2.0.9
Packeta v2.0.9
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / PacketaWidget / View.jsx

View.jsx in Packeta 2.0.9, at src/PacketaWidget/View.jsx

49 lines 961 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ValidatedTextInput } from '@woocommerce/blocks-components';
2 import { PacketaWidget } from './PacketaWidget';
3 import { useView } from "./useView";
4
5 export const View = ( { cart } ) => {
6
7 const view = useView( cart );
8 if ( null === view ) {
9 return null;
10 }
11
12 const {
13 buttonCallback,
14 buttonLabel,
15 buttonInfo,
16 inputValue,
17 inputRequired,
18 errorMessage,
19 logo,
20 translations,
21 loading,
22 } = view;
23
24 // translations are sometimes unexpectedly undefined
25 if ( ! translations ) {
26 return null;
27 }
28
29 return (
30 <PacketaWidget
31 onClick={ buttonCallback }
32 buttonLabel={ buttonLabel }
33 logoSrc={ logo }
34 logoAlt={ translations.packeta }
35 info={ buttonInfo }
36 loading={ loading }
37 placeholderText={ translations.placeholderText }
38 >
39 <ValidatedTextInput
40 key={ inputRequired ? 'required' : 'optional' }
41 value={ inputValue }
42 required={ inputRequired }
43 errorMessage={ errorMessage }
44 />
45 </PacketaWidget>
46 );
47
48 };
49