@@ -38,6 +38,15 @@ public function __construct( ShippingPlugins $shipping_plugins ) {
3838 * @return array
3939 */
4040 public function props () {
41+ $ button_props = [
42+ 'usps ' => [
43+ 'label ' => __ ( 'Add USPS ' , 'wme-sitebuilder ' ),
44+ 'backgroundColor ' => '#004B87 ' ,
45+ // TODO: Redirect user to an action that installs and activates the plugin.
46+ 'href ' => admin_url ( 'admin.php?page=wc-settings&tab=shipping ' ),
47+ ]
48+ ];
49+
4150 // Flat rate is built-in to WooCommerce.
4251 $ rows = [
4352 [
@@ -48,6 +57,17 @@ public function props() {
4857 'intro ' => __ ( 'Charge a fixed rate of your choosing for shipping. ' , 'wme-sitebuilder ' ),
4958 'url ' => admin_url ( 'admin.php?page=wc-settings&tab=shipping ' ),
5059 ],
60+ [
61+ 'id ' => 'usps ' ,
62+ 'type ' => 'task ' ,
63+ 'taskCta ' => __ ( 'USPS Settings ' , 'wme-sitebuilder ' ),
64+ 'title ' => __ ( 'USPS ' , 'wme-sitebuilder ' ),
65+ 'intro ' => __ ( 'Shipping rates based on address and cart content through USPS. ' , 'wme-sitebuilder ' ),
66+ 'disabled ' => false ,
67+ 'disableText ' => '' ,
68+ 'url ' => $ this ->plugins ->isUspsActive () ? admin_url ( 'admin.php?page=wc-settings&tab=shipping§ion=elex_shipping_usps ' ) : null ,
69+ 'button ' => ! $ this ->plugins ->isUspsActive () ? $ button_props ['usps ' ] : null ,
70+ ],
5171 ];
5272
5373 // Check our supported shipping plugins.
@@ -59,103 +79,33 @@ public function props() {
5979 $ rows [] = $ plugin ['card ' ];
6080 }
6181
62- // If there are additional options, make wizard available.
63- if ( 1 === count ( $ rows ) && 0 < count ( $ this ->plugins ->getPlugins () ) ) {
64- $ rows [] = [
65- 'id ' => 'shipping-wizard ' ,
66- 'type ' => 'button ' ,
67- 'wizardHash ' => '/wizard/shipping ' ,
68- 'title ' => __ ( 'Add another way to ship ' , 'wme-sitebuilder ' ),
69- ];
70- }
71-
7282 return [
7383 'id ' => 'shipping-configuration ' ,
7484 'title ' => __ ( 'Configure shipping ' , 'wme-sitebuilder ' ),
7585 'intro ' => __ ( 'Offer flat rate shipping and/or set up ShipStation to offer multiple rates. ' , 'wme-sitebuilder ' ),
7686 'completed ' => false ,
7787 'rows ' => $ rows ,
7888 'footer ' => [
79- 'collapsible ' => true ,
80- 'collapsibleLabel ' => __ ( 'Learn more about Shipping ' , 'wme-sitebuilder ' ),
81- 'rows ' => [
89+ 'collapsible ' => false ,
90+ 'rows ' => [
8291 [
83- 'type ' => 'learn-types ' ,
84- 'title ' => 'Is this needed here? ' ,
85- 'overline ' => __ ( '3 Minutes ' , 'wme-sitebuilder ' ),
86- 'headline ' => __ ( 'Understanding Flat Rate Shipping in Storebuilder ' , 'wme-sitebuilder ' ),
87- 'videoData ' => [
88- 'placeholderImage ' => 'setup-shipping-poster.png ' ,
89- 'ariaLabel ' => __ ( 'Click to play video ' , 'wme-sitebuilder ' ),
90- 'src ' => 'https://www.youtube.com/embed/EXMe2i7OSQM ' ,
91- 'description ' => __ ( 'When setting up shipping in StoreBuilder, there are three concepts to understand: Flat Rate Shipping, Shipping Zones, and Shipping Classes. This video describes each and how they interact to ensure customers are charged correctly to ship their purchases. ' , 'wme-sitebuilder ' ),
92- ]
92+ 'type ' => 'links ' ,
93+ 'title ' => __ ( 'Need help with shipping? ' , 'wme-sitebuilder ' ),
94+ 'links ' => $ this ->footer_messages (),
9395 ],
94- [
95- 'type ' => 'columns ' ,
96- 'gridColumns ' => 3 ,
97- 'columns ' => [
98- [
99- 'heading ' => __ ( 'Shipping Zones ' , 'wme-sitebuilder ' ),
100- 'list ' => [
101- [
102- 'icon ' => 'Add ' ,
103- 'title ' => __ ( 'Set up Shipping Zones ' , 'wme-sitebuilder ' ),
104- 'url ' => admin_url ( 'admin.php?page=wc-settings&tab=shipping ' ),
105- 'target ' => '_self ' ,
106- ],
107- [
108- 'icon ' => 'LocalLibrary ' ,
109- 'title ' => __ ( 'WooCommerce: Shipping Zones Docs ' , 'wme-sitebuilder ' ),
110- 'url ' => 'https://woocommerce.com/document/setting-up-shipping-zones/ ' ,
111- 'target ' => '_blank ' ,
112- ],
113- ],
114- ],
115- [
116- 'heading ' => __ ( 'Shipping Classes ' , 'wme-sitebuilder ' ),
117- 'list ' => [
118- [
119- 'icon ' => 'Add ' ,
120- 'title ' => __ ( 'Set up Shipping Classes ' , 'wme-sitebuilder ' ),
121- 'url ' => admin_url ( 'admin.php?page=wc-settings&tab=shipping§ion=classes ' ),
122- 'target ' => '_self ' ,
123- ],
124- [
125- 'icon ' => 'School ' ,
126- 'title ' => __ ( 'Tutorial: Shipping Classes ' , 'wme-sitebuilder ' ),
127- 'url ' => 'wp101:woocommerce-shipping-classes ' ,
128- 'target ' => '_self ' ,
129- ],
130- [
131- 'icon ' => 'LocalLibrary ' ,
132- 'title ' => __ ( 'WooCommerce: Shipping Classes Docs ' , 'wme-sitebuilder ' ),
133- 'url ' => 'https://woocommerce.com/document/product-shipping-classes/ ' ,
134- 'target ' => '_blank ' ,
135- ],
136- ],
137- ],
138- [
139- 'heading ' => __ ( 'Shipping Calculations ' , 'wme-sitebuilder ' ),
140- 'list ' => [
141- [
142- 'icon ' => 'Add ' ,
143- 'title ' => __ ( 'Set Flat Rate shipping calculations ' , 'wme-sitebuilder ' ),
144- 'url ' => admin_url ( 'admin.php?page=wc-settings&tab=shipping§ion=options ' ),
145- 'target ' => '_blank ' ,
146- ],
147- [
148- 'icon ' => 'School ' ,
149- 'title ' => __ ( 'Tutorial: Flat Rate Shipping ' , 'wme-sitebuilder ' ),
150- 'url ' => 'wp101:woocommerce-flat-rate-shipping ' ,
151- 'target ' => '_self ' ,
152- ],
153- ],
154- ],
155- ]
156- ]
157- ],
96+ ]
15897 ],
15998 ];
16099 }
100+
101+ /**
102+ * Get card footer messages.
103+ *
104+ * @return array[]
105+ */
106+ protected function footer_messages () {
107+ return [
108+ $ this ->plugins ->card_footer_props ()
109+ ];
110+ }
161111}
0 commit comments