@vonq/hapi-elements-types 1.18.0 → 1.20.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/events.types.ts +15 -2
- package/_window/qa.types.ts +3 -1
- package/_window/routing.types.ts +1 -0
- package/_window/sdk.types.ts +3 -1
- package/_window/service.types.ts +5 -0
- package/_window/state.types.ts +4 -1
- package/_window/utils.types.ts +13 -0
- package/alert/enums.ts +2 -0
- package/ats/state.types.ts +1 -0
- package/basket/state.types.ts +3 -1
- package/basket/utils.types.ts +3 -0
- package/basket/validations.types.ts +7 -0
- package/campaign/api.types.ts +22 -1
- package/campaign/service.types.ts +44 -3
- package/campaign/state.types.ts +2 -1
- package/campaign/types.ts +89 -20
- package/campaign/utils.types.ts +21 -0
- package/campaign/validations.types.ts +8 -1
- package/common/events/EventCommand/enums.ts +1 -0
- package/common/events/types.ts +1 -0
- package/common/types.ts +122 -0
- package/contract/service.types.ts +5 -7
- package/contract/types.ts +2 -83
- package/contract/validations.types.ts +7 -1
- package/debugging/index.ts +1 -0
- package/debugging/service.types.ts +16 -0
- package/debugging/state.types.ts +4 -0
- package/debugging/types.ts +17 -0
- package/modal/enums.ts +2 -0
- package/modal/types.ts +28 -4
- package/orderJourney/enums.ts +1 -0
- package/orderJourney/service.types.ts +27 -1
- package/orderJourney/state.types.ts +17 -3
- package/orderJourney/types.ts +42 -0
- package/orderJourney/validations.types.ts +7 -0
- package/package.json +1 -1
- package/product/api.types.ts +15 -1
- package/product/enums.ts +9 -0
- package/product/service.types.ts +25 -2
- package/product/state.types.ts +4 -1
- package/product/types.ts +22 -16
- package/product/utils.types.ts +2 -1
- package/product/validations.types.ts +3 -2
- package/routing/utils.types.ts +14 -0
- package/theming/types.ts +1 -0
- package/wallet/service.types.ts +1 -0
- package/wallet/types.ts +1 -0
package/_window/events.types.ts
CHANGED
@@ -106,6 +106,12 @@ export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
|
|
106
106
|
readonly eventApiStrategy?: WindowHapiEventStrategy
|
107
107
|
readonly eventServiceStrategy?: WindowHapiEventStrategy
|
108
108
|
readonly eventQAStrategy?: WindowHapiEventStrategy
|
109
|
+
readonly onReceive?: (
|
110
|
+
eventCommand: WindowHapiEventCommand | undefined,
|
111
|
+
) => void
|
112
|
+
readonly onDispatch?: (
|
113
|
+
eventCommand: WindowHapiEventCommand | undefined,
|
114
|
+
) => void
|
109
115
|
}
|
110
116
|
>
|
111
117
|
|
@@ -127,7 +133,12 @@ export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
|
|
127
133
|
name: string,
|
128
134
|
) => (WindowHapiEventCommand | WindowHapiEventListener)[]
|
129
135
|
},
|
130
|
-
{
|
136
|
+
{
|
137
|
+
readonly getInstances: WindowHapiEventMediatorGetInstancesHandler
|
138
|
+
readonly onAdd?: (
|
139
|
+
eventCommand: WindowHapiEventCommand | WindowHapiEventListener,
|
140
|
+
) => void
|
141
|
+
}
|
131
142
|
>
|
132
143
|
|
133
144
|
export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
@@ -141,7 +152,9 @@ export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
|
141
152
|
eventRoutingStrategy: WindowHapiEventStrategy
|
142
153
|
eventAppStrategy: WindowHapiEventStrategy
|
143
154
|
eventApiStrategy: WindowHapiEventStrategy
|
144
|
-
eventStateStrategy: WindowHapiEventStrategy
|
155
|
+
eventStateStrategy: WindowHapiEventStrategy & {
|
156
|
+
onHydrateState: (event: WindowHapiEventCommand) => void
|
157
|
+
}
|
145
158
|
eventServiceStrategy: WindowHapiEventStrategy
|
146
159
|
eventQAStrategy: WindowHapiEventStrategy
|
147
160
|
eventDOMStrategy: WindowHapiEventStrategy
|
package/_window/qa.types.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { WindowHapiModuleName } from "../common/enums"
|
2
2
|
import {
|
3
|
-
WindowHapiModuleWithConstructorArgs,
|
4
3
|
WindowHapiClassInterface,
|
4
|
+
WindowHapiModuleWithConstructorArgs,
|
5
5
|
} from "./window"
|
6
6
|
import { WindowHapiQACampaign } from "../campaign/qa.types"
|
7
7
|
import { WindowHapiQACommon } from "../common/qa.types"
|
@@ -22,7 +22,9 @@ export type WindowHapiQA = WindowHapiModuleWithConstructorArgs<
|
|
22
22
|
[WindowHapiModuleName.common]: WindowHapiQACommon
|
23
23
|
|
24
24
|
isDebugPanelOpen: boolean
|
25
|
+
|
25
26
|
getDebugPanelButtonEl: () => HTMLElement | null
|
27
|
+
onClickDebugPanel: () => void
|
26
28
|
addDebugPanelToDOM: () => void
|
27
29
|
setDebugPanelPosition: (buttonEl: HTMLElement | null) => void
|
28
30
|
},
|
package/_window/routing.types.ts
CHANGED
@@ -18,6 +18,7 @@ export type WindowHapiRouting = WindowHapiModuleWithConstructorArgs<
|
|
18
18
|
setOrigin: (origin: string) => void
|
19
19
|
setQueryParams: (params: WindowHapiRoutingQueryParams) => void
|
20
20
|
onRouteChange: () => void
|
21
|
+
onAfterSetQueryParams: () => void
|
21
22
|
},
|
22
23
|
{ readonly core: WindowHapiClassInterface }
|
23
24
|
>
|
package/_window/sdk.types.ts
CHANGED
@@ -42,6 +42,8 @@ import {
|
|
42
42
|
import { WindowHapiServiceUI } from "../ui/service.types"
|
43
43
|
import { ATSState, WindowHapiAPIATS, WindowHapiServiceATS } from "../ats"
|
44
44
|
import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
|
45
|
+
import { WindowHapiQA } from "./qa.types"
|
46
|
+
import { WindowHapiServiceDebugging } from "../debugging/service.types"
|
45
47
|
|
46
48
|
export type WindowHapiSDKModule<
|
47
49
|
APIModule,
|
@@ -86,7 +88,7 @@ export type WindowHapiSDKContract = WindowHapiSDKModule<
|
|
86
88
|
>
|
87
89
|
export type WindowHapiSDKDebugging = WindowHapiSDKModule<
|
88
90
|
undefined,
|
89
|
-
|
91
|
+
WindowHapiServiceDebugging,
|
90
92
|
undefined,
|
91
93
|
WindowHapiStateModule<DebuggingState>
|
92
94
|
>
|
package/_window/service.types.ts
CHANGED
@@ -18,6 +18,7 @@ import { WindowHapiServiceTalentMindCompany } from "../talentMindCompany/service
|
|
18
18
|
import { WindowHapiServiceTalentMindJob } from "../talentMindJob/service.types"
|
19
19
|
import { WindowHapiServiceTalentMindResume } from "../talentMindResume/service.types"
|
20
20
|
import { WindowHapiServiceTalentMindEvaluation } from "../talentMindEvaluation/service.types"
|
21
|
+
import { WindowHapiServiceDebugging } from "../debugging/service.types"
|
21
22
|
|
22
23
|
export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
|
23
24
|
| void
|
@@ -45,6 +46,8 @@ export type HapiServiceBase = {
|
|
45
46
|
}
|
46
47
|
export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
47
48
|
{
|
49
|
+
propertiesThatShouldNotBeDocumented: string[]
|
50
|
+
mergePropertiesThatShouldNotBeDocumented: (klass: any) => void
|
48
51
|
[WindowHapiModuleName.alert]: WindowHapiServiceAlert
|
49
52
|
[WindowHapiModuleName.basket]: WindowHapiServiceBasket
|
50
53
|
[WindowHapiModuleName.campaign]: WindowHapiServiceCampaign
|
@@ -55,6 +58,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
55
58
|
[WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
|
56
59
|
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
57
60
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
61
|
+
[WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
|
58
62
|
[WindowHapiModuleName.talentMindCompany]: WindowHapiServiceTalentMindCompany
|
59
63
|
[WindowHapiModuleName.talentMindJob]: WindowHapiServiceTalentMindJob
|
60
64
|
[WindowHapiModuleName.talentMindResume]: WindowHapiServiceTalentMindResume
|
@@ -70,6 +74,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
70
74
|
[WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
|
71
75
|
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
72
76
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
77
|
+
[WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
|
73
78
|
[WindowHapiModuleName.talentMindCompany]: WindowHapiServiceTalentMindCompany
|
74
79
|
[WindowHapiModuleName.talentMindJob]: WindowHapiServiceTalentMindJob
|
75
80
|
[WindowHapiModuleName.talentMindResume]: WindowHapiServiceTalentMindResume
|
package/_window/state.types.ts
CHANGED
@@ -55,7 +55,10 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
|
|
55
55
|
[WindowHapiModuleName.talentMindEvaluation]: WindowHapiStateModule<TalentMindEvaluationState>
|
56
56
|
basePropertiesThatShouldNotBeDocumented: string[]
|
57
57
|
handleDefaultStateFromQueryParams: (params: string | string[]) => void
|
58
|
-
rehydrateInitialState: (
|
58
|
+
rehydrateInitialState: (
|
59
|
+
initialState: Record<string, any>,
|
60
|
+
getStateModuleName: (storeName: string) => string,
|
61
|
+
) => void
|
59
62
|
onBeforeStateChange: () => void
|
60
63
|
onAfterStateChange: () => void
|
61
64
|
stores: {
|
package/_window/utils.types.ts
CHANGED
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
WindowHapiModuleWithConstructorArgs,
|
10
10
|
} from "./window"
|
11
11
|
import { WindowHapiUtilsModal } from "../modal/utils.types"
|
12
|
+
import { WindowHapiUtilsRouter } from "../routing/utils.types"
|
12
13
|
|
13
14
|
export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
14
15
|
{
|
@@ -22,6 +23,16 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
|
22
23
|
parentLabel?: any,
|
23
24
|
canSelectParentCategoriesThatHasOptions?: boolean,
|
24
25
|
) => { label: string; value: any }[]
|
26
|
+
pushAfter: (
|
27
|
+
array: any[],
|
28
|
+
findPredicate: (item: any, index: number) => boolean,
|
29
|
+
itemsToPush: any[],
|
30
|
+
) => any[]
|
31
|
+
pushBefore: (
|
32
|
+
array: any[],
|
33
|
+
findPredicate: (item: any, index: number) => boolean,
|
34
|
+
itemsToPush: any[],
|
35
|
+
) => any[]
|
25
36
|
getComponentNameIndexSuffix: (instanceName: string) => string
|
26
37
|
getIframeLoadingSpinner: () => HTMLDivElement
|
27
38
|
product: WindowHapiUtilsProduct
|
@@ -30,6 +41,7 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
|
30
41
|
basket: WindowHapiUtilsBasket
|
31
42
|
orderJourney: WindowHapiUtilsOrderJourney
|
32
43
|
modal: WindowHapiUtilsModal
|
44
|
+
router: WindowHapiUtilsRouter
|
33
45
|
|
34
46
|
utilities: {
|
35
47
|
[WindowHapiModuleName.basket]: WindowHapiUtilsBasket
|
@@ -38,6 +50,7 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
|
38
50
|
[WindowHapiModuleName.product]: WindowHapiUtilsProduct
|
39
51
|
[WindowHapiModuleName.orderJourney]: WindowHapiUtilsOrderJourney
|
40
52
|
[WindowHapiModuleName.modal]: WindowHapiUtilsModal
|
53
|
+
[WindowHapiModuleName.router]: WindowHapiUtilsRouter
|
41
54
|
}
|
42
55
|
},
|
43
56
|
{ readonly core: WindowHapiClassInterface }
|
package/alert/enums.ts
CHANGED
@@ -5,9 +5,11 @@ export enum AlertKey {
|
|
5
5
|
contractCreateSuccess = "contract-created",
|
6
6
|
contractGroupCreateSuccess = "contract-group-created",
|
7
7
|
campaignTakeOfflineSuccess = "campaign-take-offline-success",
|
8
|
+
campaignProductTakeOfflineSuccess = "campaign-product-take-offline-success",
|
8
9
|
"campaignCopyProductsContractsDeletedWarning" = "campaign-copy-contract-warning",
|
9
10
|
campaignOrderSuccess = "campaign-order-success",
|
10
11
|
campaignCopySuccess = "campaign-copy-success",
|
12
|
+
campaignSaveSuccess = "campaign-save-success",
|
11
13
|
buttonCopySuccess = "copy-button-success",
|
12
14
|
productAddToBasket = "add-product-to-basket-success",
|
13
15
|
productRemoveFromBasket = "remove-product-from-basket-warning",
|
package/ats/state.types.ts
CHANGED
package/basket/state.types.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Product } from "../product/types"
|
1
|
+
import { Product, ProductOrderDeliveryTime } from "../product/types"
|
2
2
|
import { BasketProduct } from "./types"
|
3
3
|
import { Contract } from "../contract/types"
|
4
4
|
|
@@ -12,4 +12,6 @@ export type BasketState = {
|
|
12
12
|
totalInWalletCurrency: number
|
13
13
|
totalExceedsMaxPurchaseOrder: boolean
|
14
14
|
productsAreLoading: boolean
|
15
|
+
deliveryAndProcessingTimes: ProductOrderDeliveryTime | null
|
16
|
+
deliveryAndProcessingTimesAreLoading: boolean
|
15
17
|
}
|
package/basket/utils.types.ts
CHANGED
@@ -43,6 +43,9 @@ export type WindowHapiUtilsBasket = WindowHapiModuleWithConstructorArgs<
|
|
43
43
|
products: (Product | Contract)[],
|
44
44
|
currency: ProductPriceCurrency,
|
45
45
|
) => number
|
46
|
+
prepareCampaignFormOrderedProducts: (
|
47
|
+
productOrContractIds: (Product | Contract)[],
|
48
|
+
) => void
|
46
49
|
},
|
47
50
|
{ readonly utils: WindowHapiUtils }
|
48
51
|
>
|
@@ -18,8 +18,15 @@ export type ZodBasketProductMeta = ZodObject<{
|
|
18
18
|
}>
|
19
19
|
export type ZodBasketProductsMeta = ZodArray<ZodBasketProductMeta>
|
20
20
|
|
21
|
+
export type ZodBasketDeliveryAndProcessingTimes = ZodObject<{
|
22
|
+
days_to_process: ZodNumber
|
23
|
+
days_to_setup: ZodNumber
|
24
|
+
total_days: ZodNumber
|
25
|
+
}>
|
26
|
+
|
21
27
|
export type WindowHapiValidationsBasket = {
|
22
28
|
contractsOrProducts: ZodContractsOrProducts
|
23
29
|
productMeta: ZodBasketProductMeta
|
24
30
|
productsMeta: ZodBasketProductsMeta
|
31
|
+
deliveryAndProcessingTimes: ZodBasketDeliveryAndProcessingTimes
|
25
32
|
}
|
package/campaign/api.types.ts
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
import { AxiosRequestConfig } from "axios"
|
2
2
|
import {
|
3
3
|
Campaign,
|
4
|
+
CampaignEditRequestBody,
|
5
|
+
CampaignIdResponse,
|
4
6
|
CampaignOrderRequestBody,
|
7
|
+
CampaignPostingRequirementsValidateRequestBody,
|
8
|
+
CampaignSetProductStatusRequestBody,
|
5
9
|
TaxonomyEducationAndSeniorityLevel,
|
6
10
|
} from "./types"
|
7
11
|
import { ProductSupportingContractsComplete } from "../product/types"
|
@@ -17,13 +21,21 @@ export type WindowHapiAPICampaignConfigs = {
|
|
17
21
|
getEducationLevels: AxiosRequestConfig
|
18
22
|
getSeniorities: AxiosRequestConfig
|
19
23
|
orderCampaign: AxiosRequestConfig
|
24
|
+
validateCampaign: AxiosRequestConfig
|
25
|
+
validateCampaignPostingRequirements: AxiosRequestConfig
|
26
|
+
saveCampaign: AxiosRequestConfig
|
27
|
+
setProductStatus: AxiosRequestConfig
|
20
28
|
}
|
21
29
|
export type WindowHapiAPICampaignRequests = {
|
22
30
|
getCampaigns: (
|
23
31
|
offset?: number,
|
24
32
|
limit?: number,
|
33
|
+
labels?: Record<string, string> | null,
|
25
34
|
) => Promise<PaginatedAPIResponseV2<Campaign>>
|
26
|
-
getCampaign: (
|
35
|
+
getCampaign: (
|
36
|
+
campaignId: string,
|
37
|
+
queryParams?: Record<string, any>,
|
38
|
+
) => Promise<Campaign>
|
27
39
|
getCampaignDetail: (
|
28
40
|
campaignId: string,
|
29
41
|
detail: "status",
|
@@ -35,6 +47,15 @@ export type WindowHapiAPICampaignRequests = {
|
|
35
47
|
getEducationLevels: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
|
36
48
|
getSeniorities: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
|
37
49
|
orderCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
|
50
|
+
saveCampaign: (postBody: CampaignEditRequestBody) => Promise<Campaign>
|
51
|
+
validateCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
|
52
|
+
validateCampaignPostingRequirements: (
|
53
|
+
campaign: CampaignPostingRequirementsValidateRequestBody,
|
54
|
+
) => Promise<Campaign>
|
55
|
+
setProductStatus: (
|
56
|
+
campaignId: string,
|
57
|
+
requestBody: CampaignSetProductStatusRequestBody,
|
58
|
+
) => Promise<CampaignIdResponse>
|
38
59
|
}
|
39
60
|
export type WindowHapiAPICampaign = WindowHapiModuleWithConstructorArgs<
|
40
61
|
WindowHapiAPIModule<
|
@@ -3,13 +3,23 @@ import {
|
|
3
3
|
WindowHapiService,
|
4
4
|
} from "../_window/service.types"
|
5
5
|
import { ProductSupportingContractsComplete } from "../product/types"
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
Campaign,
|
8
|
+
CampaignCreateForm,
|
9
|
+
CampaignEditForm,
|
10
|
+
CampaignIdResponse,
|
11
|
+
CampaignOrderRequestBody,
|
12
|
+
CampaignSetProductStatusRequestBody,
|
13
|
+
TaxonomyEducationAndSeniorityLevel,
|
14
|
+
} from "./types"
|
7
15
|
import { PaginatedAPIResponseV2 } from "../common/types"
|
8
16
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
17
|
+
import { AlertKey } from "../alert"
|
9
18
|
|
10
19
|
export type CampaignServiceGetCampaignsHandler = (
|
11
20
|
offset?: number,
|
12
21
|
limit?: number,
|
22
|
+
labels?: Record<string, string> | null,
|
13
23
|
) => Promise<PaginatedAPIResponseV2<Campaign>>
|
14
24
|
export type CampaignServiceGetCampaignDetailHandler = (
|
15
25
|
campaignId: string,
|
@@ -17,6 +27,7 @@ export type CampaignServiceGetCampaignDetailHandler = (
|
|
17
27
|
) => Promise<ProductSupportingContractsComplete>
|
18
28
|
export type CampaignServiceGetCampaignHandler = (
|
19
29
|
campaignId: string,
|
30
|
+
queryParams?: Record<string, any>,
|
20
31
|
) => Promise<ProductSupportingContractsComplete>
|
21
32
|
export type CampaignServiceSetCampaignCancellationHandler = (
|
22
33
|
campaignId: string,
|
@@ -33,7 +44,27 @@ export type CampaignServiceCopyCampaignHandler = (
|
|
33
44
|
campaign: Campaign,
|
34
45
|
withExistingProducts: boolean,
|
35
46
|
) => Promise<Campaign>
|
36
|
-
|
47
|
+
export type CampaignServiceEditCampaignHandler = (
|
48
|
+
campaign: Campaign,
|
49
|
+
) => Promise<Campaign>
|
50
|
+
export type CampaignServiceSaveCampaignHandler = (
|
51
|
+
campaign: CampaignEditForm,
|
52
|
+
) => Promise<Campaign>
|
53
|
+
export type CampaignServiceValidateContractPostingRequirementsWithCampaignHandler =
|
54
|
+
(contractId: string, requestBody: CampaignOrderRequestBody) => Promise<any>
|
55
|
+
export type CampaignServiceValidateCampaignHandler = (
|
56
|
+
requestBody: CampaignOrderRequestBody,
|
57
|
+
) => Promise<any>
|
58
|
+
export type CampaignServiceGetCopyCampaignRequestBodyHandler = (
|
59
|
+
campaign: Campaign,
|
60
|
+
) => CampaignCreateForm
|
61
|
+
export type CampaignServiceGetEditCampaignRequestBodyHandler = (
|
62
|
+
campaign: Campaign,
|
63
|
+
) => CampaignCreateForm
|
64
|
+
export type CampaignServiceSetProductStatusHandler = (
|
65
|
+
campaignId: string,
|
66
|
+
requestBody: CampaignSetProductStatusRequestBody,
|
67
|
+
) => Promise<CampaignIdResponse>
|
37
68
|
export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
|
38
69
|
{
|
39
70
|
getCampaigns: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignsHandler>
|
@@ -44,7 +75,17 @@ export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
|
|
44
75
|
getSeniorities: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetSenioritiesHandler>
|
45
76
|
orderCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceOrderCampaignHandler>
|
46
77
|
copyCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceCopyCampaignHandler>
|
47
|
-
|
78
|
+
editCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceEditCampaignHandler>
|
79
|
+
onAfterOrderCampaignSuccess: (
|
80
|
+
alertKey?: AlertKey,
|
81
|
+
disclaimerTexts?: string[],
|
82
|
+
) => void
|
83
|
+
validateContractPostingRequirementsWithCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateContractPostingRequirementsWithCampaignHandler>
|
84
|
+
saveCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSaveCampaignHandler>
|
85
|
+
validateCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateCampaignHandler>
|
86
|
+
getCopyCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCopyCampaignRequestBodyHandler>
|
87
|
+
getEditCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetEditCampaignRequestBodyHandler>
|
88
|
+
setProductStatus: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSetProductStatusHandler>
|
48
89
|
},
|
49
90
|
{ readonly service: WindowHapiService }
|
50
91
|
>
|
package/campaign/state.types.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
Campaign,
|
3
3
|
CampaignCreateForm,
|
4
|
+
CampaignEditForm,
|
4
5
|
TaxonomyEducationAndSeniorityLevel,
|
5
6
|
TaxonomyEmploymentTypes,
|
6
7
|
TaxonomySeniority,
|
@@ -12,7 +13,7 @@ export type CampaignState = {
|
|
12
13
|
campaigns: Campaign[]
|
13
14
|
campaignsPaginationMeta: PaginationResponseV2
|
14
15
|
campaignsAreLoading: boolean
|
15
|
-
campaignForm: CampaignCreateForm
|
16
|
+
campaignForm: CampaignCreateForm | CampaignEditForm
|
16
17
|
campaignIsCreating: boolean
|
17
18
|
/* Education Levels */
|
18
19
|
educationLevels: TaxonomyEducationAndSeniorityLevel[]
|
package/campaign/types.ts
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
import { ProductDuration, ProductIndustry } from "../product/types"
|
2
|
-
import {
|
3
|
-
ContractPostingRequirement,
|
4
|
-
ContractPostingRequirementOptionRequiresField,
|
5
|
-
} from "../contract/types"
|
6
2
|
import { ProductPriceCurrency } from "../product/enums"
|
7
3
|
import { EmploymentType, SalaryPeriod } from "./enums"
|
8
4
|
import { OrderJourneyPaymentMethod } from "../orderJourney"
|
5
|
+
import { PostingRequirement, PostingRequirementLabelsMap } from "../common"
|
9
6
|
|
10
7
|
export type CampaignProductSpecs = {
|
11
8
|
contractId: string | null
|
@@ -14,6 +11,7 @@ export type CampaignProductSpecs = {
|
|
14
11
|
durationPeriod: ProductDuration
|
15
12
|
jobBoardLink: string | null
|
16
13
|
postingRequirements: Record<string, any> | null
|
14
|
+
postingRequirementsLabels?: PostingRequirementLabelsMap
|
17
15
|
productId: string
|
18
16
|
status: CampaignStatus
|
19
17
|
utm: string | null
|
@@ -132,9 +130,15 @@ export type CampaignDetailedStatus = {
|
|
132
130
|
orderedProductsStatuses: CampaignDetailsStatusOrderedProductStatus[]
|
133
131
|
}
|
134
132
|
|
135
|
-
export type
|
136
|
-
currency: ProductPriceCurrency
|
133
|
+
export type CampaignDraft = {
|
137
134
|
campaignId: string
|
135
|
+
isDraft: boolean
|
136
|
+
paymentStatus: "processing_payment"
|
137
|
+
}
|
138
|
+
|
139
|
+
export type Campaign = Pick<CampaignDraft, "campaignId"> & {
|
140
|
+
labels: Record<string, string> | null
|
141
|
+
currency: ProductPriceCurrency
|
138
142
|
campaignName: string | null
|
139
143
|
companyId: string
|
140
144
|
createdOn: string
|
@@ -152,6 +156,7 @@ export type Campaign = {
|
|
152
156
|
totalPrice: CampaignTotalPrice
|
153
157
|
walletId: string
|
154
158
|
detailedStatus?: CampaignDetailedStatus //this is only added virtually on FE on demand
|
159
|
+
isEditable: boolean
|
155
160
|
}
|
156
161
|
|
157
162
|
export type CampaignCreateFormTargetGroupEducationLevel =
|
@@ -177,7 +182,9 @@ export type CampaignCreateFormOrderedProductSpecBase = {
|
|
177
182
|
productId: string
|
178
183
|
utm: string
|
179
184
|
contractId: string
|
180
|
-
postingRequirements:
|
185
|
+
postingRequirements: PostingRequirement[]
|
186
|
+
postingRequirementsLabels?: PostingRequirementLabelsMap
|
187
|
+
postingDurationDays: number | null
|
181
188
|
}
|
182
189
|
export type CampaignCreateFormOrderedProductSpec =
|
183
190
|
CampaignCreateFormOrderedProductSpecBase & { [k: string]: any }
|
@@ -197,38 +204,95 @@ export type CampaignCreateFormPostingDetails = {
|
|
197
204
|
}
|
198
205
|
|
199
206
|
export type CampaignCreateForm = {
|
207
|
+
labels: Record<string, string> | null
|
200
208
|
companyId: string
|
201
209
|
currency: ProductPriceCurrency | null
|
202
210
|
campaignName?: string | null
|
203
211
|
poNumber: string | null
|
204
|
-
orderReference?: string
|
212
|
+
orderReference?: string | null
|
205
213
|
paymentMethod: OrderJourneyPaymentMethod | null
|
206
214
|
targetGroup: CampaignCreateFormTargetGroup
|
207
215
|
recruiterInfo: CampaignRecruiterInfo
|
208
216
|
postingDetails: CampaignCreateFormPostingDetails
|
209
217
|
orderedProducts: string[] //Array of UUIDs
|
210
218
|
orderedProductsSpecs: Record<string, CampaignCreateFormOrderedProductSpec>
|
219
|
+
orderedProductsSpecsLabels?: Record<string, PostingRequirementLabelsMap>
|
220
|
+
}
|
221
|
+
|
222
|
+
export type CampaignEditForm = Omit<
|
223
|
+
CampaignCreateForm,
|
224
|
+
| "companyId"
|
225
|
+
| "currency"
|
226
|
+
| "poNumber"
|
227
|
+
| "orderReference"
|
228
|
+
| "paymentMethod"
|
229
|
+
| "postingDetails"
|
230
|
+
| "orderedProductsSpecs"
|
231
|
+
| "orderedProductsSpecsLabels"
|
232
|
+
> & {
|
233
|
+
campaignId: string
|
234
|
+
postingDetails: Omit<
|
235
|
+
CampaignCreateFormPostingDetails,
|
236
|
+
"applicationUrl" | "jobPageUrl"
|
237
|
+
>
|
238
|
+
orderedProductsSpecs: Record<
|
239
|
+
string,
|
240
|
+
Omit<CampaignCreateFormOrderedProductSpec, "postingDurationDays">
|
241
|
+
>
|
242
|
+
orderedProductsSpecsLabels: Record<string, PostingRequirementLabelsMap>
|
211
243
|
}
|
212
244
|
|
213
245
|
export type CampaignOrderRequestBodyOrderedProductsSpec = {
|
214
246
|
contractId?: string
|
215
247
|
utm: string
|
216
248
|
productId?: string
|
217
|
-
postingRequirements?: any
|
249
|
+
postingRequirements?: Record<string, any>
|
250
|
+
postingRequirementsLabels?: PostingRequirementLabelsMap
|
251
|
+
postingDurationDays: number | null
|
218
252
|
}
|
219
253
|
|
220
254
|
export type CampaignOrderRequestBody = {
|
255
|
+
labels: Record<string, string> | null
|
221
256
|
companyId: string
|
222
257
|
campaignName: string | null | undefined
|
223
258
|
walletId?: string
|
224
259
|
poNumber?: string | null
|
225
|
-
orderReference?: string
|
260
|
+
orderReference?: string | null
|
226
261
|
recruiterInfo: Omit<CampaignRecruiterInfo, "id">
|
227
262
|
paymentMethod: OrderJourneyPaymentMethod | null
|
228
263
|
postingDetails: CampaignPostingDetails
|
229
264
|
targetGroup: CampaignTargetGroup
|
230
265
|
orderedProducts: string[]
|
231
266
|
orderedProductsSpecs: CampaignOrderRequestBodyOrderedProductsSpec[]
|
267
|
+
currency?: ProductPriceCurrency
|
268
|
+
}
|
269
|
+
|
270
|
+
export type CampaignEditRequestBody = Omit<
|
271
|
+
CampaignOrderRequestBody,
|
272
|
+
| "walletId"
|
273
|
+
| "poNumber"
|
274
|
+
| "orderReference"
|
275
|
+
| "companyId"
|
276
|
+
| "postingDetails"
|
277
|
+
| "orderedProductsSpecs"
|
278
|
+
| "paymentMethod"
|
279
|
+
> & {
|
280
|
+
campaignId: string
|
281
|
+
postingDetails: Omit<
|
282
|
+
CampaignPostingDetails,
|
283
|
+
"applicationUrl" | "jobPageUrl"
|
284
|
+
>
|
285
|
+
orderedProductsSpecs: Omit<
|
286
|
+
CampaignOrderRequestBodyOrderedProductsSpec,
|
287
|
+
"utm" | "productId" | "contractId" | "postingDurationDays"
|
288
|
+
>[]
|
289
|
+
}
|
290
|
+
|
291
|
+
export type CampaignPostingRequirementsValidateRequestBody = {
|
292
|
+
contract_id: string
|
293
|
+
product_id: string
|
294
|
+
posting_requirements: { name: string; value: any }[]
|
295
|
+
vacancy: { name: string; value: any }[]
|
232
296
|
}
|
233
297
|
|
234
298
|
export type CampaignTaxonomyNameWithLanguage = {
|
@@ -254,15 +318,20 @@ export type TaxonomyEmploymentTypes = {
|
|
254
318
|
value: EmploymentType
|
255
319
|
label: string
|
256
320
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
321
|
+
|
322
|
+
export type CampaignPostingRequirementsValidateResponse = {
|
323
|
+
has_errors: boolean
|
324
|
+
errors: {
|
325
|
+
credentials: Record<string, any>
|
326
|
+
posting_requirements: Record<string, any>
|
327
|
+
}
|
262
328
|
}
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
329
|
+
|
330
|
+
export type CampaignSetProductStatusRequestBody = {
|
331
|
+
productId: string
|
332
|
+
status: "offline"
|
333
|
+
}
|
334
|
+
|
335
|
+
export type CampaignIdResponse = {
|
336
|
+
campaignId: string
|
268
337
|
}
|
package/campaign/utils.types.ts
CHANGED
@@ -7,8 +7,11 @@ import {
|
|
7
7
|
CampaignCreateFormTargetGroupIndustry,
|
8
8
|
CampaignCreateFormTargetGroupJobCategory,
|
9
9
|
CampaignCreateFormTargetGroupSeniority,
|
10
|
+
CampaignEditForm,
|
11
|
+
CampaignEditRequestBody,
|
10
12
|
CampaignOrderRequestBody,
|
11
13
|
CampaignOrderRequestBodyOrderedProductsSpec,
|
14
|
+
CampaignPostingRequirementsValidateResponse,
|
12
15
|
CampaignTargetGroup,
|
13
16
|
CampaignTargetGroupData,
|
14
17
|
} from "./types"
|
@@ -16,6 +19,10 @@ import { Product } from "../product/types"
|
|
16
19
|
import { Contract } from "../contract/types"
|
17
20
|
import { WindowHapiUtils } from "../_window/utils.types"
|
18
21
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
22
|
+
import {
|
23
|
+
OrderJourneyOrderErrors,
|
24
|
+
OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid,
|
25
|
+
} from "../orderJourney"
|
19
26
|
|
20
27
|
export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
|
21
28
|
{
|
@@ -25,7 +32,11 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
|
|
25
32
|
campaign: Partial<Campaign>,
|
26
33
|
) => void
|
27
34
|
getOrderCampaignRequestBody: () => CampaignOrderRequestBody
|
35
|
+
getEditCampaignRequestBody: (
|
36
|
+
campaignForm: CampaignEditForm,
|
37
|
+
) => CampaignEditRequestBody
|
28
38
|
getCopyCampaignRequestBody: (campaign: Campaign) => CampaignCreateForm
|
39
|
+
getCampaignEditForm: (campaign: Campaign) => CampaignEditForm
|
29
40
|
getPostBodyValuesForTargetGroupProperty: (
|
30
41
|
selectValue:
|
31
42
|
| CampaignCreateFormTargetGroupEducationLevel[]
|
@@ -51,6 +62,16 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
|
|
51
62
|
getPostBodyForOrderedProductsSpecsPostingRequirement: (
|
52
63
|
postingRequirement: any,
|
53
64
|
) => any
|
65
|
+
transformValidatePostingRequirementsWithCampaignErrorsToOrderErrors: (
|
66
|
+
response: CampaignPostingRequirementsValidateResponse,
|
67
|
+
requestBody: CampaignOrderRequestBody,
|
68
|
+
indexOfProductOrContract: number,
|
69
|
+
) => OrderJourneyOrderErrors
|
70
|
+
getMergedOrderErrorsWithPostingRequirementsValidation: (
|
71
|
+
existingErrors: OrderJourneyOrderErrors | null,
|
72
|
+
newErrors: OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid,
|
73
|
+
indexOfNewPostingRequirements: number,
|
74
|
+
) => OrderJourneyOrderErrors
|
54
75
|
},
|
55
76
|
{ readonly utils: WindowHapiUtils }
|
56
77
|
>
|
@@ -149,7 +149,14 @@ export type ZodCampaign = ZodObject<{
|
|
149
149
|
walletId: ZodOptional<ZodNullable<ZodString>>
|
150
150
|
poNumber: ZodOptional<ZodNullable<ZodString>>
|
151
151
|
}>
|
152
|
-
|
152
|
+
|
153
|
+
export type ZodCampaignDraft = ZodObject<{
|
154
|
+
campaignId: ZodString
|
155
|
+
isDraft: ZodBoolean
|
156
|
+
paymentStatus: ZodString
|
157
|
+
}>
|
158
|
+
|
159
|
+
export type ZodCampaigns = ZodArray<ZodUnion<[ZodCampaign, ZodCampaignDraft]>>
|
153
160
|
export type ZodCampaignCreateFormPostingDetails = ZodObject<{
|
154
161
|
title: ZodString
|
155
162
|
description: ZodString
|
@@ -36,6 +36,7 @@ export enum WindowHapiEventCommandName {
|
|
36
36
|
domHideElement = "dom:hide-element",
|
37
37
|
domShowElement = "dom:show-element",
|
38
38
|
domSetStyleAttribute = "dom:set-style-attribute",
|
39
|
+
domSetAttribute = "dom:set-attribute",
|
39
40
|
domAddClass = "dom:add-class",
|
40
41
|
domRemoveClass = "dom:remove-class",
|
41
42
|
domSlotAvailable = "dom:slot-available",
|
package/common/events/types.ts
CHANGED
@@ -37,6 +37,7 @@ export type WindowHapiEventCommand = {
|
|
37
37
|
export type WindowHapiEventCommandCallbackHandler = (
|
38
38
|
data: any,
|
39
39
|
event: WindowHapiEventCommand | WindowHapiEventListener,
|
40
|
+
previousData?: any,
|
40
41
|
) => void
|
41
42
|
export type WindowHapiEventCommandCommitHandler = (
|
42
43
|
...args: any[]
|