@vonq/hapi-elements-types 1.28.0 → 1.30.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.
@@ -16,8 +16,10 @@ import {
16
16
  } from "./window"
17
17
  import { WindowHapiLogger } from "../common/logger/types"
18
18
  import { ATSUserTokenResponse } from "../ats"
19
+ import { PartialRecord } from "../common"
20
+ import { WindowHapiAPIExperimental } from "../experimental"
19
21
 
20
- export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
22
+ export type WindowHapiAPIModule<ModuleRequests, ModuleConfig> = {
21
23
  propertiesThatShouldNotBeDocumented: string[]
22
24
  logger: WindowHapiLogger
23
25
  configs: ModuleConfig
@@ -27,7 +29,11 @@ export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
27
29
  resourceKey: keyof ModuleConfig,
28
30
  config: RawAxiosRequestConfig,
29
31
  ) => void
30
- } & ModuleType
32
+ abortControllers: PartialRecord<
33
+ keyof ModuleRequests,
34
+ Map<RawAxiosRequestConfig, AbortController>
35
+ >
36
+ } & ModuleRequests
31
37
  export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
32
38
  headers?: any
33
39
  }
@@ -43,6 +49,17 @@ export type WindowHapiAPIRefreshJWTTokenHandler = () => Promise<
43
49
 
44
50
  export type WindowHapiAPIValidateJWTTokenHandler = () => Promise<boolean>
45
51
 
52
+ export type WindowHapiAPIModules = {
53
+ [WindowHapiModuleName.contract]: WindowHapiAPIContract
54
+ [WindowHapiModuleName.wallet]: WindowHapiAPIWallet
55
+ [WindowHapiModuleName.product]: WindowHapiAPIProduct
56
+ [WindowHapiModuleName.campaign]: WindowHapiAPICampaign
57
+ [WindowHapiModuleName.ats]: WindowHapiAPIATS
58
+ [WindowHapiModuleName.experimental]: WindowHapiAPIExperimental
59
+ }
60
+
61
+ type Test = WindowHapiAPIModules[keyof WindowHapiAPIModules]
62
+
46
63
  export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
47
64
  {
48
65
  /* Common */
@@ -60,6 +77,21 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
60
77
  request: <T = any, R = AxiosResponse<T>, D = any>(
61
78
  config: Partial<HapiRequestConfig<D>>,
62
79
  ) => Promise<R>
80
+ requestAbortable: <
81
+ ModuleKlass extends WindowHapiAPIModule<
82
+ ModuleRequests,
83
+ ModuleConfig
84
+ >,
85
+ ModuleRequests,
86
+ ModuleConfig,
87
+ T = any,
88
+ R = AxiosResponse<T>,
89
+ D = any,
90
+ >(
91
+ moduleKlass: WindowHapiAPIModule<any, any>,
92
+ functionName: keyof ModuleRequests,
93
+ config: Partial<HapiRequestConfig<D>>,
94
+ ) => Promise<R>
63
95
  jwtHeaderKey: string
64
96
  jwtRefreshIntervalInSeconds: number
65
97
  setJWTRefreshIntervalInSeconds: (seconds: number) => void
@@ -84,18 +116,7 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
84
116
  endpoint: string,
85
117
  data?: any,
86
118
  ) => Promise<any>
87
- [WindowHapiModuleName.contract]: WindowHapiAPIContract
88
- [WindowHapiModuleName.wallet]: WindowHapiAPIWallet
89
- [WindowHapiModuleName.product]: WindowHapiAPIProduct
90
- [WindowHapiModuleName.campaign]: WindowHapiAPICampaign
91
- [WindowHapiModuleName.ats]: WindowHapiAPIATS
92
- modules: {
93
- [WindowHapiModuleName.contract]: WindowHapiAPIContract
94
- [WindowHapiModuleName.wallet]: WindowHapiAPIWallet
95
- [WindowHapiModuleName.product]: WindowHapiAPIProduct
96
- [WindowHapiModuleName.campaign]: WindowHapiAPICampaign
97
- [WindowHapiModuleName.ats]: WindowHapiAPIATS
98
- }
99
- },
119
+ modules: WindowHapiAPIModules
120
+ } & WindowHapiAPIModules,
100
121
  { readonly core: WindowHapiClassInterface }
101
122
  >
@@ -17,6 +17,7 @@ export type WindowHapiRouting = WindowHapiModuleWithConstructorArgs<
17
17
  changeHref: (href: string) => void
18
18
  setOrigin: (origin: string) => void
19
19
  setQueryParams: (params: WindowHapiRoutingQueryParams) => void
20
+ getRootHref: () => string
20
21
  onRouteChange: () => void
21
22
  onAfterSetQueryParams: () => void
22
23
  },
@@ -46,6 +46,11 @@ import { WindowHapiQA } from "./qa.types"
46
46
  import { WindowHapiServiceDebugging } from "../debugging/service.types"
47
47
  import { WindowHapiServiceLanguage } from "../language/service.types"
48
48
  import { WindowHapiUtilsLanguage } from "../language/utils.types"
