@vonq/hapi-elements-types 1.7.0 → 1.9.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 (42) hide show
  1. package/README.md +21 -0
  2. package/_window/api.types.ts +23 -0
  3. package/_window/events.types.ts +10 -10
  4. package/_window/sdk.types.ts +12 -1
  5. package/_window/service.types.ts +3 -0
  6. package/_window/state.types.ts +12 -6
  7. package/_window/window.ts +2 -0
  8. package/ats/api.types.ts +5 -1
  9. package/ats/state.types.ts +2 -1
  10. package/ats/types.ts +9 -1
  11. package/basket/service.types.ts +7 -1
  12. package/basket/state.types.ts +1 -21
  13. package/basket/utils.types.ts +36 -0
  14. package/campaign/state.types.ts +0 -30
  15. package/campaign/types.ts +9 -5
  16. package/campaign/validations.types.ts +10 -3
  17. package/common/enums.ts +2 -0
  18. package/common/events/EventCommand/enums.ts +5 -4
  19. package/common/events/EventCommand/types.ts +2 -0
  20. package/common/events/types.ts +4 -1
  21. package/common/qa.types.ts +2 -0
  22. package/common/validations.types.ts +2 -0
  23. package/contract/state.types.ts +0 -45
  24. package/contract/utils.types.ts +2 -1
  25. package/debugging/state.types.ts +1 -12
  26. package/modal/enums.ts +3 -0
  27. package/modal/types.ts +19 -0
  28. package/orderJourney/enums.ts +1 -1
  29. package/orderJourney/service.types.ts +16 -0
  30. package/orderJourney/state.types.ts +11 -5
  31. package/orderJourney/types.ts +50 -12
  32. package/orderJourney/utils.types.ts +8 -0
  33. package/orderJourney/validations.types.ts +23 -2
  34. package/package.json +1 -1
  35. package/product/enums.ts +1 -0
  36. package/product/state.types.ts +2 -57
  37. package/product/types.ts +12 -7
  38. package/product/utils.types.ts +0 -4
  39. package/routing/state.types.ts +1 -1
  40. package/theming/types.ts +5 -0
  41. package/ui/service.types.ts +6 -4
  42. package/wallet/state.types.ts +0 -36
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ This package contains type definitions for VONQ HAPI Elements project.
2
+
3
+ To get started using the types, install the package as a dev dependency:
4
+
5
+
6
+ Using NPM:
7
+ ```
8
+ npm install @vonq/hapi-elements-types --save-dev
9
+ ```
10
+
11
+ Using Yarn:
12
+ ```
13
+ yarn add -D @vonq/hapi-elements-types
14
+ ```
15
+
16
+ All the types have been exported in a single file so you can get started using the types as such:
17
+ ```
18
+ import {CreateCampaignForm} from "@vonq/hapi-elements-types";
19
+
20
+ const campaignObject: CreateCampaignForm = {} //Typescript will warn about missing properties
21
+ ```
@@ -15,6 +15,7 @@ import {
15
15
  WindowHapiClassInterface,
16
16
  } from "./window"
17
17
  import { WindowHapiLogger } from "../common/logger/types"
18
+ import { ATSUserTokenResponse } from "../ats"
18
19
 
19
20
  export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
20
21
  logger: WindowHapiLogger
@@ -29,12 +30,34 @@ export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
29
30
  export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
30
31
  headers?: any
31
32
  }
33
+
34
+ export type WindowHapiAPIOnChangeJWTTokenHandler = (
35
+ newToken: string,
36
+ oldToken?: string,
37
+ ) => string
38
+
39
+ export type WindowHapiAPIRefreshJWTTokenHandler = () => Promise<
40
+ ATSUserTokenResponse | undefined
41
+ >
42
+
43
+ export type WindowHapiAPIValidateJWTTokenHandler = () => Promise<boolean>
44
+
32
45
  export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
