@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.
Files changed (47) hide show
  1. package/_window/events.types.ts +15 -2
  2. package/_window/qa.types.ts +3 -1
  3. package/_window/routing.types.ts +1 -0
  4. package/_window/sdk.types.ts +3 -1
  5. package/_window/service.types.ts +5 -0
  6. package/_window/state.types.ts +4 -1
  7. package/_window/utils.types.ts +13 -0
  8. package/alert/enums.ts +2 -0
  9. package/ats/state.types.ts +1 -0
  10. package/basket/state.types.ts +3 -1
  11. package/basket/utils.types.ts +3 -0
  12. package/basket/validations.types.ts +7 -0
  13. package/campaign/api.types.ts +22 -1
  14. package/campaign/service.types.ts +44 -3
  15. package/campaign/state.types.ts +2 -1
  16. package/campaign/types.ts +89 -20
  17. package/campaign/utils.types.ts +21 -0
  18. package/campaign/validations.types.ts +8 -1
  19. package/common/events/EventCommand/enums.ts +1 -0
  20. package/common/events/types.ts +1 -0
  21. package/common/types.ts +122 -0
  22. package/contract/service.types.ts +5 -7
  23. package/contract/types.ts +2 -83
  24. package/contract/validations.types.ts +7 -1
  25. package/debugging/index.ts +1 -0
  26. package/debugging/service.types.ts +16 -0
  27. package/debugging/state.types.ts +4 -0
  28. package/debugging/types.ts +17 -0
  29. package/modal/enums.ts +2 -0
  30. package/modal/types.ts +28 -4
  31. package/orderJourney/enums.ts +1 -0
  32. package/orderJourney/service.types.ts +27 -1
  33. package/orderJourney/state.types.ts +17 -3
  34. package/orderJourney/types.ts +42 -0
  35. package/orderJourney/validations.types.ts +7 -0
  36. package/package.json +1 -1
  37. package/product/api.types.ts +15 -1
  38. package/product/enums.ts +9 -0
  39. package/product/service.types.ts +25 -2
  40. package/product/state.types.ts +4 -1
  41. package/product/types.ts +22 -16
  42. package/product/utils.types.ts +2 -1
  43. package/product/validations.types.ts +3 -2
  44. package/routing/utils.types.ts +14 -0
  45. package/theming/types.ts +1 -0
  46. package/wallet/service.types.ts +1 -0
  47. package/wallet/types.ts +1 -0
package/common/types.ts CHANGED
@@ -50,6 +50,7 @@ export type PaginatedAPIResponseV2<T> = {
50
50
  } & PaginationResponseV2
51
51
  export type HapiInputErrorMessageOrValidity =
52
52
  | MessageDescriptor
53
+ | MessageDescriptor[]
53
54
  | boolean
54
55
  | undefined
55
56
  | null
@@ -78,6 +79,7 @@ export type ValidatorKey =
78
79
  | keyof Validators
79
80
  export type NestedValidatorKeys =
80
81
  | ValidatorKey
82
+ | ValidatorKey[]
81
83
  | {
82
84
  [k: string]: ValidatorKey | NestedValidatorKeys
83
85
  }
@@ -107,6 +109,126 @@ export type HapiWebComponent = {
107
109
  "campaignId": "campaign.getRandomCampaignId" //campaignId being the path parameter like [campaignId].tsx
108
110
  }
109
111
  */
112
+ // some widgets have query params, we need to mock them
113
+ qaMockQueryParams?: Record<string, string>
110
114
  enableNextJSDivScroll?: boolean
111
115
  loadingLazyIframe?: boolean
