import { useLocation, useNavigate } from 'react-router-dom';
import ONBOARDING_ROUTES_CONFIG from './onboardingRoutesConfig';
/**
* This hook will return functions that will handle the navigation of the onboarding process.
* It will be used to handle the back and continue buttons.
*/
export const useOnboardingNavigation = () => {
const navigate = useNavigate();
const urlParams = new URLSearchParams( useLocation().search );
const currentRoute = urlParams.get( 'step' ) || 'welcome';
const BASE_PATH =
'?page=woo-cart-abandonment-recovery&path=onboarding&step=';
const getNextRoute = ( currentPath ) => {
const currentIndex = ONBOARDING_ROUTES_CONFIG.findIndex(
( route ) => route.url === currentPath
);
return ONBOARDING_ROUTES_CONFIG[ currentIndex + 1 ].url;
};
const getPreviousRoute = ( currentPath ) => {
const currentIndex = ONBOARDING_ROUTES_CONFIG.findIndex(
( route ) => route.url === currentPath
);
return ONBOARDING_ROUTES_CONFIG[ currentIndex - 1 ].url;
};
const navigateToNextRoute = () => {
const nextRoute = getNextRoute( currentRoute );
navigate( {
search: BASE_PATH + nextRoute,
} );
};
const navigateToPreviousRoute = () => {
const previousRoute = getPreviousRoute( currentRoute );
navigate( {
search: BASE_PATH + previousRoute,
} );
};
const getCurrentStepNumber = () => {
const currentIndex = ONBOARDING_ROUTES_CONFIG.findIndex(
( route ) => route.url === currentRoute
);
return currentIndex + 1;
};
const getCurrentStep = () => {
return ONBOARDING_ROUTES_CONFIG.find(
( route ) => route.url === currentRoute
);
};
const navigateToStep = ( stepNumber ) => {
// Convert step number to index (stepNumber is 1-based, array is 0-based)
const targetIndex = stepNumber - 1;
// Check if step number is valid
if (
targetIndex < 0 ||
targetIndex >= ONBOARDING_ROUTES_CONFIG.length
) {
return;
}
const targetRoute = ONBOARDING_ROUTES_CONFIG[ targetIndex ];
// Check if we can navigate to this step by checking requirements
for ( let i = 0; i <= targetIndex; i++ ) {
const route = ONBOARDING_ROUTES_CONFIG[ i ];
// Skip routes without requirements
if (
! route?.requires?.stateKeys ||
route?.requires?.stateKeys?.length === 0
) {
continue;
}
}
// If all requirements are met, navigate to the target step
navigate( {
search: BASE_PATH + targetRoute.url,
} );
};
return {
getNextRoute,
getPreviousRoute,
navigateToNextRoute,
navigateToPreviousRoute,
getCurrentStepNumber,
getCurrentStep,
navigateToStep,
};
};
[data-vc-shortcode="vc_line_chart"], [data-vc-shortcode="vc_round_chart"] {
// vc_line-chart custom dependency
.vc_chart-edit-form-custom-color {
.vc_shortcode-param[data-vc-shortcode-param-name="values_custom_color"] {
display: block;
}
.vc_shortcode-param[data-vc-shortcode-param-name="values_color"] {
display: none;
}
}
.vc_shortcode-param[data-vc-shortcode-param-name="values_custom_color"] {
display: none;
}
}!function(t){"use strict";var e={theme:"fip-grey",source:!1,emptyIcon:!0,emptyIconValue:"",iconsPerPage:20,hasSearch:!0,searchSource:!1,useAttribute:!1,attributeName:"data-icon",convertToHex:!0,allCategoryText:"From all categories",unCategorizedText:"Uncategorized"};function i(i,s){this.element=t(i),this.settings=t.extend({},e,s),this.settings.emptyIcon&&this.settings.iconsPerPage--,this.iconPicker=t("
",{"class":"icons-selector",style:"position: relative",html:'
'}),this.iconContainer=this.iconPicker.find(".fip-icons-container"),this.searchIcon=this.iconPicker.find(".selector-search i"),this.iconsSearched=[],this.isSearch=!1,this.totalPage=1,this.currentPage=1,this.currentIcon=!1,this.iconsCount=0,this.open=!1,this.searchValues=[],this.availableCategoriesSearch=[],this.triggerEvent=null,this.backupSource=[],this.backupSearch=[],this.isCategorized=!1,this.selectCategory=this.iconPicker.find(".icon-category-select"),this.selectedCategory=!1,this.availableCategories=[],this.unCategorizedKey=null,this.init()}i.prototype={init:function(){this.iconPicker.addClass(this.settings.theme),this.iconPicker.css({left:-9999}).appendTo("body");var e=this.iconPicker.outerHeight(),i=this.iconPicker.outerWidth();if(this.iconPicker.css({left:""}),this.element.before(this.iconPicker),this.element.css({visibility:"hidden",top:0,position:"relative",zIndex:"-1",left:"-"+i+"px",display:"inline-block",height:e+"px",width:i+"px",padding:"0",margin:"0 -"+i+"px 0 0",border:"0 none",verticalAlign:"top"}),!this.element.is("select")){var s=function(){for(var t=3,e=document.createElement("div"),i=e.all||[];e.innerHTML="\x3c!--[if gt IE "+ ++t+"]>
4?t:!t}(),n=document.createElement("div");this.triggerEvent=9!==s&&"oninput"in n?["input","keyup"]:["keyup"]}!this.settings.source&&this.element.is("select")?(this.settings.source=[],this.settings.searchSource=[],this.element.find("optgroup").length?(this.isCategorized=!0,this.element.find("optgroup").each(t.proxy((function(e,i){var s=this.availableCategories.length,n=t("");n.attr("value",s),n.html(t(i).attr("label")),this.selectCategory.append(n),this.availableCategories[s]=[],this.availableCategoriesSearch[s]=[],t(i).find("option").each(t.proxy((function(e,i){var n=t(i).val(),c=t(i).html();n&&n!==this.settings.emptyIconValue&&(this.settings.source.push(n),this.availableCategories[s].push(n),this.searchValues.push(c),this.availableCategoriesSearch[s].push(c))}),this))}),this)),this.element.find("> option").length&&this.element.find("> option").each(t.proxy((function(e,i){var s=t(i).val(),n=t(i).html();if(!s||""===s||s==this.settings.emptyIconValue)return!0;null===this.unCategorizedKey&&(this.unCategorizedKey=this.availableCategories.length,this.availableCategories[this.unCategorizedKey]=[],this.availableCategoriesSearch[this.unCategorizedKey]=[],t("").attr("value",this.unCategorizedKey).html(this.settings.unCategorizedText).appendTo(this.selectCategory)),this.settings.source.push(s),this.availableCategories[this.unCategorizedKey].push(s),this.searchValues.push(n),this.availableCategoriesSearch[this.unCategorizedKey].push(n)}),this))):this.element.find("option").each(t.proxy((function(e,i){var s=t(i).val(),n=t(i).html();s&&(this.settings.source.push(s),this.searchValues.push(n))}),this)),this.backupSource=this.settings.source.slice(0),this.backupSearch=this.searchValues.slice(0),this.loadCategories()):this.initSourceIndex(),this.loadIcons(),this.selectCategory.on("change keyup",t.proxy((function(e){if(!1===this.isCategorized)return!1;var i=t(e.currentTarget),s=i.val();if("all"===i.val())this.settings.source=this.backupSource,this.searchValues=this.backupSearch;else{var n=parseInt(s,10);this.availableCategories[n]&&(this.settings.source=this.availableCategories[n],this.searchValues=this.availableCategoriesSearch[n])}this.resetSearch(),this.loadIcons()}),this)),this.iconPicker.find(".selector-button").on("click",t.proxy((function(){this.toggleIconSelector()}),this)),this.iconPicker.find(".selector-arrow-right").on("click",t.proxy((function(e){this.currentPage1&&(this.iconPicker.find(".selector-arrow-right").show(),this.currentPage=this.currentPage-1,this.renderIconContainer()),1===this.currentPage&&t(e.currentTarget).hide()}),this)),this.iconPicker.find(".icons-search-input").keyup(t.proxy((function(e){var i=t(e.currentTarget).val();""!==i?(this.searchIcon.removeClass("fip-icon-search"),this.searchIcon.addClass("fip-icon-cancel"),this.isSearch=!0,this.currentPage=1,this.iconsSearched=[],t.grep(this.searchValues,t.proxy((function(t,e){if(t.toLowerCase().search(i.toLowerCase())>=0)return this.iconsSearched[this.iconsSearched.length]=this.settings.source[e],!0}),this)),this.renderIconContainer()):this.resetSearch()}),this)),this.iconPicker.find(".selector-search").on("click",".fip-icon-cancel",t.proxy((function(){this.iconPicker.find(".icons-search-input").trigger("focus"),this.resetSearch()}),this)),this.iconContainer.on("click",".fip-box",t.proxy((function(e){this.setSelectedIcon(t(e.currentTarget).find("i").attr("data-fip-value")),this.toggleIconSelector()}),this)),this.iconPicker.on("click",(function(t){return t.stopPropagation(),!1})),t("html").on("click",t.proxy((function(){this.open&&this.toggleIconSelector()}),this))},initSourceIndex:function(){if("object"==typeof this.settings.source){if(t.isArray(this.settings.source))this.isCategorized=!1,this.selectCategory.html("").hide(),this.settings.source=t.map(this.settings.source,(function(t,e){return"function"==typeof t.toString?t.toString():t})),t.isArray(this.settings.searchSource)?this.searchValues=t.map(this.settings.searchSource,(function(t,e){return"function"==typeof t.toString?t.toString():t})):this.searchValues=this.settings.source.slice(0);else{var e=t.extend(!0,{},this.settings.source);for(var i in this.settings.source=[],this.searchValues=[],this.availableCategoriesSearch=[],this.selectedCategory=!1,this.availableCategories=[],this.unCategorizedKey=null,this.isCategorized=!0,this.selectCategory.html(""),e){var s=this.availableCategories.length,n=t("");for(var c in n.attr("value",s),n.html(i),this.selectCategory.append(n),this.availableCategories[s]=[],this.availableCategoriesSearch[s]=[],e[i]){var o=e[i][c],r=this.settings.searchSource&&this.settings.searchSource[i]&&this.settings.searchSource[i][c]?this.settings.searchSource[i][c]:o;"function"==typeof o.toString&&(o=o.toString()),o&&o!==this.settings.emptyIconValue&&(this.settings.source.push(o),this.availableCategories[s].push(o),this.searchValues.push(r),this.availableCategoriesSearch[s].push(r))}}}this.backupSource=this.settings.source.slice(0),this.backupSearch=this.searchValues.slice(0),this.loadCategories()}},loadCategories:function(){!1!==this.isCategorized&&(t('").prependTo(this.selectCategory),this.selectCategory.show().val("all").trigger("change"))},loadIcons:function(){this.iconContainer.html(''),this.settings.source instanceof Array&&this.renderIconContainer()},renderIconContainer:function(){var e,i=[];if(i=this.isSearch?this.iconsSearched:this.settings.source,this.iconsCount=i.length,this.totalPage=Math.ceil(this.iconsCount/this.settings.iconsPerPage),this.totalPage>1?this.iconPicker.find(".selector-footer").show():this.iconPicker.find(".selector-footer").hide(),this.iconPicker.find(".selector-pages").html(this.currentPage+"/"+this.totalPage+" ("+this.iconsCount+")"),e=(this.currentPage-1)*this.settings.iconsPerPage,this.settings.emptyIcon)this.iconContainer.html('');else{if(i.length<1)return void this.iconContainer.html('');this.iconContainer.html("")}i=i.slice(e,e+this.settings.iconsPerPage);for(var s,n=0;s=i[n++];){var c=s;t.grep(this.settings.source,t.proxy((function(t,e){return t===s&&(c=this.searchValues[e],!0)}),this)),t("",{html:'","class":"fip-box",title:c}).appendTo(this.iconContainer)}this.settings.emptyIcon||this.element.val()&&-1!==t.inArray(this.element.val(),this.settings.source)?-1===t.inArray(this.element.val(),this.settings.source)?this.setSelectedIcon():this.setSelectedIcon(this.element.val()):this.setSelectedIcon(i[0])},setHighlightedIcon:function(){this.iconContainer.find(".current-icon").removeClass("current-icon"),this.currentIcon&&this.iconContainer.find('[data-fip-value="'+this.currentIcon+'"]').parent("span").addClass("current-icon")},setSelectedIcon:function(t){if("fip-icon-block"===t&&(t=""),this.settings.useAttribute?t?this.iconPicker.find(".selected-icon").html("'):this.iconPicker.find(".selected-icon").html(''):this.iconPicker.find(".selected-icon").html(''),this.element.val(""===t?this.settings.emptyIconValue:t).trigger("change"),null!==this.triggerEvent)for(var e in this.triggerEvent)this.element.trigger(this.triggerEvent[e]);this.currentIcon=t,this.setHighlightedIcon()},toggleIconSelector:function(){this.open=this.open?0:1,this.iconPicker.find(".selector-popup").slideToggle(300),this.iconPicker.find(".selector-button i").toggleClass("fip-icon-down-dir"),this.iconPicker.find(".selector-button i").toggleClass("fip-icon-up-dir"),this.open&&this.iconPicker.find(".icons-search-input").trigger("focus").select()},resetSearch:function(){this.iconPicker.find(".icons-search-input").val(""),this.searchIcon.removeClass("fip-icon-cancel"),this.searchIcon.addClass("fip-icon-search"),this.iconPicker.find(".selector-arrow-left").hide(),this.currentPage=1,this.isSearch=!1,this.renderIconContainer(),this.totalPage>1&&this.iconPicker.find(".selector-arrow-right").show()}},t.fn.fontIconPicker=function(e){return this.each((function(){t.data(this,"fontIconPicker")||t.data(this,"fontIconPicker",new i(this,e))})),this.setIcons=t.proxy((function(e,i){undefined===e&&(e=!1),undefined===i&&(i=!1),this.each((function(){t.data(this,"fontIconPicker").settings.source=e,t.data(this,"fontIconPicker").settings.searchSource=i,t.data(this,"fontIconPicker").initSourceIndex(),t.data(this,"fontIconPicker").resetSearch(),t.data(this,"fontIconPicker").loadIcons()}))}),this),this.destroyPicker=t.proxy((function(){this.each((function(){t.data(this,"fontIconPicker")&&(t.data(this,"fontIconPicker").iconPicker.remove(),t.data(this,"fontIconPicker").element.css({visibility:"",top:"",position:"",zIndex:"",left:"",display:"",height:"",width:"",padding:"",margin:"",border:"",verticalAlign:""}),t.removeData(this,"fontIconPicker"))}))}),this),this.refreshPicker=t.proxy((function(s){s||(s=e),this.destroyPicker(),this.each((function(){t.data(this,"fontIconPicker")||t.data(this,"fontIconPicker",new i(this,s))}))}),this),this}}(jQuery);{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "woocommerce/product-taxonomy-field",
"title": "Taxonomy",
"category": "widgets",
"description": "A block that displays a taxonomy field, allowing searching, selection, and creation of new items",
"keywords": ["taxonomy"],
"textdomain": "default",
"attributes": {
"slug": {
"type": "string",
"role": "content"
},
"property": {
"type": "string",
"role": "content"
},
"label": {
"type": "string",
"role": "content"
},
"createTitle": {
"type": "string",
"role": "content"
},
"dialogNameHelpText": {
"type": "string",
"role": "content"
},
"parentTaxonomyText": {
"type": "string",
"role": "content"
},
"help": {
"type": "string",
"role": "content"
}
},
"supports": {
"align": false,
"html": false,
"multiple": true,
"reusable": false,
"inserter": false,
"lock": false,
"__experimentalToolbar": false
},
"editorStyle": "file:./editor.css",
"usesContext": ["postType", "isInSelectedTab"]
}
/**
* Media editor - file upload, URL entry, media library browser, and save UI
*
* Reads (via globals):
* SFE.Context - .activeEditor (r/w), .activeMode (r/w),
* .draftEditState, .actionBar, .buttonManager
* SFE.PositionManager - .positionFloatingElements
* SFE.FocusManager - .createFocusManager
* SFE.Api - .apiCall
* SFE.MediaHelper - (MediaHelper global)
* SFE.MediaLibraryCache - (mediaLibraryCache global)
* SFE.OverlayManager
* SFE.LifecycleHelpers - .createFadeHandler, .setupDraftPreviewLifecycle
* SFE.handleInlineSave - set by SaveManager
* SFE.closeDraftPreview - set by DraftManager
* SFE.ManagerData - .iconLibraryUrl, .mediaLibraryUrl, .restBase,
* .restUrl, .nonce, .postId
*
* Exposes: SFE.MediaEditor { startMediaEditing, startSchemaComponentEditing }
*/
(function() {
'use strict';
window.MWP = window.MWP || {};
window.MWP.SFE = window.MWP.SFE || {};
const SFE = window.MWP.SFE;
SFE.ManagerData = SFE.ManagerData || {};
function showToolbar(toolbar) {
if (!toolbar) return;
if (toolbar._mwpSwitchHideTimeout) {
clearTimeout(toolbar._mwpSwitchHideTimeout);
delete toolbar._mwpSwitchHideTimeout;
}
toolbar.classList.remove('mwp-sfe-closing');
toolbar.style.display = '';
}
function ensureToolbarContainer(editorState) {
if (!editorState) return null;
let toolbarContainer = editorState.toolbarContainer || null;
if (!toolbarContainer) {
toolbarContainer = document.createElement('div');
toolbarContainer.className = 'mwp-sfe-inline-toolbar mwp-sfe-inline-editor';
toolbarContainer.setAttribute('data-mwp-sfe-control', 'true');
toolbarContainer.style.pointerEvents = 'auto';
toolbarContainer.style.display = 'none';
document.body.appendChild(toolbarContainer);
editorState.toolbarContainer = toolbarContainer;
}
return toolbarContainer;
}
function bindInlineEditButtons(editorState) {
const actionsContainer = editorState?.actionsContainer || null;
if (!actionsContainer) return;
if (actionsContainer._saveBtn) {
actionsContainer._saveBtn.addEventListener('click', (event) => {
event.preventDefault();
event.stopImmediatePropagation();
SFE.handleInlineSave(editorState);
});
}
if (actionsContainer._cancelBtn) {
actionsContainer._cancelBtn.addEventListener('click', (event) => {
event.preventDefault();
event.stopImmediatePropagation();
SFE.closeInPlaceEditor(editorState, true);
});
}
}
function restoreInlineEditButtons(editorState) {
const ctx = SFE.Context;
const actionBar = ctx?.actionBar;
const buttonManager = ctx?.buttonManager;
const actionsContainer = editorState?.actionsContainer || null;
if (!actionBar || !buttonManager || !actionsContainer) return;
actionBar.updateState({
bar: actionsContainer,
element: editorState.element,
state: 'edit',
content: buttonManager.getEditButtons(),
});
bindInlineEditButtons(editorState);
}
function cloneAttributeChanges(attributeChanges) {
return attributeChanges && typeof attributeChanges === 'object'
? { ...attributeChanges }
: {};
}
function createMediaToolbarHost(config) {
const {
editorState,
component,
toolbarContainer,
formats,
getMediaElement,
setMediaElement,
reposition,
serializeState,
applySerializedState,
showMediaReplaceUI,
} = config;
const historyApi = typeof editorState?.getSessionHistoryApi === 'function'
? editorState.getSessionHistoryApi('media')
: null;
const host = {
element: getMediaElement(),
formats: Array.isArray(formats) ? formats : [],
options: {
...(component?.editorOptions && typeof component.editorOptions === 'object' ? component.editorOptions : {}),
toolbarContainer,
blockRootElement: editorState?.element || null,
},
attributeChanges: editorState.attributeChanges && typeof editorState.attributeChanges === 'object'
? editorState.attributeChanges
: (editorState.attributeChanges = {}),
toolbarManager: null,
attachToolbarManager(manager) {
this.toolbarManager = manager;
},
detachToolbarManager(manager) {
if (this.toolbarManager === manager) {
this.toolbarManager = null;
}
},
isSelectionInEditor() {
return false;
},
getCurrentListItem() {
return null;
},
getParentList() {
return null;
},
canIndentListItem() {
return false;
},
canOutdentListItem() {
return false;
},
canUndo() {
return !!historyApi?.canUndo?.();
},
canRedo() {
return !!historyApi?.canRedo?.();
},
updateToolbarState() {
if (this.toolbarManager && typeof this.toolbarManager.updateToolbarState === 'function') {
this.toolbarManager.updateToolbarState();
}
},
updateUndoRedoButtons() {
if (this.toolbarManager && typeof this.toolbarManager.updateUndoRedoButtons === 'function') {
this.toolbarManager.updateUndoRedoButtons();
}
},
saveToHistory() {
historyApi?.saveToHistory?.();
},
undo() {
historyApi?.undo?.();
},
redo() {
historyApi?.redo?.();
},
setElement(element) {
this.element = element;
setMediaElement(element);
},
showMediaReplaceUI() {
if (typeof showMediaReplaceUI === 'function') {
showMediaReplaceUI();
}
},
getBlockRootElement() {
return editorState?.element || null;
},
scheduleFloatingElementsPositionAfterLayout() {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
reposition();
});
});
}
};
return SFE.SchemaEditorHost.attachHostContract(host);
}
// ─── Pure / stateless helpers ─────────────────────────────────────────────
/**
* Reposition the action bar once a media element has finished loading, or
* immediately when it is already in a ready state.
* Handles both
(.complete) and