/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Button } from '@wordpress/components'; import { useState } from '@wordpress/element'; import { SelectControl } from '@woocommerce/components'; import { Icon, chevronDown } from '@wordpress/icons'; import classnames from 'classnames'; /** * Internal dependencies */ import { UserProfileEvent, CoreProfilerStateMachineContext } from '../index'; import { Navigation } from '../components/navigation/navigation'; import { Heading } from '../components/heading/heading'; import { Choice } from '../components/choice/choice'; import { MultipleSelector } from '../components/multiple-selector/multiple-selector'; const businessOptions = [ { title: __( "I'm just starting my business", 'woocommerce' ), value: 'im_just_starting_my_business' as const, }, { title: __( "I'm already selling", 'woocommerce' ), value: 'im_already_selling' as const, }, { title: __( "I'm setting up a store for a client", 'woocommerce' ), value: 'im_setting_up_a_store_for_a_client' as const, }, ]; const sellingOnlineOptions = [ { label: __( "Yes, I'm selling online", 'woocommerce' ), value: 'yes_im_selling_online' as const, key: 'yes_im_selling_online' as const, }, { label: __( "No, I'm selling offline", 'woocommerce' ), value: 'no_im_selling_offline' as const, key: 'no_im_selling_offline' as const, }, { label: __( "I'm selling both online and offline", 'woocommerce' ), value: 'im_selling_both_online_and_offline' as const, key: 'im_selling_both_online_and_offline' as const, }, ]; const platformOptions = [ { label: __( 'Amazon', 'woocommerce' ), value: 'amazon' as const, }, { label: __( 'Adobe Commerce', 'woocommerce' ), value: 'adobe_commerce' as const, }, { label: __( 'Big Cartel', 'woocommerce' ), value: 'big_cartel' as const, }, { label: __( 'Big Commerce', 'woocommerce' ), value: 'big_commerce' as const, }, { label: __( 'Ebay', 'woocommerce' ), value: 'ebay' as const, }, { label: __( 'Ecwid', 'woocommerce' ), value: 'ecwid' as const, }, { label: __( 'Etsy', 'woocommerce' ), value: 'etsy' as const, }, { label: __( 'Facebook Marketplace', 'woocommerce' ), value: 'facebook_marketplace' as const, }, { label: __( 'Google Shopping', 'woocommerce' ), value: 'google_shopping' as const, }, { label: __( 'Pinterest', 'woocommerce' ), value: 'pinterest' as const, }, { label: __( 'Shopify', 'woocommerce' ), value: 'shopify' as const, }, { label: __( 'Square', 'woocommerce' ), value: 'square' as const, }, { label: __( 'Squarespace', 'woocommerce' ), value: 'squarespace' as const, }, { label: __( 'Wix', 'woocommerce' ), value: 'wix' as const, }, { label: __( 'WordPress', 'woocommerce' ), value: 'wordpress' as const, }, ]; export type BusinessChoice = ( typeof businessOptions )[ 0 ][ 'value' ]; export type SellingOnlineAnswer = ( typeof sellingOnlineOptions )[ 0 ][ 'value' ]; export type SellingPlatform = ( typeof platformOptions )[ 0 ][ 'value' ]; export const UserProfile = ( { sendEvent, navigationProgress, context, }: { sendEvent: ( event: UserProfileEvent ) => void; navigationProgress: number; context: Pick< CoreProfilerStateMachineContext, 'userProfile' >; } ) => { const [ businessChoice, setBusinessChoice ] = useState< BusinessChoice >( context.userProfile.businessChoice || 'im_just_starting_my_business' ); const [ sellingOnlineAnswer, setSellingOnlineAnswer ] = useState< SellingOnlineAnswer | null >( context.userProfile.sellingOnlineAnswer || null ); const [ sellingPlatforms, setSellingPlatforms ] = useState< Array< SellingPlatform > | null >( context.userProfile.sellingPlatforms || null ); const [ isPlatformDropdownOpen, setIsPlatformDropdownOpen ] = useState( false ); const renderAlreadySellingOptions = () => { return ( <>
{ __( 'Are you selling online?', 'woocommerce' ) }
{ __( 'Which platform(s) are you currently using?', 'woocommerce' ) }