116
+ isHiddenOnDocumentation?: boolean
117
+ }
118
+ export type PostingRequirementType =
119
+ | "SELECT"
120
+ | "SELECT-MAP_ONLY"
121
+ | "TEXT"
122
+ | "MULTIPLE"
123
+ | "HIER"
124
+ | "TEXTEXPAND"
125
+ | "DATE"
126
+ | "TEXTAREA"
127
+ | "AUTOCOMPLETE"
128
+ | "STATISCH"
129
+ | "IMAGE-URL"
130
+ | "VIDEO-URL"
131
+ | "IMAGE-PREVIEW"
132
+ | "DYNAMISCH"
133
+
134
+ export type PostingRequirementRuleName =
135
+ | "int"
136
+ | "regex"
137
+ | "maxlength"
138
+ | "minlength"
139
+ | "maxitems"
140
+ | "minitems"
141
+ | "date"
142
+ | "float"
143
+ | "email"
144
+ | "lower"
145
+ | "higher"
146
+ | "min"
147
+ | "max"
148
+ | "before"
149
+ | "after"
150
+ | "url"
151
+
152
+ export type PostingRequirementRule = {
153
+ rule: PostingRequirementRuleName
154
+ data: string
155
+ }
156
+ export type PostingRequirementDisplayRuleShow = {
157
+ facet: string
158
+ value: any
159
+ op: "notempty" | "equal" | "in" | "selected_option_show_contains"
160
+ }
161
+ export type PostingRequirementDisplayRule = {
162
+ show: PostingRequirementDisplayRuleShow[]
163
+ }
164
+ export type PostingRequirementAutocompleteParametersSourceSingle = {
165
+ field?: string
166
+ facet?: string
167
+ }
168
+ export type PostingRequirementAutocompleteParametersSourceMultiple = {
169
+ [key: string]:
170
+ | PostingRequirementAutocompleteParametersSourceSingle
171
+ | PostingRequirementAutocompleteParametersSourceSingle[]
172
+ }
173
+ export type PostingRequirementParametersSource =
174
+ | PostingRequirementAutocompleteParametersSourceSingle
175
+ | PostingRequirementAutocompleteParametersSourceMultiple
176
+ export type PostingRequirementAutocomplete = {
177
+ required_parameters: string[] | null
178
+ parameters_source: PostingRequirementParametersSource | null
179
+ }
180
+ export type PostingRequirementGroup = {
181
+ id: string
182
+ name: string
183
+ sort: number
184
+ }
185
+ export type PostingRequirement = {
186
+ name: string
187
+ label: string
188
+ description?: string
189
+ display_rules: PostingRequirementDisplayRule | null
190
+ autocomplete: PostingRequirementAutocomplete | null
191
+ options: PostingRequirementOption[] | null
192
+ message?: string | null
193
+ required: boolean
194
+ sort: string
195
+ type: PostingRequirementType
196
+ rules?: PostingRequirementRule[] | null
197
+ group_id?: string | number
198
+ }
199
+ export type PostingRequirementLabelsMap = Record<string, string>
200
+ export type PostingRequirementOptionRequiresField = {
201
+ field: {
202
+ name: string
203
+ }
204
+ }
205
+ export type PostingRequirementOption = {
206
+ default?: string
207
+ key: string
208
+ label: string
209
+ data?: any[]
210
+ labels?: Record<"default", string>
211
+ sort: string
212
+ parent?: string
213
+ requires?: PostingRequirementOptionRequiresField[] | null
214
+ show?: string[]
215
+ }
216
+ export type TransformedPostingRequirementOption = {
217
+ value?: string
218
+ data?: any[]
219
+ requires?: PostingRequirementOptionRequiresField[] | null
220
+ label: string
221
+ show?: string[]
222
+ }
223
+ export type PostingRequirementReactiveDescription = { description: string }
224
+ export type TransformedPostingRequirement = Omit<
225
+ PostingRequirement,
226
+ "options"
227
+ > & {
228
+ options: TransformedPostingRequirementOption[] | null
229
+ }
230
+ export type Facet = {}
231
+ export type PostingRequirementsAutocompleteRequestOption = {
232
+ key: string
233
+ value: string | string[]
112
234
  }
