Merge branch 'trunk' into fix/unit-tests

This commit is contained in:
Nestor Soriano 2021-08-24 09:33:00 +02:00
commit 07cdb5b6a4
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
49 changed files with 1056 additions and 3476 deletions

View File

@ -1,4 +1,3 @@
/**
* admin.scss
* General WooCommerce admin styles. Settings, product data tabs, reports, etc.
@ -20,40 +19,190 @@
@include loader();
}
.wc_addons_wrap {
max-width: 1200px;
.wc-addons-wrap {
.marketplace-header {
background-image: url(../images/marketplace-header-bg@2x.png);
background-position: right;
background-size: cover;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
min-height: 216px;
padding: 24px 16px;
width: 100%;
&__title {
color: #fff;
font-size: 32px;
font-style: normal;
font-weight: 400;
line-height: 1.15;
margin-bottom: 8px;
padding: 0;
}
&__description {
color: #fff;
font-size: 16px;
line-height: 24px;
margin-bottom: 24px;
margin-top: 0;
}
&__search-form {
clear: both;
display: block;
max-width: 318px;
position: relative;
input {
border: 1px solid #ddd;
box-shadow: none;
font-size: 13px;
height: 48px;
padding-left: 16px;
padding-right: 50px;
width: 100%;
margin: 0;
}
button {
background: none;
border: none;
cursor: pointer;
height: 48px;
position: absolute;
right: 0;
width: 53px;
}
}
}
.top-bar {
background: #fff;
box-shadow: inset 0 -1px 0 #ccc;
display: block;
height: 60px;
margin: 0 0 16px;
@media only screen and ( min-width: 768px ) {
margin-bottom: 24px;
}
.current-section-dropdown {
position: relative;
width: 100%;
@media only screen and ( min-width: 600px ) {
margin-left: 70px;
width: 288px;
}
}
.current-section-name {
cursor: pointer;
font-weight: 600;
font-size: 14px;
line-height: 20px;
padding: 20px 16px;
position: relative;
}
.current-section-name::after {
background-image: url(../images/icons/gridicons-chevron-down.svg);
background-size: contain;
content: "";
display: block;
height: 20px;
position: absolute;
right: 20px;
top: 20px;
width: 20px;
}
ul {
background: #fff;
border-radius: 2px;
display: none;
flex-direction: column;
justify-content: left;
left: 0;
margin: 0;
padding: 14px 0;
position: absolute;
top: 50px;
width: 100%;
z-index: 10;
@media only screen and ( min-width: 600px ) {
border: 1px solid #1e1e1e;
}
@media only screen and ( min-width: 1100px ) {
justify-content: center;
}
li {
font-size: 13px;
line-height: 16px;
margin: 0;
}
a,
a:visited,
a:hover,
a:focus {
border: none;
box-shadow: none;
box-sizing: border-box;
color: #1e1e1e;
display: inline-block;
text-decoration: none;
outline: none;
padding: 14px 18px;
position: relative;
width: 100%;
@media only screen and ( min-width: 600px ) {
padding: 10px 18px;
}
}
a.current::after {
background-image: url(../images/icons/gridicons-checkmark.svg);
content: "";
display: block;
height: 20px;
position: absolute;
right: 20px;
top: 7px;
width: 20px;
}
}
.current-section-dropdown:hover,
.current-section-dropdown.is-open {
ul {
display: flex;
}
.current-section-name::after {
transform: rotate(0.5turn);
}
}
}
h1.search-form-title {
clear: left;
font-size: 20px;
line-height: 1.2;
margin: 48px 0 16px;
padding: 0;
}
form.search-form {
clear: both;
display: block;
position: relative;
margin-top: 1em;
margin-bottom: 1em;
input {
border: 1px solid #ddd;
box-shadow: none;
height: 53px;
padding-left: 50px;
width: 100%;
margin: 0;
}
button {
background: none;
border: none;
cursor: pointer;
height: 53px;
position: absolute;
width: 53px;
}
}
.update-plugins .update-count {
background-color: #d54e21;
border-radius: 10px;
@ -83,6 +232,18 @@
content: "";
}
.addons-button {
border-radius: 3px;
cursor: pointer;
display: block;
height: 37px;
line-height: 37px;
margin-top: 16px;
text-align: center;
text-decoration: none;
width: 124px;
}
.addons-banner-block-item-icon,
.addons-column-block-item-icon {
align-items: center;
@ -149,6 +310,16 @@
align-items: center;
}
.addons-promotion-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-wcs-banner-block-image {
background: #f7f7f7;
border: 1px solid #e6e6e6;
@ -173,16 +344,6 @@
}
}
.addons-promotion-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-promotion-block-content {
display: flex;
flex-direction: column;
@ -343,11 +504,11 @@
display: none;
}
.addons-banner-block-item:nth-child(-n+3) {
.addons-banner-block-item:nth-child(-n + 3) {
display: block;
}
.addons-column-block-item:nth-of-type(-n+3) {
.addons-column-block-item:nth-of-type(-n + 3) {
display: flex;
}
@ -416,17 +577,6 @@
width: 48%;
}
.addons-button {
border-radius: 3px;
cursor: pointer;
display: block;
height: 37px;
line-height: 37px;
text-align: center;
text-decoration: none;
width: 124px;
}
.addons-button-solid {
background-color: #674399;
color: #fff;
@ -506,81 +656,105 @@
}
}
.marketplace-content-wrapper {
margin: 0 auto;
max-width: 1032px;
width: 100%;
}
.products {
overflow: hidden;
display: flex;
flex-flow: row;
flex-wrap: wrap;
margin: 0 -0.5em;
justify-content: space-between;
margin: 0;
max-width: 1032px;
overflow: hidden;
li {
float: left;
border: 1px solid #ddd;
margin: 0 0.5em 1em !important;
padding: 0;
vertical-align: top;
width: 25%;
background: #fff;
border: 1px solid #dcdcde;
border-radius: 2px;
display: flex;
flex: 1 0 auto;
flex-direction: column;
justify-content: space-between;
margin: 12px 0;
max-width: calc(50% - 12px);
min-width: 280px;
min-height: 220px;
flex: 1;
overflow: hidden;
background: #f5f5f5;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.2),
inset 0 -1px 0 rgba(0, 0, 0, 0.1);
padding: 0;
vertical-align: top;
@media only screen and ( max-width: 768px ) {
max-width: none;
width: 100%;
}
a {
text-decoration: none;
color: inherit;
display: block;
height: 100%;
}
.product-details {
padding: 24px;
.product-img-wrap {
background: #fff;
display: block;
}
float: right;
margin-left: 24px;
img {
max-width: 258px;
max-height: 24px;
padding: 17px 20px;
display: block;
margin: 0;
background: #fff;
border-right: 260px solid #fff;
}
img.extension-thumb + h3 {
display: none;
}
.price {
display: none;
img {
border-radius: 3px;
display: block;
margin: 0;
max-width: 48px;
max-height: 48px;
}
}
h2,
h3 {
color: #007cba;
font-family:
HelveticaNeue-Light,
"Helvetica Neue Light",
"Helvetica Neue",
sans-serif;
font-size: 20px;
font-weight: 400;
line-height: 28px;
margin: 0 !important;
padding: 20px !important;
background: #fff;
}
p {
padding: 20px !important;
margin: 0 !important;
border-top: 1px solid #f1f1f1;
color: #2c3338;
margin: 14px 64px 0 0;
max-width: 389px;
}
}
.product-footer {
border-top: 1px solid #dcdcde;
padding: 24px;
.price {
font-size: 16px;
color: #1d2327;
}
&:hover,
&:focus {
.button {
background-color: #fff;
border-color: #007cba;
color: #007cba;
float: right;
}
}
}
}
.storefront {
background: url("../images/storefront-bg.jpg") bottom right #f6f6f6;
background: url(../images/storefront-bg.jpg) bottom right #f6f6f6;
border: 1px solid #ddd;
margin-top: 1em;
padding: 20px;
@ -601,6 +775,43 @@
}
}
.wc-subscriptions-wrap {
max-width: 1200px;
}
.woocommerce-page-wc-marketplace {
.notice {
margin-left: 20px;
margin-right: 20px;
}
&.woocommerce-page {
.wrap {
margin-top: 32px;
}
}
}
.woocommerce-page-wc-subscriptions {
#wpbody-content {
.screen-reader-text + .notice {
margin-top: 32px;
}
}
}
.woocommerce-embed-page.woocommerce-page-wc-marketplace {
#screen-meta-links {
position: absolute;
right: 0;
}
}
.woocommerce-message,
.woocommerce-BlankState {
@ -610,7 +821,11 @@
border-color: #a36597;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
color: #fff;
text-shadow: 0 -1px 1px #a36597, 1px 0 1px #a36597, 0 1px 1px #a36597, -1px 0 1px #a36597;
text-shadow:
0 -1px 1px #a36597,
1px 0 1px #a36597,
0 1px 1px #a36597,
-1px 0 1px #a36597;
display: inline-block;
&:hover,
@ -719,7 +934,7 @@ mark.amount {
&::after {
@include icon_dashicons( "\f223" );
@include icon_dashicons("\f223");
cursor: help;
}
}
@ -845,7 +1060,6 @@ table.wc_status_table--tools {
}
}
/**
* DB log viewer
*/
@ -904,7 +1118,7 @@ table.wc_status_table--tools {
}
// Adjust log table columns only when table is not collapsed
@media screen and ( min-width: 783px ) {
@media screen and (min-width: 783px) {
.column-timestamp {
width: 18%;
@ -1095,7 +1309,7 @@ ul.wc_coupon_list {
&::before {
@include icon_dashicons( "\f158" );
@include icon_dashicons("\f158");
}
&:hover::before {
@ -1139,7 +1353,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon_dashicons( "\f345" );
@include icon_dashicons("\f345");
line-height: 28px;
}
}
@ -1162,7 +1376,11 @@ ul.wc_coupon_list_block {
h2 {
margin: 0;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
font-family:
"HelveticaNeue-Light",
"Helvetica Neue Light",
"Helvetica Neue",
sans-serif;
font-size: 21px;
font-weight: normal;
line-height: 1.2;
@ -1186,7 +1404,11 @@ ul.wc_coupon_list_block {
p.order_number {
margin: 0;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
font-family:
"HelveticaNeue-Light",
"Helvetica Neue Light",
"Helvetica Neue",
sans-serif;
font-weight: normal;
line-height: 1.6em;
font-size: 16px;
@ -1663,7 +1885,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons( "\f128" );
@include icon_dashicons("\f128");
width: 38px;
line-height: 38px;
display: block;
@ -1911,7 +2133,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon( "\e007" );
@include icon("\e007");
color: #ccc;
}
}
@ -1926,7 +2148,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon( "\e014" );
@include icon("\e014");
color: #ccc;
}
}
@ -1943,7 +2165,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon( "\e01a" );
@include icon("\e01a");
color: #ccc;
}
}
@ -1972,7 +2194,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons( "\f153" );
@include icon_dashicons("\f153");
color: #999;
}
@ -1994,7 +2216,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons( "\f171" );
@include icon_dashicons("\f171");
position: relative;
top: auto;
left: auto;
@ -2050,7 +2272,7 @@ ul.wc_coupon_list_block {
.edit-order-item::before {
@include icon_dashicons( "\f464" );
@include icon_dashicons("\f464");
position: relative;
}
@ -2059,7 +2281,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons( "\f158" );
@include icon_dashicons("\f158");
position: relative;
}
@ -2427,12 +2649,11 @@ ul.wc_coupon_list_block {
&::before {
@include icon( "\e010" );
@include icon("\e010");
line-height: 16px;
font-size: 14px;
vertical-align: middle;
top: 4px;
}
&:hover {
@ -2717,7 +2938,7 @@ ul.wc_coupon_list_block {
}
}
.wc_addons_wrap {
.wc-addons-wrap {
.addons-promotion-block {
flex-direction: column;
@ -2750,7 +2971,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon( "\e026" );
@include icon("\e026");
line-height: 16px;
}
}
@ -2763,7 +2984,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon( "\e027" );
@include icon("\e027");
line-height: 16px;
}
}
@ -3000,7 +3221,7 @@ table.wp-list-table {
&::before {
@include icon_dashicons( "\f128" );
@include icon_dashicons("\f128");
}
}
@ -3155,8 +3376,8 @@ table.wc_input_table {
background: #fff;
cursor: default;
input[type=text],
input[type=number] {
input[type="text"],
input[type="number"] {
width: 100% !important;
min-width: 100px;
padding: 8px 10px;
@ -3600,10 +3821,16 @@ table.wc-shipping-classes {
.button-primary {
background-color: #804877;
border-color: #804877;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(0, 0, 0, 0.15);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.2),
0 1px 0 rgba(0, 0, 0, 0.15);
margin: 0;
opacity: 1;
text-shadow: 0 -1px 1px #8a4f7f, 1px 0 1px #8a4f7f, 0 1px 1px #8a4f7f, -1px 0 1px #8a4f7f;
text-shadow:
0 -1px 1px #8a4f7f,
1px 0 1px #8a4f7f,
0 1px 1px #8a4f7f,
-1px 0 1px #8a4f7f;
font-size: 1.5em;
padding: 0.75em 1em;
height: auto;
@ -3965,19 +4192,19 @@ img.help_tip {
.status-manual::before {
@include icon( "\e008" );
@include icon("\e008");
color: #999;
}
.status-enabled::before {
@include icon( "\e015" );
@include icon("\e015");
color: $woocommerce;
}
.status-disabled::before {
@include icon( "\e013" );
@include icon("\e013");
color: #ccc;
}
@ -4260,7 +4487,6 @@ img.help_tip {
}
table.form-table {
// Give regular settings inputs a standard width and padding.
textarea,
input[type="text"],
@ -4396,7 +4622,7 @@ img.help_tip {
&::after {
@include icon_dashicons( "\f161" );
@include icon_dashicons("\f161");
font-size: 2.618em;
line-height: 72px;
color: #ddd;
@ -4438,7 +4664,7 @@ img.help_tip {
&::before {
@include icon_dashicons( "\f153" );
@include icon_dashicons("\f153");
color: #999;
background: #fff;
border-radius: 50%;
@ -4625,7 +4851,7 @@ img.help_tip {
&::before {
@include iconbeforedashicons( "\f107" );
@include iconbeforedashicons("\f107");
}
}
@ -4692,8 +4918,8 @@ img.help_tip {
*/
.woocommerce_page_wc-settings {
input[type=url],
input[type=email] {
input[type="url"],
input[type="email"] {
direction: ltr;
}
@ -4709,7 +4935,7 @@ img.help_tip {
.add.button::before {
@include iconbefore( "\e007" );
@include iconbefore("\e007");
}
}
@ -4825,7 +5051,7 @@ img.help_tip {
&::before {
@include icon_dashicons( "\f153" );
@include icon_dashicons("\f153");
color: #999;
}
@ -5450,7 +5676,7 @@ img.help_tip {
padding: 4px 1em 2px 0;
}
input[type=checkbox] {
input[type="checkbox"] {
margin: 0 5px 0 0.5em !important;
vertical-align: middle;
}
@ -5549,7 +5775,6 @@ img.tips {
/*rtl:ignore*/
left: 0;
&.tip_top {
padding-bottom: 5px;
@ -5740,7 +5965,7 @@ img.ui-datepicker-trigger {
&::before {
@include iconbeforedashicons( "\f346" );
@include iconbeforedashicons("\f346");
margin-right: 4px;
}
}
@ -5867,7 +6092,7 @@ img.ui-datepicker-trigger {
&::after {
@include iconafter( "\e035" );
@include iconafter("\e035");
float: right;
font-size: 0.9em;
line-height: 1.618;
@ -5991,7 +6216,11 @@ img.ui-datepicker-trigger {
color: #464646;
font-weight: normal;
display: block;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
font-family:
"HelveticaNeue-Light",
"Helvetica Neue Light",
"Helvetica Neue",
sans-serif;
del {
color: #e74c3c;
@ -6202,27 +6431,27 @@ table.bar_chart {
.post-type-shop_order .woocommerce-BlankState-message::before {
@include icon( "\e01d" );
@include icon("\e01d");
}
.post-type-shop_coupon .woocommerce-BlankState-message::before {
@include icon( "\e600" );
@include icon("\e600");
}
.post-type-product .woocommerce-BlankState-message::before {
@include icon( "\e006" );
@include icon("\e006");
}
.woocommerce-BlankState--api .woocommerce-BlankState-message::before {
@include icon( "\e01c" );
@include icon("\e01c");
}
.woocommerce-BlankState--webhooks .woocommerce-BlankState-message::before {
@include icon( "\e01b" );
@include icon("\e01b");
}
.woocommerce-BlankState {
@ -6238,7 +6467,9 @@ table.bar_chart {
&::before {
color: #ddd;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.8);
text-shadow:
0 -1px 1px rgba(0, 0, 0, 0.2),
0 1px 0 rgba(255, 255, 255, 0.8);
font-size: 8em;
display: block;
position: relative !important;
@ -6325,7 +6556,6 @@ table.bar_chart {
}
}
.woocommerce_variations,
.woocommerce_options_panel {
@ -6513,7 +6743,7 @@ table.bar_chart {
flex-direction: column;
}
.wc_addons_wrap {
.wc-addons-wrap {
.addons-wcs-banner-block {
padding: 40px;
@ -6911,7 +7141,9 @@ table.bar_chart {
right: 1px;
height: 28px;
width: 23px;
background: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat right 5px top 55%;
background:
url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E")
no-repeat right 5px top 55%;
background-size: 16px 16px;
@media only screen and (max-width: 782px) {
@ -6941,7 +7173,6 @@ table.bar_chart {
padding: 0 0 0 3px;
min-height: 28px;
}
}
.woocommerce table.form-table .select2-container {
@ -6980,11 +7211,10 @@ table.bar_chart {
midnight: #e14d43,
ocean: #9ebaa0,
sunrise: #dd823b,
light: #04a4cc
light: #04a4cc,
);
@each $name, $color in $wp_admin_colors {
&-#{$name}.wc-wp-version-gte-53 {
.select2-dropdown {
@ -7003,22 +7233,26 @@ table.bar_chart {
color: $color;
}
.select2-container.select2-container--focus .select2-selection--single,
.select2-container.select2-container--open .select2-selection--single,
.select2-container.select2-container--open .select2-selection--multiple {
.select2-container.select2-container--focus
.select2-selection--single,
.select2-container.select2-container--open
.select2-selection--single,
.select2-container.select2-container--open
.select2-selection--multiple {
border-color: $color;
box-shadow: 0 0 0 1px $color;
}
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[data-selected] {
.select2-container--default
.select2-results__option--highlighted[aria-selected],
.select2-container--default
.select2-results__option--highlighted[data-selected] {
background-color: $color;
}
}
}
}
.post-type-product .tablenav,
.post-type-shop_order .tablenav {
@ -7117,9 +7351,15 @@ table.bar_chart {
border-radius: 4px;
background-color: #bb77ae;
border-color: #a36597;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
-webkit-box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0 #a36597;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
text-shadow: 0 -1px 1px #a36597, 1px 0 1px #a36597, 0 1px 1px #a36597, -1px 0 1px #a36597;
text-shadow:
0 -1px 1px #a36597,
1px 0 1px #a36597,
0 1px 1px #a36597,
-1px 0 1px #a36597;
margin: 0;
opacity: 1;
@ -7128,7 +7368,9 @@ table.bar_chart {
&:active {
background: #a36597;
border-color: #a36597;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
-webkit-box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0 #a36597;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
}
}
@ -7396,7 +7638,7 @@ table.bar_chart {
&::before {
@include icon( "\e015" );
@include icon("\e015");
color: #a16696;
position: static;
font-size: 100px;
@ -7423,3 +7665,13 @@ table.bar_chart {
color: darkred;
font-weight: bold;
}
@media screen and (min-width: 600px) {
.wc-addons-wrap {
.marketplace-header {
padding-left: 84px;
}
}
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414"/></g></svg>

After

Width:  |  Height:  |  Size: 201 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586"/></g></svg>

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

View File

@ -406,6 +406,43 @@
return window.confirm( woocommerce_admin.i18n_remove_personal_data_notice );
}
});
var marketplaceSectionDropdown = $( '#marketplace-current-section-dropdown' );
var marketplaceSectionName = $( '#marketplace-current-section-name' );
var marketplaceMenuIsOpen = false;
// Add event listener to toggle Marketplace menu on touch devices
if ( marketplaceSectionDropdown.length && isTouchDevice() ) {
marketplaceSectionName.on( 'click', function() {
marketplaceMenuIsOpen = ! marketplaceMenuIsOpen;
if ( marketplaceMenuIsOpen ) {
marketplaceSectionDropdown.addClass( 'is-open' );
$( document ).on( 'click', maybeToggleMarketplaceMenu );
} else {
marketplaceSectionDropdown.removeClass( 'is-open' );
$( document ).off( 'click', maybeToggleMarketplaceMenu );
}
} );
}
// Close menu if the user clicks outside it
function maybeToggleMarketplaceMenu( e ) {
if (
! marketplaceSectionDropdown.is( e.target )
&& marketplaceSectionDropdown.has( e.target ).length === 0
) {
marketplaceSectionDropdown.removeClass( 'is-open' );
marketplaceMenuIsOpen = false;
$( document ).off( 'click', maybeToggleMarketplaceMenu );
}
}
function isTouchDevice() {
return ( ( 'ontouchstart' in window ) ||
( navigator.maxTouchPoints > 0 ) ||
( navigator.msMaxTouchPoints > 0 ) );
}
});
})( jQuery, woocommerce_admin );

View File

@ -33,7 +33,6 @@
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.4"
},
"default-branch": true,
"bin": [
"bin/mozart"
],
@ -54,10 +53,6 @@
}
],
"description": "Composes all dependencies as a package inside a WordPress plugin",
"support": {
"issues": "https://github.com/coenjacobs/mozart/issues",
"source": "https://github.com/coenjacobs/mozart/tree/master"
},
"funding": [
{
"url": "https://github.com/coenjacobs",
@ -344,9 +339,6 @@
"console",
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.3.6"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -633,9 +625,6 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -797,9 +786,6 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -959,9 +945,6 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -1153,5 +1136,5 @@
"platform-overrides": {
"php": "7.3"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "1.1.0"
}

View File

@ -71,10 +71,6 @@
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-12-07T18:04:37+00:00"
},
{
@ -243,10 +239,6 @@
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2021-07-21T11:09:57+00:00"
},
{
@ -343,10 +335,6 @@
"woocommerce",
"wordpress"
],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-sniffs/issues",
"source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.1"
},
"time": "2021-07-29T17:25:16+00:00"
},
{
@ -411,5 +399,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "1.1.0"
}

View File

@ -1697,5 +1697,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "1.1.0"
}

View File

@ -205,10 +205,6 @@
}
],
"description": "Peast is PHP library that generates AST for JavaScript code",
"support": {
"issues": "https://github.com/mck89/peast/issues",
"source": "https://github.com/mck89/peast/tree/v1.13.5"
},
"time": "2021-07-28T17:14:56+00:00"
},
{
@ -624,5 +620,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "1.1.0"
}

View File

@ -21,8 +21,8 @@
"pelago/emogrifier": "3.1.0",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.2.1",
"woocommerce/woocommerce-admin": "2.5.1",
"woocommerce/woocommerce-blocks": "5.5.1"
"woocommerce/woocommerce-admin": "2.6.0-rc.2",
"woocommerce/woocommerce-blocks": "5.7.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",

30
composer.lock generated
View File

@ -532,16 +532,16 @@
},
{
"name": "woocommerce/woocommerce-admin",
"version": "2.5.1",
"version": "2.6.0-rc.2",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "093d698d770f49d41df8abe89a716dc897bb9e96"
"reference": "a6dd63d2b90111637f7879a95e26acb16dff2ac4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/093d698d770f49d41df8abe89a716dc897bb9e96",
"reference": "093d698d770f49d41df8abe89a716dc897bb9e96",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/a6dd63d2b90111637f7879a95e26acb16dff2ac4",
"reference": "a6dd63d2b90111637f7879a95e26acb16dff2ac4",
"shasum": ""
},
"require": {
@ -594,24 +594,20 @@
],
"description": "A modern, javascript-driven WooCommerce Admin experience.",
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"support": {
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.5.1"
},
"time": "2021-08-16T14:31:33+00:00"
"time": "2021-08-19T16:23:09+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v5.5.1",
"version": "v5.7.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "f3d8dbadb745cbb2544e86dfb3864e870146d197"
"reference": "6056eb0fd5ec74972237faa6ed0f08f774466324"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/f3d8dbadb745cbb2544e86dfb3864e870146d197",
"reference": "f3d8dbadb745cbb2544e86dfb3864e870146d197",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/6056eb0fd5ec74972237faa6ed0f08f774466324",
"reference": "6056eb0fd5ec74972237faa6ed0f08f774466324",
"shasum": ""
},
"require": {
@ -645,11 +641,7 @@
"gutenberg",
"woocommerce"
],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v5.5.1"
},
"time": "2021-07-14T20:59:04+00:00"
"time": "2021-08-17T12:58:49+00:00"
}
],
"packages-dev": [
@ -2458,5 +2450,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "1.1.0"
}

View File

@ -723,6 +723,7 @@ class WC_Admin_Addons {
* Addon page view.
*
* @uses $addons
* @uses $search
* @uses $sections
* @uses $theme
* @uses $current_section
@ -794,4 +795,20 @@ class WC_Admin_Addons {
return true;
}
/**
* We're displaying page=wc-addons and page=wc-addons&section=helper as two separate pages.
* When we're on those pages, add body classes to distinguishe them.
*
* @param string $admin_body_class Unfiltered body class.
*
* @return string Body class with added class for Marketplace or My Subscriptions page.
*/
public static function filter_admin_body_classes( string $admin_body_class = '' ): string {
if ( isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) {
return " $admin_body_class woocommerce-page-wc-subscriptions ";
}
return " $admin_body_class woocommerce-page-wc-marketplace ";
}
}

View File

@ -36,6 +36,8 @@ class WC_Admin_Menus {
add_filter( 'menu_order', array( $this, 'menu_order' ) );
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 );
add_filter( 'submenu_file', array( $this, 'update_menu_highlight' ), 10, 2 );
add_filter( 'admin_title', array( $this, 'update_my_subscriptions_title' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
@ -149,8 +151,9 @@ class WC_Admin_Menus {
public function addons_menu() {
$count_html = WC_Helper_Updater::get_updates_count_html();
/* translators: %s: extensions count */
$menu_title = sprintf( __( 'Extensions %s', 'woocommerce' ), $count_html );
add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
$menu_title = sprintf( __( 'My Subscriptions %s', 'woocommerce' ), $count_html );
add_submenu_page( 'woocommerce', __( 'WooCommerce Marketplace', 'woocommerce' ), __( 'Marketplace', 'woocommerce' ), 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
add_submenu_page( 'woocommerce', __( 'My WooCommerce.com Subscriptions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons&section=helper', array( $this, 'addons_page' ) );
}
/**
@ -387,6 +390,39 @@ class WC_Admin_Menus {
)
);
}
/**
* Highlight the My Subscriptions menu item when on that page
*
* @param string $submenu_file The submenu file.
* @param string $parent_file currently opened page.
*
* @return string
*/
public function update_menu_highlight( $submenu_file, $parent_file ) {
if ( 'woocommerce' === $parent_file && isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) {
$submenu_file = 'wc-addons&section=helper';
}
return $submenu_file;
}
/**
* Update the My Subscriptions document title when on that page.
* We want to maintain existing page URL but add it as a separate page,
* which requires updating it manually.
*
* @param string $admin_title existing page title.
* @return string
*/
public function update_my_subscriptions_title( $admin_title ) {
if (
isset( $_GET['page'] ) && 'wc-addons' === $_GET['page'] &&
isset( $_GET['section'] ) && 'helper' === $_GET['section']
) {
$admin_title = 'My WooCommerce.com Subscriptions';
}
return $admin_title;
}
}
return new WC_Admin_Menus();

View File

@ -35,6 +35,11 @@ class WC_Admin {
// Add body class for WP 5.3+ compatibility.
add_filter( 'admin_body_class', array( $this, 'include_admin_body_class' ), 9999 );
// Add body class for Marketplace and My Subscriptions pages.
if ( isset( $_GET['page'] ) && 'wc-addons' === $_GET['page'] ) {
add_filter( 'admin_body_class', array( 'WC_Admin_Addons', 'filter_admin_body_classes' ) );
}
}
/**

View File

@ -1,19 +1,46 @@
<?php defined( 'ABSPATH' ) or exit(); ?>
<?php
/**
* Helper main view
*
* @package WooCommerce\Helper
*/
<div class="wrap woocommerce wc_addons_wrap wc-helper">
<?php require WC_Helper::get_view_filename( 'html-section-nav.php' ); ?>
<h1 class="screen-reader-text"><?php _e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
?>
<?php defined( 'ABSPATH' ) || exit(); ?>
<div class="wrap woocommerce wc-subscriptions-wrap wc-helper">
<h1 class="screen-reader-text"><?php esc_html_e( 'My Subscriptions', 'woocommerce' ); ?></h1>
<?php require WC_Helper::get_view_filename( 'html-section-notices.php' ); ?>
<div class="subscriptions-header">
<h2><?php _e( 'Subscriptions', 'woocommerce' ); ?></h2>
<h2><?php esc_html_e( 'Subscriptions', 'woocommerce' ); ?></h2>
<?php require WC_Helper::get_view_filename( 'html-section-account.php' ); ?>
<p><?php printf( __( 'Below is a list of extensions available on your WooCommerce.com account. To receive extension updates please make sure the extension is installed, and its subscription activated and connected to your WooCommerce.com account. Extensions can be activated from the <a href="%s">Plugins</a> screen.', 'woocommerce' ), admin_url( 'plugins.php' ) ); ?></p>
<p>
<?php
printf(
wp_kses(
/* translators: Introduction to list of WooCommerce.com extensions the merchant has subscriptions for. */
__(
'Below is a list of extensions available on your WooCommerce.com account. To receive extension updates please make sure the extension is installed, and its subscription activated and connected to your WooCommerce.com account. Extensions can be activated from the <a href="%s">Plugins</a> screen.',
'woocommerce'
),
array(
'a' => array(
'href' => array(),
),
)
),
esc_url(
admin_url( 'plugins.php' )
)
);
?>
</p>
</div>
<ul class="subscription-filter">
<label><?php _e( 'Sort by:', 'woocommerce' ); ?> <span class="chevron dashicons dashicons-arrow-up-alt2"></span></label>
<label><?php esc_html_e( 'Sort by:', 'woocommerce' ); ?> <span class="chevron dashicons dashicons-arrow-up-alt2"></span></label>
<?php
$filters = array_keys( WC_Helper::get_filters() );
$last_filter = array_pop( $filters );
@ -32,7 +59,7 @@
$class_html = $current_filter === $key ? 'class="current"' : '';
?>
<li>
<a <?php echo $class_html; ?> href="<?php echo esc_url( $url ); ?>">
<a <?php echo esc_html( $class_html ); ?> href="<?php echo esc_url( $url ); ?>">
<?php echo esc_html( $label ); ?>
<span class="count">(<?php echo absint( $counts[ $key ] ); ?>)</span>
</a>
@ -55,27 +82,27 @@
<div class="wp-list-table__ext-description">
<?php if ( $subscription['lifetime'] ) : ?>
<span class="renews">
<?php _e( 'Lifetime Subscription', 'woocommerce' ); ?>
<?php esc_html_e( 'Lifetime Subscription', 'woocommerce' ); ?>
</span>
<?php elseif ( $subscription['expired'] ) : ?>
<span class="renews">
<strong><?php _e( 'Expired :(', 'woocommerce' ); ?></strong>
<?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
<strong><?php esc_html_e( 'Expired :(', 'woocommerce' ); ?></strong>
<?php echo esc_html( date_i18n( 'F jS, Y', $subscription['expires'] ) ); ?>
</span>
<?php elseif ( $subscription['autorenew'] ) : ?>
<span class="renews">
<?php _e( 'Auto renews on:', 'woocommerce' ); ?>
<?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
<?php esc_html_e( 'Auto renews on:', 'woocommerce' ); ?>
<?php echo esc_html( date_i18n( 'F jS, Y', $subscription['expires'] ) ); ?>
</span>
<?php elseif ( $subscription['expiring'] ) : ?>
<span class="renews">
<strong><?php _e( 'Expiring soon!', 'woocommerce' ); ?></strong>
<?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
<strong><?php esc_html_e( 'Expiring soon!', 'woocommerce' ); ?></strong>
<?php echo esc_html( date_i18n( 'F jS, Y', $subscription['expires'] ) ); ?>
</span>
<?php else : ?>
<span class="renews">
<?php _e( 'Expires on:', 'woocommerce' ); ?>
<?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
<?php esc_html_e( 'Expires on:', 'woocommerce' ); ?>
<?php echo esc_html( date_i18n( 'F jS, Y', $subscription['expires'] ) ); ?>
</span>
<?php endif; ?>
@ -84,19 +111,21 @@
<?php
if ( ! $subscription['active'] && $subscription['maxed'] ) {
/* translators: %1$d: sites active, %2$d max sites active */
printf( __( 'Subscription: Not available - %1$d of %2$d already in use', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
printf( esc_html__( 'Subscription: Not available - %1$d of %2$d already in use', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
} elseif ( $subscription['sites_max'] > 0 ) {
/* translators: %1$d: sites active, %2$d max sites active */
printf( __( 'Subscription: Using %1$d of %2$d sites available', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
printf( esc_html__( 'Subscription: Using %1$d of %2$d sites available', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
} else {
_e( 'Subscription: Unlimited', 'woocommerce' );
esc_html_e( 'Subscription: Unlimited', 'woocommerce' );
}
// Check shared.
if ( ! empty( $subscription['is_shared'] ) && ! empty( $subscription['owner_email'] ) ) {
printf( '</br>' . __( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['owner_email'] ) );
/* translators: Email address of person who shared the subscription. */
printf( '</br>' . esc_html__( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['owner_email'] ) );
} elseif ( isset( $subscription['master_user_email'] ) ) {
printf( '</br>' . __( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['master_user_email'] ) );
/* translators: Email address of person who shared the subscription. */
printf( '</br>' . esc_html__( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['master_user_email'] ) );
}
?>
</span>
@ -104,35 +133,35 @@
</td>
<td class="wp-list-table__ext-actions">
<?php if ( ! $subscription['active'] && $subscription['maxed'] ) : ?>
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php _e( 'Upgrade', 'woocommerce' ); ?></a>
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php esc_html_e( 'Upgrade', 'woocommerce' ); ?></a>
<?php elseif ( ! $subscription['local']['installed'] && ! $subscription['expired'] ) : ?>
<a class="button <?php echo empty( $subscription['download_primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $subscription['download_url'] ); ?>" target="_blank"><?php _e( 'Download', 'woocommerce' ); ?></a>
<a class="button <?php echo empty( $subscription['download_primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $subscription['download_url'] ); ?>" target="_blank"><?php esc_html_e( 'Download', 'woocommerce' ); ?></a>
<?php elseif ( $subscription['active'] ) : ?>
<span class="form-toggle__wrapper">
<a href="<?php echo esc_url( $subscription['deactivate_url'] ); ?>" class="form-toggle active is-compact" role="link" aria-checked="true"><?php _e( 'Active', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $subscription['deactivate_url'] ); ?>" class="form-toggle active is-compact" role="link" aria-checked="true"><?php esc_html_e( 'Active', 'woocommerce' ); ?></a>
<label class="form-toggle__label" for="activate-extension">
<span class="form-toggle__label-content">
<label for="activate-extension"><?php _e( 'Active', 'woocommerce' ); ?></label>
<label for="activate-extension"><?php esc_html_e( 'Active', 'woocommerce' ); ?></label>
</span>
<span class="form-toggle__switch"></span>
</label>
</span>
<?php elseif ( ! $subscription['expired'] ) : ?>
<span class="form-toggle__wrapper">
<a href="<?php echo esc_url( $subscription['activate_url'] ); ?>" class="form-toggle is-compact" role="link" aria-checked="false"><?php _e( 'Inactive', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $subscription['activate_url'] ); ?>" class="form-toggle is-compact" role="link" aria-checked="false"><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></a>
<label class="form-toggle__label" for="activate-extension">
<span class="form-toggle__label-content">
<label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
<label for="activate-extension"><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></label>
</span>
<span class="form-toggle__switch"></span>
</label>
</span>
<?php else : ?>
<span class="form-toggle__wrapper">
<span class="form-toggle disabled is-compact"><?php _e( 'Inactive', 'woocommerce' ); ?></span>
<span class="form-toggle disabled is-compact"><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></span>
<label class="form-toggle__label" for="activate-extension">
<span class="form-toggle__label-content">
<label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
<label for="activate-extension"><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></label>
</span>
</label>
</span>
@ -140,16 +169,16 @@
</td>
</tr>
<?php foreach ( $subscription['actions'] as $action ) : ?>
<?php foreach ( $subscription['actions'] as $subscription_action ) : ?>
<tr class="wp-list-table__row wp-list-table__ext-updates">
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
<p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
<?php echo $action['message']; ?>
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $subscription_action['status'] ); ?>">
<p><span class="dashicons <?php echo sanitize_html_class( $subscription_action['icon'] ); ?>"></span>
<?php echo wp_kses_post( $subscription_action['message'] ); ?>
</p>
</td>
<td class="wp-list-table__ext-actions">
<?php if ( ! empty( $action['button_label'] ) && ! empty( $action['button_url'] ) ) : ?>
<a class="button <?php echo empty( $action['primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $action['button_url'] ); ?>"><?php echo esc_html( $action['button_label'] ); ?></a>
<?php if ( ! empty( $subscription_action['button_label'] ) && ! empty( $subscription_action['button_url'] ) ) : ?>
<a class="button <?php echo empty( $subscription_action['primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $subscription_action['button_url'] ); ?>"><?php echo esc_html( $subscription_action['button_label'] ); ?></a>
<?php endif; ?>
</td>
</tr>
@ -159,14 +188,14 @@
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="3"><em><?php _e( 'Could not find any subscriptions on your WooCommerce.com account', 'woocommerce' ); ?></td>
<td colspan="3"><em><?php esc_html_e( 'Could not find any subscriptions on your WooCommerce.com account', 'woocommerce' ); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php if ( ! empty( $no_subscriptions ) ) : ?>
<h2><?php _e( 'Installed Extensions without a Subscription', 'woocommerce' ); ?></h2>
<h2><?php esc_html_e( 'Installed Extensions without a Subscription', 'woocommerce' ); ?></h2>
<p>Below is a list of WooCommerce.com products available on your site - but are either out-dated or do not have a valid subscription.</p>
<table class="wp-list-table widefat fixed striped">
@ -183,25 +212,25 @@
</td>
<td class="wp-list-table__ext-actions">
<span class="form-toggle__wrapper">
<span class="form-toggle disabled is-compact" ><?php _e( 'Inactive', 'woocommerce' ); ?></span>
<span class="form-toggle disabled is-compact" ><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></span>
<label class="form-toggle__label" for="activate-extension">
<span class="form-toggle__label-content">
<label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
<label for="activate-extension"><?php esc_html_e( 'Inactive', 'woocommerce' ); ?></label>
</span>
</label>
</span>
</td>
</tr>
<?php foreach ( $data['_actions'] as $action ) : ?>
<?php foreach ( $data['_actions'] as $subscription_action ) : ?>
<tr class="wp-list-table__row wp-list-table__ext-updates">
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
<p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
<?php echo $action['message']; ?>
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $subscription_action['status'] ); ?>">
<p><span class="dashicons <?php echo sanitize_html_class( $subscription_action['icon'] ); ?>"></span>
<?php echo esc_html( $subscription_action['message'] ); ?>
</p>
</td>
<td class="wp-list-table__ext-actions">
<a class="button" href="<?php echo esc_url( $action['button_url'] ); ?>" target="_blank"><?php echo esc_html( $action['button_label'] ); ?></a>
<a class="button" href="<?php echo esc_url( $subscription_action['button_url'] ); ?>" target="_blank"><?php echo esc_html( $subscription_action['button_label'] ); ?></a>
</td>
</tr>
<?php endforeach; ?>

View File

@ -9,8 +9,7 @@ defined( 'ABSPATH' ) || exit();
?>
<div class="wrap woocommerce wc_addons_wrap wc-helper">
<?php require WC_Helper::get_view_filename( 'html-section-nav.php' ); ?>
<div class="wrap woocommerce wc-addons-wrap wc-helper">
<h1 class="screen-reader-text"><?php esc_html_e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
<?php require WC_Helper::get_view_filename( 'html-section-notices.php' ); ?>

View File

@ -3,6 +3,8 @@
* Helper admin navigation.
*
* @package WooCommerce\Helper
*
* @deprecated 5.7.0
*/
defined( 'ABSPATH' ) || exit(); ?>

View File

@ -11,124 +11,148 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$current_section_name = __( 'Browse Categories', 'woocommerce' );
?>
<div class="wrap woocommerce wc_addons_wrap">
<nav class="nav-tab-wrapper woo-nav-tab-wrapper">
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons' ) ); ?>" class="nav-tab nav-tab-active"><?php esc_html_e( 'Browse Extensions', 'woocommerce' ); ?></a>
<?php
$count_html = WC_Helper_Updater::get_updates_count_html();
// translators: Count of updates for WooCommerce.com subscriptions.
$menu_title = sprintf( __( 'WooCommerce.com Subscriptions %s', 'woocommerce' ), $count_html );
?>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) ); ?>" class="nav-tab"><?php echo wp_kses_post( $menu_title ); ?></a>
</nav>
<h1 class="screen-reader-text"><?php esc_html_e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
<div class="woocommerce wc-addons-wrap">
<h1 class="screen-reader-text"><?php esc_html_e( 'Marketplace', 'woocommerce' ); ?></h1>
<?php if ( $sections ) : ?>
<ul class="subsubsub">
<?php foreach ( $sections as $section ) : ?>
<li>
<a
class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>"
href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section->slug ) ) ); ?>">
<?php echo esc_html( $section->label ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php if ( isset( $_GET['search'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
<h1 class="search-form-title" >
<?php // translators: search keyword. ?>
<?php printf( esc_html__( 'Showing search results for: %s', 'woocommerce' ), '<strong>' . esc_html( sanitize_text_field( wp_unslash( $_GET['search'] ) ) ) . '</strong>' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
</h1>
<?php endif; ?>
<form class="search-form" method="GET">
<button type="submit">
<span class="dashicons dashicons-search"></span>
</button>
<div class="marketplace-header">
<h1 class="marketplace-header__title"><?php esc_html_e( 'WooCommerce Marketplace', 'woocommerce' ); ?></h1>
<p class="marketplace-header__description"><?php esc_html_e( 'Grow your business with hundreds of free and paid WooCommerce extensions.', 'woocommerce' ); ?></p>
<form class="marketplace-header__search-form" method="GET">
<input
type="text"
name="search"
value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
value="<?php echo esc_attr( ! empty( $search ) ? sanitize_text_field( wp_unslash( $search ) ) : '' ); ?>"
placeholder="<?php esc_attr_e( 'Search for extensions', 'woocommerce' ); ?>"
/>
<button type="submit">
<span class="dashicons dashicons-search"></span>
</button>
<input type="hidden" name="page" value="wc-addons">
<input type="hidden" name="section" value="_all">
</form>
<?php if ( '_featured' === $current_section ) : ?>
<div class="addons-featured">
<?php
</div>
<div class="top-bar">
<div id="marketplace-current-section-dropdown" class="current-section-dropdown">
<ul>
<?php foreach ( $sections as $section ) : ?>
<?php
if ( $current_section === $section->slug && '_featured' !== $section->slug ) {
$current_section_name = $section->label;
}
?>
<li>
<a
class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>"
href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section->slug ) ) ); ?>">
<?php echo esc_html( $section->label ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<div id="marketplace-current-section-name" class="current-section-name"><?php echo esc_html( $current_section_name ); ?></div>
</div>
</div>
<div class="wp-header-end"></div>
<div class="wrap">
<div class="marketplace-content-wrapper">
<?php if ( ! empty( $search ) ) : ?>
<h1 class="search-form-title">
<?php // translators: search keyword. ?>
<?php printf( esc_html__( 'Search results for "%s"', 'woocommerce' ), esc_html( sanitize_text_field( wp_unslash( $search ) ) ) ); ?>
</h1>
<?php endif; ?>
<?php if ( '_featured' === $current_section ) : ?>
<div class="addons-featured">
<?php
$featured = WC_Admin_Addons::get_featured();
?>
?>
</div>
<?php endif; ?>
<?php if ( '_featured' !== $current_section && $addons ) : ?>
<?php if ( 'shipping_methods' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcs_banner_block(); ?>
</div>
<?php endif; ?>
<?php if ( 'payment-gateways' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcpay_banner_block(); ?>
</div>
<?php endif; ?>
<ul class="products">
<?php foreach ( $addons as $addon ) : ?>
<?php
if ( 'shipping_methods' === $current_section ) {
// Do not show USPS or Canada Post extensions for US and CA stores, respectively.
$country = WC()->countries->get_base_country();
if ( 'US' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/usps-shipping-method'
)
) {
continue;
}
if ( 'CA' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/canada-post-shipping-method'
)
) {
continue;
}
}
?>
<li class="product">
<div class="product-details">
<?php if ( ! empty( $addon->image ) ) : ?>
<span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>" /></span>
<?php endif; ?>
<a href="<?php echo esc_url( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
<h2><?php echo esc_html( $addon->title ); ?></h2>
</a>
<p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
</div>
<div class="product-footer">
<?php if ( '&#36;0.00' === $addon->price ) : ?>
<span class="price"><?php esc_html_e( 'Free', 'woocommerce' ); ?></span>
<?php else : ?>
<span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
<span class="price_suffix"><?php esc_html_e( 'per year', 'woocommerce' ); ?></span>
<?php endif; ?>
<a class="button" href="<?php echo esc_url( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
<?php esc_html_e( 'View details', 'woocommerce' ); ?>
</a>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php else : ?>
<?php /* translators: a url */ ?>
<p><?php printf( wp_kses_post( __( 'Our catalog of WooCommerce Extensions can be found on WooCommerce.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ) ), 'https://woocommerce.com/product-category/woocommerce-extensions/' ); ?></p>
<?php endif; ?>
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
<div class="storefront">
<a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
<p><?php echo wp_kses_post( __( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ) ); ?></p>
<p>
<a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_storefront' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Download &amp; install', 'woocommerce' ); ?></a>
</p>
</div>
<?php endif; ?>
<?php if ( '_featured' !== $current_section && $addons ) : ?>
<?php if ( 'shipping_methods' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcs_banner_block(); ?>
</div>
<?php endif; ?>
<?php if ( 'payment-gateways' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcpay_banner_block(); ?>
</div>
<?php endif; ?>
<ul class="products">
<?php foreach ( $addons as $addon ) : ?>
<?php
if ( 'shipping_methods' === $current_section ) {
// Do not show USPS or Canada Post extensions for US and CA stores, respectively.
$country = WC()->countries->get_base_country();
if ( 'US' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/usps-shipping-method'
)
) {
continue;
}
if ( 'CA' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/canada-post-shipping-method'
)
) {
continue;
}
}
?>
<li class="product">
<a href="<?php echo esc_attr( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
<?php if ( ! empty( $addon->image ) ) : ?>
<span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>"/></span>
<?php else : ?>
<h2><?php echo esc_html( $addon->title ); ?></h2>
<?php endif; ?>
<span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
<p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php else : ?>
<?php /* translators: a url */ ?>
<p><?php printf( wp_kses_post( __( 'Our catalog of WooCommerce Extensions can be found on WooCommerce.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ) ), 'https://woocommerce.com/product-category/woocommerce-extensions/' ); ?></p>
<?php endif; ?>
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
<div class="storefront">
<a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
<p><?php echo wp_kses_post( __( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ) ); ?></p>
<p>
<a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_storefront' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Download &amp; install', 'woocommerce' ); ?></a>
</p>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -27,7 +27,7 @@ final class WooCommerce {
*
* @var string
*/
public $version = '5.6.0';
public $version = '5.8.0';
/**
* WooCommerce Schema version.

View File

@ -29,11 +29,15 @@ class WC_Extensions_Tracking {
*/
public function track_extensions_page() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
$event = 'extensions_view';
$properties = array(
'section' => empty( $_REQUEST['section'] ) ? '_featured' : wc_clean( wp_unslash( $_REQUEST['section'] ) ),
);
$event = 'extensions_view';
if ( 'helper' === $properties['section'] ) {
$event = 'subscriptions_view';
}
if ( ! empty( $_REQUEST['search'] ) ) {
$event = 'extensions_view_search';
$properties['search_term'] = wc_clean( wp_unslash( $_REQUEST['search'] ) );

View File

@ -2273,7 +2273,22 @@ function wc_update_500_db_version() {
* See @link https://github.com/woocommerce/woocommerce/issues/29235.
*/
function wc_update_560_create_refund_returns_page() {
/**
* Filter on the pages created to return what we expect.
*
* @param array $pages The default WC pages.
*/
function filter_created_pages( $pages ) {
$page_to_create = array( 'refund_returns' );
return array_intersect_key( $pages, array_flip( $page_to_create ) );
}
add_filter( 'woocommerce_create_pages', 'filter_created_pages' );
WC_Install::create_pages();
remove_filter( 'woocommerce_create_pages', 'filter_created_pages' );
}
/**

362
package-lock.json generated
View File

@ -9227,7 +9227,7 @@
"@jest/test-sequencer": "^25.5.4",
"@slack/web-api": "^6.1.0",
"@woocommerce/api": "^0.2.0",
"@wordpress/e2e-test-utils": "^4.15.0",
"@wordpress/e2e-test-utils": "^4.16.1",
"@wordpress/jest-preset-default": "^6.4.0",
"app-root-path": "^3.0.0",
"jest": "^25.1.0",
@ -9319,7 +9319,7 @@
}
},
"prettier": {
"version": "npm:prettier@1.19.1",
"version": "npm:wp-prettier@1.19.1",
"resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-1.19.1.tgz",
"integrity": "sha512-mqAC2r1NDmRjG+z3KCJ/i61tycKlmADIjxnDhQab+KBxSAGbF/W7/zwB2guy/ypIeKrrftNsIYkNZZQKf3vJcg==",
"dev": true
@ -12210,64 +12210,6 @@
}
}
},
"@wordpress/e2e-test-utils": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.15.0.tgz",
"integrity": "sha512-mCOlNDX/yERd7hIAFB+y9x56iCQ2XyDZkWNlQNMYRH0+EdrQ5H5zE7MSxzycideIC7grxKw/j4RcuyxUdSWGDw==",
"dev": true,
"requires": {
"@babel/runtime": "^7.11.2",
"@wordpress/keycodes": "^2.16.0",
"@wordpress/url": "^2.19.0",
"lodash": "^4.17.19",
"node-fetch": "^2.6.0"
},
"dependencies": {
"@wordpress/i18n": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.16.0.tgz",
"integrity": "sha512-ZyRWplETgD90caVaBuGBFcnYVpcogji1g9Ctbb5AO2bGFeHpmPpjvWm0NE64iQTtLFEJoaCiq6oqUvAOPIQJpw==",
"dev": true,
"requires": {
"@babel/runtime": "^7.11.2",
"gettext-parser": "^1.3.1",
"lodash": "^4.17.19",
"memize": "^1.1.0",
"sprintf-js": "^1.1.1",
"tannin": "^1.2.0"
}
},
"@wordpress/keycodes": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-2.16.0.tgz",
"integrity": "sha512-8CfxB+9f08FXMUsaO625abmbx2ZinFUz6upzXbe0Da8W3oy7+/TZz6EWsMVBEWz+alSR3Z2FUZ7xUuopHZFcow==",
"dev": true,
"requires": {
"@babel/runtime": "^7.11.2",
"@wordpress/i18n": "^3.16.0",
"lodash": "^4.17.19"
}
},
"@wordpress/url": {
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-2.19.0.tgz",
"integrity": "sha512-RizWbBxYmWBlNd+q89r3N6Y2XO8eCG3VncnXDgbGnhV4e+2z9fjzp1/9C/SORftEn+ix/qBKbqygmkmBqb+wuw==",
"dev": true,
"requires": {
"@babel/runtime": "^7.11.2",
"lodash": "^4.17.19",
"qs": "^6.5.2",
"react-native-url-polyfill": "^1.1.2"
}
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"dev": true
}
}
},
"@wordpress/eslint-plugin": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-4.1.0.tgz",
@ -20766,125 +20708,32 @@
"dev": true,
"requires": {
"@wordpress/deprecated": "^2.10.0",
"@wordpress/e2e-test-utils": "^4.6.0",
"@wordpress/e2e-test-utils": "^4.16.1",
"config": "3.3.3",
"faker": "^5.1.0",
"fishery": "^1.2.0"
},
"dependencies": {
"@babel/runtime": {
"version": "7.11.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz",
"integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==",
"version": "7.15.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz",
"integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
}
},
"@tannin/compile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/compile/-/compile-1.1.0.tgz",
"integrity": "sha512-n8m9eNDfoNZoxdvWiTfW/hSPhehzLJ3zW7f8E7oT6mCROoMNWCB4TYtv041+2FMAxweiE0j7i1jubQU4MEC/Gg==",
"dev": true,
"requires": {
"@tannin/evaluate": "^1.2.0",
"@tannin/postfix": "^1.1.0"
}
},
"@tannin/evaluate": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@tannin/evaluate/-/evaluate-1.2.0.tgz",
"integrity": "sha512-3ioXvNowbO/wSrxsDG5DKIMxC81P0QrQTYai8zFNY+umuoHWRPbQ/TuuDEOju9E+jQDXmj6yI5GyejNuh8I+eg==",
"dev": true
},
"@tannin/plural-forms": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/plural-forms/-/plural-forms-1.1.0.tgz",
"integrity": "sha512-xl9R2mDZO/qiHam1AgMnAES6IKIg7OBhcXqy6eDsRCdXuxAFPcjrej9HMjyCLE0DJ/8cHf0i5OQTstuBRhpbHw==",
"dev": true,
"requires": {
"@tannin/compile": "^1.1.0"
}
},
"@tannin/postfix": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/postfix/-/postfix-1.1.0.tgz",
"integrity": "sha512-oocsqY7g0cR+Gur5jRQLSrX2OtpMLMse1I10JQBm8CdGMrDkh1Mg2gjsiquMHRtBs4Qwu5wgEp5GgIYHk4SNPw==",
"dev": true
},
"@wordpress/e2e-test-utils": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.6.0.tgz",
"integrity": "sha512-oqnFEOuWkUFwzSVGeKZOfs9YhWVyCKdsOtJKnXd6Vv5Q1quq2fmbDp6HL+dIUI2DlJZISUmOWG4B37mMVA0DLg==",
"version": "4.16.1",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils/-/e2e-test-utils-4.16.1.tgz",
"integrity": "sha512-Dpsq5m0VSvjIhro2MjACSzkOkOf1jGEryzgEMW1ikbT6YI+motspHfGtisKXgYhZJOnjV4PwuEg+9lPVnd971g==",
"dev": true,
"requires": {
"@babel/runtime": "^7.9.2",
"@wordpress/keycodes": "^2.12.0",
"@wordpress/url": "^2.14.0",
"lodash": "^4.17.15",
"node-fetch": "^1.7.3"
}
},
"@wordpress/i18n": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.15.0.tgz",
"integrity": "sha512-AawJgHEGPyMoPATl8a3Qa+cCZV3S6azPfvqeStbN2pSc7v0HqYhJhWaw80WToHkN4kyOsfu1PUVf1wefuoMNEA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.9.2",
"gettext-parser": "^1.3.1",
"@babel/runtime": "^7.12.5",
"@wordpress/keycodes": "^2.18.0",
"@wordpress/url": "^2.21.0",
"lodash": "^4.17.19",
"memize": "^1.1.0",
"sprintf-js": "^1.1.1",
"tannin": "^1.2.0"
}
},
"@wordpress/keycodes": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-2.15.0.tgz",
"integrity": "sha512-XHyBmhzWjp0svzwiGLOwovlQHH42KkACKTfakDizB5OaaAzlmgZ34Fdl03S7pWl+HUBa7MqItRhGsd4kxdo0bQ==",
"dev": true,
"requires": {
"@babel/runtime": "^7.9.2",
"@wordpress/i18n": "^3.15.0",
"lodash": "^4.17.19"
}
},
"@wordpress/url": {
"version": "2.18.0",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-2.18.0.tgz",
"integrity": "sha512-FX6CYVG8vYgQnxjA9SsWTDAWPHarPSBIGk2shZ3I+cq+LV31dDaAz8OhvVMD6rvUoQW0INlWe1t2JKXoHhcTcw==",
"dev": true,
"requires": {
"@babel/runtime": "^7.9.2",
"lodash": "^4.17.19",
"qs": "^6.5.2",
"react-native-url-polyfill": "^1.1.2"
}
},
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
"dev": true
},
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"dev": true,
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"dev": true,
"requires": {
"iconv-lite": "^0.6.2"
"node-fetch": "^2.6.0"
}
},
"faker": {
@ -20892,130 +20741,6 @@
"resolved": "https://registry.npmjs.org/faker/-/faker-5.1.0.tgz",
"integrity": "sha512-RrWKFSSA/aNLP0g3o2WW1Zez7/MnMr7xkiZmoCfAGZmdkDQZ6l2KtuXHN5XjdvpRjDl8+3vf+Rrtl06Z352+Mw==",
"dev": true
},
"gettext-parser": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz",
"integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==",
"dev": true,
"requires": {
"encoding": "^0.1.12",
"safe-buffer": "^5.1.1"
}
},
"iconv-lite": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz",
"integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
}
},
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==",
"dev": true
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true
},
"memize": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/memize/-/memize-1.1.0.tgz",
"integrity": "sha512-K4FcPETOMTwe7KL2LK0orMhpOmWD2wRGwWWpbZy0fyArwsyIKR8YJVz8+efBAh3BO4zPqlSICu4vsLTRRqtFAg==",
"dev": true
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"dev": true,
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"dev": true
},
"qs": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ==",
"dev": true
},
"react-native-url-polyfill": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/react-native-url-polyfill/-/react-native-url-polyfill-1.2.0.tgz",
"integrity": "sha512-hpLZ8RyS3oGVyTOe/HjoqVoCOSkeJvrCoEB3bJsY7t9uh7kpQDV6kgvdlECEafYpxe3RzMrKLVcmWRbPU7CuAw==",
"dev": true,
"requires": {
"whatwg-url-without-unicode": "8.0.0-3"
}
},
"regenerator-runtime": {
"version": "0.13.7",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==",
"dev": true
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
},
"sprintf-js": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
"dev": true
},
"tannin": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tannin/-/tannin-1.2.0.tgz",
"integrity": "sha512-U7GgX/RcSeUETbV7gYgoz8PD7Ni4y95pgIP/Z6ayI3CfhSujwKEBlGFTCRN+Aqnuyf4AN2yHL+L8x+TCGjb9uA==",
"dev": true,
"requires": {
"@tannin/plural-forms": "^1.1.0"
}
},
"webidl-conversions": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz",
"integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==",
"dev": true
},
"whatwg-url-without-unicode": {
"version": "8.0.0-3",
"resolved": "https://registry.npmjs.org/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz",
"integrity": "sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig==",
"dev": true,
"requires": {
"buffer": "^5.4.3",
"punycode": "^2.1.1",
"webidl-conversions": "^5.0.0"
}
}
}
},
@ -21086,9 +20811,9 @@
},
"dependencies": {
"@babel/runtime": {
"version": "7.13.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.9.tgz",
"integrity": "sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==",
"version": "7.15.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz",
"integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
@ -21162,13 +20887,13 @@
}
},
"@wordpress/i18n": {
"version": "3.18.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.18.0.tgz",
"integrity": "sha512-e1uFWhWYnT0B6s3hyy+xS0S3bwabrvkZA84xxitiIcQvGnZDUPntqv6M9+VrgJVlmd2MR2TbCGJ5xKFAVFr/gA==",
"version": "3.20.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-3.20.0.tgz",
"integrity": "sha512-SIoOJFB4UrrYAScS4H91CYCLW9dX3Ghv8pBKc/yHGculb1AdGr6gRMlmJxZV62Cn3CZ4Ga86c+FfR+GiBu0JPg==",
"dev": true,
"requires": {
"@babel/runtime": "^7.12.5",
"@wordpress/hooks": "^2.11.1",
"@babel/runtime": "^7.13.10",
"@wordpress/hooks": "^2.12.3",
"gettext-parser": "^1.3.1",
"lodash": "^4.17.19",
"memize": "^1.1.0",
@ -21177,13 +20902,22 @@
},
"dependencies": {
"@babel/runtime": {
"version": "7.13.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.9.tgz",
"integrity": "sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==",
"version": "7.15.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz",
"integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
}
},
"@wordpress/hooks": {
"version": "2.12.3",
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-2.12.3.tgz",
"integrity": "sha512-LmKiwKldZt6UYqOxV/a6+eUFXdvALFnB/pQx3RmrMvO64sgFhfR6dhrlv+uVbuuezSuv8dce1jx8lUWAT0krMA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.13.10"
}
}
}
},
@ -21213,20 +20947,20 @@
}
},
"@wordpress/keycodes": {
"version": "2.18.3",
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-2.18.3.tgz",
"integrity": "sha512-Lenyw+K2KgiqddBv5fDCh2JRfXFrONWNvPfv1DKXzHXTvBSI0JkU1RVP5WZTcVuEtctCZWL5JbhrkG2I26w68g==",
"version": "2.19.3",
"resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-2.19.3.tgz",
"integrity": "sha512-8rNdmP5M1ifTgLIL0dt/N1uTGsq/Rx1ydCXy+gg24WdxBRhyu5sudNVCtascVXo26aIfOH9OJRdqRZZTEORhog==",
"dev": true,
"requires": {
"@babel/runtime": "^7.12.5",
"@wordpress/i18n": "^3.18.0",
"@babel/runtime": "^7.13.10",
"@wordpress/i18n": "^3.20.0",
"lodash": "^4.17.19"
},
"dependencies": {
"@babel/runtime": {
"version": "7.13.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.9.tgz",
"integrity": "sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==",
"version": "7.15.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz",
"integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
@ -21241,20 +20975,20 @@
"dev": true
},
"@wordpress/url": {
"version": "2.21.2",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-2.21.2.tgz",
"integrity": "sha512-bLHg4pTo/9mQUkK1s1MU/Sjgnzfy2AkPvPn4ObGA8/4CFkMsDhQGAVhhw5YuezcxvaJkBiKJ+BxgFJ1QKksF6w==",
"version": "2.22.2",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-2.22.2.tgz",
"integrity": "sha512-aqpYKQXzyzkCOm+GzZRYlLb+wh58g0cwR1PaKAl0UXaBS4mdS+X6biMriylb4P8CVC/RR7CSw5XI20JC24KDwQ==",
"dev": true,
"requires": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.13.10",
"lodash": "^4.17.19",
"react-native-url-polyfill": "^1.1.2"
},
"dependencies": {
"@babel/runtime": {
"version": "7.13.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.9.tgz",
"integrity": "sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==",
"version": "7.15.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz",
"integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"

View File

@ -1,7 +1,7 @@
{
"name": "woocommerce",
"title": "WooCommerce",
"version": "5.7.0",
"version": "5.8.0",
"homepage": "https://woocommerce.com/",
"repository": {
"type": "git",
@ -52,7 +52,6 @@
"@woocommerce/e2e-utils": "file:tests/e2e/utils",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/e2e-test-utils": "^4.16.1",
"@wordpress/eslint-plugin": "7.3.0",
"autoprefixer": "9.8.6",
"babel-eslint": "10.1.0",

View File

@ -4,7 +4,7 @@ Tags: e-commerce, store, sales, sell, woo, shop, cart, checkout, downloadable, d
Requires at least: 5.6
Tested up to: 5.8
Requires PHP: 7.0
Stable tag: 5.5.2
Stable tag: 5.6.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

View File

@ -10,6 +10,9 @@
- Checkout create account test would fail if configuration value `addresses.customer.billing.email` was not `john.doe@example.com`
## Changed
- The e2e test `order-status-filters.test.js` now uses the API to create orders
# 0.1.3
## Added

View File

@ -1,4 +1,3 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/

View File

@ -20,14 +20,8 @@ const runInitiateWccomConnectionTest = () => {
await merchant.login();
});
it.skip('can initiate WCCOM connection', async () => {
await merchant.openExtensions();
// Click on a tab to choose WooCommerce Subscriptions extension
await Promise.all([
expect(page).toClick('a.nav-tab', {text: "WooCommerce.com Subscriptions"}),
page.waitForNavigation({waitUntil: 'networkidle0'}),
]);
it('can initiate WCCOM connection', async () => {
await merchant.openHelper();
// Click on Connect button to initiate a WCCOM connection
await Promise.all([

View File

@ -1,20 +1,16 @@
/* eslint-disable jest/no-export, jest/no-standalone-expect */
/**
* Internal dependencies
*/
const {
createSimpleProduct,
createSimpleOrder,
createCoupon,
uiUnblocked,
addProductToOrder,
evalAndClick,
merchant
merchant,
createOrder,
} = require( '@woocommerce/e2e-utils' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
const discountedPrice = simpleProductPrice - 5.00;
@ -22,22 +18,18 @@ const couponDialogMessage = 'Enter a coupon code to apply. Discounts are applied
let couponCode;
let orderId;
let productId;
const runOrderApplyCouponTest = () => {
describe('WooCommerce Orders > Apply coupon', () => {
beforeAll(async () => {
await createSimpleProduct();
productId = await createSimpleProduct();
couponCode = await createCoupon();
orderId = await createOrder( { productId, status: 'pending' } );
await merchant.login();
orderId = await createSimpleOrder('Pending payment', simpleProductName);
await Promise.all([
addProductToOrder(orderId, simpleProductName),
// We need to remove any listeners on the `dialog` event otherwise we can't catch the dialog below
page.removeAllListeners('dialog'),
]);
await merchant.goToOrder( orderId );
await page.removeAllListeners('dialog');
// Make sure the simple product price is greater than the coupon amount
await expect(Number(simpleProductPrice)).toBeGreaterThan(5.00);
@ -72,6 +64,8 @@ const runOrderApplyCouponTest = () => {
await uiUnblocked();
await page.waitFor(2000); // to avoid flakyness
// Verify the coupon pricing has been removed
await expect(page).not.toMatchElement('.wc_coupon_list li.code.editable', { text: couponCode.toLowerCase() });
await expect(page).not.toMatchElement('.wc-order-item-discount', { text: '5.00' });

View File

@ -1,4 +1,3 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests, jest/no-standalone-expect */
const { createSimpleProduct } = require( '@woocommerce/e2e-utils' );
/**
@ -6,8 +5,7 @@ const { createSimpleProduct } = require( '@woocommerce/e2e-utils' );
*/
const {
merchant,
createSimpleOrder,
addProductToOrder,
createOrder,
} = require( '@woocommerce/e2e-utils' );
// TODO create a function for the logic below getConfigSimpleProduct(), see: https://github.com/woocommerce/woocommerce/issues/29072
@ -15,23 +13,15 @@ const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
const simpleProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99';
let orderId;
const runMerchantOrdersCustomerPaymentPage = () => {
let orderId;
let productId;
describe('WooCommerce Merchant Flow: Orders > Customer Payment Page', () => {
beforeAll(async () => {
await createSimpleProduct();
productId = await createSimpleProduct();
orderId = await createOrder( { productId } );
await merchant.login();
orderId = await createSimpleOrder();
await addProductToOrder( orderId, simpleProductName );
// We first need to click "Update" otherwise the link doesn't show
await Promise.all([
expect(page).toClick( 'button.save_order' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
]);
});
it('should show the customer payment page link on a pending payment order', async () => {

View File

@ -1,28 +1,21 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests, */
/**
* Internal dependencies
*/
const {
merchant,
createSimpleProduct,
createSimpleOrder,
verifyCheckboxIsSet,
verifyValueOfInputField,
uiUnblocked,
addProductToOrder,
evalAndClick,
createOrder,
} = require( '@woocommerce/e2e-utils' );
const { waitForSelector } = require( '@woocommerce/e2e-environment' );
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
let orderId;
let currencySymbol;
/**
* Evaluate and click a button selector then wait for a result selector.
* This is a work around for what appears to be intermittent delays in handling confirm dialogs.
@ -44,20 +37,24 @@ const clickAndWaitForSelector = async ( buttonSelector, resultSelector ) => {
const runRefundOrderTest = () => {
describe('WooCommerce Orders > Refund an order', () => {
let productId;
let orderId;
let currencySymbol;
beforeAll(async () => {
await createSimpleProduct();
productId = await createSimpleProduct();
orderId = await createOrder( {
productId,
status: 'completed'
} );
await merchant.login();
orderId = await createSimpleOrder();
await addProductToOrder(orderId, simpleProductName);
await merchant.goToOrder( orderId );
// Get the currency symbol for the store's selected currency
await page.waitForSelector('.woocommerce-Price-currencySymbol');
let currencyElement = await page.$('.woocommerce-Price-currencySymbol');
currencySymbol = await page.evaluate(el => el.textContent, currencyElement);
// Update order status to `Completed` so we can issue a refund
await merchant.updateOrderStatus(orderId, 'Completed');
});
it('can issue a refund by quantity', async () => {
@ -93,7 +90,6 @@ const runRefundOrderTest = () => {
// Verify system note was added
expect(page).toMatchElement('.system-note', { text: 'Order status changed from Completed to Refunded.' }),
]);
page.waitForNavigation( { waitUntil: 'networkidle0' } );
});
it('can delete an issued refund', async () => {

View File

@ -1,17 +1,12 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests, jest/expect-expect */
/**
* Internal dependencies
*/
const {
merchant,
clearAndFillInput,
searchForOrder,
createSimpleProduct,
addProductToOrder,
clickUpdateOrder,
factories,
selectOptionInSelect2,
createOrder,
} = require( '@woocommerce/e2e-utils' );
const searchString = 'John Doe';
@ -45,7 +40,7 @@ const customerShipping = {
/**
* Set the billing fields for the customer account for this test suite.
*
* @returns {Promise<void>}
* @returns {Promise<number>}
*/
const updateCustomerBilling = async () => {
const client = factories.api.withDefaultPermalinks;
@ -65,39 +60,33 @@ const updateCustomerBilling = async () => {
shipping: customerShipping,
};
await client.put( customerEndpoint + customerId, customerData );
return customerId;
};
const runOrderSearchingTest = () => {
describe('WooCommerce Orders > Search orders', () => {
let productId;
let orderId;
let customerId;
beforeAll( async () => {
await createSimpleProduct('Wanted Product');
await updateCustomerBilling();
productId = await createSimpleProduct('Wanted Product');
customerId = await updateCustomerBilling();
orderId = await createOrder({
customerId,
productId,
customerBilling,
customerShipping,
});
// Create new order for testing
// Login and open All Orders view
await merchant.login();
await merchant.openNewOrder();
await page.waitForSelector('#order_status');
await page.click('#customer_user');
await page.click('span.select2-search > input.select2-search__field');
await page.type('span.select2-search > input.select2-search__field', 'Jane Smith');
await page.waitFor(2000); // to avoid flakyness
await page.keyboard.press('Enter');
// Get the post id
const variablePostId = await page.$('#post_ID');
orderId = (await(await variablePostId.getProperty('value')).jsonValue());
// Save new order and add desired product to order
await clickUpdateOrder('Order updated.', true);
await addProductToOrder(orderId, 'Wanted Product');
// Open All Orders view
await merchant.openAllOrdersView();
});
it('can search for order by order id', async () => {
await searchForOrder(orderId, orderId, searchString);
// Convert the order ID to string so we can search on it
await searchForOrder(orderId.toString(), orderId, searchString);
});
it('can search for order by billing first name', async () => {

View File

@ -1,10 +1,11 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
import config from 'config';
const {
merchant,
createSimpleOrder,
withRestApi,
clickFilter,
moveAllItemsToTrash,
} = require( '@woocommerce/e2e-utils' );
@ -42,22 +43,28 @@ const orderStatus = {
description: { text: 'Failed' },
}
};
const defaultOrder = config.get('orders.basicPaidOrder');
const runOrderStatusFiltersTest = () => {
describe('WooCommerce Orders > Filter Orders by Status', () => {
beforeAll(async () => {
// First, let's login
await merchant.login();
// First, let's create some orders we can filter against
const orders = Object.entries(orderStatus).map((entryPair) => {
const statusName = entryPair[1].name.replace('wc-', '');
// Next, let's create some orders we can filter against
await createSimpleOrder(orderStatus.pending.description.text);
await createSimpleOrder(orderStatus.processing.description.text);
await createSimpleOrder(orderStatus.onHold.description.text);
await createSimpleOrder(orderStatus.completed.description.text);
await createSimpleOrder(orderStatus.cancelled.description.text);
await createSimpleOrder(orderStatus.refunded.description.text);
await createSimpleOrder(orderStatus.failed.description.text);
}, 60000);
return {
...defaultOrder,
status: statusName,
};
});
// Create the orders using the API
await withRestApi.batchCreateOrders(orders);
// Next, let's login
await merchant.login();
});
afterAll( async () => {
// Make sure we're on the all orders view and cleanup the orders we created

View File

@ -1,5 +1,3 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
@ -10,7 +8,7 @@ const {
addShippingZoneAndMethod,
clearAndFillInput,
selectOptionInSelect2,
deleteAllShippingZones,
withRestApi,
} = require( '@woocommerce/e2e-utils' );
/**
@ -35,8 +33,8 @@ const runAddNewShippingZoneTest = () => {
describe('WooCommerce Shipping Settings - Add new shipping zone', () => {
beforeAll(async () => {
await createSimpleProduct();
await withRestApi.deleteAllShippingZones();
await merchant.login();
await deleteAllShippingZones();
});
it('add shipping zone for San Francisco with free Local pickup', async () => {

View File

@ -1,16 +1,12 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests, jest/expect-expect */
/**
* Internal dependencies
*/
const {
shopper,
merchant,
createSimpleProduct,
addShippingZoneAndMethod,
clearAndFillInput,
uiUnblocked,
selectOptionInSelect2,
withRestApi,
} = require( '@woocommerce/e2e-utils' );
/**
@ -43,29 +39,21 @@ const runCartCalculateShippingTest = () => {
await createSimpleProduct(firstProductName);
await createSimpleProduct(secondProductName, secondProductPrice);
await merchant.login();
await merchant.openNewShipping();
await withRestApi.resetSettingsGroupToDefault( 'general' );
// Add a new shipping zone Germany with Free shipping
await addShippingZoneAndMethod(shippingZoneNameDE, shippingCountryDE, ' ', 'free_shipping');
await withRestApi.addShippingZoneAndMethod(shippingZoneNameDE, shippingCountryDE, ' ', 'free_shipping');
// Add a new shipping zone for France with Flat rate & Local pickup
await addShippingZoneAndMethod(shippingZoneNameFR, shippingCountryFR, ' ', 'flat_rate');
await page.waitFor(1000); // to avoid flakiness in headless
await page.click('a.wc-shipping-zone-method-settings', {text: 'Flat rate'});
await clearAndFillInput('#woocommerce_flat_rate_cost', '5');
await page.click('.wc-backbone-modal-main button#btn-ok');
// Add additional method Local pickup for the same location
await page.waitFor(1000); // to avoid flakiness in headless
await page.click('button.wc-shipping-zone-add-method', {text:'Add shipping method'});
await page.waitForSelector('.wc-shipping-zone-method-selector');
await page.select('select[name="add_method_id"]', 'local_pickup');
await page.click('button#btn-ok');
await page.waitForSelector('#zone_locations');
await merchant.logout();
await withRestApi.addShippingZoneAndMethod(shippingZoneNameFR, shippingCountryFR, ' ', 'flat_rate', '5', ['local_pickup']);
await shopper.emptyCart();
});
afterAll(async () => {
await withRestApi.deleteAllShippingZones();
});
it('allows customer to calculate Free Shipping if in Germany', async () => {
await shopper.goToShop();
await shopper.addToCartFromShopPage(firstProductName);
@ -76,6 +64,7 @@ const runCartCalculateShippingTest = () => {
await expect(page).toClick('#select2-calc_shipping_country-container');
await selectOptionInSelect2('Germany');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping costs
await page.waitForSelector('.order-total');
@ -84,13 +73,14 @@ const runCartCalculateShippingTest = () => {
});
it('allows customer to calculate Flat rate and Local pickup if in France', async () => {
await page.reload();
await page.reload( { waitUntil: ['networkidle0', 'domcontentloaded'] } );
// Set shipping country to France
await expect(page).toClick('a.shipping-calculator-button');
await expect(page).toClick('#select2-calc_shipping_country-container');
await selectOptionInSelect2('France');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping costs
await page.waitForSelector('.order-total');
@ -119,13 +109,14 @@ const runCartCalculateShippingTest = () => {
});
it('should show correct total cart price with 2 products without flat rate', async () => {
await page.reload();
await page.reload( { waitUntil: ['networkidle0', 'domcontentloaded'] } );
// Set shipping country to Spain
await expect(page).toClick('a.shipping-calculator-button');
await expect(page).toClick('#select2-calc_shipping_country-container');
await selectOptionInSelect2('Spain');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping costs
await page.waitForSelector('.order-total');

View File

@ -8,6 +8,10 @@
- `downloadZip( fileUrl, downloadPath )` downloads a plugin zip file from a remote location to the provided path.
- Added `getLatestReleaseZipUrl( owner, repository, getPrerelease, perPage )` util function to get the latest release zip from a GitHub repository.
- Added `DEFAULT_TIMEOUT_OVERRIDE` that allows passing in a time in milliseconds to override the default Jest and Puppeteer timeouts.
- Fix latest version tag search paging logic
- Update fallback PHP version to 7.4.22
- Update fallback MariaDB version to 10.6.4
- Update fallback WordPress version to 5.8.0.
# 0.2.2

View File

@ -10,7 +10,7 @@ if [[ $1 ]]; then
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
export WORDPRESS_VERSION=$WP_VERSION
else
export WORDPRESS_VERSION="5.5.1"
export WORDPRESS_VERSION="5.8.0"
fi
if ! [[ $TRAVIS_PHP_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
@ -19,7 +19,7 @@ if [[ $1 ]]; then
if [[ $TRAVIS_PHP_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
export DC_PHP_VERSION=$TRAVIS_PHP_VERSION
else
export DC_PHP_VERSION="7.4.9"
export DC_PHP_VERSION="7.4.22"
fi
if ! [[ $TRAVIS_MARIADB_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
@ -28,7 +28,7 @@ if [[ $1 ]]; then
if [[ $TRAVIS_MARIADB_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
export DC_MARIADB_VERSION=$TRAVIS_MARIADB_VERSION
else
export DC_MARIADB_VERSION="10.5.5"
export DC_MARIADB_VERSION="10.6.4"
fi
if [[ $1 == 'up' ]]; then

View File

@ -84,21 +84,23 @@ function findLatestVersion( image, nameSearch ) {
// Repeat the requests until we've read as many pages as necessary.
const paginationFn = function ( result ) {
// We can save on unnecessarily loading every page by short-circuiting when
// the number of days between the first recorded version and the
// one from this page becomes excessive.
const lastUpdate = Date.parse( result.latestTag.last_updated );
if ( ! earliestUpdated ) {
earliestUpdated = lastUpdate;
} else {
const daysSinceEarliestUpdate = ( earliestUpdated - lastUpdate ) / ( 1000 * 3600 * 24 );
if ( daysSinceEarliestUpdate > 15 ) {
result.isLastPage = true;
if ( result.latestTag ) {
// We can save on unnecessarily loading every page by short-circuiting when
// the number of days between the first recorded version and the
// one from this page becomes excessive.
const lastUpdate = Date.parse( result.latestTag.last_updated );
if ( ! earliestUpdated ) {
earliestUpdated = lastUpdate;
} else {
const daysSinceEarliestUpdate = ( earliestUpdated - lastUpdate ) / ( 1000 * 3600 * 24 );
if ( daysSinceEarliestUpdate > 15 ) {
result.isLastPage = true;
}
}
}
if ( ! latestVersion || semver.gt( result.latestTag.semver, latestVersion ) ) {
latestVersion = result.latestTag.semver;
if ( ! latestVersion || semver.gt( result.latestTag.semver, latestVersion ) ) {
latestVersion = result.latestTag.semver;
}
}
if ( ! result.isLastPage ) {

View File

@ -14,17 +14,17 @@ printf "Testing URL: $WP_BASE_URL\n\n"
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${WP_BASE_URL}/?pagename=ready)" != "200" ]]
do
echo "$(date) - Docker container is still being built"
echo "$(date) - Waiting for testing environment"
sleep ${DELAY_SEC}
((count++))
if [[ $count -gt ${MAX_ATTEMPTS} ]]; then
echo "$(date) - Docker container couldn't be built"
exit 1
echo "$(date) - Testing environment couldn't be found"
exit 1
fi
done
if [[ $count -gt 0 ]]; then
echo "$(date) - Docker container had been built successfully"
echo "$(date) - Testing environment is ready"
fi

2632
tests/e2e/env/package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
"@jest/test-sequencer": "^25.5.4",
"@slack/web-api": "^6.1.0",
"@woocommerce/api": "^0.2.0",
"@wordpress/e2e-test-utils": "^4.15.0",
"@wordpress/e2e-test-utils": "^4.16.1",
"@wordpress/jest-preset-default": "^6.4.0",
"app-root-path": "^3.0.0",
"jest": "^25.1.0",
@ -35,11 +35,11 @@
"node-stream-zip": "^1.13.6"
},
"devDependencies": {
"@babel/cli": "7.12.0",
"@babel/core": "7.12.0",
"@babel/polyfill": "7.11.5",
"@babel/preset-env": "7.12.0",
"@wordpress/eslint-plugin": "7.1.0",
"@babel/cli": "7.12.8",
"@babel/core": "7.12.9",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.12.7",
"@wordpress/eslint-plugin": "7.3.0",
"ndb": "^1.1.5",
"semver": "^7.3.2"
},

View File

@ -3,6 +3,7 @@
## Added
- Factories for variable product, variation, and grouped product
- New function to create orders by batch using the orders API
- Added new constant for WordPress update page `WP_ADMIN_WP_UPDATES`
- Added new merchant flow for `openWordPressUpdatesPage()`
- Added new merchant flows:
@ -16,6 +17,8 @@
- Added `deleteAllOrders()` that goes through and deletes all orders
- Added `deleteAllShippingClasses()` which permanently deletes all shipping classes using the API
- Added `statuses` optional parameter to `deleteAllRepositoryObjects()` to delete on specific statuses
- Added `createOrder()` component util that creates an order using the API with the passed in details
- Updated `addShippingZoneAndMethod` to use the API instead of UI to create shipping zones
# 0.1.5

View File

@ -147,6 +147,7 @@ This package provides support for enabling retries in tests:
| `deleteAllShippingClasses` | Permanently delete all shipping classes |
| `deleteCustomerByEmail` | `emailAddress` | Delete customer user account. Posts are reassigned to user ID 1 |
| `resetSettingsGroupToDefault` | `settingsGroup` | Reset settings in settings group to default except `select` fields |
| `batchCreateOrders` | `orders` | Create a batch of orders using the "Batch Create Order" API endpoint |
| `deleteAllOrders` | | Permanently delete all orders |
### Page Utilities
@ -194,6 +195,7 @@ This package provides support for enabling retries in tests:
| `clickUpdateOrder` | `noticeText`, `waitForSave` | Helper method to click the Update button on the order details page |
| `deleteAllShippingZones` | | Delete all the existing shipping zones |
| `waitForSelectorWithoutThrow` | `selector`, `timeoutInSeconds` | conditionally wait for a selector without throwing an error. Default timeout is 5 seconds |
| `createOrder` | `orderOptions` | Creates an order using the API with the passed in details |
### Test Utilities

View File

@ -12,7 +12,7 @@
"module": "build-module/index.js",
"dependencies": {
"@wordpress/deprecated": "^2.10.0",
"@wordpress/e2e-test-utils": "^4.6.0",
"@wordpress/e2e-test-utils": "^4.16.1",
"config": "3.3.3",
"faker": "^5.1.0",
"fishery": "^1.2.0"

View File

@ -16,7 +16,7 @@ import {
waitForSelectorWithoutThrow,
} from './page-utils';
import factories from './factories';
import { Coupon } from '@woocommerce/api';
import { Coupon, Order } from '@woocommerce/api';
const client = factories.api.withDefaultPermalinks;
const config = require( 'config' );
@ -322,6 +322,30 @@ const createGroupedProduct = async (groupedProduct = defaultGroupedProduct) => {
return id;
};
/**
* Use the API to create an order with the provided details.
*
* @param {object} orderOptions
* @returns {Promise<number>} ID of the created order.
*/
const createOrder = async ( orderOptions = {} ) => {
const newOrder = {
...( orderOptions.status ) && { status: orderOptions.status },
...( orderOptions.customerId ) && { customer_id: orderOptions.customerId },
...( orderOptions.customerBilling ) && { billing: orderOptions.customerBilling },
...( orderOptions.customerShipping ) && { shipping: orderOptions.customerShipping },
...( orderOptions.productId ) && { line_items: [
{ product_id: orderOptions.productId },
]
},
};
const repository = Order.restRepository( client );
const order = await repository.create( newOrder );
return order.id;
}
/**
* Create a basic order with the provided order status.
*
@ -522,4 +546,5 @@ export {
clickUpdateOrder,
deleteAllEmailLogs,
deleteAllShippingZones,
createOrder,
};

View File

@ -41,6 +41,7 @@ export const WP_ADMIN_ANALYTICS_PAGES = WP_ADMIN_WC_HOME + '&path=%2Fanalytics%2
export const WP_ADMIN_WC_SETTINGS = WP_ADMIN_PLUGIN_PAGE + 'wc-settings&tab=';
export const WP_ADMIN_NEW_SHIPPING_ZONE = WP_ADMIN_WC_SETTINGS + 'shipping&zone_id=new';
export const WP_ADMIN_WC_EXTENSIONS = WP_ADMIN_PLUGIN_PAGE + 'wc-addons';
export const WP_ADMIN_WC_HELPER = WP_ADMIN_PLUGIN_PAGE + 'wc-addons&section=helper';
/**
* Shop pages.

View File

@ -21,6 +21,7 @@ const {
WP_ADMIN_WC_HOME,
WP_ADMIN_WC_SETTINGS,
WP_ADMIN_WC_EXTENSIONS,
WP_ADMIN_WC_HELPER,
WP_ADMIN_NEW_SHIPPING_ZONE,
WP_ADMIN_ANALYTICS_PAGES,
WP_ADMIN_ALL_USERS_VIEW,
@ -134,6 +135,12 @@ const merchant = {
} );
},
openHelper: async () => {
await page.goto( WP_ADMIN_WC_HELPER, {
waitUntil: 'networkidle0',
} );
},
runSetupWizard: async () => {
const setupWizard = IS_RETEST_MODE ? WP_ADMIN_SETUP_WIZARD : WP_ADMIN_WC_HOME;
await page.goto( setupWizard, {

View File

@ -93,6 +93,79 @@ export const withRestApi = {
const repository = Order.restRepository( client );
await deleteAllRepositoryObjects( repository, null, orderStatuses );
},
/**
* Adds a shipping zone along with a shipping method using the API.
*
* @param zoneName Shipping zone name.
* @param zoneLocation Shiping zone location. Defaults to country:US. For states use: state:US:CA.
* @param zipCode Shipping zone zip code. Default is no zip code.
* @param zoneMethod Shipping method type. Defaults to flat_rate (use also: free_shipping or local_pickup).
* @param cost Shipping method cost. Default is no cost.
* @param additionalZoneMethods Array of additional zone methods to add to the shipping zone.
*/
addShippingZoneAndMethod: async (
zoneName,
zoneLocation = 'country:US',
zipCode = '',
zoneMethod = 'flat_rate',
cost = '',
additionalZoneMethods = [] ) => {
const path = 'wc/v3/shipping/zones';
const response = await client.post( path, { name: zoneName } );
expect(response.statusCode).toEqual(201);
let zoneId = response.data.id;
// Select shipping zone location
let [ zoneType, zoneCode ] = zoneLocation.split(/:(.+)/);
let zoneLocationPayload = [
{
code: zoneCode,
type: zoneType,
}
];
// Fill shipping zone postcode if provided
if ( zipCode ) {
zoneLocationPayload.push( {
code: zipCode,
type: "postcode",
} );
}
const locationResponse = await client.put( path + `/${zoneId}/locations`, zoneLocationPayload );
expect(locationResponse.statusCode).toEqual(200);
// Add shipping zone method
let methodPayload = {
method_id: zoneMethod
}
const methodsResponse = await client.post( path + `/${zoneId}/methods`, methodPayload );
expect(methodsResponse.statusCode).toEqual(200);
let methodId = methodsResponse.data.id;
// Add in cost, if provided
if ( cost ) {
let costPayload = {
settings: {
cost: cost
}
}
const costResponse = await client.put( path + `/${zoneId}/methods/${methodId}`, costPayload );
expect(costResponse.statusCode).toEqual(200);
}
// Add any additional zones, if provided
if (additionalZoneMethods.length > 0) {
for ( let z = 0; z < additionalZoneMethods.length; z++ ) {
let response = await client.post( path + `/${zoneId}/methods`, { method_id: additionalZoneMethods[z] } );
expect(response.statusCode).toEqual(200);
}
}
},
/**
* Use api package to delete shipping zones.
*
@ -178,5 +251,19 @@ export const withRestApi = {
expect( response.value ).toBe( defaultSetting.value );
}
}
},
/**
* Create a batch of orders using the "Batch Create Order" API endpoint.
*
* @param orders Array of orders to be created
*/
batchCreateOrders : async (orders) => {
const path = '/wc/v3/orders/batch';
const payload = { create: orders };
const { statusCode } = await client.post(path, payload);
expect(statusCode).toEqual(200);
}
};

View File

@ -3,7 +3,7 @@
* Plugin Name: WooCommerce
* Plugin URI: https://woocommerce.com/
* Description: An eCommerce toolkit that helps you sell anything. Beautifully.
* Version: 5.7.0-dev
* Version: 5.8.0-dev
* Author: Automattic
* Author URI: https://woocommerce.com
* Text Domain: woocommerce