33
46
  {
34
47
  /* Common */
35
48
  request: <T = any, R = AxiosResponse<T>, D = any>(
36
49
  config: Partial<HapiRequestConfig<D>>,
37
50
  ) => Promise<R>
51
+ jwtHeaderKey: string
52
+ jwtRefreshIntervalInSeconds: number
53
+ setJWTRefreshIntervalInSeconds: (seconds: number) => void
54
+ jwtRefreshInterval: number | undefined
55
+ jwtTokenRefreshCallback:
56
+ | WindowHapiAPIOnChangeJWTTokenHandler
57
+ | undefined
58
+ onJWTTokenRefresh: (token: string) => void
59
+ refreshJWTToken: WindowHapiAPIRefreshJWTTokenHandler
60
+ validateJWTToken: WindowHapiAPIValidateJWTTokenHandler
38
61
  baseURL: string
39
62
  setBaseURL: (url: string) => void
40
63
  setBaseConfig: (params: Record<string, Record<string, string>>) => void
@@ -30,6 +30,9 @@ export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
30
30
  value: WindowHapiEventCommandData,
31
31
  instances: WindowHapiEventMediatorInstances,
32
32
  id?: string,
33
+ status?: WindowHapiEventCommandStatus,
34
+ createdAt?: string,
35
+ updatedAt?: string,
33
36
  ) => WindowHapiEventCommand
34
37
  create: (
35
38
  name: WindowHapiEventCommandNames,
@@ -37,6 +40,8 @@ export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
37
40
  getInstances: WindowHapiEventMediatorGetInstancesHandler,
38
41
  id?: string,
39
42
  status?: WindowHapiEventCommandStatus,
43
+ createdAt?: string,
44
+ updatedAt?: string,
40
45
  ) => WindowHapiEventCommand
41
46
  },
42
47
  { readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
@@ -47,6 +52,7 @@ export type WindowHapiEventMediatorCreateAndDispatchHandler = (
47
52
  data?: WindowHapiEventCommandData,
48
53
  id?: string,
49
54
  status?: WindowHapiEventCommandStatus,
55
+ getInstances?: WindowHapiEventMediatorGetInstancesHandler,
50
56
  ) => Promise<WindowHapiEventCommand | undefined>
51
57
 
52
58
  export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
@@ -117,7 +123,9 @@ export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
117
123
  ) => void
118
124
  remove: (id: string) => void
119
125
  removeByName: (name: string) => void
120
- getEventsByName: (name: string) => WindowHapiEventCommand[]
126
+ getEventsByName: (
127
+ name: string,
128
+ ) => (WindowHapiEventCommand | WindowHapiEventListener)[]
121
129
  },
