@vonq/hapi-elements-types 1.18.0 → 1.19.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.
@@ -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
  >
@@ -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
@@ -8,6 +8,7 @@ export enum AlertKey {
8
8
  "campaignCopyProductsContractsDeletedWarning" = "campaign-copy-contract-warning",
9
9
  campaignOrderSuccess = "campaign-order-success",
10
10
  campaignCopySuccess = "campaign-copy-success",
11
+ campaignSaveSuccess = "campaign-save-success",
11
12
  buttonCopySuccess = "copy-button-success",
12
13
  productAddToBasket = "add-product-to-basket-success",
13
14
  productRemoveFromBasket = "remove-product-from-basket-warning",
@@ -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
  }
@@ -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
  }
@@ -1,7 +1,9 @@
1
1
  import { AxiosRequestConfig } from "axios"
2
2
  import {
3
3
  Campaign,
4
+ CampaignEditRequestBody,
4
5
  CampaignOrderRequestBody,
6
+ CampaignPostingRequirementsValidateRequestBody,
5
7
  TaxonomyEducationAndSeniorityLevel,
6
8
  } from "./types"
7
9
  import { ProductSupportingContractsComplete } from "../product/types"
@@ -17,11 +19,15 @@ export type WindowHapiAPICampaignConfigs = {
17
19
  getEducationLevels: AxiosRequestConfig
18
20
  getSeniorities: AxiosRequestConfig
19
21
  orderCampaign: AxiosRequestConfig
22
+ validateCampaign: AxiosRequestConfig
23
+ validateCampaignPostingRequirements: AxiosRequestConfig
24
+ saveCampaign: AxiosRequestConfig
20
25
  }