49
+ import {
50
+ WindowHapiAPIExperimental,
51
+ WindowHapiServiceExperimental,
52
+ } from "../experimental"
53
+ import { ExperimentalState } from "../experimental/state.types"
49
54
 
50
55
  export type WindowHapiSDKModule<
51
56
  APIModule,
@@ -54,6 +59,7 @@ export type WindowHapiSDKModule<
54
59
  StateModule,
55
60
  UtilsModule = any,
56
61
  > = {
62
+ isHiddenOnDocumentation?: boolean
57
63
  api?: APIModule
58
64
  state?: StateModule
59
65
  service?: ServiceModule
@@ -139,6 +145,12 @@ export type WindowHapiSDKATS = WindowHapiSDKModule<
139
145
  undefined,
140
146
  WindowHapiStateModule<ATSState>
141
147
  >
148
+ export type WindowHapiSDKExperimental = WindowHapiSDKModule<
149
+ WindowHapiAPIExperimental,
150
+ WindowHapiServiceExperimental,
151
+ undefined,
152
+ WindowHapiStateModule<ExperimentalState>
153
+ >
142
154
 
143
155
  export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
144
156
  {
@@ -154,6 +166,7 @@ export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
154
166
  [WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
155
167
  [WindowHapiModuleName.alert]: WindowHapiSDKAlert
156
168
  [WindowHapiModuleName.ui]: WindowHapiSDKUI
169
+ [WindowHapiModuleName.experimental]: WindowHapiSDKExperimental
157
170
  },
158
171
  { readonly core: WindowHapiClassInterface }
159
172
  >
@@ -16,6 +16,7 @@ import { WindowHapiLogger } from "../common/logger/types"
16
16
  import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
17
17
  import { WindowHapiServiceDebugging } from "../debugging/service.types"
18
18
  import { WindowHapiServiceLanguage } from "../language/service.types"
19
+ import { WindowHapiServiceExperimental } from "../experimental"
19
20
 
20
21
  export type HapiServiceFunctionLifecycleHookCallbackHandler = (
21
22
  ...args: any[]
@@ -23,6 +24,7 @@ export type HapiServiceFunctionLifecycleHookCallbackHandler = (
23
24
 
24
25
  export type HapiServiceFunctionLifecycleHookHandler = (
25
26
  callback: HapiServiceFunctionLifecycleHookCallbackHandler,
27
+ runArgs?: any[],
26
28
  ) => void
27
29
 
28
30
  export type HapiServiceFunctionWithLifecycleHooks<HandlerType> = {
@@ -56,6 +58,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
56
58
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
57
59
  [WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
58
60
  [WindowHapiModuleName.language]: WindowHapiServiceLanguage
61
+ [WindowHapiModuleName.experimental]: WindowHapiServiceExperimental
59
62
  services: {
60
63
  [WindowHapiModuleName.alert]: WindowHapiServiceAlert
61
64
  [WindowHapiModuleName.basket]: WindowHapiServiceBasket
@@ -69,6 +72,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
69
72
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
70
73
  [WindowHapiModuleName.debugging]: WindowHapiServiceDebugging
71
74
  [WindowHapiModuleName.language]: WindowHapiServiceLanguage
75
+ [WindowHapiModuleName.experimental]: WindowHapiServiceExperimental
72
76
  }
73
77
 
74
78
  decorateFunctionWithLifecycleEvents: <HandlerType extends Function>(
@@ -26,6 +26,7 @@ import { WindowHapiValidationsTheming } from "../theming/validations.types"
26
26
  import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.types"
27
27
  import { WindowHapiValidationsWallet } from "../wallet/validations.types"
28
28
  import { WindowHapiValidations } from "./validation.types"
29
+ import { ExperimentalState } from "../experimental/state.types"
29
30
 
30
31
  export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
31
32
  {
@@ -41,11 +42,13 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
41
42
  [WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
42
43
  [WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
43
44
  [WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
45
+ [WindowHapiModuleName.experimental]: WindowHapiStateModule<ExperimentalState>
44
46
  basePropertiesThatShouldNotBeDocumented: string[]
45
47
  handleDefaultStateFromQueryParams: (params: string | string[]) => void
46
48
  rehydrateInitialState: (
47
49
  initialState: Record<string, any>,
48
50
  getStateModuleName?: (storeName: string) => string,
51
+ throwError?: boolean,
49
52
  ) => void
50
53
  onBeforeStateChange: () => void
51
54
  onAfterStateChange: () => void
@@ -62,7 +65,11 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
62
65
  [WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
63
66
  [WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
64
67
  [WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
68
+ [WindowHapiModuleName.experimental]: WindowHapiStateModule<ExperimentalState>
65
69
  }
70
+ saveStateSnapshot: () => string
71
+ restoreStateSnapshot: (snapshotId: string) => void
72
+ cleanStateSnapshot: (snapshotId: string) => void
66
73
  toJSON: Record<string, any>
67
74
  },
68
75
  { readonly core: WindowHapiClassInterface }
@@ -81,6 +88,7 @@ export type WindowHapiStatesJSON = {
81
88
  [WindowHapiModuleName.wallet]: WalletState
82
89
  [WindowHapiModuleName.modal]: ModalState
83
90
  [WindowHapiModuleName.ats]: ATSState
91
+ [WindowHapiModuleName.experimental]: ExperimentalState
84
92
  }
85
93
 
86
94
  export type WindowHapiStateBase<T> = {
@@ -17,6 +17,9 @@ export type WindowHapiUI = WindowHapiModuleWithConstructorArgs<
17
17
  ) => void
18
18
  toggleModal: () => void
19
19
  toggleAlertbar: () => void
20
+ addModalElementToBody: (element: HTMLDivElement) => void
21
+ removeModalElementFromBody: () => void
22
+ getModalElement: () => HTMLDivElement
20
23
  },
21
24
  { readonly core: WindowHapiClassInterface }
22
25
  >
@@ -8,7 +8,7 @@ import {
8
8
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
9
9
 
10
10
  export type BasketServiceGetProductsHandler = (
11
- products?: BasketProduct[],
11
+ products: BasketProduct[],
12
12
  shouldSet?: boolean,
13
13
  ) => Promise<(Product | Contract)[]>
14
14
  export type BasketServiceAddProductOrContractByIdHandler = (
@@ -25,13 +25,14 @@ export type BasketServiceRemoveContractsWithConflictingGroupsHandler = (
25
25
  export type BasketServiceKeepContractsWithConflictingGroupsHandler = () => void
26
26
  export type BasketServiceSetProductsMetaHandler = (
27
27
  meta: BasketProduct[],
28
- ) => Promise<(Product | Contract)[]>
28
+ ) => void
29
29
 
30
30
  export type WindowHapiServiceBasket = WindowHapiModuleWithConstructorArgs<
31
31
  {
32
32
  onAfterGetBasketData: (
33
33
  basketItemData: (Contract | Product)[],
34
- shouldSet: boolean,
34
+ shouldSet?: boolean,
35
+ shouldSetMeta?: boolean,
35
36
  ) => BasketProduct[]
36
37
  setProductsMeta: BasketServiceSetProductsMetaHandler
37
38
  getProducts: HapiServiceFunctionWithLifecycleHooks<BasketServiceGetProductsHandler>
@@ -90,6 +90,7 @@ export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
90
90
  onAfterOrderCampaignSuccess: (
91
91
  alertKey?: AlertKey,
92
92
  disclaimerTexts?: string[],
93
+ isSuccessFromEditing?: boolean,
93
94
  ) => void
94
95
  validateContractPostingRequirementsWithCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateContractPostingRequirementsWithCampaignHandler>
95
96
  saveCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSaveCampaignHandler>
package/campaign/types.ts CHANGED
@@ -227,6 +227,7 @@ export type CampaignCreateForm = {
227
227
  orderedProducts: string[] //Array of UUIDs
228
228
  orderedProductsSpecs: Record<string, CampaignCreateFormOrderedProductSpec>
229
229
  orderedProductsSpecsLabels?: Record<string, PostingRequirementLabelsMap>
230
+ heStateSnapshotId?: string
230
231
  }
231
232
 
232
233
  export type CampaignEditForm = Omit<
@@ -239,6 +240,7 @@ export type CampaignEditForm = Omit<
239
240
  | "postingDetails"
240
241
  | "orderedProductsSpecs"
241
242
  | "orderedProductsSpecsLabels"
243
+ | "heStateSnapshotId"
242
244
  > & {
243
245
  campaignId: string
244
246
  postingDetails: Omit<
@@ -27,6 +27,7 @@ import {
27
27
  import {
28
28
  FormFacetsFieldType,
29
29
  PostingRequirement,
30
+ PostingRequirementLabelsMap,
30
31
  TransformedPostingRequirement,
31
32
  } from "../common"
32
33
 
@@ -64,6 +65,10 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
64
65
  string,
65
66
  CampaignCreateFormOrderedProductSpec
66
67
  >,
68
+ orderedProductsSpecsLabels?: Record<
69
+ string,
70
+ PostingRequirementLabelsMap
71
+ >,
67
72
  ) => CampaignOrderRequestBodyOrderedProductsSpec[]
68
73
  getPostBodyForOrderedProductsSpecsPostingRequirement: (
69
74
  postingRequirement: any,
package/common/enums.ts CHANGED
@@ -33,6 +33,7 @@ export enum WindowHapiModuleName {
33
33
  alert = "alert",
34
34
  modal = "modal",
35
35
  "ui" = "ui",
36
+ "experimental" = "experimental",
36
37
  }
37
38
 
38
39
  export enum WindowHapiSDKModuleName {
@@ -1,6 +1,9 @@
1
1
  export enum WindowHapiEventCommandName {
2
2
  /* State */
3
3
  stateHydrate = "state:hydrate",
4
+ stateSnapshotSave = "state:snapshot-save",
5
+ stateSnapshotRestore = "state:snapshot-restore",
6
+ stateSnapshotClean = "state:snapshot-clean",
4
7
 
5
8
  /* Service */
6
9
  serviceLoad = "service:load",
@@ -24,6 +27,9 @@ export enum WindowHapiEventCommandName {
24
27
  /* API */
25
28
  apiRequest = "api:request",
26
29
 
30
+ /* Routing */
31
+ routingRequest = "routing:request",
32
+
27
33
  /* QA */
28
34
  qaRequest = "qa:request",
29
35
 
package/common/types.ts CHANGED
@@ -131,7 +131,6 @@ export type PostingRequirementType =
131
131
  | "TEXTAREA"
132
132
  | "AUTOCOMPLETE"
133
133
  | "STATISCH"
134
- | "FILE-URL"
135
134
  | "HTMLAREA"
136
135
 
137
136
  export type PostingRequirementRuleName =
@@ -151,13 +150,8 @@ export type PostingRequirementRuleName =
151
150
  | "before"
152
151
  | "after"
153
152
  | "url"
154
- | "fileMimeType"
155
- | "fileMimeSubType"
156
- | "editorTest"
157
- | "libraryTest"
158
153
  | "autocomplete"
159
- | "statictype"
160
- | "staticsubtype"
154
+ | "mimetype"
161
155
 
162
156
  export type PostingRequirementRule = {
163
157
  rule: PostingRequirementRuleName
@@ -177,7 +171,7 @@ export type PostingRequirementDisplayRuleShowOperand =
177
171
 
178
172
  export type PostingRequirementDisplayRuleShow = {
179
173
  facet: string
180
- value: any
174
+ value: null | string | string[]
181
175
  op: PostingRequirementDisplayRuleShowOperand
182
176
  }
183
177
  export type PostingRequirementDisplayRule = {
@@ -199,11 +193,6 @@ export type PostingRequirementAutocomplete = {
199
193
  required_parameters: string[] | null
200
194
  parameters_source: PostingRequirementParametersSource | null
201
195
  }
202
- export type PostingRequirementGroup = {
203
- id: string
204
- name: string
205
- sort: number
206
- }
207
196
  export type PostingRequirement = {
208
197
  name: string
209
198
  label: string
@@ -228,7 +217,7 @@ export type PostingRequirementOptionRequiresField = {
228
217
  }
229
218
  export type PostingRequirementOption = {
230
219
  default?: string
231
- key: string
220
+ key: string | number
232
221
  label: string
233
222
  data?: PostingRequirementOptionData
234
223
  labels?: Record<"default", string>
@@ -248,13 +237,12 @@ export type PostingRequirementOptionData = {
248
237
  images?: PostingRequirementOptionDataImage[]
249
238
  }
250
239
  export type TransformedPostingRequirementOption = {
251
- value?: string
240
+ value?: string | number
252
241
  data?: PostingRequirementOptionData
253
242
  requires?: PostingRequirementOptionRequiresField[] | null
254
243
  label: string
255
244
  show?: string[]
256
245
  }
257
- export type PostingRequirementReactiveDescription = { description: string }
258
246
  export type TransformedPostingRequirement = Omit<
259
247
  PostingRequirement,
260
248
  "options"
@@ -282,14 +270,10 @@ export type FormFacetsFieldType =
282
270
  | "heading"
283
271
  | "file-upload"
284
272
  | "unknown"
285
- export type ContractPostingRequirementFieldAutocompleteRequestOption = {
286
- key: string
287
- value: string | string[]
288
- }
289
- export type ProductPostingRequirementFieldAutocompleteRequestOption = {
290
- key: string
291
- value: string | string[]
292
- }
273
+
274
+ // keep this for backwards compatability
275
+ export type ContractPostingRequirementFieldAutocompleteRequestOption =
276
+ PostingRequirementsAutocompleteRequestOption
293
277
 
294
278
  export type HapiFeatureBranch = {
295
279
  name: string
@@ -1,5 +1,6 @@
1
1
  export type Validators = {
2
2
  isNotEmpty: (value: string | Record<string, any> | any[]) => boolean
3
+ isNotEmptyObject: (value: Object | undefined | null) => boolean
3
4
  isNotZero: (value: number) => boolean
4
5
  isHandledByBackend: (value: any) => false
5
6
  }
package/contract/types.ts CHANGED
@@ -67,6 +67,7 @@ export type Contract = {
67
67
  posting_duration_days: number | null
68
68
  group: ContractGroup | null
69
69
  posting_requirements_defaults: Record<string, string | string[]> | null
70
+ errors?: string[]
70
71
  }
71
72
 
72
73
  export type ContractGroup = {
@@ -92,6 +92,7 @@ export type ZodContract = ZodObject<{
92
92
  product: ZodContractProduct
93
93
  purchase_price: ZodNullable<ZodContractPurchasePrice>
94
94
  group: ZodNullable<ZodContractGroup>
95
+ errors: ZodOptional<ZodArray<ZodString>>
95
96
  }>
96
97
  export type WindowHapiValidationsContract = {
97
98
  channel: ZodContractChannel
@@ -0,0 +1,73 @@
1
+ import { RawAxiosRequestConfig } from "axios"
2
+ import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
3
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+ import { AxiosRequestConfig } from "axios/index"
5
+ import { PostingRequirement } from "../common"
6
+ import {
7
+ ExperimentalSuggestionCreateRequestData,
8
+ ExperimentalSuggestionGetResponseData,
9
+ ExperimentalSuggestionPostingRequirementsCreateRequestPayload,
10
+ ExperimentalSuggestionPostingRequirementsGetResponseData,
11
+ ExperimentalSuggestionVacancyFieldsCreateRequestPayload,
12
+ ExperimentalSuggestionVacancyFieldsGetResponseData,
13
+ } from "./types"
14
+
15
+ export type WindowHapiAPIExperimentalConfigs = {
16
+ getExperimental: RawAxiosRequestConfig
17
+ getPostingRequirementOptions: AxiosRequestConfig
18
+ getPostingRequirements: AxiosRequestConfig
19
+ getSuggestionOfPostingRequirements: AxiosRequestConfig
20
+ getSuggestionOfVacancyFields: AxiosRequestConfig
21
+ createSuggestionOfPostingRequirements: AxiosRequestConfig
22
+ createSuggestionOfVacancyFields: AxiosRequestConfig
23
+ }
24
+ export type WindowHapiAPIExperimentalRequests = {
25
+ getExperimental: () => Promise<any>
26
+ getPostingRequirementOptions: (
27
+ productId: string,
28
+ fieldName: string,
29
+ autocompleteRequestOptions: Record<string, string | string[]>,
30
+ ) => Promise<any>
31
+ getPostingRequirements: (
32
+ productId: string | number,
33
+ ) => Promise<PostingRequirement[]>
34
+ createSuggestionOfPostingRequirements: (
35
+ payload: ExperimentalSuggestionCreateRequestData<ExperimentalSuggestionPostingRequirementsCreateRequestPayload>,
36
+ ) => Promise<
37
+ ExperimentalSuggestionGetResponseData<
38
+ ExperimentalSuggestionPostingRequirementsCreateRequestPayload,
39
+ ExperimentalSuggestionPostingRequirementsGetResponseData
40
+ >
41
+ >
42
+ createSuggestionOfVacancyFields: (
43
+ payload: ExperimentalSuggestionCreateRequestData<ExperimentalSuggestionVacancyFieldsCreateRequestPayload>,
44
+ ) => Promise<
45
+ ExperimentalSuggestionGetResponseData<
46
+ ExperimentalSuggestionVacancyFieldsCreateRequestPayload,
47
+ ExperimentalSuggestionVacancyFieldsGetResponseData
48
+ >
49
+ >
50
+ getSuggestionOfPostingRequirements: (
51
+ suggestionId: string,
52
+ ) => Promise<
53
+ ExperimentalSuggestionGetResponseData<
54
+ ExperimentalSuggestionPostingRequirementsCreateRequestPayload,
55
+ ExperimentalSuggestionPostingRequirementsGetResponseData
56
+ >
57
+ >
58
+ getSuggestionOfVacancyFields: (
59
+ suggestionId: string,
60
+ ) => Promise<
61
+ ExperimentalSuggestionGetResponseData<
62
+ ExperimentalSuggestionVacancyFieldsCreateRequestPayload,
63
+ ExperimentalSuggestionVacancyFieldsGetResponseData
64
+ >
65
+ >
66
+ }
67
+ export type WindowHapiAPIExperimental = WindowHapiModuleWithConstructorArgs<
68
+ WindowHapiAPIModule<
69
+ WindowHapiAPIExperimentalRequests,
70
+ WindowHapiAPIExperimentalConfigs
71
+ >,
72
+ { readonly api: WindowHapiAPI }
73
+ >
@@ -0,0 +1,8 @@
1
+ export enum ExperimentalModalKeys {
2
+ contractPostingRequirementsSmartFillSuccess = "__experimental-contract-posting-requirements-smart-fill-success",
3
+ campaignVacancyFieldsSmartFillSuccess = "__experimental-campaign-vacancy-fields-smart-fill-success",
4
+ }
5
+
6
+ export enum ExperimentalFilePickerModalPropsActionFor {
7
+ productPostingRequirements = "product-posting-requirements",
8
+ }
@@ -0,0 +1,5 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./api.types"
4
+ export * from "./service.types"
5
+ export * from "./types"
@@ -0,0 +1,47 @@
1
+ import {
2
+ HapiServiceFunctionWithLifecycleHooks,
3
+ WindowHapiService,
4
+ } from "../_window/service.types"
5
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
6
+ import {
7
+ NestedValidatorKeys,
8
+ PostingRequirement,
9
+ PostingRequirementsAutocompleteRequestOption,
10
+ UseValidatorResult,
11
+ } from "../common"
12
+ import { MessageDescriptor } from "react-intl"
13
+
14
+ export type ExperimentalServiceGetProductPostingRequirementOptionsHandler = (
15
+ productId: string,
16
+ fieldName: string,
17
+ autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
18
+ ) => Promise<any>
19
+
20
+ export type ExperimentalServiceGetProductPostingRequirementsHandler = (
21
+ productId: string | number,
22
+ ) => Promise<PostingRequirement[]>
23
+
24
+ export type WindowHapiServiceExperimental = WindowHapiModuleWithConstructorArgs<
25
+ {
26
+ getExperimental: HapiServiceFunctionWithLifecycleHooks<
27
+ () => Promise<any>
28
+ >
29
+ getProductPostingRequirementOptions: HapiServiceFunctionWithLifecycleHooks<ExperimentalServiceGetProductPostingRequirementOptionsHandler>
30
+ getProductPostingRequirements: HapiServiceFunctionWithLifecycleHooks<ExperimentalServiceGetProductPostingRequirementsHandler>
31
+ setProductStepsBlurredFields: (
32
+ fields: Record<string, Record<string, boolean>>,
33
+ ) => Record<string, UseValidatorResult> | null
34
+ setProductStepsErrorMessages: (
35
+ messages: Record<
36
+ string,
37
+ Record<string, MessageDescriptor | boolean>
38
+ >,
39
+ ) => void
40
+ setProductStepsSubmittedSteps: (steps: Record<string, boolean>) => void
41
+ setProductStepsValidators: (
42
+ validators: NestedValidatorKeys,
43
+ replaceAsIs: boolean,
44
+ ) => void
45
+ },
46
+ { readonly service: WindowHapiService }
47
+ >
@@ -0,0 +1,17 @@
1
+ import { MessageDescriptor } from "react-intl"
2
+ import { NestedValidatorKeys, UseValidatorResult } from "../common"
3
+ import { OrderJourneyProductStep } from "./types"
4
+
5
+ export type ExperimentalState = {
6
+ /* Product Fields */
7
+ productSteps: OrderJourneyProductStep[]
8
+ productStepsBlurredFields: Record<string, Record<string, boolean>>
9
+ productStepsSubmittedSteps: Record<string, boolean>
10
+ productStepsErrorMessages: Record<
11
+ string,
12
+ Record<string, MessageDescriptor | MessageDescriptor[]>
13
+ >
14
+ productStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
15
+ productStepsData: Record<string, Record<string, any>>
16
+ productStepsValidations: Record<string, UseValidatorResult> | null
17
+ }
@@ -1,11 +1,6 @@
1
1
  import { RecursivePartial } from "../common"
2
2
  import { Campaign, CampaignOrderRequestBody } from "../campaign"
3
-
4
- export enum ExperimentalSuggestionEndpointName {
5
- "postingRequirements" = "posting_requirements",
6
- "vacancyFields" = "vacancy_fields",
7
- "primaryTaxonomy" = "primary_taxonomy",
8
- }
3
+ import { OrderJourneyStep } from "../orderJourney"
9
4
 
10
5
  export type ExperimentalSuggestionResponseStatus =
11
6
  | "new"
@@ -22,7 +17,7 @@ export type ExperimentalSuggestionGetResponseData<P, R> = {
22
17
  id: string
23
18
  status: ExperimentalSuggestionResponseStatus
24
19
  contract_id?: string
25
- type: ExperimentalSuggestionEndpointName
20
+ type: "posting_requirements" | "vacancy_fields" | "primary_taxonomy"
26
21
  payload: P
27
22
  response: R
28
23
  }
@@ -41,12 +36,7 @@ export type ExperimentalSuggestionVacancyFieldsCreateRequestPayload = {
41
36
 
42
37
  export type ExperimentalSuggestionVacancyFieldsGetResponseData =
43
38
  RecursivePartial<Campaign>
44
-
45
- export type ExperimentalSuggestionPrimaryTaxonomyCreateRequestPayload = {
46
- description: string
47
- }
48
-
49
- export type ExperimentalSuggestionPrimaryTaxonomyGetResponseData = Record<
50
- string,
51
- string
39
+ export type OrderJourneyProductStep = Omit<
40
+ OrderJourneyStep,
41
+ "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
52
42
  >
package/modal/enums.ts CHANGED
@@ -24,11 +24,10 @@ export enum ModalKeys {
24
24
  "mediaEditor" = "media-editor",
25
25
  "uploadWidget" = "upload-widget",
26
26
  "mediaLibrary" = "media-library",
27
- __experimentalContractPostingRequirementsSmartFillSuccess = "__experimental-contract-posting-requirements-smart-fill-success",
28
- __experimentalCampaignVacancyFieldsSmartFillSuccess = "__experimental-campaign-vacancy-fields-smart-fill-success",
29
27
  }
30
28
 
31
29
  export enum FilePickerModalPropsActionFor {
32
30
  postingOrganization = "posting-organization",
33
- postingRequirements = "posting-requirements",
31
+ productPostingRequirements = "product-posting-requirements",
32
+ contractPostingRequirements = "contract-posting-requirements",
34
33
  }
@@ -6,11 +6,12 @@ import { IObservableValue } from "mobx"
6
6
  import { AnyNonFunction } from "../common/types"
7
7
  import { WindowHapiService } from "../_window/service.types"
8
8
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
9
+ import { ExperimentalModalKeys } from "../experimental/enums"
9
10
 
10
11
  export type WindowHapiServiceModal = WindowHapiModuleWithConstructorArgs<
11
12
  {
12
13
  openModal: (
13
- key: ModalKeys,
14
+ key: ModalKeys | ExperimentalModalKeys,
14
15
  props: AnyNonFunction<
15
16
  | { product: Product }
16
17
  | {
@@ -25,7 +26,7 @@ export type WindowHapiServiceModal = WindowHapiModuleWithConstructorArgs<
25
26
  options?: ModalOptions,
26
27
  zone?: ModalZone,
27
28
  ) => void
28
- closeModal: (key: ModalKeys) => void
29
+ closeModal: (key: ModalKeys | ExperimentalModalKeys) => void
29
30
  },
30
31
  { readonly service: WindowHapiService }
31
32
  >
package/modal/types.ts CHANGED
@@ -10,6 +10,10 @@ import { Campaign } from "../campaign"
10
10
  import { OrderJourneyPaymentMethod } from "../orderJourney"
11
11
  import { PickerDisplayMode } from "filestack-js"
12
12
  import { HapiSiteTheme } from "../theming"
13
+ import {
14
+ ExperimentalFilePickerModalPropsActionFor,
15
+ ExperimentalModalKeys,
16
+ } from "../experimental/enums"
13
17
 
14
18
  export type ProductDetailModalProps = {
15
19
  id: string
@@ -78,14 +82,15 @@ export type WalletPurchaseOrderModalProps = {}
78
82
  export type FilePickerModalPropsActionDataPostingRequirements = {
79
83
  requirement: TransformedPostingRequirement
80
84
  id: string | number
81
- mimeTypesFull: string[]
82
- mimeTypesSplit?: { mimeType: string; mimeSubType: string }[]
85
+ mimetype: string[]
83
86
  }
84
87
  export type FilePickerModalPropsActionData =
85
88
  FilePickerModalPropsActionDataPostingRequirements
86
89
 
87
90
  export type FilePickerModalProps = {
88
- actionFor: FilePickerModalPropsActionFor
91
+ actionFor:
92
+ | FilePickerModalPropsActionFor
93
+ | ExperimentalFilePickerModalPropsActionFor
89
94
  actionData?: FilePickerModalPropsActionData
90
95
  }
91
96
 
@@ -113,7 +118,7 @@ export type ModalOptions = {
113
118
 
114
119
  export type Modal = {
115
120
  zone: ModalZone
116
- key: ModalKeys
121
+ key: ModalKeys | ExperimentalModalKeys
117
122
  props: ModalProps | undefined
118
123
  options: ModalOptions
119
124
  }
@@ -10,7 +10,9 @@ import { OrderJourneyStepKey } from "./enums"
10
10
 
11
11
  export type OrderJourneyServiceSwitchToNextStepHandler = () => Promise<void>
12
12
  export type OrderJourneyServiceSwitchToPreviousStepHandler = () => Promise<void>
13
- export type OrderJourneyServiceRestartJourneyHandler = () => void
13
+ export type OrderJourneyServiceRestartJourneyHandler = (
14
+ shouldResetStepBackToFirstStep?: boolean,
15
+ ) => void
14
16
 
15
17
  export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
16
18
  {
@@ -56,20 +58,7 @@ export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
56
58
  validators: NestedValidatorKeys,
57
59
  replaceAsIs: boolean,
58
60
  ) => void
59
- setProductStepsBlurredFields: (
60
- fields: Record<string, Record<string, boolean>>,
61
- ) => Record<string, UseValidatorResult> | null
62
- setProductStepsErrorMessages: (
63
- messages: Record<
64
- string,
65
- Record<string, MessageDescriptor | boolean>
66
- >,
67
- ) => void
68
- setProductStepsSubmittedSteps: (steps: Record<string, boolean>) => void
69
- setProductStepsValidators: (
70
- validators: NestedValidatorKeys,
71
- replaceAsIs: boolean,
72
- ) => void
61
+
73
62
  getSetters: (
74
63
  steps: Record<string, boolean>,
75
64
  ) => Record<string, (step: OrderJourneyStep) => any>
@@ -14,7 +14,6 @@ import {
14
14
  OrderJourneyOrderErrorsPostingDetailsURLs,
15
15
  OrderJourneyOrderErrorsPostingDetailsWorkingLocation,
16
16
  OrderJourneyOrderReviewStepData,
17
- OrderJourneyProductStep,
18
17
  OrderJourneyStep,
19
18
  OrderJourneyUTMStepData,
20
19
  OrderJourneyUTMStepValidations,
@@ -112,17 +111,7 @@ export type OrderJourneyState = {
112
111
  contractStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
113
112
  contractStepsData: Record<string, Record<string, any>>
114
113
  contractStepsValidations: Record<string, UseValidatorResult> | null
115
- /* Product Fields */
116
- productSteps: OrderJourneyProductStep[]
117
- productStepsBlurredFields: Record<string, Record<string, boolean>>
118
- productStepsSubmittedSteps: Record<string, boolean>
119
- productStepsErrorMessages: Record<
120
- string,
121
- Record<string, MessageDescriptor | MessageDescriptor[]>
122
- >
123
- productStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
124
- productStepsData: Record<string, Record<string, any>>
125
- productStepsValidations: Record<string, UseValidatorResult> | null
114
+
126
115
  /* UTM Codes */
127
116
  utmCodesStep: OrderJourneyStep
128
117
  utmCodesStepData: OrderJourneyUTMStepData
@@ -1,6 +1,7 @@
1
1
  import { MessageDescriptor } from "react-intl"
2
2
  import { OrderJourneyStepKey } from "./enums"
3
3
  import { UseValidatorResult } from "../common"
4
+ import { OrderJourneyProductStep } from "../experimental"
4
5
 
5
6
  export type OrderJourneyStepBlurredFields = {
6
7
  [k: string]:
@@ -31,11 +32,6 @@ export type OrderJourneyContractStep = Omit<
31
32
  "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
32
33
  >
33
34
 
34
- export type OrderJourneyProductStep = Omit<
35
- OrderJourneyStep,
36
- "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
37
- >
38
-
39
35
  export type UTMMap = {
40
36
  value: string
41
37
  mapToName: boolean
@@ -203,3 +199,13 @@ export type OrderJourneyStepMap = {
203
199
  [OrderJourneyStepKey.paymentMethod]: OrderJourneyStep
204
200
  [OrderJourneyStepKey.orderConfirmation]: OrderJourneyStep
205
201
  }
202
+ export type OrderReviewAccordionKeys = Exclude<
203
+ OrderJourneyStepKey,
204
+ | OrderJourneyStepKey.searchRecommendProducts
205
+ | OrderJourneyStepKey.selectProducts
206
+ | OrderJourneyStepKey.addContracts
207
+ | OrderJourneyStepKey.selectContracts
208
+ | OrderJourneyStepKey.orderReview
209
+ | OrderJourneyStepKey.orderConfirmation
210
+ | OrderJourneyStepKey.paymentMethod
211
+ >
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.28.0",
4
+ "version": "1.30.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -29,8 +29,6 @@ export type WindowHapiAPIProductConfigs = {
29
29
  getJobTitles: AxiosRequestConfig
30
30
  getLocations: AxiosRequestConfig
31
31
  calculateDeliveryTime: AxiosRequestConfig
32
- getPostingRequirementOptions: AxiosRequestConfig
33
- getPostingRequirements: AxiosRequestConfig
34
32
  }
35
33
  export type WindowHapiAPIProductRequests = {
36
34
  getProduct: (productId: number | string) => Promise<Product>
@@ -50,14 +48,6 @@ export type WindowHapiAPIProductRequests = {
50
48
  filters?: ProductWithSupportForContractsFilters,
51
49
  limitOffset?: PaginationLimitOffset,
52
50
  ) => 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[]>
61
51
  getIndustries: () => Promise<ProductIndustry[]>
62
52
  getJobFunctions: () => Promise<ProductJobFunction[]>
63
53
  getJobTitles: (
@@ -67,16 +67,6 @@ export type ProductServiceSetArbitraryJobTitle = (
67
67
  shouldResetJobFunctionsIds?: boolean,
68
68
  ) => void
69
69
 
70
- export type ProductServiceGetProductPostingRequirementOptionsHandler = (
71
- productId: string,
72
- fieldName: string,
73
- autocompleteRequestOptions: PostingRequirementsAutocompleteRequestOption[],
74
- ) => Promise<any>
75
-
76
- export type ProductServiceGetProductPostingRequirementsHandler = (
77
- productId: string | number,
78
- ) => Promise<PostingRequirement[]>
79
-
80
70
  export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
81
71
  {
82
72
  loadMoreProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceLoadMoreProductsHandler>
@@ -93,8 +83,6 @@ export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
93
83
  getJobTitles: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobTitlesHandler>
94
84
  getJobFunctions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobFunctionsHandler>
95
85
  getIndustries: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetIndustriesHandler>
96
- getProductPostingRequirementOptions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductPostingRequirementOptionsHandler>
97
- getProductPostingRequirements: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductPostingRequirementsHandler>
98
86
  },
99
87
  { readonly service: WindowHapiService }
100
88
  >
package/product/types.ts CHANGED
@@ -176,8 +176,3 @@ export type ProductUserProvidedFilters = Omit<
176
176
  ProductFilterQueryParams,
177
177
  "filterProductRecommendations" | "filterMyContractSupportedOnly"
178
178
  >
179
-
180
- export type ProductPostingRequirementsAutocompleteRequestOption = {
181
- key: string
182
- value: string | string[]
183
- }
@@ -23,6 +23,7 @@ export type WindowHapiServiceWallet = WindowHapiModuleWithConstructorArgs<
23
23
  createPaymentIntent: (
24
24
  paymentParams: WalletPaymentIntentRequest,
25
25
  ) => Promise<void>
26
+ handlePaymentIntentCallbackFromQueryParams: () => void
26
27
  resetTopUpState: () => void
27
28
  resetDirectChargeState: () => void
28
29
  resetPurchaseOrderState: () => void