122
130
  { readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
123
131
  >
@@ -127,15 +135,6 @@ export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
127
135
  hasAddedWindowMessageEvent: boolean
128
136
  addInternalEventListeners: () => void
129
137
  removeInternalEventListeners: () => void
130
- createSDKEventListener: (
131
- property: string,
132
- callback: (data: any) => void,
133
- ) => void
134
- sdkEventListenerCallback: (
135
- data: WindowHapiEventCommandData,
136
- _property: string,
137
- callback: (data: WindowHapiEventCommandData) => void,
138
- ) => void
139
138
  eventFactory: WindowHapiEventFactory
140
139
  eventMediator: WindowHapiEventMediator
141
140
  eventStorage: WindowHapiEventStorage
@@ -145,6 +144,7 @@ export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
145
144
  eventStateStrategy: WindowHapiEventStrategy
146
145
  eventServiceStrategy: WindowHapiEventStrategy
147
146
  eventQAStrategy: WindowHapiEventStrategy
147
+ eventDOMStrategy: WindowHapiEventStrategy
148
148
  getInstances: () => {
149
149
  source: WindowHapiInstance
150
150
  targets: WindowHapiInstance[]
@@ -40,6 +40,8 @@ import {
40
40
  WindowHapiClassInterface,
41
41
  } from "./window"
42
42
  import { WindowHapiServiceUI } from "../ui/service.types"
43
+ import { ATSState, WindowHapiAPIATS, WindowHapiServiceATS } from "../ats"
44
+ import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
43
45
 
44
46
  export type WindowHapiSDKModule<
45
47
  APIModule,
@@ -96,7 +98,7 @@ export type WindowHapiSDKLanguage = WindowHapiSDKModule<
96
98
  >
97
99
  export type WindowHapiSDKOrderJourney = WindowHapiSDKModule<
98
100
  undefined,
99
- undefined,
101
+ WindowHapiServiceOrderJourney,
100
102
  WindowHapiValidationsOrderJourney,
101
103
  WindowHapiStateModule<OrderJourneyState>,
102
104
  WindowHapiUtilsOrderJourney
@@ -126,8 +128,16 @@ export type WindowHapiSDKUI = WindowHapiSDKModule<
126
128
  undefined,
127
129
  undefined
128
130
  >
131
+ export type WindowHapiSDKATS = WindowHapiSDKModule<
132
+ WindowHapiAPIATS,
133
+ WindowHapiServiceATS,
134
+ undefined,
135
+ WindowHapiStateModule<ATSState>
136
+ >
137
+
129
138
  export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
130
139
  {
140
+ [WindowHapiModuleName.ats]: WindowHapiSDKATS
131
141
  [WindowHapiModuleName.contract]: WindowHapiSDKContract
132
142
  [WindowHapiModuleName.basket]: WindowHapiSDKBasket
133
143
  [WindowHapiModuleName.campaign]: WindowHapiSDKCampaign
@@ -138,6 +148,7 @@ export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
138
148
  [WindowHapiModuleName.language]: WindowHapiSDKLanguage
139
149
  [WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
140
150
  [WindowHapiModuleName.alert]: WindowHapiSDKAlert
151
+ [WindowHapiModuleName.ui]: WindowHapiSDKUI
141
152
  },
142
153
  { readonly core: WindowHapiClassInterface }
143
154
  >
@@ -13,6 +13,7 @@ import {
13
13
  WindowHapiModuleWithConstructorArgs,
14
14
  } from "./window"
15
15
  import { WindowHapiLogger } from "../common/logger/types"
16
+ import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
16
17
 
17
18
  export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
18
19
  | void
@@ -45,6 +46,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
45
46
  [WindowHapiModuleName.product]: WindowHapiServiceProduct
46
47
  [WindowHapiModuleName.wallet]: WindowHapiServiceWallet
47
48
  [WindowHapiModuleName.modal]: WindowHapiServiceModal
49
+ [WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
48
50
  [WindowHapiModuleName.ui]: WindowHapiServiceUI
49
51
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
50
52
  services: {
@@ -55,6 +57,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
55
57
  [WindowHapiModuleName.product]: WindowHapiServiceProduct
56
58
  [WindowHapiModuleName.wallet]: WindowHapiServiceWallet
57
59
  [WindowHapiModuleName.modal]: WindowHapiServiceModal
60
+ [WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
58
61
  [WindowHapiModuleName.ui]: WindowHapiServiceUI
59
62
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
60
63
  }
@@ -41,11 +41,9 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
41
41
  [WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
42
42
  [WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
43
43
  [WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
44
- getModuleByName: (
45
- name: string,
46
- ) => WindowHapiStateModule<any> | undefined
44
+ basePropertiesThatShouldNotBeDocumented: string[]
47
45
  handleDefaultStateFromQueryParams: (params: string | string[]) => void
48
- shouldPreventStateDispatch: boolean
46
+ onAfterStateChange: () => void
49
47
  stores: {
50
48
  alert: WindowHapiStateModule<AlertState>
51
49
  basket: WindowHapiStateModule<BasketState>
@@ -81,12 +79,14 @@ export type WindowHapiStatesJSON = {
81
79
  }
82
80
 
83
81
  export type WindowHapiStateBase = {
84
- __stateName: string
82
+ propertiesThatShouldNotBeDocumented: string[]
83
+ __elementsStateModuleName: string
85
84
  toJSON: any
85
+ addClassPropertiesObserver: () => void
86
86
  }
87
87
 
88
88
  export type HapiStateValueWithListener<T> = {
89
- on: (callback: WindowHapiEventCommandCallbackHandler) => void
89
+ onChange: (callback: WindowHapiEventCommandCallbackHandler) => void
90
90
  value: T
91
91
  }
92
92
 
@@ -112,3 +112,9 @@ export type StateValidationKey =
112
112
  export type StateValidations<State> = {
113
113
  [P in keyof State]: StateValidationKey | undefined
114
114
  }
115
+
116
+ export type WindowHapiStateModuleState<T> = {
117
+ [K in keyof T]: T[K]
118
+ } & {
119
+ state?: WindowHapiState
120
+ }
package/_window/window.ts CHANGED
@@ -92,6 +92,7 @@ export type WindowHapiConfigSubmodule = {
92
92
  enableLogs: boolean
93
93
  webComponents: HapiWebComponent[]
94
94
  isInvalidToken: boolean
95
+ isAllowedToUseDevelopmentEnvironment: boolean
95
96
  useJWTAuthHeaders: boolean
96
97
  addModal: boolean
97
98
  addAlertBar: boolean
@@ -120,6 +121,7 @@ export type WindowHapiClassInterface = {
120
121
  service: WindowHapiServiceSubmodule
121
122
  instance: WindowHapiInstance
122
123
  qa: WindowHapiQASubmodule
124
+ isProduction: boolean
123
125
  }
124
126
 
125
127
  export type WindowHapi = {
package/ats/api.types.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { AxiosRequestConfig } from "axios/index"
2
- import { ATSSettings } from "./types"
2
+ import { ATSSettings, ATSUserTokenResponse } from "./types"
3
3
  import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
4
4
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
5
5
 
6
6
  export type WindowHapiAPIATSConfigs = {
7
7
  getUserSettings: AxiosRequestConfig<any>
8
+ refreshJWTToken: AxiosRequestConfig<any>
9
+ validateJWTToken: AxiosRequestConfig<any>
8
10
  }
9
11
 
10
12
  export type WindowHapiAPIATSRequests = {
11
13
  getUserSettings: () => Promise<ATSSettings>
14
+ refreshJWTToken: () => Promise<ATSUserTokenResponse>
15
+ validateJWTToken: () => Promise<boolean>
12
16
  }
13
17
  export type WindowHapiAPIATS = WindowHapiModuleWithConstructorArgs<
14
18
  WindowHapiAPIModule<WindowHapiAPIATSRequests, WindowHapiAPIATSConfigs>,
@@ -1,5 +1,6 @@
1
- import { ATSSettings } from "./types"
1
+ import { ATSSettings, ATSUserPaymentSetting } from "./types"
2
2
 
3
3
  export type ATSState = {
4
4
  userSettings: ATSSettings | null
5
+ displayCurrencyPaymentSettings: ATSUserPaymentSetting | null
5
6
  }
package/ats/types.ts CHANGED
@@ -5,15 +5,23 @@ export type ATSUserPaymentSetting = {
5
5
  max_outstanding_balance: string
6
6
  max_purchase_order: string
7
7
  min_topup: string
8
+ gateway: {
9
+ provider: "stripe"
10
+ publishable_key: string
11
+ }
8
12
  payment_method_types: WalletPaymentIntentPaymentMethod[] | null
9
13
  }
10
14
  export type ATSUserSettings = {
11
15
  ats_managed_payment: boolean
12
16
  can_pay_with_purchase_order: boolean
13
17
  can_use_wallets: boolean
14
- invoice_currency: string
18
+ invoice_currency: string | null
15
19
  }
16
20
  export type ATSSettings = {
17
21
  payment_settings: ATSUserPaymentSetting[]
18
22
  settings: ATSUserSettings
19
23
  }
24
+
25
+ export type ATSUserTokenResponse = {
26
+ token: string
27
+ }
@@ -17,15 +17,21 @@ export type BasketServiceAddProductOrContractByIdHandler = (
17
17
  export type BasketServiceRemoveProductOrContractByIdHandler = (
18
18
  contractOrProductId: string,
19
19
  ) => void
20
+ export type BasketServiceRemoveContractsWithConflictingGroupsHandler = (
21
+ contractThatUserTriedToAdd: Contract,
22
+ ) => void
23
+ export type BasketServiceKeepContractsWithConflictingGroupsHandler = () => void
20
24
 
21
25
  export type WindowHapiServiceBasket = WindowHapiModuleWithConstructorArgs<
22
26
  {
23
- setBasketProductsAndMetaByItemData: (
27
+ onAfterGetBasketData: (
24
28
  basketItemData: (Contract | Product)[],
25
29
  ) => BasketProduct[]
26
30
  getProducts: HapiServiceFunctionWithLifecycleHooks<BasketServiceGetProductsHandler>
27
31
  addProductOrContractById: HapiServiceFunctionWithLifecycleHooks<BasketServiceAddProductOrContractByIdHandler>
28
32
  removeProductOrContractById: HapiServiceFunctionWithLifecycleHooks<BasketServiceRemoveProductOrContractByIdHandler>
33
+ removeContractsWithConflictingGroups: HapiServiceFunctionWithLifecycleHooks<BasketServiceRemoveContractsWithConflictingGroupsHandler>
34
+ keepContractsWithConflictingGroups: HapiServiceFunctionWithLifecycleHooks<BasketServiceKeepContractsWithConflictingGroupsHandler>
29
35
  clear: () => BasketProduct[]
30
36
  },
31
37
  { readonly service: WindowHapiService }
@@ -3,32 +3,12 @@ import { BasketProduct } from "./types"
3
3
  import { Contract } from "../contract/types"
4
4
 
5
5
  export type BasketState = {
6
- /**
7
- * Array of `BasketProduct`s. The price or other properties of a Product or Contract may change therefore this variable only contains ID of Product or Contract and whether it is a Product or not; via the `isProduct: boolean` variable. Elements of this array then are fetched from the API with their latest information and then set as `products`.
8
- */
9
6
  productsMeta: BasketProduct[]
10
- /**
11
- * Array of Products and/or Contracts. This variable is auto-populated with the response received from the API for the Products and Contracts inside `productsMeta`
12
- */
13
7
  products: (Product | Contract)[]
14
- /**
15
- * Sum of prices of Products and/or Contracts in EUR currency. **This value is a computed getter meaning that it cannot be set from outside**
16
- */
17
8
  totalInEUR: number
18
- /**
19
- * Sum of prices of Products and/or Contracts in USD currency. **This value is a computed getter meaning that it cannot be set from outside**
20
- */
21
9
  totalInUSD: number
22
- /**
23
- * Sum of prices of Products and/or Contracts in GBP currency. **This value is a computed getter meaning that it cannot be set from outside**
24
- */
25
10
  totalInGBP: number
26
- /**
27
- * Sum of prices of Products and/or Contracts in the current display currency that is used throughout the widgets. **This value is a computed getter meaning that it cannot be set from outside**
28
- */
11
+ totalInAUD: number
29
12
  totalInDisplayCurrency: number
30
- /**
31
- * Shows a spinner in Basket when the data for Products and/or Contracts is being fetched from the API
32
- */
33
13
  productsAreLoading: boolean
34
14
  }
@@ -1,10 +1,46 @@
1
1
  import { BasketProduct } from "./types"
2
2
  import { WindowHapiUtils } from "../_window/utils.types"
3
3
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+ import {
5
+ Product,
6
+ ProductBoardType,
7
+ ProductPrice,
8
+ ProductPriceCurrency,
9
+ } from "../product"
10
+ import { Contract } from "../contract"
11
+ import {
12
+ getBasketProductBoardType,
13
+ getConflictingContractsWithDifferentGroupsInBasket,
14
+ } from "../../common/basket/utils"
4
15
 
5
16
  export type WindowHapiUtilsBasket = WindowHapiModuleWithConstructorArgs<
6
17
  {
7
18
  getInitialBasketProductsMeta: () => BasketProduct[]
19
+ getBasketProductId: (product: Product | Contract) => string
20
+ getBasketProductTitle: (product: Product | Contract) => string
21
+ getIsBasketProductContract: (product: Product | Contract) => boolean
22
+ getIsBasketProductProduct: (product: Product | Contract) => boolean
23
+ getBasketProductPrice: (
24
+ product: Product | Contract,
25
+ displayCurrency: ProductPriceCurrency,
26
+ ) => ProductPrice | undefined
27
+ getBasketProductBoardType: (
28
+ product: Product | Contract,
29
+ ) => ProductBoardType | undefined
30
+ getBasketProductTimeToProcess: (
31
+ product: Product | Contract,
32
+ ) => string | undefined
33
+ getBasketProductDuration: (
34
+ product: Product | Contract,
35
+ ) => string | undefined
36
+ getIsProductOrContractInBasket: (
37
+ contractOrProductId: string,
38
+ productsMeta: BasketProduct[],
39
+ ) => boolean
40
+ getConflictingContractsWithDifferentGroupsInBasket: (
41
+ contract: Contract,
42
+ basketProducts: (Contract | Product)[],
43
+ ) => (Product | Contract)[]
8
44
  },
9
45
  { readonly utils: WindowHapiUtils }
10
46
  >
@@ -9,47 +9,17 @@ import { PaginationResponseV2 } from "../common/types"
9
9
 
10
10
  export type CampaignState = {
11
11
  /* Campaign */
12
- /**
13
- * Array of Campaign Objects for listing in Campaigns Landing and Campaigns List (both Card and Accordion Table Layout) widgets
14
- */
15
12
  campaigns: Campaign[]
16
- /**
17
- * An object that holds information like next URL, previous URL and count for pagination purposes
18
- */
19
13
  campaignsPaginationMeta: PaginationResponseV2
20
- /**
21
- * Used to show a loading spinner in Campaign widgets that show list of campaigns
22
- */
23
14
  campaignsAreLoading: boolean
24
- /**
25
- * Object used to create (order) a campaign
26
- */
27
15
  campaignForm: CampaignCreateForm
28
- /**
29
- * Shows a loading spinner and disables the buttons in Campaign Create Form while creating a Campaign
30
- */
31
16
  campaignIsCreating: boolean
32
17
  /* Education Levels */
33
- /**
34
- * Array of Education Levels that end user will select via a Select HTML element
35
- */
36
18
  educationLevels: TaxonomyEducationAndSeniorityLevel[]
37
- /**
38
- * Used to show a loading spinner and also disable the Select HTML element while values for Education Levels is loading
39
- */
40
19
  educationLevelsAreLoading: boolean
41
20
  /* Seniorities */
42
- /**
43
- * Array of Seniorities that end user will select via a Select HTML element
44
- */
45
21
  seniorities: TaxonomySeniority[]
46
- /**
47
- * Used to show a loading spinner and also disable the Select HTML element while values for Seniorities is loading
48
- */
49
22
  senioritiesAreLoading: boolean
50
23
  /* Employment Types */
51
- /**
52
- * Array of Employment Types that end user will select via a Select HTML element
53
- */
54
24
  employmentTypes: TaxonomyEmploymentTypes[]
55
25
  }
package/campaign/types.ts CHANGED
@@ -2,6 +2,7 @@ import { ProductDuration, ProductIndustry } from "../product/types"
2
2
  import { ContractPostingRequirement } from "../contract/types"
3
3
  import { ProductPriceCurrency } from "../product/enums"
4
4
  import { EmploymentType, SalaryPeriod } from "./enums"
5
+ import { OrderJourneyPaymentMethod } from "../orderJourney"
5
6
 
6
7
  export type CampaignProductSpecs = {
7
8
  contractId: string | null
@@ -121,6 +122,7 @@ export type Campaign = {
121
122
  orderedProducts: string[]
122
123
  orderedProductsSpecs: CampaignProductSpecs[]
123
124
  postingDetails: CampaignPostingDetails
125
+ paymentMethod: OrderJourneyPaymentMethod
124
126
  postings: CampaignPosting[]
125
127
  recruiterInfo: CampaignRecruiterInfo
126
128
  status: CampaignStatus
@@ -161,7 +163,8 @@ export type CampaignCreateFormOrderedProductSpec =
161
163
  export type CampaignCreateForm = {
162
164
  companyId: string
163
165
  campaignName?: string | null
164
- poNumber?: string
166
+ poNumber: string | null
167
+ paymentMethod: OrderJourneyPaymentMethod | null
165
168
  targetGroup: CampaignCreateFormTargetGroup
166
169
  recruiterInfo: CampaignRecruiterInfo
167
170
  postingDetails: {
@@ -173,7 +176,7 @@ export type CampaignCreateForm = {
173
176
  employmentType: EmploymentType
174
177
  weeklyWorkingHours: CampaignPostingDetailsWeeklyWorkingHours
175
178
  salaryIndication: CampaignPostingDetailsSalaryIndication
176
- contactInfo: CampaignPostingDetailsContactInfo
179
+ contactInfo: CampaignPostingDetailsContactInfo | null
177
180
  jobPageUrl: string
178
181
  applicationUrl: string
179
182
  }
@@ -182,9 +185,9 @@ export type CampaignCreateForm = {
182
185
  }
183
186
 
184
187
  export type CampaignOrderRequestBodyOrderedProductsSpec = {
185
- contractId: string
188
+ contractId?: string
186
189
  utm: string
187
- productId: string
190
+ productId?: string
188
191
  postingRequirements?: any
189
192
  }
190
193
 
@@ -192,8 +195,9 @@ export type CampaignOrderRequestBody = {
192
195
  companyId: string
193
196
  campaignName: string | null | undefined
194
197
  walletId?: string
195
- poNumber?: string
198
+ poNumber?: string | null
196
199
  recruiterInfo: Omit<CampaignRecruiterInfo, "id">
200
+ paymentMethod: OrderJourneyPaymentMethod | null
197
201
  postingDetails: CampaignPostingDetails
198
202
  targetGroup: CampaignTargetGroup
199
203
  orderedProducts: string[]
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  ZodAny,
3
3
  ZodArray,
4
+ ZodBoolean,
5
+ ZodNativeEnum,
4
6
  ZodNullable,
5
7
  ZodNumber,
6
8
  ZodObject,
@@ -10,6 +12,7 @@ import {
10
12
  ZodUnion,
11
13
  } from "zod"
12
14
  import { ZodProductDuration } from "../product/validations.types"
15
+ import { OrderJourneyPaymentMethod } from "../orderJourney"
13
16
 
14
17
  export type ZodCampaignTotalPrice = ZodObject<{
15
18
  amount: ZodNumber
@@ -26,7 +29,7 @@ export type ZodCampaignRecruiterInfo = ZodObject<{
26
29
  }>
27
30
  export type ZodCampaignTargetGroupData = ZodObject<{
28
31
  description: ZodString
29
- vonqId: ZodString
32
+ vonqId: ZodUnion<[ZodNumber, ZodString]>
30
33
  }>
31
34
  export type ZodCampaignTargetGroupDatas = ZodArray<ZodCampaignTargetGroupData>
32
35
  export type ZodCampaignTargetGroup = ZodObject<{
@@ -68,7 +71,9 @@ export type ZodCampaignPostingDetailsWorkingLocationPostCodeDefinition = {
68
71
  export type ZodCampaignPostingDetailsWorkingLocationAddressDetailsDefinition = {
69
72
  addressLine1: ZodString
70
73
  addressLine2: ZodOptional<ZodNullable<ZodString>>
71
- allowsRemoteWork: ZodOptional<ZodNullable<ZodNumber>>
74
+ allowsRemoteWork: ZodOptional<
75
+ ZodNullable<ZodUnion<[ZodNumber, ZodBoolean]>>
76
+ >
72
77
  city: ZodString
73
78
  country: ZodString
74
79
  postcode: ZodString
@@ -131,7 +136,7 @@ export type ZodCampaign = ZodObject<{
131
136
  campaignName: ZodNullable<ZodString>
132
137
  companyId: ZodString
133
138
  createdOn: ZodString
134
- customerId: ZodString
139
+ customerId: ZodNullable<ZodString>
135
140
  orderReference: ZodNullable<ZodString>
136
141
  orderedProducts: ZodArray<ZodString>
137
142
  orderedProductsSpecs: ZodCampaignOrderedProductSpecs
@@ -171,6 +176,8 @@ export type ZodCampaignCreateFormTargetGroup = ZodObject<{
171
176
  export type ZodCampaignCreateForm = ZodObject<{
172
177
  companyId: ZodString
173
178
  campaignName: ZodOptional<ZodNullable<ZodString>>
179
+ poNumber: ZodNullable<ZodString>
180
+ paymentMethod: ZodNullable<ZodNativeEnum<typeof OrderJourneyPaymentMethod>>
174
181
  targetGroup: ZodCampaignCreateFormTargetGroup
175
182
  recruiterInfo: ZodCampaignRecruiterInfo
176
183
  postingDetails: ZodCampaignCreateFormPostingDetails
package/common/enums.ts CHANGED
@@ -16,6 +16,8 @@ export enum WindowHapiSubmoduleName {
16
16
  }
17
17
 
18
18
  export enum WindowHapiModuleName {
19
+ router = "router",
20
+ config = "config",
19
21
  ats = "ats",
20
22
  basket = "basket",
21
23
  campaign = "campaign",
@@ -1,10 +1,7 @@
1
1
  export enum WindowHapiEventCommandName {
2
2
  /* State */
3
- stateHydrate = "state:hydrate",
4
- stateTransfer = "state:transfer",
5
- stateRestore = "state:restore",
6
3
  stateLoad = "state:load",
7
- stateInit = "state:init",
4
+ stateHydrate = "state:hydrate",
8
5
 
9
6
  /* Service */
10
7
  serviceLoad = "service:load",
@@ -30,6 +27,8 @@ export enum WindowHapiEventCommandName {
30
27
  qaRequest = "qa:request",
31
28
 
32
29
  /* DOM */
30
+ iframeLoaded = "dom:iframe-loaded",
31
+ iframeUnloaded = "dom:iframe-unloaded",
33
32
  domAppendChild = "dom:append-child",
34
33
  domElementEvent = "dom:element-event",
35
34
  domRemoveChild = "dom:remove-child",
@@ -39,6 +38,8 @@ export enum WindowHapiEventCommandName {
39
38
  domAddClass = "dom:add-class",
40
39
  domRemoveClass = "dom:remove-class",
41
40
  domSlotAvailable = "dom:slot-available",
41
+ domElementMounted = "dom:element-mounted",
42
+ domElementUnmounted = "dom:element-unmounted",
42
43
 
43
44
  /* Location */
44
45
  locationSetHref = "location:href",
@@ -3,11 +3,13 @@ import { WindowHapiEventCommandName } from "./enums"
3
3
  export type WindowHapiEventCommandNames =
4
4
  | WindowHapiEventCommandName
5
5
  | `dom:element-event-${string}`
6
+ | `state:change-event-${string}`
6
7
 
7
8
  export type WindowHapiEventCommandData =
8
9
  | [string]
9
10
  | [string, ...any[]]
10
11
  | [...any[]]
12
+ | any
11
13
  | undefined
12
14
 
13
15
  export type WindowHapiEventCommandStatus =
@@ -34,7 +34,10 @@ export type WindowHapiEventCommand = {
34
34
  toJSON: Record<string, any>
35
35
  }
36
36
 
37
- export type WindowHapiEventCommandCallbackHandler = (data: any) => void
37
+ export type WindowHapiEventCommandCallbackHandler = (
38
+ data: any,
39
+ event: WindowHapiEventCommand,
40
+ ) => void
38
41
  export type WindowHapiEventCommandCommitHandler = (
39
42
  ...args: any[]
40
43
  ) => void | never | Promise<void | never>
@@ -4,6 +4,8 @@ import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
4
  export type WindowHapiQACommon = WindowHapiModuleWithConstructorArgs<
5
5
  {
6
6
  setComponentDebuggingIsEnabled: (isEnabled: boolean) => boolean
7
+ setIsAIFeaturesEnabled: (isEnabled: boolean) => boolean
8
+ refreshPage: () => void
7
9
  },
8
10
  { readonly qa: WindowHapiQA }
9
11
  >
@@ -55,6 +55,7 @@ export type ZodPaginationResponseV2 = ZodObject<
55
55
  } & ZodPaginationLimitOffsetDefinition
56
56
  >
57
57
  export type WindowHapiValidationsCommon = {
58
+ isURL: (url: string) => boolean | never
58
59
  genericBoolean: ZodBoolean
59
60
  genericNumber: ZodNumber
60
61
  genericNumberArray: ZodArray<ZodNumber>
@@ -66,6 +67,7 @@ export type WindowHapiValidationsCommon = {
66
67
  ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>
67
68
  >
68
69
  genericRecordBoolean: ZodRecord<ZodString, ZodBoolean>
70
+ genericRecordAny: ZodRecord<ZodString, ZodAny>
69
71
  genericRecordString: ZodRecord<ZodString, ZodString>
70
72
  genericStringOrNumber: ZodUnion<[ZodNumber, ZodString]>
71
73
  genericNullableStringOrNumber: ZodNullable<ZodUnion<[ZodNumber, ZodString]>>