@vonq/hapi-elements-types 1.28.0 → 1.29.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/api.types.ts +36 -15
- package/_window/service.types.ts +4 -0
- package/basket/service.types.ts +4 -3
- package/campaign/service.types.ts +1 -0
- package/campaign/utils.types.ts +5 -0
- package/common/enums.ts +1 -0
- package/common/types.ts +4 -16
- package/common/validator/types.ts +1 -0
- package/contract/types.ts +1 -0
- package/contract/validations.types.ts +1 -0
- package/experimental/api.types.ts +17 -0
- package/experimental/index.ts +4 -0
- package/experimental/service.types.ts +14 -0
- package/modal/enums.ts +2 -1
- package/modal/types.ts +1 -2
- package/orderJourney/service.types.ts +3 -1
- package/orderJourney/types.ts +10 -0
- package/package.json +1 -1
package/_window/api.types.ts
CHANGED
@@ -16,8 +16,10 @@ import {
|
|
16
16
|
} from "./window"
|
17
17
|
import { WindowHapiLogger } from "../common/logger/types"
|
18
18
|
import { ATSUserTokenResponse } from "../ats"
|
19
|
+
import { PartialRecord } from "../common"
|
20
|
+
import { WindowHapiAPIExperimental } from "../experimental"
|
19
21
|
|
20
|
-
export type WindowHapiAPIModule<
|
22
|
+
export type WindowHapiAPIModule<ModuleRequests, ModuleConfig> = {
|
21
23
|
propertiesThatShouldNotBeDocumented: string[]
|
22
24
|
logger: WindowHapiLogger
|
23
25
|
configs: ModuleConfig
|
@@ -27,7 +29,11 @@ export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
|
27
29
|
resourceKey: keyof ModuleConfig,
|
28
30
|
config: RawAxiosRequestConfig,
|
29
31
|
) => void
|
30
|
-
|
32
|
+
abortControllers: PartialRecord<
|
33
|
+
keyof ModuleRequests,
|
34
|
+
Map<RawAxiosRequestConfig, AbortController>
|
35
|
+
>
|
36
|
+
} & ModuleRequests
|
31
37
|
export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
|
32
38
|
headers?: any
|
33
39
|
}
|
@@ -43,6 +49,17 @@ export type WindowHapiAPIRefreshJWTTokenHandler = () => Promise<
|
|
43
49
|
|
44
50
|
export type WindowHapiAPIValidateJWTTokenHandler = () => Promise<boolean>
|
45
51
|
|
52
|
+
export type WindowHapiAPIModules = {
|
53
|
+
[WindowHapiModuleName.contract]: WindowHapiAPIContract
|
54
|
+
[WindowHapiModuleName.wallet]: WindowHapiAPIWallet
|
55
|
+
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
56
|
+
[WindowHapiModuleName.campaign]: WindowHapiAPICampaign
|
57
|
+
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
58
|
+
[WindowHapiModuleName.experimental]: WindowHapiAPIExperimental
|
59
|
+
}
|
60
|
+
|
61
|
+
type Test = WindowHapiAPIModules[keyof WindowHapiAPIModules]
|
62
|
+
|
46
63
|
export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
47
64
|
{
|
48
65
|
/* Common */
|
@@ -60,6 +77,21 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
|
60
77
|
request: <T = any, R = AxiosResponse<T>, D = any>(
|
61
78
|
config: Partial<HapiRequestConfig<D>>,
|
62
79
|
) => Promise<R>
|
80
|
+
requestAbortable: <
|
81
|
+
ModuleKlass extends WindowHapiAPIModule<
|
82
|
+
ModuleRequests,
|
83
|
+
ModuleConfig
|
84
|
+
>,
|
85
|
+
ModuleRequests,
|
86
|
+
ModuleConfig,
|
87
|
+
T = any,
|
88
|
+
R = AxiosResponse<T>,
|
89
|
+
D = any,
|
90
|
+
>(
|
91
|
+
moduleKlass: WindowHapiAPIModule<any, any>,
|
92
|
+
functionName: keyof ModuleRequests,
|
93
|
+
config: Partial<HapiRequestConfig<D>>,
|
94
|
+
) => Promise<R>
|
63
95
|
jwtHeaderKey: string
|
64
96
|
jwtRefreshIntervalInSeconds: number
|
65
97
|
setJWTRefreshIntervalInSeconds: (seconds: number) => void
|
@@ -84,18 +116,7 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
|
84
116
|
endpoint: string,
|
85
117
|
data?: any,
|
86
118
|
) => Promise<any>
|
87
|
-
|
88
|
-
|
89
|
-
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
90
|
-
[WindowHapiModuleName.campaign]: WindowHapiAPICampaign
|
91
|
-
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
92
|
-
modules: {
|
93
|
-
[WindowHapiModuleName.contract]: WindowHapiAPIContract
|
94
|
-
[WindowHapiModuleName.wallet]: WindowHapiAPIWallet
|
95
|
-
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
96
|
-
[WindowHapiModuleName.campaign]: WindowHapiAPICampaign
|
97
|
-
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
98
|
-
}
|
99
|
-
},
|
119
|
+
modules: WindowHapiAPIModules
|
120
|
+
} & WindowHapiAPIModules,
|
100
121
|
{ readonly core: WindowHapiClassInterface }
|
101
122
|
>
|
package/_window/service.types.ts
CHANGED
@@ -16,6 +16,7 @@ import { WindowHapiLogger } from "../common/logger/types"
|
|
16
16
|
import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
|
17
17
|
import { WindowHapiServiceDebugging } from "../debugging/service.types"
|
18
18
|
import { WindowHapiServiceLanguage } from "../language/service.types"
|
19
|
+
import { WindowHapiServiceExperimental } from "../experimental"
|
19
20
|
|
20
21
|
export type HapiServiceFunctionLifecycleHookCallbackHandler = (
|
21
22
|
...args: any[]
|
@@ -23,6 +24,7 @@ export type HapiServiceFunctionLifecycleHookCallbackHandler = (
|
|
23
24
|
|
24
25
|
export type HapiServiceFunctionLifecycleHookHandler = (
|
25
26
|
callback: HapiServiceFunctionLifecycleHookCallbackHandler,
|
27
|
+
runArgs?: any[],
|
26
28
|
) => void
|
27
29
|
|
28
30
|
export type HapiServiceFunctionWithLifecycleHooks<HandlerType> = {
|
@@ -56,6 +58,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
56
58
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
57
59
|
[WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
|
58
60
|
[WindowHapiModuleName.language]: WindowHapiServiceLanguage
|
61
|
+
[WindowHapiModuleName.experimental]: WindowHapiServiceExperimental
|
59
62
|
services: {
|
60
63
|
[WindowHapiModuleName.alert]: WindowHapiServiceAlert
|
61
64
|
[WindowHapiModuleName.basket]: WindowHapiServiceBasket
|
@@ -69,6 +72,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
69
72
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
70
73
|
[WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
|
71
74
|
[WindowHapiModuleName.language]: WindowHapiServiceLanguage
|
75
|
+
[WindowHapiModuleName.experimental]: WindowHapiServiceExperimental
|
72
76
|
}
|
73
77
|
|
74
78
|
decorateFunctionWithLifecycleEvents: <HandlerType extends Function>(
|
package/basket/service.types.ts
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
9
9
|
|
10
10
|
export type BasketServiceGetProductsHandler = (
|
11
|
-
products
|
11
|
+
products: BasketProduct[],
|
12
12
|
shouldSet?: boolean,
|
13
13
|
) => Promise<(Product | Contract)[]>
|
14
14
|
export type BasketServiceAddProductOrContractByIdHandler = (
|
@@ -25,13 +25,14 @@ export type BasketServiceRemoveContractsWithConflictingGroupsHandler = (
|
|
25
25
|
export type BasketServiceKeepContractsWithConflictingGroupsHandler = () => void
|
26
26
|
export type BasketServiceSetProductsMetaHandler = (
|
27
27
|
meta: BasketProduct[],
|
28
|
-
) =>
|
28
|
+
) => void
|
29
29
|
|
30
30
|
export type WindowHapiServiceBasket = WindowHapiModuleWithConstructorArgs<
|
31
31
|
{
|
32
32
|
onAfterGetBasketData: (
|
33
33
|
basketItemData: (Contract | Product)[],
|
34
|
-
shouldSet
|
34
|
+
shouldSet?: boolean,
|
35
|
+
shouldSetMeta?: boolean,
|
35
36
|
) => BasketProduct[]
|
36
37
|
setProductsMeta: BasketServiceSetProductsMetaHandler
|
37
38
|
getProducts: HapiServiceFunctionWithLifecycleHooks<BasketServiceGetProductsHandler>
|
@@ -90,6 +90,7 @@ export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
|
|
90
90
|
onAfterOrderCampaignSuccess: (
|
91
91
|
alertKey?: AlertKey,
|
92
92
|
disclaimerTexts?: string[],
|
93
|
+
isSuccessFromEditing?: boolean,
|
93
94
|
) => void
|
94
95
|
validateContractPostingRequirementsWithCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateContractPostingRequirementsWithCampaignHandler>
|
95
96
|
saveCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSaveCampaignHandler>
|
package/campaign/utils.types.ts
CHANGED
@@ -27,6 +27,7 @@ import {
|
|
27
27
|
import {
|
28
28
|
FormFacetsFieldType,
|
29
29
|
PostingRequirement,
|
30
|
+
PostingRequirementLabelsMap,
|
30
31
|
TransformedPostingRequirement,
|
31
32
|
} from "../common"
|
32
33
|
|
@@ -64,6 +65,10 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
|
|
64
65
|
string,
|
65
66
|
CampaignCreateFormOrderedProductSpec
|
66
67
|
>,
|
68
|
+
orderedProductsSpecsLabels?: Record<
|
69
|
+
string,
|
70
|
+
PostingRequirementLabelsMap
|
71
|
+
>,
|
67
72
|
) => CampaignOrderRequestBodyOrderedProductsSpec[]
|
68
73
|
getPostBodyForOrderedProductsSpecsPostingRequirement: (
|
69
74
|
postingRequirement: any,
|
package/common/enums.ts
CHANGED
package/common/types.ts
CHANGED
@@ -131,7 +131,6 @@ export type PostingRequirementType =
|
|
131
131
|
| "TEXTAREA"
|
132
132
|
| "AUTOCOMPLETE"
|
133
133
|
| "STATISCH"
|
134
|
-
| "FILE-URL"
|
135
134
|
| "HTMLAREA"
|
136
135
|
|
137
136
|
export type PostingRequirementRuleName =
|
@@ -151,13 +150,8 @@ export type PostingRequirementRuleName =
|
|
151
150
|
| "before"
|
152
151
|
| "after"
|
153
152
|
| "url"
|
154
|
-
| "fileMimeType"
|
155
|
-
| "fileMimeSubType"
|
156
|
-
| "editorTest"
|
157
|
-
| "libraryTest"
|
158
153
|
| "autocomplete"
|
159
|
-
| "
|
160
|
-
| "staticsubtype"
|
154
|
+
| "mimetype"
|
161
155
|
|
162
156
|
export type PostingRequirementRule = {
|
163
157
|
rule: PostingRequirementRuleName
|
@@ -177,7 +171,7 @@ export type PostingRequirementDisplayRuleShowOperand =
|
|
177
171
|
|
178
172
|
export type PostingRequirementDisplayRuleShow = {
|
179
173
|
facet: string
|
180
|
-
value:
|
174
|
+
value: string | string[]
|
181
175
|
op: PostingRequirementDisplayRuleShowOperand
|
182
176
|
}
|
183
177
|
export type PostingRequirementDisplayRule = {
|
@@ -199,11 +193,6 @@ export type PostingRequirementAutocomplete = {
|
|
199
193
|
required_parameters: string[] | null
|
200
194
|
parameters_source: PostingRequirementParametersSource | null
|
201
195
|
}
|
202
|
-
export type PostingRequirementGroup = {
|
203
|
-
id: string
|
204
|
-
name: string
|
205
|
-
sort: number
|
206
|
-
}
|
207
196
|
export type PostingRequirement = {
|
208
197
|
name: string
|
209
198
|
label: string
|
@@ -228,7 +217,7 @@ export type PostingRequirementOptionRequiresField = {
|
|
228
217
|
}
|
229
218
|
export type PostingRequirementOption = {
|
230
219
|
default?: string
|
231
|
-
key: string
|
220
|
+
key: string | number
|
232
221
|
label: string
|
233
222
|
data?: PostingRequirementOptionData
|
234
223
|
labels?: Record<"default", string>
|
@@ -248,13 +237,12 @@ export type PostingRequirementOptionData = {
|
|
248
237
|
images?: PostingRequirementOptionDataImage[]
|
249
238
|
}
|
250
239
|
export type TransformedPostingRequirementOption = {
|
251
|
-
value?: string
|
240
|
+
value?: string | number
|
252
241
|
data?: PostingRequirementOptionData
|
253
242
|
requires?: PostingRequirementOptionRequiresField[] | null
|
254
243
|
label: string
|
255
244
|
show?: string[]
|
256
245
|
}
|
257
|
-
export type PostingRequirementReactiveDescription = { description: string }
|
258
246
|
export type TransformedPostingRequirement = Omit<
|
259
247
|
PostingRequirement,
|
260
248
|
"options"
|
package/contract/types.ts
CHANGED
@@ -92,6 +92,7 @@ export type ZodContract = ZodObject<{
|
|
92
92
|
product: ZodContractProduct
|
93
93
|
purchase_price: ZodNullable<ZodContractPurchasePrice>
|
94
94
|
group: ZodNullable<ZodContractGroup>
|
95
|
+
errors: ZodOptional<ZodArray<ZodString>>
|
95
96
|
}>
|
96
97
|
export type WindowHapiValidationsContract = {
|
97
98
|
channel: ZodContractChannel
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { RawAxiosRequestConfig } from "axios"
|
2
|
+
import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
|
3
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
4
|
+
|
5
|
+
export type WindowHapiAPIExperimentalConfigs = {
|
6
|
+
getExperimental: RawAxiosRequestConfig
|
7
|
+
}
|
8
|
+
export type WindowHapiAPIExperimentalRequests = {
|
9
|
+
getExperimental: () => Promise<any>
|
10
|
+
}
|
11
|
+
export type WindowHapiAPIExperimental = WindowHapiModuleWithConstructorArgs<
|
12
|
+
WindowHapiAPIModule<
|
13
|
+
WindowHapiAPIExperimentalRequests,
|
14
|
+
WindowHapiAPIExperimentalConfigs
|
15
|
+
>,
|
16
|
+
{ readonly api: WindowHapiAPI }
|
17
|
+
>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import {
|
2
|
+
HapiServiceFunctionWithLifecycleHooks,
|
3
|
+
WindowHapiService,
|
4
|
+
} from "../_window/service.types"
|
5
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
6
|
+
|
7
|
+
export type WindowHapiServiceExperimental = WindowHapiModuleWithConstructorArgs<
|
8
|
+
{
|
9
|
+
getExperimental: HapiServiceFunctionWithLifecycleHooks<
|
10
|
+
() => Promise<any>
|
11
|
+
>
|
12
|
+
},
|
13
|
+
{ readonly service: WindowHapiService }
|
14
|
+
>
|
package/modal/enums.ts
CHANGED
@@ -30,5 +30,6 @@ export enum ModalKeys {
|
|
30
30
|
|
31
31
|
export enum FilePickerModalPropsActionFor {
|
32
32
|
postingOrganization = "posting-organization",
|
33
|
-
|
33
|
+
productPostingRequirements = "product-posting-requirements",
|
34
|
+
contractPostingRequirements = "contract-posting-requirements",
|
34
35
|
}
|
package/modal/types.ts
CHANGED
@@ -78,8 +78,7 @@ export type WalletPurchaseOrderModalProps = {}
|
|
78
78
|
export type FilePickerModalPropsActionDataPostingRequirements = {
|
79
79
|
requirement: TransformedPostingRequirement
|
80
80
|
id: string | number
|
81
|
-
|
82
|
-
mimeTypesSplit?: { mimeType: string; mimeSubType: string }[]
|
81
|
+
mimetype: string[]
|
83
82
|
}
|
84
83
|
export type FilePickerModalPropsActionData =
|
85
84
|
FilePickerModalPropsActionDataPostingRequirements
|
@@ -10,7 +10,9 @@ import { OrderJourneyStepKey } from "./enums"
|
|
10
10
|
|
11
11
|
export type OrderJourneyServiceSwitchToNextStepHandler = () => Promise<void>
|
12
12
|
export type OrderJourneyServiceSwitchToPreviousStepHandler = () => Promise<void>
|
13
|
-
export type OrderJourneyServiceRestartJourneyHandler = (
|
13
|
+
export type OrderJourneyServiceRestartJourneyHandler = (
|
14
|
+
shouldResetStepBackToFirstStep?: boolean,
|
15
|
+
) => void
|
14
16
|
|
15
17
|
export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
|
16
18
|
{
|
package/orderJourney/types.ts
CHANGED
@@ -203,3 +203,13 @@ export type OrderJourneyStepMap = {
|
|
203
203
|
[OrderJourneyStepKey.paymentMethod]: OrderJourneyStep
|
204
204
|
[OrderJourneyStepKey.orderConfirmation]: OrderJourneyStep
|
205
205
|
}
|
206
|
+
export type OrderReviewAccordionKeys = Exclude<
|
207
|
+
OrderJourneyStepKey,
|
208
|
+
| OrderJourneyStepKey.searchRecommendProducts
|
209
|
+
| OrderJourneyStepKey.selectProducts
|
210
|
+
| OrderJourneyStepKey.addContracts
|
211
|
+
| OrderJourneyStepKey.selectContracts
|
212
|
+
| OrderJourneyStepKey.orderReview
|
213
|
+
| OrderJourneyStepKey.orderConfirmation
|
214
|
+
| OrderJourneyStepKey.paymentMethod
|
215
|
+
>
|
package/package.json
CHANGED