2024-04-08 08:29:49 +00:00
/ * *
* External dependencies
* /
import { OPTIONS_STORE_NAME } from '@woocommerce/data' ;
import { useSelect , dispatch } from '@wordpress/data' ;
import { useState } from 'react' ;
const LYS_TOUR_HIDDEN = 'woocommerce_launch_your_store_tour_hidden' ;
export const useSiteVisibilityTour = ( ) = > {
const [ showTour , setShowTour ] = useState ( true ) ;
const { shouldTourBeShown } = useSelect ( ( select ) = > {
// Tour should only be shown if the user has not seen it before and the `woocommerce_show_lys_tour` option is "yes" (for sites upgrading from a previous WooCommerce version)
const { getCurrentUser } = select ( 'core' ) ;
const wasTourShown =
Update to pnpm 9.1 (#47385)
* Update to pnpm 9.1 and fix a mini css bug
* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai
* temporarily disable swallowing build output to diagnose issue with perf workflow
* Ignore some type issues that commonly resurface when deps slightly change
* Fix persistent type issues that have recurred many times
* Add more ignores
* Fix lint issue
* Revert change to swallow build error
* Improve access of the config that needs updated build dir.
---------
Co-authored-by: github-actions <github-actions@github.com>
2024-05-13 13:57:39 +00:00
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
2024-04-08 08:29:49 +00:00
( getCurrentUser ( ) as { meta ? : { [ key : string ] : string } } )
? . meta ? . [ LYS_TOUR_HIDDEN ] === 'yes' ;
const { getOption } = select ( OPTIONS_STORE_NAME ) ;
const showLYSTourOption = getOption ( 'woocommerce_show_lys_tour' ) ;
const _shouldTourBeShown =
showLYSTourOption === 'yes' && ! wasTourShown ;
return {
shouldTourBeShown : _shouldTourBeShown ,
} ;
} ) ;
const onClose = ( ) = > {
Update to pnpm 9.1 (#47385)
* Update to pnpm 9.1 and fix a mini css bug
* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai
* temporarily disable swallowing build output to diagnose issue with perf workflow
* Ignore some type issues that commonly resurface when deps slightly change
* Fix persistent type issues that have recurred many times
* Add more ignores
* Fix lint issue
* Revert change to swallow build error
* Improve access of the config that needs updated build dir.
---------
Co-authored-by: github-actions <github-actions@github.com>
2024-05-13 13:57:39 +00:00
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
2024-04-08 08:29:49 +00:00
dispatch ( 'core' ) . saveUser ( {
id : window?.wcSettings?.currentUserId ,
meta : {
woocommerce_launch_your_store_tour_hidden : 'yes' ,
} ,
} ) ;
} ;
return {
onClose ,
shouldTourBeShown ,
showTour ,
setShowTour ,
} ;
} ;