File size: 1,696 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { registerStore } from '@wordpress/data';
import { controls } from '@wordpress/data-controls';
import { registerPlugins } from '../plugins';
import * as actions from './actions';
import { STORE_KEY } from './constants';
import reducer, { State } from './reducer';
import * as selectors from './selectors';
import type { SelectFromMap, DispatchFromMap } from '../mapped-types';

export type { State };
export type OnboardSelect = SelectFromMap< typeof selectors >;
export type OnboardActions = DispatchFromMap< typeof actions >;

export { SiteGoal, SiteIntent } from './constants';
export * as utils from './utils';
export * from './types';
let isRegistered = false;

/**
 * Onboard store depends on site-store. You should register the site before using this store.
 */
export function register(): typeof STORE_KEY {
	if ( isRegistered ) {
		return STORE_KEY;
	}

	registerPlugins();

	registerStore( STORE_KEY, {
		actions,
		controls,
		reducer,
		selectors,
		persist: [
			'domainTransferNames',
			'shouldImportDomainTransferDnsRecords',
			'domain',
			'domainSearch',
			'domainForm',
			'goals',
			'hasUsedDomainsStep',
			'hasUsedPlansStep',
			'intent',
			'paidSubscribers',
			'lastLocation',
			'planProductId',
			'randomizedDesigns',
			'selectedDesign',
			'selectedStyleVariation',
			'selectedGlobalStyles',
			'selectedFeatures',
			'selectedSite',
			'readymadeTemplate',
			'siteTitle',
			'siteDescription',
			'siteLogo',
			'siteAccentColor',
			'storeType',
			'ecommerceFlowRecurType',
			'couponCode',
			'storageAddonSlug',
			'domainCartItem',
			'planCartItem',
			'productCartItems',
			'partnerBundle',
		],
	} );
	isRegistered = true;
	return STORE_KEY;
}