@vonq/hapi-elements-types 1.43.0 → 1.44.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/_window/state.types.ts +24 -6
- package/common/types.ts +2 -0
- package/common/validations.types.ts +2 -0
- package/contract/service.types.ts +12 -2
- package/contract/state.cache.types.ts +5 -0
- package/contract/types.ts +16 -0
- package/package.json +1 -1
- package/product/service.types.ts +6 -0
- package/product/state.cache.types.ts +5 -0
- package/product/types.ts +15 -6
package/_window/state.types.ts
CHANGED
@@ -27,16 +27,24 @@ import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.t
|
|
27
27
|
import { WindowHapiValidationsWallet } from "../wallet/validations.types"
|
28
28
|
import { WindowHapiValidations } from "./validation.types"
|
29
29
|
import { ExperimentalState } from "../experimental/state.types"
|
30
|
+
import { ProductCacheState } from "../product/state.cache.types"
|
31
|
+
import { ContractCacheState } from "../contract/state.cache.types"
|
30
32
|
|
31
33
|
export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
|
32
34
|
{
|
33
35
|
[WindowHapiModuleName.alert]: WindowHapiStateModule<AlertState>
|
34
36
|
[WindowHapiModuleName.basket]: WindowHapiStateModule<BasketState>
|
35
37
|
[WindowHapiModuleName.campaign]: WindowHapiStateModule<CampaignState>
|
36
|
-
[WindowHapiModuleName.contract]: WindowHapiStateModule<
|
38
|
+
[WindowHapiModuleName.contract]: WindowHapiStateModule<
|
39
|
+
ContractState,
|
40
|
+
ContractCacheState
|
41
|
+
>
|
37
42
|
[WindowHapiModuleName.debugging]: WindowHapiStateModule<DebuggingState>
|
38
43
|
[WindowHapiModuleName.language]: WindowHapiStateModule<LanguageState>
|
39
|
-
[WindowHapiModuleName.product]: WindowHapiStateModule<
|
44
|
+
[WindowHapiModuleName.product]: WindowHapiStateModule<
|
45
|
+
ProductState,
|
46
|
+
ProductCacheState
|
47
|
+
>
|
40
48
|
[WindowHapiModuleName.theming]: WindowHapiStateModule<ThemingState>
|
41
49
|
[WindowHapiModuleName.orderJourney]: WindowHapiStateModule<OrderJourneyState>
|
42
50
|
[WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
|
@@ -56,10 +64,16 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
|
|
56
64
|
[WindowHapiModuleName.alert]: WindowHapiStateModule<AlertState>
|
57
65
|
[WindowHapiModuleName.basket]: WindowHapiStateModule<BasketState>
|
58
66
|
[WindowHapiModuleName.campaign]: WindowHapiStateModule<CampaignState>
|
59
|
-
[WindowHapiModuleName.contract]: WindowHapiStateModule<
|
67
|
+
[WindowHapiModuleName.contract]: WindowHapiStateModule<
|
68
|
+
ContractState,
|
69
|
+
ContractCacheState
|
70
|
+
>
|
60
71
|
[WindowHapiModuleName.debugging]: WindowHapiStateModule<DebuggingState>
|
61
72
|
[WindowHapiModuleName.language]: WindowHapiStateModule<LanguageState>
|
62
|
-
[WindowHapiModuleName.product]: WindowHapiStateModule<
|
73
|
+
[WindowHapiModuleName.product]: WindowHapiStateModule<
|
74
|
+
ProductState,
|
75
|
+
ProductCacheState
|
76
|
+
>
|
63
77
|
[WindowHapiModuleName.theming]: WindowHapiStateModule<ThemingState>
|
64
78
|
[WindowHapiModuleName.orderJourney]: WindowHapiStateModule<OrderJourneyState>
|
65
79
|
[WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
|
@@ -91,12 +105,13 @@ export type WindowHapiStatesJSON = {
|
|
91
105
|
[WindowHapiModuleName.experimental]: ExperimentalState
|
92
106
|
}
|
93
107
|
|
94
|
-
export type WindowHapiStateBase<T> = {
|
108
|
+
export type WindowHapiStateBase<T, CacheType = undefined> = {
|
95
109
|
propertiesThatShouldNotBeDocumented: string[]
|
96
110
|
__elementsStateModuleName: string
|
97
111
|
toJSON: any
|
98
112
|
addClassPropertiesObserver: () => void
|
99
113
|
validations: StateValidations<T>
|
114
|
+
cache: WindowHapiStateModule<CacheType> | undefined
|
100
115
|
}
|
101
116
|
|
102
117
|
export type HapiStateValueWithListener<T> = {
|
@@ -104,7 +119,10 @@ export type HapiStateValueWithListener<T> = {
|
|
104
119
|
value: T
|
105
120
|
}
|
106
121
|
|
107
|
-
export type WindowHapiStateModule<
|
122
|
+
export type WindowHapiStateModule<
|
123
|
+
T,
|
124
|
+
CacheType = undefined,
|
125
|
+
> = WindowHapiStateBase<T, CacheType> & {
|
108
126
|
[P in keyof T]:
|
109
127
|
| T[P]
|
110
128
|
| HapiStateValueWithListener<T[P]>
|
package/common/types.ts
CHANGED
@@ -3,6 +3,7 @@ import {
|
|
3
3
|
ZodArray,
|
4
4
|
ZodBoolean,
|
5
5
|
ZodFunction,
|
6
|
+
ZodMap,
|
6
7
|
ZodNullable,
|
7
8
|
ZodNumber,
|
8
9
|
ZodObject,
|
@@ -63,6 +64,7 @@ export type WindowHapiValidationsCommon = {
|
|
63
64
|
genericString: ZodString
|
64
65
|
genericStringArray: ZodArray<ZodString>
|
65
66
|
genericObject: ZodObject<any>
|
67
|
+
genericMap: ZodMap<any, any>
|
66
68
|
genericRecordFunction: ZodRecord<
|
67
69
|
ZodString,
|
68
70
|
ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>
|
@@ -5,8 +5,8 @@ import {
|
|
5
5
|
import { OrderJourneyStepKey } from "../orderJourney/enums"
|
6
6
|
import {
|
7
7
|
Contract,
|
8
|
-
ContractDirectApplyChannelPrefillVariablesMap,
|
9
8
|
ContractCredential,
|
9
|
+
ContractDirectApplyChannelPrefillVariablesMap,
|
10
10
|
ContractGroup,
|
11
11
|
ContractDirectApplyPostingRequirementQuestionnaireQuestionBody,
|
12
12
|
ContractDirectApplyPostingRequirementQuestionnaireRules,
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
} from "./types"
|
15
15
|
import {
|
16
16
|
PaginatedAPIResponseV1,
|
17
|
+
PostingRequirementOption,
|
17
18
|
PostingRequirementsAutocompleteRequestOption,
|
18
19
|
TransformedPostingRequirement,
|
19
20
|
} from "../common/types"
|
@@ -27,7 +28,7 @@ export type ContractServiceGetContractPostingRequirementOptionsHandler = (
|
|
27
28
|
contractId: string,
|
28
29
|
fieldName: string,
|
29
30
|
autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
|
30
|
-
) => Promise<
|
31
|
+
) => Promise<PostingRequirementOption[]>
|
31
32
|
|
32
33
|
export type ContractServiceGetContractsHandler = (
|
33
34
|
offset: number,
|
@@ -96,6 +97,14 @@ export type ContractServiceGetContractChannelPostingRequirementQuestionnaireRule
|
|
96
97
|
channelName: ContractDirectApplyChannelName,
|
97
98
|
) => Promise<ContractServiceGetContractChannelPostingRequirementQuestionnaireRulesForDirectApplyResponse>
|
98
99
|
|
100
|
+
export type ContractServiceGetContractPostingRequirementOptionsFromCacheOrAPIHandler =
|
101
|
+
(
|
102
|
+
contractId: string,
|
103
|
+
fieldName: string,
|
104
|
+
autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
|
105
|
+
forceRefresh?: boolean,
|
106
|
+
) => Promise<PostingRequirementOption[]>
|
107
|
+
|
99
108
|
export type WindowHapiServiceContract = WindowHapiModuleWithConstructorArgs<
|
100
109
|
{
|
101
110
|
onAfterContractEditModalOpenClose: (
|
@@ -115,6 +124,7 @@ export type WindowHapiServiceContract = WindowHapiModuleWithConstructorArgs<
|
|
115
124
|
getContractChannelPostingRequirementQuestionnaireBodyForDirectApply: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractChannelPostingRequirementQuestionnaireBodyForDirectApplyHandler>
|
116
125
|
getContractChannelPostingRequirementQuestionnaireRulesForDirectApply: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractChannelPostingRequirementQuestionnaireRulesForDirectApplyHandler>
|
117
126
|
setContractChannelPostingRequirementQuestionnaireOptionsDirectApply: HapiServiceFunctionWithLifecycleHooks<ContractServiceSetContractChannelPostingRequirementQuestionnaireOptionsDirectApplyHandler>
|
127
|
+
getContractPostingRequirementOptionsFromCacheOrAPI: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractPostingRequirementOptionsFromCacheOrAPIHandler>
|
118
128
|
initiateOauthLogin: (
|
119
129
|
contractId: string | number,
|
120
130
|
orderJourneyStepActive: OrderJourneyStepKey,
|
package/contract/types.ts
CHANGED
@@ -3,6 +3,8 @@ import {
|
|
3
3
|
Facet,
|
4
4
|
PostingRequirement,
|
5
5
|
PostingRequirementLabelsMap,
|
6
|
+
PostingRequirementsAutocompleteRequestOption,
|
7
|
+
StringifiedJSON,
|
6
8
|
} from "../common"
|
7
9
|
import {
|
8
10
|
ContractDirectApplyPostingRequirementQuestionnaireLengthRule,
|
@@ -254,3 +256,17 @@ export type ContractDirectApplyPostingRequirementQuestionnaireQuestionAnswerIgno
|
|
254
256
|
answer: ContractDirectApplyPostingRequirementQuestionnaireClosedQuestionAnswer
|
255
257
|
ignoreReasons: ContractDirectApplyPostingRequirementQuestionnaireQuestionValidationError[]
|
256
258
|
}
|
259
|
+
|
260
|
+
export type ContractPostingRequirementsOptionsPayload = [
|
261
|
+
string | number, // argument 1 of fn ContractServiceGetContractPostingRequirementOptionsFromCacheOrAPIHandler
|
262
|
+
string, // argument 2 of fn ContractServiceGetContractPostingRequirementOptionsFromCacheOrAPIHandler
|
263
|
+
PostingRequirementsAutocompleteRequestOption[], // argument 3 of fn ContractServiceGetContractPostingRequirementOptionsFromCacheOrAPIHandler
|
264
|
+
]
|
265
|
+
export type ContractPostingRequirementsOptionsMapState = {
|
266
|
+
isLoading: boolean
|
267
|
+
data: any | null
|
268
|
+
}
|
269
|
+
export type ContractProductsSupportingContractsMap = Map<
|
270
|
+
StringifiedJSON<ContractPostingRequirementsOptionsPayload>,
|
271
|
+
ContractPostingRequirementsOptionsMapState
|
272
|
+
>
|
package/package.json
CHANGED
package/product/service.types.ts
CHANGED
@@ -67,6 +67,11 @@ export type ProductServiceSetArbitraryJobTitle = (
|
|
67
67
|
shouldResetJobFunctionsIds?: boolean,
|
68
68
|
) => void
|
69
69
|
|
70
|
+
export type ProductServiceGetProductSupportingContractsFromCacheOrAPIHandler = (
|
71
|
+
id: string | number,
|
72
|
+
forceRefresh?: boolean,
|
73
|
+
) => Promise<ProductSupportingContractsComplete | undefined>
|
74
|
+
|
70
75
|
export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
|
71
76
|
{
|
72
77
|
loadMoreProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceLoadMoreProductsHandler>
|
@@ -83,6 +88,7 @@ export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
|
|
83
88
|
getJobTitles: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobTitlesHandler>
|
84
89
|
getJobFunctions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobFunctionsHandler>
|
85
90
|
getIndustries: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetIndustriesHandler>
|
91
|
+
getProductSupportingContractsFromCacheOrAPI: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductSupportingContractsFromCacheOrAPIHandler>
|
86
92
|
},
|
87
93
|
{ readonly service: WindowHapiService }
|
88
94
|
>
|
package/product/types.ts
CHANGED
@@ -4,12 +4,8 @@ import {
|
|
4
4
|
ProductSortBy,
|
5
5
|
ProductTypeFilterBy,
|
6
6
|
} from "./enums"
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
Facet,
|
10
|
-
PostingRequirement,
|
11
|
-
PostingRequirementLabelsMap,
|
12
|
-
} from "../common"
|
7
|
+
import { ContractDetails } from "../contract/types"
|
8
|
+
import { StringifiedJSON } from "../common"
|
13
9
|
|
14
10
|
export type ProductRange = "hours" | "days" | "weeks" | "months"
|
15
11
|
|
@@ -171,3 +167,16 @@ export type ProductUserProvidedFilters = Omit<
|
|
171
167
|
ProductFilterQueryParams,
|
172
168
|
"filterProductRecommendations" | "filterMyContractSupportedOnly"
|
173
169
|
>
|
170
|
+
|
171
|
+
export type ProductProductsSupportingContractsPayload = [
|
172
|
+
string | number, // argument 1 of fn ProductServiceGetProductSupportingContractsFromCacheOrAPIHandler
|
173
|
+
]
|
174
|
+
|
175
|
+
export type ProductProductsSupportingContractsMapState = {
|
176
|
+
isLoading: boolean
|
177
|
+
data: ProductSupportingContractsComplete | null
|
178
|
+
}
|
179
|
+
export type ProductProductsSupportingContractsMap = Map<
|
180
|
+
StringifiedJSON<ProductProductsSupportingContractsPayload>,
|
181
|
+
ProductProductsSupportingContractsMapState
|
182
|
+
>
|