Fix LYS private link query parameter when permalink is plain (#48425)

* Properly build URL query parameters

* Changelog
This commit is contained in:
Ilyas Foo 2024-06-14 09:23:32 +08:00 committed by GitHub
parent a7fc9afa8e
commit 641370aa4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 7 deletions

View File

@ -70,16 +70,23 @@ const SiteVisibility = () => {
const [ copyLinkText, setCopyLinkText ] = useState( copyLink );
const getPrivateLink = () => {
const settings = window?.wcSettings;
const homeUrl = settings?.homeUrl;
const urlObject = new URL( homeUrl );
if ( storePagesOnly === 'yes' ) {
return (
window?.wcSettings?.admin?.siteVisibilitySettings
?.shop_permalink +
'?woo-share=' +
shareKey
);
const shopPermalink =
settings?.admin?.siteVisibilitySettings?.shop_permalink;
if ( shopPermalink ) {
urlObject.href = shopPermalink;
}
}
return window?.wcSettings?.homeUrl + '?woo-share=' + shareKey;
const params = new URLSearchParams( urlObject.search );
params.set( 'woo-share', shareKey );
urlObject.search = params.toString();
return urlObject.toString();
};
const copyClipboardRef = useCopyToClipboard( getPrivateLink, () => {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix LYS private link URL parameter regardless of permalink settings