diff --git a/.distignore b/.distignore
new file mode 100644
index 00000000000..cbeeef597c5
--- /dev/null
+++ b/.distignore
@@ -0,0 +1,26 @@
+.*
+.*/
+*.lock
+*.md
+*.zip
+/bin/
+/build/
+/node_modules/
+/tests/
+babel.config.js
+CHANGELOG.txt
+composer.*
+contributors.html
+docker-compose.yaml
+Dockerfile
+Gruntfile.js
+none
+package-lock.json
+package.json
+packages/woocommerce-admin/docs
+phpcs.xml
+phpunit.xml
+phpunit.xml.dist
+README.md
+renovate.json
+webpack.config.js
diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644
index f38d1a2ab7f..00000000000
--- a/.eslintrc
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "root": true,
- "env": {
- "browser": true,
- "es6": true,
- "node": true,
- "jest/globals": true
- },
- "globals": {
- "wp": true,
- "wpApiSettings": true,
- "wcSettings": true,
- "es6": true,
- "page": true,
- "browser": true,
- "context": true,
- "jestPuppeteer": true
- },
- "rules": {
- "camelcase": 0,
- "indent": 0,
- "max-len": [ 2, { "code": 140 } ],
- "no-console": 1
- },
- "plugins": [
- "jest"
- ],
- "extends": [
- "plugin:jest/recommended"
- ],
- "parser": "babel-eslint",
- "parserOptions": {
- "ecmaVersion": 8,
- "ecmaFeatures": {
- "modules": true,
- "experimentalObjectRestSpread": true,
- "jsx": true
- }
- }
-}
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 00000000000..d152f7b934a
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,35 @@
+/** @format */
+const baseConfig = require( '@woocommerce/e2e-environment' ).esLintConfig;
+
+module.exports = {
+ ...baseConfig,
+ root: true,
+ env: {
+ ...baseConfig.env,
+ browser: true,
+ es6: true,
+ node: true
+ },
+ globals: {
+ ...baseConfig.globals,
+ wp: true,
+ wpApiSettings: true,
+ wcSettings: true,
+ es6: true
+ },
+ rules: {
+ camelcase: 0,
+ indent: 0,
+ 'max-len': [ 2, { 'code': 140 } ],
+ 'no-console': 1
+ },
+ parser: 'babel-eslint',
+ parserOptions: {
+ ecmaVersion: 8,
+ ecmaFeatures: {
+ modules: true,
+ experimentalObjectRestSpread: true,
+ jsx: true
+ }
+ },
+};
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 3019353697d..82dc600b065 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,48 +1,7 @@
-
+
-
+**Prerequisites (mark completed items with an [x]):**
+- [ ] I have checked that my issue type is not listed here https://github.com/woocommerce/woocommerce/issues/new/choose
+- [ ] My issue is not a security issue, support request, bug report, enhancement or feature request (Please use the link above if it is).
-
-
-
-
-
-
-## Prerequisites
-
-
-
-- [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate
-- [ ] The issue still exists against the latest `master` branch of WooCommerce on Github (this is **not** the same version as on WordPress.org!)
-- [ ] I have attempted to find the simplest possible steps to reproduce the issue
-- [ ] I have included a failing test as a pull request (Optional)
-
-## Steps to reproduce the issue
-
-
-
-1.
-2.
-3.
-
-## Expected/actual behavior
-
-When I follow those steps, I see...
-
-I was expecting to see...
-
-## Isolating the problem
-
-
-
-- [ ] This bug happens with only WooCommerce plugin active
-- [ ] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/)
-- [ ] I can reproduce this bug consistently using the steps above
-
-## WordPress Environment
-
-
-```
-Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin here.
-```
-
+**Issue Description:**
diff --git a/.github/ISSUE_TEMPLATE/1-Security-issue.md b/.github/ISSUE_TEMPLATE/1-Security-issue.md
index 9775c1c2c0c..7c78be16976 100644
--- a/.github/ISSUE_TEMPLATE/1-Security-issue.md
+++ b/.github/ISSUE_TEMPLATE/1-Security-issue.md
@@ -1,5 +1,5 @@
---
-name: "\U0001F46E♂️ Security issue"
+name: "\U0001F512 Security issue"
about: Please report security issues *only* via https://www.hackerone.com
title: ''
labels: ''
diff --git a/.github/ISSUE_TEMPLATE/2-External-issues.md b/.github/ISSUE_TEMPLATE/2-External-issues.md
index 5d1e0e7c6ab..59f52cf6770 100644
--- a/.github/ISSUE_TEMPLATE/2-External-issues.md
+++ b/.github/ISSUE_TEMPLATE/2-External-issues.md
@@ -1,10 +1,18 @@
---
name: "\U0001F47D External issues"
-about: Please report WooCommerce REST API or WooCommerce Gutenberg Products Blocks issues directly to their respective repositories.
+about: Please report WooCommerce REST API, WooCommerce Admin or WooCommerce Gutenberg Products Blocks issues directly to their respective repositories.
title: ''
labels: ''
assignees: ''
---
-Please report WooCommerce REST API (https://github.com/woocommerce/woocommerce-rest-api) or WooCommerce Gutenberg Products Blocks (https://github.com/woocommerce/woocommerce-gutenberg-products-block) issues directly to their respective repositories.
+Please report issues for the following features directly to their respective repositories.
+
+WooCommerce REST API: https://github.com/woocommerce/woocommerce-rest-api
+
+WooCommerce Admin: https://github.com/woocommerce/woocommerce-admin
+
+WooCommerce Gutenberg Products Blocks: https://github.com/woocommerce/woocommerce-gutenberg-products-block
+
+Action Scheduler: https://github.com/woocommerce/action-scheduler
diff --git a/.github/ISSUE_TEMPLATE/3-Support.md b/.github/ISSUE_TEMPLATE/3-Support.md
index 6804c6d2c99..3ae796e2030 100644
--- a/.github/ISSUE_TEMPLATE/3-Support.md
+++ b/.github/ISSUE_TEMPLATE/3-Support.md
@@ -16,10 +16,13 @@ Usage docs can be found here: https://docs.woocommerce.com/
If you have a problem, you may want to start with the self help guide here: https://docs.woocommerce.com/document/woocommerce-self-service-guide/
**Technical support for premium extensions or if you're a WooCommerce.com customer**
- from a human being - submit a ticket via the helpdesk
+Contact WooCommerce support by opening a ticket.
https://woocommerce.com/contact-us/
+**For help with custom code**
+WooCommerce Slack Community: https://woocommerce.com/community-slack/ in the `#developers` channel.
+
**General usage and development questions**
- WooCommerce Slack Community: https://woocommerce.com/community-slack/
- WordPress.org Forums: https://wordpress.org/support/plugin/woocommerce
-- The WooCommerce Help and Share Facebook group
+- The Official WooCommerce Facebook Group https://www.facebook.com/groups/advanced.woocommerce/
diff --git a/.github/ISSUE_TEMPLATE/4-Bug-report.md b/.github/ISSUE_TEMPLATE/4-Bug-report.md
index 261ca9edb8b..c0316763647 100644
--- a/.github/ISSUE_TEMPLATE/4-Bug-report.md
+++ b/.github/ISSUE_TEMPLATE/4-Bug-report.md
@@ -8,11 +8,30 @@ assignees: ''
---
-**Describe the bug**
-A clear and concise description of what the bug is. Please be as descriptive as possible; issues lacking detail, or for any other reason than to report a bug, may be closed without action.
+Please provide us with the information requested in this bug report. Without these details, we won't be able to fully evaluate this issue.
+Bug reports lacking detail, or for any other reason than to report a bug, may be closed without action.
-**To Reproduce**
-Steps to reproduce the behavior:
+
+
+
+
+
+
+**Prerequisites (mark completed items with an [x]):**
+- [ ] I have have carried out troubleshooting steps and I believe I have found a bug.
+- [ ] I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Actual behavior**
+A clear and concise description of what actually happens. Please be as descriptive as possible;
+
+**Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.)**
+Steps to reproduce the bug:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
@@ -21,8 +40,7 @@ Steps to reproduce the behavior:
**Screenshots**
If applicable, add screenshots to help explain your problem.
-**Expected behavior**
-A clear and concise description of what you expected to happen.
+
**Isolating the problem (mark completed items with an [x]):**
- [ ] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
@@ -30,8 +48,11 @@ A clear and concise description of what you expected to happen.
- [ ] I can reproduce this bug consistently using the steps above.
**WordPress Environment**
+We use the [WooCommerce System Status Report](https://docs.woocommerce.com/document/understanding-the-woocommerce-system-status-report/) to help us evaluate the issue.
+Without this report we won't be able to fully evaluate this issue.
```
-Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin.
+The System Status Report is found in your WordPress admin under **WooCommerce > Status**.
+Please select “Get system report”, then “Copy for support”, and then paste it here.
```
diff --git a/.github/ISSUE_TEMPLATE/5-Enhancement.md b/.github/ISSUE_TEMPLATE/5-Enhancement.md
index 9f625ac6afc..b616509eedd 100644
--- a/.github/ISSUE_TEMPLATE/5-Enhancement.md
+++ b/.github/ISSUE_TEMPLATE/5-Enhancement.md
@@ -8,6 +8,10 @@ assignees: ''
---
+
+
+
+
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
diff --git a/.github/ISSUE_TEMPLATE/6-Feature-request.md b/.github/ISSUE_TEMPLATE/6-Feature-request.md
index 4b05fbc4035..e20ce518c65 100644
--- a/.github/ISSUE_TEMPLATE/6-Feature-request.md
+++ b/.github/ISSUE_TEMPLATE/6-Feature-request.md
@@ -8,6 +8,10 @@ assignees: ''
---
+
+
+
+
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
new file mode 100644
index 00000000000..3cfefb166e2
--- /dev/null
+++ b/.github/workflows/build-release.yml
@@ -0,0 +1,25 @@
+name: Build release asset
+on:
+ release:
+ types: [published]
+jobs:
+ build:
+ name: Build release asset
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+ - name: Build
+ id: build
+ uses: woocommerce/action-build@master
+ with:
+ generate-zip: true
+ - name: Upload release asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: ${{ steps.build.outputs.zip_path }}
+ asset_name: woocommerce.zip
+ asset_content_type: application/zip
diff --git a/.gitignore b/.gitignore
index 9b99f73835d..4906d0e7c9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,9 +10,10 @@ project.properties
*.sublime-project
*.sublime-workspace
.sublimelinterrc
+*.swp
# Grunt
-/node_modules/
+node_modules/
none
# Sass
@@ -42,8 +43,12 @@ tests/cli/vendor
# Unit tests
/tmp
/tests/bin/tmp
-/tests/e2e-tests/config/local-*.json
-/tests/e2e-tests/config/local.json
+/tests/e2e/config/local-*.json
+/tests/e2e/config/local.json
+/tests/e2e/docker
+/tests/e2e/env/docker/wp-cli/initialize.sh
+/tests/e2e/env/build/
+/tests/e2e/env/build-module/
# Logs
/logs
@@ -51,6 +56,7 @@ tests/cli/vendor
# Composer
/vendor/
contributors.md
+contributors.html
# Packages
/packages/*
@@ -61,3 +67,6 @@ contributors.md
# Language files
i18n/languages/woocommerce.pot
+
+# Build
+build/
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 07172a9bfb1..00000000000
--- a/.jshintrc
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "boss": true,
- "curly": true,
- "eqeqeq": true,
- "eqnull": true,
- "es3": true,
- "expr": true,
- "immed": true,
- "noarg": true,
- "onevar": true,
- "quotmark": "single",
- "trailing": true,
- "undef": true,
- "unused": true,
- "multistr": true,
-
- "browser": true,
-
- "globals": {
- "_": false,
- "Backbone": false,
- "jQuery": false,
- "JSON": false,
- "wp": false
- }
-}
diff --git a/.travis.yml b/.travis.yml
index 4efa981ff5d..c8bca1a3bb9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,18 @@
+version: ~> 1.0
+
language: php
dist: xenial
+cache:
+ directories:
+ - vendor
+ - $HOME/.composer/cache
+
# Since Xenial services are not started by default, we need to instruct it below to start.
services:
- xvfb
- mysql
- docker
- - docker-compose
-
-sudo: false
-
-cache:
- directories:
- - vendor
- - $HOME/.composer/cache
# Test main supported versions of PHP against latest WP.
php:
@@ -28,39 +27,39 @@ env:
# Additional tests against stable PHP (min version is 7.0)
# and code coverage report.
-matrix:
+jobs:
fast_finish: true
include:
- - name: "Coding standard check"
- php: 7.4
- env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1
- - name: "E2E tests"
+ - name: "Core E2E Tests"
php: 7.4
+ env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1
script:
- composer require wp-cli/i18n-command
- npm run build
- - docker-compose up --build -d
- - bash tests/bin/run-e2e-CI.sh
+ - npm run build:packages
+ - npm install jest --global
+ - npm run docker:up
+ - npm run test:e2e
after_script:
- - docker-compose down -v
- - name: "Unit tests code coverage"
- php: 7.4
- env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
- - name: "WooCommerce unit tests using WordPress nightly"
+ - npm run docker:down
+ - name: "WP Nightly"
php: 7.4
env: WP_VERSION=nightly WP_MULTISITE=0
- - name: "WP latest - 1"
+ - name: "WP Latest"
+ php: 7.2
+ env: WP_VERSION=5.4 WP_MULTISITE=0
+ - name: "WP Latest - 1"
php: 7.2
env: WP_VERSION=5.3 WP_MULTISITE=0
- - name: "WP latest - 2"
+ - name: "WP Latest - 2"
php: 7.2
env: WP_VERSION=5.2 WP_MULTISITE=0
- - name: "WP 5.1"
- php: 7.2
- env: WP_VERSION=5.1 WP_MULTISITE=0
- - name: "WP 5.0"
- php: 7.0
- env: WP_VERSION=5.0 WP_MULTISITE=0
+ - name: "Code Standards"
+ php: 7.4
+ env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1
+ - name: "Code Coverage"
+ php: 7.4
+ env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
allow_failures:
- php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index a6b1ec8d479..0df226a570a 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,128 @@
== Changelog ==
+= 4.2.0 - 2020-06-02 =
+
+**WooCommerce**
+* Enhancement - Added Ghanaian regions to the state dropdown. #26273
+* Enhancement - Added Mozambique provinces to the state dropdown. #26162
+* Enhancement - Added support for the new group descriptions available on WordPress privacy exporters as of WP 5.3. #25575
+* Fix - Fixed false positives when checking if uploads directory is public. #26600
+* Fix - Introduced a new admin body class for supporting styling issues in WP 5.3+. #26251
+* Fix - Removed case conversion of meta keys from CSV imports. #25517
+* Fix - Allow schedule coupons via CRUD. #26387
+* Fix - Password visibility toggle when password strength check fails. #26132
+* Fix - Cross-sell placement when product has no description. #26334
+* Fix - Display of the rate limit warning during payment method creation. #26411
+* Fix - Made the shipping zone matching query's `zone_id` field more specific. #26308
+* Fix - Corrected the display of RTL languages on the WooCommerce.com addons page. #26080
+* Fix - Removed the postcode field for Ghana. #26272
+* Fix - Made the hiding of state fields more explicit for Germany, Denmark, and Sweden. #25598
+* Fix - Ensured that global attribute prefixes are passed to the `woocommerce_attribute_label` filter. #26022
+* Dev - Increased WordPress minimum version to 5.2 according to policy. #26550
+* Dev - Added the customer as a third argument to the `woocommerce_matched_rates` filter. #26361
+* Dev - Introduced `woocommerce_menu_order_count` filter. #26044
+* Dev - Introduced `should_send_ajax_request.adding_to_cart `cart event to allow short-circuiting cart addition. #25760
+* Dev - Made the jQuery selector for checkout form rows less specific. #25654
+* Dev - Changed the `{site_address}` placeholder to `{site_url}` for clarity. #25630
+* Dev - Deprecated `.wp-policy-help` and replaced with with the `.privacy-policy-tutorial` and `.wp-suggested-text` classes added in WP 5.1. #26072
+* Dev - Updated `automattic/jetpack-autoloader` to 1.7.0. #26559
+* Dev - Add a way to fetch basic object data. #26025
+
+**REST API 1.0.8**
+* Enhancement - Add support for trash status for products in V2 and V3 API. #184
+* Dev - Updated minimum PHP requirement to 7.0 to keep up with WooCommerce Core.
+* Dev - Fixed failing unit tests. #105
+
+**WooCommerce Admin 1.2.3**
+* Enhancement - Add onboarding payments note #4157
+* Enhancement - Marketing Inbox Note #4030
+* Performance - Use Route based code splitting to reduce bundle size #4094
+* Performance - trim down inbox note API request. #3977
+* Fix - Proper display of elements in wc-admin pages when in a RTL environment. #4051
+* Fix - Update UX when knowledge base articles fail to retrieve #4133
+* Fix - Updated messaging after last step in OBW. #4148
+* Fix - Reset profiler when visiting old OBW URL #4166.
+* Fix - Dashboard flash before OBW chunk loads #4259
+* Tweak - Enable the default homepage template to be filtered #4072
+* Tweak - Create admin note if Jetpack or WooCommerce Services plugin doesn't get installed due to an error during OBW #3888
+* Tweak - Update Email Marketing note. #4167
+* Tweak - Adjust "demo products" verbiage to "Sample Products" #4184
+* Tweak - Don't reschedule imports on failed imports #4263
+* Tweak - Remove obsolete inbox messages #4182
+* Tweak - Updates to WooCommerce Payments in Setup Checklist #4293
+* Dev - Make query selector for admin alerts more specific #4289
+* Dev - Guard against null themes in OBW #4244
+* Dev - Update wcadmin db version after db callback #4323
+* Dev - Only migrate options on version change #4324
+* Dev - Use `PAGE_ROOT` constant to reduce redundant strings #4238
+* Dev - Decouple Plugins DataStore from onboarding feature #4048
+* Dev - Move API out of Onboarding #4093
+* Dev - Add Profiler Step View Tracks #4141
+* Dev - Add React Testing Library #4221
+* Dev - Add List and Link components to Storybook #4219
+* Dev - Cast Shipping Total to float #4042
+* Dev - Dynamic Currency with Context API #4027
+* Dev - Remove Duplicate array entry #4049
+
+= 4.1.1 - 2020-05-19 =
+
+* Enhancement - Added notice about public uploads directory. #26207
+* Tweak - Disallow directory listing in woocommerce_uploads when "Redirect only" it's the selected download method. #26399
+* Fix - Added correct handling of nonces to database update notice dismissal. #26500
+* Dev - Updated WooCommerce admin version to 1.1.3 and Action Scheduler to 3.1.6.
+* Dev - Add prop `isEnabled` and a function to dynamically enable tracks. #26493
+
+**WooCommerce Admin**
+* Tweak - Onboarding: Add Jetpack flow back to onboarding profiler. #4382
+* Fix - Respect tracking opt-in before new page load. #4368
+
+**ActionScheduler**
+* Fix - Shutdown deprecated notice changed to a warning when as_* functions called without data store initialization. #546
+
+= 4.1.0 - 2020-05-05 =
+
+**WooCommerce**
+* Enhancement - Update dependency woocommerce/woocommerce-admin to v1.1.0 #26057
+* Enhancement - Updated jetpack-autoloader to 1.6 and woocommerce-blocks to 2.5.16. #26099
+* Enhancement - Added option to ignore discounts from cart's total amount to enable free shipping. #24776
+* Enhancement - Changed show password icon color to a darker grey hue. #25625
+* Enhancement - Use new Setup Wizard for all users. #26016
+* Security - Fixed unescaped meta data while duplicating products. Reported by Slavco.
+* Tweak - Show notice for WP min version to WP 5.2. #26094
+* Tweak - Improve the string for untested WooCommerce extensions in the system status page to avoid confusion. #25904
+* Tweak - Updated KZT (₸) symbol. #25609
+* Tweak - Trim whitespaces and strip slashes from MaxMind License Key. #25466
+* Tweak - Updated "Help" tabs documentation. #25826
+* Tweak - Update serbian currency symbol to рсд from дин. #25885
+* Fix - Password visibility toggle to hide password again from text. #25627
+* Fix - Undefined property error when attempting to modify the coupon post meta. #25755
+* Fix - Remove some of the individual rounding logic to make sure we round at certain places only. #25800
+* Fix - Order totals calculation if the order contains taxable and non-taxable products and percentage coupons. #25092
+* Fix - Wording for cancelled order email. #25316
+* Fix - Removed guided tour videos link on setup wizard (since current link only redirects to the docs). #25823
+* Fix - Add RTL style to the onboarding wizard. #25835
+* Fix - Trigger change and set val to qty on the frontend so that it properly updates event handlers. #25903
+* Fix - Corrected the way percent coupons apply remainders across the order. #25943
+* Fix - Clarified the error messaging for WooCommerce.com package update failures. #26034
+* Fix - Enforce per user usage limit check for a coupon on guest users based on email. #26066
+* Fix - Remove elements with style=display:none explicitly to address a regression causing broken email html. #26075
+* Dev - Added woocommerce_can_restock_refunded_items filter. #25728
+* Dev - Added woocommerce_order_get_tax_location filter. #25727
+* Dev - Updated stock handling to prevent race conditions when orders come in at the same time. #25708
+* Dev - Updated /myaccount/form-login.php to use consistent kebab-case class names for woocommerce-form-row. #25668
+* Dev - Add filter woocommerce_product_upsells_products_heading to allow heading modification without having to override the template file. #25628
+* Dev - Added woocommerce_order_get_tax_location filter. #25727
+* Dev - Added the get_woocommerce_currency_symbols function to allow develops to get an array of all the currency symbol registered with WooCommerce. #25733
+* Dev - Changed string typed label_class to array in checkout fields.
+* Dev - Added "woocommerce_emogrifier" action before the content of the emails is "emogrified". #25801
+* Dev - Add Ability to Filter Event Props. #25851
+* Dev - Updated the unit test install script to support paths to MySQL sockets that contain spaces. #25923
+* Dev - Made the default test source folders support the system tmp folder. #25923
+* Dev - Add cart & checkout block/shortcode info to tracker data. #25932
+* Dev - Make WC_Product_Data_Store_CPT::update_product_stock operations atomic. #26039
+* Dev - Adds usage data for the of cart & checkout blocks (currently in development in WooCommmerce Blocks plugin) to the WC Tracker snapshot. #26084
+* Dev - Implement some additional tracks for coupons, orders, and products. #26085
+
= 4.0.1 - 2020-03-18 =
**WooCommerce**
diff --git a/Dockerfile b/Dockerfile
index ef53cc1b22a..538e25c9a70 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1 +1 @@
-FROM wordpress:5.4.0
+FROM wordpress:5.4.2
diff --git a/Gruntfile.js b/Gruntfile.js
index bb38d5151fc..d831b5da2b2 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,4 +1,3 @@
-/* jshint node:true */
module.exports = function( grunt ) {
'use strict';
var sass = require( 'node-sass' );
@@ -14,12 +13,9 @@ module.exports = function( grunt ) {
php: 'includes'
},
- // JavaScript linting with JSHint.
- jshint: {
- options: {
- jshintrc: '.jshintrc'
- },
- all: [
+ // JavaScript linting with ESLint.
+ eslint: {
+ src: [
'<%= dirs.js %>/admin/*.js',
'!<%= dirs.js %>/admin/*.min.js',
'<%= dirs.js %>/frontend/*.js',
@@ -192,62 +188,13 @@ module.exports = function( grunt ) {
},
js: {
files: [
+ 'GruntFile.js',
'<%= dirs.js %>/admin/*js',
'<%= dirs.js %>/frontend/*js',
'!<%= dirs.js %>/admin/*.min.js',
'!<%= dirs.js %>/frontend/*.min.js'
],
- tasks: ['jshint', 'uglify']
- }
- },
-
- // Exec shell commands.
- shell: {
- options: {
- stdout: true,
- stderr: true
- },
- e2e_test: {
- command: 'npm run --silent test:single tests/e2e-tests/' + grunt.option( 'file' )
- },
- e2e_tests: {
- command: 'npm run --silent test'
- },
- e2e_tests_grep: {
- command: 'npm run --silent test:grep "' + grunt.option( 'grep' ) + '"'
- },
- contributors: {
- command: [
- 'echo "Generating contributor list since <%= fromDate %>"',
- './node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce --fromDate <%= fromDate %>' +
- ' --authToken <%= authToken %> --cols 6 --sortBy contributions --format md --sortOrder desc' +
- ' --showlogin true --sha <%= sha %> --filter renovate-bot > contributors.md'
- ].join( '&&' )
- }
- },
-
- prompt: {
- contributors: {
- options: {
- questions: [
- {
- config: 'fromDate',
- type: 'input',
- message: 'What date (YYYY-MM-DD) should we get contributions since?'
- },
- {
- config: 'sha',
- type: 'input',
- message: 'What branch should we get contributors from?'
- },
- {
- config: 'authToken',
- type: 'input',
- message: '(optional) Provide a personal access token.' +
- ' This will allow 5000 requests per hour rather than 60 - use if nothing is generated.'
- }
- ]
- }
+ tasks: ['eslint','uglify']
}
},
@@ -286,19 +233,17 @@ module.exports = function( grunt ) {
// Load NPM tasks to be used here.
grunt.loadNpmTasks( 'grunt-sass' );
- grunt.loadNpmTasks( 'grunt-shell' );
grunt.loadNpmTasks( 'grunt-phpcs' );
grunt.loadNpmTasks( 'grunt-rtlcss' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-stylelint' );
- grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+ grunt.loadNpmTasks( 'gruntify-eslint' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
- grunt.loadNpmTasks( 'grunt-prompt' );
// Register tasks.
grunt.registerTask( 'default', [
@@ -307,7 +252,7 @@ module.exports = function( grunt ) {
]);
grunt.registerTask( 'js', [
- 'jshint',
+ 'eslint',
'uglify:admin',
'uglify:frontend'
]);
@@ -332,25 +277,8 @@ module.exports = function( grunt ) {
'css'
]);
- grunt.registerTask( 'contributors', [
- 'prompt:contributors',
- 'shell:contributors'
- ]);
-
// Only an alias to 'default' task.
grunt.registerTask( 'dev', [
'default'
]);
-
- grunt.registerTask( 'e2e-tests', [
- 'shell:e2e_tests'
- ]);
-
- grunt.registerTask( 'e2e-tests-grep', [
- 'shell:e2e_tests_grep'
- ]);
-
- grunt.registerTask( 'e2e-test', [
- 'shell:e2e_test'
- ]);
};
diff --git a/README.md b/README.md
index ae91337621f..91334b368fa 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Welcome to the WooCommerce repository on GitHub. Here you can browse the source,
If you are not a developer, please use the [WooCommerce plugin page](https://wordpress.org/plugins/woocommerce/) on WordPress.org.
## Documentation
-* [WooCommerce Documentation](https://docs.woocommerce.com/documentation/plugins/woocommerce/)
+* [WooCommerce Documentation](https://docs.woocommerce.com/)
* [WooCommerce Developer Documentation](https://github.com/woocommerce/woocommerce/wiki)
* [WooCommerce Code Reference](https://docs.woocommerce.com/wc-apidocs/)
* [WooCommerce REST API Docs](https://woocommerce.github.io/woocommerce-rest-api-docs/)
diff --git a/assets/css/activation.scss b/assets/css/activation.scss
index 1823bd69dce..30ad30bc07a 100644
--- a/assets/css/activation.scss
+++ b/assets/css/activation.scss
@@ -9,7 +9,10 @@
div.woocommerce-message {
overflow: hidden;
position: relative;
- border-left-color: #cc99c2 !important;
+
+ &.updated {
+ border-left-color: #cc99c2 !important;
+ }
}
p.woocommerce-actions,
diff --git a/assets/css/admin.scss b/assets/css/admin.scss
index 67ae21ee00f..4276487feb3 100644
--- a/assets/css/admin.scss
+++ b/assets/css/admin.scss
@@ -541,9 +541,12 @@
.woocommerce-message {
position: relative;
- border-left-color: #cc99c2 !important;
overflow: hidden;
+ &.updated {
+ border-left-color: #cc99c2 !important;
+ }
+
a.skip,
a.docs {
text-decoration: none !important;
@@ -637,7 +640,7 @@ mark.amount {
}
}
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.woocommerce-help-tip {
font-size: 1.2em;
@@ -2167,7 +2170,7 @@ ul.wc_coupon_list_block {
}
}
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.widefat {
@@ -4123,7 +4126,7 @@ img.help_tip {
}
}
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.woocommerce {
@@ -6694,7 +6697,7 @@ table.bar_chart {
min-width: 400px !important;
}
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.select2-results {
@@ -6831,7 +6834,7 @@ table.bar_chart {
@each $name, $color in $wp_admin_colors {
- &-#{$name}.branch-5-3 {
+ &-#{$name}.wc-wp-version-gte-53 {
.select2-dropdown {
border-color: $color;
diff --git a/assets/css/privacy.scss b/assets/css/privacy.scss
new file mode 100644
index 00000000000..4636aca879b
--- /dev/null
+++ b/assets/css/privacy.scss
@@ -0,0 +1,56 @@
+/**
+ * privacy.scss
+ * Styles applied to the Privacy Policy Guide to support WooCommerce content.
+ * Adds support for styling ul/ol elements.
+ */
+
+/**
+ * Styling begins
+ */
+
+// Support for indented bullet-lists.
+.policy-text ul {
+ list-style: disc;
+}
+
+.policy-text ol {
+ list-style: decimal;
+}
+
+.policy-text ul li,
+.policy-text ol li {
+ margin-left: 2em;
+}
+
+// Pre-5.4 support for italics.
+.branch-5-2 .policy-text ul,
+.branch-5-2 .policy-text ol,
+.branch-5-3 .policy-text ul,
+.branch-5-3 .policy-text ol {
+ font-style: italic;
+}
+
+// 5.4 support for white background and padding.
+.branch-5-4 .policy-text ul:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.branch-5-4 .policy-text ol:not(.privacy-policy-tutorial):not(.wp-policy-help) {
+ background-color: #fff;
+ margin: 0;
+ padding: 1em;
+}
+
+.branch-5-4 .hide-privacy-policy-tutorial ul:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.branch-5-4 .hide-privacy-policy-tutorial ol:not(.privacy-policy-tutorial):not(.wp-policy-help) {
+ margin: 1em 0;
+ padding: 0;
+}
+
+.policy-text p:not(.privacy-policy-tutorial):not(.wp-policy-help) + ul:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text p:not(.privacy-policy-tutorial):not(.wp-policy-help) + ol:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ul:not(.privacy-policy-tutorial):not(.wp-policy-help) + p:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ul:not(.privacy-policy-tutorial):not(.wp-policy-help) + ul:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ul:not(.privacy-policy-tutorial):not(.wp-policy-help) + ol:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ol:not(.privacy-policy-tutorial):not(.wp-policy-help) + p:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ol:not(.privacy-policy-tutorial):not(.wp-policy-help) + ul:not(.privacy-policy-tutorial):not(.wp-policy-help),
+.policy-text ol:not(.privacy-policy-tutorial):not(.wp-policy-help) + ol:not(.privacy-policy-tutorial):not(.wp-policy-help) {
+ padding-top: 0;
+}
diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss
index b7dce2f6d79..eab9fb5f2d2 100644
--- a/assets/css/twenty-twenty.scss
+++ b/assets/css/twenty-twenty.scss
@@ -170,6 +170,7 @@ a.button {
}
.wc-block-grid__products {
+
.wc-block-grid__product-onsale {
position: absolute;
top: 0;
@@ -296,6 +297,7 @@ a.button {
}
#site-content {
+
.post-inner {
padding-top: 0;
}
@@ -319,7 +321,7 @@ a.button {
/* Make thumbnails in the gallery affect parent's height and wrapping */
.flex-control-nav::after {
clear: both;
- content: '';
+ content: "";
display: table;
}
@@ -501,7 +503,7 @@ dl.variation,
.product_meta {
clear: both;
- font-size: .7em;
+ font-size: 0.7em;
padding-top: 0.5em;
margin-top: 3rem;
}
@@ -726,7 +728,7 @@ a.reset_variations {
margin: 4rem 0 2rem;
/* reset description tab width to full width */
- #tab-description{
+ #tab-description {
h2,
p {
@@ -836,7 +838,7 @@ a.reset_variations {
}
}
- .comment-form-rating{
+ .comment-form-rating {
label {
max-width: 58rem;
@@ -910,7 +912,7 @@ a.reset_variations {
}
.comment-form-author,
- .comment-form-email{
+ .comment-form-email {
float: none;
margin-left: auto;
}
@@ -924,6 +926,8 @@ a.reset_variations {
.related.products,
.up-sells {
+ clear: both;
+
ul.products {
display: flex;
justify-content: space-evenly;
@@ -1185,6 +1189,7 @@ a.reset_variations {
}
form {
+
h3 {
margin-top: 0;
}
@@ -1215,7 +1220,7 @@ a.reset_variations {
}
}
- table.account-orders-table:not( .has-background ) {
+ table.account-orders-table:not(.has-background) {
tbody {
@@ -1343,6 +1348,7 @@ a.reset_variations {
}
tbody {
+
tr {
border-top: 1px solid #eee;
}
@@ -1399,7 +1405,7 @@ a.reset_variations {
width: 100%;
}
- input[type='radio'].shipping_method {
+ input[type="radio"].shipping_method {
display: none;
& + label {
@@ -1713,9 +1719,9 @@ a.reset_variations {
}
tbody::after {
- content: '';
- display: block;
- height: 2rem;
+ content: "";
+ display: block;
+ height: 2rem;
}
.woocommerce-Price-amount {
@@ -1723,7 +1729,7 @@ a.reset_variations {
}
.cart-subtotal,
- .order-total{
+ .order-total {
border-top: 1px solid #ddd;
}
}
@@ -1774,6 +1780,7 @@ a.reset_variations {
}
.woocommerce-form-login {
+
p.form-row.form-row-first,
p.form-row.form-row-last {
float: none;
@@ -1836,7 +1843,7 @@ a.reset_variations {
.woocommerce-checkout-review-order-table {
- input[type='radio'].shipping_method {
+ input[type="radio"].shipping_method {
display: none;
& + label {
@@ -2134,13 +2141,15 @@ ul.wc-block-grid__products {
.wc-block-grid__product-rating {
.star-rating {
- font-size: 0.7em
+ font-size: 0.7em;
}
}
}
@media only screen and (max-width: 600px) {
+
.woocommerce {
+
.woocommerce-ordering {
float: left;
clear: both;
@@ -2265,7 +2274,7 @@ ul.wc-block-grid__products {
}
&::before {
- content: '';
+ content: "";
}
}
}
@@ -2385,8 +2394,8 @@ ul.wc-block-grid__products {
table.account-orders-table {
.button {
- padding-left: .5em;
- padding-right: .5em;
+ padding-left: 0.5em;
+ padding-right: 0.5em;
width: 100%;
margin: 2rem 0;
}
@@ -2427,6 +2436,7 @@ ul.wc-block-grid__products {
}
.wc-block-grid__products {
+
.wc-block-grid__product-onsale {
font-size: 1.5rem;
padding: 1rem;
@@ -2587,6 +2597,7 @@ ul.wc-block-grid__products {
}
.wc-block-grid__products {
+
.wc-block-grid__product-onsale {
font-size: 1.7rem;
padding: 1.5rem;
diff --git a/assets/css/wc-setup.scss b/assets/css/wc-setup.scss
index d6d26e38f32..ccb0f2691d1 100644
--- a/assets/css/wc-setup.scss
+++ b/assets/css/wc-setup.scss
@@ -1185,7 +1185,7 @@ h3.jetpack-reasons {
}
.branch-5-2,
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.location-input {
margin: 0;
@@ -1415,7 +1415,7 @@ p.jetpack-terms {
}
.branch-5-2,
-.branch-5-3 {
+.wc-wp-version-gte-53 {
.wc-wizard-service-setting-stripe_create_account,
.wc-wizard-service-setting-ppec_paypal_reroute_requests {
diff --git a/assets/js/admin/api-keys.js b/assets/js/admin/api-keys.js
index 760e883be27..4a5c0dd7ceb 100644
--- a/assets/js/admin/api-keys.js
+++ b/assets/js/admin/api-keys.js
@@ -142,7 +142,9 @@
$( '#key_permissions', self.el ).val( data.permissions );
}
} else {
- $( 'h2, h3', self.el ).first().append( '
' + response.data.message + '
' );
+ $( 'h2, h3', self.el )
+ .first()
+ .append( '' + response.data.message + '
' );
}
self.unblock();
diff --git a/assets/js/admin/backbone-modal.js b/assets/js/admin/backbone-modal.js
index 7aa02f8a90f..63cca56422a 100644
--- a/assets/js/admin/backbone-modal.js
+++ b/assets/js/admin/backbone-modal.js
@@ -130,7 +130,10 @@
var button = e.keyCode || e.which;
// Enter key
- if ( 13 === button && ! ( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) ) ) {
+ if (
+ 13 === button &&
+ ! ( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) )
+ ) {
this.addButton( e );
}
diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js
index 603ba14733f..3175beb5760 100644
--- a/assets/js/admin/meta-boxes-order.js
+++ b/assets/js/admin/meta-boxes-order.js
@@ -1,3 +1,4 @@
+// eslint-disable-next-line max-len
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order, wcSetClipboard, wcClearClipboard */
jQuery( function ( $ ) {
@@ -11,7 +12,12 @@ jQuery( function ( $ ) {
var wc_meta_boxes_order = {
states: null,
init: function() {
- if ( ! ( typeof woocommerce_admin_meta_boxes_order === 'undefined' || typeof woocommerce_admin_meta_boxes_order.countries === 'undefined' ) ) {
+ if (
+ ! (
+ typeof woocommerce_admin_meta_boxes_order === 'undefined' ||
+ typeof woocommerce_admin_meta_boxes_order.countries === 'undefined'
+ )
+ ) {
/* State/Country select boxes */
this.states = $.parseJSON( woocommerce_admin_meta_boxes_order.countries.replace( /"/g, '"' ) );
}
@@ -380,11 +386,19 @@ jQuery( function ( $ ) {
$( 'input.line_tax', $row ).each( function() {
var $line_total_tax = $( this );
var tax_id = $line_total_tax.data( 'tax_id' );
- var unit_total_tax = accounting.unformat( $line_total_tax.attr( 'data-total_tax' ), woocommerce_admin.mon_decimal_point ) / o_qty;
+ var unit_total_tax = accounting.unformat(
+ $line_total_tax.attr( 'data-total_tax' ),
+ woocommerce_admin.mon_decimal_point
+ ) / o_qty;
var $line_subtotal_tax = $( 'input.line_subtotal_tax[data-tax_id="' + tax_id + '"]', $row );
- var unit_subtotal_tax = accounting.unformat( $line_subtotal_tax.attr( 'data-subtotal_tax' ), woocommerce_admin.mon_decimal_point ) / o_qty;
+ var unit_subtotal_tax = accounting.unformat(
+ $line_subtotal_tax.attr( 'data-subtotal_tax' ),
+ woocommerce_admin.mon_decimal_point
+ ) / o_qty;
var round_at_subtotal = 'yes' === woocommerce_admin_meta_boxes.round_at_subtotal;
- var precision = woocommerce_admin_meta_boxes[ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' ];
+ var precision = woocommerce_admin_meta_boxes[
+ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals'
+ ];
if ( 0 < unit_total_tax ) {
$line_total_tax.val(
@@ -877,7 +891,10 @@ jQuery( function ( $ ) {
$( '.refund input.refund_line_total' ).each(function( index, item ) {
if ( $( item ).closest( 'tr' ).data( 'order_item_id' ) ) {
- line_item_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = accounting.unformat( item.value, woocommerce_admin.mon_decimal_point );
+ line_item_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = accounting.unformat(
+ item.value,
+ woocommerce_admin.mon_decimal_point
+ );
}
});
@@ -889,7 +906,10 @@ jQuery( function ( $ ) {
line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = {};
}
- line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ][ tax_id ] = accounting.unformat( item.value, woocommerce_admin.mon_decimal_point );
+ line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ][ tax_id ] = accounting.unformat(
+ item.value,
+ woocommerce_admin.mon_decimal_point
+ );
}
});
@@ -1018,11 +1038,16 @@ jQuery( function ( $ ) {
var $refund_line_total_tax = $( this );
var tax_id = $refund_line_total_tax.data( 'tax_id' );
var line_total_tax = $( 'input.line_tax[data-tax_id="' + tax_id + '"]', $row );
- var unit_total_tax = accounting.unformat( line_total_tax.data( 'total_tax' ), woocommerce_admin.mon_decimal_point ) / qty;
+ var unit_total_tax = accounting.unformat(
+ line_total_tax.data( 'total_tax' ),
+ woocommerce_admin.mon_decimal_point
+ ) / qty;
if ( 0 < unit_total_tax ) {
var round_at_subtotal = 'yes' === woocommerce_admin_meta_boxes.round_at_subtotal;
- var precision = woocommerce_admin_meta_boxes[ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' ];
+ var precision = woocommerce_admin_meta_boxes[
+ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals'
+ ];
$refund_line_total_tax.val(
parseFloat( accounting.formatNumber( unit_total_tax * refund_qty, precision, '' ) )
@@ -1059,8 +1084,17 @@ jQuery( function ( $ ) {
var index = $items.find('tr').length + 1;
var $row = '' +
'' +
- ' ' +
- '' +
+ ' ' +
+ '' +
' ' +
'× ' +
' ';
diff --git a/assets/js/admin/meta-boxes-product.js b/assets/js/admin/meta-boxes-product.js
index f21e2cc9ceb..efbae1dbf4d 100644
--- a/assets/js/admin/meta-boxes-product.js
+++ b/assets/js/admin/meta-boxes-product.js
@@ -476,7 +476,9 @@ jQuery( function( $ ) {
$( '.product_attributes .woocommerce_attribute' ).each( function( index, el ) {
if ( $( el ).css( 'display' ) !== 'none' && $( el ).is( '.taxonomy' ) ) {
- $( 'select.attribute_taxonomy' ).find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' ).prop( 'disabled', true );
+ $( 'select.attribute_taxonomy' )
+ .find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' )
+ .prop( 'disabled', true );
}
});
diff --git a/assets/js/admin/product-ordering.js b/assets/js/admin/product-ordering.js
index 9c2075eb5cd..c030871a48b 100644
--- a/assets/js/admin/product-ordering.js
+++ b/assets/js/admin/product-ordering.js
@@ -38,17 +38,24 @@ jQuery( function( $ ) {
var nextpostid = ui.item.next().find( '.check-column input' ).val();
// Show Spinner
- ui.item.find( '.check-column input' ).hide().after( ' ' );
+ ui.item
+ .find( '.check-column input' )
+ .hide()
+ .after( ' ' );
// Go do the sorting stuff via ajax
- $.post( ajaxurl, { action: 'woocommerce_product_ordering', id: postid, previd: prevpostid, nextid: nextpostid }, function( response ) {
- $.each( response, function( key, value ) {
- $( '#inline_' + key + ' .menu_order' ).html( value );
- });
- ui.item.find( '.check-column input' ).show().siblings( 'img' ).remove();
- $( 'table.widefat tbody th, table.widefat tbody td' ).css( 'cursor', 'move' );
- $( 'table.widefat tbody' ).sortable( 'enable' );
- });
+ $.post(
+ ajaxurl,
+ { action: 'woocommerce_product_ordering', id: postid, previd: prevpostid, nextid: nextpostid },
+ function( response ) {
+ $.each( response, function( key, value ) {
+ $( '#inline_' + key + ' .menu_order' ).html( value );
+ });
+ ui.item.find( '.check-column input' ).show().siblings( 'img' ).remove();
+ $( 'table.widefat tbody th, table.widefat tbody td' ).css( 'cursor', 'move' );
+ $( 'table.widefat tbody' ).sortable( 'enable' );
+ }
+ );
// fix cell colors
$( 'table.widefat tbody tr' ).each( function() {
diff --git a/assets/js/admin/quick-edit.js b/assets/js/admin/quick-edit.js
index 74f2f94c866..56bd651779d 100644
--- a/assets/js/admin/quick-edit.js
+++ b/assets/js/admin/quick-edit.js
@@ -45,6 +45,7 @@ jQuery(function( $ ) {
$( 'input[name="_stock"]', '.inline-edit-row' ).val( stock );
$( 'input[name="menu_order"]', '.inline-edit-row' ).val( menu_order );
+ // eslint-disable-next-line max-len
$( 'select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' );
$( 'select[name="_tax_status"] option[value="' + tax_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' );
diff --git a/assets/js/admin/reports.js b/assets/js/admin/reports.js
index 3173462e470..f419f16fc03 100644
--- a/assets/js/admin/reports.js
+++ b/assets/js/admin/reports.js
@@ -222,7 +222,13 @@ jQuery(function( $ ) {
csv_data += '"' + index + '",';
} else {
if ( groupby === 'day' ) {
- csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '-' + date.getUTCDate() + '",';
+ csv_data += '"' +
+ date.getUTCFullYear() +
+ '-' +
+ parseInt( date.getUTCMonth() + 1, 10 ) +
+ '-' +
+ date.getUTCDate() +
+ '",';
} else {
csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '",';
}
diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js
index 9d6793aa173..061c2bd1af7 100644
--- a/assets/js/admin/settings-views-html-settings-tax.js
+++ b/assets/js/admin/settings-views-html-settings-tax.js
@@ -165,7 +165,8 @@
minLength: 3
});
- // Postcode and city don't have `name` values by default. They're only created if the contents changes, to save on database queries (I think)
+ // Postcode and city don't have `name` values by default.
+ // They're only created if the contents changes, to save on database queries (I think)
this.$el.find( 'td.postcode input, td.city input' ).change( function() {
$( this ).attr( 'name', $( this ).data( 'name' ) );
});
@@ -232,7 +233,9 @@
reordered_rates = _.map( rates_to_reorder, function( rate ) {
rate.tax_rate_order++;
- changes[ rate.tax_rate_id ] = _.extend( changes[ rate.tax_rate_id ] || {}, { tax_rate_order : rate.tax_rate_order } );
+ changes[ rate.tax_rate_id ] = _.extend(
+ changes[ rate.tax_rate_id ] || {}, { tax_rate_order : rate.tax_rate_order }
+ );
return rate;
} );
} else {
diff --git a/assets/js/admin/term-ordering.js b/assets/js/admin/term-ordering.js
index 302f6854d6e..1a1a99d8d97 100644
--- a/assets/js/admin/term-ordering.js
+++ b/assets/js/admin/term-ordering.js
@@ -30,7 +30,13 @@ jQuery( function( $ ) {
};
$( document ).ajaxComplete( function( event, request, options ) {
- if ( request && 4 === request.readyState && 200 === request.status && options.data && ( 0 <= options.data.indexOf( '_inline_edit' ) || 0 <= options.data.indexOf( 'add-tag' ) ) ) {
+ if (
+ request &&
+ 4 === request.readyState &&
+ 200 === request.status &&
+ options.data &&
+ ( 0 <= options.data.indexOf( '_inline_edit' ) || 0 <= options.data.indexOf( 'add-tag' ) )
+ ) {
$.wc_add_missing_sort_handles();
$( document.body ).trigger( 'init_tooltips' );
}
@@ -80,25 +86,41 @@ jQuery( function( $ ) {
}
}
- // If previous and next not at same tree level, or next not at same tree level and the previous is the parent of the next, or just moved item beneath its own children
- if ( ( prevtermid === undefined && nexttermid === undefined ) || ( nexttermid === undefined && nexttermparent === prevtermid ) || ( nexttermid !== undefined && prevtermparent === termid ) ) {
+ // If previous and next not at same tree level, or next not at same tree level and
+ // the previous is the parent of the next, or just moved item beneath its own children.
+ if (
+ ( prevtermid === undefined && nexttermid === undefined ) ||
+ ( nexttermid === undefined && nexttermparent === prevtermid ) ||
+ ( nexttermid !== undefined && prevtermparent === termid )
+ ) {
$( table_selector ).sortable( 'cancel' );
return;
}
// Show Spinner
ui.item.find( '.check-column input' ).hide();
- ui.item.find( '.check-column' ).append( ' ' );
+ ui.item
+ .find( '.check-column' )
+ .append( ' ' );
- // Go do the sorting stuff via ajax
- $.post( ajaxurl, { action: 'woocommerce_term_ordering', id: termid, nextid: nexttermid, thetaxonomy: woocommerce_term_ordering_params.taxonomy }, function(response){
- if ( response === 'children' ) {
- window.location.reload();
- } else {
- ui.item.find( '.check-column input' ).show();
- ui.item.find( '.check-column' ).find( 'img' ).remove();
+ // Go do the sorting stuff via ajax.
+ $.post(
+ ajaxurl,
+ {
+ action: 'woocommerce_term_ordering',
+ id: termid,
+ nextid: nexttermid,
+ thetaxonomy: woocommerce_term_ordering_params.taxonomy
+ },
+ function(response) {
+ if ( response === 'children' ) {
+ window.location.reload();
+ } else {
+ ui.item.find( '.check-column input' ).show();
+ ui.item.find( '.check-column' ).find( 'img' ).remove();
+ }
}
- });
+ );
// Fix cell colors
$( 'table.widefat tbody tr' ).each( function() {
diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js
index 0af872bcd8a..7ba790ed5e6 100644
--- a/assets/js/admin/wc-product-import.js
+++ b/assets/js/admin/wc-product-import.js
@@ -58,7 +58,15 @@
$this.$form.find('.woocommerce-importer-progress').val( response.data.percentage );
if ( 'done' === response.data.position ) {
- window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 );
+ window.location = response.data.url +
+ '&products-imported=' +
+ parseInt( $this.imported, 10 ) +
+ '&products-failed=' +
+ parseInt( $this.failed, 10 ) +
+ '&products-updated=' +
+ parseInt( $this.updated, 10 ) +
+ '&products-skipped=' +
+ parseInt( $this.skipped, 10 );
} else {
$this.run_import();
}
diff --git a/assets/js/admin/wc-shipping-zone-methods.js b/assets/js/admin/wc-shipping-zone-methods.js
index 813b7ebda9a..17289866132 100644
--- a/assets/js/admin/wc-shipping-zone-methods.js
+++ b/assets/js/admin/wc-shipping-zone-methods.js
@@ -34,11 +34,16 @@
this.trigger( 'change:methods' );
},
save: function() {
- $.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes', {
- wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
- changes : this.changes,
- zone_id : data.zone_id
- }, this.onSaveResponse, 'json' );
+ $.post(
+ ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes',
+ {
+ wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
+ changes : this.changes,
+ zone_id : data.zone_id
+ },
+ this.onSaveResponse,
+ 'json'
+ );
},
onSaveResponse: function( response, textStatus ) {
if ( 'success' === textStatus ) {
@@ -46,7 +51,11 @@
if ( response.data.zone_id !== data.zone_id ) {
data.zone_id = response.data.zone_id;
if ( window.history.pushState ) {
- window.history.pushState({}, '', 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id );
+ window.history.pushState(
+ {},
+ '',
+ 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id
+ );
}
}
shippingMethod.set( 'methods', response.data.methods );
@@ -72,7 +81,12 @@
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
$save_button.on( 'click', { view: this }, this.onSubmit );
- $( document.body ).on( 'input change', '#zone_name, #zone_locations, #zone_postcodes', { view: this }, this.onUpdateZone );
+ $( document.body ).on(
+ 'input change',
+ '#zone_name, #zone_locations, #zone_postcodes',
+ { view: this },
+ this.onUpdateZone
+ );
$( document.body ).on( 'click', '.wc-shipping-zone-method-settings', { view: this }, this.onConfigureShippingMethod );
$( document.body ).on( 'click', '.wc-shipping-zone-add-method', { view: this }, this.onAddShippingMethod );
$( document.body ).on( 'wc_backbone_modal_response', this.onConfigureShippingMethodSubmitted );
@@ -128,9 +142,13 @@
// Populate $tbody with the current methods
$.each( methods, function( id, rowData ) {
if ( 'yes' === rowData.enabled ) {
- rowData.enabled_icon = '' + data.strings.yes + ' ';
+ rowData.enabled_icon = '' +
+ data.strings.yes +
+ ' ';
} else {
- rowData.enabled_icon = '' + data.strings.no + ' ';
+ rowData.enabled_icon = '' +
+ data.strings.no +
+ ' ';
}
view.$el.append( view.rowTemplate( rowData ) );
@@ -138,7 +156,9 @@
var $tr = view.$el.find( 'tr[data-id="' + rowData.instance_id + '"]');
if ( ! rowData.has_settings ) {
- $tr.find( '.wc-shipping-zone-method-title > a' ).replaceWith('' + $tr.find( '.wc-shipping-zone-method-title > a' ).text() + ' ' );
+ $tr
+ .find( '.wc-shipping-zone-method-title > a' )
+ .replaceWith('' + $tr.find( '.wc-shipping-zone-method-title > a' ).text() + ' ' );
var $del = $tr.find( '.wc-shipping-zone-method-delete' );
$tr.find( '.wc-shipping-zone-method-title .row-actions' ).empty().html($del);
}
@@ -241,7 +261,9 @@
if ( old_position !== new_position ) {
methods[ method.instance_id ].method_order = new_position;
changes.methods = changes.methods || { methods : {} };
- changes.methods[ method.instance_id ] = _.extend( changes.methods[ method.instance_id ] || {}, { method_order : new_position } );
+ changes.methods[ method.instance_id ] = _.extend(
+ changes.methods[ method.instance_id ] || {}, { method_order : new_position }
+ );
}
} );
@@ -281,30 +303,35 @@
shippingMethodView.block();
// Save method settings via ajax call
- $.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_settings', {
- wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
- instance_id : posted_data.instance_id,
- data : posted_data
- }, function( response, textStatus ) {
- if ( 'success' === textStatus && response.success ) {
- $( 'table.wc-shipping-zone-methods' ).parent().find( '#woocommerce_errors' ).remove();
+ $.post(
+ ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_settings',
+ {
+ wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
+ instance_id : posted_data.instance_id,
+ data : posted_data
+ },
+ function( response, textStatus ) {
+ if ( 'success' === textStatus && response.success ) {
+ $( 'table.wc-shipping-zone-methods' ).parent().find( '#woocommerce_errors' ).remove();
- // If there were errors, prepend the form.
- if ( response.data.errors.length > 0 ) {
- shippingMethodView.showErrors( response.data.errors );
- }
+ // If there were errors, prepend the form.
+ if ( response.data.errors.length > 0 ) {
+ shippingMethodView.showErrors( response.data.errors );
+ }
- // Method was saved. Re-render.
- if ( _.size( shippingMethodView.model.changes ) ) {
- shippingMethodView.model.save();
+ // Method was saved. Re-render.
+ if ( _.size( shippingMethodView.model.changes ) ) {
+ shippingMethodView.model.save();
+ } else {
+ shippingMethodView.model.onSaveResponse( response, textStatus );
+ }
} else {
- shippingMethodView.model.onSaveResponse( response, textStatus );
+ window.alert( data.strings.save_failed );
+ shippingMethodView.unblock();
}
- } else {
- window.alert( data.strings.save_failed );
- shippingMethodView.unblock();
- }
- }, 'json' );
+ },
+ 'json'
+ );
}
},
showErrors: function( errors ) {
@@ -343,7 +370,11 @@
if ( response.data.zone_id !== data.zone_id ) {
data.zone_id = response.data.zone_id;
if ( window.history.pushState ) {
- window.history.pushState({}, '', 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id );
+ window.history.pushState(
+ {},
+ '',
+ 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id
+ );
}
}
// Trigger save if there are changes, or just re-render
diff --git a/assets/js/admin/wc-shipping-zones.js b/assets/js/admin/wc-shipping-zones.js
index 79026f2d964..093170a1ca9 100644
--- a/assets/js/admin/wc-shipping-zones.js
+++ b/assets/js/admin/wc-shipping-zones.js
@@ -161,7 +161,9 @@
class_name = 'method_enabled';
}
- $method_list.append( '' + shipping_method.title + ' ' );
+ $method_list.append(
+ '' + shipping_method.title + ' '
+ );
} );
} else {
$method_list.append( '' + data.strings.no_shipping_methods_offered + ' ' );
diff --git a/assets/js/admin/woocommerce_admin.js b/assets/js/admin/woocommerce_admin.js
index 51351a52839..5070f3f5508 100644
--- a/assets/js/admin/woocommerce_admin.js
+++ b/assets/js/admin/woocommerce_admin.js
@@ -12,10 +12,22 @@
if ( 0 === $blankslate.length ) {
if ( woocommerce_admin.urls.export_products ) {
- $title_action.after('' + woocommerce_admin.strings.export_products + ' ');
+ $title_action.after(
+ '' +
+ woocommerce_admin.strings.export_products +
+ ' '
+ );
}
if ( woocommerce_admin.urls.import_products ) {
- $title_action.after( '' + woocommerce_admin.strings.import_products + ' ' );
+ $title_action.after(
+ '' +
+ woocommerce_admin.strings.import_products +
+ ' '
+ );
}
} else {
$title_action.hide();
@@ -60,70 +72,85 @@
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
})
- .on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
- var regex, decimalRegex,
- decimailPoint = woocommerce_admin.decimal_point;
+ .on(
+ 'change',
+ '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]',
+ function() {
+ var regex, decimalRegex,
+ decimailPoint = woocommerce_admin.decimal_point;
- if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
- decimailPoint = woocommerce_admin.mon_decimal_point;
+ if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
+ decimailPoint = woocommerce_admin.mon_decimal_point;
+ }
+
+ regex = new RegExp( '[^\-0-9\%\\' + decimailPoint + ']+', 'gi' );
+ decimalRegex = new RegExp( '\\' + decimailPoint + '+', 'gi' );
+
+ var value = $( this ).val();
+ var newvalue = value.replace( regex, '' ).replace( decimalRegex, decimailPoint );
+
+ if ( value !== newvalue ) {
+ $( this ).val( newvalue );
+ }
}
+ )
- regex = new RegExp( '[^\-0-9\%\\' + decimailPoint + ']+', 'gi' );
- decimalRegex = new RegExp( '\\' + decimailPoint + '+', 'gi' );
+ .on(
+ 'keyup',
+ // eslint-disable-next-line max-len
+ '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]',
+ function() {
+ var regex, error, decimalRegex;
+ var checkDecimalNumbers = false;
- var value = $( this ).val();
- var newvalue = value.replace( regex, '' ).replace( decimalRegex, decimailPoint );
+ if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
+ checkDecimalNumbers = true;
+ regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
+ decimalRegex = new RegExp( '[^\\' + woocommerce_admin.mon_decimal_point + ']', 'gi' );
+ error = 'i18n_mon_decimal_error';
+ } else if ( $( this ).is( '.wc_input_country_iso' ) ) {
+ regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
+ error = 'i18n_country_iso_error';
+ } else {
+ checkDecimalNumbers = true;
+ regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
+ decimalRegex = new RegExp( '[^\\' + woocommerce_admin.decimal_point + ']', 'gi' );
+ error = 'i18n_decimal_error';
+ }
- if ( value !== newvalue ) {
- $( this ).val( newvalue );
+ var value = $( this ).val();
+ var newvalue = value.replace( regex, '' );
+
+ // Check if newvalue have more than one decimal point.
+ if ( checkDecimalNumbers && 1 < newvalue.replace( decimalRegex, '' ).length ) {
+ newvalue = newvalue.replace( decimalRegex, '' );
+ }
+
+ if ( value !== newvalue ) {
+ $( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
+ } else {
+ $( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
+ }
}
- })
-
- .on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
- var regex, error, decimalRegex;
- var checkDecimalNumbers = false;
-
- if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
- checkDecimalNumbers = true;
- regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
- decimalRegex = new RegExp( '[^\\' + woocommerce_admin.mon_decimal_point + ']', 'gi' );
- error = 'i18n_mon_decimal_error';
- } else if ( $( this ).is( '.wc_input_country_iso' ) ) {
- regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
- error = 'i18n_country_iso_error';
- } else {
- checkDecimalNumbers = true;
- regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
- decimalRegex = new RegExp( '[^\\' + woocommerce_admin.decimal_point + ']', 'gi' );
- error = 'i18n_decimal_error';
- }
-
- var value = $( this ).val();
- var newvalue = value.replace( regex, '' );
-
- // Check if newvalue have more than one decimal point.
- if ( checkDecimalNumbers && 1 < newvalue.replace( decimalRegex, '' ).length ) {
- newvalue = newvalue.replace( decimalRegex, '' );
- }
-
- if ( value !== newvalue ) {
- $( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
- } else {
- $( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
- }
- })
+ )
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
var sale_price_field = $( this ), regular_price_field;
if ( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
- regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
+ regular_price_field = sale_price_field
+ .parents( '.variable_pricing' )
+ .find( '.wc_input_price[name^=variable_regular_price]' );
} else {
regular_price_field = $( '#_regular_price' );
}
- var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
- var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
+ var sale_price = parseFloat(
+ window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point )
+ );
+ var regular_price = parseFloat(
+ window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point )
+ );
if ( sale_price >= regular_price ) {
$( this ).val( '' );
@@ -134,13 +161,19 @@
var sale_price_field = $( this ), regular_price_field;
if ( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
- regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
+ regular_price_field = sale_price_field
+ .parents( '.variable_pricing' )
+ .find( '.wc_input_price[name^=variable_regular_price]' );
} else {
regular_price_field = $( '#_regular_price' );
}
- var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
- var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
+ var sale_price = parseFloat(
+ window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point )
+ );
+ var regular_price = parseFloat(
+ window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point )
+ );
if ( sale_price >= regular_price ) {
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18n_sale_less_than_regular_error' ] );
@@ -236,9 +269,13 @@
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
- $( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
+ $( 'tr', $this_table )
+ .slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() )
+ .addClass( 'current' );
} else {
- $( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
+ $( 'tr', $this_table )
+ .slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 )
+ .addClass( 'current' );
}
}
@@ -260,7 +297,8 @@
});
// Additional cost and Attribute term tables
- $( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
+ $( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' )
+ .addClass( 'alternate' );
// Show order items on orders page
$( document.body ).on( 'click', '.show_order_items', function() {
@@ -281,9 +319,15 @@
$( '.hide_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() {
if ( $( this ).is( ':checked' ) ) {
- $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
+ $( this )
+ .closest( 'fieldset, tr' )
+ .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
+ .hide();
} else {
- $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
+ $( this )
+ .closest( 'fieldset, tr' )
+ .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
+ .show();
}
}).change();
});
@@ -291,9 +335,15 @@
$( '.show_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() {
if ( $( this ).is( ':checked' ) ) {
- $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
+ $( this )
+ .closest( 'fieldset, tr' )
+ .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
+ .show();
} else {
- $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
+ $( this )
+ .closest( 'fieldset, tr' )
+ .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
+ .hide();
}
}).change();
});
diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js
index ffc851b544f..c7c603725ee 100644
--- a/assets/js/frontend/add-to-cart-variation.js
+++ b/assets/js/frontend/add-to-cart-variation.js
@@ -43,7 +43,7 @@
// Init after gallery.
setTimeout( function() {
$form.trigger( 'check_variations' );
- $form.trigger( 'wc_variation_form' );
+ $form.trigger( 'wc_variation_form', self );
self.loading = false;
}, 100 );
};
@@ -72,8 +72,14 @@
*/
VariationForm.prototype.onHide = function( event ) {
event.preventDefault();
- event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-is-unavailable' ).addClass( 'disabled wc-variation-selection-needed' );
- event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
+ event.data.variationForm.$form
+ .find( '.single_add_to_cart_button' )
+ .removeClass( 'wc-variation-is-unavailable' )
+ .addClass( 'disabled wc-variation-selection-needed' );
+ event.data.variationForm.$form
+ .find( '.woocommerce-variation-add-to-cart' )
+ .removeClass( 'woocommerce-variation-add-to-cart-enabled' )
+ .addClass( 'woocommerce-variation-add-to-cart-disabled' );
};
/**
@@ -82,11 +88,22 @@
VariationForm.prototype.onShow = function( event, variation, purchasable ) {
event.preventDefault();
if ( purchasable ) {
- event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' );
- event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-disabled' ).addClass( 'woocommerce-variation-add-to-cart-enabled' );
+ event.data.variationForm.$form
+ .find( '.single_add_to_cart_button' )
+ .removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' );
+ event.data.variationForm.$form
+ .find( '.woocommerce-variation-add-to-cart' )
+ .removeClass( 'woocommerce-variation-add-to-cart-disabled' )
+ .addClass( 'woocommerce-variation-add-to-cart-enabled' );
} else {
- event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-selection-needed' ).addClass( 'disabled wc-variation-is-unavailable' );
- event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
+ event.data.variationForm.$form
+ .find( '.single_add_to_cart_button' )
+ .removeClass( 'wc-variation-selection-needed' )
+ .addClass( 'disabled wc-variation-is-unavailable' );
+ event.data.variationForm.$form
+ .find( '.woocommerce-variation-add-to-cart' )
+ .removeClass( 'woocommerce-variation-add-to-cart-enabled' )
+ .addClass( 'woocommerce-variation-add-to-cart-disabled' );
}
// If present, the media element library needs initialized on the variation description.
@@ -123,8 +140,12 @@
VariationForm.prototype.onResetDisplayedVariation = function( event ) {
var form = event.data.variationForm;
form.$product.find( '.product_meta' ).find( '.sku' ).wc_reset_content();
- form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ).wc_reset_content();
- form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ).wc_reset_content();
+ form.$product
+ .find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' )
+ .wc_reset_content();
+ form.$product
+ .find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' )
+ .wc_reset_content();
form.$form.trigger( 'reset_image' );
form.$singleVariation.slideUp( 200 ).trigger( 'hide_variation' );
};
@@ -139,12 +160,12 @@
/**
* Looks for matching variations for current selected attributes.
*/
- VariationForm.prototype.onFindVariation = function( event ) {
+ VariationForm.prototype.onFindVariation = function( event, chosenAttributes ) {
var form = event.data.variationForm,
- attributes = form.getChosenAttributes(),
+ attributes = 'undefined' !== typeof chosenAttributes ? chosenAttributes : form.getChosenAttributes(),
currentAttributes = attributes.data;
- if ( attributes.count === attributes.chosenCount ) {
+ if ( attributes.count && attributes.count === attributes.chosenCount ) {
if ( form.useAjax ) {
if ( form.xhr ) {
form.xhr.abort();
@@ -164,7 +185,13 @@
attributes.chosenCount = 0;
if ( ! form.loading ) {
- form.$form.find( '.single_variation' ).after( '' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '
' );
+ form.$form
+ .find( '.single_variation' )
+ .after(
+ '' +
+ wc_add_to_cart_variation_params.i18n_no_matching_variations_text +
+ '
'
+ );
form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 );
}
}
@@ -186,7 +213,13 @@
attributes.chosenCount = 0;
if ( ! form.loading ) {
- form.$form.find( '.single_variation' ).after( '' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '
' );
+ form.$form
+ .find( '.single_variation' )
+ .after(
+ '' +
+ wc_add_to_cart_variation_params.i18n_no_matching_variations_text +
+ '
'
+ );
form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 );
}
}
@@ -206,8 +239,12 @@
VariationForm.prototype.onFoundVariation = function( event, variation ) {
var form = event.data.variationForm,
$sku = form.$product.find( '.product_meta' ).find( '.sku' ),
- $weight = form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ),
- $dimensions = form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ),
+ $weight = form.$product.find(
+ '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value'
+ ),
+ $dimensions = form.$product.find(
+ '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value'
+ ),
$qty = form.$singleVariationWrap.find( '.quantity' ),
purchasable = true,
variation_id = '',
@@ -333,7 +370,11 @@
refSelect.find( 'option' ).removeAttr( 'disabled attached' ).removeAttr( 'selected' );
- current_attr_select.data( 'attribute_options', refSelect.find( 'option' + option_gt_filter ).get() ); // Legacy data attribute.
+ // Legacy data attribute.
+ current_attr_select.data(
+ 'attribute_options',
+ refSelect.find( 'option' + option_gt_filter ).get()
+ );
current_attr_select.data( 'attribute_html', refSelect.html() );
}
@@ -597,7 +638,9 @@
$product_gallery = $product.find( '.images' ),
$gallery_nav = $product.find( '.flex-control-nav' ),
$gallery_img = $gallery_nav.find( 'li:eq(0) img' ),
- $product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
+ $product_img_wrap = $product_gallery
+ .find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' )
+ .eq( 0 ),
$product_img = $product_img_wrap.find( '.wp-post-image' ),
$product_link = $product_img_wrap.find( 'a' ).eq( 0 );
@@ -658,7 +701,9 @@
$product_gallery = $product.find( '.images' ),
$gallery_nav = $product.find( '.flex-control-nav' ),
$gallery_img = $gallery_nav.find( 'li:eq(0) img' ),
- $product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
+ $product_img_wrap = $product_gallery
+ .find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' )
+ .eq( 0 ),
$product_img = $product_img_wrap.find( '.wp-post-image' ),
$product_link = $product_img_wrap.find( 'a' ).eq( 0 );
diff --git a/assets/js/frontend/add-to-cart.js b/assets/js/frontend/add-to-cart.js
index 8d6666c96de..6fcee7b5a74 100644
--- a/assets/js/frontend/add-to-cart.js
+++ b/assets/js/frontend/add-to-cart.js
@@ -17,6 +17,7 @@ jQuery( function( $ ) {
.on( 'click', '.add_to_cart_button', { addToCartHandler: this }, this.onAddToCart )
.on( 'click', '.remove_from_cart_button', { addToCartHandler: this }, this.onRemoveFromCart )
.on( 'added_to_cart', this.updateButton )
+ .on( 'ajax_request_not_sent.adding_to_cart', this.updateButton )
.on( 'added_to_cart removed_from_cart', { addToCartHandler: this }, this.updateFragments );
};
@@ -69,6 +70,12 @@ jQuery( function( $ ) {
$thisbutton.removeClass( 'added' );
$thisbutton.addClass( 'loading' );
+ // Allow 3rd parties to validate and quit early.
+ if ( false === $( document.body ).triggerHandler( 'should_send_ajax_request.adding_to_cart', [ $thisbutton ] ) ) {
+ $( document.body ).trigger( 'ajax_request_not_sent.adding_to_cart', [ false, false, $thisbutton ] );
+ return true;
+ }
+
var data = {};
// Fetch changes that are directly added by calling $thisbutton.data( key, value )
@@ -159,10 +166,13 @@ jQuery( function( $ ) {
if ( $button ) {
$button.removeClass( 'loading' );
- $button.addClass( 'added' );
+
+ if ( fragments ) {
+ $button.addClass( 'added' );
+ }
// View cart text.
- if ( ! wc_add_to_cart_params.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
+ if ( fragments && ! wc_add_to_cart_params.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
$button.after( ' ' + wc_add_to_cart_params.i18n_view_cart + ' ' );
}
diff --git a/assets/js/frontend/cart.js b/assets/js/frontend/cart.js
index 816863ed454..622c8eb1437 100644
--- a/assets/js/frontend/cart.js
+++ b/assets/js/frontend/cart.js
@@ -105,7 +105,7 @@ jQuery( function( $ ) {
}
$( '.woocommerce-cart-form' ).replaceWith( $new_form );
- $( '.woocommerce-cart-form' ).find( ':input[name="update_cart"]' ).prop( 'disabled', true );
+ $( '.woocommerce-cart-form' ).find( ':input[name="update_cart"]' ).prop( 'disabled', true ).attr( 'aria-disabled', true );
if ( $notices.length > 0 ) {
show_notice( $notices );
@@ -134,7 +134,9 @@ jQuery( function( $ ) {
*/
var show_notice = function( html_element, $target ) {
if ( ! $target ) {
- $target = $( '.woocommerce-notices-wrapper:first' ) || $( '.cart-empty' ).closest( '.woocommerce' ) || $( '.woocommerce-cart-form' );
+ $target = $( '.woocommerce-notices-wrapper:first' ) ||
+ $( '.cart-empty' ).closest( '.woocommerce' ) ||
+ $( '.woocommerce-cart-form' );
}
$target.prepend( html_element );
};
@@ -188,6 +190,7 @@ jQuery( function( $ ) {
shipping_method_selected: function() {
var shipping_methods = {};
+ // eslint-disable-next-line max-len
$( 'select.shipping_method, :input[name^=shipping_method][type=radio]:checked, :input[name^=shipping_method][type=hidden]' ).each( function() {
shipping_methods[ $( this ).data( 'index' ) ] = $( this ).val();
} );
@@ -301,14 +304,14 @@ jQuery( function( $ ) {
'.woocommerce-cart-form .cart_item :input',
this.input_changed );
- $( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', true );
+ $( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', true ).attr( 'aria-disabled', true );
},
/**
* After an input is changed, enable the update cart button.
*/
input_changed: function() {
- $( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', false );
+ $( '.woocommerce-cart-form :input[name="update_cart"]' ).prop( 'disabled', false ).attr( 'aria-disabled', false );
},
/**
diff --git a/assets/js/frontend/country-select.js b/assets/js/frontend/country-select.js
index d0cbe57ba92..77b9655d214 100644
--- a/assets/js/frontend/country-select.js
+++ b/assets/js/frontend/country-select.js
@@ -93,7 +93,7 @@ jQuery( function( $ ) {
var country = $( this ).val(),
$statebox = $wrapper.find( '#billing_state, #shipping_state, #calc_shipping_state' ),
- $parent = $statebox.closest( 'p.form-row' ),
+ $parent = $statebox.closest( '.form-row' ),
input_name = $statebox.attr( 'name' ),
input_id = $statebox.attr('id'),
input_classes = $statebox.attr('data-input-classes'),
diff --git a/assets/js/frontend/single-product.js b/assets/js/frontend/single-product.js
index 30b3d6fd991..618791c6a47 100644
--- a/assets/js/frontend/single-product.js
+++ b/assets/js/frontend/single-product.js
@@ -9,7 +9,7 @@ jQuery( function( $ ) {
$( 'body' )
// Tabs
.on( 'init', '.wc-tabs-wrapper, .woocommerce-tabs', function() {
- $( '.wc-tab, .woocommerce-tabs .panel:not(.panel .panel)' ).hide();
+ $( this ).find( '.wc-tab, .woocommerce-tabs .panel:not(.panel .panel)' ).hide();
var hash = window.location.hash;
var url = window.location.href;
diff --git a/assets/js/frontend/tokenization-form.js b/assets/js/frontend/tokenization-form.js
index 15e9054b7c4..3a5a8bffbad 100644
--- a/assets/js/frontend/tokenization-form.js
+++ b/assets/js/frontend/tokenization-form.js
@@ -22,7 +22,12 @@ jQuery( function( $ ) {
this.hideSaveNewCheckbox = this.hideSaveNewCheckbox.bind( this );
// When a radio button is changed, make sure to show/hide our new CC info area.
- this.$target.on( 'click change', ':input.woocommerce-SavedPaymentMethods-tokenInput', { tokenizationForm: this }, this.onTokenChange );
+ this.$target.on(
+ 'click change',
+ ':input.woocommerce-SavedPaymentMethods-tokenInput',
+ { tokenizationForm: this },
+ this.onTokenChange
+ );
// OR if create account is checked.
$( 'input#createaccount' ).change( { tokenizationForm: this }, this.onCreateAccountChange );
diff --git a/assets/js/frontend/woocommerce.js b/assets/js/frontend/woocommerce.js
index 6c6047558cd..8c0414fff1b 100644
--- a/assets/js/frontend/woocommerce.js
+++ b/assets/js/frontend/woocommerce.js
@@ -81,15 +81,17 @@ jQuery( function( $ ) {
// Show password visiblity hover icon on woocommerce forms
$( '.woocommerce form .woocommerce-Input[type="password"]' ).wrap( ' ' );
+ // Add 'password-input' class to the password wrapper in checkout page.
+ $( '.woocommerce form input' ).filter(':password').parent('span').addClass('password-input');
$( '.password-input' ).append( ' ' );
$( '.show-password-input' ).click(
function() {
$( this ).toggleClass( 'display-password' );
if ( $( this ).hasClass( 'display-password' ) ) {
- $( this ).siblings( ['input[name^="password"]', 'input[type="password"]'] ).prop( 'type', 'text' );
+ $( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' );
} else {
- $( this ).siblings( 'input[name^="password"]' ).prop( 'type', 'password' );
+ $( this ).siblings( 'input[type="text"]' ).prop( 'type', 'password' );
}
}
);
diff --git a/assets/js/selectWoo/selectWoo.full.js b/assets/js/selectWoo/selectWoo.full.js
index 613204ba441..23548fce727 100644
--- a/assets/js/selectWoo/selectWoo.full.js
+++ b/assets/js/selectWoo/selectWoo.full.js
@@ -755,6 +755,12 @@ S2.define('select2/utils',[
});
};
+ Utils.entityDecode = function(html) {
+ var txt = document.createElement("textarea");
+ txt.innerHTML = html;
+ return txt.value;
+ }
+
// Append an array of jQuery nodes to a given element.
Utils.appendMany = function ($element, $nodes) {
// jQuery 1.7.x does not support $.fn.append() with an array
@@ -1611,9 +1617,9 @@ S2.define('select2/selection/single',[
var selection = data[0];
var $rendered = this.$selection.find('.select2-selection__rendered');
- var formatted = this.display(selection, $rendered);
+ var formatted = Utils.entityDecode(this.display(selection, $rendered));
- $rendered.empty().append(formatted);
+ $rendered.empty().text(formatted);
$rendered.prop('title', selection.title || selection.text);
};
@@ -1742,12 +1748,14 @@ S2.define('select2/selection/multiple',[
var selection = data[d];
var $selection = this.selectionContainer();
+ var removeItemTag = $selection.html();
var formatted = this.display(selection, $selection);
if ('string' === typeof formatted) {
- formatted = formatted.trim();
+ formatted = Utils.entityDecode(formatted.trim());
}
- $selection.append(formatted);
+ $selection.text(formatted);
+ $selection.prepend(removeItemTag);
$selection.prop('title', selection.title || selection.text);
$selection.data('data', selection);
@@ -1786,7 +1794,7 @@ S2.define('select2/selection/placeholder',[
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
var $placeholder = this.selectionContainer();
- $placeholder.html(this.display(placeholder));
+ $placeholder.text(Utils.entityDecode(this.display(placeholder)));
$placeholder.addClass('select2-selection__placeholder')
.removeClass('select2-selection__choice');
diff --git a/assets/js/selectWoo/selectWoo.full.min.js b/assets/js/selectWoo/selectWoo.full.min.js
index 4654399e175..11e22517352 100644
--- a/assets/js/selectWoo/selectWoo.full.min.js
+++ b/assets/js/selectWoo/selectWoo.full.min.js
@@ -5,7 +5,7 @@
* Released under the MIT license
* https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
*/
-!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(i){var e=function(){if(i&&i.fn&&i.fn.select2&&i.fn.select2.amd)var e=i.fn.select2.amd;var t,o,c,n;return e&&e.requirejs||(e?o=e:e={},function(h){var s,r,f,g,m={},v={},y={},w={},n=Object.prototype.hasOwnProperty,i=[].slice,_=/\.js$/;function $(e,t){return n.call(e,t)}function a(e,t){var n,i,o,s,r,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(r=(e=e.split("/")).length-1,y.nodeIdCompat&&_.test(e[r])&&(e[r]=e[r].replace(_,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},e.appendMany=function(e,t){if("1.7"===s.fn.jquery.substr(0,3)){var n=s();s.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},e.isTouchscreen=function(){return"undefined"==typeof e._isTouchscreenCache&&(e._isTouchscreenCache="ontouchstart"in document.documentElement),e._isTouchscreenCache},e}),e.define("select2/results",["jquery","./utils"],function(h,e){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return e.Extend(i,e.Observable),i.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{"class":"select2-results__options select2-results__options--nested",role:"listbox"});p.append(l),s.attr("role","list"),s.append(r),s.append(p)}else this.template(e,t);return h.data(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("data-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e);if(0!==n){var i=n-1;0===e.length&&(i=0);var o=t.eq(i);o.trigger("mouseenter");var s=l.$results.offset().top,r=o.offset().top,a=l.$results.scrollTop()+(r-s);0===i?l.$results.scrollTop(0):r-s<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var o=l.$results.offset().top+l.$results.outerHeight(!1),s=i.offset().top+i.outerHeight(!1),r=l.$results.scrollTop()+s-o;0===n?l.$results.scrollTop(0):othis.$results.outerHeight()||s<0)&&this.$results.scrollTop(o)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),o=n(e,t);null==o?t.style.display="none":"string"==typeof o?t.innerHTML=i(o):h(t).append(o)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(i,e,o){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=i(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),this.$selection=e},n.prototype.bind=function(e,t){var n=this,i=(e.id,e.id+"-results");this.options.get("minimumResultsForSearch"),Infinity;this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===o.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),window.setTimeout(function(){n.$selection.focus()},1),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||i.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},n.prototype._attachCloseHandler=function(e){i(document.body).on("mousedown.select2."+e.id,function(e){var t=i(e.target),n=t.closest(".select2");i(".select2.select2-container--open").each(function(){var e=i(this);this!=n[0]&&(e.data("element").select2("close"),setTimeout(function(){e.find("*:focus").blur(),t.focus()},1))})})},n.prototype._detachCloseHandler=function(e){i(document.body).off("mousedown.select2."+e.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function o(){o.__super__.constructor.apply(this,arguments)}return n.Extend(o,t),o.prototype.render=function(){var e=o.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.focus()}),t.on("selection:update",function(e){n.update(e.data)})},o.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return e(" ")},o.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n);n.empty().append(i),n.prop("title",t.title||t.text)}else this.clear()},o}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,a){function o(e,t){o.__super__.constructor.apply(this,arguments)}return a.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!n.options.get("disabled")){var t=i(this).parent().data("data");n.trigger("unselect",{originalEvent:e,data:t})}}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),t.on("focus",function(){n.focusOnSearch()})},o.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return i('× ')},o.prototype.focusOnSearch=function(){var e=this;"undefined"!=typeof e.$search&&setTimeout(function(){e._keyUpPrevented=!0,e.$search.focus()},1)},o.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×');n.data("data",t),this.$selection.find(".select2-selection__rendered").prepend(n)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,e,a){function t(e,t,n){e.call(this,t,n)}return t.prototype.render=function(e){var t=i(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},t.prototype.bind=function(e,i,t){var o=this,n=i.id+"-results";e.call(this,i,t),i.on("open",function(){o.$search.attr("aria-owns",n),o.$search.trigger("focus")}),i.on("close",function(){o.$search.val(""),o.$search.removeAttr("aria-activedescendant"),o.$search.removeAttr("aria-owns"),o.$search.trigger("focus")}),i.on("enable",function(){o.$search.prop("disabled",!1),o._transferTabIndex()}),i.on("disable",function(){o.$search.prop("disabled",!0)}),i.on("focus",function(e){o.$search.trigger("focus")}),i.on("results:focus",function(e){o.$search.attr("aria-activedescendant",e.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(e){o.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){o._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),o.trigger("keypress",e),o._keyUpPrevented=e.isDefaultPrevented(),e.which===a.BACKSPACE&&""===o.$search.val()){var t=o.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(n,i,o){var s=this;this.current(function(e){var t=null!=e?e.length:0;0=s.maximumSelectionLength?s.trigger("results:message",{message:"maximumSelected",args:{maximum:s.maximumSelectionLength}}):n.call(s,i,o)})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(s,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=s(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){s(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-owns",o),i.$search.focus(),window.setTimeout(function(){i.$search.focus()},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-activedescendant"),i.$search.removeAttr("aria-owns"),i.$search.val("")}),t.on("focus",function(){t.isOpen()||i.$search.focus()}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){i.$search.attr("aria-activedescendant",e.data._resultId)})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var o=t[i];this.placeholder.id===o.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(o){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",function(){var e=o.contains(document.documentElement,i.$loadingMore[0]);if(!i.loading&&e){var t=i.$results.offset().top+i.$results.outerHeight(!1);i.$loadingMore.offset().top+i.$loadingMore.outerHeight(!1)<=t+50&&i.loadMore()}})},e.prototype.loadMore=function(){this.loading=!0;var e=o.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=o(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=n.get("dropdownParent")||f(document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this,o=!1;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),o||(o=!0,t.on("results:all",function(){i._positionDropdown(),i._resizeDropdown()}),t.on("results:append",function(){i._positionDropdown(),i._resizeDropdown()}))}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,o="resize.select2."+t.id,s="orientationchange.select2."+t.id,r=this.$container.parents().filter(a.hasScroll);r.each(function(){f(this).data("select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),r.on(i,function(e){var t=f(this).data("select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+o+" "+s,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+o)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,o=this.$container.offset();o.bottom=o.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=o.top,s.bottom=o.top+s.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ao.bottom+r,d={left:o.left,top:s.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=s.top-h.top-r),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=Infinity),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function o(e){for(var t=0,n=0;n ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),e.data("element",this.$element),e},u}),e.define("select2/compat/utils",["jquery"],function(r){return{syncCssClasses:function a(e,t,n){var i,o,s=[];(i=r.trim(e.attr("class")))&&r((i=""+i).split(/\s+/)).each(function(){0===this.indexOf("select2-")&&s.push(this)}),(i=r.trim(t.attr("class")))&&r((i=""+i).split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(o=n(this))&&s.push(o)}),e.attr("class",s.join(" "))}}}),e.define("select2/compat/containerCss",["jquery","./utils"],function(r,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("containerCssClass")||"";r.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptContainerCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var o=i;i=function(e){var t=o(e);return null!=t?t+" "+e:e}}var s=this.options.get("containerCss")||{};return r.isFunction(s)&&(s=s(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(s),t.addClass(n),t},e}),e.define("select2/compat/dropdownCss",["jquery","./utils"],function(r,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";r.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptDropdownCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var o=i;i=function(e){var t=o(e);return null!=t?t+" "+e:e}}var s=this.options.get("dropdownCss")||{};return r.isFunction(s)&&(s=s(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(s),t.addClass(n),t},e}),e.define("select2/compat/initSelection",["jquery"],function(i){function e(e,t,n){n.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=n.get("initSelection"),this._isInitialized=!1,e.call(this,t,n)}return e.prototype.current=function(e,t){var n=this;this._isInitialized?e.call(this,t):this.initSelection.call(null,this.$element,function(e){n._isInitialized=!0,i.isArray(e)||(e=[e]),t(e)})},e}),e.define("select2/compat/inputData",["jquery"],function(r){function e(e,t,n){this._currentData=[],this._valueSeparator=n.get("valueSeparator")||",","hidden"===t.prop("type")&&n.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),e.call(this,t,n)}return e.prototype.current=function(e,t){function i(e,t){var n=[];return e.selected||-1!==r.inArray(e.id,t)?(e.selected=!0,n.push(e)):e.selected=!1,e.children&&n.push.apply(n,i(e.children,t)),n}for(var n=[],o=0;o":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},e.entityDecode=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},e.appendMany=function(e,t){if("1.7"===s.fn.jquery.substr(0,3)){var n=s();s.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},e.isTouchscreen=function(){return"undefined"==typeof e._isTouchscreenCache&&(e._isTouchscreenCache="ontouchstart"in document.documentElement),e._isTouchscreenCache},e}),e.define("select2/results",["jquery","./utils"],function(h,e){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return e.Extend(i,e.Observable),i.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{"class":"select2-results__options select2-results__options--nested",role:"listbox"});p.append(l),s.attr("role","list"),s.append(r),s.append(p)}else this.template(e,t);return h.data(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("data-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e);if(0!==n){var i=n-1;0===e.length&&(i=0);var o=t.eq(i);o.trigger("mouseenter");var s=l.$results.offset().top,r=o.offset().top,a=l.$results.scrollTop()+(r-s);0===i?l.$results.scrollTop(0):r-s<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var o=l.$results.offset().top+l.$results.outerHeight(!1),s=i.offset().top+i.outerHeight(!1),r=l.$results.scrollTop()+s-o;0===n?l.$results.scrollTop(0):othis.$results.outerHeight()||s<0)&&this.$results.scrollTop(o)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),o=n(e,t);null==o?t.style.display="none":"string"==typeof o?t.innerHTML=i(o):h(t).append(o)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(i,e,o){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=i(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),this.$selection=e},n.prototype.bind=function(e,t){var n=this,i=(e.id,e.id+"-results");this.options.get("minimumResultsForSearch"),Infinity;this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===o.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),window.setTimeout(function(){n.$selection.focus()},1),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||i.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},n.prototype._attachCloseHandler=function(e){i(document.body).on("mousedown.select2."+e.id,function(e){var t=i(e.target),n=t.closest(".select2");i(".select2.select2-container--open").each(function(){var e=i(this);this!=n[0]&&(e.data("element").select2("close"),setTimeout(function(){e.find("*:focus").blur(),t.focus()},1))})})},n.prototype._detachCloseHandler=function(e){i(document.body).off("mousedown.select2."+e.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,o,n){function s(){s.__super__.constructor.apply(this,arguments)}return o.Extend(s,t),s.prototype.render=function(){var e=s.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},s.prototype.bind=function(t,e){var n=this;s.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.focus()}),t.on("selection:update",function(e){n.update(e.data)})},s.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},s.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},s.prototype.selectionContainer=function(){return e(" ")},s.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=o.entityDecode(this.display(t,n));n.empty().text(i),n.prop("title",t.title||t.text)}else this.clear()},s}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function o(e,t){o.__super__.constructor.apply(this,arguments)}return l.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!n.options.get("disabled")){var t=i(this).parent().data("data");n.trigger("unselect",{originalEvent:e,data:t})}}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),t.on("focus",function(){n.focusOnSearch()})},o.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return i('× ')},o.prototype.focusOnSearch=function(){var e=this;"undefined"!=typeof e.$search&&setTimeout(function(){e._keyUpPrevented=!0,e.$search.focus()},1)},o.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×');n.data("data",t),this.$selection.find(".select2-selection__rendered").prepend(n)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,e,a){function t(e,t,n){e.call(this,t,n)}return t.prototype.render=function(e){var t=i(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},t.prototype.bind=function(e,i,t){var o=this,n=i.id+"-results";e.call(this,i,t),i.on("open",function(){o.$search.attr("aria-owns",n),o.$search.trigger("focus")}),i.on("close",function(){o.$search.val(""),o.$search.removeAttr("aria-activedescendant"),o.$search.removeAttr("aria-owns"),o.$search.trigger("focus")}),i.on("enable",function(){o.$search.prop("disabled",!1),o._transferTabIndex()}),i.on("disable",function(){o.$search.prop("disabled",!0)}),i.on("focus",function(e){o.$search.trigger("focus")}),i.on("results:focus",function(e){o.$search.attr("aria-activedescendant",e.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(e){o.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){o._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),o.trigger("keypress",e),o._keyUpPrevented=e.isDefaultPrevented(),e.which===a.BACKSPACE&&""===o.$search.val()){var t=o.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(n,i,o){var s=this;this.current(function(e){var t=null!=e?e.length:0;0=s.maximumSelectionLength?s.trigger("results:message",{message:"maximumSelected",args:{maximum:s.maximumSelectionLength}}):n.call(s,i,o)})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(s,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=s(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){s(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-owns",o),i.$search.focus(),window.setTimeout(function(){i.$search.focus()},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-activedescendant"),i.$search.removeAttr("aria-owns"),i.$search.val("")}),t.on("focus",function(){t.isOpen()||i.$search.focus()}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){i.$search.attr("aria-activedescendant",e.data._resultId)})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var o=t[i];this.placeholder.id===o.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(o){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",function(){var e=o.contains(document.documentElement,i.$loadingMore[0]);if(!i.loading&&e){var t=i.$results.offset().top+i.$results.outerHeight(!1);i.$loadingMore.offset().top+i.$loadingMore.outerHeight(!1)<=t+50&&i.loadMore()}})},e.prototype.loadMore=function(){this.loading=!0;var e=o.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=o(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=n.get("dropdownParent")||f(document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this,o=!1;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),o||(o=!0,t.on("results:all",function(){i._positionDropdown(),i._resizeDropdown()}),t.on("results:append",function(){i._positionDropdown(),i._resizeDropdown()}))}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,o="resize.select2."+t.id,s="orientationchange.select2."+t.id,r=this.$container.parents().filter(a.hasScroll);r.each(function(){f(this).data("select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),r.on(i,function(e){var t=f(this).data("select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+o+" "+s,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+o)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,o=this.$container.offset();o.bottom=o.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=o.top,s.bottom=o.top+s.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ao.bottom+r,d={left:o.left,top:s.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=s.top-h.top-r),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=Infinity),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function o(e){for(var t=0,n=0;n ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),e.data("element",this.$element),e},u}),e.define("select2/compat/utils",["jquery"],function(r){return{syncCssClasses:function a(e,t,n){var i,o,s=[];(i=r.trim(e.attr("class")))&&r((i=""+i).split(/\s+/)).each(function(){0===this.indexOf("select2-")&&s.push(this)}),(i=r.trim(t.attr("class")))&&r((i=""+i).split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(o=n(this))&&s.push(o)}),e.attr("class",s.join(" "))}}}),e.define("select2/compat/containerCss",["jquery","./utils"],function(r,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("containerCssClass")||"";r.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptContainerCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var o=i;i=function(e){var t=o(e);return null!=t?t+" "+e:e}}var s=this.options.get("containerCss")||{};return r.isFunction(s)&&(s=s(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(s),t.addClass(n),t},e}),e.define("select2/compat/dropdownCss",["jquery","./utils"],function(r,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";r.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptDropdownCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var o=i;i=function(e){var t=o(e);return null!=t?t+" "+e:e}}var s=this.options.get("dropdownCss")||{};return r.isFunction(s)&&(s=s(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(s),t.addClass(n),t},e}),e.define("select2/compat/initSelection",["jquery"],function(i){function e(e,t,n){n.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=n.get("initSelection"),this._isInitialized=!1,e.call(this,t,n)}return e.prototype.current=function(e,t){var n=this;this._isInitialized?e.call(this,t):this.initSelection.call(null,this.$element,function(e){n._isInitialized=!0,i.isArray(e)||(e=[e]),t(e)})},e}),e.define("select2/compat/inputData",["jquery"],function(r){function e(e,t,n){this._currentData=[],this._valueSeparator=n.get("valueSeparator")||",","hidden"===t.prop("type")&&n.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),e.call(this,t,n)}return e.prototype.current=function(e,t){function i(e,t){var n=[];return e.selected||-1!==r.inArray(e.id,t)?(e.selected=!0,n.push(e)):e.selected=!1,e.children&&n.push.apply(n,i(e.children,t)),n}for(var n=[],o=0;o":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},e.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},e.isTouchscreen=function(){return"undefined"==typeof e._isTouchscreenCache&&(e._isTouchscreenCache="ontouchstart"in document.documentElement),e._isTouchscreenCache},e}),e.define("select2/results",["jquery","./utils"],function(h,e){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return e.Extend(i,e.Observable),i.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{"class":"select2-results__options select2-results__options--nested",role:"listbox"});p.append(l),o.attr("role","list"),o.append(s),o.append(p)}else this.template(e,t);return h.data(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("data-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e);if(0!==n){var i=n-1;0===e.length&&(i=0);var r=t.eq(i);r.trigger("mouseenter");var o=l.$results.offset().top,s=r.offset().top,a=l.$results.scrollTop()+(s-o);0===i?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var r=l.$results.offset().top+l.$results.outerHeight(!1),o=i.offset().top+i.outerHeight(!1),s=l.$results.scrollTop()+o-r;0===n?l.$results.scrollTop(0):rthis.$results.outerHeight()||o<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),r=n(e,t);null==r?t.style.display="none":"string"==typeof r?t.innerHTML=i(r):h(t).append(r)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(i,e,r){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=i(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),this.$selection=e},n.prototype.bind=function(e,t){var n=this,i=(e.id,e.id+"-results");this.options.get("minimumResultsForSearch"),Infinity;this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),window.setTimeout(function(){n.$selection.focus()},1),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||i.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},n.prototype._attachCloseHandler=function(e){i(document.body).on("mousedown.select2."+e.id,function(e){var t=i(e.target),n=t.closest(".select2");i(".select2.select2-container--open").each(function(){var e=i(this);this!=n[0]&&(e.data("element").select2("close"),setTimeout(function(){e.find("*:focus").blur(),t.focus()},1))})})},n.prototype._detachCloseHandler=function(e){i(document.body).off("mousedown.select2."+e.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function r(){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},r.prototype.bind=function(t,e){var n=this;r.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.focus()}),t.on("selection:update",function(e){n.update(e.data)})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return e(" ")},r.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n);n.empty().append(i),n.prop("title",t.title||t.text)}else this.clear()},r}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,a){function r(e,t){r.__super__.constructor.apply(this,arguments)}return a.Extend(r,e),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},r.prototype.bind=function(t,e){var n=this;r.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!n.options.get("disabled")){var t=i(this).parent().data("data");n.trigger("unselect",{originalEvent:e,data:t})}}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),t.on("focus",function(){n.focusOnSearch()})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return i('× ')},r.prototype.focusOnSearch=function(){var e=this;"undefined"!=typeof e.$search&&setTimeout(function(){e._keyUpPrevented=!0,e.$search.focus()},1)},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×');n.data("data",t),this.$selection.find(".select2-selection__rendered").prepend(n)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,e,a){function t(e,t,n){e.call(this,t,n)}return t.prototype.render=function(e){var t=i(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},t.prototype.bind=function(e,i,t){var r=this,n=i.id+"-results";e.call(this,i,t),i.on("open",function(){r.$search.attr("aria-owns",n),r.$search.trigger("focus")}),i.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-activedescendant"),r.$search.removeAttr("aria-owns"),r.$search.trigger("focus")}),i.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),i.on("disable",function(){r.$search.prop("disabled",!0)}),i.on("focus",function(e){r.$search.trigger("focus")}),i.on("results:focus",function(e){r.$search.attr("aria-activedescendant",e.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===a.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(n,i,r){var o=this;this.current(function(e){var t=null!=e?e.length:0;0=o.maximumSelectionLength?o.trigger("results:message",{message:"maximumSelected",args:{maximum:o.maximumSelectionLength}}):n.call(o,i,r)})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-owns",r),i.$search.focus(),window.setTimeout(function(){i.$search.focus()},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-activedescendant"),i.$search.removeAttr("aria-owns"),i.$search.val("")}),t.on("focus",function(){t.isOpen()||i.$search.focus()}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){i.$search.attr("aria-activedescendant",e.data._resultId)})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var r=t[i];this.placeholder.id===r.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(r){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",function(){var e=r.contains(document.documentElement,i.$loadingMore[0]);if(!i.loading&&e){var t=i.$results.offset().top+i.$results.outerHeight(!1);i.$loadingMore.offset().top+i.$loadingMore.outerHeight(!1)<=t+50&&i.loadMore()}})},e.prototype.loadMore=function(){this.loading=!0;var e=r.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=r(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=n.get("dropdownParent")||f(document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this,r=!1;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),r||(r=!0,t.on("results:all",function(){i._positionDropdown(),i._resizeDropdown()}),t.on("results:append",function(){i._positionDropdown(),i._resizeDropdown()}))}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,r="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){f(this).data("select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(i,function(e){var t=f(this).data("select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+r+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,r="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+r)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,r=this.$container.offset();r.bottom=r.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=r.top,o.bottom=r.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ar.bottom+s,d={left:r.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=o.top-h.top-s),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=Infinity),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function r(e){for(var t=0,n=0;n ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),e.data("element",this.$element),e},u}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(r,e,o,t){if(null==r.fn.selectWoo){var s=["open","close","destroy"];r.fn.selectWoo=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=r.extend(!0,{},t);new o(r(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=r(this).data("select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},e.entityDecode=function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},e.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},e.isTouchscreen=function(){return"undefined"==typeof e._isTouchscreenCache&&(e._isTouchscreenCache="ontouchstart"in document.documentElement),e._isTouchscreenCache},e}),e.define("select2/results",["jquery","./utils"],function(h,e){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return e.Extend(i,e.Observable),i.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{"class":"select2-results__options select2-results__options--nested",role:"listbox"});p.append(l),o.attr("role","list"),o.append(s),o.append(p)}else this.template(e,t);return h.data(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("data-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e);if(0!==n){var i=n-1;0===e.length&&(i=0);var r=t.eq(i);r.trigger("mouseenter");var o=l.$results.offset().top,s=r.offset().top,a=l.$results.scrollTop()+(s-o);0===i?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[data-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var r=l.$results.offset().top+l.$results.outerHeight(!1),o=i.offset().top+i.outerHeight(!1),s=l.$results.scrollTop()+o-r;0===n?l.$results.scrollTop(0):rthis.$results.outerHeight()||o<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),r=n(e,t);null==r?t.style.display="none":"string"==typeof r?t.innerHTML=i(r):h(t).append(r)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(i,e,r){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=i(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),this.$selection=e},n.prototype.bind=function(e,t){var n=this,i=(e.id,e.id+"-results");this.options.get("minimumResultsForSearch"),Infinity;this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),window.setTimeout(function(){n.$selection.focus()},1),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||i.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},n.prototype._attachCloseHandler=function(e){i(document.body).on("mousedown.select2."+e.id,function(e){var t=i(e.target),n=t.closest(".select2");i(".select2.select2-container--open").each(function(){var e=i(this);this!=n[0]&&(e.data("element").select2("close"),setTimeout(function(){e.find("*:focus").blur(),t.focus()},1))})})},n.prototype._detachCloseHandler=function(e){i(document.body).off("mousedown.select2."+e.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,r,n){function o(){o.__super__.constructor.apply(this,arguments)}return r.Extend(o,t),o.prototype.render=function(){var e=o.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.focus()}),t.on("selection:update",function(e){n.update(e.data)})},o.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return e(" ")},o.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=r.entityDecode(this.display(t,n));n.empty().text(i),n.prop("title",t.title||t.text)}else this.clear()},o}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function r(e,t){r.__super__.constructor.apply(this,arguments)}return l.Extend(r,e),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},r.prototype.bind=function(t,e){var n=this;r.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!n.options.get("disabled")){var t=i(this).parent().data("data");n.trigger("unselect",{originalEvent:e,data:t})}}),this.$selection.on("keydown",function(e){!t.isOpen()&&48<=e.which&&e.which<=90&&t.open()}),t.on("focus",function(){n.focusOnSearch()})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return i('× ')},r.prototype.focusOnSearch=function(){var e=this;"undefined"!=typeof e.$search&&setTimeout(function(){e._keyUpPrevented=!0,e.$search.focus()},1)},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×');n.data("data",t),this.$selection.find(".select2-selection__rendered").prepend(n)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,e,a){function t(e,t,n){e.call(this,t,n)}return t.prototype.render=function(e){var t=i(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},t.prototype.bind=function(e,i,t){var r=this,n=i.id+"-results";e.call(this,i,t),i.on("open",function(){r.$search.attr("aria-owns",n),r.$search.trigger("focus")}),i.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-activedescendant"),r.$search.removeAttr("aria-owns"),r.$search.trigger("focus")}),i.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),i.on("disable",function(){r.$search.prop("disabled",!0)}),i.on("focus",function(e){r.$search.trigger("focus")}),i.on("results:focus",function(e){r.$search.attr("aria-activedescendant",e.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===a.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.query=function(n,i,r){var o=this;this.current(function(e){var t=null!=e?e.length:0;0=o.maximumSelectionLength?o.trigger("results:message",{message:"maximumSelected",args:{maximum:o.maximumSelectionLength}}):n.call(o,i,r)})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-owns",r),i.$search.focus(),window.setTimeout(function(){i.$search.focus()},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-activedescendant"),i.$search.removeAttr("aria-owns"),i.$search.val("")}),t.on("focus",function(){t.isOpen()||i.$search.focus()}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){i.$search.attr("aria-activedescendant",e.data._resultId)})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var r=t[i];this.placeholder.id===r.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(r){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",function(){var e=r.contains(document.documentElement,i.$loadingMore[0]);if(!i.loading&&e){var t=i.$results.offset().top+i.$results.outerHeight(!1);i.$loadingMore.offset().top+i.$loadingMore.outerHeight(!1)<=t+50&&i.loadMore()}})},e.prototype.loadMore=function(){this.loading=!0;var e=r.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=r(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=n.get("dropdownParent")||f(document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this,r=!1;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),r||(r=!0,t.on("results:all",function(){i._positionDropdown(),i._resizeDropdown()}),t.on("results:append",function(){i._positionDropdown(),i._resizeDropdown()}))}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,r="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){f(this).data("select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(i,function(e){var t=f(this).data("select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+r+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,r="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+r)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,r=this.$container.offset();r.bottom=r.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=r.top,o.bottom=r.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ar.bottom+s,d={left:r.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=o.top-h.top-s),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=Infinity),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function r(e){for(var t=0,n=0;n ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),e.data("element",this.$element),e},u}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(r,e,o,t){if(null==r.fn.selectWoo){var s=["open","close","destroy"];r.fn.selectWoo=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=r.extend(!0,{},t);new o(r(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=r(this).data("select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1WooCommerce core" > $output_file
+echo "Generating contributor list for WC core since $from_date"
+./node_modules/.bin/githubcontrib --repo woocommerce $common_arguments >> $output_file
+
+echo "WooCommerce Admin " >> $output_file
+echo "Generating contributor list for WC Admin since $from_date"
+./node_modules/.bin/githubcontrib --repo woocommerce-admin $common_arguments >> $output_file
+
+echo "WooCommerce Blocks " >> $output_file
+echo "Generating contributor list for WC Blocks since $from_date"
+./node_modules/.bin/githubcontrib --repo woocommerce-gutenberg-products-block $common_arguments >> $output_file
+
+echo "Action Scheduler " >> $output_file
+echo "Generating contributor list for Action Scheduler since $from_date"
+./node_modules/.bin/githubcontrib --repo action-scheduler $common_arguments >> $output_file
+
+echo "REST API " >> $output_file
+echo "Generating contributor list for REST API since $from_date"
+./node_modules/.bin/githubcontrib --repo woocommerce-rest-api $common_arguments >> $output_file
+
+echo "Output generated to $output_file."
diff --git a/bin/package-update.sh b/bin/package-update.sh
index 0a3cc1b6a95..f3bb1137f81 100755
--- a/bin/package-update.sh
+++ b/bin/package-update.sh
@@ -34,7 +34,8 @@ output 2 "Done!"
output 3 "Updating package JS textdomains..."
find ./packages/woocommerce-blocks -iname '*.js' -exec sed -i.bak -e "s/'woo-gutenberg-products-block'/'woocommerce'/g" -e "s/\"woo-gutenberg-products-block\"/'woocommerce'/g" {} \;
-find ./packages/woocommerce-admin -iname '*.js' -exec sed -i.bak -e "s/, 'woocommerce-admin'/, 'woocommerce'/g" {} \;
+find ./packages/woocommerce-blocks -iname '*.js' -exec sed -i.bak -e "s/'woocommerce-admin'/'woocommerce'/g" -e "s/\"woocommerce-admin\"/'woocommerce'/g" {} \;
+find ./packages/woocommerce-admin -iname '*.js' -exec sed -i.bak -e "s/'woocommerce-admin'/'woocommerce'/g" -e "s/\"woocommerce-admin\"/'woocommerce'/g" {} \;
# Cleanup backup files
find ./packages -name "*.bak" -type f -delete
diff --git a/bin/pre-push.sh b/bin/pre-push.sh
new file mode 100755
index 00000000000..4f4afd34923
--- /dev/null
+++ b/bin/pre-push.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+PROTECTED_BRANCH="master"
+REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3)
+
+if [ -n "$REMOTE_REF" ]; then
+ if [ -z "${REMOTE_REF##*$PROTECTED_BRANCH*}" ]; then
+ printf "%sYou're about to push to master, is that what you intended? [y/N]: %s" "$(tput setaf 3)" "$(tput sgr0)"
+ read -r PROCEED < /dev/tty
+ echo
+
+ if [ "$(echo "${PROCEED:-n}" | tr "[:upper:]" "[:lower:]")" = "y" ]; then
+ echo "$(tput setaf 2)Brace yourself! Pushing to the master branch...$(tput sgr0)"
+ echo
+ exit 0
+ fi
+
+ echo "$(tput setaf 2)Push to master cancelled!$(tput sgr0)"
+ echo
+ exit 1
+ fi
+fi
diff --git a/composer.json b/composer.json
index b204fe4c990..e2c31e99b5a 100644
--- a/composer.json
+++ b/composer.json
@@ -8,15 +8,15 @@
"minimum-stability": "dev",
"require": {
"php": ">=7.0",
- "automattic/jetpack-autoloader": "^1.6.0",
+ "automattic/jetpack-autoloader": "^1.7.0",
"automattic/jetpack-constants": "^1.1",
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
"pelago/emogrifier": "^3.1",
- "woocommerce/action-scheduler": "3.1.5",
- "woocommerce/woocommerce-blocks": "2.5.16",
- "woocommerce/woocommerce-rest-api": "1.0.7",
- "woocommerce/woocommerce-admin": "1.1.1"
+ "woocommerce/action-scheduler": "3.1.6",
+ "woocommerce/woocommerce-admin": "1.3.0-rc.1",
+ "woocommerce/woocommerce-blocks": "2.7.1",
+ "woocommerce/woocommerce-rest-api": "1.0.10"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
@@ -43,6 +43,12 @@
"Automattic\\WooCommerce\\": "src/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "Automattic\\WooCommerce\\Tests\\": "tests/php/src",
+ "Automattic\\WooCommerce\\Testing\\Tools\\": "tests/Tools"
+ }
+ },
"scripts": {
"post-install-cmd": [
"sh ./bin/package-update.sh"
@@ -63,7 +69,7 @@
"phpcbf -p"
],
"makepot-audit": [
- "wp i18n make-pot . --exclude=\".github,.wordpress-org,bin,sample-data,node_modules,tests\" --slug=woocommerce"
+ "wp --allow-root i18n make-pot . --exclude=\".github,.wordpress-org,bin,sample-data,node_modules,tests\" --slug=woocommerce"
],
"makepot": [
"@makepot-audit --skip-audit"
@@ -80,8 +86,8 @@
"test": "Run unit tests",
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier",
- "makepot-audit": "Generate i18n/langauges/woocommerce.pot file and run audit",
- "makepot": "Generate i18n/langauges/woocommerce.pot file"
+ "makepot-audit": "Generate i18n/languages/woocommerce.pot file and run audit",
+ "makepot": "Generate i18n/languages/woocommerce.pot file"
}
}
}
diff --git a/composer.lock b/composer.lock
index 8d09e371394..dec7ac99caf 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "4f587bb7d4020e7b4987cd1dde300e48",
+ "content-hash": "c35209de8f965f88aa5121e3ba76fc65",
"packages": [
{
"name": "automattic/jetpack-autoloader",
- "version": "v1.6.0",
+ "version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/Automattic/jetpack-autoloader.git",
- "reference": "3bcbe1ae19febd6beeb181cf11af0bf0b7abe7e7"
+ "reference": "7c6736eeee0f9fc49fa691fe3e958725efb27ca0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/3bcbe1ae19febd6beeb181cf11af0bf0b7abe7e7",
- "reference": "3bcbe1ae19febd6beeb181cf11af0bf0b7abe7e7",
+ "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/7c6736eeee0f9fc49fa691fe3e958725efb27ca0",
+ "reference": "7c6736eeee0f9fc49fa691fe3e958725efb27ca0",
"shasum": ""
},
"require": {
@@ -40,23 +40,24 @@
"GPL-2.0-or-later"
],
"description": "Creates a custom autoloader for a plugin or theme.",
- "time": "2020-03-26T07:57:53+00:00"
+ "time": "2020-04-23T02:28:37+00:00"
},
{
"name": "automattic/jetpack-constants",
- "version": "v1.1.3",
+ "version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/Automattic/jetpack-constants.git",
- "reference": "5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a"
+ "reference": "881618defb04134ddba120e7835af1a474a11edc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a",
- "reference": "5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a",
+ "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/881618defb04134ddba120e7835af1a474a11edc",
+ "reference": "881618defb04134ddba120e7835af1a474a11edc",
"shasum": ""
},
"require-dev": {
+ "php-mock/php-mock": "^2.1",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
},
"type": "library",
@@ -70,7 +71,7 @@
"GPL-2.0-or-later"
],
"description": "A wrapper for defining constants in a more testable way.",
- "time": "2019-11-08T21:16:05+00:00"
+ "time": "2020-04-15T18:58:53+00:00"
},
{
"name": "composer/installers",
@@ -330,7 +331,7 @@
},
{
"name": "symfony/css-selector",
- "version": "v3.4.39",
+ "version": "v3.4.42",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -379,34 +380,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
"time": "2020-03-16T08:31:04+00:00"
},
{
"name": "woocommerce/action-scheduler",
- "version": "3.1.5",
+ "version": "3.1.6",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/action-scheduler.git",
- "reference": "84e8ecba7d4f542f85fae7663e90eede1858b41b"
+ "reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/84e8ecba7d4f542f85fae7663e90eede1858b41b",
- "reference": "84e8ecba7d4f542f85fae7663e90eede1858b41b",
+ "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/275d0ba54b1c263dfc62688de2fa9a25a373edf8",
+ "reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8",
"shasum": ""
},
"require-dev": {
@@ -428,20 +415,20 @@
],
"description": "Action Scheduler for WordPress and WooCommerce",
"homepage": "https://actionscheduler.org/",
- "time": "2020-04-29T16:19:22+00:00"
+ "time": "2020-05-12T16:22:33+00:00"
},
{
"name": "woocommerce/woocommerce-admin",
- "version": "v1.1.1",
+ "version": "v1.3.0-rc.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
- "reference": "79e78bb8b71fa0c0b0a77efee5474b46d62c1a76"
+ "reference": "12bc8bf522298a099bb725990cd50bae944e667f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/79e78bb8b71fa0c0b0a77efee5474b46d62c1a76",
- "reference": "79e78bb8b71fa0c0b0a77efee5474b46d62c1a76",
+ "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/12bc8bf522298a099bb725990cd50bae944e667f",
+ "reference": "12bc8bf522298a099bb725990cd50bae944e667f",
"shasum": ""
},
"require": {
@@ -475,20 +462,20 @@
],
"description": "A modern, javascript-driven WooCommerce Admin experience.",
"homepage": "https://github.com/woocommerce/woocommerce-admin",
- "time": "2020-04-28T22:16:15+00:00"
+ "time": "2020-06-23T02:57:05+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
- "version": "v2.5.16",
+ "version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
- "reference": "3bd91b669247000fd3f5277954701d0b148d3f1a"
+ "reference": "0025c5cda83892c6f566fffd05197006f230d16c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/3bd91b669247000fd3f5277954701d0b148d3f1a",
- "reference": "3bd91b669247000fd3f5277954701d0b148d3f1a",
+ "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/0025c5cda83892c6f566fffd05197006f230d16c",
+ "reference": "0025c5cda83892c6f566fffd05197006f230d16c",
"shasum": ""
},
"require": {
@@ -522,20 +509,20 @@
"gutenberg",
"woocommerce"
],
- "time": "2020-04-07T11:47:19+00:00"
+ "time": "2020-06-16T13:34:29+00:00"
},
{
"name": "woocommerce/woocommerce-rest-api",
- "version": "1.0.7",
+ "version": "1.0.10",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-rest-api.git",
- "reference": "49162ec26a25bd0c6efc0f3452b113cdfff0a823"
+ "reference": "fdcb116b4f5b699b942c01b46fd863c7da8b4b7c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/49162ec26a25bd0c6efc0f3452b113cdfff0a823",
- "reference": "49162ec26a25bd0c6efc0f3452b113cdfff0a823",
+ "url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/fdcb116b4f5b699b942c01b46fd863c7da8b4b7c",
+ "reference": "fdcb116b4f5b699b942c01b46fd863c7da8b4b7c",
"shasum": ""
},
"require": {
@@ -562,7 +549,7 @@
],
"description": "The WooCommerce core REST API.",
"homepage": "https://github.com/woocommerce/woocommerce-rest-api",
- "time": "2020-01-28T21:04:51+00:00"
+ "time": "2020-06-16T09:51:51+00:00"
}
],
"packages-dev": [
@@ -634,20 +621,20 @@
},
{
"name": "doctrine/instantiator",
- "version": "1.3.0",
+ "version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
- "reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
+ "reference": "f350df0268e904597e3bd9c4685c53e0e333feea"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
- "reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea",
+ "reference": "f350df0268e904597e3bd9c4685c53e0e333feea",
"shasum": ""
},
"require": {
- "php": "^7.1"
+ "php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
@@ -686,7 +673,7 @@
"constructor",
"instantiate"
],
- "time": "2019-10-21T16:45:58+00:00"
+ "time": "2020-05-29T17:27:14+00:00"
},
{
"name": "gettext/gettext",
@@ -813,16 +800,16 @@
},
{
"name": "mck89/peast",
- "version": "v1.10.3",
+ "version": "v1.10.4",
"source": {
"type": "git",
"url": "https://github.com/mck89/peast.git",
- "reference": "6d1100f39f684c9e004f808b27f6c824b083d8d8"
+ "reference": "e11664ef53ba2a4ca1d16d8bc73fcc317cd65d3d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/mck89/peast/zipball/6d1100f39f684c9e004f808b27f6c824b083d8d8",
- "reference": "6d1100f39f684c9e004f808b27f6c824b083d8d8",
+ "url": "https://api.github.com/repos/mck89/peast/zipball/e11664ef53ba2a4ca1d16d8bc73fcc317cd65d3d",
+ "reference": "e11664ef53ba2a4ca1d16d8bc73fcc317cd65d3d",
"shasum": ""
},
"require": {
@@ -834,7 +821,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.10.3-dev"
+ "dev-master": "1.10.4-dev"
}
},
"autoload": {
@@ -854,7 +841,7 @@
}
],
"description": "Peast is PHP library that generates AST for JavaScript code",
- "time": "2020-04-03T09:06:20+00:00"
+ "time": "2020-06-21T17:16:08+00:00"
},
{
"name": "mustache/mustache",
@@ -1214,24 +1201,21 @@
},
{
"name": "phpdocumentor/reflection-common",
- "version": "2.0.0",
+ "version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
- "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
+ "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
- "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
+ "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
- "require-dev": {
- "phpunit/phpunit": "~6"
- },
"type": "library",
"extra": {
"branch-alias": {
@@ -1262,7 +1246,7 @@
"reflection",
"static analysis"
],
- "time": "2018-08-07T13:53:10+00:00"
+ "time": "2020-04-27T09:25:28+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
@@ -2430,7 +2414,7 @@
},
{
"name": "symfony/finder",
- "version": "v3.4.39",
+ "version": "v3.4.42",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@@ -2475,34 +2459,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
"time": "2020-02-14T07:34:21+00:00"
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.15.0",
+ "version": "v1.17.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
+ "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
- "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
+ "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
"shasum": ""
},
"require": {
@@ -2514,7 +2484,11 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.15-dev"
+ "dev-master": "1.17-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
@@ -2547,21 +2521,7 @@
"polyfill",
"portable"
],
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2020-02-27T09:26:54+00:00"
+ "time": "2020-06-06T08:46:27+00:00"
},
{
"name": "theseer/tokenizer",
@@ -2605,16 +2565,16 @@
},
{
"name": "webmozart/assert",
- "version": "1.8.0",
+ "version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
- "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
+ "reference": "9dc4f203e36f2b486149058bade43c851dd97451"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
- "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
+ "reference": "9dc4f203e36f2b486149058bade43c851dd97451",
"shasum": ""
},
"require": {
@@ -2622,6 +2582,7 @@
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
+ "phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
@@ -2649,7 +2610,7 @@
"check",
"validate"
],
- "time": "2020-04-18T12:12:48+00:00"
+ "time": "2020-06-16T10:16:42+00:00"
},
{
"name": "woocommerce/woocommerce-sniffs",
@@ -2693,16 +2654,16 @@
},
{
"name": "wp-cli/i18n-command",
- "version": "v2.2.2",
+ "version": "v2.2.3",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/i18n-command.git",
- "reference": "2804c5246d9338da59951737b03c54d257be8e47"
+ "reference": "7a5d483d872dfec1b89d88d348666ecd59454d52"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/2804c5246d9338da59951737b03c54d257be8e47",
- "reference": "2804c5246d9338da59951737b03c54d257be8e47",
+ "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/7a5d483d872dfec1b89d88d348666ecd59454d52",
+ "reference": "7a5d483d872dfec1b89d88d348666ecd59454d52",
"shasum": ""
},
"require": {
@@ -2746,7 +2707,7 @@
],
"description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command",
- "time": "2019-12-13T09:00:43+00:00"
+ "time": "2020-06-04T07:07:10+00:00"
},
{
"name": "wp-cli/mustangostang-spyc",
@@ -2965,6 +2926,5 @@
"platform-dev": [],
"platform-overrides": {
"php": "7.1"
- },
- "plugin-api-version": "1.1.0"
+ }
}
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 8d127416ccd..d0efa56e609 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -1,57 +1,14 @@
-version: '3.7'
+version: '3.3'
services:
- db:
- image: mariadb:10.5
- restart: on-failure
- environment:
- MYSQL_DATABASE: testdb
- MYSQL_USER: wordpress
- MYSQL_PASSWORD: wordpress
- MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
+ wordpress-www:
volumes:
- - db:/var/lib/mysql
-
- wordpress-woocommerce-dev:
- depends_on:
- - db
- build:
- context: .
- dockerfile: Dockerfile
- ports:
- - 8084:80
- restart: on-failure
- environment:
- WORDPRESS_DB_HOST: db
- WORDPRESS_DB_NAME: testdb
- WORDPRESS_DB_USER: wordpress
- WORDPRESS_DB_PASSWORD: wordpress
- WORDPRESS_TABLE_PREFIX: "wp_"
- WORDPRESS_DEBUG: 1
- volumes:
- - "./:/var/www/html/wp-content/plugins/woocommerce"
- - wordpress:/var/www/html
+ # This path is relative to the first config file
+ # which is in tests/e2e/env or node_modules/@woocommerce/e2e-environment
+ - "../../../:/var/www/html/wp-content/plugins/woocommerce"
wordpress-cli:
- depends_on:
- - db
- - wordpress-woocommerce-dev
- image: wordpress:cli
- restart: on-failure
- user: xfs
- command: >
- /bin/sh -c '
- wp core install --url=http://localhost:8084 --title="WooCommerce Core E2E Test Suite" --admin_user=admin --admin_password=password --admin_email=admin@woocommercecoree2etestsuite.com --path=/var/www/html --skip-email;
- wp plugin activate woocommerce;
- wp theme install twentynineteen --activate;
- wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=customer --path=/var/www/html;
- wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.';
- '
volumes:
- - "./:/var/www/html/wp-content/plugins/woocommerce"
- - wordpress:/var/www/html
+ - "../../../:/var/www/html/wp-content/plugins/woocommerce"
-volumes:
- db:
- wordpress:
diff --git a/i18n/states.php b/i18n/states.php
index 49aa9b6603a..9c2a5ff6876 100644
--- a/i18n/states.php
+++ b/i18n/states.php
@@ -349,6 +349,25 @@ return array(
),
'FI' => array(),
'FR' => array(),
+ 'GH' => array( // Ghanaian Regions.
+ 'AF' => __( 'Ahafo', 'woocommerce' ),
+ 'AH' => __( 'Ashanti', 'woocommerce' ),
+ 'BA' => __( 'Brong-Ahafo', 'woocommerce' ),
+ 'BO' => __( 'Bono', 'woocommerce' ),
+ 'BE' => __( 'Bono East', 'woocommerce' ),
+ 'CP' => __( 'Central', 'woocommerce' ),
+ 'EP' => __( 'Eastern', 'woocommerce' ),
+ 'AA' => __( 'Greater Accra', 'woocommerce' ),
+ 'NE' => __( 'North East', 'woocommerce' ),
+ 'NP' => __( 'Northern', 'woocommerce' ),
+ 'OT' => __( 'Oti', 'woocommerce' ),
+ 'SV' => __( 'Savannah', 'woocommerce' ),
+ 'UE' => __( 'Upper East', 'woocommerce' ),
+ 'UW' => __( 'Upper West', 'woocommerce' ),
+ 'TV' => __( 'Volta', 'woocommerce' ),
+ 'WP' => __( 'Western', 'woocommerce' ),
+ 'WN' => __( 'Western North', 'woocommerce' ),
+ ),
'GP' => array(),
'GR' => array( // Greek Regions.
'I' => __( 'Αττική', 'woocommerce' ),
@@ -696,6 +715,55 @@ return array(
'JP46' => __( 'Kagoshima', 'woocommerce' ),
'JP47' => __( 'Okinawa', 'woocommerce' ),
),
+ 'KE' => array( // Kenya counties.
+ 'KE01' => __( 'Baringo', 'woocommerce' ),
+ 'KE02' => __( 'Bomet', 'woocommerce' ),
+ 'KE03' => __( 'Bungoma', 'woocommerce' ),
+ 'KE04' => __( 'Busia', 'woocommerce' ),
+ 'KE05' => __( 'Elgeyo-Marakwet', 'woocommerce' ),
+ 'KE06' => __( 'Embu', 'woocommerce' ),
+ 'KE07' => __( 'Garissa', 'woocommerce' ),
+ 'KE08' => __( 'Homa Bay', 'woocommerce' ),
+ 'KE09' => __( 'Isiolo', 'woocommerce' ),
+ 'KE10' => __( 'Kajiado', 'woocommerce' ),
+ 'KE11' => __( 'Kakamega', 'woocommerce' ),
+ 'KE12' => __( 'Kericho', 'woocommerce' ),
+ 'KE13' => __( 'Kiambu', 'woocommerce' ),
+ 'KE14' => __( 'Kilifi', 'woocommerce' ),
+ 'KE15' => __( 'Kirinyaga', 'woocommerce' ),
+ 'KE16' => __( 'Kisii', 'woocommerce' ),
+ 'KE17' => __( 'Kisumu', 'woocommerce' ),
+ 'KE18' => __( 'Kitui', 'woocommerce' ),
+ 'KE19' => __( 'Kwale', 'woocommerce' ),
+ 'KE20' => __( 'Laikipia', 'woocommerce' ),
+ 'KE21' => __( 'Lamu', 'woocommerce' ),
+ 'KE22' => __( 'Machakos', 'woocommerce' ),
+ 'KE23' => __( 'Makueni', 'woocommerce' ),
+ 'KE24' => __( 'Mandera', 'woocommerce' ),
+ 'KE25' => __( 'Marsabit', 'woocommerce' ),
+ 'KE26' => __( 'Meru', 'woocommerce' ),
+ 'KE27' => __( 'Migori', 'woocommerce' ),
+ 'KE28' => __( 'Mombasa', 'woocommerce' ),
+ 'KE29' => __( 'Murang’a', 'woocommerce' ),
+ 'KE30' => __( 'Nairobi County', 'woocommerce' ),
+ 'KE31' => __( 'Nakuru', 'woocommerce' ),
+ 'KE32' => __( 'Nandi', 'woocommerce' ),
+ 'KE33' => __( 'Narok', 'woocommerce' ),
+ 'KE34' => __( 'Nyamira', 'woocommerce' ),
+ 'KE35' => __( 'Nyandarua', 'woocommerce' ),
+ 'KE36' => __( 'Nyeri', 'woocommerce' ),
+ 'KE37' => __( 'Samburu', 'woocommerce' ),
+ 'KE38' => __( 'Siaya', 'woocommerce' ),
+ 'KE39' => __( 'Taita-Taveta', 'woocommerce' ),
+ 'KE40' => __( 'Tana River', 'woocommerce' ),
+ 'KE41' => __( 'Tharaka-Nithi', 'woocommerce' ),
+ 'KE42' => __( 'Trans Nzoia', 'woocommerce' ),
+ 'KE43' => __( 'Turkana', 'woocommerce' ),
+ 'KE44' => __( 'Uasin Gishu', 'woocommerce' ),
+ 'KE45' => __( 'Vihiga', 'woocommerce' ),
+ 'KE46' => __( 'Wajir', 'woocommerce' ),
+ 'KE47' => __( 'West Pokot', 'woocommerce' ),
+ ),
'KR' => array(),
'KW' => array(),
'LA' => array(
@@ -828,6 +896,19 @@ return array(
'PJY' => __( 'Putrajaya', 'woocommerce' ),
'KUL' => __( 'Kuala Lumpur', 'woocommerce' ),
),
+ 'MZ' => array( // Mozambique provinces.
+ 'MZP' => __( 'Cabo Delgado', 'woocommerce' ),
+ 'MZG' => __( 'Gaza', 'woocommerce' ),
+ 'MZI' => __( 'Inhambane', 'woocommerce' ),
+ 'MZB' => __( 'Manica', 'woocommerce' ),
+ 'MZL' => __( 'Maputo Province', 'woocommerce' ),
+ 'MZMPM' => __( 'Maputo', 'woocommerce' ),
+ 'MZN' => __( 'Nampula', 'woocommerce' ),
+ 'MZA' => __( 'Niassa', 'woocommerce' ),
+ 'MZS' => __( 'Sofala', 'woocommerce' ),
+ 'MZT' => __( 'Tete', 'woocommerce' ),
+ 'MZQ' => __( 'Zambézia', 'woocommerce' ),
+ ),
'NG' => array( // Nigerian provinces.
'AB' => __( 'Abia', 'woocommerce' ),
'FC' => __( 'Abuja', 'woocommerce' ),
diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php
index 5e5f38f6d9f..9c0f2618f7e 100644
--- a/includes/abstracts/abstract-wc-order.php
+++ b/includes/abstracts/abstract-wc-order.php
@@ -437,12 +437,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @return float
*/
public function get_subtotal() {
- $subtotal = 0;
-
- foreach ( $this->get_items() as $item ) {
- $subtotal += wc_remove_number_precision( self::round_item_subtotal( wc_add_number_precision( $item->get_subtotal() ) ) );
- }
-
+ $subtotal = round( $this->get_cart_subtotal_for_order(), wc_get_price_decimals() );
return apply_filters( 'woocommerce_order_get_subtotal', (float) $subtotal, $this );
}
@@ -1672,18 +1667,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
public function calculate_totals( $and_taxes = true ) {
do_action( 'woocommerce_order_before_calculate_totals', $and_taxes, $this );
- $cart_subtotal = 0;
- $cart_total = 0;
$fees_total = 0;
$shipping_total = 0;
$cart_subtotal_tax = 0;
$cart_total_tax = 0;
- // Sum line item costs without rounding.
- foreach ( $this->get_items() as $item ) {
- $cart_subtotal += $item->get_subtotal();
- $cart_total += $item->get_total();
- }
+ $cart_subtotal = $this->get_cart_subtotal_for_order();
+ $cart_total = $this->get_cart_total_for_order();
// Sum shipping costs.
foreach ( $this->get_shipping_methods() as $shipping ) {
diff --git a/includes/abstracts/abstract-wc-settings-api.php b/includes/abstracts/abstract-wc-settings-api.php
index 6e844fb4939..4fd19ca7041 100644
--- a/includes/abstracts/abstract-wc-settings-api.php
+++ b/includes/abstracts/abstract-wc-settings-api.php
@@ -708,7 +708,7 @@ abstract class WC_Settings_API {
get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>>
$option_value ) : ?>
- get_option( $key ) ) ); ?>>
+ get_option( $key ) ) ); ?>>
get_description_html( $data ); // WPCS: XSS ok. ?>
@@ -761,11 +761,11 @@ abstract class WC_Settings_API {
$option_value_inner ) : ?>
- >
+ >
- >
+ >
diff --git a/includes/admin/class-wc-admin-addons.php b/includes/admin/class-wc-admin-addons.php
index 31e9adac3a3..42faab0fb19 100644
--- a/includes/admin/class-wc-admin-addons.php
+++ b/includes/admin/class-wc-admin-addons.php
@@ -51,13 +51,13 @@ class WC_Admin_Addons {
*/
public static function build_parameter_string( $category, $term, $country ) {
- $paramters = array(
+ $parameters = array(
'category' => $category,
'term' => $term,
'country' => $country,
);
- return '?' . http_build_query( $paramters );
+ return '?' . http_build_query( $parameters );
}
/**
diff --git a/includes/admin/class-wc-admin-assets.php b/includes/admin/class-wc-admin-assets.php
index 5bdd3e12685..df1b5de4f33 100644
--- a/includes/admin/class-wc-admin-assets.php
+++ b/includes/admin/class-wc-admin-assets.php
@@ -44,6 +44,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), $version );
wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), $version, 'print' );
wp_register_style( 'woocommerce_admin_marketplace_styles', WC()->plugin_url() . '/assets/css/marketplace-suggestions.css', array(), $version );
+ wp_register_style( 'woocommerce_admin_privacy_styles', WC()->plugin_url() . '/assets/css/privacy.css', array(), $version );
// Add RTL support for admin styles.
wp_style_add_data( 'woocommerce_admin_menu_styles', 'rtl', 'replace' );
@@ -51,6 +52,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
wp_style_add_data( 'woocommerce_admin_dashboard_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_print_reports_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_marketplace_styles', 'rtl', 'replace' );
+ wp_style_add_data( 'woocommerce_admin_privacy_styles', 'rtl', 'replace' );
// Sitewide menu CSS.
wp_enqueue_style( 'woocommerce_admin_menu_styles' );
@@ -70,6 +72,11 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
wp_enqueue_style( 'woocommerce_admin_print_reports_styles' );
}
+ // Privacy Policy Guide css for back-compat.
+ if ( isset( $_GET['wp-privacy-policy-guide'] ) || in_array( $screen_id, array( 'privacy-policy-guide' ) ) ) {
+ wp_enqueue_style( 'woocommerce_admin_privacy_styles' );
+ }
+
// @deprecated 2.3.
if ( has_action( 'woocommerce_admin_css' ) ) {
do_action( 'woocommerce_admin_css' );
diff --git a/includes/admin/class-wc-admin-dashboard.php b/includes/admin/class-wc-admin-dashboard.php
index 9b5ef4941b3..28d1c6b0fe2 100644
--- a/includes/admin/class-wc-admin-dashboard.php
+++ b/includes/admin/class-wc-admin-dashboard.php
@@ -216,36 +216,61 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
$lowinstock_count = get_transient( $transient_name );
if ( false === $lowinstock_count ) {
- $lowinstock_count = (int) $wpdb->get_var(
- $wpdb->prepare(
- "SELECT COUNT( product_id )
- FROM {$wpdb->wc_product_meta_lookup} AS lookup
- INNER JOIN {$wpdb->posts} as posts ON lookup.product_id = posts.ID
- WHERE stock_quantity <= %d
- AND stock_quantity > %d
- AND posts.post_status = 'publish'",
- $stock,
- $nostock
- )
- );
- set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 );
+ /**
+ * Status widget low in stock count pre query.
+ *
+ * @since 4.3.0
+ * @param null|string $low_in_stock_count Low in stock count, by default null.
+ * @param int $stock Low stock amount.
+ * @param int $nostock No stock amount
+ */
+ $lowinstock_count = apply_filters( 'woocommerce_status_widget_low_in_stock_count_pre_query', null, $stock, $nostock );
+
+ if ( is_null( $lowinstock_count ) ) {
+ $lowinstock_count = $wpdb->get_var(
+ $wpdb->prepare(
+ "SELECT COUNT( product_id )
+ FROM {$wpdb->wc_product_meta_lookup} AS lookup
+ INNER JOIN {$wpdb->posts} as posts ON lookup.product_id = posts.ID
+ WHERE stock_quantity <= %d
+ AND stock_quantity > %d
+ AND posts.post_status = 'publish'",
+ $stock,
+ $nostock
+ )
+ );
+ }
+
+ set_transient( $transient_name, (int) $lowinstock_count, DAY_IN_SECONDS * 30 );
}
$transient_name = 'wc_outofstock_count';
$outofstock_count = get_transient( $transient_name );
if ( false === $outofstock_count ) {
- $outofstock_count = (int) $wpdb->get_var(
- $wpdb->prepare(
- "SELECT COUNT( product_id )
- FROM {$wpdb->wc_product_meta_lookup} AS lookup
- INNER JOIN {$wpdb->posts} as posts ON lookup.product_id = posts.ID
- WHERE stock_quantity <= %d
- AND posts.post_status = 'publish'",
- $nostock
- )
- );
- set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 );
+ /**
+ * Status widget out of stock count pre query.
+ *
+ * @since 4.3.0
+ * @param null|string $outofstock_count Out of stock count, by default null.
+ * @param int $nostock No stock amount
+ */
+ $outofstock_count = apply_filters( 'woocommerce_status_widget_out_of_stock_count_pre_query', null, $nostock );
+
+ if ( is_null( $outofstock_count ) ) {
+ $outofstock_count = (int) $wpdb->get_var(
+ $wpdb->prepare(
+ "SELECT COUNT( product_id )
+ FROM {$wpdb->wc_product_meta_lookup} AS lookup
+ INNER JOIN {$wpdb->posts} as posts ON lookup.product_id = posts.ID
+ WHERE stock_quantity <= %d
+ AND posts.post_status = 'publish'",
+ $nostock
+ )
+ );
+ }
+
+ set_transient( $transient_name, (int) $outofstock_count, DAY_IN_SECONDS * 30 );
}
?>
diff --git a/includes/admin/class-wc-admin-menus.php b/includes/admin/class-wc-admin-menus.php
index 4443eba108a..3f1dd955b5e 100644
--- a/includes/admin/class-wc-admin-menus.php
+++ b/includes/admin/class-wc-admin-menus.php
@@ -184,7 +184,7 @@ class WC_Admin_Menus {
// Add count if user has access.
if ( apply_filters( 'woocommerce_include_processing_order_count_in_menu', true ) && current_user_can( 'edit_others_shop_orders' ) ) {
- $order_count = wc_processing_order_count();
+ $order_count = apply_filters( 'woocommerce_menu_order_count', wc_processing_order_count() );
if ( $order_count ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
diff --git a/includes/admin/class-wc-admin-meta-boxes.php b/includes/admin/class-wc-admin-meta-boxes.php
index dd50c90d3a5..32e03797591 100644
--- a/includes/admin/class-wc-admin-meta-boxes.php
+++ b/includes/admin/class-wc-admin-meta-boxes.php
@@ -49,9 +49,9 @@ class WC_Admin_Meta_Boxes {
* Save order data - also updates status and sends out admin emails if needed. Last to show latest data.
* Save actions - sends out other emails. Last to show latest data.
*/
- add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Items::save', 10, 2 );
+ add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Items::save', 10 );
add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Downloads::save', 30, 2 );
- add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40, 2 );
+ add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40 );
add_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Actions::save', 50, 2 );
// Save Product Meta Boxes.
diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php
index 59939424c8a..e6057d91c46 100644
--- a/includes/admin/class-wc-admin-notices.php
+++ b/includes/admin/class-wc-admin-notices.php
@@ -28,17 +28,19 @@ class WC_Admin_Notices {
* @var array
*/
private static $core_notices = array(
- 'install' => 'install_notice',
- 'update' => 'update_notice',
- 'template_files' => 'template_file_check_notice',
- 'legacy_shipping' => 'legacy_shipping_notice',
- 'no_shipping_methods' => 'no_shipping_methods_notice',
- 'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
- 'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
- 'no_secure_connection' => 'secure_connection_notice',
- WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice',
- 'maxmind_license_key' => 'maxmind_missing_license_key_notice',
- 'redirect_download_method' => 'redirect_download_method_notice',
+ 'install' => 'install_notice',
+ 'update' => 'update_notice',
+ 'template_files' => 'template_file_check_notice',
+ 'legacy_shipping' => 'legacy_shipping_notice',
+ 'no_shipping_methods' => 'no_shipping_methods_notice',
+ 'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
+ 'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
+ 'no_secure_connection' => 'secure_connection_notice',
+ WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice',
+ 'maxmind_license_key' => 'maxmind_missing_license_key_notice',
+ 'redirect_download_method' => 'redirect_download_method_notice',
+ 'uploads_directory_is_unprotected' => 'uploads_directory_is_unprotected_notice',
+ 'base_tables_missing' => 'base_tables_missing_notice',
);
/**
@@ -93,6 +95,9 @@ class WC_Admin_Notices {
if ( ! self::is_ssl() ) {
self::add_notice( 'no_secure_connection' );
}
+ if ( ! self::is_uploads_directory_protected() ) {
+ self::add_notice( 'uploads_directory_is_unprotected' );
+ }
self::add_notice( 'template_files' );
self::add_min_version_notice();
self::add_maxmind_missing_license_key_notice();
@@ -488,6 +493,35 @@ class WC_Admin_Notices {
include dirname( __FILE__ ) . '/views/html-notice-redirect-only-download.php';
}
+ /**
+ * Notice about uploads directory begin unprotected.
+ *
+ * @since 4.2.0
+ */
+ public static function uploads_directory_is_unprotected_notice() {
+ if ( get_user_meta( get_current_user_id(), 'dismissed_uploads_directory_is_unprotected_notice', true ) || self::is_uploads_directory_protected() ) {
+ self::remove_notice( 'uploads_directory_is_unprotected' );
+ return;
+ }
+
+ include dirname( __FILE__ ) . '/views/html-notice-uploads-directory-is-unprotected.php';
+ }
+
+ /**
+ * Notice about base tables missing.
+ */
+ public static function base_tables_missing_notice() {
+ $notice_dismissed = apply_filters(
+ 'woocommerce_hide_base_tables_missing_nag',
+ get_user_meta( get_current_user_id(), 'dismissed_base_tables_missing_notice', true )
+ );
+ if ( $notice_dismissed ) {
+ self::remove_notice( 'base_tables_missing' );
+ }
+
+ include dirname( __FILE__ ) . '/views/html-notice-base-table-missing.php';
+ }
+
/**
* Determine if the store is running SSL.
*
@@ -530,6 +564,42 @@ class WC_Admin_Notices {
public static function theme_check_notice() {
wc_deprecated_function( 'WC_Admin_Notices::theme_check_notice', '3.3.0' );
}
+
+ /**
+ * Check if uploads directory is protected.
+ *
+ * @since 4.2.0
+ * @return bool
+ */
+ protected static function is_uploads_directory_protected() {
+ $cache_key = '_woocommerce_upload_directory_status';
+ $status = get_transient( $cache_key );
+
+ // Check for cache.
+ if ( false !== $status ) {
+ return 'protected' === $status;
+ }
+
+ // Get only data from the uploads directory.
+ $uploads = wp_get_upload_dir();
+
+ // Check for the "uploads/woocommerce_uploads" directory.
+ $response = wp_safe_remote_get(
+ esc_url_raw( $uploads['baseurl'] . '/woocommerce_uploads/' ),
+ array(
+ 'redirection' => 0,
+ )
+ );
+ $response_code = intval( wp_remote_retrieve_response_code( $response ) );
+ $response_content = wp_remote_retrieve_body( $response );
+
+ // Check if returns 200 with empty content in case can open an index.html file,
+ // and check for non-200 codes in case the directory is protected.
+ $is_protected = ( 200 === $response_code && empty( $response_content ) ) || ( 200 !== $response_code );
+ set_transient( $cache_key, $is_protected ? 'protected' : 'unprotected', 1 * DAY_IN_SECONDS );
+
+ return $is_protected;
+ }
}
WC_Admin_Notices::init();
diff --git a/includes/admin/class-wc-admin-settings.php b/includes/admin/class-wc-admin-settings.php
index 837ffbc8230..1d1a49b8311 100644
--- a/includes/admin/class-wc-admin-settings.php
+++ b/includes/admin/class-wc-admin-settings.php
@@ -200,7 +200,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
/**
* Output admin fields.
*
- * Loops though the woocommerce options array and outputs each field.
+ * Loops through the woocommerce options array and outputs each field.
*
* @param array[] $options Opens array to output.
*/
@@ -726,7 +726,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
/**
* Save admin fields.
*
- * Loops though the woocommerce options array and outputs each field.
+ * Loops through the woocommerce options array and outputs each field.
*
* @param array $options Options array to output.
* @param array $data Optional. Data to use for saving. Defaults to $_POST.
@@ -869,25 +869,29 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
* If using force or x-sendfile, this ensures the .htaccess is in place.
*/
public static function check_download_folder_protection() {
- $upload_dir = wp_upload_dir();
- $downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
+ $upload_dir = wp_get_upload_dir();
+ $downloads_path = $upload_dir['basedir'] . '/woocommerce_uploads';
$download_method = get_option( 'woocommerce_file_download_method' );
+ $file_path = $downloads_path . '/.htaccess';
+ $file_content = 'redirect' === $download_method ? 'Options -Indexes' : 'deny from all';
+ $create = false;
- if ( 'redirect' === $download_method ) {
-
- // Redirect method - don't protect.
- if ( file_exists( $downloads_url . '/.htaccess' ) ) {
- unlink( $downloads_url . '/.htaccess' ); // @codingStandardsIgnoreLine
- }
+ if ( wp_mkdir_p( $downloads_path ) && ! file_exists( $file_path ) ) {
+ $create = true;
} else {
+ $current_content = @file_get_contents( $file_path ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
- // Force method - protect, add rules to the htaccess file.
- if ( ! file_exists( $downloads_url . '/.htaccess' ) ) {
- $file_handle = @fopen( $downloads_url . '/.htaccess', 'w' ); // @codingStandardsIgnoreLine
- if ( $file_handle ) {
- fwrite( $file_handle, 'deny from all' ); // @codingStandardsIgnoreLine
- fclose( $file_handle ); // @codingStandardsIgnoreLine
- }
+ if ( $current_content !== $file_content ) {
+ unlink( $file_path );
+ $create = true;
+ }
+ }
+
+ if ( $create ) {
+ $file_handle = @fopen( $file_path, 'wb' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
+ if ( $file_handle ) {
+ fwrite( $file_handle, $file_content ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
+ fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
}
}
}
diff --git a/includes/admin/class-wc-admin-status.php b/includes/admin/class-wc-admin-status.php
index be40b97270a..23e670ec8d7 100644
--- a/includes/admin/class-wc-admin-status.php
+++ b/includes/admin/class-wc-admin-status.php
@@ -339,6 +339,33 @@ class WC_Admin_Status {
}
}
+ /**
+ * Prints table info if a base table is not present.
+ */
+ private static function output_tables_info() {
+ $missing_tables = WC_Install::verify_base_tables( false );
+ if ( 0 === count( $missing_tables ) ) {
+ return;
+ }
+ ?>
+
+
+
+
+
+
+
+ 1 ? $version_parts[0] : $raw_version;
+
+ // Add WP 5.3+ compatibility class.
+ if ( $raw_version && version_compare( $version, '5.3', '>=' ) ) {
+ $classes .= ' wc-wp-version-gte-53';
+ }
+
+ return $classes;
+ }
}
return new WC_Admin();
diff --git a/includes/admin/helper/class-wc-helper-api.php b/includes/admin/helper/class-wc-helper-api.php
index d47b64395c9..e1baf489000 100644
--- a/includes/admin/helper/class-wc-helper-api.php
+++ b/includes/admin/helper/class-wc-helper-api.php
@@ -97,10 +97,11 @@ class WC_Helper_API {
$args['headers'] = array();
}
- $args['headers'] = array(
+ $headers = array(
'Authorization' => 'Bearer ' . $auth['access_token'],
'X-Woo-Signature' => $signature,
);
+ $args['headers'] = wp_parse_args( $headers, $args['headers'] );
$url = add_query_arg(
array(
@@ -139,6 +140,19 @@ class WC_Helper_API {
return self::request( $endpoint, $args );
}
+ /**
+ * Wrapper for self::request().
+ *
+ * @param string $endpoint The helper API endpoint to request.
+ * @param array $args Arguments passed to wp_remote_request().
+ *
+ * @return array The response object from wp_safe_remote_request().
+ */
+ public static function put( $endpoint, $args = array() ) {
+ $args['method'] = 'PUT';
+ return self::request( $endpoint, $args );
+ }
+
/**
* Using the API base, form a request URL from a given endpoint.
*
diff --git a/includes/admin/helper/class-wc-helper.php b/includes/admin/helper/class-wc-helper.php
index e131b8e52e5..40beb7e9493 100644
--- a/includes/admin/helper/class-wc-helper.php
+++ b/includes/admin/helper/class-wc-helper.php
@@ -471,6 +471,7 @@ class WC_Helper {
if ( $wc_screen_id . '_page_wc-addons' === $screen_id && isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) {
wp_enqueue_style( 'woocommerce-helper', WC()->plugin_url() . '/assets/css/helper.css', array(), Constants::get_constant( 'WC_VERSION' ) );
+ wp_style_add_data( 'woocommerce-helper', 'rtl', 'replace' );
}
}
@@ -1149,9 +1150,18 @@ class WC_Helper {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
- // Reset plugin cache before retrieving plugin list.
- wp_clean_plugins_cache();
- $plugins = get_plugins();
+ $plugins = get_plugins();
+
+ /**
+ * Check if plugins have WC headers, if not then clear cache and fetch again.
+ * WC Headers will not be present if `wc_enable_wc_plugin_headers` hook was added after a `get_plugins` call -- for example when WC is activated/updated.
+ * Also, get_plugins call is expensive so we should clear this cache very conservatively.
+ */
+ if ( ! empty( $plugins ) && ! array_key_exists( 'Woo', current( $plugins ) ) ) {
+ wp_clean_plugins_cache( false );
+ $plugins = get_plugins();
+ }
+
$woo_plugins = array();
// Backwards compatibility for woothemes_queue_update().
@@ -1469,8 +1479,6 @@ class WC_Helper {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
- self::_prompt_helper_connect( $screen_id );
-
if ( 'update-core' !== $screen_id ) {
return;
}
@@ -1487,56 +1495,6 @@ class WC_Helper {
}
}
- /**
- * Prompt a Helper connection if the user has WooCommerce.com extensions.
- *
- * @param string $screen_id Current screen ID.
- */
- private static function _prompt_helper_connect( $screen_id ) {
- if ( apply_filters( 'woocommerce_helper_suppress_connect_notice', false ) ) {
- return;
- }
-
- $screens = wc_get_screen_ids();
- $screens[] = 'plugins';
-
- if ( ! in_array( $screen_id, $screens, true ) ) {
- return;
- }
-
- // Don't show the notice on the Helper screens.
- $screen_addons = sanitize_title( __( 'WooCommerce', 'woocommerce' ) ) . '_page_wc-addons';
-
- if ( $screen_addons === $screen_id && ! empty( $_REQUEST['section'] ) && 'helper' === $_REQUEST['section'] ) {
- return;
- }
-
- // We believe we have an active connection.
- $auth = WC_Helper_Options::get( 'auth' );
- if ( ! empty( $auth['access_token'] ) ) {
- return;
- }
-
- $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
- if ( empty( $active_plugins ) ) {
- return;
- }
-
- $woo_plugins = self::get_local_woo_plugins();
- if ( empty( $woo_plugins ) ) {
- return;
- }
-
- $active_woo_plugins = array_intersect_key( $woo_plugins, array_flip( $active_plugins ) );
-
- if ( count( $active_woo_plugins ) > 0 ) {
- /* translators: %s: helper screen url */
- $notice = __( 'Connect your store to WooCommerce.com to receive extensions updates and support.', 'woocommerce' );
- $notice = sprintf( $notice, admin_url( 'admin.php?page=wc-addons§ion=helper' ) );
- echo '' . wp_kses_post( $notice ) . '
';
- }
- }
-
/**
* Get an update notice if one or more Woo extensions has an update available.
*
diff --git a/includes/admin/importers/class-wc-product-csv-importer-controller.php b/includes/admin/importers/class-wc-product-csv-importer-controller.php
index 22b70555917..5a87ec9ae50 100644
--- a/includes/admin/importers/class-wc-product-csv-importer-controller.php
+++ b/includes/admin/importers/class-wc-product-csv-importer-controller.php
@@ -319,6 +319,7 @@ class WC_Product_CSV_Importer_Controller {
return new WP_Error( 'woocommerce_product_csv_importer_upload_file_empty', __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.', 'woocommerce' ) );
}
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
if ( ! self::is_file_valid_csv( wc_clean( wp_unslash( $_FILES['import']['name'] ) ), false ) ) {
return new WP_Error( 'woocommerce_product_csv_importer_upload_file_invalid', __( 'Invalid file type. The importer supports CSV and TXT file formats.', 'woocommerce' ) );
}
@@ -327,7 +328,7 @@ class WC_Product_CSV_Importer_Controller {
'test_form' => false,
'mimes' => self::get_valid_csv_filetypes(),
);
- $import = $_FILES['import']; // WPCS: sanitization ok, input var ok.
+ $import = $_FILES['import']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.MissingUnslash
$upload = wp_handle_upload( $import, $overrides );
if ( isset( $upload['error'] ) ) {
@@ -577,14 +578,15 @@ class WC_Product_CSV_Importer_Controller {
$headers = array();
foreach ( $raw_headers as $key => $field ) {
- $field = strtolower( $field );
+ $normalized_field = strtolower( $field );
$index = $num_indexes ? $key : $field;
- $headers[ $index ] = $field;
+ $headers[ $index ] = $normalized_field;
- if ( isset( $default_columns[ $field ] ) ) {
- $headers[ $index ] = $default_columns[ $field ];
+ if ( isset( $default_columns[ $normalized_field ] ) ) {
+ $headers[ $index ] = $default_columns[ $normalized_field ];
} else {
foreach ( $special_columns as $regex => $special_key ) {
+ // Don't use the normalized field in the regex since meta might be case-sensitive.
if ( preg_match( $regex, $field, $matches ) ) {
$headers[ $index ] = $special_key . $matches[1];
break;
@@ -619,7 +621,7 @@ class WC_Product_CSV_Importer_Controller {
* @return string
*/
protected function sanitize_special_column_name_regex( $value ) {
- return '/' . str_replace( array( '%d', '%s' ), '(.*)', trim( quotemeta( $value ) ) ) . '/';
+ return '/' . str_replace( array( '%d', '%s' ), '(.*)', trim( quotemeta( $value ) ) ) . '/i';
}
/**
diff --git a/includes/admin/importers/views/html-product-csv-import-form.php b/includes/admin/importers/views/html-product-csv-import-form.php
index 0d925979476..f7e44815c11 100644
--- a/includes/admin/importers/views/html-product-csv-import-form.php
+++ b/includes/admin/importers/views/html-product-csv-import-form.php
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {