active-filters
2 years ago
add-to-cart-form
2 years ago
all-products
2 years ago
attribute-filter
2 years ago
base-components-mini-cart-contents-block
2 years ago
base-components-product-price~mini-cart-contents-block
2 years ago
breadcrumbs
2 years ago
cart-blocks
2 years ago
catalog-sorting
2 years ago
checkout
2 years ago
checkout-blocks
2 years ago
classic-shortcode
2 years ago
collection-active-filters
2 years ago
collection-attribute-filter
2 years ago
collection-filters
2 years ago
collection-price-filter
2 years ago
collection-rating-filter
2 years ago
collection-stock-filter
2 years ago
customer-account
2 years ago
featured-category
2 years ago
featured-product
2 years ago
filter-wrapper
2 years ago
handpicked-products
2 years ago
inner-blocks
2 years ago
mini-cart
2 years ago
mini-cart-contents-block
2 years ago
order-confirmation-additional-information
2 years ago
order-confirmation-billing-address
2 years ago
order-confirmation-billing-wrapper
2 years ago
order-confirmation-downloads
2 years ago
order-confirmation-downloads-wrapper
2 years ago
order-confirmation-shipping-address
2 years ago
order-confirmation-shipping-wrapper
2 years ago
order-confirmation-status
2 years ago
order-confirmation-summary
2 years ago
order-confirmation-totals
2 years ago
order-confirmation-totals-wrapper
2 years ago
page-content-wrapper
2 years ago
price-filter
2 years ago
product-average-rating
2 years ago
product-best-sellers
2 years ago
product-button
2 years ago
product-categories
2 years ago
product-category
2 years ago
product-collection
2 years ago
product-collection-no-results
2 years ago
product-details
2 years ago
product-gallery
2 years ago
product-gallery-large-image
2 years ago
product-gallery-large-image-next-previous
2 years ago
product-gallery-pager
2 years ago
product-gallery-thumbnails
2 years ago
product-image-gallery
2 years ago
product-meta
2 years ago
product-new
2 years ago
product-rating
2 years ago
product-rating-counter
2 years ago
product-rating-stars
2 years ago
product-results-count
2 years ago
product-reviews
2 years ago
product-tag
2 years ago
product-template
2 years ago
product-top-rated
2 years ago
products-by-attribute
2 years ago
rating-filter
2 years ago
related-products
2 years ago
single-product
2 years ago
stock-filter
2 years ago
store-notices
2 years ago
active-filters-frontend.asset.php
2 years ago
active-filters-frontend.js
2 years ago
active-filters-frontend.js.map
2 years ago
active-filters-rtl.css
2 years ago
active-filters-style.asset.php
2 years ago
active-filters-style.js.map
2 years ago
active-filters-wrapper-frontend.js
2 years ago
active-filters-wrapper-frontend.js.map
2 years ago
active-filters-wrapper-rtl.css
2 years ago
active-filters-wrapper-style.js.map
2 years ago
active-filters-wrapper.css
2 years ago
active-filters-wrapper.css.map
2 years ago
active-filters.asset.php
2 years ago
active-filters.css
2 years ago
active-filters.css.map
2 years ago
active-filters.js
2 years ago
active-filters.js.map
2 years ago
add-to-cart-form-rtl.css
2 years ago
add-to-cart-form-style.asset.php
2 years ago
add-to-cart-form-style.js.map
2 years ago
add-to-cart-form.css
2 years ago
add-to-cart-form.css.map
2 years ago
all-products-frontend.asset.php
2 years ago
all-products-frontend.js
2 years ago
all-products-frontend.js.map
2 years ago
all-products-rtl.css
2 years ago
all-products-style.asset.php
2 years ago
all-products-style.js.map
2 years ago
all-products.asset.php
2 years ago
all-products.css
2 years ago
all-products.css.map
2 years ago
all-products.js
2 years ago
all-products.js.map
2 years ago
all-reviews-rtl.css
2 years ago
all-reviews-style.asset.php
2 years ago
all-reviews-style.js.map
2 years ago
all-reviews.asset.php
2 years ago
all-reviews.css
2 years ago
all-reviews.css.map
2 years ago
all-reviews.js
2 years ago
all-reviews.js.map
2 years ago
assets_js_base_context_hooks_collections_use-collection_ts-assets_js_base_context_hooks_use-q-fdf7ba-style.js.map
2 years ago
assets_js_base_context_hooks_use-store-add-to-cart_ts-assets_js_base_context_hooks_use-store--e30f56-style.js.map
2 years ago
attribute-filter-frontend.asset.php
2 years ago
attribute-filter-frontend.js
2 years ago
attribute-filter-frontend.js.map
2 years ago
attribute-filter-rtl.css
2 years ago
attribute-filter-style.asset.php
2 years ago
attribute-filter-style.js.map
2 years ago
attribute-filter-wrapper-frontend.js
2 years ago
attribute-filter-wrapper-frontend.js.map
2 years ago
attribute-filter-wrapper-rtl.css
2 years ago
attribute-filter-wrapper-style.js.map
2 years ago
attribute-filter-wrapper.css
2 years ago
attribute-filter-wrapper.css.map
2 years ago
attribute-filter.asset.php
2 years ago
attribute-filter.css
2 years ago
attribute-filter.css.map
2 years ago
attribute-filter.js
2 years ago
attribute-filter.js.map
2 years ago
base-components-attribute-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-price-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-price-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-price-filter-wrapper-style.scss.css
2 years ago
base-components-price-filter-wrapper-style.scss.css.map
2 years ago
base-components-rating-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-rating-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-rating-filter-wrapper-style.scss.css
2 years ago
base-components-rating-filter-wrapper-style.scss.css.map
2 years ago
base-components-stock-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss.css
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss.css.map
2 years ago
base-context-product-add-to-cart-index.js-style.js.map
2 years ago
blocks-checkout.asset.php
2 years ago
blocks-checkout.js
2 years ago
blocks-checkout.js.map
2 years ago
blocks-components.asset.php
2 years ago
blocks-components.js
2 years ago
blocks-components.js.map
2 years ago
breadcrumbs-rtl.css
2 years ago
breadcrumbs-style.asset.php
2 years ago
breadcrumbs-style.js.map
2 years ago
breadcrumbs.asset.php
2 years ago
breadcrumbs.css
2 years ago
breadcrumbs.css.map
2 years ago
breadcrumbs.js
2 years ago
breadcrumbs.js.map
2 years ago
cart-frontend.asset.php
2 years ago
cart-frontend.js
2 years ago
cart-frontend.js.map
2 years ago
cart-rtl.css
2 years ago
cart-style.asset.php
2 years ago
cart-style.js.map
2 years ago
cart.asset.php
2 years ago
cart.css
2 years ago
cart.css.map
2 years ago
cart.js
2 years ago
cart.js.map
2 years ago
catalog-sorting-rtl.css
2 years ago
catalog-sorting-style.asset.php
2 years ago
catalog-sorting-style.js.map
2 years ago
catalog-sorting.asset.php
2 years ago
catalog-sorting.css
2 years ago
catalog-sorting.css.map
2 years ago
catalog-sorting.js
2 years ago
catalog-sorting.js.map
2 years ago
checkout-frontend.asset.php
2 years ago
checkout-frontend.js
2 years ago
checkout-frontend.js.map
2 years ago
checkout-rtl.css
2 years ago
checkout-style.asset.php
2 years ago
checkout-style.js.map
2 years ago
checkout.asset.php
2 years ago
checkout.css
2 years ago
checkout.css.map
2 years ago
checkout.js
2 years ago
checkout.js.map
2 years ago
classic-shortcode-rtl.css
2 years ago
classic-shortcode-style.asset.php
2 years ago
classic-shortcode-style.js.map
2 years ago
classic-shortcode.asset.php
2 years ago
classic-shortcode.css
2 years ago
classic-shortcode.css.map
2 years ago
classic-shortcode.js
2 years ago
classic-shortcode.js.map
2 years ago
collection-active-filters-frontend.asset.php
2 years ago
collection-active-filters-frontend.js
2 years ago
collection-active-filters-frontend.js.map
2 years ago
collection-active-filters-rtl.css
2 years ago
collection-active-filters-style.asset.php
2 years ago
collection-active-filters-style.js.map
2 years ago
collection-active-filters.asset.php
2 years ago
collection-active-filters.css
2 years ago
collection-active-filters.css.map
2 years ago
collection-active-filters.js
2 years ago
collection-active-filters.js.map
2 years ago
collection-attribute-filter-frontend.asset.php
2 years ago
collection-attribute-filter-frontend.js
2 years ago
collection-attribute-filter-frontend.js.map
2 years ago
collection-attribute-filter-rtl.css
2 years ago
collection-attribute-filter-style.asset.php
2 years ago
collection-attribute-filter-style.js.map
2 years ago
collection-attribute-filter.asset.php
2 years ago
collection-attribute-filter.css
2 years ago
collection-attribute-filter.css.map
2 years ago
collection-attribute-filter.js
2 years ago
collection-attribute-filter.js.map
2 years ago
collection-filters-style.asset.php
2 years ago
collection-filters-style.js.map
2 years ago
collection-filters.asset.php
2 years ago
collection-filters.js
2 years ago
collection-filters.js.map
2 years ago
collection-price-filter-frontend.asset.php
2 years ago
collection-price-filter-frontend.js
2 years ago
collection-price-filter-frontend.js.map
2 years ago
collection-price-filter-rtl.css
2 years ago
collection-price-filter-style.asset.php
2 years ago
collection-price-filter-style.js.map
2 years ago
collection-price-filter.asset.php
2 years ago
collection-price-filter.css
2 years ago
collection-price-filter.css.map
2 years ago
collection-price-filter.js
2 years ago
collection-price-filter.js.map
2 years ago
collection-rating-filter-frontend.asset.php
2 years ago
collection-rating-filter-frontend.js
2 years ago
collection-rating-filter-frontend.js.map
2 years ago
collection-rating-filter-rtl.css
2 years ago
collection-rating-filter-style.asset.php
2 years ago
collection-rating-filter-style.js.map
2 years ago
collection-rating-filter.asset.php
2 years ago
collection-rating-filter.css
2 years ago
collection-rating-filter.css.map
2 years ago
collection-rating-filter.js
2 years ago
collection-rating-filter.js.map
2 years ago
collection-stock-filter-frontend.asset.php
2 years ago
collection-stock-filter-frontend.js
2 years ago
collection-stock-filter-frontend.js.map
2 years ago
collection-stock-filter-rtl.css
2 years ago
collection-stock-filter-style.asset.php
2 years ago
collection-stock-filter-style.js.map
2 years ago
collection-stock-filter.asset.php
2 years ago
collection-stock-filter.css
2 years ago
collection-stock-filter.css.map
2 years ago
collection-stock-filter.js
2 years ago
collection-stock-filter.js.map
2 years ago
customer-account-rtl.css
2 years ago
customer-account-style.asset.php
2 years ago
customer-account-style.js.map
2 years ago
customer-account.asset.php
2 years ago
customer-account.css
2 years ago
customer-account.css.map
2 years ago
customer-account.js
2 years ago
customer-account.js.map
2 years ago
featured-category-rtl.css
2 years ago
featured-category-style.asset.php
2 years ago
featured-category-style.js.map
2 years ago
featured-category.asset.php
2 years ago
featured-category.css
2 years ago
featured-category.css.map
2 years ago
featured-category.js
2 years ago
featured-category.js.map
2 years ago
featured-product-rtl.css
2 years ago
featured-product-style.asset.php
2 years ago
featured-product-style.js.map
2 years ago
featured-product.asset.php
2 years ago
featured-product.css
2 years ago
featured-product.css.map
2 years ago
featured-product.js
2 years ago
featured-product.js.map
2 years ago
filter-wrapper-frontend.asset.php
2 years ago
filter-wrapper-frontend.js
2 years ago
filter-wrapper-frontend.js.map
2 years ago
filter-wrapper-rtl.css
2 years ago
filter-wrapper-style.asset.php
2 years ago
filter-wrapper-style.js.map
2 years ago
filter-wrapper.asset.php
2 years ago
filter-wrapper.css
2 years ago
filter-wrapper.css.map
2 years ago
filter-wrapper.js
2 years ago
filter-wrapper.js.map
2 years ago
handpicked-products-style.asset.php
2 years ago
handpicked-products-style.js.map
2 years ago
handpicked-products.asset.php
2 years ago
handpicked-products.js
2 years ago
handpicked-products.js.map
2 years ago
legacy-template-rtl.css
2 years ago
legacy-template-style.asset.php
2 years ago
legacy-template-style.js.map
2 years ago
legacy-template.asset.php
2 years ago
legacy-template.css
2 years ago
legacy-template.css.map
2 years ago
legacy-template.js
2 years ago
legacy-template.js.map
2 years ago
mini-cart-component-frontend.asset.php
2 years ago
mini-cart-component-frontend.js
2 years ago
mini-cart-component-frontend.js.map
2 years ago
mini-cart-contents-rtl.css
2 years ago
mini-cart-contents-style.asset.php
2 years ago
mini-cart-contents-style.js.map
2 years ago
mini-cart-contents.asset.php
2 years ago
mini-cart-contents.css
2 years ago
mini-cart-contents.css.map
2 years ago
mini-cart-contents.js
2 years ago
mini-cart-contents.js.map
2 years ago
mini-cart-frontend.asset.php
2 years ago
mini-cart-frontend.js
2 years ago
mini-cart-frontend.js.map
2 years ago
mini-cart-rtl.css
2 years ago
mini-cart-style.asset.php
2 years ago
mini-cart-style.js.map
2 years ago
mini-cart.asset.php
2 years ago
mini-cart.css
2 years ago
mini-cart.css.map
2 years ago
mini-cart.js
2 years ago
mini-cart.js.map
2 years ago
order-confirmation-additional-information-rtl.css
2 years ago
order-confirmation-additional-information-style.asset.php
2 years ago
order-confirmation-additional-information-style.js.map
2 years ago
order-confirmation-additional-information.asset.php
2 years ago
order-confirmation-additional-information.css
2 years ago
order-confirmation-additional-information.css.map
2 years ago
order-confirmation-additional-information.js
2 years ago
order-confirmation-additional-information.js.map
2 years ago
order-confirmation-billing-address-rtl.css
2 years ago
order-confirmation-billing-address-style.asset.php
2 years ago
order-confirmation-billing-address-style.js.map
2 years ago
order-confirmation-billing-address.asset.php
2 years ago
order-confirmation-billing-address.css
2 years ago
order-confirmation-billing-address.css.map
2 years ago
order-confirmation-billing-address.js
2 years ago
order-confirmation-billing-address.js.map
2 years ago
order-confirmation-billing-wrapper-style.asset.php
2 years ago
order-confirmation-billing-wrapper-style.js.map
2 years ago
order-confirmation-billing-wrapper.asset.php
2 years ago
order-confirmation-billing-wrapper.js
2 years ago
order-confirmation-billing-wrapper.js.map
2 years ago
order-confirmation-downloads-rtl.css
2 years ago
order-confirmation-downloads-style.asset.php
2 years ago
order-confirmation-downloads-style.js.map
2 years ago
order-confirmation-downloads-wrapper-style.asset.php
2 years ago
order-confirmation-downloads-wrapper-style.js.map
2 years ago
order-confirmation-downloads-wrapper.asset.php
2 years ago
order-confirmation-downloads-wrapper.js
2 years ago
order-confirmation-downloads-wrapper.js.map
2 years ago
order-confirmation-downloads.asset.php
2 years ago
order-confirmation-downloads.css
2 years ago
order-confirmation-downloads.css.map
2 years ago
order-confirmation-downloads.js
2 years ago
order-confirmation-downloads.js.map
2 years ago
order-confirmation-shipping-address-rtl.css
2 years ago
order-confirmation-shipping-address-style.asset.php
2 years ago
order-confirmation-shipping-address-style.js.map
2 years ago
order-confirmation-shipping-address.asset.php
2 years ago
order-confirmation-shipping-address.css
2 years ago
order-confirmation-shipping-address.css.map
2 years ago
order-confirmation-shipping-address.js
2 years ago
order-confirmation-shipping-address.js.map
2 years ago
order-confirmation-shipping-wrapper-style.asset.php
2 years ago
order-confirmation-shipping-wrapper-style.js.map
2 years ago
order-confirmation-shipping-wrapper.asset.php
2 years ago
order-confirmation-shipping-wrapper.js
2 years ago
order-confirmation-shipping-wrapper.js.map
2 years ago
order-confirmation-status-rtl.css
2 years ago
order-confirmation-status-style.asset.php
2 years ago
order-confirmation-status-style.js.map
2 years ago
order-confirmation-status.asset.php
2 years ago
order-confirmation-status.css
2 years ago
order-confirmation-status.css.map
2 years ago
order-confirmation-status.js
2 years ago
order-confirmation-status.js.map
2 years ago
order-confirmation-summary-rtl.css
2 years ago
order-confirmation-summary-style.asset.php
2 years ago
order-confirmation-summary-style.js.map
2 years ago
order-confirmation-summary.asset.php
2 years ago
order-confirmation-summary.css
2 years ago
order-confirmation-summary.css.map
2 years ago
order-confirmation-summary.js
2 years ago
order-confirmation-summary.js.map
2 years ago
order-confirmation-totals-rtl.css
2 years ago
order-confirmation-totals-style.asset.php
2 years ago
order-confirmation-totals-style.js.map
2 years ago
order-confirmation-totals-wrapper-style.asset.php
2 years ago
order-confirmation-totals-wrapper-style.js.map
2 years ago
order-confirmation-totals-wrapper.asset.php
2 years ago
order-confirmation-totals-wrapper.js
2 years ago
order-confirmation-totals-wrapper.js.map
2 years ago
order-confirmation-totals.asset.php
2 years ago
order-confirmation-totals.css
2 years ago
order-confirmation-totals.css.map
2 years ago
order-confirmation-totals.js
2 years ago
order-confirmation-totals.js.map
2 years ago
packages-style-rtl.css
2 years ago
packages-style-style.asset.php
2 years ago
packages-style-style.js.map
2 years ago
packages-style.css
2 years ago
packages-style.css.map
2 years ago
page-content-wrapper-style.asset.php
2 years ago
page-content-wrapper-style.js.map
2 years ago
page-content-wrapper.asset.php
2 years ago
page-content-wrapper.js
2 years ago
page-content-wrapper.js.map
2 years ago
price-filter-frontend.asset.php
2 years ago
price-filter-frontend.js
2 years ago
price-filter-frontend.js.map
2 years ago
price-filter-rtl.css
2 years ago
price-filter-style.asset.php
2 years ago
price-filter-style.js.map
2 years ago
price-filter-wrapper-frontend.js
2 years ago
price-filter-wrapper-frontend.js.map
2 years ago
price-filter-wrapper-rtl.css
2 years ago
price-filter-wrapper-style.js.map
2 years ago
price-filter-wrapper.css
2 years ago
price-filter-wrapper.css.map
2 years ago
price-filter.asset.php
2 years ago
price-filter.css
2 years ago
price-filter.css.map
2 years ago
price-filter.js
2 years ago
price-filter.js.map
2 years ago
price-format.asset.php
2 years ago
price-format.js
2 years ago
price-format.js.map
2 years ago
product-add-to-cart-frontend.js
2 years ago
product-add-to-cart-frontend.js.map
2 years ago
product-add-to-cart-rtl.css
2 years ago
product-add-to-cart-style.js.map
2 years ago
product-add-to-cart.css
2 years ago
product-add-to-cart.css.map
2 years ago
product-add-to-cart.js
2 years ago
product-add-to-cart.js.map
2 years ago
product-average-rating-frontend.js
2 years ago
product-average-rating-frontend.js.map
2 years ago
product-average-rating-style.js.map
2 years ago
product-average-rating.js
2 years ago
product-average-rating.js.map
2 years ago
product-best-sellers-style.asset.php
2 years ago
product-best-sellers-style.js.map
2 years ago
product-best-sellers.asset.php
2 years ago
product-best-sellers.js
2 years ago
product-best-sellers.js.map
2 years ago
product-button-frontend.js
2 years ago
product-button-frontend.js.map
2 years ago
product-button-interactivity-frontend.asset.php
2 years ago
product-button-interactivity-frontend.js
2 years ago
product-button-interactivity-frontend.js.map
2 years ago
product-button-rtl.css
2 years ago
product-button-style.js.map
2 years ago
product-button.css
2 years ago
product-button.css.map
2 years ago
product-button.js
2 years ago
product-button.js.map
2 years ago
product-categories-rtl.css
2 years ago
product-categories-style.asset.php
2 years ago
product-categories-style.js.map
2 years ago
product-categories.asset.php
2 years ago
product-categories.css
2 years ago
product-categories.css.map
2 years ago
product-categories.js
2 years ago
product-categories.js.map
2 years ago
product-category-style.asset.php
2 years ago
product-category-style.js.map
2 years ago
product-category.asset.php
2 years ago
product-category.js
2 years ago
product-category.js.map
2 years ago
product-collection-no-results-style.asset.php
2 years ago
product-collection-no-results-style.js.map
2 years ago
product-collection-no-results.asset.php
2 years ago
product-collection-no-results.js
2 years ago
product-collection-no-results.js.map
2 years ago
product-collection-style.asset.php
2 years ago
product-collection-style.js.map
2 years ago
product-collection.asset.php
2 years ago
product-collection.js
2 years ago
product-collection.js.map
2 years ago
product-details-rtl.css
2 years ago
product-details-style.asset.php
2 years ago
product-details-style.js.map
2 years ago
product-details.css
2 years ago
product-details.css.map
2 years ago
product-gallery-frontend.asset.php
2 years ago
product-gallery-frontend.js
2 years ago
product-gallery-frontend.js.map
2 years ago
product-gallery-large-image-frontend.asset.php
2 years ago
product-gallery-large-image-frontend.js
2 years ago
product-gallery-large-image-frontend.js.map
2 years ago
product-gallery-large-image-next-previous-style.asset.php
2 years ago
product-gallery-large-image-next-previous-style.js.map
2 years ago
product-gallery-large-image-next-previous.asset.php
2 years ago
product-gallery-large-image-next-previous.js
2 years ago
product-gallery-large-image-next-previous.js.map
2 years ago
product-gallery-large-image-style.asset.php
2 years ago
product-gallery-large-image-style.js.map
2 years ago
product-gallery-large-image.asset.php
2 years ago
product-gallery-large-image.js
2 years ago
product-gallery-large-image.js.map
2 years ago
product-gallery-pager-style.asset.php
2 years ago
product-gallery-pager-style.js.map
2 years ago
product-gallery-pager.asset.php
2 years ago
product-gallery-pager.js
2 years ago
product-gallery-pager.js.map
2 years ago
product-gallery-rtl.css
2 years ago
product-gallery-style.asset.php
2 years ago
product-gallery-style.js.map
2 years ago
product-gallery-thumbnails-style.asset.php
2 years ago
product-gallery-thumbnails-style.js.map
2 years ago
product-gallery-thumbnails.asset.php
2 years ago
product-gallery-thumbnails.js
2 years ago
product-gallery-thumbnails.js.map
2 years ago
product-gallery.asset.php
2 years ago
product-gallery.css
2 years ago
product-gallery.css.map
2 years ago
product-gallery.js
2 years ago
product-gallery.js.map
2 years ago
product-image-frontend.js
2 years ago
product-image-frontend.js.map
2 years ago
product-image-gallery-rtl.css
2 years ago
product-image-gallery-style.asset.php
2 years ago
product-image-gallery-style.js.map
2 years ago
product-image-gallery.css
2 years ago
product-image-gallery.css.map
2 years ago
product-image-rtl.css
2 years ago
product-image-style.js.map
2 years ago
product-image.css
2 years ago
product-image.css.map
2 years ago
product-image.js
2 years ago
product-image.js.map
2 years ago
product-new-style.asset.php
2 years ago
product-new-style.js.map
2 years ago
product-new.asset.php
2 years ago
product-new.js
2 years ago
product-new.js.map
2 years ago
product-on-sale-style.asset.php
2 years ago
product-on-sale-style.js.map
2 years ago
product-on-sale.asset.php
2 years ago
product-on-sale.js
2 years ago
product-on-sale.js.map
2 years ago
product-price-frontend.js
2 years ago
product-price-frontend.js.map
2 years ago
product-price-rtl.css
2 years ago
product-price-style.js.map
2 years ago
product-price.css
2 years ago
product-price.css.map
2 years ago
product-price.js
2 years ago
product-price.js.map
2 years ago
product-query-rtl.css
2 years ago
product-query-style.asset.php
2 years ago
product-query-style.js.map
2 years ago
product-query.asset.php
2 years ago
product-query.css
2 years ago
product-query.css.map
2 years ago
product-query.js
2 years ago
product-query.js.map
2 years ago
product-rating-counter-frontend.js
2 years ago
product-rating-counter-frontend.js.map
2 years ago
product-rating-counter-style.js.map
2 years ago
product-rating-counter.js
2 years ago
product-rating-counter.js.map
2 years ago
product-rating-frontend.js
2 years ago
product-rating-frontend.js.map
2 years ago
product-rating-rtl.css
2 years ago
product-rating-stars-frontend.js
2 years ago
product-rating-stars-frontend.js.map
2 years ago
product-rating-stars-rtl.css
2 years ago
product-rating-stars-style.js.map
2 years ago
product-rating-stars.css
2 years ago
product-rating-stars.css.map
2 years ago
product-rating-stars.js
2 years ago
product-rating-stars.js.map
2 years ago
product-rating-style.js.map
2 years ago
product-rating.css
2 years ago
product-rating.css.map
2 years ago
product-rating.js
2 years ago
product-rating.js.map
2 years ago
product-results-count-rtl.css
2 years ago
product-results-count-style.asset.php
2 years ago
product-results-count-style.js.map
2 years ago
product-results-count.asset.php
2 years ago
product-results-count.css
2 years ago
product-results-count.css.map
2 years ago
product-results-count.js
2 years ago
product-results-count.js.map
2 years ago
product-reviews-rtl.css
2 years ago
product-reviews-style.asset.php
2 years ago
product-reviews-style.js.map
2 years ago
product-reviews.css
2 years ago
product-reviews.css.map
2 years ago
product-sale-badge-frontend.js
2 years ago
product-sale-badge-frontend.js.map
2 years ago
product-sale-badge-rtl.css
2 years ago
product-sale-badge-style.js.map
2 years ago
product-sale-badge.css
2 years ago
product-sale-badge.css.map
2 years ago
product-sale-badge.js
2 years ago
product-sale-badge.js.map
2 years ago
product-search-rtl.css
2 years ago
product-search-style.asset.php
2 years ago
product-search-style.js.map
2 years ago
product-search.asset.php
2 years ago
product-search.css
2 years ago
product-search.css.map
2 years ago
product-search.js
2 years ago
product-search.js.map
2 years ago
product-sku-frontend.js
2 years ago
product-sku-frontend.js.map
2 years ago
product-sku-rtl.css
2 years ago
product-sku-style.js.map
2 years ago
product-sku.css
2 years ago
product-sku.css.map
2 years ago
product-sku.js
2 years ago
product-sku.js.map
2 years ago
product-stock-indicator-frontend.js
2 years ago
product-stock-indicator-frontend.js.map
2 years ago
product-stock-indicator-rtl.css
2 years ago
product-stock-indicator-style.js.map
2 years ago
product-stock-indicator.css
2 years ago
product-stock-indicator.css.map
2 years ago
product-stock-indicator.js
2 years ago
product-stock-indicator.js.map
2 years ago
product-summary-frontend.js
2 years ago
product-summary-frontend.js.map
2 years ago
product-summary-rtl.css
2 years ago
product-summary-style.js.map
2 years ago
product-summary.css
2 years ago
product-summary.css.map
2 years ago
product-summary.js
2 years ago
product-summary.js.map
2 years ago
product-tag-style.asset.php
2 years ago
product-tag-style.js.map
2 years ago
product-tag.asset.php
2 years ago
product-tag.js
2 years ago
product-tag.js.map
2 years ago
product-template-rtl.css
2 years ago
product-template-style.asset.php
2 years ago
product-template-style.js.map
2 years ago
product-template.asset.php
2 years ago
product-template.css
2 years ago
product-template.css.map
2 years ago
product-template.js
2 years ago
product-template.js.map
2 years ago
product-title-frontend.js
2 years ago
product-title-frontend.js.map
2 years ago
product-title-rtl.css
2 years ago
product-title-style.js.map
2 years ago
product-title.css
2 years ago
product-title.css.map
2 years ago
product-title.js
2 years ago
product-title.js.map
2 years ago
product-top-rated-style.asset.php
2 years ago
product-top-rated-style.js.map
2 years ago
product-top-rated.asset.php
2 years ago
product-top-rated.js
2 years ago
product-top-rated.js.map
2 years ago
products-by-attribute-style.asset.php
2 years ago
products-by-attribute-style.js.map
2 years ago
products-by-attribute.asset.php
2 years ago
products-by-attribute.js
2 years ago
products-by-attribute.js.map
2 years ago
rating-filter-frontend.asset.php
2 years ago
rating-filter-frontend.js
2 years ago
rating-filter-frontend.js.map
2 years ago
rating-filter-rtl.css
2 years ago
rating-filter-style.asset.php
2 years ago
rating-filter-style.js.map
2 years ago
rating-filter-wrapper-frontend.js
2 years ago
rating-filter-wrapper-frontend.js.map
2 years ago
rating-filter-wrapper-rtl.css
2 years ago
rating-filter-wrapper-style.js.map
2 years ago
rating-filter-wrapper.css
2 years ago
rating-filter-wrapper.css.map
2 years ago
rating-filter.asset.php
2 years ago
rating-filter.css
2 years ago
rating-filter.css.map
2 years ago
rating-filter.js
2 years ago
rating-filter.js.map
2 years ago
reviews-by-category-rtl.css
2 years ago
reviews-by-category-style.asset.php
2 years ago
reviews-by-category-style.js.map
2 years ago
reviews-by-category.asset.php
2 years ago
reviews-by-category.css
2 years ago
reviews-by-category.css.map
2 years ago
reviews-by-category.js
2 years ago
reviews-by-category.js.map
2 years ago
reviews-by-product-rtl.css
2 years ago
reviews-by-product-style.asset.php
2 years ago
reviews-by-product-style.js.map
2 years ago
reviews-by-product.asset.php
2 years ago
reviews-by-product.css
2 years ago
reviews-by-product.css.map
2 years ago
reviews-by-product.js
2 years ago
reviews-by-product.js.map
2 years ago
reviews-frontend.asset.php
2 years ago
reviews-frontend.js
2 years ago
reviews-frontend.js.map
2 years ago
single-product-rtl.css
2 years ago
single-product-style.asset.php
2 years ago
single-product-style.js.map
2 years ago
single-product.asset.php
2 years ago
single-product.css
2 years ago
single-product.css.map
2 years ago
single-product.js
2 years ago
single-product.js.map
2 years ago
stock-filter-frontend.asset.php
2 years ago
stock-filter-frontend.js
2 years ago
stock-filter-frontend.js.map
2 years ago
stock-filter-rtl.css
2 years ago
stock-filter-style.asset.php
2 years ago
stock-filter-style.js.map
2 years ago
stock-filter-wrapper-frontend.js
2 years ago
stock-filter-wrapper-frontend.js.map
2 years ago
stock-filter-wrapper-rtl.css
2 years ago
stock-filter-wrapper-style.js.map
2 years ago
stock-filter-wrapper.css
2 years ago
stock-filter-wrapper.css.map
2 years ago
stock-filter.asset.php
2 years ago
stock-filter.css
2 years ago
stock-filter.css.map
2 years ago
stock-filter.js
2 years ago
stock-filter.js.map
2 years ago
store-notices-rtl.css
2 years ago
store-notices-style.asset.php
2 years ago
store-notices-style.js.map
2 years ago
store-notices.asset.php
2 years ago
store-notices.css
2 years ago
store-notices.css.map
2 years ago
store-notices.js
2 years ago
store-notices.js.map
2 years ago
vendors-node_modules_pnpm_dinero_js_1_9_1_node_modules_dinero_js_build_esm_dinero_js-style.js.map
2 years ago
vendors-node_modules_pnpm_param-case_3_0_4_node_modules_param-case_dist_es2015_index_js-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-019903-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-37238e-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-37238e-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-68c184-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-70a73f-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-70a73f-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-849324-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-849324-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-bab841-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-c6918e-style.js.map
2 years ago
wc-blocks-classic-template-revert-button-style-rtl.css
2 years ago
wc-blocks-classic-template-revert-button-style-style.asset.php
2 years ago
wc-blocks-classic-template-revert-button-style-style.js.map
2 years ago
wc-blocks-classic-template-revert-button-style.css
2 years ago
wc-blocks-classic-template-revert-button-style.css.map
2 years ago
wc-blocks-classic-template-revert-button.asset.php
2 years ago
wc-blocks-classic-template-revert-button.js
2 years ago
wc-blocks-classic-template-revert-button.js.map
2 years ago
wc-blocks-data.asset.php
2 years ago
wc-blocks-data.js
2 years ago
wc-blocks-data.js.map
2 years ago
wc-blocks-editor-style-rtl.css
2 years ago
wc-blocks-editor-style.css
2 years ago
wc-blocks-editor-style.css.map
2 years ago
wc-blocks-google-analytics.asset.php
2 years ago
wc-blocks-google-analytics.js
2 years ago
wc-blocks-google-analytics.js.map
2 years ago
wc-blocks-middleware.asset.php
2 years ago
wc-blocks-middleware.js
2 years ago
wc-blocks-middleware.js.map
2 years ago
wc-blocks-registry.asset.php
2 years ago
wc-blocks-registry.js
2 years ago
wc-blocks-registry.js.map
2 years ago
wc-blocks-rtl.css
2 years ago
wc-blocks-shared-context.asset.php
2 years ago
wc-blocks-shared-context.js
2 years ago
wc-blocks-shared-context.js.map
2 years ago
wc-blocks-shared-hocs.asset.php
2 years ago
wc-blocks-shared-hocs.js
2 years ago
wc-blocks-shared-hocs.js.map
2 years ago
wc-blocks-style.asset.php
2 years ago
wc-blocks-style.js.map
2 years ago
wc-blocks-vendors.asset.php
2 years ago
wc-blocks-vendors.js
2 years ago
wc-blocks-vendors.js.map
2 years ago
wc-blocks.asset.php
2 years ago
wc-blocks.css
2 years ago
wc-blocks.css.map
2 years ago
wc-blocks.js
2 years ago
wc-blocks.js.map
2 years ago
wc-interactivity-checkbox-list-rtl.css
2 years ago
wc-interactivity-checkbox-list-style.asset.php
2 years ago
wc-interactivity-checkbox-list-style.js.map
2 years ago
wc-interactivity-checkbox-list.asset.php
2 years ago
wc-interactivity-checkbox-list.css
2 years ago
wc-interactivity-checkbox-list.css.map
2 years ago
wc-interactivity-checkbox-list.js
2 years ago
wc-interactivity-checkbox-list.js.map
2 years ago
wc-interactivity-dropdown-rtl.css
2 years ago
wc-interactivity-dropdown-style.asset.php
2 years ago
wc-interactivity-dropdown-style.js.map
2 years ago
wc-interactivity-dropdown.asset.php
2 years ago
wc-interactivity-dropdown.css
2 years ago
wc-interactivity-dropdown.css.map
2 years ago
wc-interactivity-dropdown.js
2 years ago
wc-interactivity-dropdown.js.map
2 years ago
wc-interactivity.asset.php
2 years ago
wc-interactivity.js
2 years ago
wc-interactivity.js.map
2 years ago
wc-payment-method-bacs.asset.php
2 years ago
wc-payment-method-bacs.js
2 years ago
wc-payment-method-bacs.js.map
2 years ago
wc-payment-method-cheque.asset.php
2 years ago
wc-payment-method-cheque.js
2 years ago
wc-payment-method-cheque.js.map
2 years ago
wc-payment-method-cod.asset.php
2 years ago
wc-payment-method-cod.js
2 years ago
wc-payment-method-cod.js.map
2 years ago
wc-payment-method-paypal.asset.php
2 years ago
wc-payment-method-paypal.js
2 years ago
wc-payment-method-paypal.js.map
2 years ago
wc-settings.asset.php
2 years ago
wc-settings.js
2 years ago
wc-settings.js.map
2 years ago
wc-shipping-method-pickup-location.asset.php
2 years ago
wc-shipping-method-pickup-location.js
2 years ago
wc-shipping-method-pickup-location.js.map
2 years ago
product-collection.js
6422 lines
| 1 | /******/ (() => { // webpackBootstrap |
| 2 | /******/ var __webpack_modules__ = ({ |
| 3 | |
| 4 | /***/ "./assets/js/atomic/blocks/product-elements/image/types.ts": |
| 5 | /*!*****************************************************************!*\ |
| 6 | !*** ./assets/js/atomic/blocks/product-elements/image/types.ts ***! |
| 7 | \*****************************************************************/ |
| 8 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 9 | |
| 10 | "use strict"; |
| 11 | __webpack_require__.r(__webpack_exports__); |
| 12 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 | /* harmony export */ ImageSizing: () => (/* binding */ ImageSizing) |
| 14 | /* harmony export */ }); |
| 15 | let ImageSizing = /*#__PURE__*/function (ImageSizing) { |
| 16 | ImageSizing["SINGLE"] = "single"; |
| 17 | ImageSizing["THUMBNAIL"] = "thumbnail"; |
| 18 | return ImageSizing; |
| 19 | }({}); |
| 20 | |
| 21 | /***/ }), |
| 22 | |
| 23 | /***/ "./assets/js/atomic/blocks/product-elements/summary/constants.tsx": |
| 24 | /*!************************************************************************!*\ |
| 25 | !*** ./assets/js/atomic/blocks/product-elements/summary/constants.tsx ***! |
| 26 | \************************************************************************/ |
| 27 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 28 | |
| 29 | "use strict"; |
| 30 | __webpack_require__.r(__webpack_exports__); |
| 31 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 32 | /* harmony export */ BLOCK_DESCRIPTION: () => (/* binding */ BLOCK_DESCRIPTION), |
| 33 | /* harmony export */ BLOCK_ICON: () => (/* binding */ BLOCK_ICON), |
| 34 | /* harmony export */ BLOCK_TITLE: () => (/* binding */ BLOCK_TITLE) |
| 35 | /* harmony export */ }); |
| 36 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 37 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 38 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 39 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 40 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/icon/index.js"); |
| 41 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/page.js"); |
| 42 | |
| 43 | /** |
| 44 | * External dependencies |
| 45 | */ |
| 46 | |
| 47 | |
| 48 | const BLOCK_TITLE = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Product Summary', 'woocommerce'); |
| 49 | const BLOCK_ICON = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_2__["default"], { |
| 50 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"], |
| 51 | className: "wc-block-editor-components-block-icon" |
| 52 | }); |
| 53 | const BLOCK_DESCRIPTION = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Display a short description about a product.', 'woocommerce'); |
| 54 | |
| 55 | /***/ }), |
| 56 | |
| 57 | /***/ "./assets/js/atomic/blocks/product-elements/title/constants.tsx": |
| 58 | /*!**********************************************************************!*\ |
| 59 | !*** ./assets/js/atomic/blocks/product-elements/title/constants.tsx ***! |
| 60 | \**********************************************************************/ |
| 61 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 62 | |
| 63 | "use strict"; |
| 64 | __webpack_require__.r(__webpack_exports__); |
| 65 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 66 | /* harmony export */ BLOCK_DESCRIPTION: () => (/* binding */ BLOCK_DESCRIPTION), |
| 67 | /* harmony export */ BLOCK_ICON: () => (/* binding */ BLOCK_ICON), |
| 68 | /* harmony export */ BLOCK_TITLE: () => (/* binding */ BLOCK_TITLE) |
| 69 | /* harmony export */ }); |
| 70 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 71 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 72 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 73 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 74 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/icon/index.js"); |
| 75 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/heading.js"); |
| 76 | |
| 77 | /** |
| 78 | * External dependencies |
| 79 | */ |
| 80 | |
| 81 | |
| 82 | const BLOCK_TITLE = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Product Title', 'woocommerce'); |
| 83 | const BLOCK_ICON = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_2__["default"], { |
| 84 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"], |
| 85 | className: "wc-block-editor-components-block-icon" |
| 86 | }); |
| 87 | const BLOCK_DESCRIPTION = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Display the title of a product.', 'woocommerce'); |
| 88 | |
| 89 | /***/ }), |
| 90 | |
| 91 | /***/ "./assets/js/base/context/hooks/use-product-attributes.ts": |
| 92 | /*!****************************************************************!*\ |
| 93 | !*** ./assets/js/base/context/hooks/use-product-attributes.ts ***! |
| 94 | \****************************************************************/ |
| 95 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 96 | |
| 97 | "use strict"; |
| 98 | __webpack_require__.r(__webpack_exports__); |
| 99 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 100 | /* harmony export */ "default": () => (/* binding */ useProductAttributes) |
| 101 | /* harmony export */ }); |
| 102 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 103 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
| 104 | /* harmony import */ var _woocommerce_editor_components_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @woocommerce/editor-components/utils */ "./assets/js/editor-components/utils/index.js"); |
| 105 | /* harmony import */ var _woocommerce_base_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/base-utils */ "./assets/js/base/utils/errors.ts"); |
| 106 | /** |
| 107 | * External dependencies |
| 108 | */ |
| 109 | |
| 110 | |
| 111 | |
| 112 | function useProductAttributes(shouldLoadAttributes) { |
| 113 | const [errorLoadingAttributes, setErrorLoadingAttributes] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); |
| 114 | const [isLoadingAttributes, setIsLoadingAttributes] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); |
| 115 | const [productsAttributes, setProductsAttributes] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)([]); |
| 116 | const hasLoadedAttributes = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); |
| 117 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { |
| 118 | if (!shouldLoadAttributes || isLoadingAttributes || hasLoadedAttributes.current) return; |
| 119 | async function fetchAttributesWithTerms() { |
| 120 | setIsLoadingAttributes(true); |
| 121 | try { |
| 122 | const attributes = await (0,_woocommerce_editor_components_utils__WEBPACK_IMPORTED_MODULE_1__.getAttributes)(); |
| 123 | const attributesWithTerms = []; |
| 124 | for (const attribute of attributes) { |
| 125 | const terms = await (0,_woocommerce_editor_components_utils__WEBPACK_IMPORTED_MODULE_1__.getTerms)(attribute.id); |
| 126 | attributesWithTerms.push({ |
| 127 | ...attribute, |
| 128 | // Manually adding the parent id because of a Rest API bug |
| 129 | // returning always `0` as parent. |
| 130 | // see https://github.com/woocommerce/woocommerce-blocks/issues/8501 |
| 131 | parent: 0, |
| 132 | terms: terms.map(term => ({ |
| 133 | ...term, |
| 134 | attr_slug: attribute.taxonomy, |
| 135 | parent: attribute.id |
| 136 | })) |
| 137 | }); |
| 138 | } |
| 139 | setProductsAttributes(attributesWithTerms); |
| 140 | hasLoadedAttributes.current = true; |
| 141 | } catch (e) { |
| 142 | if (e instanceof Error) { |
| 143 | setErrorLoadingAttributes(await (0,_woocommerce_base_utils__WEBPACK_IMPORTED_MODULE_2__.formatError)(e)); |
| 144 | } |
| 145 | } finally { |
| 146 | setIsLoadingAttributes(false); |
| 147 | } |
| 148 | } |
| 149 | fetchAttributesWithTerms(); |
| 150 | return () => { |
| 151 | hasLoadedAttributes.current = true; |
| 152 | }; |
| 153 | }, [isLoadingAttributes, shouldLoadAttributes]); |
| 154 | return { |
| 155 | errorLoadingAttributes, |
| 156 | isLoadingAttributes, |
| 157 | productsAttributes |
| 158 | }; |
| 159 | } |
| 160 | |
| 161 | /***/ }), |
| 162 | |
| 163 | /***/ "./assets/js/base/hooks/use-local-storage-state.ts": |
| 164 | /*!*********************************************************!*\ |
| 165 | !*** ./assets/js/base/hooks/use-local-storage-state.ts ***! |
| 166 | \*********************************************************/ |
| 167 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 168 | |
| 169 | "use strict"; |
| 170 | __webpack_require__.r(__webpack_exports__); |
| 171 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 172 | /* harmony export */ useLocalStorageState: () => (/* binding */ useLocalStorageState) |
| 173 | /* harmony export */ }); |
| 174 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 175 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
| 176 | /** |
| 177 | * External dependencies |
| 178 | */ |
| 179 | |
| 180 | const useLocalStorageState = (key, initialValue) => { |
| 181 | const [state, setState] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(() => { |
| 182 | const valueInLocalStorage = window.localStorage.getItem(key); |
| 183 | if (valueInLocalStorage) { |
| 184 | try { |
| 185 | return JSON.parse(valueInLocalStorage); |
| 186 | } catch { |
| 187 | // eslint-disable-next-line no-console |
| 188 | console.error(`Value for key '${key}' could not be retrieved from localStorage because it can't be parsed.`); |
| 189 | } |
| 190 | } |
| 191 | return initialValue; |
| 192 | }); |
| 193 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { |
| 194 | try { |
| 195 | window.localStorage.setItem(key, JSON.stringify(state)); |
| 196 | } catch { |
| 197 | // eslint-disable-next-line no-console |
| 198 | console.error(`Value for key '${key}' could not be saved in localStorage because it can't be converted into a string.`); |
| 199 | } |
| 200 | }, [key, state]); |
| 201 | return [state, setState]; |
| 202 | }; |
| 203 | |
| 204 | /***/ }), |
| 205 | |
| 206 | /***/ "./assets/js/base/hooks/use-previous.ts": |
| 207 | /*!**********************************************!*\ |
| 208 | !*** ./assets/js/base/hooks/use-previous.ts ***! |
| 209 | \**********************************************/ |
| 210 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 211 | |
| 212 | "use strict"; |
| 213 | __webpack_require__.r(__webpack_exports__); |
| 214 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 215 | /* harmony export */ usePrevious: () => (/* binding */ usePrevious) |
| 216 | /* harmony export */ }); |
| 217 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 218 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
| 219 | /** |
| 220 | * External dependencies |
| 221 | */ |
| 222 | |
| 223 | /** |
| 224 | * Use Previous based on https://usehooks.com/useprevious/. |
| 225 | * |
| 226 | * @param {*} value |
| 227 | * @param {Function} [validation] Function that needs to validate for the value |
| 228 | * to be updated. |
| 229 | */ |
| 230 | function usePrevious(value, validation) { |
| 231 | const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(); |
| 232 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { |
| 233 | if (ref.current !== value && (!validation || validation(value, ref.current))) { |
| 234 | ref.current = value; |
| 235 | } |
| 236 | }, [value, validation]); |
| 237 | return ref.current; |
| 238 | } |
| 239 | |
| 240 | /***/ }), |
| 241 | |
| 242 | /***/ "./assets/js/base/utils/errors.ts": |
| 243 | /*!****************************************!*\ |
| 244 | !*** ./assets/js/base/utils/errors.ts ***! |
| 245 | \****************************************/ |
| 246 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 247 | |
| 248 | "use strict"; |
| 249 | __webpack_require__.r(__webpack_exports__); |
| 250 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 251 | /* harmony export */ formatError: () => (/* binding */ formatError) |
| 252 | /* harmony export */ }); |
| 253 | const formatError = async error => { |
| 254 | if ('json' in error) { |
| 255 | try { |
| 256 | const parsedError = await error.json(); |
| 257 | return { |
| 258 | message: parsedError.message, |
| 259 | type: parsedError.type || 'api' |
| 260 | }; |
| 261 | } catch (e) { |
| 262 | return { |
| 263 | // We could only return this if e is instanceof Error but, to avoid changing runtime |
| 264 | // behaviour, we'll just cast it instead. |
| 265 | message: e.message, |
| 266 | type: 'general' |
| 267 | }; |
| 268 | } |
| 269 | } else { |
| 270 | return { |
| 271 | message: error.message, |
| 272 | type: error.type || 'general' |
| 273 | }; |
| 274 | } |
| 275 | }; |
| 276 | |
| 277 | /***/ }), |
| 278 | |
| 279 | /***/ "./assets/js/base/utils/keyby.ts": |
| 280 | /*!***************************************!*\ |
| 281 | !*** ./assets/js/base/utils/keyby.ts ***! |
| 282 | \***************************************/ |
| 283 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 284 | |
| 285 | "use strict"; |
| 286 | __webpack_require__.r(__webpack_exports__); |
| 287 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 288 | /* harmony export */ keyBy: () => (/* binding */ keyBy) |
| 289 | /* harmony export */ }); |
| 290 | const keyBy = (array, key) => { |
| 291 | return array.reduce((acc, value) => { |
| 292 | const computedKey = key ? String(value[key]) : String(value); |
| 293 | acc[computedKey] = value; |
| 294 | return acc; |
| 295 | }, {}); |
| 296 | }; |
| 297 | |
| 298 | /***/ }), |
| 299 | |
| 300 | /***/ "./assets/js/blocks/migration-products-to-product-collection/constants.ts": |
| 301 | /*!********************************************************************************!*\ |
| 302 | !*** ./assets/js/blocks/migration-products-to-product-collection/constants.ts ***! |
| 303 | \********************************************************************************/ |
| 304 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 305 | |
| 306 | "use strict"; |
| 307 | __webpack_require__.r(__webpack_exports__); |
| 308 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 309 | /* harmony export */ AUTO_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION: () => (/* binding */ AUTO_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION), |
| 310 | /* harmony export */ HOURS_TO_DISPLAY_UPGRADE_NOTICE: () => (/* binding */ HOURS_TO_DISPLAY_UPGRADE_NOTICE), |
| 311 | /* harmony export */ INITIAL_STATUS_LS_VALUE: () => (/* binding */ INITIAL_STATUS_LS_VALUE), |
| 312 | /* harmony export */ MANUAL_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION: () => (/* binding */ MANUAL_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION), |
| 313 | /* harmony export */ MIGRATION_STATUS_LS_KEY: () => (/* binding */ MIGRATION_STATUS_LS_KEY), |
| 314 | /* harmony export */ UPGRADE_NOTICE_DISPLAY_COUNT_THRESHOLD: () => (/* binding */ UPGRADE_NOTICE_DISPLAY_COUNT_THRESHOLD), |
| 315 | /* harmony export */ getInitialStatusLSValue: () => (/* binding */ getInitialStatusLSValue) |
| 316 | /* harmony export */ }); |
| 317 | /** |
| 318 | * Internal dependencies |
| 319 | */ |
| 320 | |
| 321 | const AUTO_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION = false; |
| 322 | const MANUAL_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION = true; |
| 323 | const HOURS_TO_DISPLAY_UPGRADE_NOTICE = 72; |
| 324 | const UPGRADE_NOTICE_DISPLAY_COUNT_THRESHOLD = 4; |
| 325 | const MIGRATION_STATUS_LS_KEY = 'wc-blocks_upgraded-products-to-product-collection'; |
| 326 | // Initial status used in the localStorage |
| 327 | const INITIAL_STATUS_LS_VALUE = 'notseen'; |
| 328 | const getInitialStatusLSValue = () => ({ |
| 329 | status: INITIAL_STATUS_LS_VALUE, |
| 330 | time: Date.now(), |
| 331 | displayCount: 0 |
| 332 | }); |
| 333 | |
| 334 | /***/ }), |
| 335 | |
| 336 | /***/ "./assets/js/blocks/migration-products-to-product-collection/migration-from-product-collection-to-products.ts": |
| 337 | /*!********************************************************************************************************************!*\ |
| 338 | !*** ./assets/js/blocks/migration-products-to-product-collection/migration-from-product-collection-to-products.ts ***! |
| 339 | \********************************************************************************************************************/ |
| 340 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 341 | |
| 342 | "use strict"; |
| 343 | __webpack_require__.r(__webpack_exports__); |
| 344 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 345 | /* harmony export */ replaceProductCollectionWithProducts: () => (/* binding */ replaceProductCollectionWithProducts), |
| 346 | /* harmony export */ revertMigration: () => (/* binding */ revertMigration) |
| 347 | /* harmony export */ }); |
| 348 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 349 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 350 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 351 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 352 | /* harmony import */ var _migration_from_products_to_product_collection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./migration-from-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/migration-from-products-to-product-collection.ts"); |
| 353 | /* harmony import */ var _migration_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./migration-utils */ "./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts"); |
| 354 | /** |
| 355 | * External dependencies |
| 356 | */ |
| 357 | |
| 358 | |
| 359 | |
| 360 | /** |
| 361 | * Internal dependencies |
| 362 | */ |
| 363 | |
| 364 | |
| 365 | const VARIATION_NAME = 'woocommerce/product-query'; |
| 366 | const mapAttributes = attributes => { |
| 367 | const { |
| 368 | query, |
| 369 | ...restAttributes |
| 370 | } = attributes; |
| 371 | const { |
| 372 | woocommerceAttributes, |
| 373 | woocommerceStockStatus, |
| 374 | woocommerceOnSale, |
| 375 | woocommerceHandPickedProducts, |
| 376 | taxQuery, |
| 377 | isProductCollectionBlock, |
| 378 | ...restQuery |
| 379 | } = query; |
| 380 | |
| 381 | // These fields have to be explicitly removed if they are empty |
| 382 | // otherwise incorrect data is fetched even if they are set as undefined. |
| 383 | const mappedQuery = { |
| 384 | ...restQuery |
| 385 | }; |
| 386 | if (woocommerceHandPickedProducts) { |
| 387 | mappedQuery.include = woocommerceHandPickedProducts; |
| 388 | } |
| 389 | if (woocommerceOnSale) { |
| 390 | mappedQuery.__woocommerceOnSale = woocommerceOnSale; |
| 391 | } |
| 392 | if (taxQuery) { |
| 393 | mappedQuery.taxQuery = taxQuery; |
| 394 | } |
| 395 | return { |
| 396 | ...restAttributes, |
| 397 | namespace: VARIATION_NAME, |
| 398 | query: { |
| 399 | __woocommerceAttributes: woocommerceAttributes || [], |
| 400 | __woocommerceStockStatus: woocommerceStockStatus || [], |
| 401 | ...mappedQuery |
| 402 | } |
| 403 | }; |
| 404 | }; |
| 405 | const isProductTemplate = ({ |
| 406 | name |
| 407 | }) => name === 'woocommerce/product-template'; |
| 408 | const isPostTitle = ({ |
| 409 | name, |
| 410 | attributes |
| 411 | }) => name === 'core/post-title' && attributes.__woocommerceNamespace === 'woocommerce/product-collection/product-title'; |
| 412 | const isPostSummary = ({ |
| 413 | name, |
| 414 | attributes |
| 415 | }) => name === 'core/post-excerpt' && attributes.__woocommerceNamespace === 'woocommerce/product-collection/product-summary'; |
| 416 | const mapLayoutType = type => { |
| 417 | if (type === 'flex') { |
| 418 | return 'grid'; |
| 419 | } |
| 420 | if (type === 'list') { |
| 421 | return 'default'; |
| 422 | } |
| 423 | return 'grid'; |
| 424 | }; |
| 425 | const mapLayoutPropertiesFromProductCollectionToPostTemplate = layout => { |
| 426 | const { |
| 427 | type, |
| 428 | columns |
| 429 | } = layout; |
| 430 | return { |
| 431 | type: mapLayoutType(type), |
| 432 | columnCount: columns |
| 433 | }; |
| 434 | }; |
| 435 | const transformProductTemplate = (block, innerBlocks, displayLayout) => { |
| 436 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/post-template', { |
| 437 | className: 'products-block-post-template', |
| 438 | layout: _migration_utils__WEBPACK_IMPORTED_MODULE_2__.postTemplateHasSupportForGridView ? mapLayoutPropertiesFromProductCollectionToPostTemplate(displayLayout) : undefined, |
| 439 | __woocommerceNamespace: 'woocommerce/product-query/product-template', |
| 440 | ...block.attributes |
| 441 | }, innerBlocks); |
| 442 | }; |
| 443 | const transformPostTitle = (block, innerBlocks) => { |
| 444 | const { |
| 445 | __woocommerceNamespace, |
| 446 | ...restAttrributes |
| 447 | } = block.attributes; |
| 448 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/post-title', { |
| 449 | __woocommerceNamespace: 'woocommerce/product-collection/product-title', |
| 450 | ...restAttrributes |
| 451 | }, innerBlocks); |
| 452 | }; |
| 453 | const transformPostSummary = (block, innerBlocks) => { |
| 454 | const { |
| 455 | __woocommerceNamespace, |
| 456 | ...restAttrributes |
| 457 | } = block.attributes; |
| 458 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/post-excerpt', { |
| 459 | __woocommerceNamespace: 'woocommerce/product-collection/product-summary', |
| 460 | ...restAttrributes |
| 461 | }, innerBlocks); |
| 462 | }; |
| 463 | const mapInnerBlocks = (innerBlocks, displayLayout) => { |
| 464 | const mappedInnerBlocks = innerBlocks.map(innerBlock => { |
| 465 | const { |
| 466 | name, |
| 467 | attributes |
| 468 | } = innerBlock; |
| 469 | const mappedInnerInnerBlocks = mapInnerBlocks(innerBlock.innerBlocks); |
| 470 | if (isProductTemplate(innerBlock)) { |
| 471 | return transformProductTemplate(innerBlock, mappedInnerInnerBlocks, displayLayout); |
| 472 | } |
| 473 | if (isPostTitle(innerBlock)) { |
| 474 | return transformPostTitle(innerBlock, mappedInnerInnerBlocks); |
| 475 | } |
| 476 | if (isPostSummary(innerBlock)) { |
| 477 | return transformPostSummary(innerBlock, mappedInnerInnerBlocks); |
| 478 | } |
| 479 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)(name, attributes, mappedInnerInnerBlocks); |
| 480 | }); |
| 481 | return mappedInnerBlocks; |
| 482 | }; |
| 483 | const replaceProductCollectionBlock = clientId => { |
| 484 | const productCollectionBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getBlock(clientId); |
| 485 | const canBeInserted = (0,_migration_utils__WEBPACK_IMPORTED_MODULE_2__.checkIfBlockCanBeInserted)(clientId, 'core/query'); |
| 486 | if (productCollectionBlock && canBeInserted) { |
| 487 | const { |
| 488 | attributes = {}, |
| 489 | innerBlocks = [] |
| 490 | } = productCollectionBlock; |
| 491 | // Starting from GB 16, it's not Query Loop that keeps the layout, but the Post Template block. |
| 492 | // We need to account for that and in that case, move the layout properties |
| 493 | // from Product Collection either to Query Loop OR to Post Template. |
| 494 | const { |
| 495 | displayLayout, |
| 496 | ...restAttributes |
| 497 | } = attributes; |
| 498 | const adjustedAttributes = !_migration_utils__WEBPACK_IMPORTED_MODULE_2__.postTemplateHasSupportForGridView ? mapAttributes(attributes) : mapAttributes(restAttributes); |
| 499 | const adjustedInnerBlocks = mapInnerBlocks(innerBlocks, displayLayout); |
| 500 | const productsBlock = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/query', adjustedAttributes, adjustedInnerBlocks); |
| 501 | (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('core/block-editor').replaceBlock(clientId, productsBlock); |
| 502 | return true; |
| 503 | } |
| 504 | return false; |
| 505 | }; |
| 506 | const replaceProductCollectionWithProducts = () => { |
| 507 | const blocks = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getBlocks(); |
| 508 | const productCollectionBlockClientIds = (0,_migration_utils__WEBPACK_IMPORTED_MODULE_2__.getProductCollectionBlockClientIds)(blocks); |
| 509 | productCollectionBlockClientIds.map(replaceProductCollectionBlock); |
| 510 | }; |
| 511 | const revertMigration = () => { |
| 512 | (0,_migration_from_products_to_product_collection__WEBPACK_IMPORTED_MODULE_3__.disableAutoUpdate)(); |
| 513 | (0,_migration_utils__WEBPACK_IMPORTED_MODULE_2__.setUpgradeStatus)({ |
| 514 | status: 'reverted', |
| 515 | time: Date.now() |
| 516 | }); |
| 517 | replaceProductCollectionWithProducts(); |
| 518 | }; |
| 519 | |
| 520 | /***/ }), |
| 521 | |
| 522 | /***/ "./assets/js/blocks/migration-products-to-product-collection/migration-from-products-to-product-collection.ts": |
| 523 | /*!********************************************************************************************************************!*\ |
| 524 | !*** ./assets/js/blocks/migration-products-to-product-collection/migration-from-products-to-product-collection.ts ***! |
| 525 | \********************************************************************************************************************/ |
| 526 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 527 | |
| 528 | "use strict"; |
| 529 | __webpack_require__.r(__webpack_exports__); |
| 530 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 531 | /* harmony export */ disableAutoUpdate: () => (/* binding */ disableAutoUpdate), |
| 532 | /* harmony export */ enableAutoUpdate: () => (/* binding */ enableAutoUpdate), |
| 533 | /* harmony export */ manualUpdate: () => (/* binding */ manualUpdate), |
| 534 | /* harmony export */ replaceProductsWithProductCollection: () => (/* binding */ replaceProductsWithProductCollection) |
| 535 | /* harmony export */ }); |
| 536 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 537 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 538 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 539 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 540 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 541 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__); |
| 542 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "./assets/js/blocks/migration-products-to-product-collection/constants.ts"); |
| 543 | /* harmony import */ var _migration_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./migration-utils */ "./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts"); |
| 544 | /* harmony import */ var _product_collection_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../product-collection/constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 545 | /* harmony import */ var _product_collection_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../product-collection/types */ "./assets/js/blocks/product-collection/types.ts"); |
| 546 | /** |
| 547 | * External dependencies |
| 548 | */ |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | /** |
| 554 | * Internal dependencies |
| 555 | */ |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | const mapAttributes = attributes => { |
| 561 | const { |
| 562 | query, |
| 563 | namespace, |
| 564 | ...restAttributes |
| 565 | } = attributes; |
| 566 | const { |
| 567 | __woocommerceAttributes, |
| 568 | __woocommerceStockStatus, |
| 569 | __woocommerceOnSale, |
| 570 | include, |
| 571 | ...restQuery |
| 572 | } = query; |
| 573 | return { |
| 574 | ...restAttributes, |
| 575 | query: { |
| 576 | woocommerceAttributes: __woocommerceAttributes, |
| 577 | woocommerceStockStatus: __woocommerceStockStatus, |
| 578 | woocommerceOnSale: __woocommerceOnSale, |
| 579 | woocommerceHandPickedProducts: include, |
| 580 | taxQuery: {}, |
| 581 | isProductCollectionBlock: true, |
| 582 | ...restQuery |
| 583 | }, |
| 584 | convertedFromProducts: true |
| 585 | }; |
| 586 | }; |
| 587 | const isPostTemplate = ({ |
| 588 | name, |
| 589 | attributes |
| 590 | }) => name === 'core/post-template' && attributes.__woocommerceNamespace === 'woocommerce/product-query/product-template'; |
| 591 | const isPostTitle = ({ |
| 592 | name, |
| 593 | attributes |
| 594 | }) => name === 'core/post-title' && attributes.__woocommerceNamespace === 'woocommerce/product-query/product-title'; |
| 595 | const isPostSummary = ({ |
| 596 | name, |
| 597 | attributes |
| 598 | }) => name === 'core/post-excerpt' && attributes.__woocommerceNamespace === 'woocommerce/product-query/product-summary'; |
| 599 | const transformPostTemplate = (block, innerBlocks) => { |
| 600 | const { |
| 601 | __woocommerceNamespace, |
| 602 | className, |
| 603 | layout, |
| 604 | ...restAttrributes |
| 605 | } = block.attributes; |
| 606 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('woocommerce/product-template', restAttrributes, innerBlocks); |
| 607 | }; |
| 608 | const transformPostTitle = (block, innerBlocks) => { |
| 609 | const { |
| 610 | __woocommerceNamespace, |
| 611 | ...restAttrributes |
| 612 | } = block.attributes; |
| 613 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/post-title', { |
| 614 | __woocommerceNamespace: 'woocommerce/product-collection/product-title', |
| 615 | ...restAttrributes |
| 616 | }, innerBlocks); |
| 617 | }; |
| 618 | const transformPostSummary = (block, innerBlocks) => { |
| 619 | const { |
| 620 | __woocommerceNamespace, |
| 621 | ...restAttrributes |
| 622 | } = block.attributes; |
| 623 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('core/post-excerpt', { |
| 624 | __woocommerceNamespace: 'woocommerce/product-collection/product-summary', |
| 625 | ...restAttrributes |
| 626 | }, innerBlocks); |
| 627 | }; |
| 628 | const mapLayoutType = type => { |
| 629 | if (type === 'grid') { |
| 630 | return _product_collection_types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID; |
| 631 | } |
| 632 | if (type === 'default') { |
| 633 | return _product_collection_types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.STACK; |
| 634 | } |
| 635 | return _product_collection_types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID; |
| 636 | }; |
| 637 | const mapLayoutPropertiesFromPostTemplateToProductCollection = layout => { |
| 638 | if (layout === undefined) { |
| 639 | return _product_collection_constants__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_ATTRIBUTES.displayLayout; |
| 640 | } |
| 641 | const { |
| 642 | type, |
| 643 | columnCount |
| 644 | } = layout; |
| 645 | return { |
| 646 | type: mapLayoutType(type), |
| 647 | columns: columnCount |
| 648 | }; |
| 649 | }; |
| 650 | const getLayoutAttribute = (attributes, innerBlocks) => { |
| 651 | // Starting from GB 16, it's not Query Loop that keeps the layout, but the Post Template block. |
| 652 | // We need to account for that and in that case, move the layout properties |
| 653 | // from Post Template to Product Collection. |
| 654 | const postTemplate = innerBlocks.find(isPostTemplate); |
| 655 | const { |
| 656 | layout: postTemplateLayout |
| 657 | } = (postTemplate === null || postTemplate === void 0 ? void 0 : postTemplate.attributes) || {}; |
| 658 | return _migration_utils__WEBPACK_IMPORTED_MODULE_5__.postTemplateHasSupportForGridView ? mapLayoutPropertiesFromPostTemplateToProductCollection(postTemplateLayout) : attributes.displayLayout; |
| 659 | }; |
| 660 | const mapInnerBlocks = innerBlocks => { |
| 661 | const mappedInnerBlocks = innerBlocks.map(innerBlock => { |
| 662 | const { |
| 663 | name, |
| 664 | attributes |
| 665 | } = innerBlock; |
| 666 | const mappedInnerInnerBlocks = mapInnerBlocks(innerBlock.innerBlocks); |
| 667 | if (isPostTemplate(innerBlock)) { |
| 668 | return transformPostTemplate(innerBlock, mappedInnerInnerBlocks); |
| 669 | } |
| 670 | if (isPostTitle(innerBlock)) { |
| 671 | return transformPostTitle(innerBlock, mappedInnerInnerBlocks); |
| 672 | } |
| 673 | if (isPostSummary(innerBlock)) { |
| 674 | return transformPostSummary(innerBlock, mappedInnerInnerBlocks); |
| 675 | } |
| 676 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)(name, attributes, mappedInnerInnerBlocks); |
| 677 | }); |
| 678 | return mappedInnerBlocks; |
| 679 | }; |
| 680 | const replaceProductsBlock = clientId => { |
| 681 | const productsBlock = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getBlock(clientId); |
| 682 | const canBeInserted = (0,_migration_utils__WEBPACK_IMPORTED_MODULE_5__.checkIfBlockCanBeInserted)(clientId, 'woocommerce/product-collection'); |
| 683 | if (productsBlock && canBeInserted) { |
| 684 | const { |
| 685 | attributes = {}, |
| 686 | innerBlocks = [] |
| 687 | } = productsBlock; |
| 688 | const displayLayout = getLayoutAttribute(attributes, innerBlocks); |
| 689 | const adjustedAttributes = mapAttributes({ |
| 690 | ...attributes, |
| 691 | displayLayout |
| 692 | }); |
| 693 | const adjustedInnerBlocks = mapInnerBlocks(innerBlocks); |
| 694 | const productCollectionBlock = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.createBlock)('woocommerce/product-collection', adjustedAttributes, adjustedInnerBlocks); |
| 695 | (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('core/block-editor').replaceBlock(clientId, productCollectionBlock); |
| 696 | return true; |
| 697 | } |
| 698 | return false; |
| 699 | }; |
| 700 | const replaceProductsBlocks = productsBlockClientIds => { |
| 701 | const results = productsBlockClientIds.map(replaceProductsBlock); |
| 702 | return !!results.length && results.every(result => !!result); |
| 703 | }; |
| 704 | const replaceProductsWithProductCollection = () => { |
| 705 | const queryBlocksCount = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getGlobalBlockCount('core/query'); |
| 706 | if (queryBlocksCount === 0) { |
| 707 | return; |
| 708 | } |
| 709 | const blocks = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getBlocks(); |
| 710 | const productsBlockClientIds = (0,_migration_utils__WEBPACK_IMPORTED_MODULE_5__.getProductsBlockClientIds)(blocks); |
| 711 | const productsBlocksCount = productsBlockClientIds.length; |
| 712 | if (productsBlocksCount === 0) { |
| 713 | return; |
| 714 | } |
| 715 | replaceProductsBlocks(productsBlockClientIds); |
| 716 | }; |
| 717 | const manualUpdate = () => { |
| 718 | (0,_migration_utils__WEBPACK_IMPORTED_MODULE_5__.setUpgradeStatus)((0,_constants__WEBPACK_IMPORTED_MODULE_6__.getInitialStatusLSValue)()); |
| 719 | replaceProductsWithProductCollection(); |
| 720 | }; |
| 721 | let unsubscribe; |
| 722 | const disableAutoUpdate = () => { |
| 723 | if (unsubscribe) { |
| 724 | unsubscribe(); |
| 725 | } |
| 726 | }; |
| 727 | const enableAutoUpdate = () => { |
| 728 | if ((0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__.isWpVersion)('6.1', '>=')) { |
| 729 | const { |
| 730 | status |
| 731 | } = (0,_migration_utils__WEBPACK_IMPORTED_MODULE_5__.getUpgradeStatus)(); |
| 732 | if (_constants__WEBPACK_IMPORTED_MODULE_6__.AUTO_REPLACE_PRODUCTS_WITH_PRODUCT_COLLECTION && status !== 'reverted' && !unsubscribe) { |
| 733 | unsubscribe = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.subscribe)(() => { |
| 734 | replaceProductsWithProductCollection(); |
| 735 | }, 'core/block-editor'); |
| 736 | } |
| 737 | } |
| 738 | }; |
| 739 | |
| 740 | /***/ }), |
| 741 | |
| 742 | /***/ "./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts": |
| 743 | /*!**************************************************************************************!*\ |
| 744 | !*** ./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts ***! |
| 745 | \**************************************************************************************/ |
| 746 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 747 | |
| 748 | "use strict"; |
| 749 | __webpack_require__.r(__webpack_exports__); |
| 750 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 751 | /* harmony export */ checkIfBlockCanBeInserted: () => (/* binding */ checkIfBlockCanBeInserted), |
| 752 | /* harmony export */ getProductCollectionBlockClientIds: () => (/* binding */ getProductCollectionBlockClientIds), |
| 753 | /* harmony export */ getProductsBlockClientIds: () => (/* binding */ getProductsBlockClientIds), |
| 754 | /* harmony export */ getUpgradeStatus: () => (/* binding */ getUpgradeStatus), |
| 755 | /* harmony export */ incrementUpgradeStatusDisplayCount: () => (/* binding */ incrementUpgradeStatusDisplayCount), |
| 756 | /* harmony export */ postTemplateHasSupportForGridView: () => (/* binding */ postTemplateHasSupportForGridView), |
| 757 | /* harmony export */ setUpgradeStatus: () => (/* binding */ setUpgradeStatus) |
| 758 | /* harmony export */ }); |
| 759 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 760 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__); |
| 761 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 762 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 763 | /* harmony import */ var _woocommerce_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/types */ "./assets/js/types/type-guards/boolean.ts"); |
| 764 | /* harmony import */ var _woocommerce_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @woocommerce/types */ "./assets/js/types/type-guards/number.ts"); |
| 765 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./assets/js/blocks/migration-products-to-product-collection/constants.ts"); |
| 766 | /** |
| 767 | * External dependencies |
| 768 | */ |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | /** |
| 774 | * Internal dependencies |
| 775 | */ |
| 776 | |
| 777 | const isProductsBlock = block => block.name === 'core/query' && block.attributes.namespace === 'woocommerce/product-query'; |
| 778 | const isConvertedProductCollectionBlock = block => block.name === 'woocommerce/product-collection' && block.attributes.convertedFromProducts; |
| 779 | const getBlockClientIdsByPredicate = (blocks, predicate) => { |
| 780 | let clientIds = []; |
| 781 | blocks.forEach(block => { |
| 782 | if (predicate(block)) { |
| 783 | clientIds = [...clientIds, block.clientId]; |
| 784 | } |
| 785 | clientIds = [...clientIds, ...getBlockClientIdsByPredicate(block.innerBlocks, predicate)]; |
| 786 | }); |
| 787 | return clientIds; |
| 788 | }; |
| 789 | const getProductsBlockClientIds = blocks => getBlockClientIdsByPredicate(blocks, isProductsBlock); |
| 790 | const getProductCollectionBlockClientIds = blocks => getBlockClientIdsByPredicate(blocks, isConvertedProductCollectionBlock); |
| 791 | const checkIfBlockCanBeInserted = (clientId, blockToBeInserted) => { |
| 792 | // We need to duplicate checks that are happening within replaceBlocks method |
| 793 | // as replacement is initially blocked and there's no information returned |
| 794 | // that would determine if replacement happened or not. |
| 795 | // https://github.com/WordPress/gutenberg/issues/46740 |
| 796 | const rootClientId = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').getBlockRootClientId(clientId) || undefined; |
| 797 | return (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor').canInsertBlockType(blockToBeInserted, rootClientId); |
| 798 | }; |
| 799 | const postTemplateHasSupportForGridView = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSettingWithCoercion)('postTemplateHasSupportForGridView', false, _woocommerce_types__WEBPACK_IMPORTED_MODULE_2__.isBoolean); |
| 800 | const getUpgradeStatus = () => { |
| 801 | const status = window.localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_3__.MIGRATION_STATUS_LS_KEY); |
| 802 | return status ? JSON.parse(status) : (0,_constants__WEBPACK_IMPORTED_MODULE_3__.getInitialStatusLSValue)(); |
| 803 | }; |
| 804 | const setUpgradeStatus = newStatus => { |
| 805 | window.localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_3__.MIGRATION_STATUS_LS_KEY, JSON.stringify(newStatus)); |
| 806 | }; |
| 807 | const incrementUpgradeStatusDisplayCount = () => { |
| 808 | const status = getUpgradeStatus(); |
| 809 | const displayCount = (0,_woocommerce_types__WEBPACK_IMPORTED_MODULE_4__.isNumber)(status.displayCount) ? status.displayCount + 1 : 0; |
| 810 | setUpgradeStatus({ |
| 811 | ...status, |
| 812 | displayCount |
| 813 | }); |
| 814 | }; |
| 815 | |
| 816 | |
| 817 | /***/ }), |
| 818 | |
| 819 | /***/ "./assets/js/blocks/product-collection/constants.ts": |
| 820 | /*!**********************************************************!*\ |
| 821 | !*** ./assets/js/blocks/product-collection/constants.ts ***! |
| 822 | \**********************************************************/ |
| 823 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 824 | |
| 825 | "use strict"; |
| 826 | __webpack_require__.r(__webpack_exports__); |
| 827 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 828 | /* harmony export */ DEFAULT_ATTRIBUTES: () => (/* binding */ DEFAULT_ATTRIBUTES), |
| 829 | /* harmony export */ DEFAULT_FILTERS: () => (/* binding */ DEFAULT_FILTERS), |
| 830 | /* harmony export */ DEFAULT_QUERY: () => (/* binding */ DEFAULT_QUERY), |
| 831 | /* harmony export */ INNER_BLOCKS_NO_RESULTS_TEMPLATE: () => (/* binding */ INNER_BLOCKS_NO_RESULTS_TEMPLATE), |
| 832 | /* harmony export */ INNER_BLOCKS_PAGINATION_TEMPLATE: () => (/* binding */ INNER_BLOCKS_PAGINATION_TEMPLATE), |
| 833 | /* harmony export */ INNER_BLOCKS_PRODUCT_TEMPLATE: () => (/* binding */ INNER_BLOCKS_PRODUCT_TEMPLATE), |
| 834 | /* harmony export */ INNER_BLOCKS_TEMPLATE: () => (/* binding */ INNER_BLOCKS_TEMPLATE), |
| 835 | /* harmony export */ STOCK_STATUS_OPTIONS: () => (/* binding */ STOCK_STATUS_OPTIONS), |
| 836 | /* harmony export */ getDefaultDisplayLayout: () => (/* binding */ getDefaultDisplayLayout), |
| 837 | /* harmony export */ getDefaultProductCollection: () => (/* binding */ getDefaultProductCollection), |
| 838 | /* harmony export */ getDefaultQuery: () => (/* binding */ getDefaultQuery), |
| 839 | /* harmony export */ getDefaultSettings: () => (/* binding */ getDefaultSettings), |
| 840 | /* harmony export */ getDefaultStockStatuses: () => (/* binding */ getDefaultStockStatuses) |
| 841 | /* harmony export */ }); |
| 842 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 843 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__); |
| 844 | /* harmony import */ var _woocommerce_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/utils */ "./assets/js/utils/object-operations.ts"); |
| 845 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 846 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); |
| 847 | /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./types */ "./assets/js/blocks/product-collection/types.ts"); |
| 848 | /* harmony import */ var _atomic_blocks_product_elements_image_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../atomic/blocks/product-elements/image/types */ "./assets/js/atomic/blocks/product-elements/image/types.ts"); |
| 849 | /* harmony import */ var _variations_elements_product_title__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variations/elements/product-title */ "./assets/js/blocks/product-collection/variations/elements/product-title.tsx"); |
| 850 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./assets/js/blocks/product-collection/utils.tsx"); |
| 851 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./block.json */ "./assets/js/blocks/product-collection/block.json"); |
| 852 | /** |
| 853 | * External dependencies |
| 854 | */ |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | /** |
| 860 | * Internal dependencies |
| 861 | */ |
| 862 | |
| 863 | |
| 864 | |
| 865 | |
| 866 | |
| 867 | const STOCK_STATUS_OPTIONS = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('stockStatusOptions', []); |
| 868 | const GLOBAL_HIDE_OUT_OF_STOCK = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('hideOutOfStockItems', false); |
| 869 | const getDefaultStockStatuses = () => { |
| 870 | return GLOBAL_HIDE_OUT_OF_STOCK ? Object.keys((0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_3__.objectOmit)(STOCK_STATUS_OPTIONS, 'outofstock')) : Object.keys(STOCK_STATUS_OPTIONS); |
| 871 | }; |
| 872 | const DEFAULT_QUERY = { |
| 873 | perPage: 9, |
| 874 | pages: 0, |
| 875 | offset: 0, |
| 876 | postType: 'product', |
| 877 | order: 'asc', |
| 878 | orderBy: 'title', |
| 879 | search: '', |
| 880 | exclude: [], |
| 881 | inherit: null, |
| 882 | taxQuery: {}, |
| 883 | isProductCollectionBlock: true, |
| 884 | featured: false, |
| 885 | woocommerceOnSale: false, |
| 886 | woocommerceStockStatus: getDefaultStockStatuses(), |
| 887 | woocommerceAttributes: [], |
| 888 | woocommerceHandPickedProducts: [], |
| 889 | timeFrame: undefined |
| 890 | }; |
| 891 | const DEFAULT_ATTRIBUTES = { |
| 892 | query: DEFAULT_QUERY, |
| 893 | tagName: 'div', |
| 894 | displayLayout: { |
| 895 | type: _types__WEBPACK_IMPORTED_MODULE_4__.LayoutOptions.GRID, |
| 896 | columns: 3, |
| 897 | shrinkColumns: true |
| 898 | } |
| 899 | }; |
| 900 | const getDefaultQuery = currentQuery => ({ |
| 901 | ...currentQuery, |
| 902 | orderBy: DEFAULT_QUERY.orderBy, |
| 903 | order: DEFAULT_QUERY.order, |
| 904 | inherit: (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getDefaultValueOfInheritQueryFromTemplate)() |
| 905 | }); |
| 906 | const getDefaultDisplayLayout = () => DEFAULT_ATTRIBUTES.displayLayout; |
| 907 | const getDefaultSettings = currentAttributes => ({ |
| 908 | displayLayout: getDefaultDisplayLayout(), |
| 909 | query: getDefaultQuery(currentAttributes.query) |
| 910 | }); |
| 911 | const DEFAULT_FILTERS = { |
| 912 | woocommerceOnSale: DEFAULT_QUERY.woocommerceOnSale, |
| 913 | woocommerceStockStatus: getDefaultStockStatuses(), |
| 914 | woocommerceAttributes: [], |
| 915 | taxQuery: DEFAULT_QUERY.taxQuery, |
| 916 | woocommerceHandPickedProducts: [], |
| 917 | featured: DEFAULT_QUERY.featured, |
| 918 | timeFrame: undefined |
| 919 | }; |
| 920 | |
| 921 | /** |
| 922 | * Default inner block templates for the product collection block. |
| 923 | * Exported for use in different collections, e.g., 'New Arrivals' collection. |
| 924 | */ |
| 925 | const INNER_BLOCKS_PRODUCT_TEMPLATE = ['woocommerce/product-template', {}, [['woocommerce/product-image', { |
| 926 | imageSizing: _atomic_blocks_product_elements_image_types__WEBPACK_IMPORTED_MODULE_2__.ImageSizing.THUMBNAIL |
| 927 | }], ['core/post-title', { |
| 928 | textAlign: 'center', |
| 929 | level: 3, |
| 930 | fontSize: 'medium', |
| 931 | style: { |
| 932 | spacing: { |
| 933 | margin: { |
| 934 | bottom: '0.75rem', |
| 935 | top: '0' |
| 936 | } |
| 937 | } |
| 938 | }, |
| 939 | isLink: true, |
| 940 | __woocommerceNamespace: _variations_elements_product_title__WEBPACK_IMPORTED_MODULE_6__.VARIATION_NAME |
| 941 | }], ['woocommerce/product-price', { |
| 942 | textAlign: 'center', |
| 943 | fontSize: 'small' |
| 944 | }], ['woocommerce/product-button', { |
| 945 | textAlign: 'center', |
| 946 | fontSize: 'small' |
| 947 | }]]]; |
| 948 | const INNER_BLOCKS_PAGINATION_TEMPLATE = ['core/query-pagination', { |
| 949 | layout: { |
| 950 | type: 'flex', |
| 951 | justifyContent: 'center' |
| 952 | } |
| 953 | }]; |
| 954 | const INNER_BLOCKS_NO_RESULTS_TEMPLATE = ['woocommerce/product-collection-no-results']; |
| 955 | const INNER_BLOCKS_TEMPLATE = [INNER_BLOCKS_PRODUCT_TEMPLATE, INNER_BLOCKS_PAGINATION_TEMPLATE, INNER_BLOCKS_NO_RESULTS_TEMPLATE]; |
| 956 | const getDefaultProductCollection = () => (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.createBlock)(_block_json__WEBPACK_IMPORTED_MODULE_7__.name, { |
| 957 | ...DEFAULT_ATTRIBUTES, |
| 958 | query: { |
| 959 | ...DEFAULT_ATTRIBUTES.query, |
| 960 | inherit: (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getDefaultValueOfInheritQueryFromTemplate)() |
| 961 | } |
| 962 | }, (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.createBlocksFromInnerBlocksTemplate)(INNER_BLOCKS_TEMPLATE)); |
| 963 | |
| 964 | /***/ }), |
| 965 | |
| 966 | /***/ "./assets/js/blocks/product-collection/edit/index.tsx": |
| 967 | /*!************************************************************!*\ |
| 968 | !*** ./assets/js/blocks/product-collection/edit/index.tsx ***! |
| 969 | \************************************************************/ |
| 970 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 971 | |
| 972 | "use strict"; |
| 973 | __webpack_require__.r(__webpack_exports__); |
| 974 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 975 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 976 | /* harmony export */ }); |
| 977 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 978 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 979 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 980 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| 981 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 982 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__); |
| 983 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 984 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 985 | /* harmony import */ var _inspector_controls__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./inspector-controls */ "./assets/js/blocks/product-collection/edit/inspector-controls/index.tsx"); |
| 986 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 987 | /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./assets/js/blocks/product-collection/edit/editor.scss"); |
| 988 | /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_editor_scss__WEBPACK_IMPORTED_MODULE_4__); |
| 989 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils */ "./assets/js/blocks/product-collection/utils.tsx"); |
| 990 | /* harmony import */ var _toolbar_controls__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./toolbar-controls */ "./assets/js/blocks/product-collection/edit/toolbar-controls/index.tsx"); |
| 991 | |
| 992 | /** |
| 993 | * External dependencies |
| 994 | */ |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | /** |
| 1000 | * Internal dependencies |
| 1001 | */ |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | const Edit = props => { |
| 1009 | var _attributes$query; |
| 1010 | const { |
| 1011 | attributes, |
| 1012 | setAttributes |
| 1013 | } = props; |
| 1014 | const { |
| 1015 | queryId |
| 1016 | } = attributes; |
| 1017 | const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)(); |
| 1018 | const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useInnerBlocksProps)(blockProps, { |
| 1019 | template: _constants__WEBPACK_IMPORTED_MODULE_5__.INNER_BLOCKS_TEMPLATE |
| 1020 | }); |
| 1021 | const instanceId = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__.useInstanceId)(Edit); |
| 1022 | |
| 1023 | // We need this for multi-query block pagination. |
| 1024 | // Query parameters for each block are scoped to their ID. |
| 1025 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useEffect)(() => { |
| 1026 | if (!Number.isFinite(queryId)) { |
| 1027 | setAttributes({ |
| 1028 | queryId: Number(instanceId) |
| 1029 | }); |
| 1030 | } |
| 1031 | }, [queryId, instanceId, setAttributes]); |
| 1032 | |
| 1033 | /** |
| 1034 | * Because of issue https://github.com/WordPress/gutenberg/issues/7342, |
| 1035 | * We are using this workaround to set default attributes. |
| 1036 | */ |
| 1037 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useEffect)(() => { |
| 1038 | setAttributes({ |
| 1039 | ..._constants__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_ATTRIBUTES, |
| 1040 | query: { |
| 1041 | ..._constants__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_ATTRIBUTES.query, |
| 1042 | inherit: (0,_utils__WEBPACK_IMPORTED_MODULE_6__.getDefaultValueOfInheritQueryFromTemplate)() |
| 1043 | }, |
| 1044 | ...attributes |
| 1045 | }); |
| 1046 | // We don't wanna add attributes as a dependency here. |
| 1047 | // Because we want this to run only once. |
| 1048 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 1049 | }, [setAttributes]); |
| 1050 | |
| 1051 | /** |
| 1052 | * If inherit is not a boolean, then we haven't set default attributes yet. |
| 1053 | * We don't wanna render anything until default attributes are set. |
| 1054 | * Default attributes are set in the useEffect above. |
| 1055 | */ |
| 1056 | if (typeof (attributes === null || attributes === void 0 ? void 0 : (_attributes$query = attributes.query) === null || _attributes$query === void 0 ? void 0 : _attributes$query.inherit) !== 'boolean') return null; |
| 1057 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 1058 | ...blockProps |
| 1059 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_inspector_controls__WEBPACK_IMPORTED_MODULE_7__["default"], { |
| 1060 | ...props |
| 1061 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_toolbar_controls__WEBPACK_IMPORTED_MODULE_8__["default"], { |
| 1062 | ...props |
| 1063 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 1064 | ...innerBlocksProps |
| 1065 | })); |
| 1066 | }; |
| 1067 | Edit.__docgenInfo = { |
| 1068 | "description": "", |
| 1069 | "methods": [], |
| 1070 | "displayName": "Edit" |
| 1071 | }; |
| 1072 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit); |
| 1073 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1074 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/index.tsx"] = { |
| 1075 | name: "Edit", |
| 1076 | docgenInfo: Edit.__docgenInfo, |
| 1077 | path: "assets/js/blocks/product-collection/edit/index.tsx" |
| 1078 | }; |
| 1079 | } |
| 1080 | |
| 1081 | /***/ }), |
| 1082 | |
| 1083 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/attributes-control.tsx": |
| 1084 | /*!********************************************************************************************!*\ |
| 1085 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/attributes-control.tsx ***! |
| 1086 | \********************************************************************************************/ |
| 1087 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1088 | |
| 1089 | "use strict"; |
| 1090 | __webpack_require__.r(__webpack_exports__); |
| 1091 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1092 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1093 | /* harmony export */ }); |
| 1094 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1095 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1096 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1097 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1098 | /* harmony import */ var _woocommerce_editor_components_product_attribute_term_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @woocommerce/editor-components/product-attribute-term-control */ "./assets/js/editor-components/product-attribute-term-control/index.tsx"); |
| 1099 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 1100 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__); |
| 1101 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1102 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); |
| 1103 | |
| 1104 | /** |
| 1105 | * External dependencies |
| 1106 | */ |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | /** |
| 1113 | * Internal dependencies |
| 1114 | */ |
| 1115 | |
| 1116 | const EDIT_ATTRIBUTES_URL = `${_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__.ADMIN_URL}edit.php?post_type=product&page=product_attributes`; |
| 1117 | const AttributesControl = ({ |
| 1118 | query, |
| 1119 | setQueryAttribute |
| 1120 | }) => { |
| 1121 | const woocommerceAttributes = query.woocommerceAttributes || []; |
| 1122 | const selectedAttributes = woocommerceAttributes === null || woocommerceAttributes === void 0 ? void 0 : woocommerceAttributes.map(({ |
| 1123 | termId: id |
| 1124 | }) => ({ |
| 1125 | id |
| 1126 | })); |
| 1127 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.__experimentalToolsPanelItem, { |
| 1128 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Product Attributes', 'woocommerce'), |
| 1129 | hasValue: () => !!(woocommerceAttributes !== null && woocommerceAttributes !== void 0 && woocommerceAttributes.length) |
| 1130 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_product_attribute_term_control__WEBPACK_IMPORTED_MODULE_4__["default"], { |
| 1131 | messages: { |
| 1132 | search: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Attributes', 'woocommerce') |
| 1133 | }, |
| 1134 | selected: selectedAttributes || [], |
| 1135 | onChange: searchListItems => { |
| 1136 | const newValue = searchListItems.map(({ |
| 1137 | id, |
| 1138 | value |
| 1139 | }) => ({ |
| 1140 | termId: id, |
| 1141 | taxonomy: value |
| 1142 | })); |
| 1143 | setQueryAttribute({ |
| 1144 | woocommerceAttributes: newValue |
| 1145 | }); |
| 1146 | }, |
| 1147 | operator: 'any', |
| 1148 | isCompact: true, |
| 1149 | type: 'token' |
| 1150 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ExternalLink, { |
| 1151 | className: "wc-block-editor-product-collection-panel__manage-attributes-link", |
| 1152 | href: EDIT_ATTRIBUTES_URL |
| 1153 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Manage attributes', 'woocommerce'))); |
| 1154 | }; |
| 1155 | AttributesControl.__docgenInfo = { |
| 1156 | "description": "", |
| 1157 | "methods": [], |
| 1158 | "displayName": "AttributesControl" |
| 1159 | }; |
| 1160 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AttributesControl); |
| 1161 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1162 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/attributes-control.tsx"] = { |
| 1163 | name: "AttributesControl", |
| 1164 | docgenInfo: AttributesControl.__docgenInfo, |
| 1165 | path: "assets/js/blocks/product-collection/edit/inspector-controls/attributes-control.tsx" |
| 1166 | }; |
| 1167 | } |
| 1168 | |
| 1169 | /***/ }), |
| 1170 | |
| 1171 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/columns-control.tsx": |
| 1172 | /*!*****************************************************************************************!*\ |
| 1173 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/columns-control.tsx ***! |
| 1174 | \*****************************************************************************************/ |
| 1175 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1176 | |
| 1177 | "use strict"; |
| 1178 | __webpack_require__.r(__webpack_exports__); |
| 1179 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1180 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1181 | /* harmony export */ }); |
| 1182 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1183 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1184 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1185 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1186 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1187 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 1188 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 1189 | |
| 1190 | /** |
| 1191 | * External dependencies |
| 1192 | */ |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | /** |
| 1197 | * Internal dependencies |
| 1198 | */ |
| 1199 | |
| 1200 | |
| 1201 | const columnsLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Columns', 'woocommerce'); |
| 1202 | const toggleLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Responsive', 'woocommerce'); |
| 1203 | const toggleHelp = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Automatically adjust the number of columns to better fit smaller screens.', 'woocommerce'); |
| 1204 | const ColumnsControl = props => { |
| 1205 | const { |
| 1206 | type, |
| 1207 | columns, |
| 1208 | shrinkColumns |
| 1209 | } = props.displayLayout; |
| 1210 | const showColumnsControl = type === 'flex'; |
| 1211 | const defaultLayout = (0,_constants__WEBPACK_IMPORTED_MODULE_3__.getDefaultDisplayLayout)(); |
| 1212 | const onShrinkColumnsToggleChange = value => { |
| 1213 | props.setAttributes({ |
| 1214 | displayLayout: { |
| 1215 | ...props.displayLayout, |
| 1216 | shrinkColumns: value |
| 1217 | } |
| 1218 | }); |
| 1219 | }; |
| 1220 | const onPanelDeselect = () => { |
| 1221 | props.setAttributes({ |
| 1222 | displayLayout: defaultLayout |
| 1223 | }); |
| 1224 | }; |
| 1225 | const onColumnsChange = value => props.setAttributes({ |
| 1226 | displayLayout: { |
| 1227 | ...props.displayLayout, |
| 1228 | columns: value |
| 1229 | } |
| 1230 | }); |
| 1231 | return showColumnsControl ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 1232 | label: columnsLabel, |
| 1233 | hasValue: () => (defaultLayout === null || defaultLayout === void 0 ? void 0 : defaultLayout.columns) !== columns, |
| 1234 | isShownByDefault: true, |
| 1235 | onDeselect: onPanelDeselect |
| 1236 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RangeControl, { |
| 1237 | label: columnsLabel, |
| 1238 | onChange: onColumnsChange, |
| 1239 | value: columns, |
| 1240 | min: 2, |
| 1241 | max: Math.max(6, columns) |
| 1242 | })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 1243 | label: toggleLabel, |
| 1244 | hasValue: () => (defaultLayout === null || defaultLayout === void 0 ? void 0 : defaultLayout.shrinkColumns) !== shrinkColumns, |
| 1245 | isShownByDefault: true, |
| 1246 | onDeselect: onPanelDeselect |
| 1247 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 1248 | checked: !!shrinkColumns, |
| 1249 | label: toggleLabel, |
| 1250 | help: toggleHelp, |
| 1251 | onChange: onShrinkColumnsToggleChange |
| 1252 | }))) : null; |
| 1253 | }; |
| 1254 | ColumnsControl.__docgenInfo = { |
| 1255 | "description": "", |
| 1256 | "methods": [], |
| 1257 | "displayName": "ColumnsControl" |
| 1258 | }; |
| 1259 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ColumnsControl); |
| 1260 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1261 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/columns-control.tsx"] = { |
| 1262 | name: "ColumnsControl", |
| 1263 | docgenInfo: ColumnsControl.__docgenInfo, |
| 1264 | path: "assets/js/blocks/product-collection/edit/inspector-controls/columns-control.tsx" |
| 1265 | }; |
| 1266 | } |
| 1267 | |
| 1268 | /***/ }), |
| 1269 | |
| 1270 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/created-control.tsx": |
| 1271 | /*!*****************************************************************************************!*\ |
| 1272 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/created-control.tsx ***! |
| 1273 | \*****************************************************************************************/ |
| 1274 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1275 | |
| 1276 | "use strict"; |
| 1277 | __webpack_require__.r(__webpack_exports__); |
| 1278 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1279 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1280 | /* harmony export */ }); |
| 1281 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1282 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1283 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1284 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1285 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1286 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 1287 | /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../types */ "./assets/js/blocks/product-collection/types.ts"); |
| 1288 | |
| 1289 | /** |
| 1290 | * External dependencies |
| 1291 | */ |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | /** |
| 1296 | * Internal dependencies |
| 1297 | */ |
| 1298 | |
| 1299 | const CreatedControl = props => { |
| 1300 | const { |
| 1301 | query, |
| 1302 | setQueryAttribute |
| 1303 | } = props; |
| 1304 | const { |
| 1305 | timeFrame |
| 1306 | } = query; |
| 1307 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 1308 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Created', 'woocommerce'), |
| 1309 | hasValue: () => (timeFrame === null || timeFrame === void 0 ? void 0 : timeFrame.operator) && (timeFrame === null || timeFrame === void 0 ? void 0 : timeFrame.value), |
| 1310 | onDeselect: () => { |
| 1311 | setQueryAttribute({ |
| 1312 | timeFrame: undefined |
| 1313 | }); |
| 1314 | } |
| 1315 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Flex, { |
| 1316 | direction: "column", |
| 1317 | gap: 3 |
| 1318 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, { |
| 1319 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Created', 'woocommerce'), |
| 1320 | isBlock: true, |
| 1321 | onChange: value => { |
| 1322 | setQueryAttribute({ |
| 1323 | timeFrame: { |
| 1324 | ...timeFrame, |
| 1325 | operator: value |
| 1326 | } |
| 1327 | }); |
| 1328 | }, |
| 1329 | value: (timeFrame === null || timeFrame === void 0 ? void 0 : timeFrame.operator) || _types__WEBPACK_IMPORTED_MODULE_3__.ETimeFrameOperator.IN |
| 1330 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, { |
| 1331 | value: _types__WEBPACK_IMPORTED_MODULE_3__.ETimeFrameOperator.IN, |
| 1332 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__._x)('Within', 'Product Collection query operator', 'woocommerce') |
| 1333 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, { |
| 1334 | value: _types__WEBPACK_IMPORTED_MODULE_3__.ETimeFrameOperator.NOT_IN, |
| 1335 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__._x)('Before', 'Product Collection query operator', 'woocommerce') |
| 1336 | }))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RadioControl, { |
| 1337 | onChange: value => { |
| 1338 | setQueryAttribute({ |
| 1339 | timeFrame: { |
| 1340 | operator: _types__WEBPACK_IMPORTED_MODULE_3__.ETimeFrameOperator.IN, |
| 1341 | ...timeFrame, |
| 1342 | value |
| 1343 | } |
| 1344 | }); |
| 1345 | }, |
| 1346 | options: [{ |
| 1347 | label: 'last 24 hours', |
| 1348 | value: '-1 day' |
| 1349 | }, { |
| 1350 | label: 'last 7 days', |
| 1351 | value: '-7 days' |
| 1352 | }, { |
| 1353 | label: 'last 30 days', |
| 1354 | value: '-30 days' |
| 1355 | }, { |
| 1356 | label: 'last 3 months', |
| 1357 | value: '-3 months' |
| 1358 | }], |
| 1359 | selected: timeFrame === null || timeFrame === void 0 ? void 0 : timeFrame.value |
| 1360 | })))); |
| 1361 | }; |
| 1362 | CreatedControl.__docgenInfo = { |
| 1363 | "description": "", |
| 1364 | "methods": [], |
| 1365 | "displayName": "CreatedControl" |
| 1366 | }; |
| 1367 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CreatedControl); |
| 1368 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1369 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/created-control.tsx"] = { |
| 1370 | name: "CreatedControl", |
| 1371 | docgenInfo: CreatedControl.__docgenInfo, |
| 1372 | path: "assets/js/blocks/product-collection/edit/inspector-controls/created-control.tsx" |
| 1373 | }; |
| 1374 | } |
| 1375 | |
| 1376 | /***/ }), |
| 1377 | |
| 1378 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/featured-products-control.tsx": |
| 1379 | /*!***************************************************************************************************!*\ |
| 1380 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/featured-products-control.tsx ***! |
| 1381 | \***************************************************************************************************/ |
| 1382 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1383 | |
| 1384 | "use strict"; |
| 1385 | __webpack_require__.r(__webpack_exports__); |
| 1386 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1387 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1388 | /* harmony export */ }); |
| 1389 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1390 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1391 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1392 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1393 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1394 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 1395 | |
| 1396 | /** |
| 1397 | * External dependencies |
| 1398 | */ |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | /** |
| 1403 | * Internal dependencies |
| 1404 | */ |
| 1405 | |
| 1406 | const FeaturedProductsControl = props => { |
| 1407 | const { |
| 1408 | query, |
| 1409 | setQueryAttribute |
| 1410 | } = props; |
| 1411 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 1412 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured', 'woocommerce'), |
| 1413 | hasValue: () => query.featured === true, |
| 1414 | onDeselect: () => { |
| 1415 | setQueryAttribute({ |
| 1416 | featured: false |
| 1417 | }); |
| 1418 | } |
| 1419 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, { |
| 1420 | id: "product-collection-featured-products-control", |
| 1421 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured', 'woocommerce') |
| 1422 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 1423 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show only featured products', 'woocommerce'), |
| 1424 | checked: query.featured || false, |
| 1425 | onChange: featured => { |
| 1426 | setQueryAttribute({ |
| 1427 | featured |
| 1428 | }); |
| 1429 | } |
| 1430 | }))); |
| 1431 | }; |
| 1432 | FeaturedProductsControl.__docgenInfo = { |
| 1433 | "description": "", |
| 1434 | "methods": [], |
| 1435 | "displayName": "FeaturedProductsControl" |
| 1436 | }; |
| 1437 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FeaturedProductsControl); |
| 1438 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1439 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/featured-products-control.tsx"] = { |
| 1440 | name: "FeaturedProductsControl", |
| 1441 | docgenInfo: FeaturedProductsControl.__docgenInfo, |
| 1442 | path: "assets/js/blocks/product-collection/edit/inspector-controls/featured-products-control.tsx" |
| 1443 | }; |
| 1444 | } |
| 1445 | |
| 1446 | /***/ }), |
| 1447 | |
| 1448 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/hand-picked-products-control.tsx": |
| 1449 | /*!******************************************************************************************************!*\ |
| 1450 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/hand-picked-products-control.tsx ***! |
| 1451 | \******************************************************************************************************/ |
| 1452 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1453 | |
| 1454 | "use strict"; |
| 1455 | __webpack_require__.r(__webpack_exports__); |
| 1456 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1457 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1458 | /* harmony export */ }); |
| 1459 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1460 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1461 | /* harmony import */ var _woocommerce_editor_components_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @woocommerce/editor-components/utils */ "./assets/js/editor-components/utils/index.js"); |
| 1462 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); |
| 1463 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_1__); |
| 1464 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 1465 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); |
| 1466 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1467 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); |
| 1468 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1469 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); |
| 1470 | |
| 1471 | /** |
| 1472 | * External dependencies |
| 1473 | */ |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | /** |
| 1481 | * Internal dependencies |
| 1482 | */ |
| 1483 | |
| 1484 | /** |
| 1485 | * Returns: |
| 1486 | * - productsMap: Map of products by id and name. |
| 1487 | * - productsList: List of products retrieved. |
| 1488 | */ |
| 1489 | function useProducts() { |
| 1490 | // Creating a map for fast lookup of products by id or name. |
| 1491 | const [productsMap, setProductsMap] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(new Map()); |
| 1492 | |
| 1493 | // List of products retrieved |
| 1494 | const [productsList, setProductsList] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)([]); |
| 1495 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { |
| 1496 | (0,_woocommerce_editor_components_utils__WEBPACK_IMPORTED_MODULE_5__.getProducts)({ |
| 1497 | selected: [] |
| 1498 | }).then(results => { |
| 1499 | const newProductsMap = new Map(); |
| 1500 | results.forEach(product => { |
| 1501 | newProductsMap.set(product.id, product); |
| 1502 | newProductsMap.set(product.name, product); |
| 1503 | }); |
| 1504 | setProductsList(results); |
| 1505 | setProductsMap(newProductsMap); |
| 1506 | }); |
| 1507 | }, []); |
| 1508 | return { |
| 1509 | productsMap, |
| 1510 | productsList |
| 1511 | }; |
| 1512 | } |
| 1513 | const HandPickedProductsControl = ({ |
| 1514 | query, |
| 1515 | setQueryAttribute |
| 1516 | }) => { |
| 1517 | const selectedProductIds = query.woocommerceHandPickedProducts; |
| 1518 | const { |
| 1519 | productsMap, |
| 1520 | productsList |
| 1521 | } = useProducts(); |
| 1522 | const onTokenChange = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useCallback)(values => { |
| 1523 | // Map the tokens to product ids. |
| 1524 | const newHandPickedProductsSet = values.reduce((acc, nameOrId) => { |
| 1525 | const product = productsMap.get(nameOrId) || productsMap.get(Number(nameOrId)); |
| 1526 | if (product) acc.add(String(product.id)); |
| 1527 | return acc; |
| 1528 | }, new Set()); |
| 1529 | setQueryAttribute({ |
| 1530 | woocommerceHandPickedProducts: Array.from(newHandPickedProductsSet) |
| 1531 | }); |
| 1532 | }, [setQueryAttribute, productsMap]); |
| 1533 | const suggestions = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => { |
| 1534 | return productsList |
| 1535 | // Filter out products that are already selected. |
| 1536 | .filter(product => !(selectedProductIds !== null && selectedProductIds !== void 0 && selectedProductIds.includes(String(product.id)))).map(product => product.name); |
| 1537 | }, [productsList, selectedProductIds]); |
| 1538 | |
| 1539 | /** |
| 1540 | * Transforms a token into a product name. |
| 1541 | * - If the token is a number, it will be used to lookup the product name. |
| 1542 | * - Otherwise, the token will be used as is. |
| 1543 | */ |
| 1544 | const transformTokenIntoProductName = token => { |
| 1545 | const parsedToken = Number(token); |
| 1546 | if (Number.isNaN(parsedToken)) { |
| 1547 | return (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_1__.decodeEntities)(token) || ''; |
| 1548 | } |
| 1549 | const product = productsMap.get(parsedToken); |
| 1550 | return (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_1__.decodeEntities)(product === null || product === void 0 ? void 0 : product.name) || ''; |
| 1551 | }; |
| 1552 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToolsPanelItem, { |
| 1553 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Hand-picked Products', 'woocommerce'), |
| 1554 | hasValue: () => !!(selectedProductIds !== null && selectedProductIds !== void 0 && selectedProductIds.length), |
| 1555 | onDeselect: () => { |
| 1556 | setQueryAttribute({ |
| 1557 | woocommerceHandPickedProducts: [] |
| 1558 | }); |
| 1559 | } |
| 1560 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FormTokenField, { |
| 1561 | disabled: !productsMap.size, |
| 1562 | displayTransform: transformTokenIntoProductName, |
| 1563 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Hand-picked Products', 'woocommerce'), |
| 1564 | onChange: onTokenChange, |
| 1565 | suggestions: suggestions |
| 1566 | // @ts-expect-error Using experimental features |
| 1567 | , |
| 1568 | __experimentalValidateInput: value => productsMap.has(value), |
| 1569 | value: !productsMap.size ? [(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Loading…', 'woocommerce')] : selectedProductIds || [], |
| 1570 | __experimentalExpandOnFocus: true, |
| 1571 | __experimentalShowHowTo: false |
| 1572 | })); |
| 1573 | }; |
| 1574 | HandPickedProductsControl.__docgenInfo = { |
| 1575 | "description": "", |
| 1576 | "methods": [], |
| 1577 | "displayName": "HandPickedProductsControl" |
| 1578 | }; |
| 1579 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HandPickedProductsControl); |
| 1580 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1581 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/hand-picked-products-control.tsx"] = { |
| 1582 | name: "HandPickedProductsControl", |
| 1583 | docgenInfo: HandPickedProductsControl.__docgenInfo, |
| 1584 | path: "assets/js/blocks/product-collection/edit/inspector-controls/hand-picked-products-control.tsx" |
| 1585 | }; |
| 1586 | } |
| 1587 | |
| 1588 | /***/ }), |
| 1589 | |
| 1590 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/index.tsx": |
| 1591 | /*!*******************************************************************************!*\ |
| 1592 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/index.tsx ***! |
| 1593 | \*******************************************************************************/ |
| 1594 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1595 | |
| 1596 | "use strict"; |
| 1597 | __webpack_require__.r(__webpack_exports__); |
| 1598 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1599 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), |
| 1600 | /* harmony export */ withUpgradeNoticeControls: () => (/* binding */ withUpgradeNoticeControls) |
| 1601 | /* harmony export */ }); |
| 1602 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1603 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1604 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 1605 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| 1606 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1607 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); |
| 1608 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 1609 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 1610 | /* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); |
| 1611 | /* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_4__); |
| 1612 | /* harmony import */ var _woocommerce_editor_components_feedback_prompt__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @woocommerce/editor-components/feedback-prompt */ "./assets/js/editor-components/feedback-prompt/index.tsx"); |
| 1613 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/migration-from-products-to-product-collection.ts"); |
| 1614 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/constants.ts"); |
| 1615 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts"); |
| 1616 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/migration-from-product-collection-to-products.ts"); |
| 1617 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1618 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); |
| 1619 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../block.json */ "./assets/js/blocks/product-collection/block.json"); |
| 1620 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./assets/js/blocks/product-collection/utils.tsx"); |
| 1621 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 1622 | /* harmony import */ var _upgrade_notice__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./upgrade-notice */ "./assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx"); |
| 1623 | /* harmony import */ var _columns_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./columns-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/columns-control.tsx"); |
| 1624 | /* harmony import */ var _inherit_query_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./inherit-query-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx"); |
| 1625 | /* harmony import */ var _order_by_control__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./order-by-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/order-by-control.tsx"); |
| 1626 | /* harmony import */ var _on_sale_control__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./on-sale-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/on-sale-control.tsx"); |
| 1627 | /* harmony import */ var _stock_status_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./stock-status-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/stock-status-control.tsx"); |
| 1628 | /* harmony import */ var _keyword_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./keyword-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/keyword-control.tsx"); |
| 1629 | /* harmony import */ var _attributes_control__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./attributes-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/attributes-control.tsx"); |
| 1630 | /* harmony import */ var _taxonomy_controls__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./taxonomy-controls */ "./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/index.tsx"); |
| 1631 | /* harmony import */ var _hand_picked_products_control__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./hand-picked-products-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/hand-picked-products-control.tsx"); |
| 1632 | /* harmony import */ var _layout_options_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./layout-options-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/layout-options-control.tsx"); |
| 1633 | /* harmony import */ var _featured_products_control__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./featured-products-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/featured-products-control.tsx"); |
| 1634 | /* harmony import */ var _created_control__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./created-control */ "./assets/js/blocks/product-collection/edit/inspector-controls/created-control.tsx"); |
| 1635 | |
| 1636 | /** |
| 1637 | * External dependencies |
| 1638 | */ |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | |
| 1648 | /** |
| 1649 | * Internal dependencies |
| 1650 | */ |
| 1651 | |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | const ProductCollectionInspectorControls = props => { |
| 1668 | const query = props.attributes.query; |
| 1669 | const inherit = query === null || query === void 0 ? void 0 : query.inherit; |
| 1670 | const displayQueryControls = inherit === false; |
| 1671 | const setQueryAttributeBind = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)(() => _utils__WEBPACK_IMPORTED_MODULE_6__.setQueryAttribute.bind(null, props), [props]); |
| 1672 | const displayControlProps = { |
| 1673 | setAttributes: props.setAttributes, |
| 1674 | displayLayout: props.attributes.displayLayout |
| 1675 | }; |
| 1676 | const queryControlProps = { |
| 1677 | setQueryAttribute: setQueryAttributeBind, |
| 1678 | query |
| 1679 | }; |
| 1680 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.__experimentalToolsPanel, { |
| 1681 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Settings', 'woocommerce'), |
| 1682 | resetAll: () => { |
| 1683 | const defaultSettings = (0,_constants__WEBPACK_IMPORTED_MODULE_7__.getDefaultSettings)(props.attributes); |
| 1684 | props.setAttributes(defaultSettings); |
| 1685 | } |
| 1686 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_layout_options_control__WEBPACK_IMPORTED_MODULE_8__["default"], { |
| 1687 | ...displayControlProps |
| 1688 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_columns_control__WEBPACK_IMPORTED_MODULE_9__["default"], { |
| 1689 | ...displayControlProps |
| 1690 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_inherit_query_control__WEBPACK_IMPORTED_MODULE_10__["default"], { |
| 1691 | ...queryControlProps |
| 1692 | }), displayQueryControls ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_order_by_control__WEBPACK_IMPORTED_MODULE_11__["default"], { |
| 1693 | ...queryControlProps |
| 1694 | }) : null), displayQueryControls ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.__experimentalToolsPanel, { |
| 1695 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Filters', 'woocommerce'), |
| 1696 | resetAll: resetAllFilters => { |
| 1697 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.setQueryAttribute)(props, _constants__WEBPACK_IMPORTED_MODULE_7__.DEFAULT_FILTERS); |
| 1698 | resetAllFilters.forEach(resetFilter => resetFilter()); |
| 1699 | }, |
| 1700 | className: "wc-block-editor-product-collection-inspector-toolspanel__filters" |
| 1701 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_on_sale_control__WEBPACK_IMPORTED_MODULE_12__["default"], { |
| 1702 | ...queryControlProps |
| 1703 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_stock_status_control__WEBPACK_IMPORTED_MODULE_13__["default"], { |
| 1704 | ...queryControlProps |
| 1705 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_hand_picked_products_control__WEBPACK_IMPORTED_MODULE_14__["default"], { |
| 1706 | ...queryControlProps |
| 1707 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_keyword_control__WEBPACK_IMPORTED_MODULE_15__["default"], { |
| 1708 | ...queryControlProps |
| 1709 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_attributes_control__WEBPACK_IMPORTED_MODULE_16__["default"], { |
| 1710 | ...queryControlProps |
| 1711 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_taxonomy_controls__WEBPACK_IMPORTED_MODULE_17__["default"], { |
| 1712 | ...queryControlProps |
| 1713 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_featured_products_control__WEBPACK_IMPORTED_MODULE_18__["default"], { |
| 1714 | ...queryControlProps |
| 1715 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_created_control__WEBPACK_IMPORTED_MODULE_19__["default"], { |
| 1716 | ...queryControlProps |
| 1717 | })) : null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_feedback_prompt__WEBPACK_IMPORTED_MODULE_20__.ProductCollectionFeedbackPrompt, null)); |
| 1718 | }; |
| 1719 | ProductCollectionInspectorControls.__docgenInfo = { |
| 1720 | "description": "", |
| 1721 | "methods": [], |
| 1722 | "displayName": "ProductCollectionInspectorControls" |
| 1723 | }; |
| 1724 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProductCollectionInspectorControls); |
| 1725 | |
| 1726 | // Trigger Auto Upgrade of Products only once when module is loaded. |
| 1727 | // This triggers subscription but only if: |
| 1728 | // - auto update is enabled |
| 1729 | // - user haven't reverted the migration |
| 1730 | // - no other subscription is in place |
| 1731 | (0,_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_21__.enableAutoUpdate)(); |
| 1732 | const isProductCollection = blockName => blockName === _block_json__WEBPACK_IMPORTED_MODULE_22__.name; |
| 1733 | const lessThanThresholdSinceUpdate = t => { |
| 1734 | // Xh * 60m * 60s * 1000ms |
| 1735 | const xHoursFromT = t + _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_23__.HOURS_TO_DISPLAY_UPGRADE_NOTICE * 60 * 60 * 1000; |
| 1736 | return Date.now() < xHoursFromT; |
| 1737 | }; |
| 1738 | const displayedLessThanThreshold = (displayCount = 0) => { |
| 1739 | return displayCount <= _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_23__.UPGRADE_NOTICE_DISPLAY_COUNT_THRESHOLD; |
| 1740 | }; |
| 1741 | |
| 1742 | // Upgrade Notice should be displayed only if: |
| 1743 | // - block is converted from Products |
| 1744 | // - user haven't acknowledged seeing the notice |
| 1745 | // - less than X hours since the notice was first displayed |
| 1746 | // - notice was displayed less than X times |
| 1747 | const shouldDisplayUpgradeNotice = props => { |
| 1748 | const { |
| 1749 | attributes |
| 1750 | } = props; |
| 1751 | const { |
| 1752 | convertedFromProducts |
| 1753 | } = attributes; |
| 1754 | const { |
| 1755 | status, |
| 1756 | time, |
| 1757 | displayCount |
| 1758 | } = (0,_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_24__.getUpgradeStatus)(); |
| 1759 | return convertedFromProducts && status === 'notseen' && lessThanThresholdSinceUpdate(time) && displayedLessThanThreshold(displayCount); |
| 1760 | }; |
| 1761 | |
| 1762 | // Block should be unmarked as converted from Products if: |
| 1763 | // block is converted from Products and either: |
| 1764 | // - user acknowledged seeing the notice |
| 1765 | // - it's more than X hours since the notice was first displayed |
| 1766 | // - notice was displayed more than X times |
| 1767 | // We do that to prevent showing the notice again after Products on |
| 1768 | // other page were updated or local storage was cleared or user |
| 1769 | // switched to another machine/browser etc. |
| 1770 | const shouldBeUnmarkedAsConverted = props => { |
| 1771 | const { |
| 1772 | attributes |
| 1773 | } = props; |
| 1774 | const { |
| 1775 | convertedFromProducts |
| 1776 | } = attributes; |
| 1777 | const { |
| 1778 | status, |
| 1779 | time, |
| 1780 | displayCount |
| 1781 | } = (0,_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_24__.getUpgradeStatus)(); |
| 1782 | return convertedFromProducts && (status === 'seen' || !lessThanThresholdSinceUpdate(time) || !displayedLessThanThreshold(displayCount)); |
| 1783 | }; |
| 1784 | const withUpgradeNoticeControls = BlockEdit => props => { |
| 1785 | if (!isProductCollection(props.name)) { |
| 1786 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { |
| 1787 | ...props |
| 1788 | }); |
| 1789 | } |
| 1790 | const displayUpgradeNotice = shouldDisplayUpgradeNotice(props); |
| 1791 | const unmarkAsConverted = shouldBeUnmarkedAsConverted(props); |
| 1792 | if (unmarkAsConverted) { |
| 1793 | props.setAttributes({ |
| 1794 | convertedFromProducts: false |
| 1795 | }); |
| 1796 | } |
| 1797 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, displayUpgradeNotice && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_upgrade_notice__WEBPACK_IMPORTED_MODULE_25__["default"], { |
| 1798 | revertMigration: _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_26__.revertMigration |
| 1799 | })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { |
| 1800 | ...props |
| 1801 | })); |
| 1802 | }; |
| 1803 | (0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_4__.addFilter)('editor.BlockEdit', 'woocommerce/product-collection', withUpgradeNoticeControls); |
| 1804 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1805 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/index.tsx"] = { |
| 1806 | name: "ProductCollectionInspectorControls", |
| 1807 | docgenInfo: ProductCollectionInspectorControls.__docgenInfo, |
| 1808 | path: "assets/js/blocks/product-collection/edit/inspector-controls/index.tsx" |
| 1809 | }; |
| 1810 | } |
| 1811 | |
| 1812 | /***/ }), |
| 1813 | |
| 1814 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx": |
| 1815 | /*!***********************************************************************************************!*\ |
| 1816 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx ***! |
| 1817 | \***********************************************************************************************/ |
| 1818 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1819 | |
| 1820 | "use strict"; |
| 1821 | __webpack_require__.r(__webpack_exports__); |
| 1822 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1823 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1824 | /* harmony export */ }); |
| 1825 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1826 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1827 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1828 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1829 | /* harmony import */ var _woocommerce_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @woocommerce/utils */ "./assets/js/utils/is-site-editor-page.ts"); |
| 1830 | /* harmony import */ var _woocommerce_base_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @woocommerce/base-hooks */ "./assets/js/base/hooks/use-previous.ts"); |
| 1831 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 1832 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__); |
| 1833 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 1834 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 1835 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1836 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); |
| 1837 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 1838 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./assets/js/blocks/product-collection/utils.tsx"); |
| 1839 | |
| 1840 | /** |
| 1841 | * External dependencies |
| 1842 | */ |
| 1843 | |
| 1844 | |
| 1845 | |
| 1846 | |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | /** |
| 1851 | * Internal dependencies |
| 1852 | */ |
| 1853 | |
| 1854 | |
| 1855 | |
| 1856 | const label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Inherit query from template', 'woocommerce'); |
| 1857 | const InheritQueryControl = ({ |
| 1858 | setQueryAttribute, |
| 1859 | query |
| 1860 | }) => { |
| 1861 | const inherit = query === null || query === void 0 ? void 0 : query.inherit; |
| 1862 | const editSiteStore = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.select)('core/edit-site'); |
| 1863 | const queryObjectBeforeInheritEnabled = (0,_woocommerce_base_hooks__WEBPACK_IMPORTED_MODULE_5__.usePrevious)(query, value => { |
| 1864 | return (value === null || value === void 0 ? void 0 : value.inherit) === false; |
| 1865 | }); |
| 1866 | const defaultValue = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)(() => (0,_utils__WEBPACK_IMPORTED_MODULE_6__.getDefaultValueOfInheritQueryFromTemplate)(), []); |
| 1867 | |
| 1868 | // Hide the control if not in site editor. |
| 1869 | const isSiteEditor = (0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_7__.isSiteEditorPage)(editSiteStore); |
| 1870 | if (!isSiteEditor) { |
| 1871 | return null; |
| 1872 | } |
| 1873 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToolsPanelItem, { |
| 1874 | label: label, |
| 1875 | hasValue: () => inherit !== defaultValue, |
| 1876 | isShownByDefault: true, |
| 1877 | onDeselect: () => { |
| 1878 | setQueryAttribute({ |
| 1879 | inherit: defaultValue |
| 1880 | }); |
| 1881 | } |
| 1882 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { |
| 1883 | className: "wc-block-product-collection__inherit-query-control", |
| 1884 | label: label, |
| 1885 | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.', 'woocommerce'), |
| 1886 | checked: !!inherit, |
| 1887 | onChange: newInherit => { |
| 1888 | if (newInherit) { |
| 1889 | // If the inherit is enabled, we want to reset the query to the default. |
| 1890 | setQueryAttribute({ |
| 1891 | ..._constants__WEBPACK_IMPORTED_MODULE_8__.DEFAULT_QUERY, |
| 1892 | inherit: newInherit |
| 1893 | }); |
| 1894 | } else { |
| 1895 | // If the inherit is disabled, we want to reset the query to the previous query before the inherit was enabled. |
| 1896 | setQueryAttribute({ |
| 1897 | ..._constants__WEBPACK_IMPORTED_MODULE_8__.DEFAULT_QUERY, |
| 1898 | ...queryObjectBeforeInheritEnabled, |
| 1899 | inherit: newInherit |
| 1900 | }); |
| 1901 | } |
| 1902 | } |
| 1903 | })); |
| 1904 | }; |
| 1905 | InheritQueryControl.__docgenInfo = { |
| 1906 | "description": "", |
| 1907 | "methods": [], |
| 1908 | "displayName": "InheritQueryControl", |
| 1909 | "props": { |
| 1910 | "setQueryAttribute": { |
| 1911 | "required": true, |
| 1912 | "tsType": { |
| 1913 | "name": "signature", |
| 1914 | "type": "function", |
| 1915 | "raw": "( value: Partial< ProductCollectionQuery > ) => void", |
| 1916 | "signature": { |
| 1917 | "arguments": [{ |
| 1918 | "name": "value", |
| 1919 | "type": { |
| 1920 | "name": "Partial", |
| 1921 | "elements": [{ |
| 1922 | "name": "ProductCollectionQuery" |
| 1923 | }], |
| 1924 | "raw": "Partial< ProductCollectionQuery >" |
| 1925 | } |
| 1926 | }], |
| 1927 | "return": { |
| 1928 | "name": "void" |
| 1929 | } |
| 1930 | } |
| 1931 | }, |
| 1932 | "description": "" |
| 1933 | }, |
| 1934 | "query": { |
| 1935 | "required": true, |
| 1936 | "tsType": { |
| 1937 | "name": "union", |
| 1938 | "raw": "ProductCollectionQuery | undefined", |
| 1939 | "elements": [{ |
| 1940 | "name": "ProductCollectionQuery" |
| 1941 | }, { |
| 1942 | "name": "undefined" |
| 1943 | }] |
| 1944 | }, |
| 1945 | "description": "" |
| 1946 | } |
| 1947 | } |
| 1948 | }; |
| 1949 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InheritQueryControl); |
| 1950 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 1951 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx"] = { |
| 1952 | name: "InheritQueryControl", |
| 1953 | docgenInfo: InheritQueryControl.__docgenInfo, |
| 1954 | path: "assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx" |
| 1955 | }; |
| 1956 | } |
| 1957 | |
| 1958 | /***/ }), |
| 1959 | |
| 1960 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/keyword-control.tsx": |
| 1961 | /*!*****************************************************************************************!*\ |
| 1962 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/keyword-control.tsx ***! |
| 1963 | \*****************************************************************************************/ |
| 1964 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1965 | |
| 1966 | "use strict"; |
| 1967 | __webpack_require__.r(__webpack_exports__); |
| 1968 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1969 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 1970 | /* harmony export */ }); |
| 1971 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1972 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1973 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1974 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 1975 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 1976 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); |
| 1977 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 1978 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__); |
| 1979 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 1980 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); |
| 1981 | |
| 1982 | /** |
| 1983 | * External dependencies |
| 1984 | */ |
| 1985 | |
| 1986 | |
| 1987 | |
| 1988 | |
| 1989 | |
| 1990 | /** |
| 1991 | * Internal dependencies |
| 1992 | */ |
| 1993 | |
| 1994 | const KeywordControl = props => { |
| 1995 | const { |
| 1996 | query, |
| 1997 | setQueryAttribute |
| 1998 | } = props; |
| 1999 | const [querySearch, setQuerySearch] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(query.search); |
| 2000 | const onChangeDebounced = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.useDebounce)(() => { |
| 2001 | if (query.search !== querySearch) { |
| 2002 | setQueryAttribute({ |
| 2003 | search: querySearch |
| 2004 | }); |
| 2005 | } |
| 2006 | }, 250); |
| 2007 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { |
| 2008 | onChangeDebounced(); |
| 2009 | return onChangeDebounced.cancel; |
| 2010 | }, [querySearch, onChangeDebounced]); |
| 2011 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToolsPanelItem, { |
| 2012 | hasValue: () => !!querySearch, |
| 2013 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Keyword', 'woocommerce'), |
| 2014 | onDeselect: () => setQuerySearch(''), |
| 2015 | resetAllFilter: () => setQuerySearch('') |
| 2016 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, { |
| 2017 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Keyword', 'woocommerce'), |
| 2018 | value: querySearch, |
| 2019 | onChange: setQuerySearch |
| 2020 | })); |
| 2021 | }; |
| 2022 | KeywordControl.__docgenInfo = { |
| 2023 | "description": "", |
| 2024 | "methods": [], |
| 2025 | "displayName": "KeywordControl" |
| 2026 | }; |
| 2027 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (KeywordControl); |
| 2028 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2029 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/keyword-control.tsx"] = { |
| 2030 | name: "KeywordControl", |
| 2031 | docgenInfo: KeywordControl.__docgenInfo, |
| 2032 | path: "assets/js/blocks/product-collection/edit/inspector-controls/keyword-control.tsx" |
| 2033 | }; |
| 2034 | } |
| 2035 | |
| 2036 | /***/ }), |
| 2037 | |
| 2038 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/layout-options-control.tsx": |
| 2039 | /*!************************************************************************************************!*\ |
| 2040 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/layout-options-control.tsx ***! |
| 2041 | \************************************************************************************************/ |
| 2042 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2043 | |
| 2044 | "use strict"; |
| 2045 | __webpack_require__.r(__webpack_exports__); |
| 2046 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2047 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2048 | /* harmony export */ }); |
| 2049 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2050 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2051 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2052 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2053 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2054 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 2055 | /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../types */ "./assets/js/blocks/product-collection/types.ts"); |
| 2056 | |
| 2057 | /** |
| 2058 | * External dependencies |
| 2059 | */ |
| 2060 | |
| 2061 | |
| 2062 | |
| 2063 | /** |
| 2064 | * Internal dependencies |
| 2065 | */ |
| 2066 | |
| 2067 | const getHelpText = layoutOptions => { |
| 2068 | switch (layoutOptions) { |
| 2069 | case _types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID: |
| 2070 | return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Display products using rows and columns.', 'woocommerce'); |
| 2071 | case _types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.STACK: |
| 2072 | return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Display products in a single column.', 'woocommerce'); |
| 2073 | default: |
| 2074 | return ''; |
| 2075 | } |
| 2076 | }; |
| 2077 | const DEFAULT_VALUE = _types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID; |
| 2078 | const LayoutOptionsControl = props => { |
| 2079 | const { |
| 2080 | type, |
| 2081 | columns, |
| 2082 | shrinkColumns |
| 2083 | } = props.displayLayout; |
| 2084 | const setDisplayLayout = displayLayout => { |
| 2085 | props.setAttributes({ |
| 2086 | displayLayout: { |
| 2087 | type: displayLayout, |
| 2088 | columns, |
| 2089 | shrinkColumns |
| 2090 | } |
| 2091 | }); |
| 2092 | }; |
| 2093 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 2094 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Layout', 'woocommerce'), |
| 2095 | hasValue: () => type !== DEFAULT_VALUE, |
| 2096 | isShownByDefault: true, |
| 2097 | onDeselect: () => { |
| 2098 | setDisplayLayout(_types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID); |
| 2099 | } |
| 2100 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, { |
| 2101 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Layout', 'woocommerce'), |
| 2102 | isBlock: true, |
| 2103 | onChange: value => { |
| 2104 | setDisplayLayout(value); |
| 2105 | }, |
| 2106 | help: getHelpText(type), |
| 2107 | value: type |
| 2108 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, { |
| 2109 | value: _types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.STACK, |
| 2110 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Stack', 'woocommerce') |
| 2111 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, { |
| 2112 | value: _types__WEBPACK_IMPORTED_MODULE_3__.LayoutOptions.GRID, |
| 2113 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Grid', 'woocommerce') |
| 2114 | }))); |
| 2115 | }; |
| 2116 | LayoutOptionsControl.__docgenInfo = { |
| 2117 | "description": "", |
| 2118 | "methods": [], |
| 2119 | "displayName": "LayoutOptionsControl" |
| 2120 | }; |
| 2121 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LayoutOptionsControl); |
| 2122 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2123 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/layout-options-control.tsx"] = { |
| 2124 | name: "LayoutOptionsControl", |
| 2125 | docgenInfo: LayoutOptionsControl.__docgenInfo, |
| 2126 | path: "assets/js/blocks/product-collection/edit/inspector-controls/layout-options-control.tsx" |
| 2127 | }; |
| 2128 | } |
| 2129 | |
| 2130 | /***/ }), |
| 2131 | |
| 2132 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/on-sale-control.tsx": |
| 2133 | /*!*****************************************************************************************!*\ |
| 2134 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/on-sale-control.tsx ***! |
| 2135 | \*****************************************************************************************/ |
| 2136 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2137 | |
| 2138 | "use strict"; |
| 2139 | __webpack_require__.r(__webpack_exports__); |
| 2140 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2141 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2142 | /* harmony export */ }); |
| 2143 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2144 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2145 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2146 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2147 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2148 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 2149 | |
| 2150 | /** |
| 2151 | * External dependencies |
| 2152 | */ |
| 2153 | |
| 2154 | |
| 2155 | |
| 2156 | /** |
| 2157 | * Internal dependencies |
| 2158 | */ |
| 2159 | |
| 2160 | const OnSaleControl = props => { |
| 2161 | const { |
| 2162 | query, |
| 2163 | setQueryAttribute |
| 2164 | } = props; |
| 2165 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 2166 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('On Sale', 'woocommerce'), |
| 2167 | hasValue: () => query.woocommerceOnSale === true, |
| 2168 | isShownByDefault: true, |
| 2169 | onDeselect: () => { |
| 2170 | setQueryAttribute({ |
| 2171 | woocommerceOnSale: false |
| 2172 | }); |
| 2173 | } |
| 2174 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 2175 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show only products on sale', 'woocommerce'), |
| 2176 | checked: query.woocommerceOnSale || false, |
| 2177 | onChange: woocommerceOnSale => { |
| 2178 | setQueryAttribute({ |
| 2179 | woocommerceOnSale |
| 2180 | }); |
| 2181 | } |
| 2182 | })); |
| 2183 | }; |
| 2184 | OnSaleControl.__docgenInfo = { |
| 2185 | "description": "", |
| 2186 | "methods": [], |
| 2187 | "displayName": "OnSaleControl" |
| 2188 | }; |
| 2189 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OnSaleControl); |
| 2190 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2191 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/on-sale-control.tsx"] = { |
| 2192 | name: "OnSaleControl", |
| 2193 | docgenInfo: OnSaleControl.__docgenInfo, |
| 2194 | path: "assets/js/blocks/product-collection/edit/inspector-controls/on-sale-control.tsx" |
| 2195 | }; |
| 2196 | } |
| 2197 | |
| 2198 | /***/ }), |
| 2199 | |
| 2200 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/order-by-control.tsx": |
| 2201 | /*!******************************************************************************************!*\ |
| 2202 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/order-by-control.tsx ***! |
| 2203 | \******************************************************************************************/ |
| 2204 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2205 | |
| 2206 | "use strict"; |
| 2207 | __webpack_require__.r(__webpack_exports__); |
| 2208 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2209 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2210 | /* harmony export */ }); |
| 2211 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2212 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2213 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2214 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2215 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2216 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 2217 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 2218 | |
| 2219 | /** |
| 2220 | * External dependencies |
| 2221 | */ |
| 2222 | |
| 2223 | |
| 2224 | |
| 2225 | /** |
| 2226 | * Internal dependencies |
| 2227 | */ |
| 2228 | |
| 2229 | |
| 2230 | const orderOptions = [{ |
| 2231 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('A → Z', 'woocommerce'), |
| 2232 | value: 'title/asc' |
| 2233 | }, { |
| 2234 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Z → A', 'woocommerce'), |
| 2235 | value: 'title/desc' |
| 2236 | }, { |
| 2237 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Newest to oldest', 'woocommerce'), |
| 2238 | value: 'date/desc' |
| 2239 | }, { |
| 2240 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Oldest to newest', 'woocommerce'), |
| 2241 | value: 'date/asc' |
| 2242 | }, { |
| 2243 | value: 'popularity/desc', |
| 2244 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Best Selling', 'woocommerce') |
| 2245 | }, { |
| 2246 | value: 'rating/desc', |
| 2247 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Top Rated', 'woocommerce') |
| 2248 | }]; |
| 2249 | const OrderByControl = props => { |
| 2250 | const { |
| 2251 | query, |
| 2252 | setQueryAttribute |
| 2253 | } = props; |
| 2254 | const { |
| 2255 | order, |
| 2256 | orderBy |
| 2257 | } = query; |
| 2258 | const defaultQuery = (0,_constants__WEBPACK_IMPORTED_MODULE_3__.getDefaultQuery)(query); |
| 2259 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToolsPanelItem, { |
| 2260 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Order by', 'woocommerce'), |
| 2261 | hasValue: () => order !== (defaultQuery === null || defaultQuery === void 0 ? void 0 : defaultQuery.order) || orderBy !== (defaultQuery === null || defaultQuery === void 0 ? void 0 : defaultQuery.orderBy), |
| 2262 | isShownByDefault: true, |
| 2263 | onDeselect: () => { |
| 2264 | setQueryAttribute(defaultQuery); |
| 2265 | } |
| 2266 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { |
| 2267 | value: `${orderBy}/${order}`, |
| 2268 | options: orderOptions, |
| 2269 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Order by', 'woocommerce'), |
| 2270 | onChange: value => { |
| 2271 | const [newOrderBy, newOrder] = value.split('/'); |
| 2272 | setQueryAttribute({ |
| 2273 | order: newOrder, |
| 2274 | orderBy: newOrderBy |
| 2275 | }); |
| 2276 | } |
| 2277 | })); |
| 2278 | }; |
| 2279 | OrderByControl.__docgenInfo = { |
| 2280 | "description": "", |
| 2281 | "methods": [], |
| 2282 | "displayName": "OrderByControl" |
| 2283 | }; |
| 2284 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OrderByControl); |
| 2285 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2286 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/order-by-control.tsx"] = { |
| 2287 | name: "OrderByControl", |
| 2288 | docgenInfo: OrderByControl.__docgenInfo, |
| 2289 | path: "assets/js/blocks/product-collection/edit/inspector-controls/order-by-control.tsx" |
| 2290 | }; |
| 2291 | } |
| 2292 | |
| 2293 | /***/ }), |
| 2294 | |
| 2295 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/stock-status-control.tsx": |
| 2296 | /*!**********************************************************************************************!*\ |
| 2297 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/stock-status-control.tsx ***! |
| 2298 | \**********************************************************************************************/ |
| 2299 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2300 | |
| 2301 | "use strict"; |
| 2302 | __webpack_require__.r(__webpack_exports__); |
| 2303 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2304 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2305 | /* harmony export */ }); |
| 2306 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2307 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2308 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2309 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2310 | /* harmony import */ var fast_deep_equal_es6__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fast-deep-equal/es6 */ "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js"); |
| 2311 | /* harmony import */ var fast_deep_equal_es6__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal_es6__WEBPACK_IMPORTED_MODULE_2__); |
| 2312 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2313 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); |
| 2314 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../constants */ "./assets/js/blocks/product-collection/constants.ts"); |
| 2315 | |
| 2316 | /** |
| 2317 | * External dependencies |
| 2318 | */ |
| 2319 | |
| 2320 | |
| 2321 | |
| 2322 | |
| 2323 | /** |
| 2324 | * Internal dependencies |
| 2325 | */ |
| 2326 | |
| 2327 | |
| 2328 | |
| 2329 | /** |
| 2330 | * Gets the id of a specific stock status from its text label |
| 2331 | * |
| 2332 | * In theory, we could use a `saveTransform` function on the |
| 2333 | * `FormFieldToken` component to do the conversion. However, plugins |
| 2334 | * can add custom stock statuses which don't conform to our naming |
| 2335 | * conventions. |
| 2336 | */ |
| 2337 | function getStockStatusIdByLabel(statusLabel) { |
| 2338 | var _Object$entries$find; |
| 2339 | const label = typeof statusLabel === 'string' ? statusLabel : statusLabel.value; |
| 2340 | return (_Object$entries$find = Object.entries(_constants__WEBPACK_IMPORTED_MODULE_4__.STOCK_STATUS_OPTIONS).find(([, value]) => value === label)) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]; |
| 2341 | } |
| 2342 | const StockStatusControl = props => { |
| 2343 | var _query$woocommerceSto; |
| 2344 | const { |
| 2345 | query, |
| 2346 | setQueryAttribute |
| 2347 | } = props; |
| 2348 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.__experimentalToolsPanelItem, { |
| 2349 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Stock status', 'woocommerce'), |
| 2350 | hasValue: () => !fast_deep_equal_es6__WEBPACK_IMPORTED_MODULE_2___default()(query.woocommerceStockStatus, (0,_constants__WEBPACK_IMPORTED_MODULE_4__.getDefaultStockStatuses)()), |
| 2351 | onDeselect: () => { |
| 2352 | setQueryAttribute({ |
| 2353 | woocommerceStockStatus: (0,_constants__WEBPACK_IMPORTED_MODULE_4__.getDefaultStockStatuses)() |
| 2354 | }); |
| 2355 | }, |
| 2356 | isShownByDefault: true |
| 2357 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FormTokenField, { |
| 2358 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Stock status', 'woocommerce'), |
| 2359 | onChange: statusLabels => { |
| 2360 | const woocommerceStockStatus = statusLabels.map(getStockStatusIdByLabel).filter(Boolean); |
| 2361 | setQueryAttribute({ |
| 2362 | woocommerceStockStatus |
| 2363 | }); |
| 2364 | }, |
| 2365 | suggestions: Object.values(_constants__WEBPACK_IMPORTED_MODULE_4__.STOCK_STATUS_OPTIONS), |
| 2366 | validateInput: value => Object.values(_constants__WEBPACK_IMPORTED_MODULE_4__.STOCK_STATUS_OPTIONS).includes(value), |
| 2367 | value: (query === null || query === void 0 ? void 0 : (_query$woocommerceSto = query.woocommerceStockStatus) === null || _query$woocommerceSto === void 0 ? void 0 : _query$woocommerceSto.map(key => _constants__WEBPACK_IMPORTED_MODULE_4__.STOCK_STATUS_OPTIONS[key])) || [], |
| 2368 | __experimentalExpandOnFocus: true, |
| 2369 | __experimentalShowHowTo: false |
| 2370 | })); |
| 2371 | }; |
| 2372 | StockStatusControl.__docgenInfo = { |
| 2373 | "description": "", |
| 2374 | "methods": [], |
| 2375 | "displayName": "StockStatusControl" |
| 2376 | }; |
| 2377 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StockStatusControl); |
| 2378 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2379 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/stock-status-control.tsx"] = { |
| 2380 | name: "StockStatusControl", |
| 2381 | docgenInfo: StockStatusControl.__docgenInfo, |
| 2382 | path: "assets/js/blocks/product-collection/edit/inspector-controls/stock-status-control.tsx" |
| 2383 | }; |
| 2384 | } |
| 2385 | |
| 2386 | /***/ }), |
| 2387 | |
| 2388 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/index.tsx": |
| 2389 | /*!*************************************************************************************************!*\ |
| 2390 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/index.tsx ***! |
| 2391 | \*************************************************************************************************/ |
| 2392 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2393 | |
| 2394 | "use strict"; |
| 2395 | __webpack_require__.r(__webpack_exports__); |
| 2396 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2397 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), |
| 2398 | /* harmony export */ useTaxonomies: () => (/* binding */ useTaxonomies) |
| 2399 | /* harmony export */ }); |
| 2400 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2401 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2402 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2403 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2404 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 2405 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__); |
| 2406 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); |
| 2407 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__); |
| 2408 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2409 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); |
| 2410 | /* harmony import */ var _taxonomy_item__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./taxonomy-item */ "./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx"); |
| 2411 | |
| 2412 | /** |
| 2413 | * External dependencies |
| 2414 | */ |
| 2415 | |
| 2416 | |
| 2417 | |
| 2418 | |
| 2419 | |
| 2420 | |
| 2421 | /** |
| 2422 | * Internal dependencies |
| 2423 | */ |
| 2424 | |
| 2425 | /** |
| 2426 | * Hook that returns the taxonomies associated with product post type. |
| 2427 | */ |
| 2428 | const useTaxonomies = () => { |
| 2429 | const taxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)(select => { |
| 2430 | const { |
| 2431 | getTaxonomies |
| 2432 | } = select(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__.store); |
| 2433 | const filteredTaxonomies = getTaxonomies({ |
| 2434 | type: 'product', |
| 2435 | per_page: -1, |
| 2436 | context: 'view' |
| 2437 | }); |
| 2438 | return filteredTaxonomies; |
| 2439 | }, []); |
| 2440 | return taxonomies; |
| 2441 | }; |
| 2442 | function TaxonomyControls({ |
| 2443 | setQueryAttribute, |
| 2444 | query |
| 2445 | }) { |
| 2446 | const { |
| 2447 | taxQuery |
| 2448 | } = query; |
| 2449 | const taxonomies = useTaxonomies(); |
| 2450 | if (!taxonomies || taxonomies.length === 0) { |
| 2451 | return null; |
| 2452 | } |
| 2453 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToolsPanelItem, { |
| 2454 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Taxonomies', 'woocommerce'), |
| 2455 | hasValue: () => Object.values(taxQuery || {}).some(terms => !!terms.length), |
| 2456 | onDeselect: () => setQueryAttribute({ |
| 2457 | taxQuery: {} |
| 2458 | }) |
| 2459 | }, taxonomies.map(taxonomy => { |
| 2460 | const termIds = (taxQuery === null || taxQuery === void 0 ? void 0 : taxQuery[taxonomy.slug]) || []; |
| 2461 | const handleChange = newTermIds => setQueryAttribute({ |
| 2462 | taxQuery: { |
| 2463 | ...taxQuery, |
| 2464 | [taxonomy.slug]: newTermIds |
| 2465 | } |
| 2466 | }); |
| 2467 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_taxonomy_item__WEBPACK_IMPORTED_MODULE_5__["default"], { |
| 2468 | key: taxonomy.slug, |
| 2469 | taxonomy: taxonomy, |
| 2470 | termIds: termIds, |
| 2471 | onChange: handleChange |
| 2472 | }); |
| 2473 | })); |
| 2474 | } |
| 2475 | TaxonomyControls.__docgenInfo = { |
| 2476 | "description": "", |
| 2477 | "methods": [], |
| 2478 | "displayName": "TaxonomyControls", |
| 2479 | "props": { |
| 2480 | "query": { |
| 2481 | "required": true, |
| 2482 | "tsType": { |
| 2483 | "name": "ProductCollectionQuery" |
| 2484 | }, |
| 2485 | "description": "" |
| 2486 | }, |
| 2487 | "setQueryAttribute": { |
| 2488 | "required": true, |
| 2489 | "tsType": { |
| 2490 | "name": "signature", |
| 2491 | "type": "function", |
| 2492 | "raw": "( value: Partial< ProductCollectionQuery > ) => void", |
| 2493 | "signature": { |
| 2494 | "arguments": [{ |
| 2495 | "name": "value", |
| 2496 | "type": { |
| 2497 | "name": "Partial", |
| 2498 | "elements": [{ |
| 2499 | "name": "ProductCollectionQuery" |
| 2500 | }], |
| 2501 | "raw": "Partial< ProductCollectionQuery >" |
| 2502 | } |
| 2503 | }], |
| 2504 | "return": { |
| 2505 | "name": "void" |
| 2506 | } |
| 2507 | } |
| 2508 | }, |
| 2509 | "description": "" |
| 2510 | } |
| 2511 | } |
| 2512 | }; |
| 2513 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TaxonomyControls); |
| 2514 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2515 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/index.tsx"] = { |
| 2516 | name: "TaxonomyControls", |
| 2517 | docgenInfo: TaxonomyControls.__docgenInfo, |
| 2518 | path: "assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/index.tsx" |
| 2519 | }; |
| 2520 | } |
| 2521 | |
| 2522 | /***/ }), |
| 2523 | |
| 2524 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx": |
| 2525 | /*!*********************************************************************************************************!*\ |
| 2526 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx ***! |
| 2527 | \*********************************************************************************************************/ |
| 2528 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2529 | |
| 2530 | "use strict"; |
| 2531 | __webpack_require__.r(__webpack_exports__); |
| 2532 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2533 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2534 | /* harmony export */ }); |
| 2535 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2536 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2537 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); |
| 2538 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_1__); |
| 2539 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 2540 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); |
| 2541 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 2542 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__); |
| 2543 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2544 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); |
| 2545 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); |
| 2546 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__); |
| 2547 | |
| 2548 | /** |
| 2549 | * External dependencies |
| 2550 | */ |
| 2551 | |
| 2552 | |
| 2553 | |
| 2554 | |
| 2555 | |
| 2556 | // A constant empty array that is reused throughout the component. |
| 2557 | const EMPTY_ARRAY = []; |
| 2558 | |
| 2559 | // Base arguments for querying terms. |
| 2560 | const BASE_QUERY_ARGS = { |
| 2561 | order: 'asc', |
| 2562 | _fields: 'id,name,slug', |
| 2563 | context: 'view' |
| 2564 | }; |
| 2565 | |
| 2566 | // Function to get the term id based on user input in the `FormTokenField`. |
| 2567 | const getTermIdByTermValue = (searchTerm, termNameToIdMap) => { |
| 2568 | const termId = searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.id; |
| 2569 | if (termId) { |
| 2570 | return termId; |
| 2571 | } |
| 2572 | return termNameToIdMap.get(searchTerm) || termNameToIdMap.get(searchTerm.toLocaleLowerCase()); |
| 2573 | }; |
| 2574 | |
| 2575 | /** |
| 2576 | * Creates a map that keeps track of the count of each term name in the provided list of terms. |
| 2577 | * |
| 2578 | * @param {Term[]} allTerms - Array of all term objects. |
| 2579 | * @return {Map<string, number>} A map with term names as keys and their counts as values. |
| 2580 | */ |
| 2581 | const createNameCountMap = allTerms => { |
| 2582 | return allTerms.reduce((accumulator, term) => { |
| 2583 | const termName = term.name; |
| 2584 | if (accumulator.has(termName)) { |
| 2585 | accumulator.set(termName, accumulator.get(termName) + 1); |
| 2586 | } else { |
| 2587 | accumulator.set(termName, 1); |
| 2588 | } |
| 2589 | return accumulator; |
| 2590 | }, new Map()); |
| 2591 | }; |
| 2592 | |
| 2593 | /** |
| 2594 | * Generates a unique name for the term. If there are multiple terms with the same name, |
| 2595 | * appends the term's slug to the name to distinguish them. |
| 2596 | * |
| 2597 | * @param {string} termName - Name of the term. |
| 2598 | * @param {string} termSlug - Slug of the term. |
| 2599 | * @param {Map<string, number>} nameCountMap - A map storing count of each term name. |
| 2600 | * @return {string} A unique name for the term. |
| 2601 | */ |
| 2602 | const generateUniqueName = (termName, termSlug, nameCountMap) => { |
| 2603 | return nameCountMap.get(termName) === 1 ? termName : `${termName} - ${termSlug}`; |
| 2604 | }; |
| 2605 | |
| 2606 | /** |
| 2607 | * This function generates and returns two mapping structures (Maps) for terms: |
| 2608 | * 1. termIdToNameMap: Map with term IDs as keys and their corresponding term names as values. |
| 2609 | * 2. termNameToIdMap: Map where the keys are term names and their corresponding values are the term IDs. |
| 2610 | * |
| 2611 | * The primary purpose of these Maps is to facilitate quick lookups in either direction (ID to name, or name to ID). |
| 2612 | * |
| 2613 | * In the case of duplicate term names, to ensure uniqueness, the term's slug is appended to the name. |
| 2614 | * This ensures that when the terms are displayed in the `FormTokenField`, each term name remains unique. |
| 2615 | * |
| 2616 | * An illustrative example of how termIdToNameMap might look is as follows: |
| 2617 | * { |
| 2618 | * "19": "Accessories", |
| 2619 | * "37": "category1 - category1", |
| 2620 | * "38": "category1 - category1-clothing", |
| 2621 | * "39": "category1 - category1-clothing-2", |
| 2622 | * "16": "Clothing", |
| 2623 | * "21": "Decor" |
| 2624 | * } |
| 2625 | * In the example above, "category1" is a duplicated term name, so the term's slug is appended for distinction. |
| 2626 | * |
| 2627 | * termNameToIdMap is the inverse of termIdToNameMap, mapping term names back to their respective IDs. |
| 2628 | */ |
| 2629 | const useTermMaps = taxonomy => { |
| 2630 | // Fetch all terms for the given taxonomy. |
| 2631 | const { |
| 2632 | records: allTerms, |
| 2633 | isResolving: isResolvingAllTerms |
| 2634 | } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_1__.useEntityRecords)('taxonomy', taxonomy.slug, { |
| 2635 | ...BASE_QUERY_ARGS |
| 2636 | }); |
| 2637 | |
| 2638 | // Memoize the result to avoid re-renders. |
| 2639 | return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => { |
| 2640 | const termIdToNameMap = new Map(); |
| 2641 | const termNameToIdMap = new Map(); |
| 2642 | if (!allTerms) return { |
| 2643 | termIdToNameMap, |
| 2644 | termNameToIdMap, |
| 2645 | isResolving: isResolvingAllTerms |
| 2646 | }; |
| 2647 | |
| 2648 | // Count the number of times a term name appears. |
| 2649 | const nameCountMap = createNameCountMap(allTerms); |
| 2650 | |
| 2651 | // Create the map with term ids as keys and term names as values. |
| 2652 | for (const term of allTerms) { |
| 2653 | const termId = term.id; |
| 2654 | const termName = term.name; |
| 2655 | const name = generateUniqueName(termName, term.slug, nameCountMap); |
| 2656 | termIdToNameMap.set(termId, name); |
| 2657 | termNameToIdMap.set(name, termId); |
| 2658 | // Add lower case version of the term name to the map as well |
| 2659 | // Because the search is case insensitive in FormTokenField. |
| 2660 | termNameToIdMap.set(name.toLocaleLowerCase(), termId); |
| 2661 | } |
| 2662 | return { |
| 2663 | termIdToNameMap, |
| 2664 | termNameToIdMap, |
| 2665 | isResolving: isResolvingAllTerms |
| 2666 | }; |
| 2667 | }, [allTerms, isResolvingAllTerms]); |
| 2668 | }; |
| 2669 | const TaxonomyItem = ({ |
| 2670 | taxonomy, |
| 2671 | termIds, |
| 2672 | onChange |
| 2673 | }) => { |
| 2674 | const [search, setSearch] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(undefined); |
| 2675 | const suggestionsRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useRef)(EMPTY_ARRAY); |
| 2676 | const currentValueRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useRef)(EMPTY_ARRAY); |
| 2677 | |
| 2678 | // Search is debounced to limit the number of API calls as the user types |
| 2679 | const debouncedSearch = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.useDebounce)(setSearch, 250); |
| 2680 | const { |
| 2681 | termIdToNameMap, |
| 2682 | termNameToIdMap, |
| 2683 | isResolving: isResolvingTermMaps |
| 2684 | } = useTermMaps(taxonomy); |
| 2685 | |
| 2686 | // Fetch the terms based on the search query. |
| 2687 | const { |
| 2688 | records: searchResults, |
| 2689 | hasResolved: searchHasResolved |
| 2690 | } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_1__.useEntityRecords)('taxonomy', taxonomy.slug, { |
| 2691 | ...BASE_QUERY_ARGS, |
| 2692 | search, |
| 2693 | orderby: 'name', |
| 2694 | exclude: termIds, |
| 2695 | per_page: 20 |
| 2696 | }, { |
| 2697 | enabled: search !== undefined |
| 2698 | }); |
| 2699 | suggestionsRef.current = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => { |
| 2700 | if (!searchHasResolved) return suggestionsRef.current; |
| 2701 | const newSuggestions = searchResults.map(searchResult => termIdToNameMap.get(searchResult.id) || searchResult.name); |
| 2702 | return newSuggestions; |
| 2703 | }, [searchHasResolved, searchResults, termIdToNameMap]); |
| 2704 | |
| 2705 | // Fetch the existing terms & set the current value. |
| 2706 | const { |
| 2707 | records: existingTerms, |
| 2708 | hasResolved: hasExistingTermsResolved |
| 2709 | } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_1__.useEntityRecords)('taxonomy', taxonomy.slug, { |
| 2710 | ...BASE_QUERY_ARGS, |
| 2711 | include: termIds |
| 2712 | }, { |
| 2713 | enabled: (termIds === null || termIds === void 0 ? void 0 : termIds.length) > 0 |
| 2714 | }); |
| 2715 | currentValueRef.current = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useMemo)(() => { |
| 2716 | if (hasExistingTermsResolved === false) { |
| 2717 | return currentValueRef.current; |
| 2718 | } |
| 2719 | if (!existingTerms || !termIds.length) return EMPTY_ARRAY; |
| 2720 | return existingTerms.map(({ |
| 2721 | id, |
| 2722 | name |
| 2723 | }) => ({ |
| 2724 | id, |
| 2725 | value: termIdToNameMap.get(id) || name |
| 2726 | })); |
| 2727 | }, [existingTerms, hasExistingTermsResolved, termIdToNameMap, termIds]); |
| 2728 | |
| 2729 | // Update the selected terms when the user selects a suggestion. |
| 2730 | const onTermsChange = newTermValues => { |
| 2731 | const newTermIds = []; |
| 2732 | for (const termValue of newTermValues) { |
| 2733 | const termId = getTermIdByTermValue(termValue, termNameToIdMap); |
| 2734 | if (termId) { |
| 2735 | newTermIds.push(termId); |
| 2736 | } |
| 2737 | } |
| 2738 | onChange(newTermIds); |
| 2739 | }; |
| 2740 | const decodeHTMLEntities = value => { |
| 2741 | return (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__.decodeEntities)(value) || ''; |
| 2742 | }; |
| 2743 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 2744 | className: "wc-block-editor-product-collection-inspector__taxonomy-control" |
| 2745 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FormTokenField, { |
| 2746 | label: taxonomy.name, |
| 2747 | value: currentValueRef.current, |
| 2748 | onInputChange: debouncedSearch, |
| 2749 | suggestions: suggestionsRef.current, |
| 2750 | onChange: onTermsChange, |
| 2751 | disabled: isResolvingTermMaps |
| 2752 | // @ts-expect-error Using experimental features |
| 2753 | , |
| 2754 | __experimentalShowHowTo: false, |
| 2755 | displayTransform: decodeHTMLEntities |
| 2756 | })); |
| 2757 | }; |
| 2758 | TaxonomyItem.__docgenInfo = { |
| 2759 | "description": "", |
| 2760 | "methods": [], |
| 2761 | "displayName": "TaxonomyItem", |
| 2762 | "props": { |
| 2763 | "taxonomy": { |
| 2764 | "required": true, |
| 2765 | "tsType": { |
| 2766 | "name": "Taxonomy" |
| 2767 | }, |
| 2768 | "description": "" |
| 2769 | }, |
| 2770 | "termIds": { |
| 2771 | "required": true, |
| 2772 | "tsType": { |
| 2773 | "name": "Array", |
| 2774 | "elements": [{ |
| 2775 | "name": "number" |
| 2776 | }], |
| 2777 | "raw": "number[]" |
| 2778 | }, |
| 2779 | "description": "" |
| 2780 | }, |
| 2781 | "onChange": { |
| 2782 | "required": true, |
| 2783 | "tsType": { |
| 2784 | "name": "signature", |
| 2785 | "type": "function", |
| 2786 | "raw": "( termIds: number[] ) => void", |
| 2787 | "signature": { |
| 2788 | "arguments": [{ |
| 2789 | "name": "termIds", |
| 2790 | "type": { |
| 2791 | "name": "Array", |
| 2792 | "elements": [{ |
| 2793 | "name": "number" |
| 2794 | }], |
| 2795 | "raw": "number[]" |
| 2796 | } |
| 2797 | }], |
| 2798 | "return": { |
| 2799 | "name": "void" |
| 2800 | } |
| 2801 | } |
| 2802 | }, |
| 2803 | "description": "" |
| 2804 | } |
| 2805 | } |
| 2806 | }; |
| 2807 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TaxonomyItem); |
| 2808 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2809 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx"] = { |
| 2810 | name: "TaxonomyItem", |
| 2811 | docgenInfo: TaxonomyItem.__docgenInfo, |
| 2812 | path: "assets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx" |
| 2813 | }; |
| 2814 | } |
| 2815 | |
| 2816 | /***/ }), |
| 2817 | |
| 2818 | /***/ "./assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx": |
| 2819 | /*!****************************************************************************************!*\ |
| 2820 | !*** ./assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx ***! |
| 2821 | \****************************************************************************************/ |
| 2822 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2823 | |
| 2824 | "use strict"; |
| 2825 | __webpack_require__.r(__webpack_exports__); |
| 2826 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2827 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2828 | /* harmony export */ }); |
| 2829 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2830 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2831 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2832 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2833 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2834 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 2835 | /* harmony import */ var _woocommerce_base_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @woocommerce/base-hooks */ "./assets/js/base/hooks/use-local-storage-state.ts"); |
| 2836 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 2837 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 2838 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/constants.ts"); |
| 2839 | /* harmony import */ var _woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @woocommerce/blocks/migration-products-to-product-collection */ "./assets/js/blocks/migration-products-to-product-collection/migration-utils.ts"); |
| 2840 | |
| 2841 | /** |
| 2842 | * External dependencies |
| 2843 | */ |
| 2844 | |
| 2845 | |
| 2846 | |
| 2847 | |
| 2848 | |
| 2849 | const notice = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.createInterpolateElement)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Products (Beta) block was upgraded to <strongText />, an updated version with new features and simplified settings.', 'woocommerce'), { |
| 2850 | strongText: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)(`Product Collection`, 'woocommerce')) |
| 2851 | }); |
| 2852 | const buttonLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Revert to Products (Beta)', 'woocommerce'); |
| 2853 | const UpgradeNotice = ({ |
| 2854 | revertMigration |
| 2855 | }) => { |
| 2856 | const [upgradeNoticeStatus, setUpgradeNoticeStatus] = (0,_woocommerce_base_hooks__WEBPACK_IMPORTED_MODULE_4__.useLocalStorageState)(_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_5__.MIGRATION_STATUS_LS_KEY, (0,_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_5__.getInitialStatusLSValue)()); |
| 2857 | const canCountDisplays = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useRef)(true); |
| 2858 | const { |
| 2859 | status |
| 2860 | } = upgradeNoticeStatus; |
| 2861 | const handleRemove = () => { |
| 2862 | setUpgradeNoticeStatus({ |
| 2863 | status: 'seen', |
| 2864 | time: Date.now() |
| 2865 | }); |
| 2866 | }; |
| 2867 | const handleRevert = () => { |
| 2868 | revertMigration(); |
| 2869 | }; |
| 2870 | |
| 2871 | // Prevent the possibility to count displays multiple times when the |
| 2872 | // block is selected and Inspector Controls are re-rendered multiple times. |
| 2873 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useEffect)(() => { |
| 2874 | const countDisplay = () => { |
| 2875 | if (canCountDisplays.current) { |
| 2876 | (0,_woocommerce_blocks_migration_products_to_product_collection__WEBPACK_IMPORTED_MODULE_6__.incrementUpgradeStatusDisplayCount)(); |
| 2877 | canCountDisplays.current = false; |
| 2878 | } |
| 2879 | }; |
| 2880 | return countDisplay; |
| 2881 | }, [canCountDisplays]); |
| 2882 | return status === 'notseen' ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Notice, { |
| 2883 | onRemove: handleRemove |
| 2884 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, notice, " "), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| 2885 | variant: "link", |
| 2886 | onClick: handleRevert |
| 2887 | }, buttonLabel)) : null; |
| 2888 | }; |
| 2889 | UpgradeNotice.__docgenInfo = { |
| 2890 | "description": "", |
| 2891 | "methods": [], |
| 2892 | "displayName": "UpgradeNotice", |
| 2893 | "props": { |
| 2894 | "revertMigration": { |
| 2895 | "required": true, |
| 2896 | "tsType": { |
| 2897 | "name": "signature", |
| 2898 | "type": "function", |
| 2899 | "raw": "() => void", |
| 2900 | "signature": { |
| 2901 | "arguments": [], |
| 2902 | "return": { |
| 2903 | "name": "void" |
| 2904 | } |
| 2905 | } |
| 2906 | }, |
| 2907 | "description": "" |
| 2908 | } |
| 2909 | } |
| 2910 | }; |
| 2911 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UpgradeNotice); |
| 2912 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2913 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx"] = { |
| 2914 | name: "UpgradeNotice", |
| 2915 | docgenInfo: UpgradeNotice.__docgenInfo, |
| 2916 | path: "assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx" |
| 2917 | }; |
| 2918 | } |
| 2919 | |
| 2920 | /***/ }), |
| 2921 | |
| 2922 | /***/ "./assets/js/blocks/product-collection/edit/toolbar-controls/display-layout-toolbar.tsx": |
| 2923 | /*!**********************************************************************************************!*\ |
| 2924 | !*** ./assets/js/blocks/product-collection/edit/toolbar-controls/display-layout-toolbar.tsx ***! |
| 2925 | \**********************************************************************************************/ |
| 2926 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 2927 | |
| 2928 | "use strict"; |
| 2929 | __webpack_require__.r(__webpack_exports__); |
| 2930 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 2931 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2932 | /* harmony export */ }); |
| 2933 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 2934 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 2935 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 2936 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 2937 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 2938 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 2939 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/list.js"); |
| 2940 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/grid.js"); |
| 2941 | /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../types */ "./assets/js/blocks/product-collection/types.ts"); |
| 2942 | |
| 2943 | /** |
| 2944 | * External dependencies |
| 2945 | */ |
| 2946 | |
| 2947 | |
| 2948 | |
| 2949 | |
| 2950 | /** |
| 2951 | * Internal dependencies |
| 2952 | */ |
| 2953 | |
| 2954 | const DisplayLayoutToolbar = props => { |
| 2955 | const { |
| 2956 | type, |
| 2957 | columns, |
| 2958 | shrinkColumns |
| 2959 | } = props.displayLayout; |
| 2960 | const setDisplayLayout = displayLayout => { |
| 2961 | props.setAttributes({ |
| 2962 | displayLayout |
| 2963 | }); |
| 2964 | }; |
| 2965 | const displayLayoutControls = [{ |
| 2966 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"], |
| 2967 | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('List view', 'woocommerce'), |
| 2968 | onClick: () => setDisplayLayout({ |
| 2969 | type: _types__WEBPACK_IMPORTED_MODULE_4__.LayoutOptions.STACK, |
| 2970 | columns, |
| 2971 | shrinkColumns |
| 2972 | }), |
| 2973 | isActive: type === _types__WEBPACK_IMPORTED_MODULE_4__.LayoutOptions.STACK |
| 2974 | }, { |
| 2975 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"], |
| 2976 | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Grid view', 'woocommerce'), |
| 2977 | onClick: () => setDisplayLayout({ |
| 2978 | type: _types__WEBPACK_IMPORTED_MODULE_4__.LayoutOptions.GRID, |
| 2979 | columns, |
| 2980 | shrinkColumns |
| 2981 | }), |
| 2982 | isActive: type === _types__WEBPACK_IMPORTED_MODULE_4__.LayoutOptions.GRID |
| 2983 | }]; |
| 2984 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarGroup, { |
| 2985 | controls: displayLayoutControls |
| 2986 | }); |
| 2987 | }; |
| 2988 | DisplayLayoutToolbar.__docgenInfo = { |
| 2989 | "description": "", |
| 2990 | "methods": [], |
| 2991 | "displayName": "DisplayLayoutToolbar" |
| 2992 | }; |
| 2993 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DisplayLayoutToolbar); |
| 2994 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 2995 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/toolbar-controls/display-layout-toolbar.tsx"] = { |
| 2996 | name: "DisplayLayoutToolbar", |
| 2997 | docgenInfo: DisplayLayoutToolbar.__docgenInfo, |
| 2998 | path: "assets/js/blocks/product-collection/edit/toolbar-controls/display-layout-toolbar.tsx" |
| 2999 | }; |
| 3000 | } |
| 3001 | |
| 3002 | /***/ }), |
| 3003 | |
| 3004 | /***/ "./assets/js/blocks/product-collection/edit/toolbar-controls/display-settings-toolbar.tsx": |
| 3005 | /*!************************************************************************************************!*\ |
| 3006 | !*** ./assets/js/blocks/product-collection/edit/toolbar-controls/display-settings-toolbar.tsx ***! |
| 3007 | \************************************************************************************************/ |
| 3008 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3009 | |
| 3010 | "use strict"; |
| 3011 | __webpack_require__.r(__webpack_exports__); |
| 3012 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3013 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3014 | /* harmony export */ }); |
| 3015 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3016 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3017 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 3018 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 3019 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/settings.js"); |
| 3020 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3021 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 3022 | |
| 3023 | /** |
| 3024 | * External dependencies |
| 3025 | */ |
| 3026 | |
| 3027 | |
| 3028 | |
| 3029 | |
| 3030 | /** |
| 3031 | * Internal dependencies |
| 3032 | */ |
| 3033 | |
| 3034 | const ToggleButton = ({ |
| 3035 | onToggle |
| 3036 | }) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton, { |
| 3037 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"], |
| 3038 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Display settings', 'woocommerce'), |
| 3039 | onClick: onToggle |
| 3040 | }); |
| 3041 | const DisplaySettingsToolbar = ({ |
| 3042 | query, |
| 3043 | setQueryAttribute |
| 3044 | }) => { |
| 3045 | const handlePerPageChange = value => { |
| 3046 | const parsedValue = Number(value); |
| 3047 | if (!isNaN(parsedValue) && parsedValue >= 1 && parsedValue <= 100) { |
| 3048 | setQueryAttribute({ |
| 3049 | perPage: parsedValue |
| 3050 | }); |
| 3051 | } |
| 3052 | }; |
| 3053 | const handleOffsetChange = value => { |
| 3054 | const parsedValue = Number(value); |
| 3055 | if (!isNaN(parsedValue) && parsedValue >= 0 && parsedValue <= 100) { |
| 3056 | setQueryAttribute({ |
| 3057 | offset: parsedValue |
| 3058 | }); |
| 3059 | } |
| 3060 | }; |
| 3061 | const handlePagesChange = value => { |
| 3062 | const parsedValue = Number(value); |
| 3063 | if (!isNaN(parsedValue) && parsedValue >= 0) { |
| 3064 | setQueryAttribute({ |
| 3065 | pages: parsedValue |
| 3066 | }); |
| 3067 | } |
| 3068 | }; |
| 3069 | const numberControlProps = { |
| 3070 | __unstableInputWidth: '60px', |
| 3071 | labelPosition: 'edge', |
| 3072 | step: '1', |
| 3073 | isDragEnabled: false |
| 3074 | }; |
| 3075 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarGroup, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Dropdown, { |
| 3076 | contentClassName: "wc-block-editor-product-collection__display-settings", |
| 3077 | renderToggle: ({ |
| 3078 | onToggle |
| 3079 | }) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ToggleButton, { |
| 3080 | onToggle: onToggle |
| 3081 | }), |
| 3082 | renderContent: () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalNumberControl, { |
| 3083 | ...numberControlProps, |
| 3084 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Items per Page', 'woocommerce'), |
| 3085 | min: 1, |
| 3086 | max: 100, |
| 3087 | onChange: handlePerPageChange, |
| 3088 | value: query.perPage |
| 3089 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalNumberControl, { |
| 3090 | ...numberControlProps, |
| 3091 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Offset', 'woocommerce'), |
| 3092 | min: 0, |
| 3093 | max: 100, |
| 3094 | onChange: handleOffsetChange, |
| 3095 | value: query.offset |
| 3096 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, { |
| 3097 | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).', 'woocommerce'), |
| 3098 | id: "woocommerce-products-block__display-settings-pages" |
| 3099 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalNumberControl, { |
| 3100 | ...numberControlProps, |
| 3101 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Max page to show', 'woocommerce'), |
| 3102 | min: 0, |
| 3103 | onChange: handlePagesChange, |
| 3104 | value: query.pages |
| 3105 | }))) |
| 3106 | })); |
| 3107 | }; |
| 3108 | DisplaySettingsToolbar.__docgenInfo = { |
| 3109 | "description": "", |
| 3110 | "methods": [], |
| 3111 | "displayName": "DisplaySettingsToolbar", |
| 3112 | "props": { |
| 3113 | "query": { |
| 3114 | "required": true, |
| 3115 | "tsType": { |
| 3116 | "name": "ProductCollectionQuery" |
| 3117 | }, |
| 3118 | "description": "" |
| 3119 | }, |
| 3120 | "setQueryAttribute": { |
| 3121 | "required": true, |
| 3122 | "tsType": { |
| 3123 | "name": "signature", |
| 3124 | "type": "function", |
| 3125 | "raw": "( value: Partial< ProductCollectionQuery > ) => void", |
| 3126 | "signature": { |
| 3127 | "arguments": [{ |
| 3128 | "name": "value", |
| 3129 | "type": { |
| 3130 | "name": "Partial", |
| 3131 | "elements": [{ |
| 3132 | "name": "ProductCollectionQuery" |
| 3133 | }], |
| 3134 | "raw": "Partial< ProductCollectionQuery >" |
| 3135 | } |
| 3136 | }], |
| 3137 | "return": { |
| 3138 | "name": "void" |
| 3139 | } |
| 3140 | } |
| 3141 | }, |
| 3142 | "description": "" |
| 3143 | } |
| 3144 | } |
| 3145 | }; |
| 3146 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DisplaySettingsToolbar); |
| 3147 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3148 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/toolbar-controls/display-settings-toolbar.tsx"] = { |
| 3149 | name: "DisplaySettingsToolbar", |
| 3150 | docgenInfo: DisplaySettingsToolbar.__docgenInfo, |
| 3151 | path: "assets/js/blocks/product-collection/edit/toolbar-controls/display-settings-toolbar.tsx" |
| 3152 | }; |
| 3153 | } |
| 3154 | |
| 3155 | /***/ }), |
| 3156 | |
| 3157 | /***/ "./assets/js/blocks/product-collection/edit/toolbar-controls/index.tsx": |
| 3158 | /*!*****************************************************************************!*\ |
| 3159 | !*** ./assets/js/blocks/product-collection/edit/toolbar-controls/index.tsx ***! |
| 3160 | \*****************************************************************************/ |
| 3161 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3162 | |
| 3163 | "use strict"; |
| 3164 | __webpack_require__.r(__webpack_exports__); |
| 3165 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3166 | /* harmony export */ "default": () => (/* binding */ ToolbarControls) |
| 3167 | /* harmony export */ }); |
| 3168 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3169 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3170 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 3171 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); |
| 3172 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 3173 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); |
| 3174 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./assets/js/blocks/product-collection/utils.tsx"); |
| 3175 | /* harmony import */ var _display_settings_toolbar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./display-settings-toolbar */ "./assets/js/blocks/product-collection/edit/toolbar-controls/display-settings-toolbar.tsx"); |
| 3176 | /* harmony import */ var _display_layout_toolbar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./display-layout-toolbar */ "./assets/js/blocks/product-collection/edit/toolbar-controls/display-layout-toolbar.tsx"); |
| 3177 | /* harmony import */ var _pattern_chooser_toolbar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pattern-chooser-toolbar */ "./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-chooser-toolbar.tsx"); |
| 3178 | /* harmony import */ var _pattern_selection_modal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./pattern-selection-modal */ "./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-selection-modal.tsx"); |
| 3179 | |
| 3180 | /** |
| 3181 | * External dependencies |
| 3182 | */ |
| 3183 | |
| 3184 | |
| 3185 | |
| 3186 | |
| 3187 | /** |
| 3188 | * Internal dependencies |
| 3189 | */ |
| 3190 | |
| 3191 | |
| 3192 | |
| 3193 | |
| 3194 | |
| 3195 | function ToolbarControls(props) { |
| 3196 | const [isPatternSelectionModalOpen, setIsPatternSelectionModalOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 3197 | const { |
| 3198 | attributes, |
| 3199 | clientId, |
| 3200 | setAttributes |
| 3201 | } = props; |
| 3202 | const { |
| 3203 | query, |
| 3204 | displayLayout |
| 3205 | } = attributes; |
| 3206 | const setQueryAttributeBind = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => _utils__WEBPACK_IMPORTED_MODULE_3__.setQueryAttribute.bind(null, props), [props]); |
| 3207 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_pattern_chooser_toolbar__WEBPACK_IMPORTED_MODULE_4__["default"], { |
| 3208 | openPatternSelectionModal: () => setIsPatternSelectionModalOpen(true) |
| 3209 | }), !query.inherit && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_display_settings_toolbar__WEBPACK_IMPORTED_MODULE_5__["default"], { |
| 3210 | query: query, |
| 3211 | setQueryAttribute: setQueryAttributeBind |
| 3212 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_display_layout_toolbar__WEBPACK_IMPORTED_MODULE_6__["default"], { |
| 3213 | displayLayout: displayLayout, |
| 3214 | setAttributes: setAttributes |
| 3215 | })), isPatternSelectionModalOpen && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_pattern_selection_modal__WEBPACK_IMPORTED_MODULE_7__["default"], { |
| 3216 | clientId: clientId, |
| 3217 | query: query, |
| 3218 | closePatternSelectionModal: () => setIsPatternSelectionModalOpen(false) |
| 3219 | })); |
| 3220 | } |
| 3221 | ToolbarControls.__docgenInfo = { |
| 3222 | "description": "", |
| 3223 | "methods": [], |
| 3224 | "displayName": "ToolbarControls" |
| 3225 | }; |
| 3226 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3227 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/toolbar-controls/index.tsx"] = { |
| 3228 | name: "ToolbarControls", |
| 3229 | docgenInfo: ToolbarControls.__docgenInfo, |
| 3230 | path: "assets/js/blocks/product-collection/edit/toolbar-controls/index.tsx" |
| 3231 | }; |
| 3232 | } |
| 3233 | |
| 3234 | /***/ }), |
| 3235 | |
| 3236 | /***/ "./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-chooser-toolbar.tsx": |
| 3237 | /*!***********************************************************************************************!*\ |
| 3238 | !*** ./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-chooser-toolbar.tsx ***! |
| 3239 | \***********************************************************************************************/ |
| 3240 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3241 | |
| 3242 | "use strict"; |
| 3243 | __webpack_require__.r(__webpack_exports__); |
| 3244 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3245 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3246 | /* harmony export */ }); |
| 3247 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3248 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3249 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 3250 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 3251 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3252 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 3253 | |
| 3254 | /** |
| 3255 | * External dependencies |
| 3256 | */ |
| 3257 | |
| 3258 | |
| 3259 | const DisplayLayoutControl = props => { |
| 3260 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarGroup, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton, { |
| 3261 | onClick: props.openPatternSelectionModal |
| 3262 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Choose pattern', 'woocommerce'))); |
| 3263 | }; |
| 3264 | DisplayLayoutControl.__docgenInfo = { |
| 3265 | "description": "", |
| 3266 | "methods": [], |
| 3267 | "displayName": "DisplayLayoutControl", |
| 3268 | "props": { |
| 3269 | "openPatternSelectionModal": { |
| 3270 | "required": true, |
| 3271 | "tsType": { |
| 3272 | "name": "signature", |
| 3273 | "type": "function", |
| 3274 | "raw": "() => void", |
| 3275 | "signature": { |
| 3276 | "arguments": [], |
| 3277 | "return": { |
| 3278 | "name": "void" |
| 3279 | } |
| 3280 | } |
| 3281 | }, |
| 3282 | "description": "" |
| 3283 | } |
| 3284 | } |
| 3285 | }; |
| 3286 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DisplayLayoutControl); |
| 3287 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3288 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/toolbar-controls/pattern-chooser-toolbar.tsx"] = { |
| 3289 | name: "DisplayLayoutControl", |
| 3290 | docgenInfo: DisplayLayoutControl.__docgenInfo, |
| 3291 | path: "assets/js/blocks/product-collection/edit/toolbar-controls/pattern-chooser-toolbar.tsx" |
| 3292 | }; |
| 3293 | } |
| 3294 | |
| 3295 | /***/ }), |
| 3296 | |
| 3297 | /***/ "./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-selection-modal.tsx": |
| 3298 | /*!***********************************************************************************************!*\ |
| 3299 | !*** ./assets/js/blocks/product-collection/edit/toolbar-controls/pattern-selection-modal.tsx ***! |
| 3300 | \***********************************************************************************************/ |
| 3301 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3302 | |
| 3303 | "use strict"; |
| 3304 | __webpack_require__.r(__webpack_exports__); |
| 3305 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3306 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3307 | /* harmony export */ }); |
| 3308 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3309 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3310 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 3311 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 3312 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 3313 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__); |
| 3314 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3315 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); |
| 3316 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 3317 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); |
| 3318 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 3319 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_5__); |
| 3320 | |
| 3321 | /** |
| 3322 | * External dependencies |
| 3323 | */ |
| 3324 | |
| 3325 | |
| 3326 | |
| 3327 | |
| 3328 | |
| 3329 | |
| 3330 | /** |
| 3331 | * Internal dependencies |
| 3332 | */ |
| 3333 | |
| 3334 | const blockName = 'woocommerce/product-collection'; |
| 3335 | const DisplayLayoutControl = props => { |
| 3336 | const { |
| 3337 | clientId, |
| 3338 | query |
| 3339 | } = props; |
| 3340 | const { |
| 3341 | replaceBlock, |
| 3342 | selectBlock |
| 3343 | } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useDispatch)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); |
| 3344 | const transformBlock = block => { |
| 3345 | const newInnerBlocks = block.innerBlocks.map(transformBlock); |
| 3346 | if (block.name === blockName) { |
| 3347 | const { |
| 3348 | perPage, |
| 3349 | offset, |
| 3350 | pages |
| 3351 | } = block.attributes.query; |
| 3352 | const newQuery = { |
| 3353 | ...query, |
| 3354 | perPage, |
| 3355 | offset, |
| 3356 | pages |
| 3357 | }; |
| 3358 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_5__.cloneBlock)(block, { |
| 3359 | query: newQuery |
| 3360 | }, newInnerBlocks); |
| 3361 | } |
| 3362 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_5__.cloneBlock)(block, {}, newInnerBlocks); |
| 3363 | }; |
| 3364 | const blockPatterns = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)(select => { |
| 3365 | const { |
| 3366 | getBlockRootClientId, |
| 3367 | getPatternsByBlockTypes |
| 3368 | } = select(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.store); |
| 3369 | const rootClientId = getBlockRootClientId(clientId); |
| 3370 | return getPatternsByBlockTypes(blockName, rootClientId); |
| 3371 | }, [blockName, clientId]); |
| 3372 | const onClickPattern = (pattern, blocks) => { |
| 3373 | const newBlocks = blocks.map(transformBlock); |
| 3374 | replaceBlock(clientId, newBlocks); |
| 3375 | selectBlock(newBlocks[0].clientId); |
| 3376 | }; |
| 3377 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Modal, { |
| 3378 | overlayClassName: "wc-blocks-product-collection__selection-modal", |
| 3379 | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Choose a pattern', 'woocommerce'), |
| 3380 | onRequestClose: props.closePatternSelectionModal, |
| 3381 | isFullScreen: true |
| 3382 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 3383 | className: "wc-blocks-product-collection__selection-content" |
| 3384 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.__experimentalBlockPatternsList, { |
| 3385 | blockPatterns: blockPatterns, |
| 3386 | shownPatterns: blockPatterns, |
| 3387 | onClickPattern: onClickPattern |
| 3388 | }))); |
| 3389 | }; |
| 3390 | DisplayLayoutControl.__docgenInfo = { |
| 3391 | "description": "", |
| 3392 | "methods": [], |
| 3393 | "displayName": "DisplayLayoutControl", |
| 3394 | "props": { |
| 3395 | "clientId": { |
| 3396 | "required": true, |
| 3397 | "tsType": { |
| 3398 | "name": "string" |
| 3399 | }, |
| 3400 | "description": "" |
| 3401 | }, |
| 3402 | "query": { |
| 3403 | "required": true, |
| 3404 | "tsType": { |
| 3405 | "name": "ProductCollectionQuery" |
| 3406 | }, |
| 3407 | "description": "" |
| 3408 | }, |
| 3409 | "closePatternSelectionModal": { |
| 3410 | "required": true, |
| 3411 | "tsType": { |
| 3412 | "name": "signature", |
| 3413 | "type": "function", |
| 3414 | "raw": "() => void", |
| 3415 | "signature": { |
| 3416 | "arguments": [], |
| 3417 | "return": { |
| 3418 | "name": "void" |
| 3419 | } |
| 3420 | } |
| 3421 | }, |
| 3422 | "description": "" |
| 3423 | } |
| 3424 | } |
| 3425 | }; |
| 3426 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DisplayLayoutControl); |
| 3427 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3428 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/edit/toolbar-controls/pattern-selection-modal.tsx"] = { |
| 3429 | name: "DisplayLayoutControl", |
| 3430 | docgenInfo: DisplayLayoutControl.__docgenInfo, |
| 3431 | path: "assets/js/blocks/product-collection/edit/toolbar-controls/pattern-selection-modal.tsx" |
| 3432 | }; |
| 3433 | } |
| 3434 | |
| 3435 | /***/ }), |
| 3436 | |
| 3437 | /***/ "./assets/js/blocks/product-collection/icon.tsx": |
| 3438 | /*!******************************************************!*\ |
| 3439 | !*** ./assets/js/blocks/product-collection/icon.tsx ***! |
| 3440 | \******************************************************/ |
| 3441 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3442 | |
| 3443 | "use strict"; |
| 3444 | __webpack_require__.r(__webpack_exports__); |
| 3445 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3446 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3447 | /* harmony export */ }); |
| 3448 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3449 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3450 | |
| 3451 | const Icon = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { |
| 3452 | width: "24", |
| 3453 | height: "24", |
| 3454 | viewBox: "0 0 24 24", |
| 3455 | fill: "none", |
| 3456 | xmlns: "http://www.w3.org/2000/svg" |
| 3457 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { |
| 3458 | fillRule: "evenodd", |
| 3459 | clipRule: "evenodd", |
| 3460 | d: "M19 11H5C4.72386 11 4.5 11.2239 4.5 11.5V17.5C4.5 17.7761 4.72386 18 5 18H19C19.2761 18 19.5 17.7761 19.5 17.5V11.5C19.5 11.2239 19.2761 11 19 11ZM5 9.5H19C20.1046 9.5 21 10.3954 21 11.5V17.5C21 18.6046 20.1046 19.5 19 19.5H5C3.89543 19.5 3 18.6046 3 17.5V11.5C3 10.3954 3.89543 9.5 5 9.5Z", |
| 3461 | fill: "currentColor" |
| 3462 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { |
| 3463 | fillRule: "evenodd", |
| 3464 | clipRule: "evenodd", |
| 3465 | d: "M18 7.5C18 7.77614 17.7761 8 17.5 8L6.5 8C6.22386 8 6 7.77614 6 7.5V7.5C6 7.22386 6.22386 7 6.5 7L17.5 7C17.7761 7 18 7.22386 18 7.5V7.5Z", |
| 3466 | fill: "currentColor" |
| 3467 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { |
| 3468 | fillRule: "evenodd", |
| 3469 | clipRule: "evenodd", |
| 3470 | d: "M16 5C16 5.27614 15.7761 5.5 15.5 5.5L8.5 5.5C8.22386 5.5 8 5.27614 8 5V5C8 4.72386 8.22386 4.5 8.5 4.5L15.5 4.5C15.7761 4.5 16 4.72386 16 5V5Z", |
| 3471 | fill: "currentColor" |
| 3472 | })); |
| 3473 | Icon.__docgenInfo = { |
| 3474 | "description": "", |
| 3475 | "methods": [], |
| 3476 | "displayName": "Icon" |
| 3477 | }; |
| 3478 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Icon); |
| 3479 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3480 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/icon.tsx"] = { |
| 3481 | name: "Icon", |
| 3482 | docgenInfo: Icon.__docgenInfo, |
| 3483 | path: "assets/js/blocks/product-collection/icon.tsx" |
| 3484 | }; |
| 3485 | } |
| 3486 | |
| 3487 | /***/ }), |
| 3488 | |
| 3489 | /***/ "./assets/js/blocks/product-collection/index.tsx": |
| 3490 | /*!*******************************************************!*\ |
| 3491 | !*** ./assets/js/blocks/product-collection/index.tsx ***! |
| 3492 | \*******************************************************/ |
| 3493 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3494 | |
| 3495 | "use strict"; |
| 3496 | __webpack_require__.r(__webpack_exports__); |
| 3497 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 3498 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 3499 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./block.json */ "./assets/js/blocks/product-collection/block.json"); |
| 3500 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./assets/js/blocks/product-collection/edit/index.tsx"); |
| 3501 | /* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./save */ "./assets/js/blocks/product-collection/save.tsx"); |
| 3502 | /* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./icon */ "./assets/js/blocks/product-collection/icon.tsx"); |
| 3503 | /* harmony import */ var _variations_elements_product_summary__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variations/elements/product-summary */ "./assets/js/blocks/product-collection/variations/elements/product-summary.tsx"); |
| 3504 | /* harmony import */ var _variations_elements_product_title__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variations/elements/product-title */ "./assets/js/blocks/product-collection/variations/elements/product-title.tsx"); |
| 3505 | /** |
| 3506 | * External dependencies |
| 3507 | */ |
| 3508 | |
| 3509 | |
| 3510 | /** |
| 3511 | * Internal dependencies |
| 3512 | */ |
| 3513 | |
| 3514 | |
| 3515 | |
| 3516 | |
| 3517 | |
| 3518 | |
| 3519 | (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_1__, { |
| 3520 | icon: _icon__WEBPACK_IMPORTED_MODULE_2__["default"], |
| 3521 | edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"], |
| 3522 | save: _save__WEBPACK_IMPORTED_MODULE_4__["default"] |
| 3523 | }); |
| 3524 | (0,_variations_elements_product_summary__WEBPACK_IMPORTED_MODULE_5__["default"])(); |
| 3525 | (0,_variations_elements_product_title__WEBPACK_IMPORTED_MODULE_6__["default"])(); |
| 3526 | |
| 3527 | /***/ }), |
| 3528 | |
| 3529 | /***/ "./assets/js/blocks/product-collection/save.tsx": |
| 3530 | /*!******************************************************!*\ |
| 3531 | !*** ./assets/js/blocks/product-collection/save.tsx ***! |
| 3532 | \******************************************************/ |
| 3533 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3534 | |
| 3535 | "use strict"; |
| 3536 | __webpack_require__.r(__webpack_exports__); |
| 3537 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3538 | /* harmony export */ "default": () => (/* binding */ QuerySave) |
| 3539 | /* harmony export */ }); |
| 3540 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3541 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3542 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 3543 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| 3544 | |
| 3545 | /** |
| 3546 | * External dependencies |
| 3547 | */ |
| 3548 | |
| 3549 | function QuerySave({ |
| 3550 | attributes: { |
| 3551 | tagName: Tag = 'div' |
| 3552 | } |
| 3553 | }) { |
| 3554 | const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save(); |
| 3555 | const innerBlocksProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useInnerBlocksProps.save(blockProps); |
| 3556 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Tag, { |
| 3557 | ...innerBlocksProps |
| 3558 | }); |
| 3559 | } |
| 3560 | QuerySave.__docgenInfo = { |
| 3561 | "description": "", |
| 3562 | "methods": [], |
| 3563 | "displayName": "QuerySave" |
| 3564 | }; |
| 3565 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3566 | STORYBOOK_REACT_CLASSES["assets/js/blocks/product-collection/save.tsx"] = { |
| 3567 | name: "QuerySave", |
| 3568 | docgenInfo: QuerySave.__docgenInfo, |
| 3569 | path: "assets/js/blocks/product-collection/save.tsx" |
| 3570 | }; |
| 3571 | } |
| 3572 | |
| 3573 | /***/ }), |
| 3574 | |
| 3575 | /***/ "./assets/js/blocks/product-collection/types.ts": |
| 3576 | /*!******************************************************!*\ |
| 3577 | !*** ./assets/js/blocks/product-collection/types.ts ***! |
| 3578 | \******************************************************/ |
| 3579 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3580 | |
| 3581 | "use strict"; |
| 3582 | __webpack_require__.r(__webpack_exports__); |
| 3583 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3584 | /* harmony export */ ETimeFrameOperator: () => (/* binding */ ETimeFrameOperator), |
| 3585 | /* harmony export */ LayoutOptions: () => (/* binding */ LayoutOptions) |
| 3586 | /* harmony export */ }); |
| 3587 | /** |
| 3588 | * External dependencies |
| 3589 | */ |
| 3590 | |
| 3591 | let LayoutOptions = /*#__PURE__*/function (LayoutOptions) { |
| 3592 | LayoutOptions["GRID"] = "flex"; |
| 3593 | LayoutOptions["STACK"] = "list"; |
| 3594 | return LayoutOptions; |
| 3595 | }({}); |
| 3596 | let ETimeFrameOperator = /*#__PURE__*/function (ETimeFrameOperator) { |
| 3597 | ETimeFrameOperator["IN"] = "in"; |
| 3598 | ETimeFrameOperator["NOT_IN"] = "not-in"; |
| 3599 | return ETimeFrameOperator; |
| 3600 | }({}); |
| 3601 | |
| 3602 | /***/ }), |
| 3603 | |
| 3604 | /***/ "./assets/js/blocks/product-collection/utils.tsx": |
| 3605 | /*!*******************************************************!*\ |
| 3606 | !*** ./assets/js/blocks/product-collection/utils.tsx ***! |
| 3607 | \*******************************************************/ |
| 3608 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3609 | |
| 3610 | "use strict"; |
| 3611 | __webpack_require__.r(__webpack_exports__); |
| 3612 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3613 | /* harmony export */ getDefaultValueOfInheritQueryFromTemplate: () => (/* binding */ getDefaultValueOfInheritQueryFromTemplate), |
| 3614 | /* harmony export */ setQueryAttribute: () => (/* binding */ setQueryAttribute) |
| 3615 | /* harmony export */ }); |
| 3616 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 3617 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); |
| 3618 | /** |
| 3619 | * External dependencies |
| 3620 | */ |
| 3621 | |
| 3622 | |
| 3623 | |
| 3624 | /** |
| 3625 | * Internal dependencies |
| 3626 | */ |
| 3627 | |
| 3628 | /** |
| 3629 | * Sets the new query arguments of a Product Query block |
| 3630 | * |
| 3631 | * Shorthand for setting new nested query parameters. |
| 3632 | */ |
| 3633 | function setQueryAttribute(block, queryParams) { |
| 3634 | const { |
| 3635 | query |
| 3636 | } = block.attributes; |
| 3637 | block.setAttributes({ |
| 3638 | query: { |
| 3639 | ...query, |
| 3640 | ...queryParams |
| 3641 | } |
| 3642 | }); |
| 3643 | } |
| 3644 | function getDefaultValueOfInheritQueryFromTemplate() { |
| 3645 | const ARCHIVE_PRODUCT_TEMPLATES = ['woocommerce/woocommerce//archive-product', 'woocommerce/woocommerce//taxonomy-product_cat', 'woocommerce/woocommerce//taxonomy-product_tag', 'woocommerce/woocommerce//taxonomy-product_attribute', 'woocommerce/woocommerce//product-search-results']; |
| 3646 | const editSiteStore = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('core/edit-site'); |
| 3647 | const currentTemplateId = editSiteStore === null || editSiteStore === void 0 ? void 0 : editSiteStore.getEditedPostId(); |
| 3648 | |
| 3649 | /** |
| 3650 | * Set inherit value when Product Collection block is first added to the page. |
| 3651 | * We want inherit value to be true when block is added to ARCHIVE_PRODUCT_TEMPLATES |
| 3652 | * and false when added to somewhere else. |
| 3653 | */ |
| 3654 | const initialValue = currentTemplateId ? ARCHIVE_PRODUCT_TEMPLATES.includes(currentTemplateId) : false; |
| 3655 | return initialValue; |
| 3656 | } |
| 3657 | |
| 3658 | /***/ }), |
| 3659 | |
| 3660 | /***/ "./assets/js/blocks/product-collection/variations/elements/product-summary.tsx": |
| 3661 | /*!*************************************************************************************!*\ |
| 3662 | !*** ./assets/js/blocks/product-collection/variations/elements/product-summary.tsx ***! |
| 3663 | \*************************************************************************************/ |
| 3664 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3665 | |
| 3666 | "use strict"; |
| 3667 | __webpack_require__.r(__webpack_exports__); |
| 3668 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3669 | /* harmony export */ CORE_NAME: () => (/* binding */ CORE_NAME), |
| 3670 | /* harmony export */ VARIATION_NAME: () => (/* binding */ VARIATION_NAME), |
| 3671 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3672 | /* harmony export */ }); |
| 3673 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3674 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3675 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3676 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); |
| 3677 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/page.js"); |
| 3678 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./assets/js/blocks/product-collection/variations/elements/utils.tsx"); |
| 3679 | /* harmony import */ var _atomic_blocks_product_elements_summary_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../atomic/blocks/product-elements/summary/constants */ "./assets/js/atomic/blocks/product-elements/summary/constants.tsx"); |
| 3680 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../block.json */ "./assets/js/blocks/product-collection/block.json"); |
| 3681 | |
| 3682 | /** |
| 3683 | * External dependencies |
| 3684 | */ |
| 3685 | |
| 3686 | |
| 3687 | |
| 3688 | /** |
| 3689 | * Internal dependencies |
| 3690 | */ |
| 3691 | |
| 3692 | |
| 3693 | |
| 3694 | const CORE_NAME = 'core/post-excerpt'; |
| 3695 | const VARIATION_NAME = `${_block_json__WEBPACK_IMPORTED_MODULE_3__.name}/product-summary`; |
| 3696 | const registerProductSummary = () => { |
| 3697 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.registerElementVariation)(CORE_NAME, { |
| 3698 | blockDescription: _atomic_blocks_product_elements_summary_constants__WEBPACK_IMPORTED_MODULE_2__.BLOCK_DESCRIPTION, |
| 3699 | blockIcon: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { |
| 3700 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"] |
| 3701 | }), |
| 3702 | blockTitle: _atomic_blocks_product_elements_summary_constants__WEBPACK_IMPORTED_MODULE_2__.BLOCK_TITLE, |
| 3703 | variationName: VARIATION_NAME |
| 3704 | }); |
| 3705 | }; |
| 3706 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (registerProductSummary); |
| 3707 | |
| 3708 | /***/ }), |
| 3709 | |
| 3710 | /***/ "./assets/js/blocks/product-collection/variations/elements/product-title.tsx": |
| 3711 | /*!***********************************************************************************!*\ |
| 3712 | !*** ./assets/js/blocks/product-collection/variations/elements/product-title.tsx ***! |
| 3713 | \***********************************************************************************/ |
| 3714 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3715 | |
| 3716 | "use strict"; |
| 3717 | __webpack_require__.r(__webpack_exports__); |
| 3718 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3719 | /* harmony export */ CORE_NAME: () => (/* binding */ CORE_NAME), |
| 3720 | /* harmony export */ VARIATION_NAME: () => (/* binding */ VARIATION_NAME), |
| 3721 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3722 | /* harmony export */ }); |
| 3723 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3724 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3725 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3726 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); |
| 3727 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/heading.js"); |
| 3728 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./assets/js/blocks/product-collection/variations/elements/utils.tsx"); |
| 3729 | /* harmony import */ var _atomic_blocks_product_elements_title_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../atomic/blocks/product-elements/title/constants */ "./assets/js/atomic/blocks/product-elements/title/constants.tsx"); |
| 3730 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../block.json */ "./assets/js/blocks/product-collection/block.json"); |
| 3731 | |
| 3732 | /** |
| 3733 | * External dependencies |
| 3734 | */ |
| 3735 | |
| 3736 | |
| 3737 | |
| 3738 | /** |
| 3739 | * Internal dependencies |
| 3740 | */ |
| 3741 | |
| 3742 | |
| 3743 | |
| 3744 | const CORE_NAME = 'core/post-title'; |
| 3745 | const VARIATION_NAME = `${_block_json__WEBPACK_IMPORTED_MODULE_3__.name}/product-title`; |
| 3746 | const registerProductTitle = () => { |
| 3747 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.registerElementVariation)(CORE_NAME, { |
| 3748 | blockDescription: _atomic_blocks_product_elements_title_constants__WEBPACK_IMPORTED_MODULE_2__.BLOCK_DESCRIPTION, |
| 3749 | blockIcon: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Icon, { |
| 3750 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"] |
| 3751 | }), |
| 3752 | blockTitle: _atomic_blocks_product_elements_title_constants__WEBPACK_IMPORTED_MODULE_2__.BLOCK_TITLE, |
| 3753 | variationName: VARIATION_NAME |
| 3754 | }); |
| 3755 | }; |
| 3756 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (registerProductTitle); |
| 3757 | |
| 3758 | /***/ }), |
| 3759 | |
| 3760 | /***/ "./assets/js/blocks/product-collection/variations/elements/utils.tsx": |
| 3761 | /*!***************************************************************************!*\ |
| 3762 | !*** ./assets/js/blocks/product-collection/variations/elements/utils.tsx ***! |
| 3763 | \***************************************************************************/ |
| 3764 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3765 | |
| 3766 | "use strict"; |
| 3767 | __webpack_require__.r(__webpack_exports__); |
| 3768 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3769 | /* harmony export */ registerElementVariation: () => (/* binding */ registerElementVariation) |
| 3770 | /* harmony export */ }); |
| 3771 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 3772 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 3773 | /** |
| 3774 | * External dependencies |
| 3775 | */ |
| 3776 | |
| 3777 | function registerElementVariation(coreName, { |
| 3778 | blockDescription, |
| 3779 | blockIcon, |
| 3780 | blockTitle, |
| 3781 | variationName |
| 3782 | }) { |
| 3783 | (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockVariation)(coreName, { |
| 3784 | description: blockDescription, |
| 3785 | name: variationName, |
| 3786 | title: blockTitle, |
| 3787 | isActive: blockAttributes => blockAttributes.__woocommerceNamespace === variationName, |
| 3788 | icon: { |
| 3789 | src: blockIcon |
| 3790 | }, |
| 3791 | attributes: { |
| 3792 | __woocommerceNamespace: variationName |
| 3793 | }, |
| 3794 | scope: ['block', 'inserter'] |
| 3795 | }); |
| 3796 | } |
| 3797 | |
| 3798 | /***/ }), |
| 3799 | |
| 3800 | /***/ "./assets/js/editor-components/error-placeholder/error-message.tsx": |
| 3801 | /*!*************************************************************************!*\ |
| 3802 | !*** ./assets/js/editor-components/error-placeholder/error-message.tsx ***! |
| 3803 | \*************************************************************************/ |
| 3804 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3805 | |
| 3806 | "use strict"; |
| 3807 | __webpack_require__.r(__webpack_exports__); |
| 3808 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3809 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3810 | /* harmony export */ }); |
| 3811 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3812 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3813 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 3814 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 3815 | /* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/escape-html */ "@wordpress/escape-html"); |
| 3816 | /* harmony import */ var _wordpress_escape_html__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_2__); |
| 3817 | |
| 3818 | /** |
| 3819 | * External dependencies |
| 3820 | */ |
| 3821 | |
| 3822 | |
| 3823 | |
| 3824 | /** |
| 3825 | * Internal dependencies |
| 3826 | */ |
| 3827 | |
| 3828 | const getErrorMessage = ({ |
| 3829 | message, |
| 3830 | type |
| 3831 | }) => { |
| 3832 | if (!message) { |
| 3833 | return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('An error has prevented the block from being updated.', 'woocommerce'); |
| 3834 | } |
| 3835 | if (type === 'general') { |
| 3836 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The following error was returned', 'woocommerce'), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("code", null, (0,_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_2__.escapeHTML)(message))); |
| 3837 | } |
| 3838 | if (type === 'api') { |
| 3839 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The following error was returned from the API', 'woocommerce'), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("br", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("code", null, (0,_wordpress_escape_html__WEBPACK_IMPORTED_MODULE_2__.escapeHTML)(message))); |
| 3840 | } |
| 3841 | return message; |
| 3842 | }; |
| 3843 | const ErrorMessage = ({ |
| 3844 | error |
| 3845 | }) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 3846 | className: "wc-block-error-message" |
| 3847 | }, getErrorMessage(error)); |
| 3848 | ErrorMessage.__docgenInfo = { |
| 3849 | "description": "", |
| 3850 | "methods": [], |
| 3851 | "displayName": "ErrorMessage", |
| 3852 | "props": { |
| 3853 | "error": { |
| 3854 | "required": true, |
| 3855 | "tsType": { |
| 3856 | "name": "ErrorObject" |
| 3857 | }, |
| 3858 | "description": "The error object." |
| 3859 | } |
| 3860 | } |
| 3861 | }; |
| 3862 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ErrorMessage); |
| 3863 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3864 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/error-placeholder/error-message.tsx"] = { |
| 3865 | name: "ErrorMessage", |
| 3866 | docgenInfo: ErrorMessage.__docgenInfo, |
| 3867 | path: "assets/js/editor-components/error-placeholder/error-message.tsx" |
| 3868 | }; |
| 3869 | } |
| 3870 | |
| 3871 | /***/ }), |
| 3872 | |
| 3873 | /***/ "./assets/js/editor-components/expandable-search-list-item/expandable-search-list-item.tsx": |
| 3874 | /*!*************************************************************************************************!*\ |
| 3875 | !*** ./assets/js/editor-components/expandable-search-list-item/expandable-search-list-item.tsx ***! |
| 3876 | \*************************************************************************************************/ |
| 3877 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3878 | |
| 3879 | "use strict"; |
| 3880 | __webpack_require__.r(__webpack_exports__); |
| 3881 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3882 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3883 | /* harmony export */ }); |
| 3884 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3885 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3886 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 3887 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); |
| 3888 | /* harmony import */ var _woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/editor-components/search-list-control */ "./assets/js/editor-components/search-list-control/item.tsx"); |
| 3889 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ "../../node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.js"); |
| 3890 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); |
| 3891 | |
| 3892 | /** |
| 3893 | * External dependencies |
| 3894 | */ |
| 3895 | |
| 3896 | |
| 3897 | |
| 3898 | const ExpandableSearchListItem = ({ |
| 3899 | className, |
| 3900 | item, |
| 3901 | isSelected, |
| 3902 | isLoading, |
| 3903 | onSelect, |
| 3904 | disabled, |
| 3905 | ...rest |
| 3906 | }) => { |
| 3907 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_3__.SearchListItem, { |
| 3908 | ...rest, |
| 3909 | key: item.id, |
| 3910 | className: className, |
| 3911 | isSelected: isSelected, |
| 3912 | item: item, |
| 3913 | onSelect: onSelect, |
| 3914 | disabled: disabled |
| 3915 | }), isSelected && isLoading && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 3916 | key: "loading", |
| 3917 | className: classnames__WEBPACK_IMPORTED_MODULE_2___default()('woocommerce-search-list__item', 'woocommerce-product-attributes__item', 'depth-1', 'is-loading', 'is-not-active') |
| 3918 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Spinner, null))); |
| 3919 | }; |
| 3920 | ExpandableSearchListItem.__docgenInfo = { |
| 3921 | "description": "", |
| 3922 | "methods": [], |
| 3923 | "displayName": "ExpandableSearchListItem", |
| 3924 | "props": { |
| 3925 | "isLoading": { |
| 3926 | "required": true, |
| 3927 | "tsType": { |
| 3928 | "name": "boolean" |
| 3929 | }, |
| 3930 | "description": "" |
| 3931 | } |
| 3932 | }, |
| 3933 | "composes": ["RenderItemArgs"] |
| 3934 | }; |
| 3935 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExpandableSearchListItem); |
| 3936 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 3937 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/expandable-search-list-item/expandable-search-list-item.tsx"] = { |
| 3938 | name: "ExpandableSearchListItem", |
| 3939 | docgenInfo: ExpandableSearchListItem.__docgenInfo, |
| 3940 | path: "assets/js/editor-components/expandable-search-list-item/expandable-search-list-item.tsx" |
| 3941 | }; |
| 3942 | } |
| 3943 | |
| 3944 | /***/ }), |
| 3945 | |
| 3946 | /***/ "./assets/js/editor-components/feedback-prompt/index.tsx": |
| 3947 | /*!***************************************************************!*\ |
| 3948 | !*** ./assets/js/editor-components/feedback-prompt/index.tsx ***! |
| 3949 | \***************************************************************/ |
| 3950 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3951 | |
| 3952 | "use strict"; |
| 3953 | __webpack_require__.r(__webpack_exports__); |
| 3954 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3955 | /* harmony export */ CartCheckoutFeedbackPrompt: () => (/* binding */ CartCheckoutFeedbackPrompt), |
| 3956 | /* harmony export */ ProductCollectionFeedbackPrompt: () => (/* binding */ ProductCollectionFeedbackPrompt), |
| 3957 | /* harmony export */ ProductQueryFeedbackPrompt: () => (/* binding */ ProductQueryFeedbackPrompt), |
| 3958 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3959 | /* harmony export */ }); |
| 3960 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 3961 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 3962 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 3963 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 3964 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/icon/index.js"); |
| 3965 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/comment-content.js"); |
| 3966 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/external.js"); |
| 3967 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 3968 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); |
| 3969 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.scss */ "./assets/js/editor-components/feedback-prompt/style.scss"); |
| 3970 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_scss__WEBPACK_IMPORTED_MODULE_3__); |
| 3971 | |
| 3972 | /** |
| 3973 | * External dependencies |
| 3974 | */ |
| 3975 | |
| 3976 | |
| 3977 | |
| 3978 | |
| 3979 | /** |
| 3980 | * Internal dependencies |
| 3981 | */ |
| 3982 | |
| 3983 | /** |
| 3984 | * Component to render a Feedback prompt in the sidebar. |
| 3985 | * |
| 3986 | * @param {Object} props Incoming props for the component. |
| 3987 | * @param {string} props.text |
| 3988 | * @param {string} props.title |
| 3989 | * @param {string} props.url |
| 3990 | */ |
| 3991 | const FeedbackPrompt = ({ |
| 3992 | text, |
| 3993 | title = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Feedback?', 'woocommerce'), |
| 3994 | url |
| 3995 | }) => { |
| 3996 | // By returning false we ensure that this component is not entered into the InspectorControls |
| 3997 | // (which is a slot fill), children array on first render, on the second render when the state |
| 3998 | // gets updated this component does get put into the InspectorControls children array but as the |
| 3999 | // last item, ensuring it shows last in the sidebar. |
| 4000 | const [isVisible, setIsVisible] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(false); |
| 4001 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { |
| 4002 | setIsVisible(true); |
| 4003 | }, []); |
| 4004 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, isVisible && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4005 | className: "wc-block-feedback-prompt" |
| 4006 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["default"], { |
| 4007 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"] |
| 4008 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", { |
| 4009 | className: "wc-block-feedback-prompt__title" |
| 4010 | }, title), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { |
| 4011 | className: "wc-block-feedback-prompt__text" |
| 4012 | }, text), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { |
| 4013 | href: url, |
| 4014 | className: "wc-block-feedback-prompt__link", |
| 4015 | rel: "noreferrer noopener", |
| 4016 | target: "_blank" |
| 4017 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Give us your feedback.', 'woocommerce'), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["default"], { |
| 4018 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], |
| 4019 | size: 16 |
| 4020 | })))); |
| 4021 | }; |
| 4022 | FeedbackPrompt.__docgenInfo = { |
| 4023 | "description": "Component to render a Feedback prompt in the sidebar.\n\n@param {Object} props Incoming props for the component.\n@param {string} props.text\n@param {string} props.title\n@param {string} props.url", |
| 4024 | "methods": [], |
| 4025 | "displayName": "FeedbackPrompt", |
| 4026 | "props": { |
| 4027 | "title": { |
| 4028 | "defaultValue": { |
| 4029 | "value": "__( 'Feedback?', 'woocommerce' )", |
| 4030 | "computed": true |
| 4031 | }, |
| 4032 | "required": false, |
| 4033 | "tsType": { |
| 4034 | "name": "string" |
| 4035 | }, |
| 4036 | "description": "" |
| 4037 | }, |
| 4038 | "text": { |
| 4039 | "required": true, |
| 4040 | "tsType": { |
| 4041 | "name": "string" |
| 4042 | }, |
| 4043 | "description": "" |
| 4044 | }, |
| 4045 | "url": { |
| 4046 | "required": true, |
| 4047 | "tsType": { |
| 4048 | "name": "string" |
| 4049 | }, |
| 4050 | "description": "" |
| 4051 | } |
| 4052 | } |
| 4053 | }; |
| 4054 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FeedbackPrompt); |
| 4055 | const CartCheckoutFeedbackPrompt = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(FeedbackPrompt, { |
| 4056 | text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('We are currently working on improving our cart and checkout blocks to provide merchants with the tools and customization options they need.', 'woocommerce'), |
| 4057 | url: "https://github.com/woocommerce/woocommerce/discussions/new?category=checkout-flow&labels=type%3A+product%20feedback" |
| 4058 | }); |
| 4059 | const ProductQueryFeedbackPrompt = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(FeedbackPrompt, { |
| 4060 | text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Thanks for trying out the Products block! Help us make it better by sharing your feedback.', 'woocommerce'), |
| 4061 | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Share your feedback!', 'woocommerce'), |
| 4062 | url: 'https://airtable.com/shrFX5FAqmCY6hVYI' |
| 4063 | }); |
| 4064 | const ProductCollectionFeedbackPrompt = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(FeedbackPrompt, { |
| 4065 | text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Thanks for trying out the Product Collection block! Help us make it better by sharing your feedback.', 'woocommerce'), |
| 4066 | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Share your feedback!', 'woocommerce'), |
| 4067 | url: 'https://airtable.com/shrqsMSDPvAKoY99u' |
| 4068 | }); |
| 4069 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4070 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/feedback-prompt/index.tsx"] = { |
| 4071 | name: "FeedbackPrompt", |
| 4072 | docgenInfo: FeedbackPrompt.__docgenInfo, |
| 4073 | path: "assets/js/editor-components/feedback-prompt/index.tsx" |
| 4074 | }; |
| 4075 | } |
| 4076 | CartCheckoutFeedbackPrompt.__docgenInfo = { |
| 4077 | "description": "", |
| 4078 | "methods": [], |
| 4079 | "displayName": "CartCheckoutFeedbackPrompt" |
| 4080 | }; |
| 4081 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4082 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/feedback-prompt/index.tsx"] = { |
| 4083 | name: "CartCheckoutFeedbackPrompt", |
| 4084 | docgenInfo: CartCheckoutFeedbackPrompt.__docgenInfo, |
| 4085 | path: "assets/js/editor-components/feedback-prompt/index.tsx" |
| 4086 | }; |
| 4087 | } |
| 4088 | ProductQueryFeedbackPrompt.__docgenInfo = { |
| 4089 | "description": "", |
| 4090 | "methods": [], |
| 4091 | "displayName": "ProductQueryFeedbackPrompt" |
| 4092 | }; |
| 4093 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4094 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/feedback-prompt/index.tsx"] = { |
| 4095 | name: "ProductQueryFeedbackPrompt", |
| 4096 | docgenInfo: ProductQueryFeedbackPrompt.__docgenInfo, |
| 4097 | path: "assets/js/editor-components/feedback-prompt/index.tsx" |
| 4098 | }; |
| 4099 | } |
| 4100 | ProductCollectionFeedbackPrompt.__docgenInfo = { |
| 4101 | "description": "", |
| 4102 | "methods": [], |
| 4103 | "displayName": "ProductCollectionFeedbackPrompt" |
| 4104 | }; |
| 4105 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4106 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/feedback-prompt/index.tsx"] = { |
| 4107 | name: "ProductCollectionFeedbackPrompt", |
| 4108 | docgenInfo: ProductCollectionFeedbackPrompt.__docgenInfo, |
| 4109 | path: "assets/js/editor-components/feedback-prompt/index.tsx" |
| 4110 | }; |
| 4111 | } |
| 4112 | |
| 4113 | /***/ }), |
| 4114 | |
| 4115 | /***/ "./assets/js/editor-components/product-attribute-term-control/index.tsx": |
| 4116 | /*!******************************************************************************!*\ |
| 4117 | !*** ./assets/js/editor-components/product-attribute-term-control/index.tsx ***! |
| 4118 | \******************************************************************************/ |
| 4119 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4120 | |
| 4121 | "use strict"; |
| 4122 | __webpack_require__.r(__webpack_exports__); |
| 4123 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4124 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 4125 | /* harmony export */ }); |
| 4126 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 4127 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 4128 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "../../node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.js"); |
| 4129 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); |
| 4130 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 4131 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); |
| 4132 | /* harmony import */ var _woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @woocommerce/editor-components/search-list-control */ "./assets/js/editor-components/search-list-control/item.tsx"); |
| 4133 | /* harmony import */ var _woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @woocommerce/editor-components/search-list-control */ "./assets/js/editor-components/search-list-control/search-list-control.tsx"); |
| 4134 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 4135 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); |
| 4136 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 4137 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_4__); |
| 4138 | /* harmony import */ var _woocommerce_base_context_hooks_use_product_attributes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @woocommerce/base-context/hooks/use-product-attributes */ "./assets/js/base/context/hooks/use-product-attributes.ts"); |
| 4139 | /* harmony import */ var _woocommerce_editor_components_error_placeholder_error_message__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @woocommerce/editor-components/error-placeholder/error-message */ "./assets/js/editor-components/error-placeholder/error-message.tsx"); |
| 4140 | /* harmony import */ var _woocommerce_editor_components_expandable_search_list_item_expandable_search_list_item__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @woocommerce/editor-components/expandable-search-list-item/expandable-search-list-item */ "./assets/js/editor-components/expandable-search-list-item/expandable-search-list-item.tsx"); |
| 4141 | /* harmony import */ var _woocommerce_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @woocommerce/utils */ "./assets/js/utils/attributes.ts"); |
| 4142 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style.scss */ "./assets/js/editor-components/product-attribute-term-control/style.scss"); |
| 4143 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_scss__WEBPACK_IMPORTED_MODULE_5__); |
| 4144 | |
| 4145 | /** |
| 4146 | * External dependencies |
| 4147 | */ |
| 4148 | |
| 4149 | |
| 4150 | |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | |
| 4156 | |
| 4157 | |
| 4158 | /** |
| 4159 | * Internal dependencies |
| 4160 | */ |
| 4161 | |
| 4162 | const ProductAttributeTermControl = ({ |
| 4163 | onChange, |
| 4164 | onOperatorChange, |
| 4165 | instanceId, |
| 4166 | isCompact = false, |
| 4167 | messages = {}, |
| 4168 | operator = 'any', |
| 4169 | selected, |
| 4170 | type = 'text' |
| 4171 | }) => { |
| 4172 | const { |
| 4173 | errorLoadingAttributes, |
| 4174 | isLoadingAttributes, |
| 4175 | productsAttributes |
| 4176 | } = (0,_woocommerce_base_context_hooks_use_product_attributes__WEBPACK_IMPORTED_MODULE_6__["default"])(true); |
| 4177 | const renderItem = args => { |
| 4178 | const { |
| 4179 | item, |
| 4180 | search, |
| 4181 | depth = 0 |
| 4182 | } = args; |
| 4183 | const count = item.count || 0; |
| 4184 | const classes = ['woocommerce-product-attributes__item', 'woocommerce-search-list__item', { |
| 4185 | 'is-searching': search.length > 0, |
| 4186 | 'is-skip-level': depth === 0 && item.parent !== 0 |
| 4187 | }]; |
| 4188 | if (!item.breadcrumbs.length) { |
| 4189 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_expandable_search_list_item_expandable_search_list_item__WEBPACK_IMPORTED_MODULE_7__["default"], { |
| 4190 | ...args, |
| 4191 | className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(classes), |
| 4192 | item: item, |
| 4193 | isLoading: isLoadingAttributes, |
| 4194 | disabled: item.count === 0, |
| 4195 | name: `attributes-${instanceId}`, |
| 4196 | countLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %d is the count of terms. */ |
| 4197 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%d term', '%d terms', count, 'woocommerce'), count), |
| 4198 | "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %1$s is the item name, %2$d is the count of terms for the item. */ |
| 4199 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%1$s, has %2$d term', '%1$s, has %2$d terms', count, 'woocommerce'), item.name, count) |
| 4200 | }); |
| 4201 | } |
| 4202 | const itemName = `${item.breadcrumbs[0]}: ${item.name}`; |
| 4203 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_8__.SearchListItem, { |
| 4204 | ...args, |
| 4205 | name: `terms-${instanceId}`, |
| 4206 | className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(...classes, 'has-count'), |
| 4207 | countLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %d is the count of products. */ |
| 4208 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%d product', '%d products', count, 'woocommerce'), count), |
| 4209 | "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %1$s is the attribute name, %2$d is the count of products for that attribute. */ |
| 4210 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%1$s, has %2$d product', '%1$s, has %2$d products', count, 'woocommerce'), itemName, count) |
| 4211 | }); |
| 4212 | }; |
| 4213 | const list = productsAttributes.reduce((acc, curr) => { |
| 4214 | const { |
| 4215 | terms, |
| 4216 | ...props |
| 4217 | } = curr; |
| 4218 | return [...acc, (0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_9__.convertAttributeObjectToSearchItem)(props), ...terms.map(_woocommerce_utils__WEBPACK_IMPORTED_MODULE_9__.convertAttributeObjectToSearchItem)]; |
| 4219 | }, []); |
| 4220 | messages = { |
| 4221 | clear: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Clear all product attributes', 'woocommerce'), |
| 4222 | noItems: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Your store doesn't have any product attributes.", 'woocommerce'), |
| 4223 | search: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Search for product attributes', 'woocommerce'), |
| 4224 | selected: n => (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %d is the count of attributes selected. */ |
| 4225 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%d attribute selected', '%d attributes selected', n, 'woocommerce'), n), |
| 4226 | updated: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Product attribute search results updated.', 'woocommerce'), |
| 4227 | ...messages |
| 4228 | }; |
| 4229 | if (errorLoadingAttributes) { |
| 4230 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_error_placeholder_error_message__WEBPACK_IMPORTED_MODULE_10__["default"], { |
| 4231 | error: errorLoadingAttributes |
| 4232 | }); |
| 4233 | } |
| 4234 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_woocommerce_editor_components_search_list_control__WEBPACK_IMPORTED_MODULE_11__.SearchListControl, { |
| 4235 | className: "woocommerce-product-attributes", |
| 4236 | isCompact: isCompact, |
| 4237 | isHierarchical: true, |
| 4238 | isLoading: isLoadingAttributes, |
| 4239 | isSingle: false, |
| 4240 | list: list, |
| 4241 | messages: messages, |
| 4242 | onChange: onChange, |
| 4243 | renderItem: renderItem, |
| 4244 | selected: selected.map(({ |
| 4245 | id |
| 4246 | }) => list.find(term => term.id === id)).filter(Boolean), |
| 4247 | type: type |
| 4248 | }), !!onOperatorChange && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4249 | hidden: selected.length < 2 |
| 4250 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.SelectControl, { |
| 4251 | className: "woocommerce-product-attributes__operator", |
| 4252 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Display products matching', 'woocommerce'), |
| 4253 | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Pick at least two attributes to use this setting.', 'woocommerce'), |
| 4254 | value: operator, |
| 4255 | onChange: onOperatorChange, |
| 4256 | options: [{ |
| 4257 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Any selected attributes', 'woocommerce'), |
| 4258 | value: 'any' |
| 4259 | }, { |
| 4260 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('All selected attributes', 'woocommerce'), |
| 4261 | value: 'all' |
| 4262 | }] |
| 4263 | }))); |
| 4264 | }; |
| 4265 | ProductAttributeTermControl.__docgenInfo = { |
| 4266 | "description": "", |
| 4267 | "methods": [], |
| 4268 | "displayName": "ProductAttributeTermControl", |
| 4269 | "props": { |
| 4270 | "isCompact": { |
| 4271 | "defaultValue": { |
| 4272 | "value": "false", |
| 4273 | "computed": false |
| 4274 | }, |
| 4275 | "required": false |
| 4276 | }, |
| 4277 | "messages": { |
| 4278 | "defaultValue": { |
| 4279 | "value": "{}", |
| 4280 | "computed": false |
| 4281 | }, |
| 4282 | "required": false |
| 4283 | }, |
| 4284 | "operator": { |
| 4285 | "defaultValue": { |
| 4286 | "value": "'any'", |
| 4287 | "computed": false |
| 4288 | }, |
| 4289 | "required": false, |
| 4290 | "tsType": { |
| 4291 | "name": "union", |
| 4292 | "raw": "'all' | 'any'", |
| 4293 | "elements": [{ |
| 4294 | "name": "literal", |
| 4295 | "value": "'all'" |
| 4296 | }, { |
| 4297 | "name": "literal", |
| 4298 | "value": "'any'" |
| 4299 | }] |
| 4300 | }, |
| 4301 | "description": "Setting for whether products should match all or any selected categories." |
| 4302 | }, |
| 4303 | "type": { |
| 4304 | "defaultValue": { |
| 4305 | "value": "'text'", |
| 4306 | "computed": false |
| 4307 | }, |
| 4308 | "required": false |
| 4309 | }, |
| 4310 | "instanceId": { |
| 4311 | "required": false, |
| 4312 | "tsType": { |
| 4313 | "name": "string" |
| 4314 | }, |
| 4315 | "description": "" |
| 4316 | }, |
| 4317 | "onOperatorChange": { |
| 4318 | "required": false, |
| 4319 | "tsType": { |
| 4320 | "name": "signature", |
| 4321 | "type": "function", |
| 4322 | "raw": "() => void", |
| 4323 | "signature": { |
| 4324 | "arguments": [], |
| 4325 | "return": { |
| 4326 | "name": "void" |
| 4327 | } |
| 4328 | } |
| 4329 | }, |
| 4330 | "description": "Callback to update the category operator. If not passed in, setting is not used." |
| 4331 | }, |
| 4332 | "selected": { |
| 4333 | "required": true, |
| 4334 | "tsType": { |
| 4335 | "name": "Array", |
| 4336 | "elements": [{ |
| 4337 | "name": "signature", |
| 4338 | "type": "object", |
| 4339 | "raw": "{ id: number }", |
| 4340 | "signature": { |
| 4341 | "properties": [{ |
| 4342 | "key": "id", |
| 4343 | "value": { |
| 4344 | "name": "number", |
| 4345 | "required": true |
| 4346 | } |
| 4347 | }] |
| 4348 | } |
| 4349 | }], |
| 4350 | "raw": "{ id: number }[]" |
| 4351 | }, |
| 4352 | "description": "The list of currently selected attribute ids." |
| 4353 | } |
| 4354 | }, |
| 4355 | "composes": ["Omit"] |
| 4356 | }; |
| 4357 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_4__.withInstanceId)(ProductAttributeTermControl)); |
| 4358 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4359 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/product-attribute-term-control/index.tsx"] = { |
| 4360 | name: "ProductAttributeTermControl", |
| 4361 | docgenInfo: ProductAttributeTermControl.__docgenInfo, |
| 4362 | path: "assets/js/editor-components/product-attribute-term-control/index.tsx" |
| 4363 | }; |
| 4364 | } |
| 4365 | |
| 4366 | /***/ }), |
| 4367 | |
| 4368 | /***/ "./assets/js/editor-components/search-list-control/item.tsx": |
| 4369 | /*!******************************************************************!*\ |
| 4370 | !*** ./assets/js/editor-components/search-list-control/item.tsx ***! |
| 4371 | \******************************************************************/ |
| 4372 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4373 | |
| 4374 | "use strict"; |
| 4375 | __webpack_require__.r(__webpack_exports__); |
| 4376 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4377 | /* harmony export */ SearchListItem: () => (/* binding */ SearchListItem), |
| 4378 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 4379 | /* harmony export */ }); |
| 4380 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 4381 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 4382 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "../../node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.js"); |
| 4383 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); |
| 4384 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 4385 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 4386 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 4387 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 4388 | /* harmony import */ var _woocommerce_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @woocommerce/utils */ "./assets/js/utils/array-operations.ts"); |
| 4389 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); |
| 4390 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__); |
| 4391 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./assets/js/editor-components/search-list-control/utils.tsx"); |
| 4392 | |
| 4393 | /** |
| 4394 | * External dependencies |
| 4395 | */ |
| 4396 | |
| 4397 | |
| 4398 | |
| 4399 | |
| 4400 | |
| 4401 | |
| 4402 | /** |
| 4403 | * Internal dependencies |
| 4404 | */ |
| 4405 | |
| 4406 | |
| 4407 | const Count = ({ |
| 4408 | label |
| 4409 | }) => { |
| 4410 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4411 | className: "woocommerce-search-list__item-count" |
| 4412 | }, label); |
| 4413 | }; |
| 4414 | const ItemLabel = props => { |
| 4415 | const { |
| 4416 | item, |
| 4417 | search |
| 4418 | } = props; |
| 4419 | const hasBreadcrumbs = item.breadcrumbs && item.breadcrumbs.length; |
| 4420 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4421 | className: "woocommerce-search-list__item-label" |
| 4422 | }, hasBreadcrumbs ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4423 | className: "woocommerce-search-list__item-prefix" |
| 4424 | }, (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getBreadcrumbsForDisplay)(item.breadcrumbs)) : null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4425 | className: "woocommerce-search-list__item-name" |
| 4426 | }, (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getHighlightedName)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(item.name), search))); |
| 4427 | }; |
| 4428 | const SearchListItem = ({ |
| 4429 | countLabel, |
| 4430 | className, |
| 4431 | depth = 0, |
| 4432 | controlId = '', |
| 4433 | item, |
| 4434 | isSelected, |
| 4435 | isSingle, |
| 4436 | onSelect, |
| 4437 | search = '', |
| 4438 | selected, |
| 4439 | useExpandedPanelId, |
| 4440 | ...props |
| 4441 | }) => { |
| 4442 | var _item$breadcrumbs, _item$children; |
| 4443 | const [expandedPanelId, setExpandedPanelId] = useExpandedPanelId; |
| 4444 | const showCount = countLabel !== undefined && countLabel !== null && item.count !== undefined && item.count !== null; |
| 4445 | const hasBreadcrumbs = !!((_item$breadcrumbs = item.breadcrumbs) !== null && _item$breadcrumbs !== void 0 && _item$breadcrumbs.length); |
| 4446 | const hasChildren = !!((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length); |
| 4447 | const isExpanded = expandedPanelId === item.id; |
| 4448 | const classes = classnames__WEBPACK_IMPORTED_MODULE_1___default()(['woocommerce-search-list__item', `depth-${depth}`, className], { |
| 4449 | 'has-breadcrumbs': hasBreadcrumbs, |
| 4450 | 'has-children': hasChildren, |
| 4451 | 'has-count': showCount, |
| 4452 | 'is-expanded': isExpanded, |
| 4453 | 'is-radio-button': isSingle |
| 4454 | }); |
| 4455 | const name = props.name || `search-list-item-${controlId}`; |
| 4456 | const id = `${name}-${item.id}`; |
| 4457 | const togglePanel = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useCallback)(() => { |
| 4458 | setExpandedPanelId(isExpanded ? -1 : Number(item.id)); |
| 4459 | }, [isExpanded, item.id, setExpandedPanelId]); |
| 4460 | return hasChildren ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4461 | className: classes, |
| 4462 | onClick: togglePanel, |
| 4463 | onKeyDown: e => e.key === 'Enter' || e.key === ' ' ? togglePanel() : null, |
| 4464 | role: "treeitem", |
| 4465 | tabIndex: 0 |
| 4466 | }, isSingle ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { |
| 4467 | type: "radio", |
| 4468 | id: id, |
| 4469 | name: name, |
| 4470 | value: item.value, |
| 4471 | onChange: onSelect(item), |
| 4472 | onClick: e => e.stopPropagation(), |
| 4473 | checked: isSelected, |
| 4474 | className: "woocommerce-search-list__item-input", |
| 4475 | ...props |
| 4476 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ItemLabel, { |
| 4477 | item: item, |
| 4478 | search: search |
| 4479 | }), showCount ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Count, { |
| 4480 | label: countLabel || item.count |
| 4481 | }) : null) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CheckboxControl, { |
| 4482 | className: "woocommerce-search-list__item-input", |
| 4483 | checked: isSelected, |
| 4484 | ...(!isSelected && |
| 4485 | // We know that `item.children` is not `undefined` because |
| 4486 | // we are here only if `hasChildren` is `true`. |
| 4487 | item.children.some(child => selected.find(selectedItem => selectedItem.id === child.id)) ? { |
| 4488 | indeterminate: true |
| 4489 | } : {}), |
| 4490 | label: (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getHighlightedName)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(item.name), search), |
| 4491 | onChange: () => { |
| 4492 | if (isSelected) { |
| 4493 | onSelect((0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_6__.arrayDifferenceBy)(selected, item.children, 'id'))(); |
| 4494 | } else { |
| 4495 | onSelect((0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_6__.arrayUnionBy)(selected, item.children, 'id'))(); |
| 4496 | } |
| 4497 | }, |
| 4498 | onClick: e => e.stopPropagation() |
| 4499 | }), showCount ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Count, { |
| 4500 | label: countLabel || item.count |
| 4501 | }) : null)) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { |
| 4502 | htmlFor: id, |
| 4503 | className: classes |
| 4504 | }, isSingle ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { |
| 4505 | ...props, |
| 4506 | type: "radio", |
| 4507 | id: id, |
| 4508 | name: name, |
| 4509 | value: item.value, |
| 4510 | onChange: onSelect(item), |
| 4511 | checked: isSelected, |
| 4512 | className: "woocommerce-search-list__item-input" |
| 4513 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ItemLabel, { |
| 4514 | item: item, |
| 4515 | search: search |
| 4516 | })) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CheckboxControl, { |
| 4517 | ...props, |
| 4518 | id: id, |
| 4519 | name: name, |
| 4520 | className: "woocommerce-search-list__item-input", |
| 4521 | value: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(item.value), |
| 4522 | label: (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getHighlightedName)((0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(item.name), search), |
| 4523 | onChange: onSelect(item), |
| 4524 | checked: isSelected |
| 4525 | }), showCount ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Count, { |
| 4526 | label: countLabel || item.count |
| 4527 | }) : null); |
| 4528 | }; |
| 4529 | SearchListItem.__docgenInfo = { |
| 4530 | "description": "", |
| 4531 | "methods": [], |
| 4532 | "displayName": "SearchListItem", |
| 4533 | "props": { |
| 4534 | "depth": { |
| 4535 | "defaultValue": { |
| 4536 | "value": "0", |
| 4537 | "computed": false |
| 4538 | }, |
| 4539 | "required": false |
| 4540 | }, |
| 4541 | "controlId": { |
| 4542 | "defaultValue": { |
| 4543 | "value": "''", |
| 4544 | "computed": false |
| 4545 | }, |
| 4546 | "required": false |
| 4547 | }, |
| 4548 | "search": { |
| 4549 | "defaultValue": { |
| 4550 | "value": "''", |
| 4551 | "computed": false |
| 4552 | }, |
| 4553 | "required": false |
| 4554 | } |
| 4555 | } |
| 4556 | }; |
| 4557 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchListItem); |
| 4558 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4559 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/search-list-control/item.tsx"] = { |
| 4560 | name: "SearchListItem", |
| 4561 | docgenInfo: SearchListItem.__docgenInfo, |
| 4562 | path: "assets/js/editor-components/search-list-control/item.tsx" |
| 4563 | }; |
| 4564 | } |
| 4565 | |
| 4566 | /***/ }), |
| 4567 | |
| 4568 | /***/ "./assets/js/editor-components/search-list-control/search-list-control.tsx": |
| 4569 | /*!*********************************************************************************!*\ |
| 4570 | !*** ./assets/js/editor-components/search-list-control/search-list-control.tsx ***! |
| 4571 | \*********************************************************************************/ |
| 4572 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4573 | |
| 4574 | "use strict"; |
| 4575 | __webpack_require__.r(__webpack_exports__); |
| 4576 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4577 | /* harmony export */ SearchListControl: () => (/* binding */ SearchListControl), |
| 4578 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 4579 | /* harmony export */ }); |
| 4580 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 4581 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 4582 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 4583 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 4584 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 4585 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 4586 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 4587 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); |
| 4588 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/icon/index.js"); |
| 4589 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/info.js"); |
| 4590 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! classnames */ "../../node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.js"); |
| 4591 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__); |
| 4592 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 4593 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__); |
| 4594 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils */ "./assets/js/editor-components/search-list-control/utils.tsx"); |
| 4595 | /* harmony import */ var _item__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./item */ "./assets/js/editor-components/search-list-control/item.tsx"); |
| 4596 | /* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../tag */ "./assets/js/editor-components/tag/index.tsx"); |
| 4597 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style.scss */ "./assets/js/editor-components/search-list-control/style.scss"); |
| 4598 | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_style_scss__WEBPACK_IMPORTED_MODULE_6__); |
| 4599 | |
| 4600 | /** |
| 4601 | * External dependencies |
| 4602 | */ |
| 4603 | |
| 4604 | |
| 4605 | |
| 4606 | |
| 4607 | |
| 4608 | |
| 4609 | |
| 4610 | /** |
| 4611 | * Internal dependencies |
| 4612 | */ |
| 4613 | |
| 4614 | |
| 4615 | |
| 4616 | |
| 4617 | const defaultRenderListItem = args => { |
| 4618 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_item__WEBPACK_IMPORTED_MODULE_7__["default"], { |
| 4619 | ...args |
| 4620 | }); |
| 4621 | }; |
| 4622 | const ListItems = props => { |
| 4623 | const { |
| 4624 | list, |
| 4625 | selected, |
| 4626 | renderItem, |
| 4627 | depth = 0, |
| 4628 | onSelect, |
| 4629 | instanceId, |
| 4630 | isSingle, |
| 4631 | search, |
| 4632 | useExpandedPanelId |
| 4633 | } = props; |
| 4634 | const [expandedPanelId] = useExpandedPanelId; |
| 4635 | if (!list) { |
| 4636 | return null; |
| 4637 | } |
| 4638 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.Fragment, null, list.map(item => { |
| 4639 | var _item$children, _item$children2; |
| 4640 | const isSelected = (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length && !isSingle ? item.children.every(({ |
| 4641 | id |
| 4642 | }) => selected.find(selectedItem => selectedItem.id === id)) : !!selected.find(({ |
| 4643 | id |
| 4644 | }) => id === item.id); |
| 4645 | const isExpanded = ((_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) && expandedPanelId === item.id; |
| 4646 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.Fragment, { |
| 4647 | key: item.id |
| 4648 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", null, renderItem({ |
| 4649 | item, |
| 4650 | isSelected, |
| 4651 | onSelect, |
| 4652 | isSingle, |
| 4653 | selected, |
| 4654 | search, |
| 4655 | depth, |
| 4656 | useExpandedPanelId, |
| 4657 | controlId: instanceId |
| 4658 | })), isExpanded ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ListItems, { |
| 4659 | ...props, |
| 4660 | list: item.children, |
| 4661 | depth: depth + 1 |
| 4662 | }) : null); |
| 4663 | })); |
| 4664 | }; |
| 4665 | const SelectedListItems = ({ |
| 4666 | isLoading, |
| 4667 | isSingle, |
| 4668 | selected, |
| 4669 | messages, |
| 4670 | onChange, |
| 4671 | onRemove |
| 4672 | }) => { |
| 4673 | if (isLoading || isSingle || !selected) { |
| 4674 | return null; |
| 4675 | } |
| 4676 | const selectedCount = selected.length; |
| 4677 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4678 | className: "woocommerce-search-list__selected" |
| 4679 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4680 | className: "woocommerce-search-list__selected-header" |
| 4681 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, messages.selected(selectedCount)), selectedCount > 0 ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| 4682 | variant: "link", |
| 4683 | isDestructive: true, |
| 4684 | onClick: () => onChange([]), |
| 4685 | "aria-label": messages.clear |
| 4686 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Clear all', 'woocommerce')) : null), selectedCount > 0 ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("ul", null, selected.map((item, i) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", { |
| 4687 | key: i |
| 4688 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_tag__WEBPACK_IMPORTED_MODULE_8__["default"], { |
| 4689 | label: item.name, |
| 4690 | id: item.id, |
| 4691 | remove: onRemove |
| 4692 | })))) : null); |
| 4693 | }; |
| 4694 | const ListItemsContainer = ({ |
| 4695 | filteredList, |
| 4696 | search, |
| 4697 | onSelect, |
| 4698 | instanceId, |
| 4699 | useExpandedPanelId, |
| 4700 | ...props |
| 4701 | }) => { |
| 4702 | const { |
| 4703 | messages, |
| 4704 | renderItem, |
| 4705 | selected, |
| 4706 | isSingle |
| 4707 | } = props; |
| 4708 | const renderItemCallback = renderItem || defaultRenderListItem; |
| 4709 | if (filteredList.length === 0) { |
| 4710 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4711 | className: "woocommerce-search-list__list is-not-found" |
| 4712 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4713 | className: "woocommerce-search-list__not-found-icon" |
| 4714 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"], { |
| 4715 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_10__["default"], |
| 4716 | role: "img" |
| 4717 | })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 4718 | className: "woocommerce-search-list__not-found-text" |
| 4719 | }, search ? |
| 4720 | // eslint-disable-next-line @wordpress/valid-sprintf |
| 4721 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)(messages.noResults, search) : messages.noItems)); |
| 4722 | } |
| 4723 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("ul", { |
| 4724 | className: "woocommerce-search-list__list" |
| 4725 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ListItems, { |
| 4726 | useExpandedPanelId: useExpandedPanelId, |
| 4727 | list: filteredList, |
| 4728 | selected: selected, |
| 4729 | renderItem: renderItemCallback, |
| 4730 | onSelect: onSelect, |
| 4731 | instanceId: instanceId, |
| 4732 | isSingle: isSingle, |
| 4733 | search: search |
| 4734 | })); |
| 4735 | }; |
| 4736 | |
| 4737 | /** |
| 4738 | * Component to display a searchable, selectable list of items. |
| 4739 | */ |
| 4740 | const SearchListControl = props => { |
| 4741 | const { |
| 4742 | className = '', |
| 4743 | isCompact, |
| 4744 | isHierarchical, |
| 4745 | isLoading, |
| 4746 | isSingle, |
| 4747 | list, |
| 4748 | messages: customMessages = _utils__WEBPACK_IMPORTED_MODULE_11__.defaultMessages, |
| 4749 | onChange, |
| 4750 | onSearch, |
| 4751 | selected, |
| 4752 | type = 'text', |
| 4753 | debouncedSpeak |
| 4754 | } = props; |
| 4755 | const [search, setSearch] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useState)(''); |
| 4756 | const useExpandedPanelId = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useState)(-1); |
| 4757 | const instanceId = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__.useInstanceId)(SearchListControl); |
| 4758 | const messages = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)(() => ({ |
| 4759 | ..._utils__WEBPACK_IMPORTED_MODULE_11__.defaultMessages, |
| 4760 | ...customMessages |
| 4761 | }), [customMessages]); |
| 4762 | const filteredList = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useMemo)(() => { |
| 4763 | return (0,_utils__WEBPACK_IMPORTED_MODULE_11__.getFilteredList)(list, search, isHierarchical); |
| 4764 | }, [list, search, isHierarchical]); |
| 4765 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useEffect)(() => { |
| 4766 | if (debouncedSpeak) { |
| 4767 | debouncedSpeak(messages.updated); |
| 4768 | } |
| 4769 | }, [debouncedSpeak, messages]); |
| 4770 | (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useEffect)(() => { |
| 4771 | if (typeof onSearch === 'function') { |
| 4772 | onSearch(search); |
| 4773 | } |
| 4774 | }, [search, onSearch]); |
| 4775 | const onRemove = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useCallback)(itemId => () => { |
| 4776 | if (isSingle) { |
| 4777 | onChange([]); |
| 4778 | } |
| 4779 | const i = selected.findIndex(({ |
| 4780 | id: selectedId |
| 4781 | }) => selectedId === itemId); |
| 4782 | onChange([...selected.slice(0, i), ...selected.slice(i + 1)]); |
| 4783 | }, [isSingle, selected, onChange]); |
| 4784 | const onSelect = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useCallback)(item => () => { |
| 4785 | if (Array.isArray(item)) { |
| 4786 | onChange(item); |
| 4787 | return; |
| 4788 | } |
| 4789 | if (selected.findIndex(({ |
| 4790 | id |
| 4791 | }) => id === item.id) !== -1) { |
| 4792 | onRemove(item.id)(); |
| 4793 | return; |
| 4794 | } |
| 4795 | if (isSingle) { |
| 4796 | onChange([item]); |
| 4797 | } else { |
| 4798 | onChange([...selected, item]); |
| 4799 | } |
| 4800 | }, [isSingle, onRemove, onChange, selected]); |
| 4801 | const onRemoveToken = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useCallback)(tokens => { |
| 4802 | const [removedItem] = selected.filter(item => !tokens.find(token => item.id === token.id)); |
| 4803 | onRemove(removedItem.id)(); |
| 4804 | }, [onRemove, selected]); |
| 4805 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4806 | className: classnames__WEBPACK_IMPORTED_MODULE_4___default()('woocommerce-search-list', className, { |
| 4807 | 'is-compact': isCompact, |
| 4808 | 'is-loading': isLoading, |
| 4809 | 'is-token': type === 'token' |
| 4810 | }) |
| 4811 | }, type === 'text' && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(SelectedListItems, { |
| 4812 | ...props, |
| 4813 | onRemove: onRemove, |
| 4814 | messages: messages |
| 4815 | }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4816 | className: "woocommerce-search-list__search" |
| 4817 | }, type === 'text' ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, { |
| 4818 | label: messages.search, |
| 4819 | type: "search", |
| 4820 | value: search, |
| 4821 | onChange: value => setSearch(value) |
| 4822 | }) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FormTokenField, { |
| 4823 | disabled: isLoading, |
| 4824 | label: messages.search, |
| 4825 | onChange: onRemoveToken, |
| 4826 | onInputChange: value => setSearch(value), |
| 4827 | suggestions: [] |
| 4828 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
| 4829 | // @ts-ignore - Ignoring because `__experimentalValidateInput` is not yet in the type definitions. |
| 4830 | , |
| 4831 | __experimentalValidateInput: () => false, |
| 4832 | value: isLoading ? [(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Loading…', 'woocommerce')] : selected.map(token => ({ |
| 4833 | ...token, |
| 4834 | value: token.name |
| 4835 | })), |
| 4836 | __experimentalShowHowTo: false |
| 4837 | })), isLoading ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 4838 | className: "woocommerce-search-list__list" |
| 4839 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Spinner, null)) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ListItemsContainer, { |
| 4840 | ...props, |
| 4841 | search: search, |
| 4842 | filteredList: filteredList, |
| 4843 | messages: messages, |
| 4844 | onSelect: onSelect, |
| 4845 | instanceId: instanceId, |
| 4846 | useExpandedPanelId: useExpandedPanelId |
| 4847 | })); |
| 4848 | }; |
| 4849 | SearchListControl.__docgenInfo = { |
| 4850 | "description": "Component to display a searchable, selectable list of items.", |
| 4851 | "methods": [], |
| 4852 | "displayName": "SearchListControl" |
| 4853 | }; |
| 4854 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.withSpokenMessages)(SearchListControl)); |
| 4855 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 4856 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/search-list-control/search-list-control.tsx"] = { |
| 4857 | name: "SearchListControl", |
| 4858 | docgenInfo: SearchListControl.__docgenInfo, |
| 4859 | path: "assets/js/editor-components/search-list-control/search-list-control.tsx" |
| 4860 | }; |
| 4861 | } |
| 4862 | |
| 4863 | /***/ }), |
| 4864 | |
| 4865 | /***/ "./assets/js/editor-components/search-list-control/utils.tsx": |
| 4866 | /*!*******************************************************************!*\ |
| 4867 | !*** ./assets/js/editor-components/search-list-control/utils.tsx ***! |
| 4868 | \*******************************************************************/ |
| 4869 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4870 | |
| 4871 | "use strict"; |
| 4872 | __webpack_require__.r(__webpack_exports__); |
| 4873 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4874 | /* harmony export */ buildTermsTree: () => (/* binding */ buildTermsTree), |
| 4875 | /* harmony export */ defaultMessages: () => (/* binding */ defaultMessages), |
| 4876 | /* harmony export */ getBreadcrumbsForDisplay: () => (/* binding */ getBreadcrumbsForDisplay), |
| 4877 | /* harmony export */ getFilteredList: () => (/* binding */ getFilteredList), |
| 4878 | /* harmony export */ getHighlightedName: () => (/* binding */ getHighlightedName) |
| 4879 | /* harmony export */ }); |
| 4880 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 4881 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 4882 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 4883 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); |
| 4884 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 4885 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); |
| 4886 | /* harmony import */ var _woocommerce_base_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/base-utils */ "./assets/js/base/utils/keyby.ts"); |
| 4887 | |
| 4888 | /** |
| 4889 | * External dependencies |
| 4890 | */ |
| 4891 | |
| 4892 | |
| 4893 | |
| 4894 | |
| 4895 | /** |
| 4896 | * Internal dependencies |
| 4897 | */ |
| 4898 | |
| 4899 | const defaultMessages = { |
| 4900 | clear: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Clear all selected items', 'woocommerce'), |
| 4901 | noItems: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('No items found.', 'woocommerce'), |
| 4902 | /* Translators: %s search term */ |
| 4903 | noResults: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('No results for %s', 'woocommerce'), |
| 4904 | search: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Search for items', 'woocommerce'), |
| 4905 | selected: n => (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: Number of items selected from list. */ |
| 4906 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__._n)('%d item selected', '%d items selected', n, 'woocommerce'), n), |
| 4907 | updated: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Search results updated.', 'woocommerce') |
| 4908 | }; |
| 4909 | |
| 4910 | /** |
| 4911 | * Returns terms in a tree form. |
| 4912 | * |
| 4913 | * @param {Array} filteredList Array of terms, possibly a subset of all terms, in flat format. |
| 4914 | * @param {Array} list Array of the full list of terms, defaults to the filteredList. |
| 4915 | * |
| 4916 | * @return {Array} Array of terms in tree format. |
| 4917 | */ |
| 4918 | const buildTermsTree = (filteredList, list = filteredList) => { |
| 4919 | const termsByParent = filteredList.reduce((acc, currentValue) => { |
| 4920 | const key = currentValue.parent || 0; |
| 4921 | if (!acc[key]) { |
| 4922 | acc[key] = []; |
| 4923 | } |
| 4924 | acc[key].push(currentValue); |
| 4925 | return acc; |
| 4926 | }, {}); |
| 4927 | const listById = (0,_woocommerce_base_utils__WEBPACK_IMPORTED_MODULE_3__.keyBy)(list, 'id'); |
| 4928 | const builtParents = ['0']; |
| 4929 | const getParentsName = (term = {}) => { |
| 4930 | if (!term.parent) { |
| 4931 | return term.name ? [term.name] : []; |
| 4932 | } |
| 4933 | const parentName = getParentsName(listById[term.parent]); |
| 4934 | return [...parentName, term.name]; |
| 4935 | }; |
| 4936 | const fillWithChildren = terms => { |
| 4937 | return terms.map(term => { |
| 4938 | const children = termsByParent[term.id]; |
| 4939 | builtParents.push('' + term.id); |
| 4940 | return { |
| 4941 | ...term, |
| 4942 | breadcrumbs: getParentsName(listById[term.parent]), |
| 4943 | children: children && children.length ? fillWithChildren(children) : [] |
| 4944 | }; |
| 4945 | }); |
| 4946 | }; |
| 4947 | const tree = fillWithChildren(termsByParent['0'] || []); |
| 4948 | |
| 4949 | // Handle remaining items in termsByParent that have not been built (orphaned). |
| 4950 | Object.entries(termsByParent).forEach(([termId, terms]) => { |
| 4951 | if (!builtParents.includes(termId)) { |
| 4952 | tree.push(...fillWithChildren(terms || [])); |
| 4953 | } |
| 4954 | }); |
| 4955 | return tree; |
| 4956 | }; |
| 4957 | const getFilteredList = (list, search, isHierarchical) => { |
| 4958 | if (!search) { |
| 4959 | return isHierarchical ? buildTermsTree(list) : list; |
| 4960 | } |
| 4961 | const re = new RegExp(search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'i'); |
| 4962 | const filteredList = list.map(item => re.test(item.name) ? item : false).filter(Boolean); |
| 4963 | return isHierarchical ? buildTermsTree(filteredList, list) : filteredList; |
| 4964 | }; |
| 4965 | const getHighlightedName = (name, search) => { |
| 4966 | if (!search) { |
| 4967 | return name; |
| 4968 | } |
| 4969 | const re = new RegExp( |
| 4970 | // Escaping. |
| 4971 | `(${search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')})`, 'ig'); |
| 4972 | const nameParts = name.split(re); |
| 4973 | return nameParts.map((part, i) => { |
| 4974 | return re.test(part) ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", { |
| 4975 | key: i |
| 4976 | }, part) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.Fragment, { |
| 4977 | key: i |
| 4978 | }, part); |
| 4979 | }); |
| 4980 | }; |
| 4981 | const getBreadcrumbsForDisplay = breadcrumbs => { |
| 4982 | if (breadcrumbs.length === 1) { |
| 4983 | return breadcrumbs.slice(0, 1).toString(); |
| 4984 | } |
| 4985 | if (breadcrumbs.length === 2) { |
| 4986 | return breadcrumbs.slice(0, 1).toString() + ' › ' + breadcrumbs.slice(-1).toString(); |
| 4987 | } |
| 4988 | return breadcrumbs.slice(0, 1).toString() + ' … ' + breadcrumbs.slice(-1).toString(); |
| 4989 | }; |
| 4990 | |
| 4991 | /***/ }), |
| 4992 | |
| 4993 | /***/ "./assets/js/editor-components/tag/index.tsx": |
| 4994 | /*!***************************************************!*\ |
| 4995 | !*** ./assets/js/editor-components/tag/index.tsx ***! |
| 4996 | \***************************************************/ |
| 4997 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4998 | |
| 4999 | "use strict"; |
| 5000 | __webpack_require__.r(__webpack_exports__); |
| 5001 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5002 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 5003 | /* harmony export */ }); |
| 5004 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 5005 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 5006 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 5007 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 5008 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ "../../node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.js"); |
| 5009 | /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); |
| 5010 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 5011 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); |
| 5012 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/icon/index.js"); |
| 5013 | /* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/.pnpm/@wordpress+icons@9.36.0/node_modules/@wordpress/icons/build-module/library/cancel-circle-filled.js"); |
| 5014 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); |
| 5015 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__); |
| 5016 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); |
| 5017 | /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__); |
| 5018 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 5019 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__); |
| 5020 | /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./editor.scss */ "./assets/js/editor-components/tag/editor.scss"); |
| 5021 | /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_editor_scss__WEBPACK_IMPORTED_MODULE_7__); |
| 5022 | |
| 5023 | /** |
| 5024 | * External dependencies |
| 5025 | */ |
| 5026 | |
| 5027 | |
| 5028 | |
| 5029 | |
| 5030 | |
| 5031 | |
| 5032 | |
| 5033 | |
| 5034 | /** |
| 5035 | * Internal dependencies |
| 5036 | */ |
| 5037 | |
| 5038 | |
| 5039 | /** |
| 5040 | * This component can be used to show an item styled as a "tag", optionally with an `X` + "remove" |
| 5041 | * or with a popover that is shown on click. |
| 5042 | */ |
| 5043 | const Tag = ({ |
| 5044 | id, |
| 5045 | label, |
| 5046 | popoverContents, |
| 5047 | remove, |
| 5048 | screenReaderLabel, |
| 5049 | className = '' |
| 5050 | }) => { |
| 5051 | const [isVisible, setIsVisible] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.useState)(false); |
| 5052 | const instanceId = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__.useInstanceId)(Tag); |
| 5053 | screenReaderLabel = screenReaderLabel || label; |
| 5054 | if (!label) { |
| 5055 | // A null label probably means something went wrong |
| 5056 | return null; |
| 5057 | } |
| 5058 | label = (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(label); |
| 5059 | const classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()('woocommerce-tag', className, { |
| 5060 | 'has-remove': !!remove |
| 5061 | }); |
| 5062 | const labelId = `woocommerce-tag__label-${instanceId}`; |
| 5063 | const labelTextNode = (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 5064 | className: "screen-reader-text" |
| 5065 | }, screenReaderLabel), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 5066 | "aria-hidden": "true" |
| 5067 | }, label)); |
| 5068 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 5069 | className: classes |
| 5070 | }, popoverContents ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { |
| 5071 | className: "woocommerce-tag__text", |
| 5072 | id: labelId, |
| 5073 | onClick: () => setIsVisible(true) |
| 5074 | }, labelTextNode) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { |
| 5075 | className: "woocommerce-tag__text", |
| 5076 | id: labelId |
| 5077 | }, labelTextNode), popoverContents && isVisible && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Popover, { |
| 5078 | onClose: () => setIsVisible(false) |
| 5079 | }, popoverContents), remove && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { |
| 5080 | className: "woocommerce-tag__remove", |
| 5081 | onClick: remove(id), |
| 5082 | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)( |
| 5083 | // Translators: %s label. |
| 5084 | (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Remove %s', 'woocommerce'), label), |
| 5085 | "aria-describedby": labelId |
| 5086 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_icons__WEBPACK_IMPORTED_MODULE_8__["default"], { |
| 5087 | icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"], |
| 5088 | size: 20, |
| 5089 | className: "clear-icon", |
| 5090 | role: "img" |
| 5091 | }))); |
| 5092 | }; |
| 5093 | Tag.__docgenInfo = { |
| 5094 | "description": "This component can be used to show an item styled as a \"tag\", optionally with an `X` + \"remove\"\nor with a popover that is shown on click.", |
| 5095 | "methods": [], |
| 5096 | "displayName": "Tag", |
| 5097 | "props": { |
| 5098 | "className": { |
| 5099 | "defaultValue": { |
| 5100 | "value": "''", |
| 5101 | "computed": false |
| 5102 | }, |
| 5103 | "required": false, |
| 5104 | "tsType": { |
| 5105 | "name": "string" |
| 5106 | }, |
| 5107 | "description": "" |
| 5108 | }, |
| 5109 | "id": { |
| 5110 | "required": true, |
| 5111 | "tsType": { |
| 5112 | "name": "union", |
| 5113 | "raw": "string | number", |
| 5114 | "elements": [{ |
| 5115 | "name": "string" |
| 5116 | }, { |
| 5117 | "name": "number" |
| 5118 | }] |
| 5119 | }, |
| 5120 | "description": "" |
| 5121 | }, |
| 5122 | "label": { |
| 5123 | "required": true, |
| 5124 | "tsType": { |
| 5125 | "name": "string" |
| 5126 | }, |
| 5127 | "description": "" |
| 5128 | }, |
| 5129 | "popoverContents": { |
| 5130 | "required": false, |
| 5131 | "tsType": { |
| 5132 | "name": "JSX.Element" |
| 5133 | }, |
| 5134 | "description": "" |
| 5135 | }, |
| 5136 | "remove": { |
| 5137 | "required": false, |
| 5138 | "tsType": { |
| 5139 | "name": "signature", |
| 5140 | "type": "function", |
| 5141 | "raw": "( id: string | number ) => () => void", |
| 5142 | "signature": { |
| 5143 | "arguments": [{ |
| 5144 | "name": "id", |
| 5145 | "type": { |
| 5146 | "name": "union", |
| 5147 | "raw": "string | number", |
| 5148 | "elements": [{ |
| 5149 | "name": "string" |
| 5150 | }, { |
| 5151 | "name": "number" |
| 5152 | }] |
| 5153 | } |
| 5154 | }], |
| 5155 | "return": { |
| 5156 | "name": "signature", |
| 5157 | "type": "function", |
| 5158 | "raw": "() => void", |
| 5159 | "signature": { |
| 5160 | "arguments": [], |
| 5161 | "return": { |
| 5162 | "name": "void" |
| 5163 | } |
| 5164 | } |
| 5165 | } |
| 5166 | } |
| 5167 | }, |
| 5168 | "description": "" |
| 5169 | }, |
| 5170 | "screenReaderLabel": { |
| 5171 | "required": false, |
| 5172 | "tsType": { |
| 5173 | "name": "string" |
| 5174 | }, |
| 5175 | "description": "" |
| 5176 | } |
| 5177 | } |
| 5178 | }; |
| 5179 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Tag); |
| 5180 | if (typeof STORYBOOK_REACT_CLASSES !== "undefined") { |
| 5181 | STORYBOOK_REACT_CLASSES["assets/js/editor-components/tag/index.tsx"] = { |
| 5182 | name: "Tag", |
| 5183 | docgenInfo: Tag.__docgenInfo, |
| 5184 | path: "assets/js/editor-components/tag/index.tsx" |
| 5185 | }; |
| 5186 | } |
| 5187 | |
| 5188 | /***/ }), |
| 5189 | |
| 5190 | /***/ "./assets/js/editor-components/utils/index.js": |
| 5191 | /*!****************************************************!*\ |
| 5192 | !*** ./assets/js/editor-components/utils/index.js ***! |
| 5193 | \****************************************************/ |
| 5194 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5195 | |
| 5196 | "use strict"; |
| 5197 | __webpack_require__.r(__webpack_exports__); |
| 5198 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5199 | /* harmony export */ formatTitle: () => (/* binding */ formatTitle), |
| 5200 | /* harmony export */ getAttributes: () => (/* binding */ getAttributes), |
| 5201 | /* harmony export */ getCategories: () => (/* binding */ getCategories), |
| 5202 | /* harmony export */ getCategory: () => (/* binding */ getCategory), |
| 5203 | /* harmony export */ getProduct: () => (/* binding */ getProduct), |
| 5204 | /* harmony export */ getProductTags: () => (/* binding */ getProductTags), |
| 5205 | /* harmony export */ getProductVariations: () => (/* binding */ getProductVariations), |
| 5206 | /* harmony export */ getProducts: () => (/* binding */ getProducts), |
| 5207 | /* harmony export */ getTerms: () => (/* binding */ getTerms) |
| 5208 | /* harmony export */ }); |
| 5209 | /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); |
| 5210 | /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__); |
| 5211 | /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); |
| 5212 | /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__); |
| 5213 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 5214 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__); |
| 5215 | /* harmony import */ var _woocommerce_block_settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/block-settings */ "./assets/js/settings/blocks/index.ts"); |
| 5216 | /** |
| 5217 | * External dependencies |
| 5218 | */ |
| 5219 | |
| 5220 | |
| 5221 | |
| 5222 | |
| 5223 | |
| 5224 | /** |
| 5225 | * Get product query requests for the Store API. |
| 5226 | * |
| 5227 | * @param {Object} request A query object with the list of selected products and search term. |
| 5228 | * @param {number[]} request.selected Currently selected products. |
| 5229 | * @param {string=} request.search Search string. |
| 5230 | * @param {(Record<string, unknown>)=} request.queryArgs Query args to pass in. |
| 5231 | */ |
| 5232 | const getProductsRequests = ({ |
| 5233 | selected = [], |
| 5234 | search = '', |
| 5235 | queryArgs = {} |
| 5236 | }) => { |
| 5237 | const isLargeCatalog = _woocommerce_block_settings__WEBPACK_IMPORTED_MODULE_3__.blocksConfig.productCount > 100; |
| 5238 | const defaultArgs = { |
| 5239 | per_page: isLargeCatalog ? 100 : 0, |
| 5240 | catalog_visibility: 'any', |
| 5241 | search, |
| 5242 | orderby: 'title', |
| 5243 | order: 'asc' |
| 5244 | }; |
| 5245 | const requests = [(0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)('/wc/store/v1/products', { |
| 5246 | ...defaultArgs, |
| 5247 | ...queryArgs |
| 5248 | })]; |
| 5249 | |
| 5250 | // If we have a large catalog, we might not get all selected products in the first page. |
| 5251 | if (isLargeCatalog && selected.length) { |
| 5252 | requests.push((0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)('/wc/store/v1/products', { |
| 5253 | catalog_visibility: 'any', |
| 5254 | include: selected, |
| 5255 | per_page: 0 |
| 5256 | })); |
| 5257 | } |
| 5258 | return requests; |
| 5259 | }; |
| 5260 | const uniqBy = (array, iteratee) => { |
| 5261 | const seen = new Map(); |
| 5262 | return array.filter(item => { |
| 5263 | const key = iteratee(item); |
| 5264 | if (!seen.has(key)) { |
| 5265 | seen.set(key, item); |
| 5266 | return true; |
| 5267 | } |
| 5268 | return false; |
| 5269 | }); |
| 5270 | }; |
| 5271 | |
| 5272 | /** |
| 5273 | * Get a promise that resolves to a list of products from the Store API. |
| 5274 | * |
| 5275 | * @param {Object} request A query object with the list of selected products and search term. |
| 5276 | * @param {number[]} request.selected Currently selected products. |
| 5277 | * @param {string=} request.search Search string. |
| 5278 | * @param {(Record<string, unknown>)=} request.queryArgs Query args to pass in. |
| 5279 | * @return {Promise<unknown>} Promise resolving to a Product list. |
| 5280 | * @throws Exception if there is an error. |
| 5281 | */ |
| 5282 | const getProducts = ({ |
| 5283 | selected = [], |
| 5284 | search = '', |
| 5285 | queryArgs = {} |
| 5286 | }) => { |
| 5287 | const requests = getProductsRequests({ |
| 5288 | selected, |
| 5289 | search, |
| 5290 | queryArgs |
| 5291 | }); |
| 5292 | return Promise.all(requests.map(path => _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5293 | path |
| 5294 | }))).then(data => { |
| 5295 | const flatData = data.flat(); |
| 5296 | const products = uniqBy(flatData, item => item.id); |
| 5297 | const list = products.map(product => ({ |
| 5298 | ...product, |
| 5299 | parent: 0 |
| 5300 | })); |
| 5301 | return list; |
| 5302 | }).catch(e => { |
| 5303 | throw e; |
| 5304 | }); |
| 5305 | }; |
| 5306 | |
| 5307 | /** |
| 5308 | * Get a promise that resolves to a product object from the Store API. |
| 5309 | * |
| 5310 | * @param {number} productId Id of the product to retrieve. |
| 5311 | */ |
| 5312 | const getProduct = productId => { |
| 5313 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5314 | path: `/wc/store/v1/products/${productId}` |
| 5315 | }); |
| 5316 | }; |
| 5317 | |
| 5318 | /** |
| 5319 | * Get a promise that resolves to a list of attribute objects from the Store API. |
| 5320 | */ |
| 5321 | const getAttributes = () => { |
| 5322 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5323 | path: `wc/store/v1/products/attributes` |
| 5324 | }); |
| 5325 | }; |
| 5326 | |
| 5327 | /** |
| 5328 | * Get a promise that resolves to a list of attribute term objects from the Store API. |
| 5329 | * |
| 5330 | * @param {number} attribute Id of the attribute to retrieve terms for. |
| 5331 | */ |
| 5332 | const getTerms = attribute => { |
| 5333 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5334 | path: `wc/store/v1/products/attributes/${attribute}/terms` |
| 5335 | }); |
| 5336 | }; |
| 5337 | |
| 5338 | /** |
| 5339 | * Get product tag query requests for the Store API. |
| 5340 | * |
| 5341 | * @param {Object} request A query object with the list of selected products and search term. |
| 5342 | * @param {Array} request.selected Currently selected tags. |
| 5343 | * @param {string} request.search Search string. |
| 5344 | */ |
| 5345 | const getProductTagsRequests = ({ |
| 5346 | selected = [], |
| 5347 | search |
| 5348 | }) => { |
| 5349 | const limitTags = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_2__.getSetting)('limitTags', false); |
| 5350 | const requests = [(0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(`wc/store/v1/products/tags`, { |
| 5351 | per_page: limitTags ? 100 : 0, |
| 5352 | orderby: limitTags ? 'count' : 'name', |
| 5353 | order: limitTags ? 'desc' : 'asc', |
| 5354 | search |
| 5355 | })]; |
| 5356 | |
| 5357 | // If we have a large catalog, we might not get all selected products in the first page. |
| 5358 | if (limitTags && selected.length) { |
| 5359 | requests.push((0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(`wc/store/v1/products/tags`, { |
| 5360 | include: selected |
| 5361 | })); |
| 5362 | } |
| 5363 | return requests; |
| 5364 | }; |
| 5365 | |
| 5366 | /** |
| 5367 | * Get a promise that resolves to a list of tags from the Store API. |
| 5368 | * |
| 5369 | * @param {Object} props A query object with the list of selected products and search term. |
| 5370 | * @param {Array} props.selected |
| 5371 | * @param {string} props.search |
| 5372 | */ |
| 5373 | const getProductTags = ({ |
| 5374 | selected = [], |
| 5375 | search |
| 5376 | }) => { |
| 5377 | const requests = getProductTagsRequests({ |
| 5378 | selected, |
| 5379 | search |
| 5380 | }); |
| 5381 | return Promise.all(requests.map(path => _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5382 | path |
| 5383 | }))).then(data => { |
| 5384 | const flatData = data.flat(); |
| 5385 | return uniqBy(flatData, item => item.id); |
| 5386 | }); |
| 5387 | }; |
| 5388 | |
| 5389 | /** |
| 5390 | * Get a promise that resolves to a list of category objects from the Store API. |
| 5391 | * |
| 5392 | * @param {Object} queryArgs Query args to pass in. |
| 5393 | */ |
| 5394 | const getCategories = queryArgs => { |
| 5395 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5396 | path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(`wc/store/v1/products/categories`, { |
| 5397 | per_page: 0, |
| 5398 | ...queryArgs |
| 5399 | }) |
| 5400 | }); |
| 5401 | }; |
| 5402 | |
| 5403 | /** |
| 5404 | * Get a promise that resolves to a category object from the API. |
| 5405 | * |
| 5406 | * @param {number} categoryId Id of the product to retrieve. |
| 5407 | */ |
| 5408 | const getCategory = categoryId => { |
| 5409 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5410 | path: `wc/store/v1/products/categories/${categoryId}` |
| 5411 | }); |
| 5412 | }; |
| 5413 | |
| 5414 | /** |
| 5415 | * Get a promise that resolves to a list of variation objects from the Store API. |
| 5416 | * |
| 5417 | * @param {number} product Product ID. |
| 5418 | */ |
| 5419 | const getProductVariations = product => { |
| 5420 | return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ |
| 5421 | path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(`wc/store/v1/products`, { |
| 5422 | per_page: 0, |
| 5423 | type: 'variation', |
| 5424 | parent: product |
| 5425 | }) |
| 5426 | }); |
| 5427 | }; |
| 5428 | |
| 5429 | /** |
| 5430 | * Given a page object and an array of page, format the title. |
| 5431 | * |
| 5432 | * @param {Object} page Page object. |
| 5433 | * @param {Object} page.title Page title object. |
| 5434 | * @param {string} page.title.raw Page title. |
| 5435 | * @param {string} page.slug Page slug. |
| 5436 | * @param {Array} pages Array of all pages. |
| 5437 | * @return {string} Formatted page title to display. |
| 5438 | */ |
| 5439 | const formatTitle = (page, pages) => { |
| 5440 | if (!page.title.raw) { |
| 5441 | return page.slug; |
| 5442 | } |
| 5443 | const isUnique = pages.filter(p => p.title.raw === page.title.raw).length === 1; |
| 5444 | return page.title.raw + (!isUnique ? ` - ${page.slug}` : ''); |
| 5445 | }; |
| 5446 | |
| 5447 | /***/ }), |
| 5448 | |
| 5449 | /***/ "./assets/js/settings/blocks/constants.ts": |
| 5450 | /*!************************************************!*\ |
| 5451 | !*** ./assets/js/settings/blocks/constants.ts ***! |
| 5452 | \************************************************/ |
| 5453 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5454 | |
| 5455 | "use strict"; |
| 5456 | __webpack_require__.r(__webpack_exports__); |
| 5457 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5458 | /* harmony export */ ADDITIONAL_FIELDS_KEYS: () => (/* binding */ ADDITIONAL_FIELDS_KEYS), |
| 5459 | /* harmony export */ ADDRESS_FIELDS_KEYS: () => (/* binding */ ADDRESS_FIELDS_KEYS), |
| 5460 | /* harmony export */ ALLOWED_COUNTRIES: () => (/* binding */ ALLOWED_COUNTRIES), |
| 5461 | /* harmony export */ ALLOWED_STATES: () => (/* binding */ ALLOWED_STATES), |
| 5462 | /* harmony export */ CART_PAGE_ID: () => (/* binding */ CART_PAGE_ID), |
| 5463 | /* harmony export */ CART_URL: () => (/* binding */ CART_URL), |
| 5464 | /* harmony export */ CHECKOUT_PAGE_ID: () => (/* binding */ CHECKOUT_PAGE_ID), |
| 5465 | /* harmony export */ CHECKOUT_URL: () => (/* binding */ CHECKOUT_URL), |
| 5466 | /* harmony export */ CONTACT_FIELDS_KEYS: () => (/* binding */ CONTACT_FIELDS_KEYS), |
| 5467 | /* harmony export */ COUNTRY_LOCALE: () => (/* binding */ COUNTRY_LOCALE), |
| 5468 | /* harmony export */ LOCAL_PICKUP_ENABLED: () => (/* binding */ LOCAL_PICKUP_ENABLED), |
| 5469 | /* harmony export */ LOGIN_URL: () => (/* binding */ LOGIN_URL), |
| 5470 | /* harmony export */ PRIVACY_PAGE_NAME: () => (/* binding */ PRIVACY_PAGE_NAME), |
| 5471 | /* harmony export */ PRIVACY_URL: () => (/* binding */ PRIVACY_URL), |
| 5472 | /* harmony export */ SHIPPING_COUNTRIES: () => (/* binding */ SHIPPING_COUNTRIES), |
| 5473 | /* harmony export */ SHIPPING_STATES: () => (/* binding */ SHIPPING_STATES), |
| 5474 | /* harmony export */ SHOP_URL: () => (/* binding */ SHOP_URL), |
| 5475 | /* harmony export */ TERMS_PAGE_NAME: () => (/* binding */ TERMS_PAGE_NAME), |
| 5476 | /* harmony export */ TERMS_URL: () => (/* binding */ TERMS_URL), |
| 5477 | /* harmony export */ WC_BLOCKS_BUILD_URL: () => (/* binding */ WC_BLOCKS_BUILD_URL), |
| 5478 | /* harmony export */ WC_BLOCKS_IMAGE_URL: () => (/* binding */ WC_BLOCKS_IMAGE_URL), |
| 5479 | /* harmony export */ WC_BLOCKS_PHASE: () => (/* binding */ WC_BLOCKS_PHASE), |
| 5480 | /* harmony export */ blocksConfig: () => (/* binding */ blocksConfig) |
| 5481 | /* harmony export */ }); |
| 5482 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 5483 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__); |
| 5484 | var _STORE_PAGES$shop, _STORE_PAGES$checkout, _STORE_PAGES$checkout2, _STORE_PAGES$privacy, _STORE_PAGES$privacy2, _STORE_PAGES$terms, _STORE_PAGES$terms2, _STORE_PAGES$cart, _STORE_PAGES$cart2, _STORE_PAGES$myaccoun; |
| 5485 | /** |
| 5486 | * External dependencies |
| 5487 | */ |
| 5488 | |
| 5489 | const blocksConfig = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('wcBlocksConfig', { |
| 5490 | buildPhase: 1, |
| 5491 | pluginUrl: '', |
| 5492 | productCount: 0, |
| 5493 | defaultAvatar: '', |
| 5494 | restApiRoutes: {}, |
| 5495 | wordCountType: 'words' |
| 5496 | }); |
| 5497 | const WC_BLOCKS_IMAGE_URL = blocksConfig.pluginUrl + 'assets/images/'; |
| 5498 | const WC_BLOCKS_BUILD_URL = blocksConfig.pluginUrl + 'assets/client/blocks/'; |
| 5499 | const WC_BLOCKS_PHASE = blocksConfig.buildPhase; |
| 5500 | const SHOP_URL = (_STORE_PAGES$shop = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.shop) === null || _STORE_PAGES$shop === void 0 ? void 0 : _STORE_PAGES$shop.permalink; |
| 5501 | const CHECKOUT_PAGE_ID = (_STORE_PAGES$checkout = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.checkout) === null || _STORE_PAGES$checkout === void 0 ? void 0 : _STORE_PAGES$checkout.id; |
| 5502 | const CHECKOUT_URL = (_STORE_PAGES$checkout2 = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.checkout) === null || _STORE_PAGES$checkout2 === void 0 ? void 0 : _STORE_PAGES$checkout2.permalink; |
| 5503 | const PRIVACY_URL = (_STORE_PAGES$privacy = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.privacy) === null || _STORE_PAGES$privacy === void 0 ? void 0 : _STORE_PAGES$privacy.permalink; |
| 5504 | const PRIVACY_PAGE_NAME = (_STORE_PAGES$privacy2 = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.privacy) === null || _STORE_PAGES$privacy2 === void 0 ? void 0 : _STORE_PAGES$privacy2.title; |
| 5505 | const TERMS_URL = (_STORE_PAGES$terms = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.terms) === null || _STORE_PAGES$terms === void 0 ? void 0 : _STORE_PAGES$terms.permalink; |
| 5506 | const TERMS_PAGE_NAME = (_STORE_PAGES$terms2 = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.terms) === null || _STORE_PAGES$terms2 === void 0 ? void 0 : _STORE_PAGES$terms2.title; |
| 5507 | const CART_PAGE_ID = (_STORE_PAGES$cart = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.cart) === null || _STORE_PAGES$cart === void 0 ? void 0 : _STORE_PAGES$cart.id; |
| 5508 | const CART_URL = (_STORE_PAGES$cart2 = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.cart) === null || _STORE_PAGES$cart2 === void 0 ? void 0 : _STORE_PAGES$cart2.permalink; |
| 5509 | const LOGIN_URL = (_STORE_PAGES$myaccoun = _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.myaccount) !== null && _STORE_PAGES$myaccoun !== void 0 && _STORE_PAGES$myaccoun.permalink ? _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.STORE_PAGES.myaccount.permalink : (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('wpLoginUrl', '/wp-login.php'); |
| 5510 | const LOCAL_PICKUP_ENABLED = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('localPickupEnabled', false); |
| 5511 | // Contains country names. |
| 5512 | const countries = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('countries', {}); |
| 5513 | |
| 5514 | // Contains country settings. |
| 5515 | const countryData = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('countryData', {}); |
| 5516 | const ALLOWED_COUNTRIES = Object.fromEntries(Object.keys(countryData).filter(countryCode => { |
| 5517 | return countryData[countryCode].allowBilling === true; |
| 5518 | }).map(countryCode => { |
| 5519 | return [countryCode, countries[countryCode] || '']; |
| 5520 | })); |
| 5521 | const ALLOWED_STATES = Object.fromEntries(Object.keys(countryData).filter(countryCode => { |
| 5522 | return countryData[countryCode].allowBilling === true; |
| 5523 | }).map(countryCode => { |
| 5524 | return [countryCode, countryData[countryCode].states || []]; |
| 5525 | })); |
| 5526 | const SHIPPING_COUNTRIES = Object.fromEntries(Object.keys(countryData).filter(countryCode => { |
| 5527 | return countryData[countryCode].allowShipping === true; |
| 5528 | }).map(countryCode => { |
| 5529 | return [countryCode, countries[countryCode] || '']; |
| 5530 | })); |
| 5531 | const SHIPPING_STATES = Object.fromEntries(Object.keys(countryData).filter(countryCode => { |
| 5532 | return countryData[countryCode].allowShipping === true; |
| 5533 | }).map(countryCode => { |
| 5534 | return [countryCode, countryData[countryCode].states || []]; |
| 5535 | })); |
| 5536 | const COUNTRY_LOCALE = Object.fromEntries(Object.keys(countryData).map(countryCode => { |
| 5537 | return [countryCode, countryData[countryCode].locale || []]; |
| 5538 | })); |
| 5539 | const defaultFieldsLocations = { |
| 5540 | address: ['first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'postcode', 'country', 'state', 'phone'], |
| 5541 | contact: ['email'], |
| 5542 | additional: [] |
| 5543 | }; |
| 5544 | const ADDRESS_FIELDS_KEYS = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('addressFieldsLocations', defaultFieldsLocations).address; |
| 5545 | const CONTACT_FIELDS_KEYS = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('addressFieldsLocations', defaultFieldsLocations).contact; |
| 5546 | const ADDITIONAL_FIELDS_KEYS = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('addressFieldsLocations', defaultFieldsLocations).additional; |
| 5547 | |
| 5548 | /***/ }), |
| 5549 | |
| 5550 | /***/ "./assets/js/settings/blocks/feature-flags.ts": |
| 5551 | /*!****************************************************!*\ |
| 5552 | !*** ./assets/js/settings/blocks/feature-flags.ts ***! |
| 5553 | \****************************************************/ |
| 5554 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5555 | |
| 5556 | "use strict"; |
| 5557 | __webpack_require__.r(__webpack_exports__); |
| 5558 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5559 | /* harmony export */ isExperimentalBuild: () => (/* binding */ isExperimentalBuild), |
| 5560 | /* harmony export */ isFeaturePluginBuild: () => (/* binding */ isFeaturePluginBuild), |
| 5561 | /* harmony export */ registerExperimentalBlockType: () => (/* binding */ registerExperimentalBlockType), |
| 5562 | /* harmony export */ registerFeaturePluginBlockType: () => (/* binding */ registerFeaturePluginBlockType) |
| 5563 | /* harmony export */ }); |
| 5564 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 5565 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| 5566 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./assets/js/settings/blocks/constants.ts"); |
| 5567 | /** |
| 5568 | * External dependencies |
| 5569 | */ |
| 5570 | |
| 5571 | /** |
| 5572 | * Internal dependencies |
| 5573 | */ |
| 5574 | |
| 5575 | |
| 5576 | /** |
| 5577 | * Registers a new experimental block provided a unique name and an object defining its |
| 5578 | * behavior. Once registered, the block is made available as an option to any |
| 5579 | * editor interface where blocks are implemented. |
| 5580 | */ |
| 5581 | const registerExperimentalBlockType = (blockNameOrMetadata, settings) => { |
| 5582 | if (_constants__WEBPACK_IMPORTED_MODULE_1__.WC_BLOCKS_PHASE > 2) { |
| 5583 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(blockNameOrMetadata, settings); |
| 5584 | } |
| 5585 | }; |
| 5586 | |
| 5587 | /** |
| 5588 | * Registers a new feature plugin block provided a unique name and an object |
| 5589 | * defining its behavior. Once registered, the block is made available as an |
| 5590 | * option to any editor interface where blocks are implemented. |
| 5591 | */ |
| 5592 | const registerFeaturePluginBlockType = (blockNameOrMetadata, settings) => { |
| 5593 | if (_constants__WEBPACK_IMPORTED_MODULE_1__.WC_BLOCKS_PHASE > 1) { |
| 5594 | return (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(blockNameOrMetadata, settings); |
| 5595 | } |
| 5596 | }; |
| 5597 | |
| 5598 | /** |
| 5599 | * Checks if we're executing the code in an experimental build mode. |
| 5600 | * |
| 5601 | * @return {boolean} True if this is an experimental build, false otherwise. |
| 5602 | */ |
| 5603 | const isExperimentalBuild = () => _constants__WEBPACK_IMPORTED_MODULE_1__.WC_BLOCKS_PHASE > 2; |
| 5604 | |
| 5605 | /** |
| 5606 | * Checks if we're executing the code in an feature plugin or experimental build mode. |
| 5607 | * |
| 5608 | * @return {boolean} True if this is an experimental or feature plugin build, false otherwise. |
| 5609 | */ |
| 5610 | const isFeaturePluginBuild = () => _constants__WEBPACK_IMPORTED_MODULE_1__.WC_BLOCKS_PHASE > 1; |
| 5611 | |
| 5612 | /***/ }), |
| 5613 | |
| 5614 | /***/ "./assets/js/settings/blocks/index.ts": |
| 5615 | /*!********************************************!*\ |
| 5616 | !*** ./assets/js/settings/blocks/index.ts ***! |
| 5617 | \********************************************/ |
| 5618 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5619 | |
| 5620 | "use strict"; |
| 5621 | __webpack_require__.r(__webpack_exports__); |
| 5622 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5623 | /* harmony export */ ADDITIONAL_FIELDS_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.ADDITIONAL_FIELDS_KEYS), |
| 5624 | /* harmony export */ ADDRESS_FIELDS_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.ADDRESS_FIELDS_KEYS), |
| 5625 | /* harmony export */ ALLOWED_COUNTRIES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.ALLOWED_COUNTRIES), |
| 5626 | /* harmony export */ ALLOWED_STATES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.ALLOWED_STATES), |
| 5627 | /* harmony export */ CART_PAGE_ID: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.CART_PAGE_ID), |
| 5628 | /* harmony export */ CART_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.CART_URL), |
| 5629 | /* harmony export */ CHECKOUT_PAGE_ID: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.CHECKOUT_PAGE_ID), |
| 5630 | /* harmony export */ CHECKOUT_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.CHECKOUT_URL), |
| 5631 | /* harmony export */ CONTACT_FIELDS_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.CONTACT_FIELDS_KEYS), |
| 5632 | /* harmony export */ COUNTRY_LOCALE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.COUNTRY_LOCALE), |
| 5633 | /* harmony export */ LOCAL_PICKUP_ENABLED: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.LOCAL_PICKUP_ENABLED), |
| 5634 | /* harmony export */ LOGIN_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.LOGIN_URL), |
| 5635 | /* harmony export */ PRIVACY_PAGE_NAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.PRIVACY_PAGE_NAME), |
| 5636 | /* harmony export */ PRIVACY_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.PRIVACY_URL), |
| 5637 | /* harmony export */ SHIPPING_COUNTRIES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.SHIPPING_COUNTRIES), |
| 5638 | /* harmony export */ SHIPPING_STATES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.SHIPPING_STATES), |
| 5639 | /* harmony export */ SHOP_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.SHOP_URL), |
| 5640 | /* harmony export */ TERMS_PAGE_NAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.TERMS_PAGE_NAME), |
| 5641 | /* harmony export */ TERMS_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.TERMS_URL), |
| 5642 | /* harmony export */ WC_BLOCKS_BUILD_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.WC_BLOCKS_BUILD_URL), |
| 5643 | /* harmony export */ WC_BLOCKS_IMAGE_URL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.WC_BLOCKS_IMAGE_URL), |
| 5644 | /* harmony export */ WC_BLOCKS_PHASE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.WC_BLOCKS_PHASE), |
| 5645 | /* harmony export */ blocksConfig: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.blocksConfig), |
| 5646 | /* harmony export */ isExperimentalBuild: () => (/* reexport safe */ _feature_flags__WEBPACK_IMPORTED_MODULE_1__.isExperimentalBuild), |
| 5647 | /* harmony export */ isFeaturePluginBuild: () => (/* reexport safe */ _feature_flags__WEBPACK_IMPORTED_MODULE_1__.isFeaturePluginBuild), |
| 5648 | /* harmony export */ registerExperimentalBlockType: () => (/* reexport safe */ _feature_flags__WEBPACK_IMPORTED_MODULE_1__.registerExperimentalBlockType), |
| 5649 | /* harmony export */ registerFeaturePluginBlockType: () => (/* reexport safe */ _feature_flags__WEBPACK_IMPORTED_MODULE_1__.registerFeaturePluginBlockType) |
| 5650 | /* harmony export */ }); |
| 5651 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./assets/js/settings/blocks/constants.ts"); |
| 5652 | /* harmony import */ var _feature_flags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./feature-flags */ "./assets/js/settings/blocks/feature-flags.ts"); |
| 5653 | /** |
| 5654 | * Internal dependencies |
| 5655 | */ |
| 5656 | |
| 5657 | |
| 5658 | |
| 5659 | /***/ }), |
| 5660 | |
| 5661 | /***/ "./assets/js/types/type-guards/attributes.ts": |
| 5662 | /*!***************************************************!*\ |
| 5663 | !*** ./assets/js/types/type-guards/attributes.ts ***! |
| 5664 | \***************************************************/ |
| 5665 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5666 | |
| 5667 | "use strict"; |
| 5668 | __webpack_require__.r(__webpack_exports__); |
| 5669 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5670 | /* harmony export */ isAttributeQuery: () => (/* binding */ isAttributeQuery), |
| 5671 | /* harmony export */ isAttributeQueryCollection: () => (/* binding */ isAttributeQueryCollection), |
| 5672 | /* harmony export */ isAttributeTerm: () => (/* binding */ isAttributeTerm), |
| 5673 | /* harmony export */ isAttributeTermCollection: () => (/* binding */ isAttributeTermCollection) |
| 5674 | /* harmony export */ }); |
| 5675 | /* harmony import */ var _object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./object */ "./assets/js/types/type-guards/object.ts"); |
| 5676 | /** |
| 5677 | * Internal dependencies |
| 5678 | */ |
| 5679 | |
| 5680 | |
| 5681 | const isAttributeTerm = term => { |
| 5682 | return (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'count') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'description') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'id') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'name') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'parent') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(term, 'slug') && typeof term.count === 'number' && typeof term.description === 'string' && typeof term.id === 'number' && typeof term.name === 'string' && typeof term.parent === 'number' && typeof term.slug === 'string'; |
| 5683 | }; |
| 5684 | const isAttributeTermCollection = terms => { |
| 5685 | return Array.isArray(terms) && terms.every(isAttributeTerm); |
| 5686 | }; |
| 5687 | const isAttributeQuery = query => { |
| 5688 | return (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(query, 'attribute') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(query, 'operator') && (0,_object__WEBPACK_IMPORTED_MODULE_0__.objectHasProp)(query, 'slug') && typeof query.attribute === 'string' && typeof query.operator === 'string' && Array.isArray(query.slug) && query.slug.every(slug => typeof slug === 'string'); |
| 5689 | }; |
| 5690 | const isAttributeQueryCollection = queries => { |
| 5691 | return Array.isArray(queries) && queries.every(isAttributeQuery); |
| 5692 | }; |
| 5693 | |
| 5694 | /***/ }), |
| 5695 | |
| 5696 | /***/ "./assets/js/types/type-guards/boolean.ts": |
| 5697 | /*!************************************************!*\ |
| 5698 | !*** ./assets/js/types/type-guards/boolean.ts ***! |
| 5699 | \************************************************/ |
| 5700 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5701 | |
| 5702 | "use strict"; |
| 5703 | __webpack_require__.r(__webpack_exports__); |
| 5704 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5705 | /* harmony export */ isBoolean: () => (/* binding */ isBoolean) |
| 5706 | /* harmony export */ }); |
| 5707 | const isBoolean = term => { |
| 5708 | return typeof term === 'boolean'; |
| 5709 | }; |
| 5710 | |
| 5711 | /***/ }), |
| 5712 | |
| 5713 | /***/ "./assets/js/types/type-guards/null.ts": |
| 5714 | /*!*********************************************!*\ |
| 5715 | !*** ./assets/js/types/type-guards/null.ts ***! |
| 5716 | \*********************************************/ |
| 5717 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5718 | |
| 5719 | "use strict"; |
| 5720 | __webpack_require__.r(__webpack_exports__); |
| 5721 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5722 | /* harmony export */ isNull: () => (/* binding */ isNull) |
| 5723 | /* harmony export */ }); |
| 5724 | const isNull = term => { |
| 5725 | return term === null; |
| 5726 | }; |
| 5727 | |
| 5728 | /***/ }), |
| 5729 | |
| 5730 | /***/ "./assets/js/types/type-guards/number.ts": |
| 5731 | /*!***********************************************!*\ |
| 5732 | !*** ./assets/js/types/type-guards/number.ts ***! |
| 5733 | \***********************************************/ |
| 5734 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5735 | |
| 5736 | "use strict"; |
| 5737 | __webpack_require__.r(__webpack_exports__); |
| 5738 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5739 | /* harmony export */ isNumber: () => (/* binding */ isNumber) |
| 5740 | /* harmony export */ }); |
| 5741 | const isNumber = term => { |
| 5742 | return typeof term === 'number'; |
| 5743 | }; |
| 5744 | |
| 5745 | /***/ }), |
| 5746 | |
| 5747 | /***/ "./assets/js/types/type-guards/object.ts": |
| 5748 | /*!***********************************************!*\ |
| 5749 | !*** ./assets/js/types/type-guards/object.ts ***! |
| 5750 | \***********************************************/ |
| 5751 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5752 | |
| 5753 | "use strict"; |
| 5754 | __webpack_require__.r(__webpack_exports__); |
| 5755 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5756 | /* harmony export */ isEmptyObject: () => (/* binding */ isEmptyObject), |
| 5757 | /* harmony export */ isObject: () => (/* binding */ isObject), |
| 5758 | /* harmony export */ objectHasProp: () => (/* binding */ objectHasProp) |
| 5759 | /* harmony export */ }); |
| 5760 | /* harmony import */ var _null__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./null */ "./assets/js/types/type-guards/null.ts"); |
| 5761 | /** |
| 5762 | * Internal dependencies |
| 5763 | */ |
| 5764 | |
| 5765 | |
| 5766 | const isObject = term => { |
| 5767 | return !(0,_null__WEBPACK_IMPORTED_MODULE_0__.isNull)(term) && term instanceof Object && term.constructor === Object; |
| 5768 | }; |
| 5769 | function objectHasProp(target, property) { |
| 5770 | // The `in` operator throws a `TypeError` for non-object values. |
| 5771 | return isObject(target) && property in target; |
| 5772 | } |
| 5773 | const isEmptyObject = object => { |
| 5774 | return Object.keys(object).length === 0; |
| 5775 | }; |
| 5776 | |
| 5777 | /***/ }), |
| 5778 | |
| 5779 | /***/ "./assets/js/utils/array-operations.ts": |
| 5780 | /*!*********************************************!*\ |
| 5781 | !*** ./assets/js/utils/array-operations.ts ***! |
| 5782 | \*********************************************/ |
| 5783 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5784 | |
| 5785 | "use strict"; |
| 5786 | __webpack_require__.r(__webpack_exports__); |
| 5787 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5788 | /* harmony export */ arrayDifferenceBy: () => (/* binding */ arrayDifferenceBy), |
| 5789 | /* harmony export */ arrayUnionBy: () => (/* binding */ arrayUnionBy) |
| 5790 | /* harmony export */ }); |
| 5791 | /** |
| 5792 | * Returns the difference between two arrays (A - B) |
| 5793 | */ |
| 5794 | function arrayDifferenceBy(a, b, key) { |
| 5795 | const keys = new Set(b.map(item => item[key])); |
| 5796 | return a.filter(item => !keys.has(item[key])); |
| 5797 | } |
| 5798 | |
| 5799 | /** |
| 5800 | * Returns the union of two arrays (A ∪ B) |
| 5801 | */ |
| 5802 | function arrayUnionBy(a, b, key) { |
| 5803 | const difference = arrayDifferenceBy(b, a, key); |
| 5804 | return [...a, ...difference]; |
| 5805 | } |
| 5806 | |
| 5807 | /***/ }), |
| 5808 | |
| 5809 | /***/ "./assets/js/utils/attributes.ts": |
| 5810 | /*!***************************************!*\ |
| 5811 | !*** ./assets/js/utils/attributes.ts ***! |
| 5812 | \***************************************/ |
| 5813 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5814 | |
| 5815 | "use strict"; |
| 5816 | __webpack_require__.r(__webpack_exports__); |
| 5817 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5818 | /* harmony export */ convertAttributeObjectToSearchItem: () => (/* binding */ convertAttributeObjectToSearchItem), |
| 5819 | /* harmony export */ getAttributeFromID: () => (/* binding */ getAttributeFromID), |
| 5820 | /* harmony export */ getAttributeFromTaxonomy: () => (/* binding */ getAttributeFromTaxonomy), |
| 5821 | /* harmony export */ getTaxonomyFromAttributeId: () => (/* binding */ getTaxonomyFromAttributeId), |
| 5822 | /* harmony export */ updateAttributeInSiblingBlock: () => (/* binding */ updateAttributeInSiblingBlock) |
| 5823 | /* harmony export */ }); |
| 5824 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 5825 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__); |
| 5826 | /* harmony import */ var _woocommerce_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @woocommerce/types */ "./assets/js/types/type-guards/attributes.ts"); |
| 5827 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 5828 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 5829 | /** |
| 5830 | * External dependencies |
| 5831 | */ |
| 5832 | |
| 5833 | |
| 5834 | |
| 5835 | |
| 5836 | const ATTRIBUTES = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('attributes', []); |
| 5837 | |
| 5838 | /** |
| 5839 | * Format an attribute from the settings into an object with standardized keys. |
| 5840 | * |
| 5841 | * @param {Object} attribute The attribute object. |
| 5842 | */ |
| 5843 | const attributeSettingToObject = attribute => { |
| 5844 | if (!attribute || !attribute.attribute_name) { |
| 5845 | return null; |
| 5846 | } |
| 5847 | return { |
| 5848 | id: parseInt(attribute.attribute_id, 10), |
| 5849 | name: attribute.attribute_name, |
| 5850 | taxonomy: 'pa_' + attribute.attribute_name, |
| 5851 | label: attribute.attribute_label |
| 5852 | }; |
| 5853 | }; |
| 5854 | |
| 5855 | /** |
| 5856 | * Format all attribute settings into objects. |
| 5857 | */ |
| 5858 | const attributeObjects = ATTRIBUTES.reduce((acc, current) => { |
| 5859 | const attributeObject = attributeSettingToObject(current); |
| 5860 | if (attributeObject && attributeObject.id) { |
| 5861 | acc.push(attributeObject); |
| 5862 | } |
| 5863 | return acc; |
| 5864 | }, []); |
| 5865 | |
| 5866 | /** |
| 5867 | * Converts an Attribute object into a shape compatible with the `SearchListControl` |
| 5868 | */ |
| 5869 | const convertAttributeObjectToSearchItem = attribute => { |
| 5870 | const { |
| 5871 | count, |
| 5872 | id, |
| 5873 | name, |
| 5874 | parent |
| 5875 | } = attribute; |
| 5876 | return { |
| 5877 | count, |
| 5878 | id, |
| 5879 | name, |
| 5880 | parent, |
| 5881 | breadcrumbs: [], |
| 5882 | children: [], |
| 5883 | value: (0,_woocommerce_types__WEBPACK_IMPORTED_MODULE_2__.isAttributeTerm)(attribute) ? attribute.attr_slug : '' |
| 5884 | }; |
| 5885 | }; |
| 5886 | |
| 5887 | /** |
| 5888 | * Get attribute data by taxonomy. |
| 5889 | * |
| 5890 | * @param {number} attributeId The attribute ID. |
| 5891 | * @return {Object|undefined} The attribute object if it exists. |
| 5892 | */ |
| 5893 | const getAttributeFromID = attributeId => { |
| 5894 | if (!attributeId) { |
| 5895 | return; |
| 5896 | } |
| 5897 | return attributeObjects.find(attribute => { |
| 5898 | return attribute.id === attributeId; |
| 5899 | }); |
| 5900 | }; |
| 5901 | |
| 5902 | /** |
| 5903 | * Get attribute data by taxonomy. |
| 5904 | * |
| 5905 | * @param {string} taxonomy The attribute taxonomy name e.g. pa_color. |
| 5906 | * @return {Object|undefined} The attribute object if it exists. |
| 5907 | */ |
| 5908 | const getAttributeFromTaxonomy = taxonomy => { |
| 5909 | if (!taxonomy) { |
| 5910 | return; |
| 5911 | } |
| 5912 | return attributeObjects.find(attribute => { |
| 5913 | return attribute.taxonomy === taxonomy; |
| 5914 | }); |
| 5915 | }; |
| 5916 | |
| 5917 | /** |
| 5918 | * Get the taxonomy of an attribute by Attribute ID. |
| 5919 | * |
| 5920 | * @param {number} attributeId The attribute ID. |
| 5921 | * @return {string} The taxonomy name. |
| 5922 | */ |
| 5923 | const getTaxonomyFromAttributeId = attributeId => { |
| 5924 | if (!attributeId) { |
| 5925 | return null; |
| 5926 | } |
| 5927 | const attribute = getAttributeFromID(attributeId); |
| 5928 | return attribute ? attribute.taxonomy : null; |
| 5929 | }; |
| 5930 | |
| 5931 | /** |
| 5932 | * Updates an attribute in a sibling block. Useful if two settings control the same attribute, but you don't want to |
| 5933 | * have this attribute exist on a parent block. |
| 5934 | */ |
| 5935 | const updateAttributeInSiblingBlock = (clientId, attribute, newValue, siblingBlockName) => { |
| 5936 | const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/block-editor'); |
| 5937 | const actions = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('core/block-editor'); |
| 5938 | const parentBlocks = store.getBlockParents(clientId); |
| 5939 | let shippingMethodsBlockClientId = ''; |
| 5940 | |
| 5941 | // Loop through parent block's children until we find woocommerce/checkout-shipping-methods-block. |
| 5942 | // Also set this attribute in the woocommerce/checkout-shipping-methods-block. |
| 5943 | parentBlocks.forEach(parent => { |
| 5944 | const childBlock = store.getBlock(parent).innerBlocks.find(child => child.name === siblingBlockName); |
| 5945 | if (!childBlock) { |
| 5946 | return; |
| 5947 | } |
| 5948 | shippingMethodsBlockClientId = childBlock.clientId; |
| 5949 | }); |
| 5950 | actions.updateBlockAttributes(shippingMethodsBlockClientId, { |
| 5951 | [attribute]: newValue |
| 5952 | }); |
| 5953 | }; |
| 5954 | |
| 5955 | /***/ }), |
| 5956 | |
| 5957 | /***/ "./assets/js/utils/is-site-editor-page.ts": |
| 5958 | /*!************************************************!*\ |
| 5959 | !*** ./assets/js/utils/is-site-editor-page.ts ***! |
| 5960 | \************************************************/ |
| 5961 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5962 | |
| 5963 | "use strict"; |
| 5964 | __webpack_require__.r(__webpack_exports__); |
| 5965 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5966 | /* harmony export */ isSiteEditorPage: () => (/* binding */ isSiteEditorPage) |
| 5967 | /* harmony export */ }); |
| 5968 | /* harmony import */ var _types_type_guards__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types/type-guards */ "./assets/js/types/type-guards/object.ts"); |
| 5969 | /** |
| 5970 | * Internal dependencies |
| 5971 | */ |
| 5972 | |
| 5973 | const isSiteEditorPage = store => { |
| 5974 | if ((0,_types_type_guards__WEBPACK_IMPORTED_MODULE_0__.isObject)(store)) { |
| 5975 | const editedPostType = store.getEditedPostType(); |
| 5976 | return editedPostType === 'wp_template' || editedPostType === 'wp_template_part'; |
| 5977 | } |
| 5978 | return false; |
| 5979 | }; |
| 5980 | |
| 5981 | /***/ }), |
| 5982 | |
| 5983 | /***/ "./assets/js/utils/object-operations.ts": |
| 5984 | /*!**********************************************!*\ |
| 5985 | !*** ./assets/js/utils/object-operations.ts ***! |
| 5986 | \**********************************************/ |
| 5987 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 5988 | |
| 5989 | "use strict"; |
| 5990 | __webpack_require__.r(__webpack_exports__); |
| 5991 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5992 | /* harmony export */ objectOmit: () => (/* binding */ objectOmit) |
| 5993 | /* harmony export */ }); |
| 5994 | /** |
| 5995 | * Returns an object without a key. |
| 5996 | */ |
| 5997 | function objectOmit(obj, key) { |
| 5998 | const { |
| 5999 | [key]: omit, |
| 6000 | ...rest |
| 6001 | } = obj; |
| 6002 | return rest; |
| 6003 | } |
| 6004 | |
| 6005 | /***/ }), |
| 6006 | |
| 6007 | /***/ "./assets/js/blocks/product-collection/edit/editor.scss": |
| 6008 | /*!**************************************************************!*\ |
| 6009 | !*** ./assets/js/blocks/product-collection/edit/editor.scss ***! |
| 6010 | \**************************************************************/ |
| 6011 | /***/ (() => { |
| 6012 | |
| 6013 | |
| 6014 | |
| 6015 | /***/ }), |
| 6016 | |
| 6017 | /***/ "./assets/js/editor-components/feedback-prompt/style.scss": |
| 6018 | /*!****************************************************************!*\ |
| 6019 | !*** ./assets/js/editor-components/feedback-prompt/style.scss ***! |
| 6020 | \****************************************************************/ |
| 6021 | /***/ (() => { |
| 6022 | |
| 6023 | |
| 6024 | |
| 6025 | /***/ }), |
| 6026 | |
| 6027 | /***/ "./assets/js/editor-components/product-attribute-term-control/style.scss": |
| 6028 | /*!*******************************************************************************!*\ |
| 6029 | !*** ./assets/js/editor-components/product-attribute-term-control/style.scss ***! |
| 6030 | \*******************************************************************************/ |
| 6031 | /***/ (() => { |
| 6032 | |
| 6033 | |
| 6034 | |
| 6035 | /***/ }), |
| 6036 | |
| 6037 | /***/ "./assets/js/editor-components/search-list-control/style.scss": |
| 6038 | /*!********************************************************************!*\ |
| 6039 | !*** ./assets/js/editor-components/search-list-control/style.scss ***! |
| 6040 | \********************************************************************/ |
| 6041 | /***/ (() => { |
| 6042 | |
| 6043 | |
| 6044 | |
| 6045 | /***/ }), |
| 6046 | |
| 6047 | /***/ "./assets/js/editor-components/tag/editor.scss": |
| 6048 | /*!*****************************************************!*\ |
| 6049 | !*** ./assets/js/editor-components/tag/editor.scss ***! |
| 6050 | \*****************************************************/ |
| 6051 | /***/ (() => { |
| 6052 | |
| 6053 | |
| 6054 | |
| 6055 | /***/ }), |
| 6056 | |
| 6057 | /***/ "react": |
| 6058 | /*!************************!*\ |
| 6059 | !*** external "React" ***! |
| 6060 | \************************/ |
| 6061 | /***/ ((module) => { |
| 6062 | |
| 6063 | "use strict"; |
| 6064 | module.exports = window["React"]; |
| 6065 | |
| 6066 | /***/ }), |
| 6067 | |
| 6068 | /***/ "@woocommerce/settings": |
| 6069 | /*!************************************!*\ |
| 6070 | !*** external ["wc","wcSettings"] ***! |
| 6071 | \************************************/ |
| 6072 | /***/ ((module) => { |
| 6073 | |
| 6074 | "use strict"; |
| 6075 | module.exports = window["wc"]["wcSettings"]; |
| 6076 | |
| 6077 | /***/ }), |
| 6078 | |
| 6079 | /***/ "@wordpress/api-fetch": |
| 6080 | /*!**********************************!*\ |
| 6081 | !*** external ["wp","apiFetch"] ***! |
| 6082 | \**********************************/ |
| 6083 | /***/ ((module) => { |
| 6084 | |
| 6085 | "use strict"; |
| 6086 | module.exports = window["wp"]["apiFetch"]; |
| 6087 | |
| 6088 | /***/ }), |
| 6089 | |
| 6090 | /***/ "@wordpress/block-editor": |
| 6091 | /*!*************************************!*\ |
| 6092 | !*** external ["wp","blockEditor"] ***! |
| 6093 | \*************************************/ |
| 6094 | /***/ ((module) => { |
| 6095 | |
| 6096 | "use strict"; |
| 6097 | module.exports = window["wp"]["blockEditor"]; |
| 6098 | |
| 6099 | /***/ }), |
| 6100 | |
| 6101 | /***/ "@wordpress/blocks": |
| 6102 | /*!********************************!*\ |
| 6103 | !*** external ["wp","blocks"] ***! |
| 6104 | \********************************/ |
| 6105 | /***/ ((module) => { |
| 6106 | |
| 6107 | "use strict"; |
| 6108 | module.exports = window["wp"]["blocks"]; |
| 6109 | |
| 6110 | /***/ }), |
| 6111 | |
| 6112 | /***/ "@wordpress/components": |
| 6113 | /*!************************************!*\ |
| 6114 | !*** external ["wp","components"] ***! |
| 6115 | \************************************/ |
| 6116 | /***/ ((module) => { |
| 6117 | |
| 6118 | "use strict"; |
| 6119 | module.exports = window["wp"]["components"]; |
| 6120 | |
| 6121 | /***/ }), |
| 6122 | |
| 6123 | /***/ "@wordpress/compose": |
| 6124 | /*!*********************************!*\ |
| 6125 | !*** external ["wp","compose"] ***! |
| 6126 | \*********************************/ |
| 6127 | /***/ ((module) => { |
| 6128 | |
| 6129 | "use strict"; |
| 6130 | module.exports = window["wp"]["compose"]; |
| 6131 | |
| 6132 | /***/ }), |
| 6133 | |
| 6134 | /***/ "@wordpress/core-data": |
| 6135 | /*!**********************************!*\ |
| 6136 | !*** external ["wp","coreData"] ***! |
| 6137 | \**********************************/ |
| 6138 | /***/ ((module) => { |
| 6139 | |
| 6140 | "use strict"; |
| 6141 | module.exports = window["wp"]["coreData"]; |
| 6142 | |
| 6143 | /***/ }), |
| 6144 | |
| 6145 | /***/ "@wordpress/data": |
| 6146 | /*!******************************!*\ |
| 6147 | !*** external ["wp","data"] ***! |
| 6148 | \******************************/ |
| 6149 | /***/ ((module) => { |
| 6150 | |
| 6151 | "use strict"; |
| 6152 | module.exports = window["wp"]["data"]; |
| 6153 | |
| 6154 | /***/ }), |
| 6155 | |
| 6156 | /***/ "@wordpress/element": |
| 6157 | /*!*********************************!*\ |
| 6158 | !*** external ["wp","element"] ***! |
| 6159 | \*********************************/ |
| 6160 | /***/ ((module) => { |
| 6161 | |
| 6162 | "use strict"; |
| 6163 | module.exports = window["wp"]["element"]; |
| 6164 | |
| 6165 | /***/ }), |
| 6166 | |
| 6167 | /***/ "@wordpress/escape-html": |
| 6168 | /*!************************************!*\ |
| 6169 | !*** external ["wp","escapeHtml"] ***! |
| 6170 | \************************************/ |
| 6171 | /***/ ((module) => { |
| 6172 | |
| 6173 | "use strict"; |
| 6174 | module.exports = window["wp"]["escapeHtml"]; |
| 6175 | |
| 6176 | /***/ }), |
| 6177 | |
| 6178 | /***/ "@wordpress/hooks": |
| 6179 | /*!*******************************!*\ |
| 6180 | !*** external ["wp","hooks"] ***! |
| 6181 | \*******************************/ |
| 6182 | /***/ ((module) => { |
| 6183 | |
| 6184 | "use strict"; |
| 6185 | module.exports = window["wp"]["hooks"]; |
| 6186 | |
| 6187 | /***/ }), |
| 6188 | |
| 6189 | /***/ "@wordpress/html-entities": |
| 6190 | /*!**************************************!*\ |
| 6191 | !*** external ["wp","htmlEntities"] ***! |
| 6192 | \**************************************/ |
| 6193 | /***/ ((module) => { |
| 6194 | |
| 6195 | "use strict"; |
| 6196 | module.exports = window["wp"]["htmlEntities"]; |
| 6197 | |
| 6198 | /***/ }), |
| 6199 | |
| 6200 | /***/ "@wordpress/i18n": |
| 6201 | /*!******************************!*\ |
| 6202 | !*** external ["wp","i18n"] ***! |
| 6203 | \******************************/ |
| 6204 | /***/ ((module) => { |
| 6205 | |
| 6206 | "use strict"; |
| 6207 | module.exports = window["wp"]["i18n"]; |
| 6208 | |
| 6209 | /***/ }), |
| 6210 | |
| 6211 | /***/ "@wordpress/primitives": |
| 6212 | /*!************************************!*\ |
| 6213 | !*** external ["wp","primitives"] ***! |
| 6214 | \************************************/ |
| 6215 | /***/ ((module) => { |
| 6216 | |
| 6217 | "use strict"; |
| 6218 | module.exports = window["wp"]["primitives"]; |
| 6219 | |
| 6220 | /***/ }), |
| 6221 | |
| 6222 | /***/ "@wordpress/url": |
| 6223 | /*!*****************************!*\ |
| 6224 | !*** external ["wp","url"] ***! |
| 6225 | \*****************************/ |
| 6226 | /***/ ((module) => { |
| 6227 | |
| 6228 | "use strict"; |
| 6229 | module.exports = window["wp"]["url"]; |
| 6230 | |
| 6231 | /***/ }), |
| 6232 | |
| 6233 | /***/ "./assets/js/blocks/product-collection/block.json": |
| 6234 | /*!********************************************************!*\ |
| 6235 | !*** ./assets/js/blocks/product-collection/block.json ***! |
| 6236 | \********************************************************/ |
| 6237 | /***/ ((module) => { |
| 6238 | |
| 6239 | "use strict"; |
| 6240 | module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-collection","version":"1.0.0","title":"Product Collection (Beta)","description":"Display a collection of products from your store.","category":"woocommerce","keywords":["WooCommerce","Products (Beta)"],"textdomain":"woocommerce","attributes":{"queryId":{"type":"number"},"query":{"type":"object"},"tagName":{"type":"string"},"displayLayout":{"type":"object"},"convertedFromProducts":{"type":"boolean","default":false}},"providesContext":{"queryId":"queryId","query":"query","displayLayout":"displayLayout"},"supports":{"align":["wide","full"],"anchor":true,"html":false,"__experimentalLayout":true}}'); |
| 6241 | |
| 6242 | /***/ }) |
| 6243 | |
| 6244 | /******/ }); |
| 6245 | /************************************************************************/ |
| 6246 | /******/ // The module cache |
| 6247 | /******/ var __webpack_module_cache__ = {}; |
| 6248 | /******/ |
| 6249 | /******/ // The require function |
| 6250 | /******/ function __webpack_require__(moduleId) { |
| 6251 | /******/ // Check if module is in cache |
| 6252 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 6253 | /******/ if (cachedModule !== undefined) { |
| 6254 | /******/ return cachedModule.exports; |
| 6255 | /******/ } |
| 6256 | /******/ // Create a new module (and put it into the cache) |
| 6257 | /******/ var module = __webpack_module_cache__[moduleId] = { |
| 6258 | /******/ // no module.id needed |
| 6259 | /******/ // no module.loaded needed |
| 6260 | /******/ exports: {} |
| 6261 | /******/ }; |
| 6262 | /******/ |
| 6263 | /******/ // Execute the module function |
| 6264 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 6265 | /******/ |
| 6266 | /******/ // Return the exports of the module |
| 6267 | /******/ return module.exports; |
| 6268 | /******/ } |
| 6269 | /******/ |
| 6270 | /******/ // expose the modules object (__webpack_modules__) |
| 6271 | /******/ __webpack_require__.m = __webpack_modules__; |
| 6272 | /******/ |
| 6273 | /************************************************************************/ |
| 6274 | /******/ /* webpack/runtime/chunk loaded */ |
| 6275 | /******/ (() => { |
| 6276 | /******/ var deferred = []; |
| 6277 | /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { |
| 6278 | /******/ if(chunkIds) { |
| 6279 | /******/ priority = priority || 0; |
| 6280 | /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; |
| 6281 | /******/ deferred[i] = [chunkIds, fn, priority]; |
| 6282 | /******/ return; |
| 6283 | /******/ } |
| 6284 | /******/ var notFulfilled = Infinity; |
| 6285 | /******/ for (var i = 0; i < deferred.length; i++) { |
| 6286 | /******/ var [chunkIds, fn, priority] = deferred[i]; |
| 6287 | /******/ var fulfilled = true; |
| 6288 | /******/ for (var j = 0; j < chunkIds.length; j++) { |
| 6289 | /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { |
| 6290 | /******/ chunkIds.splice(j--, 1); |
| 6291 | /******/ } else { |
| 6292 | /******/ fulfilled = false; |
| 6293 | /******/ if(priority < notFulfilled) notFulfilled = priority; |
| 6294 | /******/ } |
| 6295 | /******/ } |
| 6296 | /******/ if(fulfilled) { |
| 6297 | /******/ deferred.splice(i--, 1) |
| 6298 | /******/ var r = fn(); |
| 6299 | /******/ if (r !== undefined) result = r; |
| 6300 | /******/ } |
| 6301 | /******/ } |
| 6302 | /******/ return result; |
| 6303 | /******/ }; |
| 6304 | /******/ })(); |
| 6305 | /******/ |
| 6306 | /******/ /* webpack/runtime/compat get default export */ |
| 6307 | /******/ (() => { |
| 6308 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 6309 | /******/ __webpack_require__.n = (module) => { |
| 6310 | /******/ var getter = module && module.__esModule ? |
| 6311 | /******/ () => (module['default']) : |
| 6312 | /******/ () => (module); |
| 6313 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 6314 | /******/ return getter; |
| 6315 | /******/ }; |
| 6316 | /******/ })(); |
| 6317 | /******/ |
| 6318 | /******/ /* webpack/runtime/define property getters */ |
| 6319 | /******/ (() => { |
| 6320 | /******/ // define getter functions for harmony exports |
| 6321 | /******/ __webpack_require__.d = (exports, definition) => { |
| 6322 | /******/ for(var key in definition) { |
| 6323 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 6324 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 6325 | /******/ } |
| 6326 | /******/ } |
| 6327 | /******/ }; |
| 6328 | /******/ })(); |
| 6329 | /******/ |
| 6330 | /******/ /* webpack/runtime/global */ |
| 6331 | /******/ (() => { |
| 6332 | /******/ __webpack_require__.g = (function() { |
| 6333 | /******/ if (typeof globalThis === 'object') return globalThis; |
| 6334 | /******/ try { |
| 6335 | /******/ return this || new Function('return this')(); |
| 6336 | /******/ } catch (e) { |
| 6337 | /******/ if (typeof window === 'object') return window; |
| 6338 | /******/ } |
| 6339 | /******/ })(); |
| 6340 | /******/ })(); |
| 6341 | /******/ |
| 6342 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 6343 | /******/ (() => { |
| 6344 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 6345 | /******/ })(); |
| 6346 | /******/ |
| 6347 | /******/ /* webpack/runtime/make namespace object */ |
| 6348 | /******/ (() => { |
| 6349 | /******/ // define __esModule on exports |
| 6350 | /******/ __webpack_require__.r = (exports) => { |
| 6351 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 6352 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 6353 | /******/ } |
| 6354 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 6355 | /******/ }; |
| 6356 | /******/ })(); |
| 6357 | /******/ |
| 6358 | /******/ /* webpack/runtime/jsonp chunk loading */ |
| 6359 | /******/ (() => { |
| 6360 | /******/ // no baseURI |
| 6361 | /******/ |
| 6362 | /******/ // object to store loaded and loading chunks |
| 6363 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched |
| 6364 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded |
| 6365 | /******/ var installedChunks = { |
| 6366 | /******/ "product-collection": 0 |
| 6367 | /******/ }; |
| 6368 | /******/ |
| 6369 | /******/ // no chunk on demand loading |
| 6370 | /******/ |
| 6371 | /******/ // no prefetching |
| 6372 | /******/ |
| 6373 | /******/ // no preloaded |
| 6374 | /******/ |
| 6375 | /******/ // no HMR |
| 6376 | /******/ |
| 6377 | /******/ // no HMR manifest |
| 6378 | /******/ |
| 6379 | /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); |
| 6380 | /******/ |
| 6381 | /******/ // install a JSONP callback for chunk loading |
| 6382 | /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { |
| 6383 | /******/ var [chunkIds, moreModules, runtime] = data; |
| 6384 | /******/ // add "moreModules" to the modules object, |
| 6385 | /******/ // then flag all "chunkIds" as loaded and fire callback |
| 6386 | /******/ var moduleId, chunkId, i = 0; |
| 6387 | /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { |
| 6388 | /******/ for(moduleId in moreModules) { |
| 6389 | /******/ if(__webpack_require__.o(moreModules, moduleId)) { |
| 6390 | /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; |
| 6391 | /******/ } |
| 6392 | /******/ } |
| 6393 | /******/ if(runtime) var result = runtime(__webpack_require__); |
| 6394 | /******/ } |
| 6395 | /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); |
| 6396 | /******/ for(;i < chunkIds.length; i++) { |
| 6397 | /******/ chunkId = chunkIds[i]; |
| 6398 | /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { |
| 6399 | /******/ installedChunks[chunkId][0](); |
| 6400 | /******/ } |
| 6401 | /******/ installedChunks[chunkId] = 0; |
| 6402 | /******/ } |
| 6403 | /******/ return __webpack_require__.O(result); |
| 6404 | /******/ } |
| 6405 | /******/ |
| 6406 | /******/ var chunkLoadingGlobal = self["webpackChunkwebpackWcBlocksJsonp"] = self["webpackChunkwebpackWcBlocksJsonp"] || []; |
| 6407 | /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); |
| 6408 | /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); |
| 6409 | /******/ })(); |
| 6410 | /******/ |
| 6411 | /************************************************************************/ |
| 6412 | /******/ |
| 6413 | /******/ // startup |
| 6414 | /******/ // Load entry module and return exports |
| 6415 | /******/ // This entry module depends on other loaded chunks and execution need to be delayed |
| 6416 | /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["wc-blocks-vendors"], () => (__webpack_require__("./assets/js/blocks/product-collection/index.tsx"))) |
| 6417 | /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); |
| 6418 | /******/ ((this.wc = this.wc || {}).blocks = this.wc.blocks || {})["product-collection"] = __webpack_exports__; |
| 6419 | /******/ |
| 6420 | /******/ })() |
| 6421 | ; |
| 6422 | //# sourceMappingURL=product-collection.js.map |