@@ -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<
@@ -71,7 +77,7 @@ export type ZodContract = ZodObject<{
71
77
  channel: ZodOptional<ZodContractChannel>
72
78
  alias: ZodContractAlias
73
79
  channel_id: ZodNumber
74
- class_name: ZodString
80
+ class_name: ZodNullable<ZodString>
75
81
  contract_id: ZodString
76
82
  customer_id: ZodString
77
83
  facets: ZodContractFacets
@@ -1,3 +1,4 @@
1
1
  // created from 'create-ts-index'
2
2
 
3
3
  export * from "./state.types"
4
+ export type { HapiDebuggingLogs } from "./types"
@@ -0,0 +1,16 @@
1
+ import { WindowHapiService } from "../_window/service.types"
2
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
3
+ import { HapiDebuggingLogs } from "./types"
4
+ import { WindowHapiEventCommand, WindowHapiEventListener } from "../common"
5
+
6
+ export type WindowHapiServiceDebugging = WindowHapiModuleWithConstructorArgs<
7
+ {
8
+ logs: HapiDebuggingLogs
9
+ addStateEventToLogs: (eventCommand: WindowHapiEventCommand) => void
10
+ addNonStateEventToLogs: (eventCommand: WindowHapiEventCommand) => void
11
+ addListenerToLogs: (
12
+ eventCommand: WindowHapiEventCommand | WindowHapiEventListener,
13
+ ) => void
14
+ },
15
+ { readonly service: WindowHapiService }
16
+ >
@@ -4,4 +4,8 @@ export type DebuggingState = {
4
4
  componentDebuggingIsEnabled: boolean
5
5
  consoleLogsAreEnabled: boolean
6
6
  isAIFeaturesEnabled: boolean
7
+ isCollectingLogs: boolean
8
+ isReplayingLogs: boolean
9
+ logReplayIndex: number
10
+ restoreLogs: any
7
11
  }
@@ -0,0 +1,17 @@
1
+ import { WindowHapiConfigSubmodule, WindowHapiInjectorConfig } from "../_window"
2
+
3
+ export type HapiDebuggingLogs = {
4
+ navigator: Record<string, any> | undefined
5
+ config: WindowHapiConfigSubmodule | undefined
6
+ injectorConfig: WindowHapiInjectorConfig | undefined
7
+ timestamps: {
8
+ timeStart: Date | undefined
9
+ timeFinish: Date | undefined
10
+ }
11
+ stateTimeline: any[]
12
+ nonStateTimeline: any[]
13
+ listenersTimeline: any[]
14
+ listeners: any[]
15
+ state: any | undefined
16
+ instances: any[]
17
+ }
package/modal/enums.ts CHANGED
@@ -8,9 +8,11 @@ export enum ModalKeys {
8
8
  basket = "layout-basket-modal",
9
9
  productInfo = "product-info",
10
10
  campaignTakeOfflineConfirmation = "campaign-confirm-take-offline",
11
+ campaignProductTakeOfflineConfirmation = "campaign-product-confirm-take-offline",
11
12
  campaignCopyJourney = "campaign-confirm-copy",
12
13
  campaignStatusDetail = "campaign-status-detail",
13
14
  campaignCopySelection = "contract-copy-selection",
15
+ campaignEdit = "campaign-edit",
14
16
  basketRemoveProductConfirmation = "remove-product-from-basket",
15
17
  contractRemoveConfirmation = "contract-remove-confirmation",
16
18
  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
@@ -14,6 +17,10 @@ export type BasketRemoveProductConfirmationModalProps = {
14
17
  basketProduct: Product | Contract
15
18
  }
16
19
  export type CampaignTakeOfflineConfirmationModalProps = { campaignId: string }
20
+ export type CampaignProductTakeOfflineConfirmationModalProps = {
21
+ campaignId: string
22
+ productId: string
23
+ }
17
24
  export type ContractRemoveConfirmationModalProps = { contractId: string }
18
25
  export type ContractGroupConflictInfoModalProps = {
19
26
  contract: Contract
@@ -23,6 +30,9 @@ export type CampaignCopySelectionModalProps = {
23
30
  products: (Product | Contract)[]
24
31
  campaign: Campaign
25
32
  }
33
+ export type CampaignEditModalProps = {
34
+ campaign?: Campaign
35
+ }
26
36
  export type ContractPostingRequirementsSmartFillResponseModalProps = {
27
37
  response: Record<string, any>
28
38
  postingRequirements: Record<string, TransformedPostingRequirement>
@@ -33,9 +43,23 @@ export type FilePickerOptions = {
33
43
  uploadInBackground?: boolean
34
44
  maxFiles?: number
35
45
  maxSize?: number
46
+ displayMode?: PickerDisplayMode
47
+ container?: string
48
+ containerProps?: HapiBoxProps
49
+ imageMax?: [number, number]
50
+ imageMin?: [number, number]
51
+ showTransformations?: boolean
52
+ }
53
+ export type BasketModalProps = {
54
+ canDeleteProducts?: boolean
55
+ showDeliveryTime?: boolean
56
+ showAmounts?: boolean
57
+ }
58
+ export type WalletModalProps = {
59
+ showBalance?: boolean
60
+ paymentMethod: OrderJourneyPaymentMethod | null
36
61
  }
37
- export type BasketModalProps = {}
38
- export type WalletModalProps = {}
62
+ export type WalletPurchaseOrderModalProps = {}
39
63
  export type TalentMindEvaluateJobWithResumeModalProps = {
40
64
  resume: TalentMindResume
41
65
  }
@@ -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>
@@ -45,10 +47,34 @@ export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
45
47
  setContractStepsErrorMessages: (
46
48
  messages: Record<
47
49
  string,
48
- Record<string, MessageDescriptor | boolean>
50
+ Record<
51
+ string,
52
+ MessageDescriptor | MessageDescriptor[] | boolean
53
+ >
49
54
  >,
50
55
  ) => void
51
56
  setContractStepsSubmittedSteps: (steps: Record<string, boolean>) => void
57
+ setContractStepsValidators: (
58
+ validators: NestedValidatorKeys,
59
+ replaceAsIs: boolean,
60
+ ) => void
61
+ setProductStepsBlurredFields: (
62
+ fields: Record<string, Record<string, boolean>>,
63
+ ) => Record<string, UseValidatorResult> | null
64
+ setProductStepsErrorMessages: (
65
+ messages: Record<
66
+ string,
67
+ Record<
68
+ string,
69
+ MessageDescriptor | MessageDescriptor[] | boolean
70
+ >
71
+ >,
72
+ ) => void
73
+ setProductStepsSubmittedSteps: (steps: Record<string, boolean>) => void
74
+ setProductStepsValidators: (
75
+ validators: NestedValidatorKeys,
76
+ replaceAsIs: boolean,
77
+ ) => void
52
78
  getSetters: (
53
79
  steps: Record<string, boolean>,
54
80
  ) => Record<string, (step: OrderJourneyStep) => any>
@@ -5,6 +5,9 @@ import {
5
5
  OrderJourneyUTMStepData,
6
6
  OrderJourneyUTMStepValidations,
7
7
  OrderJourneyOrderReviewStepData,
8
+ OrderJourneyProductStep,
9
+ OrderJourneyOrderErrors,
10
+ OrderJourneyOrderConfirmationStepData,
8
11
  } from "./types"
9
12
  import { MessageDescriptor } from "react-intl"
10
13
  import { NestedValidatorKeys, UseValidatorResult } from "../common/types"
@@ -25,7 +28,7 @@ export type OrderJourneyState = {
25
28
  paymentMethodsAvailable: OrderJourneyPaymentMethod[]
26
29
  paymentMethodsEnabled: OrderJourneyPaymentMethod[]
27
30
  hidePrefilledFields: boolean
28
- orderErrors: Record<string, any> | null
31
+ orderErrors: OrderJourneyOrderErrors | null
29
32
  /* Onboarding */
30
33
  onboardingStep: OrderJourneyStep
31
34
  onboardingStepData: Record<string, any>
@@ -80,11 +83,22 @@ export type OrderJourneyState = {
80
83
  contractStepsSubmittedSteps: Record<string, boolean>
81
84
  contractStepsErrorMessages: Record<
82
85
  string,
83
- Record<string, MessageDescriptor>
86
+ Record<string, MessageDescriptor | MessageDescriptor[]>
84
87
  >
85
88
  contractStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
86
89
  contractStepsData: Record<string, Record<string, any>>
87
90
  contractStepsValidations: Record<string, UseValidatorResult> | null
91
+ /* Product Fields */
92
+ productSteps: OrderJourneyProductStep[]
93
+ productStepsBlurredFields: Record<string, Record<string, boolean>>
94
+ productStepsSubmittedSteps: Record<string, boolean>
95
+ productStepsErrorMessages: Record<
96
+ string,
97
+ Record<string, MessageDescriptor | MessageDescriptor[]>
98
+ >
99
+ productStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
100
+ productStepsData: Record<string, Record<string, any>>
101
+ productStepsValidations: Record<string, UseValidatorResult> | null
88
102
  /* UTM Codes */
89
103
  utmCodesStep: OrderJourneyStep
90
104
  utmCodesStepData: OrderJourneyUTMStepData
@@ -99,6 +113,6 @@ export type OrderJourneyState = {
99
113
  paymentMethodStepValidations: UseValidatorResult
100
114
  /* Order Confirmation */
101
115
  orderConfirmationStep: OrderJourneyStep
102
- orderConfirmationStepData: Record<string, any>
116
+ orderConfirmationStepData: OrderJourneyOrderConfirmationStepData
103
117
  orderConfirmationStepValidations: UseValidatorResult
104
118
  }
@@ -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,41 @@ export type OrderJourneyUTMStepValidations = {
61
66
 
62
67
  export type OrderJourneyOrderReviewStepData = {
63
68
  accordionsOpen: OrderJourneyStepKey[]
69
+ accordionsEnabled: OrderJourneyStepKey[]
70
+ }
71
+
72
+ export type OrderJourneyOrderConfirmationStepData = {
73
+ disclaimerTexts: string[]
64
74
  }
75
+
76
+ export type OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid =
77
+ {
78
+ errors: {
79
+ orderedProducts: Record<string, any>[]
80
+ orderedProductsSpecs: Partial<{
81
+ credentials: Record<string, any>
82
+ posting_requirements: Record<string, any>
83
+ postingRequirements?: string[]
84
+ }>[]
85
+ walletId?: string
86
+ }
87
+ has_errors: boolean
88
+ }
89
+
90
+ export type OrderJourneyOrderErrorsCampaignIsInvalid = {
91
+ postingDetails: Record<string, any>
92
+ recruiterInfo: Record<string, any>
93
+ targetGroup: Record<string, any>
94
+ orderedProducts: string[]
95
+ orderedProductsSpecs?: any[]
96
+ walletId: string
97
+ }
98
+
99
+ // HAPI Backend validation works in this order:
100
+ // - it validates the campaign first, if campaign itself is not valid, it does not validate the posting requirements at all
101
+ // - if campaign is valid, then it validates posting requirements
102
+ // because of this, the response BE sends changes
103
+ // backend does not validate the entire form in one go
104
+ export type OrderJourneyOrderErrors =
105
+ | OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid
106
+ | OrderJourneyOrderErrorsCampaignIsInvalid
@@ -36,6 +36,12 @@ 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
+ >
42
+ }>
43
+ export type ZodOrderJourneyOrderConfirmationStepData = ZodObject<{
44
+ disclaimerTexts: ZodArray<ZodString>
39
45
  }>
40
46
  export type WindowHapiValidationsOrderJourney = {
41
47
  supportedStepKeys: OrderJourneyStepKey[]
@@ -52,4 +58,5 @@ export type WindowHapiValidationsOrderJourney = {
52
58
  utmMaps: ZodOrderJourneyUTMCodeMaps
53
59
  utmCodesStepData: ZodOrderJourneyUTMCodesStepData
54
60
  orderReviewStepData: ZodOrderJourneyOrderReviewStepData
61
+ orderConfirmationStepData: ZodOrderJourneyOrderConfirmationStepData
55
62
  }
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.20.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,12 @@ export enum ProductPriceCurrency {
10
10
  "GBP" = "GBP",
11
11
  "AUD" = "AUD",
12
12
  }
13
+
14
+ export enum ProductSortBy {
15
+ "recommendedFirst" = "recommendedFirst",
16
+ "relevant" = "relevant",
17
+ "createdNewestToOldest" = "created.desc",
18
+ "createdOldestToNewest" = "created.asc",
19
+ "priceHighToLow" = "list_price.desc",
20
+ "priceLowToHigh" = "list_price.asc",
21
+ }