@automattic/data-stores 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/README.md +10 -9
- package/dist/cjs/add-ons/hooks/use-add-on-prices.js +3 -3
- package/dist/cjs/add-ons/hooks/use-add-on-prices.js.map +1 -1
- package/dist/cjs/add-ons/icons/custom-design.js +1 -1
- package/dist/cjs/add-ons/icons/custom-design.js.map +1 -1
- package/dist/cjs/add-ons/icons/unlimited-themes.js +1 -1
- package/dist/cjs/add-ons/icons/unlimited-themes.js.map +1 -1
- package/dist/cjs/contextual-help/admin-sections.js +2 -2
- package/dist/cjs/contextual-help/admin-sections.js.map +1 -1
- package/dist/cjs/help-center/actions.js +89 -62
- package/dist/cjs/help-center/actions.js.map +1 -1
- package/dist/cjs/help-center/index.js +13 -12
- package/dist/cjs/help-center/index.js.map +1 -1
- package/dist/cjs/help-center/reducer.js +32 -16
- package/dist/cjs/help-center/reducer.js.map +1 -1
- package/dist/cjs/help-center/resolvers.js +6 -1
- package/dist/cjs/help-center/resolvers.js.map +1 -1
- package/dist/cjs/help-center/selectors.js +11 -7
- package/dist/cjs/help-center/selectors.js.map +1 -1
- package/dist/cjs/index.js +3 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/onboard/actions.js +10 -10
- package/dist/cjs/onboard/actions.js.map +1 -1
- package/dist/cjs/onboard/index.js +0 -1
- package/dist/cjs/onboard/index.js.map +1 -1
- package/dist/cjs/onboard/reducer.js +18 -16
- package/dist/cjs/onboard/reducer.js.map +1 -1
- package/dist/cjs/onboard/selectors.js +5 -5
- package/dist/cjs/onboard/selectors.js.map +1 -1
- package/dist/cjs/plans/queries/use-plans.js +20 -1
- package/dist/cjs/plans/queries/use-plans.js.map +1 -1
- package/dist/cjs/plans/resolvers.js +4 -4
- package/dist/cjs/plans/resolvers.js.map +1 -1
- package/dist/cjs/purchases/lib/assembler.js +7 -13
- package/dist/cjs/purchases/lib/assembler.js.map +1 -1
- package/dist/cjs/purchases/queries/lib/use-query-keys-factory.js +1 -0
- package/dist/cjs/purchases/queries/lib/use-query-keys-factory.js.map +1 -1
- package/dist/cjs/purchases/queries/use-get-jetpack-transferred-license-purchases.js +33 -0
- package/dist/cjs/purchases/queries/use-get-jetpack-transferred-license-purchases.js.map +1 -0
- package/dist/cjs/queries/use-launchpad.js +3 -2
- package/dist/cjs/queries/use-launchpad.js.map +1 -1
- package/dist/cjs/queries/use-site-domains-query.js.map +1 -1
- package/dist/cjs/queries/use-site-intent.js.map +1 -1
- package/dist/cjs/reader/mutations/use-site-subscribe-mutation.js +1 -1
- package/dist/cjs/reader/mutations/use-site-subscribe-mutation.js.map +1 -1
- package/dist/cjs/reader/mutations/use-site-unsubscribe-mutation.js +4 -0
- package/dist/cjs/reader/mutations/use-site-unsubscribe-mutation.js.map +1 -1
- package/dist/cjs/site/actions.js +1 -1
- package/dist/cjs/site/actions.js.map +1 -1
- package/dist/cjs/site/constants.js +2 -1
- package/dist/cjs/site/constants.js.map +1 -1
- package/dist/cjs/site/types.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-add-on-prices.js +1 -1
- package/dist/esm/add-ons/hooks/use-add-on-prices.js.map +1 -1
- package/dist/esm/add-ons/icons/custom-design.js +2 -2
- package/dist/esm/add-ons/icons/custom-design.js.map +1 -1
- package/dist/esm/add-ons/icons/unlimited-themes.js +2 -2
- package/dist/esm/add-ons/icons/unlimited-themes.js.map +1 -1
- package/dist/esm/contextual-help/admin-sections.js +2 -2
- package/dist/esm/contextual-help/admin-sections.js.map +1 -1
- package/dist/esm/help-center/actions.js +81 -57
- package/dist/esm/help-center/actions.js.map +1 -1
- package/dist/esm/help-center/index.js +11 -10
- package/dist/esm/help-center/index.js.map +1 -1
- package/dist/esm/help-center/reducer.js +32 -16
- package/dist/esm/help-center/reducer.js.map +1 -1
- package/dist/esm/help-center/resolvers.js +6 -1
- package/dist/esm/help-center/resolvers.js.map +1 -1
- package/dist/esm/help-center/selectors.js +5 -3
- package/dist/esm/help-center/selectors.js.map +1 -1
- package/dist/esm/index.js +2 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/onboard/actions.js +7 -7
- package/dist/esm/onboard/actions.js.map +1 -1
- package/dist/esm/onboard/index.js +0 -1
- package/dist/esm/onboard/index.js.map +1 -1
- package/dist/esm/onboard/reducer.js +15 -15
- package/dist/esm/onboard/reducer.js.map +1 -1
- package/dist/esm/onboard/selectors.js +2 -2
- package/dist/esm/onboard/selectors.js.map +1 -1
- package/dist/esm/plans/queries/use-plans.js +20 -1
- package/dist/esm/plans/queries/use-plans.js.map +1 -1
- package/dist/esm/plans/resolvers.js +1 -1
- package/dist/esm/plans/resolvers.js.map +1 -1
- package/dist/esm/purchases/lib/assembler.js +7 -13
- package/dist/esm/purchases/lib/assembler.js.map +1 -1
- package/dist/esm/purchases/queries/lib/use-query-keys-factory.js +1 -0
- package/dist/esm/purchases/queries/lib/use-query-keys-factory.js.map +1 -1
- package/dist/esm/purchases/queries/use-get-jetpack-transferred-license-purchases.js +29 -0
- package/dist/esm/purchases/queries/use-get-jetpack-transferred-license-purchases.js.map +1 -0
- package/dist/esm/queries/use-launchpad.js +2 -2
- package/dist/esm/queries/use-launchpad.js.map +1 -1
- package/dist/esm/queries/use-site-domains-query.js.map +1 -1
- package/dist/esm/queries/use-site-intent.js.map +1 -1
- package/dist/esm/reader/mutations/use-site-subscribe-mutation.js +1 -1
- package/dist/esm/reader/mutations/use-site-subscribe-mutation.js.map +1 -1
- package/dist/esm/reader/mutations/use-site-unsubscribe-mutation.js +4 -0
- package/dist/esm/reader/mutations/use-site-unsubscribe-mutation.js.map +1 -1
- package/dist/esm/site/actions.js +1 -1
- package/dist/esm/site/actions.js.map +1 -1
- package/dist/esm/site/constants.js +1 -0
- package/dist/esm/site/constants.js.map +1 -1
- package/dist/esm/site/types.js.map +1 -1
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/add-ons/icons/custom-design.d.ts.map +1 -1
- package/dist/types/add-ons/icons/unlimited-themes.d.ts.map +1 -1
- package/dist/types/help-center/actions.d.ts +53 -30
- package/dist/types/help-center/actions.d.ts.map +1 -1
- package/dist/types/help-center/index.d.ts +1 -1
- package/dist/types/help-center/index.d.ts.map +1 -1
- package/dist/types/help-center/reducer.d.ts +14 -7
- package/dist/types/help-center/reducer.d.ts.map +1 -1
- package/dist/types/help-center/resolvers.d.ts +22 -3
- package/dist/types/help-center/resolvers.d.ts.map +1 -1
- package/dist/types/help-center/selectors.d.ts +8 -3
- package/dist/types/help-center/selectors.d.ts.map +1 -1
- package/dist/types/help-center/types.d.ts +3 -1
- package/dist/types/help-center/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +478 -46
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/onboard/actions.d.ts +13 -24
- package/dist/types/onboard/actions.d.ts.map +1 -1
- package/dist/types/onboard/index.d.ts.map +1 -1
- package/dist/types/onboard/reducer.d.ts +7 -5
- package/dist/types/onboard/reducer.d.ts.map +1 -1
- package/dist/types/onboard/selectors.d.ts +6 -6
- package/dist/types/onboard/selectors.d.ts.map +1 -1
- package/dist/types/onboard/types.d.ts +1 -1
- package/dist/types/onboard/types.d.ts.map +1 -1
- package/dist/types/plans/queries/use-plans.d.ts.map +1 -1
- package/dist/types/purchases/lib/assembler.d.ts +3 -3
- package/dist/types/purchases/lib/assembler.d.ts.map +1 -1
- package/dist/types/purchases/queries/lib/use-query-keys-factory.d.ts +1 -0
- package/dist/types/purchases/queries/lib/use-query-keys-factory.d.ts.map +1 -1
- package/dist/types/purchases/queries/use-get-jetpack-transferred-license-purchases.d.ts +18 -0
- package/dist/types/purchases/queries/use-get-jetpack-transferred-license-purchases.d.ts.map +1 -0
- package/dist/types/purchases/types.d.ts +16 -106
- package/dist/types/purchases/types.d.ts.map +1 -1
- package/dist/types/queries/use-all-domains-query.d.ts +1 -1
- package/dist/types/queries/use-all-domains-query.d.ts.map +1 -1
- package/dist/types/queries/use-launchpad.d.ts +1 -0
- package/dist/types/queries/use-launchpad.d.ts.map +1 -1
- package/dist/types/queries/use-site-domains-query.d.ts +2 -1
- package/dist/types/queries/use-site-domains-query.d.ts.map +1 -1
- package/dist/types/queries/use-site-intent.d.ts +2 -1
- package/dist/types/queries/use-site-intent.d.ts.map +1 -1
- package/dist/types/queries/use-site-query.d.ts +1 -1
- package/dist/types/queries/use-site-query.d.ts.map +1 -1
- package/dist/types/reader/index.d.ts +475 -41
- package/dist/types/reader/index.d.ts.map +1 -1
- package/dist/types/reader/mutations/use-site-subscribe-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-subscribe-mutation.d.ts.map +1 -1
- package/dist/types/reader/mutations/use-site-unsubscribe-mutation.d.ts +2 -0
- package/dist/types/reader/mutations/use-site-unsubscribe-mutation.d.ts.map +1 -1
- package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts +75 -7
- package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts +75 -7
- package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-post-subscriptions-query.d.ts +143 -13
- package/dist/types/reader/queries/use-post-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-site-subscriptions-query.d.ts +103 -13
- package/dist/types/reader/queries/use-site-subscriptions-query.d.ts.map +1 -1
- package/dist/types/site/actions.d.ts.map +1 -1
- package/dist/types/site/constants.d.ts +1 -0
- package/dist/types/site/constants.d.ts.map +1 -1
- package/dist/types/site/types.d.ts +12 -2
- package/dist/types/site/types.d.ts.map +1 -1
- package/dist/types/user/actions.d.ts +1 -1
- package/dist/types/user/reducer.d.ts +1 -1
- package/dist/types/user/resolvers.d.ts +2 -2
- package/dist/types/user/selectors.d.ts +2 -2
- package/dist/types/user/selectors.d.ts.map +1 -1
- package/dist/types/user/types.d.ts +2 -31
- package/dist/types/user/types.d.ts.map +1 -1
- package/package.json +28 -21
- package/src/add-ons/hooks/use-add-on-prices.ts +1 -1
- package/src/add-ons/icons/custom-design.tsx +3 -11
- package/src/add-ons/icons/unlimited-themes.tsx +3 -12
- package/src/contextual-help/admin-sections.ts +2 -2
- package/src/help-center/actions.ts +101 -65
- package/src/help-center/index.ts +10 -8
- package/src/help-center/reducer.ts +45 -24
- package/src/help-center/resolvers.ts +20 -3
- package/src/help-center/selectors.ts +6 -3
- package/src/help-center/types.ts +3 -1
- package/src/index.ts +6 -6
- package/src/newsletter-categories/test/index.tsx +5 -7
- package/src/onboard/actions.ts +11 -24
- package/src/onboard/index.ts +0 -1
- package/src/onboard/reducer.ts +18 -19
- package/src/onboard/selectors.ts +2 -2
- package/src/onboard/types.ts +1 -1
- package/src/plans/queries/use-plans.ts +29 -1
- package/src/plans/resolvers.ts +1 -1
- package/src/purchases/lib/assembler.ts +11 -21
- package/src/purchases/queries/lib/use-query-keys-factory.ts +1 -0
- package/src/purchases/queries/use-get-jetpack-transferred-license-purchases.tsx +43 -0
- package/src/purchases/types.ts +21 -113
- package/src/queries/use-launchpad.ts +2 -2
- package/src/queries/use-site-domains-query.ts +1 -0
- package/src/queries/use-site-intent.ts +2 -1
- package/src/reader/mutations/use-site-subscribe-mutation.ts +2 -2
- package/src/reader/mutations/use-site-unsubscribe-mutation.ts +7 -0
- package/src/reader/queries/test/use-read-feed-search-query.tsx +1 -1
- package/src/site/actions.ts +1 -1
- package/src/site/constants.ts +1 -0
- package/src/site/test/selectors.ts +0 -1
- package/src/site/types.ts +12 -2
- package/src/user/types.ts +2 -36
- package/dist/cjs/analyzer/actions.js +0 -38
- package/dist/cjs/analyzer/actions.js.map +0 -1
- package/dist/cjs/analyzer/constants.js +0 -5
- package/dist/cjs/analyzer/constants.js.map +0 -1
- package/dist/cjs/analyzer/index.js +0 -19
- package/dist/cjs/analyzer/index.js.map +0 -1
- package/dist/cjs/analyzer/reducers.js +0 -27
- package/dist/cjs/analyzer/reducers.js.map +0 -1
- package/dist/cjs/analyzer/selectors.js +0 -15
- package/dist/cjs/analyzer/selectors.js.map +0 -1
- package/dist/cjs/analyzer/types.js +0 -3
- package/dist/cjs/analyzer/types.js.map +0 -1
- package/dist/cjs/domain-suggestions/actions.js +0 -33
- package/dist/cjs/domain-suggestions/actions.js.map +0 -1
- package/dist/cjs/domain-suggestions/constants.js +0 -12
- package/dist/cjs/domain-suggestions/constants.js.map +0 -1
- package/dist/cjs/domain-suggestions/index.js +0 -25
- package/dist/cjs/domain-suggestions/index.js.map +0 -1
- package/dist/cjs/domain-suggestions/queries.js +0 -78
- package/dist/cjs/domain-suggestions/queries.js.map +0 -1
- package/dist/cjs/domain-suggestions/reducer.js +0 -65
- package/dist/cjs/domain-suggestions/reducer.js.map +0 -1
- package/dist/cjs/domain-suggestions/resolvers.js +0 -91
- package/dist/cjs/domain-suggestions/resolvers.js.map +0 -1
- package/dist/cjs/domain-suggestions/selectors.js +0 -58
- package/dist/cjs/domain-suggestions/selectors.js.map +0 -1
- package/dist/cjs/domain-suggestions/types.js +0 -3
- package/dist/cjs/domain-suggestions/types.js.map +0 -1
- package/dist/cjs/domain-suggestions/utils.js +0 -47
- package/dist/cjs/domain-suggestions/utils.js.map +0 -1
- package/dist/esm/analyzer/actions.js +0 -35
- package/dist/esm/analyzer/actions.js.map +0 -1
- package/dist/esm/analyzer/constants.js +0 -2
- package/dist/esm/analyzer/constants.js.map +0 -1
- package/dist/esm/analyzer/index.js +0 -15
- package/dist/esm/analyzer/index.js.map +0 -1
- package/dist/esm/analyzer/reducers.js +0 -25
- package/dist/esm/analyzer/reducers.js.map +0 -1
- package/dist/esm/analyzer/selectors.js +0 -9
- package/dist/esm/analyzer/selectors.js.map +0 -1
- package/dist/esm/analyzer/types.js +0 -2
- package/dist/esm/analyzer/types.js.map +0 -1
- package/dist/esm/domain-suggestions/actions.js +0 -25
- package/dist/esm/domain-suggestions/actions.js.map +0 -1
- package/dist/esm/domain-suggestions/constants.js +0 -9
- package/dist/esm/domain-suggestions/constants.js.map +0 -1
- package/dist/esm/domain-suggestions/index.js +0 -20
- package/dist/esm/domain-suggestions/index.js.map +0 -1
- package/dist/esm/domain-suggestions/queries.js +0 -72
- package/dist/esm/domain-suggestions/queries.js.map +0 -1
- package/dist/esm/domain-suggestions/reducer.js +0 -61
- package/dist/esm/domain-suggestions/reducer.js.map +0 -1
- package/dist/esm/domain-suggestions/resolvers.js +0 -84
- package/dist/esm/domain-suggestions/resolvers.js.map +0 -1
- package/dist/esm/domain-suggestions/selectors.js +0 -47
- package/dist/esm/domain-suggestions/selectors.js.map +0 -1
- package/dist/esm/domain-suggestions/types.js +0 -2
- package/dist/esm/domain-suggestions/types.js.map +0 -1
- package/dist/esm/domain-suggestions/utils.js +0 -41
- package/dist/esm/domain-suggestions/utils.js.map +0 -1
- package/dist/types/analyzer/actions.d.ts +0 -37
- package/dist/types/analyzer/actions.d.ts.map +0 -1
- package/dist/types/analyzer/constants.d.ts +0 -2
- package/dist/types/analyzer/constants.d.ts.map +0 -1
- package/dist/types/analyzer/index.d.ts +0 -38
- package/dist/types/analyzer/index.d.ts.map +0 -1
- package/dist/types/analyzer/reducers.d.ts +0 -11
- package/dist/types/analyzer/reducers.d.ts.map +0 -1
- package/dist/types/analyzer/selectors.d.ts +0 -7
- package/dist/types/analyzer/selectors.d.ts.map +0 -1
- package/dist/types/analyzer/types.d.ts +0 -35
- package/dist/types/analyzer/types.d.ts.map +0 -1
- package/dist/types/domain-suggestions/actions.d.ts +0 -27
- package/dist/types/domain-suggestions/actions.d.ts.map +0 -1
- package/dist/types/domain-suggestions/constants.d.ts +0 -8
- package/dist/types/domain-suggestions/constants.d.ts.map +0 -1
- package/dist/types/domain-suggestions/index.d.ts +0 -10
- package/dist/types/domain-suggestions/index.d.ts.map +0 -1
- package/dist/types/domain-suggestions/queries.d.ts +0 -323
- package/dist/types/domain-suggestions/queries.d.ts.map +0 -1
- package/dist/types/domain-suggestions/reducer.d.ts +0 -16
- package/dist/types/domain-suggestions/reducer.d.ts.map +0 -1
- package/dist/types/domain-suggestions/resolvers.d.ts +0 -39
- package/dist/types/domain-suggestions/resolvers.d.ts.map +0 -1
- package/dist/types/domain-suggestions/selectors.d.ts +0 -18
- package/dist/types/domain-suggestions/selectors.d.ts.map +0 -1
- package/dist/types/domain-suggestions/types.d.ts +0 -206
- package/dist/types/domain-suggestions/types.d.ts.map +0 -1
- package/dist/types/domain-suggestions/utils.d.ts +0 -23
- package/dist/types/domain-suggestions/utils.d.ts.map +0 -1
- package/src/analyzer/actions.ts +0 -49
- package/src/analyzer/constants.ts +0 -1
- package/src/analyzer/index.ts +0 -17
- package/src/analyzer/reducers.ts +0 -36
- package/src/analyzer/selectors.ts +0 -11
- package/src/analyzer/types.ts +0 -37
- package/src/domain-suggestions/actions.ts +0 -51
- package/src/domain-suggestions/constants.ts +0 -8
- package/src/domain-suggestions/index.ts +0 -22
- package/src/domain-suggestions/queries.ts +0 -85
- package/src/domain-suggestions/reducer.ts +0 -77
- package/src/domain-suggestions/resolvers.ts +0 -110
- package/src/domain-suggestions/selectors.ts +0 -86
- package/src/domain-suggestions/test/reducer.ts +0 -105
- package/src/domain-suggestions/test/selectors.ts +0 -127
- package/src/domain-suggestions/types.ts +0 -254
- package/src/domain-suggestions/utils.ts +0 -50
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { translate } from 'i18n-calypso';
|
|
2
|
-
import { stringify } from 'qs';
|
|
3
|
-
import validator from 'validator';
|
|
4
|
-
import { fetchAndParse, wpcomRequest } from '../wpcom-request-controls';
|
|
5
|
-
import {
|
|
6
|
-
receiveCategories,
|
|
7
|
-
receiveDomainSuggestionsSuccess,
|
|
8
|
-
receiveDomainSuggestionsError,
|
|
9
|
-
fetchDomainSuggestions,
|
|
10
|
-
receiveDomainAvailability,
|
|
11
|
-
} from './actions';
|
|
12
|
-
import { getFormattedPrice } from './utils';
|
|
13
|
-
import type { DomainSuggestion, DomainSuggestionQuery } from './types';
|
|
14
|
-
|
|
15
|
-
function getAvailabilityURL( domainName: string ) {
|
|
16
|
-
return `https://public-api.wordpress.com/rest/v1.3/domains/${ encodeURIComponent(
|
|
17
|
-
domainName
|
|
18
|
-
) }/is-available?is_cart_pre_check=true`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function suggestionsLackThisFQDN( suggestions: DomainSuggestion[], domainName: string ) {
|
|
22
|
-
return (
|
|
23
|
-
validator.isFQDN( domainName ) &&
|
|
24
|
-
! suggestions.some( ( s ) => s.domain_name.toLowerCase() === domainName )
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const isAvailable = function* isAvailable( domainName: string ) {
|
|
29
|
-
const url = getAvailabilityURL( domainName );
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const { body } = yield fetchAndParse( url );
|
|
33
|
-
return receiveDomainAvailability( domainName, body );
|
|
34
|
-
} catch {
|
|
35
|
-
// the API returns a status of 'unknown' if it can not accurately determine
|
|
36
|
-
// availability, we will return the same status if the API request fails.
|
|
37
|
-
return receiveDomainAvailability( domainName, {
|
|
38
|
-
domain_name: domainName,
|
|
39
|
-
mappable: 'unknown',
|
|
40
|
-
status: 'unknown',
|
|
41
|
-
supports_privacy: false,
|
|
42
|
-
} );
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export function* getCategories() {
|
|
47
|
-
const { body } = yield fetchAndParse(
|
|
48
|
-
'https://public-api.wordpress.com/wpcom/v2/onboarding/domains/categories'
|
|
49
|
-
);
|
|
50
|
-
return receiveCategories( body );
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function* __internalGetDomainSuggestions( queryObject: DomainSuggestionQuery ) {
|
|
54
|
-
// If normalized search string (`query`) contains no alphanumerics, endpoint 404s
|
|
55
|
-
if ( ! queryObject.query ) {
|
|
56
|
-
return receiveDomainSuggestionsError( 'Empty query' );
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
yield fetchDomainSuggestions();
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const suggestions: DomainSuggestion[] = yield wpcomRequest( {
|
|
63
|
-
apiVersion: '1.1',
|
|
64
|
-
path: '/domains/suggestions',
|
|
65
|
-
query: stringify( queryObject ),
|
|
66
|
-
} );
|
|
67
|
-
|
|
68
|
-
if ( ! Array.isArray( suggestions ) ) {
|
|
69
|
-
// Other internal server errors
|
|
70
|
-
return receiveDomainSuggestionsError(
|
|
71
|
-
translate( 'Invalid response from the server' ) as string
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// if the query is a FQDN and the results don't have it,
|
|
76
|
-
// this implies that the user is searching for an unavailable domain name
|
|
77
|
-
// TODO: query the availability endpoint to find the exact reason why it's unavailable
|
|
78
|
-
// all the possible responses can be found here https://github.com/Automattic/wp-calypso/blob/trunk/client/lib/domains/registration/availability-messages.js#L40-L390
|
|
79
|
-
if ( suggestionsLackThisFQDN( suggestions, queryObject.query ) ) {
|
|
80
|
-
const unavailableSuggestion: DomainSuggestion = {
|
|
81
|
-
domain_name: queryObject.query,
|
|
82
|
-
unavailable: true,
|
|
83
|
-
cost: '',
|
|
84
|
-
raw_price: 0,
|
|
85
|
-
currency_code: '',
|
|
86
|
-
};
|
|
87
|
-
suggestions.unshift( unavailableSuggestion );
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const processedSuggestions = suggestions.map( ( suggestion: DomainSuggestion ) => {
|
|
91
|
-
if ( suggestion.unavailable ) {
|
|
92
|
-
return suggestion;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
...suggestion,
|
|
96
|
-
...( suggestion.raw_price &&
|
|
97
|
-
suggestion.currency_code && {
|
|
98
|
-
cost: getFormattedPrice( suggestion.raw_price, suggestion.currency_code ),
|
|
99
|
-
} ),
|
|
100
|
-
};
|
|
101
|
-
} );
|
|
102
|
-
|
|
103
|
-
return receiveDomainSuggestionsSuccess( queryObject, processedSuggestions );
|
|
104
|
-
} catch ( e ) {
|
|
105
|
-
// e.g. no connection, or JSON parsing error
|
|
106
|
-
return receiveDomainSuggestionsError(
|
|
107
|
-
( e as Error ).message || ( translate( 'Error while fetching server response' ) as string )
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { select } from '@wordpress/data';
|
|
2
|
-
import { STORE_KEY, DataStatus } from './constants';
|
|
3
|
-
import { stringifyDomainQueryObject, normalizeDomainSuggestionQuery } from './utils';
|
|
4
|
-
import type { State } from './reducer';
|
|
5
|
-
import type {
|
|
6
|
-
DomainAvailability,
|
|
7
|
-
DomainAvailabilities,
|
|
8
|
-
DomainCategory,
|
|
9
|
-
DomainSuggestion,
|
|
10
|
-
DomainSuggestionQuery,
|
|
11
|
-
DomainSuggestionSelectorOptions,
|
|
12
|
-
} from './types';
|
|
13
|
-
|
|
14
|
-
export const getCategories = ( state: State ): DomainCategory[] => {
|
|
15
|
-
// Sort domain categories by tier, then by title.
|
|
16
|
-
return [
|
|
17
|
-
...state.categories
|
|
18
|
-
.filter( ( { tier } ) => tier !== null )
|
|
19
|
-
.sort( ( a, b ) => ( a > b ? 1 : -1 ) ),
|
|
20
|
-
...state.categories
|
|
21
|
-
.filter( ( { tier } ) => tier === null )
|
|
22
|
-
.sort( ( a, b ) => a.title.localeCompare( b.title ) ),
|
|
23
|
-
];
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const getDomainSuggestions = (
|
|
27
|
-
_state: State,
|
|
28
|
-
search: string,
|
|
29
|
-
options: DomainSuggestionSelectorOptions = {}
|
|
30
|
-
): DomainSuggestion[] | undefined => {
|
|
31
|
-
const normalizedQuery = normalizeDomainSuggestionQuery( search, options );
|
|
32
|
-
|
|
33
|
-
// We need to go through the `select` store to get the resolver action
|
|
34
|
-
return (
|
|
35
|
-
select( STORE_KEY ) as {
|
|
36
|
-
__internalGetDomainSuggestions: (
|
|
37
|
-
queryObject: DomainSuggestionQuery
|
|
38
|
-
) => DomainSuggestion[] | undefined;
|
|
39
|
-
}
|
|
40
|
-
).__internalGetDomainSuggestions( normalizedQuery );
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const getDomainState = ( state: State ): DataStatus => {
|
|
44
|
-
return state.domainSuggestions.state;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const getDomainErrorMessage = ( state: State ): string | null => {
|
|
48
|
-
return state.domainSuggestions.errorMessage;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// TODO: reconcile this function with "Pending" status?
|
|
52
|
-
// It doesn't seem to be used
|
|
53
|
-
export const isLoadingDomainSuggestions = (
|
|
54
|
-
_state: State,
|
|
55
|
-
search: string,
|
|
56
|
-
options: DomainSuggestionSelectorOptions = {}
|
|
57
|
-
): boolean => {
|
|
58
|
-
const normalizedQuery = normalizeDomainSuggestionQuery( search, options );
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
select( 'core/data' ) as {
|
|
62
|
-
isResolving: ( storeKey: string, resolverName: string, args: unknown[] ) => boolean;
|
|
63
|
-
}
|
|
64
|
-
).isResolving( STORE_KEY, '__internalGetDomainSuggestions', [ normalizedQuery ] );
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Do not use this selector. It is for internal use.
|
|
69
|
-
* @param state Store state
|
|
70
|
-
* @param queryObject Normalized object representing the query
|
|
71
|
-
* @returns suggestions
|
|
72
|
-
*/
|
|
73
|
-
export const __internalGetDomainSuggestions = (
|
|
74
|
-
state: State,
|
|
75
|
-
queryObject: DomainSuggestionQuery
|
|
76
|
-
): DomainSuggestion[] | undefined => {
|
|
77
|
-
return state.domainSuggestions.data[ stringifyDomainQueryObject( queryObject ) ];
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const isAvailable = ( state: State, domainName: string ): DomainAvailability | undefined => {
|
|
81
|
-
return state.availability[ domainName ];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const getDomainAvailabilities = ( state: State ): DomainAvailabilities => {
|
|
85
|
-
return state.availability;
|
|
86
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { DataStatus } from '../constants';
|
|
2
|
-
import { domainSuggestions } from '../reducer';
|
|
3
|
-
import type { DomainSuggestionState, DomainSuggestion } from '../types';
|
|
4
|
-
|
|
5
|
-
describe( 'domainSuggestions', () => {
|
|
6
|
-
const initialTimeStamp = Date.now();
|
|
7
|
-
const initialState: DomainSuggestionState = {
|
|
8
|
-
state: DataStatus.Uninitialized,
|
|
9
|
-
data: undefined,
|
|
10
|
-
errorMessage: null,
|
|
11
|
-
lastUpdated: initialTimeStamp,
|
|
12
|
-
pendingSince: undefined,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
it( 'goes into a state of pending when fetching results', () => {
|
|
16
|
-
const now = Date.now();
|
|
17
|
-
const state = domainSuggestions( initialState, {
|
|
18
|
-
type: 'FETCH_DOMAIN_SUGGESTIONS',
|
|
19
|
-
timeStamp: now,
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
const expectedState: DomainSuggestionState = {
|
|
23
|
-
state: DataStatus.Pending,
|
|
24
|
-
data: undefined,
|
|
25
|
-
errorMessage: null,
|
|
26
|
-
lastUpdated: initialTimeStamp,
|
|
27
|
-
pendingSince: now,
|
|
28
|
-
};
|
|
29
|
-
expect( state ).toEqual( expectedState );
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
it( 'goes into a state of errored when fetching results have failed', () => {
|
|
33
|
-
const now = Date.now();
|
|
34
|
-
const errorMessage = 'An unexpected error has occured';
|
|
35
|
-
const state = domainSuggestions( initialState, {
|
|
36
|
-
type: 'RECEIVE_DOMAIN_SUGGESTIONS_ERROR',
|
|
37
|
-
timeStamp: now,
|
|
38
|
-
errorMessage,
|
|
39
|
-
} );
|
|
40
|
-
|
|
41
|
-
const expectedState: DomainSuggestionState = {
|
|
42
|
-
state: DataStatus.Failure,
|
|
43
|
-
data: undefined,
|
|
44
|
-
errorMessage: errorMessage,
|
|
45
|
-
lastUpdated: now,
|
|
46
|
-
pendingSince: undefined,
|
|
47
|
-
};
|
|
48
|
-
expect( state ).toEqual( expectedState );
|
|
49
|
-
} );
|
|
50
|
-
|
|
51
|
-
it( 'goes into a state of success when fetching results have returned results', () => {
|
|
52
|
-
const queryObject = {
|
|
53
|
-
include_dotblogsubdomain: false,
|
|
54
|
-
include_wordpressdotcom: true,
|
|
55
|
-
locale: 'en',
|
|
56
|
-
only_wordpressdotcom: false,
|
|
57
|
-
quantity: 11,
|
|
58
|
-
query: 'test site',
|
|
59
|
-
vendor: 'variation4_front',
|
|
60
|
-
};
|
|
61
|
-
const suggestions: DomainSuggestion[] = [
|
|
62
|
-
{
|
|
63
|
-
domain_name: 'test.site',
|
|
64
|
-
relevance: 1,
|
|
65
|
-
supports_privacy: true,
|
|
66
|
-
vendor: 'donuts',
|
|
67
|
-
match_reasons: [ 'tld-common', 'tld-exact' ],
|
|
68
|
-
product_id: 78,
|
|
69
|
-
product_slug: 'dotsite_domain',
|
|
70
|
-
cost: '$25.00',
|
|
71
|
-
raw_price: 25,
|
|
72
|
-
currency_code: 'USD',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
domain_name: 'hot-test-site.com',
|
|
76
|
-
relevance: 1,
|
|
77
|
-
supports_privacy: true,
|
|
78
|
-
vendor: 'donuts',
|
|
79
|
-
match_reasons: [ 'tld-common' ],
|
|
80
|
-
product_id: 6,
|
|
81
|
-
product_slug: 'domain_reg',
|
|
82
|
-
cost: '$18.00',
|
|
83
|
-
raw_price: 18,
|
|
84
|
-
currency_code: 'USD',
|
|
85
|
-
},
|
|
86
|
-
];
|
|
87
|
-
const now = Date.now();
|
|
88
|
-
const state = domainSuggestions( initialState, {
|
|
89
|
-
type: 'RECEIVE_DOMAIN_SUGGESTIONS_SUCCESS',
|
|
90
|
-
queryObject,
|
|
91
|
-
suggestions,
|
|
92
|
-
timeStamp: now,
|
|
93
|
-
} );
|
|
94
|
-
|
|
95
|
-
const expectedState: DomainSuggestionState = {
|
|
96
|
-
state: DataStatus.Success,
|
|
97
|
-
data: { [ JSON.stringify( queryObject ) ]: suggestions },
|
|
98
|
-
errorMessage: null,
|
|
99
|
-
lastUpdated: now,
|
|
100
|
-
pendingSince: undefined,
|
|
101
|
-
};
|
|
102
|
-
expect( state ).toEqual( expectedState );
|
|
103
|
-
expect( state.data[ JSON.stringify( queryObject ) ].length ).toEqual( suggestions.length );
|
|
104
|
-
} );
|
|
105
|
-
} );
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { select, subscribe } from '@wordpress/data';
|
|
2
|
-
import wpcomRequest from 'wpcom-proxy-request';
|
|
3
|
-
import { store } from '..';
|
|
4
|
-
import { DataStatus } from '../constants';
|
|
5
|
-
|
|
6
|
-
jest.mock( 'wpcom-proxy-request', () => ( {
|
|
7
|
-
__esModule: true,
|
|
8
|
-
default: jest.fn(),
|
|
9
|
-
requestAllBlogsAccess: jest.fn( () => Promise.resolve() ),
|
|
10
|
-
} ) );
|
|
11
|
-
|
|
12
|
-
const options = {
|
|
13
|
-
category_slug: undefined,
|
|
14
|
-
include_dotblogsubdomain: false,
|
|
15
|
-
include_wordpressdotcom: true,
|
|
16
|
-
locale: 'en',
|
|
17
|
-
quantity: 11,
|
|
18
|
-
};
|
|
19
|
-
const apiResponse = [
|
|
20
|
-
{
|
|
21
|
-
domain_name: 'test.site',
|
|
22
|
-
relevance: 1,
|
|
23
|
-
supports_privacy: true,
|
|
24
|
-
vendor: 'donuts',
|
|
25
|
-
match_reasons: [ 'tld-common', 'tld-exact' ],
|
|
26
|
-
product_id: 78,
|
|
27
|
-
product_slug: 'dotsite_domain',
|
|
28
|
-
cost: '$25',
|
|
29
|
-
raw_price: 25,
|
|
30
|
-
currency_code: 'USD',
|
|
31
|
-
unavailable: false,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
domain_name: 'hot-test-site.com',
|
|
35
|
-
relevance: 1,
|
|
36
|
-
supports_privacy: true,
|
|
37
|
-
vendor: 'donuts',
|
|
38
|
-
match_reasons: [ 'tld-common' ],
|
|
39
|
-
product_id: 6,
|
|
40
|
-
product_slug: 'domain_reg',
|
|
41
|
-
cost: '$18',
|
|
42
|
-
raw_price: 18,
|
|
43
|
-
currency_code: 'USD',
|
|
44
|
-
unavailable: false,
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
beforeEach( () => {
|
|
49
|
-
( wpcomRequest as jest.Mock ).mockReset();
|
|
50
|
-
} );
|
|
51
|
-
|
|
52
|
-
describe( 'getDomainSuggestions', () => {
|
|
53
|
-
it( 'resolves the state via an API call and caches the resolver on success', async () => {
|
|
54
|
-
( wpcomRequest as jest.Mock ).mockResolvedValue( apiResponse );
|
|
55
|
-
|
|
56
|
-
const query = 'test query one';
|
|
57
|
-
const listenForStateUpdate = () => {
|
|
58
|
-
return new Promise< void >( ( resolve ) => {
|
|
59
|
-
const unsubscribe = subscribe( () => {
|
|
60
|
-
unsubscribe();
|
|
61
|
-
resolve();
|
|
62
|
-
} );
|
|
63
|
-
} );
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Status should be uninitialized before first call
|
|
67
|
-
expect( select( store ).getDomainState() ).toEqual( DataStatus.Uninitialized );
|
|
68
|
-
|
|
69
|
-
// First call returns undefined
|
|
70
|
-
expect( select( store ).getDomainSuggestions( query, options ) ).toEqual( undefined );
|
|
71
|
-
|
|
72
|
-
await listenForStateUpdate();
|
|
73
|
-
|
|
74
|
-
// Status should be pending while we wait for the response
|
|
75
|
-
expect( select( store ).getDomainState() ).toEqual( DataStatus.Pending );
|
|
76
|
-
|
|
77
|
-
await listenForStateUpdate();
|
|
78
|
-
|
|
79
|
-
// Status should be successful once we get the response
|
|
80
|
-
expect( select( store ).getDomainState() ).toEqual( DataStatus.Success );
|
|
81
|
-
|
|
82
|
-
// By the second call, the resolver will have resolved
|
|
83
|
-
expect( select( store ).getDomainSuggestions( query, options ) ).toEqual( apiResponse );
|
|
84
|
-
|
|
85
|
-
await listenForStateUpdate();
|
|
86
|
-
|
|
87
|
-
// The resolver should now be cached with an `isStarting` value of false
|
|
88
|
-
|
|
89
|
-
expect(
|
|
90
|
-
select( 'core/data' ).isResolving( store, 'getDomainSuggestions', [ query, options ] )
|
|
91
|
-
).toEqual( false );
|
|
92
|
-
} );
|
|
93
|
-
} );
|
|
94
|
-
|
|
95
|
-
describe( 'getDomainErrorMessage', () => {
|
|
96
|
-
it( 'should return null if no error message', () => {
|
|
97
|
-
expect( select( store ).getDomainErrorMessage() ).toEqual( null );
|
|
98
|
-
} );
|
|
99
|
-
|
|
100
|
-
it( 'should return correct error message if no suggestions are returned', async () => {
|
|
101
|
-
( wpcomRequest as jest.Mock ).mockResolvedValue( null );
|
|
102
|
-
|
|
103
|
-
const query = 'test query two';
|
|
104
|
-
const listenForStateUpdate = () => {
|
|
105
|
-
return new Promise< void >( ( resolve ) => {
|
|
106
|
-
const unsubscribe = subscribe( () => {
|
|
107
|
-
unsubscribe();
|
|
108
|
-
resolve();
|
|
109
|
-
} );
|
|
110
|
-
} );
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// The error message should start off as a null value
|
|
114
|
-
expect( select( store ).getDomainErrorMessage() ).toBeFalsy();
|
|
115
|
-
|
|
116
|
-
// First call returns undefined
|
|
117
|
-
select( store ).getDomainSuggestions( query, options );
|
|
118
|
-
await listenForStateUpdate();
|
|
119
|
-
|
|
120
|
-
// By the second call, the resolver will have resolved
|
|
121
|
-
select( store ).getDomainSuggestions( query, options );
|
|
122
|
-
await listenForStateUpdate();
|
|
123
|
-
|
|
124
|
-
// The promise resolves null suggestions so we should now have an error message
|
|
125
|
-
expect( select( store ).getDomainErrorMessage() ).toBeTruthy();
|
|
126
|
-
} );
|
|
127
|
-
} );
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import type { DataStatus } from './constants';
|
|
2
|
-
|
|
3
|
-
export interface DomainSuggestionQuery {
|
|
4
|
-
/**
|
|
5
|
-
* True to include .blog subdomain suggestions
|
|
6
|
-
* @example
|
|
7
|
-
* example.photo.blog
|
|
8
|
-
*/
|
|
9
|
-
include_dotblogsubdomain: boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* True to include WordPress.com subdomain suggestions
|
|
13
|
-
* @example
|
|
14
|
-
* example.wordpress.com
|
|
15
|
-
*/
|
|
16
|
-
include_wordpressdotcom: boolean;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* True to include domains registered with wpcom in the response
|
|
20
|
-
*/
|
|
21
|
-
include_internal_move_eligible?: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Localizes domain results, e.g., price format
|
|
25
|
-
*/
|
|
26
|
-
locale?: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* True to only provide a wordpress.com subdomain
|
|
30
|
-
* @example
|
|
31
|
-
* example.wordpress.com
|
|
32
|
-
*/
|
|
33
|
-
only_wordpressdotcom: boolean;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Desired number of results
|
|
37
|
-
*/
|
|
38
|
-
quantity: number;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Domain search term
|
|
42
|
-
*/
|
|
43
|
-
query: string;
|
|
44
|
-
|
|
45
|
-
recommendation_context?: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Vendor
|
|
49
|
-
*/
|
|
50
|
-
vendor: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The vertical id or slug
|
|
54
|
-
*/
|
|
55
|
-
vertical?: string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* An array of tlds
|
|
59
|
-
*/
|
|
60
|
-
tlds?: readonly string[];
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Domain category slug
|
|
64
|
-
*/
|
|
65
|
-
category_slug?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type DomainName = string;
|
|
69
|
-
|
|
70
|
-
export interface DomainSuggestion {
|
|
71
|
-
/**
|
|
72
|
-
* The domain name
|
|
73
|
-
* @example "example.com"
|
|
74
|
-
*/
|
|
75
|
-
domain_name: DomainName;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Rendered formatted cost
|
|
79
|
-
* @example "Free" or "€15.00"
|
|
80
|
-
*/
|
|
81
|
-
cost: string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Raw price
|
|
85
|
-
* @example 40
|
|
86
|
-
*/
|
|
87
|
-
raw_price: number;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Currency code
|
|
91
|
-
* @example USD
|
|
92
|
-
*/
|
|
93
|
-
currency_code: string;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Relevance as a percent: 0 <= relevance <= 1
|
|
97
|
-
* @example 0.9
|
|
98
|
-
*/
|
|
99
|
-
relevance?: number;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Whether the domain supports privacy
|
|
103
|
-
*/
|
|
104
|
-
supports_privacy?: boolean;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The domain vendor
|
|
108
|
-
*/
|
|
109
|
-
vendor?: string;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Reasons for suggestion the domain
|
|
113
|
-
* @example [ "exact-match" ]
|
|
114
|
-
*/
|
|
115
|
-
match_reasons?: readonly string[];
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* The product ID
|
|
119
|
-
*/
|
|
120
|
-
product_id?: number;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The product slug
|
|
124
|
-
*/
|
|
125
|
-
product_slug?: string;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Whether the domain is free
|
|
129
|
-
*/
|
|
130
|
-
is_free?: boolean;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Whether the domain requires HSTS
|
|
134
|
-
*/
|
|
135
|
-
hsts_required?: boolean;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Whether the domain requires to show the notice for .gay tld
|
|
139
|
-
*/
|
|
140
|
-
is_dot_gay_notice_required?: boolean;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Whether the domain is unavailable
|
|
144
|
-
*/
|
|
145
|
-
unavailable: boolean;
|
|
146
|
-
|
|
147
|
-
isRecommended?: boolean;
|
|
148
|
-
isBestAlternative?: boolean;
|
|
149
|
-
is_premium?: boolean;
|
|
150
|
-
}
|
|
151
|
-
export interface DomainCategory {
|
|
152
|
-
/**
|
|
153
|
-
* The domain category title
|
|
154
|
-
*/
|
|
155
|
-
title: string;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The domain category slug
|
|
159
|
-
*/
|
|
160
|
-
slug: string;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* The domain category tier
|
|
164
|
-
*/
|
|
165
|
-
tier: number | null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface DomainAvailability {
|
|
169
|
-
/**
|
|
170
|
-
* The domain name the availability was checked for.
|
|
171
|
-
*/
|
|
172
|
-
domain_name: string;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* The mappability status of the domain.
|
|
176
|
-
*/
|
|
177
|
-
mappable: string;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The availability status of the domain.
|
|
181
|
-
*/
|
|
182
|
-
status: string;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Whether the domain supports privacy.
|
|
186
|
-
*/
|
|
187
|
-
supports_privacy: boolean;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* ID of the product
|
|
191
|
-
*/
|
|
192
|
-
product_id?: number;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* The product slug
|
|
196
|
-
*/
|
|
197
|
-
product_slug?: string;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Rendered cost with currency
|
|
201
|
-
* @example "€15.00"
|
|
202
|
-
*/
|
|
203
|
-
cost?: string;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Vendor
|
|
207
|
-
*/
|
|
208
|
-
vendor?: string;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Whether the domain requires HSTS
|
|
212
|
-
*/
|
|
213
|
-
hsts_required?: boolean;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Whether the domain requires to show the notice for .gay tld
|
|
217
|
-
*/
|
|
218
|
-
is_dot_gay_notice_required?: boolean;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export type TimestampMS = ReturnType< typeof Date.now >;
|
|
222
|
-
|
|
223
|
-
export type DomainSuggestions = Record< string, DomainSuggestion[] | undefined >;
|
|
224
|
-
|
|
225
|
-
export interface DomainSuggestionState {
|
|
226
|
-
/**
|
|
227
|
-
* The state of the DomainSuggestions e.g. pending, failure etc
|
|
228
|
-
*/
|
|
229
|
-
state: DataStatus;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Domain suggestion data typically returned from the API
|
|
233
|
-
*/
|
|
234
|
-
data: DomainSuggestions;
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Error message
|
|
238
|
-
*/
|
|
239
|
-
errorMessage: string | null;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Timestamp from last updated attempt
|
|
243
|
-
*/
|
|
244
|
-
lastUpdated: TimestampMS;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Pending timestamp
|
|
248
|
-
*/
|
|
249
|
-
pendingSince: TimestampMS | undefined;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export type DomainAvailabilities = Record< string, DomainAvailability | undefined >;
|
|
253
|
-
|
|
254
|
-
export type DomainSuggestionSelectorOptions = Partial< Exclude< DomainSuggestionQuery, 'query' > >;
|