PluginProbe
Route ‑ Shipping Protection / 2.4.18
Route ‑ Shipping Protection v2.4.18
2.4.19 2.4.18 2.4.17 2.4.16 2.4.15 2.4.14 2.4.13 2.4.12 2.4.11 2.4.10 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.2.4 2.2.5 2.2.6 2.2.8 2.2.9 2.3.0 2.3.1 All 153 releases
routeapp / blocks / route-protection / index.js

index.js in Route ‑ Shipping Protection 2.4.18, at blocks/route-protection/index.js

120 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function ( wp, wc ) {
2 var el = wp.element.createElement;
3 var registerBlockType = wp.blocks.registerBlockType;
4 var useBlockProps = wp.blockEditor.useBlockProps;
5
6 var __ = wp.i18n.__;
7
8 registerBlockType( 'route/route-protection', {
9 title: __( 'Route Protection', 'routeapp' ),
10 category: 'woocommerce',
11 icon: el(
12 'svg',
13 { width: 24, height: 24, viewBox: '150 150 760 480', fill: 'none' },
14 el( 'path', {
15 d: 'M885.501 486.553C791.656 393.379 704.394 301.837 611.292 216.353C562.501 171.552 516.757 173.166 464.085 213.505C417.217 249.4 375.481 291.716 325.747 336.335C407.404 355.053 455.234 405.803 504.26 456.263C550.802 504.165 599.702 550.036 649.563 594.655C685.73 627.031 728.608 626.324 765.029 597.43C807.816 563.476 845.725 523.609 885.501 486.553ZM238.032 607.007C292.537 554.208 344.357 504.02 396.739 453.27C364.871 398.621 274 397.26 229.272 440.936C188.08 481.148 172.264 558.978 238.032 607.007Z',
16 fill: '#5EC7DB',
17 } )
18 ),
19 edit: function () {
20 var blockProps = useBlockProps();
21
22 return el(
23 'div',
24 blockProps,
25 el(
26 'div',
27 {
28 style: {
29 padding: '10px 16px',
30 border: '1px dashed #8c8f94',
31 borderRadius: '4px',
32 textAlign: 'center',
33 backgroundColor: '#f0f0f0',
34 display: 'flex',
35 flexDirection: 'column',
36 alignItems: 'center',
37 gap: '4px',
38 },
39 },
40 el(
41 'svg',
42 {
43 width: '60',
44 height: '60',
45 viewBox: '0 0 1080 1080',
46 fill: 'none',
47 xmlns: 'http://www.w3.org/2000/svg',
48 },
49 el( 'path', {
50 d: 'M289.182 819.946H268.632L220.276 751.62H238.668C243.765 751.62 248.064 751.294 251.582 750.641C255.101 749.988 257.713 749.335 259.418 748.682C263.59 746.85 266.818 744.148 269.104 740.556C271.389 736.965 272.532 733.483 272.532 730.091C272.532 726.445 271.425 723.017 269.213 719.807C267 716.614 263.789 714.002 259.618 711.971C255.446 709.958 250.621 708.942 245.125 708.942H215.561L215.96 819.928H199.327V692.491H245.125C251.256 692.491 257.006 693.47 262.356 695.429C267.707 697.388 272.405 700.2 276.45 703.845C280.367 707.364 283.396 711.409 285.555 715.979C287.713 720.55 288.783 725.248 288.783 730.073C288.783 737.781 286.425 744.692 281.728 750.822C279.769 753.434 277.393 755.847 274.581 758.059C271.77 760.272 268.868 762.104 265.875 763.537C261.05 765.369 256.534 766.276 252.362 766.276L289.182 819.946Z',
51 fill: '#313942',
52 } ),
53 el( 'path', {
54 d: 'M393.516 821.125C381.763 821.125 370.971 818.223 361.122 812.419C351.273 806.615 343.474 798.725 337.724 788.731C331.974 778.755 329.108 767.89 329.108 756.137C329.108 744.384 331.974 733.555 337.724 723.652C343.474 713.731 351.255 705.877 361.122 700.073C370.971 694.269 381.781 691.366 393.516 691.366C405.124 691.366 415.862 694.269 425.711 700.073C435.56 705.877 443.395 713.749 449.199 723.652C455.004 733.573 457.906 744.402 457.906 756.137C457.906 767.89 455.004 778.737 449.199 788.731C443.395 798.707 435.56 806.615 425.711 812.419C415.862 818.223 405.124 821.125 393.516 821.125ZM393.516 707.582C384.774 707.582 376.72 709.776 369.338 714.148C361.956 718.519 356.134 724.432 351.817 731.868C347.518 739.305 345.36 747.394 345.36 756.137C345.36 765.006 347.518 773.168 351.817 780.605C356.134 788.042 361.956 793.954 369.338 798.326C376.702 802.697 384.774 804.892 393.516 804.892C402.259 804.892 410.312 802.715 417.694 798.326C425.058 793.954 430.898 788.042 435.215 780.605C439.514 773.168 441.672 765.006 441.672 756.137C441.672 747.394 439.514 739.305 435.215 731.868C430.916 724.432 425.058 718.519 417.694 714.148C410.312 709.776 402.259 707.582 393.516 707.582Z',
55 fill: '#313942',
56 } ),
57 el( 'path', {
58 d: 'M553.816 821.125C547.16 821.125 540.793 819.856 534.735 817.316C528.659 814.777 523.345 811.095 518.774 806.252C514.076 801.554 510.485 796.168 508 790.109C505.515 784.033 504.282 777.612 504.282 770.829V692.528H520.533V770.829C520.533 775.4 521.386 779.771 523.073 783.943C524.759 788.114 527.19 791.778 530.31 794.898C537.22 801.554 545.056 804.874 553.798 804.874C558.242 804.874 562.468 803.985 566.513 802.226C570.558 800.466 574.149 798.018 577.287 794.88C580.425 791.742 582.837 788.096 584.524 783.924C586.211 779.753 587.063 775.381 587.063 770.811V692.509H603.315V770.811C603.315 777.594 602.063 784.015 599.596 790.091C597.112 796.167 593.593 801.536 589.022 806.234C584.324 811.059 578.974 814.741 572.97 817.298C567.003 819.837 560.6 821.125 553.816 821.125Z',
59 fill: '#313942',
60 } ),
61 el( 'path', {
62 d: 'M752.693 692.509V708.96H709.435V819.946H692.802V708.96H649.543V692.509H752.693Z',
63 fill: '#313942',
64 } ),
65 el( 'path', {
66 d: 'M798.893 819.946V692.509H880.314V708.96H815.126V747.921H865.042V764.372H815.126V803.713H880.314V819.964H798.893V819.946Z',
67 fill: '#313942',
68 } ),
69 el( 'path', {
70 d: 'M885.501 486.553C791.656 393.379 704.394 301.837 611.292 216.353C562.501 171.552 516.757 173.166 464.085 213.505C417.217 249.4 375.481 291.716 325.747 336.335C407.404 355.053 455.234 405.803 504.26 456.263C550.802 504.165 599.702 550.036 649.563 594.655C685.73 627.031 728.608 626.324 765.029 597.43C807.816 563.476 845.725 523.609 885.501 486.553ZM238.032 607.007C292.537 554.208 344.357 504.02 396.739 453.27C364.871 398.621 274 397.26 229.272 440.936C188.08 481.148 172.264 558.978 238.032 607.007Z',
71 fill: '#5EC7DB',
72 } )
73 ),
74 el(
75 'strong',
76 { style: { fontSize: '13px', color: '#1e1e1e' } },
77 'Route Shipping Protection'
78 ),
79 el(
80 'span',
81 {
82 style: {
83 fontSize: '12px',
84 color: '#757575',
85 },
86 },
87 'The Route protection widget will appear here on the storefront.'
88 )
89 )
90 );
91 },
92
93 save: function () {
94 return null;
95 },
96 } );
97
98 if (
99 wc &&
100 wc.blocksCheckout &&
101 typeof wc.blocksCheckout.registerCheckoutFilters === 'function'
102 ) {
103 wc.blocksCheckout.registerCheckoutFilters( 'route-protection', {
104 additionalCartCheckoutInnerBlockTypes: function (
105 value,
106 extensions,
107 args
108 ) {
109 if ( ! Array.isArray( value ) ) {
110 value = [];
111 }
112 if ( value.indexOf( 'route/route-protection' ) === -1 ) {
113 value.push( 'route/route-protection' );
114 }
115 return value;
116 },
117 } );
118 }
119 } )( window.wp, window.wc );
120