21
26
  export type WindowHapiAPICampaignRequests = {
22
27
  getCampaigns: (
23
28
  offset?: number,
24
29
  limit?: number,
30
+ labels?: Record<string, string> | null,
25
31
  ) => Promise<PaginatedAPIResponseV2<Campaign>>
26
32
  getCampaign: (campaignId: string) => Promise<Campaign>
27
33
  getCampaignDetail: (
@@ -35,6 +41,11 @@ export type WindowHapiAPICampaignRequests = {
35
41
  getEducationLevels: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
36
42
  getSeniorities: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
37
43
  orderCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
44
+ saveCampaign: (postBody: CampaignEditRequestBody) => Promise<Campaign>
45
+ validateCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
46
+ validateCampaignPostingRequirements: (
47
+ campaign: CampaignPostingRequirementsValidateRequestBody,
48
+ ) => Promise<Campaign>
38
49
  }
39
50
  export type WindowHapiAPICampaign = WindowHapiModuleWithConstructorArgs<
40
51
  WindowHapiAPIModule<
@@ -3,13 +3,21 @@ import {
3
3
  WindowHapiService,
4
4
  } from "../_window/service.types"
5
5
  import { ProductSupportingContractsComplete } from "../product/types"
6
- import { Campaign, TaxonomyEducationAndSeniorityLevel } from "./types"
6
+ import {
7
+ Campaign,
8
+ CampaignCreateForm,
9
+ CampaignEditForm,
10
+ CampaignOrderRequestBody,
11
+ TaxonomyEducationAndSeniorityLevel,
12
+ } from "./types"
7
13
  import { PaginatedAPIResponseV2 } from "../common/types"
8
14
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
15
+ import { AlertKey } from "../alert"
9
16
 
10
17
  export type CampaignServiceGetCampaignsHandler = (
11
18
  offset?: number,
12
19
  limit?: number,
20
+ labels?: Record<string, string> | null,
13
21
  ) => Promise<PaginatedAPIResponseV2<Campaign>>
14
22
  export type CampaignServiceGetCampaignDetailHandler = (
15
23
  campaignId: string,
@@ -33,7 +41,23 @@ export type CampaignServiceCopyCampaignHandler = (
33
41
  campaign: Campaign,
34
42
  withExistingProducts: boolean,
35
43
  ) => Promise<Campaign>
36
-
44
+ export type CampaignServiceEditCampaignHandler = (
45
+ campaign: Campaign,
46
+ ) => Promise<Campaign>
47
+ export type CampaignServiceSaveCampaignHandler = (
48
+ campaign: CampaignEditForm,
49
+ ) => Promise<Campaign>
50
+ export type CampaignServiceValidateContractPostingRequirementsWithCampaignHandler =
51
+ (contractId: string, requestBody: CampaignOrderRequestBody) => Promise<any>
52
+ export type CampaignServiceValidateCampaignHandler = (
53
+ requestBody: CampaignOrderRequestBody,
54
+ ) => Promise<any>
55
+ export type CampaignServiceGetCopyCampaignRequestBodyHandler = (
56
+ campaign: Campaign,
57
+ ) => CampaignCreateForm
58
+ export type CampaignServiceGetEditCampaignRequestBodyHandler = (
59
+ campaign: Campaign,
60
+ ) => CampaignCreateForm
37
61
  export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
38
62
  {
39
63
  getCampaigns: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignsHandler>
@@ -44,7 +68,13 @@ export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
44
68
  getSeniorities: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetSenioritiesHandler>
45
69
  orderCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceOrderCampaignHandler>
46
70
  copyCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceCopyCampaignHandler>
47
- onAfterOrderCampaignSuccess: () => void
71
+ editCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceEditCampaignHandler>
72
+ onAfterOrderCampaignSuccess: (alertKey: AlertKey) => void
73
+ validateContractPostingRequirementsWithCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateContractPostingRequirementsWithCampaignHandler>
74
+ saveCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSaveCampaignHandler>
75
+ validateCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateCampaignHandler>
76
+ getCopyCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCopyCampaignRequestBodyHandler>
77
+ getEditCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetEditCampaignRequestBodyHandler>
48
78
  },
49
79
  { readonly service: WindowHapiService }
50
80
  >
@@ -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 } from "../common"
9
6
 
10
7
  export type CampaignProductSpecs = {
11
8
  contractId: string | null
@@ -133,6 +130,7 @@ export type CampaignDetailedStatus = {
133
130
  }
134
131
 
135
132
  export type Campaign = {
133
+ labels: Record<string, string> | null
136
134
  currency: ProductPriceCurrency
137
135
  campaignId: string
138
136
  campaignName: string | null
@@ -152,6 +150,7 @@ export type Campaign = {
152
150
  totalPrice: CampaignTotalPrice
153
151
  walletId: string
154
152
  detailedStatus?: CampaignDetailedStatus //this is only added virtually on FE on demand
153
+ isEditable: boolean
155
154
  }
156
155
 
157
156
  export type CampaignCreateFormTargetGroupEducationLevel =
@@ -177,7 +176,8 @@ export type CampaignCreateFormOrderedProductSpecBase = {
177
176
  productId: string
178
177
  utm: string
179
178
  contractId: string
180
- postingRequirements: ContractPostingRequirement[]
179
+ postingRequirements: PostingRequirement[]
180
+ postingDurationDays: number | null
181
181
  }
182
182
  export type CampaignCreateFormOrderedProductSpec =
183
183
  CampaignCreateFormOrderedProductSpecBase & { [k: string]: any }
@@ -197,11 +197,12 @@ export type CampaignCreateFormPostingDetails = {
197
197
  }
198
198
 
199
199
  export type CampaignCreateForm = {
200
+ labels: Record<string, string> | null
200
201
  companyId: string
201
202
  currency: ProductPriceCurrency | null
202
203
  campaignName?: string | null
203
204
  poNumber: string | null
204
- orderReference?: string
205
+ orderReference?: string | null
205
206
  paymentMethod: OrderJourneyPaymentMethod | null
206
207
  targetGroup: CampaignCreateFormTargetGroup
207
208
  recruiterInfo: CampaignRecruiterInfo
@@ -210,19 +211,42 @@ export type CampaignCreateForm = {
210
211
  orderedProductsSpecs: Record<string, CampaignCreateFormOrderedProductSpec>
211
212
  }
212
213
 
214
+ export type CampaignEditForm = Omit<
215
+ CampaignCreateForm,
216
+ | "companyId"
217
+ | "currency"
218
+ | "poNumber"
219
+ | "orderReference"
220
+ | "paymentMethod"
221
+ | "postingDetails"
222
+ | "orderedProductsSpecs"
223
+ > & {
224
+ campaignId: string
225
+ postingDetails: Omit<
226
+ CampaignCreateFormPostingDetails,
227
+ "applicationUrl" | "jobPageUrl"
228
+ >
229
+ orderedProductsSpecs: Record<
230
+ string,
231
+ Omit<CampaignCreateFormOrderedProductSpec, "postingDurationDays">
232
+ >
233
+ }
234
+
213
235
  export type CampaignOrderRequestBodyOrderedProductsSpec = {
214
236
  contractId?: string
215
237
  utm: string
216
238
  productId?: string
217
- postingRequirements?: any
239
+ postingRequirements?: Record<string, any>
240
+ postingDurationDays: number | null
218
241
  }
219
242
 
220
243
  export type CampaignOrderRequestBody = {
244
+ labels: Record<string, string> | null
221
245
  companyId: string
222
246
  campaignName: string | null | undefined
223
247
  walletId?: string
224
248
  poNumber?: string | null
225
- orderReference?: string
249
+ orderReference?: string | null
226
250
  recruiterInfo: Omit<CampaignRecruiterInfo, "id">
227
251
  paymentMethod: OrderJourneyPaymentMethod | null
228
252
  postingDetails: CampaignPostingDetails
@@ -231,6 +255,34 @@ export type CampaignOrderRequestBody = {
231
255
  orderedProductsSpecs: CampaignOrderRequestBodyOrderedProductsSpec[]
232
256
  }
233
257
 
258
+ export type CampaignEditRequestBody = Omit<
259
+ CampaignOrderRequestBody,
260
+ | "walletId"
261
+ | "poNumber"
262
+ | "orderReference"
263
+ | "companyId"
264
+ | "postingDetails"
265
+ | "orderedProductsSpecs"
266
+ | "paymentMethod"
267
+ > & {
268
+ campaignId: string
269
+ postingDetails: Omit<
270
+ CampaignPostingDetails,
271
+ "applicationUrl" | "jobPageUrl"
272
+ >
273
+ orderedProductsSpecs: Omit<
274
+ CampaignOrderRequestBodyOrderedProductsSpec,
275
+ "utm" | "productId" | "contractId" | "postingDurationDays"
276
+ >[]
277
+ }
278
+
279
+ export type CampaignPostingRequirementsValidateRequestBody = {
280
+ contract_id: string
281
+ product_id: string
282
+ posting_requirements: { name: string; value: any }[]
283
+ vacancy: { name: string; value: any }[]
284
+ }
285
+
234
286
  export type CampaignTaxonomyNameWithLanguage = {
235
287
  languageCode: string
236
288
  value: string
@@ -254,15 +306,11 @@ export type TaxonomyEmploymentTypes = {
254
306
  value: EmploymentType
255
307
  label: string
256
308
  }
257
- export type TransformedPostingRequirementOption = {
258
- value?: string
259
- data?: any[]
260
- requires?: ContractPostingRequirementOptionRequiresField[] | null
261
- label: string
262
- }
263
- export type TransformedPostingRequirement = Omit<
264
- ContractPostingRequirement,
265
- "options"
266
- > & {
267
- options: TransformedPostingRequirementOption[] | null
309
+
310
+ export type CampaignPostingRequirementsValidateResponse = {
311
+ has_errors: boolean
312
+ errors: {
313
+ credentials: Record<string, any>
314
+ posting_requirements: Record<string, any>
315
+ }
268
316
  }
@@ -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
  >
package/common/types.ts CHANGED
@@ -107,6 +107,103 @@ export type HapiWebComponent = {
107
107
  "campaignId": "campaign.getRandomCampaignId" //campaignId being the path parameter like [campaignId].tsx
108
108
  }
109
109
  */
110
+ // some widgets have query params, we need to mock them
111
+ qaMockQueryParams?: Record<string, string>
110
112
  enableNextJSDivScroll?: boolean
111
113
  loadingLazyIframe?: boolean
114
+ isHiddenOnDocumentation?: boolean
115
+ }
116
+ export type PostingRequirementType =
117
+ | "SELECT"
118
+ | "SELECT-MAP_ONLY"
119
+ | "TEXT"
120
+ | "MULTIPLE"
121
+ | "HIER"
122
+ | "TEXTEXPAND"
123
+ | "DATE"
124
+ | "TEXTAREA"
125
+ | "AUTOCOMPLETE"
126
+ | "STATISCH"
127
+ | "IMAGE-URL"
128
+ | "VIDEO-URL"
129
+ | "IMAGE-PREVIEW"
130
+ | "DYNAMISCH"
131
+ export type PostingRequirementRule = {
132
+ rule: string
133
+ data: string
134
+ }
135
+ export type PostingRequirementDisplayRuleShow = {
136
+ facet: string
137
+ value: any
138
+ op: "notempty" | "equal" | "in"
139
+ }
140
+ export type PostingRequirementDisplayRule = {
141
+ show: PostingRequirementDisplayRuleShow[]
142
+ }
143
+ export type PostingRequirementAutocompleteParametersSourceSingle = {
144
+ field?: string
145
+ facet?: string
146
+ }
147
+ export type PostingRequirementAutocompleteParametersSourceMultiple = {
148
+ [key: string]:
149
+ | PostingRequirementAutocompleteParametersSourceSingle
150
+ | PostingRequirementAutocompleteParametersSourceSingle[]
151
+ }
152
+ export type PostingRequirementParametersSource =
153
+ | PostingRequirementAutocompleteParametersSourceSingle
154
+ | PostingRequirementAutocompleteParametersSourceMultiple
155
+ export type PostingRequirementAutocomplete = {
156
+ required_parameters: string[] | null
157
+ parameters_source: PostingRequirementParametersSource | null
158
+ }
159
+ export type PostingRequirementGroup = {
160
+ id: string
161
+ name: string
162
+ sort: number
163
+ }
164
+ export type PostingRequirement = {
165
+ name: string
166
+ label: string
167
+ description?: string
168
+ display_rules: PostingRequirementDisplayRule | null
169
+ autocomplete: PostingRequirementAutocomplete | null
170
+ options: PostingRequirementOption[] | null
171
+ required: boolean
172
+ sort: string
173
+ type: PostingRequirementType
174
+ rules?: PostingRequirementRule[] | null
175
+ group_id?: string
176
+ }
177
+ export type PostingRequirementOptionRequiresField = {
178
+ field: {
179
+ name: string
180
+ }
181
+ }
182
+ export type PostingRequirementOption = {
183
+ default?: string
184
+ key: string
185
+ label: string
186
+ data?: any[]
187
+ labels?: Record<"default", string>
188
+ sort: string
189
+ parent?: string
190
+ requires?: PostingRequirementOptionRequiresField[] | null
191
+ }
192
+ export type TransformedPostingRequirementOption = {
193
+ value?: string
194
+ data?: any[]
195
+ requires?: PostingRequirementOptionRequiresField[] | null
196
+ label: string
197
+ }
198
+ export type PostingRequirementReactiveDescription = { description: string }
199
+ export type TransformedPostingRequirement = Omit<
200
+ PostingRequirement,
201
+ "options"
202
+ > & {
203
+ options: TransformedPostingRequirementOption[] | null
204
+ }
205
+ export type Facet = {}
206
+ export type PostingRequirementsAutocompleteRequestOption = {
207
+ key: string
208
+ value: string | string[]
112
209
  }
@@ -3,19 +3,17 @@ import {
3
3
  WindowHapiService,
4
4
  } from "../_window/service.types"
5
5
  import { OrderJourneyStepKey } from "../orderJourney/enums"
6
+ import { Contract, ContractCredential, ContractGroup } from "./types"
6
7
  import {
7
- Contract,
8
- ContractCredential,
9
- ContractGroup,
10
- ContractPostingRequirementsAutocompleteRequestOption,
11
- } from "./types"
12
- import { PaginatedAPIResponseV1 } from "../common/types"
8
+ PostingRequirementsAutocompleteRequestOption,
9
+ PaginatedAPIResponseV1,
10
+ } from "../common/types"
13
11
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
14
12
 
15
13
  export type ContractServiceGetContractPostingRequirementOptionsHandler = (
16
14
  contractId: string,
17
15
  fieldName: string,
18
- autocompleteRequestOptions: ContractPostingRequirementsAutocompleteRequestOption[],
16
+ autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
19
17
  ) => Promise<any>
20
18
  export type ContractServiceGetContractsHandler = (
21
19
  offset: number,
package/contract/types.ts CHANGED
@@ -16,85 +16,6 @@ export type ContractCredential = {
16
16
  options: ContractCredentialOption[] | null
17
17
  }
18
18
 
19
- export type ContractFacet = {}
20
-
21
- export type ContractPostingRequirementType =
22
- | "SELECT"
23
- | "SELECT-MAP_ONLY"
24
- | "TEXT"
25
- | "MULTIPLE"
26
- | "HIER"
27
- | "TEXTEXPAND"
28
- | "DATE"
29
- | "TEXTAREA"
30
- | "AUTOCOMPLETE"
31
- | "STATISCH"
32
-
33
- export type ContractPostingRequirementRule = {
34
- rule: string
35
- data: string
36
- }
37
-
38
- export type ContractPostingRequirementDisplayRuleShow = {
39
- facet: string
40
- value: any
41
- op: "notempty" | "equal" | "in"
42
- }
43
-
44
- export type ContractPostingRequirementDisplayRule = {
45
- show: ContractPostingRequirementDisplayRuleShow[]
46
- }
47
-
48
- export type ContractPostingRequirementAutocompleteParametersSourceSingle = {
49
- field?: string
50
- facet?: string
51
- }
52
-
53
- export type ContractPostingRequirementAutocompleteParametersSourceMultiple = {
54
- [
55
- key: string
56
- ]: ContractPostingRequirementAutocompleteParametersSourceSingle[]
57
- }
58
-
59
- export type ContractPostingRequirementParametersSource =
60
- | ContractPostingRequirementAutocompleteParametersSourceSingle
61
- | ContractPostingRequirementAutocompleteParametersSourceMultiple
62
-
63
- export type ContractPostingRequirementAutocomplete = {
64
- required_parameters: string[] | null
65
- parameters_source: ContractPostingRequirementParametersSource | null
66
- }
67
-
68
- export type ContractPostingRequirement = {
69
- name: string
70
- label: string
71
- description?: string
72
- display_rules: ContractPostingRequirementDisplayRule | null
73
- autocomplete: ContractPostingRequirementAutocomplete | null
74
- options: ContractPostingRequirementOption[] | null
75
- required: boolean
76
- sort: string
77
- type: ContractPostingRequirementType
78
- rules?: ContractPostingRequirementRule[] | null
79
- }
80
-
81
- export type ContractPostingRequirementOptionRequiresField = {
82
- field: {
83
- name: string
84
- }
85
- }
86
-
87
- export type ContractPostingRequirementOption = {
88
- default?: string
89
- key: string
90
- label: string
91
- data?: any[]
92
- labels?: Record<"default", string>
93
- sort: string
94
- parent?: string
95
- requires: ContractPostingRequirementOptionRequiresField[] | null
96
- }
97
-
98
19
  export type ContractPurchasePrice = {
99
20
  amount: number | null
100
21
  currency: string | null
@@ -111,6 +32,7 @@ export type ContractCreateForm = {
111
32
  purchase_price: ContractPurchasePrice
112
33
  credits: string | null
113
34
  followed_instructions: boolean
35
+ posting_duration_days: number | null
114
36
  allow_renegotiation: boolean
115
37
  }
116
38
 
@@ -137,6 +59,7 @@ export type Contract = {
137
59
  facets?: any[]
138
60
  product: ContractProduct
139
61
  purchase_price: ContractPurchasePrice | null
62
+ posting_duration_days: number | null
140
63
  group: ContractGroup | null
141
64
  }
142
65
 
@@ -148,7 +71,3 @@ export type ContractGroup = {
148
71
  }
149
72
 
150
73
  export type ContractGroupSelected = ContractGroup | "add-new" | null
151
- export type ContractPostingRequirementsAutocompleteRequestOption = {
152
- key: string
153
- value: string | string[]
154
- }
@@ -60,6 +60,12 @@ export type ZodContractCreateForm = ZodObject<{
60
60
  purchase_price: ZodContractPurchasePrice
61
61
  credits: ZodContractCredits
62
62
  followed_instructions: ZodOptional<ZodBoolean>
63
+ posting_duration_days: ZodUnion<
64
+ [
65
+ ZodOptional<ZodNullable<ZodNumber>>,
66
+ ZodOptional<ZodNullable<ZodNumber>>,
67
+ ]
68
+ >
63
69
  allow_renegotiation: ZodOptional<ZodBoolean>
64
70
  }>
65
71
  export type ZodContractPostingRequirementAutocompleteRequestOptions = ZodRecord<
package/modal/enums.ts CHANGED
@@ -11,6 +11,7 @@ export enum ModalKeys {
11
11
  campaignCopyJourney = "campaign-confirm-copy",
12
12
  campaignStatusDetail = "campaign-status-detail",
13
13
  campaignCopySelection = "contract-copy-selection",
14
+ campaignEdit = "campaign-edit",
14
15
  basketRemoveProductConfirmation = "remove-product-from-basket",
15
16
  contractRemoveConfirmation = "contract-remove-confirmation",
16
17
  contractGroupConflictInfo = "contract-group-conflict-info",
package/modal/types.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import { Product } from "../product/types"
2
2
  import { Contract } from "../contract/types"
3
3
  import { ModalKeys, ModalZone } from "./enums"
4
- import { AnyNonFunction } from "../common/types"
5
- import { Campaign, TransformedPostingRequirement } from "../campaign"
4
+ import { AnyNonFunction, TransformedPostingRequirement } from "../common/types"
5
+ import { Campaign } from "../campaign"
6
6
  import { TalentMindResume } from "../talentMindResume/types"
7
7
  import { TalentMindJob } from "../talentMindJob/types"
8
+ import { OrderJourneyPaymentMethod } from "../orderJourney"
9
+ import { PickerDisplayMode } from "filestack-js"
10
+ import { HapiBoxProps } from "../../src/components/reusable/Box"
8
11
 
9
12
  export type ProductDetailModalProps = {
10
13
  id: string
@@ -23,6 +26,9 @@ export type CampaignCopySelectionModalProps = {
23
26
  products: (Product | Contract)[]
24
27
  campaign: Campaign
25
28
  }
29
+ export type CampaignEditModalProps = {
30
+ campaign?: Campaign
31
+ }
26
32
  export type ContractPostingRequirementsSmartFillResponseModalProps = {
27
33
  response: Record<string, any>
28
34
  postingRequirements: Record<string, TransformedPostingRequirement>
@@ -33,9 +39,23 @@ export type FilePickerOptions = {
33
39
  uploadInBackground?: boolean
34
40
  maxFiles?: number
35
41
  maxSize?: number
42
+ displayMode?: PickerDisplayMode
43
+ container?: string
44
+ containerProps?: HapiBoxProps
45
+ imageMax?: [number, number]
46
+ imageMin?: [number, number]
47
+ showTransformations?: boolean
48
+ }
49
+ export type BasketModalProps = {
50
+ canDeleteProducts?: boolean
51
+ showDeliveryTime?: boolean
52
+ showAmounts?: boolean
53
+ }
54
+ export type WalletModalProps = {
55
+ showBalance?: boolean
56
+ paymentMethod: OrderJourneyPaymentMethod | null
36
57
  }
37
- export type BasketModalProps = {}
38
- export type WalletModalProps = {}
58
+ export type WalletPurchaseOrderModalProps = {}
39
59
  export type TalentMindEvaluateJobWithResumeModalProps = {
40
60
  resume: TalentMindResume
41
61
  }
@@ -12,6 +12,7 @@ export enum OrderJourneyStepKey {
12
12
  postingWorkingLocation = "posting-working-location",
13
13
  postingURLs = "posting-urls",
14
14
  contractChannelPostingRequirements = "contract-channel-posting-requirements",
15
+ productChannelPostingRequirements = "product-channel-posting-requirements",
15
16
  postingUTMCodes = "posting-utm-codes",
16
17
  orderReview = "order-review",
17
18
  paymentMethod = "payment-method",
@@ -10,11 +10,13 @@ import { OrderJourneyStepKey } from "./enums"
10
10
 
11
11
  export type OrderJourneyServiceSwitchToNextStepHandler = () => Promise<void>
12
12
  export type OrderJourneyServiceSwitchToPreviousStepHandler = () => Promise<void>
13
+ export type OrderJourneyServiceRestartJourneyHandler = () => void
13
14
 
14
15
  export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
15
16
  {
16
17
  switchToNextStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToNextStepHandler>
17
18
  switchToPreviousStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToPreviousStepHandler>
19
+ restartJourney: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceRestartJourneyHandler>
18
20
  getValidators: () => Record<string, NestedValidatorKeys>
19
21
  getErrorMessages: () => Record<string, Record<string, any> | undefined>
20
22
  getBlurredFields: () => Record<string, Record<string, any> | undefined>
@@ -49,6 +51,24 @@ export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
49
51
  >,
50
52
  ) => void
51
53
  setContractStepsSubmittedSteps: (steps: Record<string, boolean>) => void
54
+ setContractStepsValidators: (
55
+ validators: NestedValidatorKeys,
56
+ replaceAsIs: boolean,
57
+ ) => void
58
+ setProductStepsBlurredFields: (
59
+ fields: Record<string, Record<string, boolean>>,
60
+ ) => Record<string, UseValidatorResult> | null
61
+ setProductStepsErrorMessages: (
62
+ messages: Record<
63
+ string,
64
+ Record<string, MessageDescriptor | boolean>
65
+ >,
66
+ ) => void
67
+ setProductStepsSubmittedSteps: (steps: Record<string, boolean>) => void
68
+ setProductStepsValidators: (
69
+ validators: NestedValidatorKeys,
70
+ replaceAsIs: boolean,
71
+ ) => void
52
72
  getSetters: (
53
73
  steps: Record<string, boolean>,
54
74
  ) => Record<string, (step: OrderJourneyStep) => any>
@@ -5,6 +5,8 @@ import {
5
5
  OrderJourneyUTMStepData,
6
6
  OrderJourneyUTMStepValidations,
7
7
  OrderJourneyOrderReviewStepData,
8
+ OrderJourneyProductStep,
9
+ OrderJourneyOrderErrors,
8
10
  } from "./types"
9
11
  import { MessageDescriptor } from "react-intl"
10
12
  import { NestedValidatorKeys, UseValidatorResult } from "../common/types"
@@ -25,7 +27,7 @@ export type OrderJourneyState = {
25
27
  paymentMethodsAvailable: OrderJourneyPaymentMethod[]
26
28
  paymentMethodsEnabled: OrderJourneyPaymentMethod[]
27
29
  hidePrefilledFields: boolean
28
- orderErrors: Record<string, any> | null
30
+ orderErrors: OrderJourneyOrderErrors | null
29
31
  /* Onboarding */
30
32
  onboardingStep: OrderJourneyStep
31
33
  onboardingStepData: Record<string, any>
@@ -85,6 +87,14 @@ export type OrderJourneyState = {
85
87
  contractStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
86
88
  contractStepsData: Record<string, Record<string, any>>
87
89
  contractStepsValidations: Record<string, UseValidatorResult> | null
90
+ /* Product Fields */
91
+ productSteps: OrderJourneyProductStep[]
92
+ productStepsBlurredFields: Record<string, Record<string, boolean>>
93
+ productStepsSubmittedSteps: Record<string, boolean>
94
+ productStepsErrorMessages: Record<string, Record<string, MessageDescriptor>>
95
+ productStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
96
+ productStepsData: Record<string, Record<string, any>>
97
+ productStepsValidations: Record<string, UseValidatorResult> | null
88
98
  /* UTM Codes */
89
99
  utmCodesStep: OrderJourneyStep
90
100
  utmCodesStepData: OrderJourneyUTMStepData
@@ -31,6 +31,11 @@ export type OrderJourneyContractStep = Omit<
31
31
  "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
32
32
  >
33
33
 
34
+ export type OrderJourneyProductStep = Omit<
35
+ OrderJourneyStep,
36
+ "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
37
+ >
38
+
34
39
  export type UTMMap = {
35
40
  value: string
36
41
  mapToName: boolean
@@ -61,4 +66,36 @@ export type OrderJourneyUTMStepValidations = {
61
66
 
62
67
  export type OrderJourneyOrderReviewStepData = {
63
68
  accordionsOpen: OrderJourneyStepKey[]
69
+ accordionsEnabled: OrderJourneyStepKey[]
70
+ }
71
+
72
+ export type OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid =
73
+ {
74
+ errors: {
75
+ orderedProducts: Record<string, any>[]
76
+ orderedProductsSpecs: Partial<{
77
+ credentials: Record<string, any>
78
+ posting_requirements: Record<string, any>
79
+ postingRequirements?: string[]
80
+ }>[]
81
+ walletId?: string
82
+ }
83
+ has_errors: boolean
84
+ }
85
+
86
+ export type OrderJourneyOrderErrorsCampaignIsInvalid = {
87
+ postingDetails: Record<string, any>
88
+ recruiterInfo: Record<string, any>
89
+ targetGroup: Record<string, any>
90
+ orderedProducts: string[]
91
+ walletId: string
64
92
  }
93
+
94
+ // HAPI Backend validation works in this order:
95
+ // - it validates the campaign first, if campaign itself is not valid, it does not validate the posting requirements at all
96
+ // - if campaign is valid, then it validates posting requirements
97
+ // because of this, the response BE sends changes
98
+ // backend does not validate the entire form in one go
99
+ export type OrderJourneyOrderErrors =
100
+ | OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid
101
+ | OrderJourneyOrderErrorsCampaignIsInvalid
@@ -36,6 +36,9 @@ export type ZodOrderJourneyOrderReviewStepData = ZodObject<{
36
36
  accordionsOpen: ZodArray<
37
37
  ZodUnion<[ZodNativeEnum<typeof OrderJourneyStepKey>, ZodString]>
38
38
  >
39
+ accordionsEnabled: ZodArray<
40
+ ZodUnion<[ZodNativeEnum<typeof OrderJourneyStepKey>, ZodString]>
41
+ >
39
42
  }>
40
43
  export type WindowHapiValidationsOrderJourney = {
41
44
  supportedStepKeys: OrderJourneyStepKey[]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.18.0",
4
+ "version": "1.19.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -11,7 +11,11 @@ import {
11
11
  ProductWithSupportForContractsFilters,
12
12
  } from "./types"
13
13
  import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
14
- import { PaginatedAPIResponseV1, PaginationLimitOffset } from "../common/types"
14
+ import {
15
+ PaginatedAPIResponseV1,
16
+ PaginationLimitOffset,
17
+ PostingRequirement,
18
+ } from "../common/types"
15
19
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
16
20
 
17
21
  export type WindowHapiAPIProductConfigs = {
@@ -25,6 +29,8 @@ export type WindowHapiAPIProductConfigs = {
25
29
  getJobTitles: AxiosRequestConfig
26
30
  getLocations: AxiosRequestConfig
27
31
  calculateDeliveryTime: AxiosRequestConfig
32
+ getPostingRequirementOptions: AxiosRequestConfig
33
+ getPostingRequirements: AxiosRequestConfig
28
34
  }
29
35
  export type WindowHapiAPIProductRequests = {
30
36
  getProduct: (productId: number | string) => Promise<Product>
@@ -44,6 +50,14 @@ export type WindowHapiAPIProductRequests = {
44
50
  filters?: ProductWithSupportForContractsFilters,
45
51
  limitOffset?: PaginationLimitOffset,
46
52
  ) => Promise<PaginatedAPIResponseV1<ProductSupportingContractsPartial>>
53
+ getPostingRequirementOptions: (
54
+ productId: string,
55
+ fieldName: string,
56
+ autocompleteRequestOptions: Record<string, string | string[]>,
57
+ ) => Promise<any>
58
+ getPostingRequirements: (
59
+ productId: string | number,
60
+ ) => Promise<PostingRequirement[]>
47
61
  getIndustries: () => Promise<ProductIndustry[]>
48
62
  getJobFunctions: () => Promise<ProductJobFunction[]>
49
63
  getJobTitles: (
package/product/enums.ts CHANGED
@@ -10,3 +10,11 @@ export enum ProductPriceCurrency {
10
10
  "GBP" = "GBP",
11
11
  "AUD" = "AUD",
12
12
  }
13
+
14
+ export enum ProductSortBy {
15
+ "recommendedFirst" = "recommendedFirst",
16
+ "createdNewestToOldest" = "created.desc",
17
+ "createdOldestToNewest" = "created.asc",
18
+ "priceHighToLow" = "list_price.desc",
19
+ "priceLowToHigh" = "list_price.asc",
20
+ }
@@ -12,13 +12,19 @@ import {
12
12
  ProductSupportingContractsComplete,
13
13
  ProductSupportingContractsPartial,
14
14
  } from "./types"
15
- import { PaginatedAPIResponseV1, PaginationResponseV1 } from "../common/types"
15
+ import {
16
+ PaginatedAPIResponseV1,
17
+ PaginationResponseV1,
18
+ PostingRequirement,
19
+ PostingRequirementsAutocompleteRequestOption,
20
+ } from "../common/types"
16
21
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
17
22
 
18
23
  export type ProductServiceGetFilteredProductsHandler = (
19
24
  meta?: PaginationResponseV1 | null,
20
25
  filters?: Partial<ProductFilterQueryParams>,
21
26
  ) => Promise<Product[]>
27
+ export type ProductServiceLoadMoreProductsHandler = () => Promise<Product[]>
22
28
  export type ProductServiceGetProductWithContractsSupportByIdHandler = (
23
29
  id: string | number,
24
30
  ) => Promise<ProductSupportingContractsComplete>
@@ -53,8 +59,19 @@ export type ProductServiceGetIndustriesHandler = () => Promise<
53
59
 
54
60
  export type ProductServiceSetArbitraryJobTitle = (text: string) => void
55
61
 
62
+ export type ProductServiceGetProductPostingRequirementOptionsHandler = (
63
+ productId: string,
64
+ fieldName: string,
65
+ autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
66
+ ) => Promise<any>
67
+
68
+ export type ProductServiceGetProductPostingRequirementsHandler = (
69
+ productId: string | number,
70
+ ) => Promise<PostingRequirement[]>
71
+
56
72
  export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
57
73
  {
74
+ loadMoreProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceLoadMoreProductsHandler>
58
75
  setArbitraryJobTitle: ProductServiceSetArbitraryJobTitle
59
76
  getProductWithContractsSupportById: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductWithContractsSupportByIdHandler>
60
77
  getProductsWithContractsSupport: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductsWithContractsSupportHandler>
@@ -66,6 +83,8 @@ export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
66
83
  getJobTitles: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobTitlesHandler>
67
84
  getJobFunctions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobFunctionsHandler>
68
85
  getIndustries: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetIndustriesHandler>
86
+ getProductPostingRequirementOptions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductPostingRequirementOptionsHandler>
87
+ getProductPostingRequirements: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductPostingRequirementsHandler>
69
88
  },
70
89
  { readonly service: WindowHapiService }
71
90
  >
@@ -7,7 +7,7 @@ import {
7
7
  ProductSupportingContractsPartial,
8
8
  } from "./types"
9
9
  import { PaginationResponseV1 } from "../common/types"
10
- import { ProductPriceCurrency } from "./enums"
10
+ import { ProductPriceCurrency, ProductSortBy } from "./enums"
11
11
 
12
12
  export type ProductState = {
13
13
  /* Products */
@@ -20,8 +20,11 @@ export type ProductState = {
20
20
  productsAreLoading: boolean
21
21
  productNameInput: string
22
22
  jobRegionsIdsSelected: number[]
23
+ filtersAccordionIsOpen: boolean
23
24
  /* Product Price Display Currency */
24
25
  displayCurrency: ProductPriceCurrency
26
+ /* Sort By */
27
+ searchSortBy: ProductSortBy
25
28
  /* Locations */
26
29
  jobRegions: ProductLocation[]
27
30
  /* Job Titles */
package/product/types.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { ProductFilterRecommendations, ProductPriceCurrency } from "./enums"
2
1
  import {
3
- ContractCredential,
4
- ContractFacet,
5
- ContractPostingRequirement,
6
- } from "../contract/types"
2
+ ProductFilterRecommendations,
3
+ ProductPriceCurrency,
4
+ ProductSortBy,
5
+ } from "./enums"
6
+ import { ContractCredential } from "../contract/types"
7
+ import { Facet, PostingRequirement } from "../common"
7
8
 
8
9
  export type ProductRange = "hours" | "days" | "weeks" | "months"
9
10
 
@@ -61,6 +62,8 @@ export type Product = {
61
62
  vonq_price: ProductPrice[]
62
63
  time_to_process: ProductDuration
63
64
  time_to_setup: ProductDuration
65
+ is_recommended?: boolean
66
+ has_posting_requirements: boolean
64
67
  } & ProductLogos &
65
68
  ProductType
66
69
 
@@ -127,6 +130,7 @@ export type ProductFilterQueryParams = {
127
130
  filterProductRecommendations: ProductFilterRecommendations
128
131
  filterMyContractSupportedOnly: boolean
129
132
  searchTextInput: string
133
+ searchSortBy: ProductSortBy
130
134
  }
131
135
 
132
136
  export type ProductSearchFilters = {
@@ -142,15 +146,7 @@ export type ProductSearchFilters = {
142
146
  mcEnabled?: boolean
143
147
  name?: string
144
148
  recommended?: boolean
145
- sortBy?:
146
- | "relevant"
147
- | "recent"
148
- | "order_frequency.desc"
149
- | "order_frequency.asc"
150
- | "created.desc"
151
- | "created.asc"
152
- | "list_price.desc"
153
- | "list_price.asc"
149
+ sortBy?: ProductSortBy
154
150
  }
155
151
 
156
152
  export type ProductWithSupportForContractsFilters = {
@@ -159,10 +155,10 @@ export type ProductWithSupportForContractsFilters = {
159
155
  export type ProductSupportingContractsComplete = ProductLogos &
160
156
  ProductSupportingContractsPartial & {
161
157
  contract_credentials: ContractCredential[]
162
- contract_facets?: ContractFacet[]
158
+ contract_facets?: Facet[]
163
159
  feed_url: string | null
164
160
  manual_setup_required: boolean
165
- posting_requirements: ContractPostingRequirement[]
161
+ posting_requirements: PostingRequirement[]
166
162
  setup_instructions: string //html;
167
163
  }
168
164
 
@@ -170,3 +166,8 @@ export type ProductUserProvidedFilters = Omit<
170
166
  ProductFilterQueryParams,
171
167
  "filterProductRecommendations" | "filterMyContractSupportedOnly"
172
168
  >
169
+
170
+ export type ProductPostingRequirementsAutocompleteRequestOption = {
171
+ key: string
172
+ value: string | string[]
173
+ }
@@ -2,11 +2,12 @@ import { ProductFilterQueryParams, ProductUserProvidedFilters } from "./types"
2
2
  import { PaginationResponseV1 } from "../common/types"
3
3
  import { WindowHapiUtils } from "../_window/utils.types"
4
4
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
5
- import { ProductPriceCurrency } from "./enums"
5
+ import { ProductPriceCurrency, ProductSortBy } from "./enums"
6
6
 
7
7
  export type WindowHapiUtilsProduct = WindowHapiModuleWithConstructorArgs<
8
8
  {
9
9
  currencyKeys: typeof ProductPriceCurrency
10
+ sortByKeys: typeof ProductSortBy
10
11
  getUserProvidedFilters: () => ProductUserProvidedFilters
11
12
  getProductsQueryParams: (
12
13
  params: Partial<ProductFilterQueryParams>,
@@ -26,8 +26,8 @@ export type ZodProductChannel = ZodObject<{
26
26
  }>
27
27
 
28
28
  export type ZodProductDuration = ZodObject<{
29
- range: ZodString
30
- period: ZodNumber
29
+ range: ZodNullable<ZodString>
30
+ period: ZodNullable<ZodNumber>
31
31
  }>
32
32
 
33
33
  export type ZodProductIndustry = ZodObject<{
@@ -109,6 +109,7 @@ export type ZodProduct = ZodObject<{
109
109
  industries: ZodProductIndustries
110
110
  job_functions: ZodProductJobFunctions
111
111
  locations: ZodProductLocationsPartial
112
+ is_recommended: ZodOptional<ZodBoolean>
112
113
  mc_enabled: ZodBoolean
113
114
  mc_only: ZodBoolean
114
115
  product_id: ZodString
@@ -0,0 +1,14 @@
1
+ import { WindowHapiUtils } from "../_window/utils.types"
2
+ import {
3
+ WindowHapiModuleWithConstructorArgs,
4
+ WindowHapiRoutingQueryParams,
5
+ } from "../_window"
6
+
7
+ export type WindowHapiUtilsRouter = WindowHapiModuleWithConstructorArgs<
8
+ {
9
+ convertSearchStringToQueryParams: (
10
+ searchString?: string,
11
+ ) => WindowHapiRoutingQueryParams
12
+ },
13
+ { readonly utils: WindowHapiUtils }
14
+ >
package/theming/types.ts CHANGED
@@ -85,6 +85,7 @@ export type HapiThemeRule =
85
85
  | "userJourneyBar"
86
86
  | "card"
87
87
  | "productCard"
88
+ | "campaignCard"
88
89
  | "tabHeaders"
89
90
  | "tabHeader"
90
91
  | "tabPanels"