@vonq/hapi-elements-types 1.8.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.
@@ -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[]
@@ -41,6 +41,7 @@ import {
41
41
  } from "./window"
42
42
  import { WindowHapiServiceUI } from "../ui/service.types"
43
43
  import { ATSState, WindowHapiAPIATS, WindowHapiServiceATS } from "../ats"
44
+ import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
44
45
 
45
46
  export type WindowHapiSDKModule<
46
47
  APIModule,
@@ -97,7 +98,7 @@ export type WindowHapiSDKLanguage = WindowHapiSDKModule<
97
98
  >
98
99
  export type WindowHapiSDKOrderJourney = WindowHapiSDKModule<
99
100
  undefined,
100
- undefined,
101
+ WindowHapiServiceOrderJourney,
101
102
  WindowHapiValidationsOrderJourney,
102
103
  WindowHapiStateModule<OrderJourneyState>,
103
104
  WindowHapiUtilsOrderJourney
@@ -147,6 +148,7 @@ export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
147
148
  [WindowHapiModuleName.language]: WindowHapiSDKLanguage
148
149
  [WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
149
150
  [WindowHapiModuleName.alert]: WindowHapiSDKAlert
151
+ [WindowHapiModuleName.ui]: WindowHapiSDKUI
150
152
  },
151
153
  { readonly core: WindowHapiClassInterface }
152
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>
@@ -82,12 +80,13 @@ export type WindowHapiStatesJSON = {
82
80
 
83
81
  export type WindowHapiStateBase = {
84
82
  propertiesThatShouldNotBeDocumented: string[]
85
- __stateName: string
83
+ __elementsStateModuleName: string
86
84
  toJSON: any
85
+ addClassPropertiesObserver: () => void
87
86
  }
88
87
 
89
88
  export type HapiStateValueWithListener<T> = {
90
- on: (callback: WindowHapiEventCommandCallbackHandler) => void
89
+ onChange: (callback: WindowHapiEventCommandCallbackHandler) => void
91
90
  value: T
92
91
  }
93
92
 
@@ -113,3 +112,9 @@ export type StateValidationKey =
113
112
  export type StateValidations<State> = {
114
113
  [P in keyof State]: StateValidationKey | undefined
115
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,6 +5,10 @@ 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 = {
@@ -17,3 +21,7 @@ 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,36 +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 AUD currency. **This value is a computed getter meaning that it cannot be set from outside**
28
- */
29
11
  totalInAUD: number
30
- /**
31
- * 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**
32
- */
33
12
  totalInDisplayCurrency: number
34
- /**
35
- * Shows a spinner in Basket when the data for Products and/or Contracts is being fetched from the API
36
- */
37
13
  productsAreLoading: boolean
38
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]>>
@@ -10,65 +10,20 @@ import { PaginationResponseV1 } from "../common/types"
10
10
 
11
11
  export type ContractState = {
12
12
  /* Contracts */
13
- /**
14
- * Array of Contracts to be displayed in Contracts Landing or Contracts List widgets.
15
- */
16
13
  contracts: Contract[]
17
- /**
18
- * An object that holds information like next URL, previous URL and count for pagination purposes
19
- */
20
14
  contractsPaginationMeta: PaginationResponseV1
21
- /**
22
- * Shows a loading spinner when the Contracts are loading
23
- */
24
15
  contractsAreLoading: boolean
25
- /**
26
- * Selected Channel ID that will trigger an API request to fetch the data then to populate `contractSelected`
27
- */
28
16
  contractSelectedId: string | number | null
29
- /**
30
- * Selected Channel that will be part of the Contract when user submits the form
31
- */
32
17
  contractSelected: ProductSupportingContractsComplete | null
33
- /**
34
- * Shows a loading spinner when the properties required for the Contract are being loaded from the API
35
- */
36
18
  contractSelectedIsLoading: boolean
37
- /**
38
- * The object that contains details for the new Contract that will be created when user submits the form
39
- */
40
19
  contractForm: ContractCreateForm
41
- /**
42
- * Error(s) received from the API when user submits the form
43
- */
44
20
  contractCreateError: any
45
- /**
46
- * Client-side validation result of the `contractForm`. **This value is a computed getter meaning that it cannot be set from outside**
47
- */
48
21
  contractFormIsValid: boolean | null
49
22
  /* Contracts Groups */
50
- /**
51
- * Array of Contract Groups for user to select during creation of a new Contract.
52
- */
53
23
  groups: ContractGroup[]
54
- /**
55
- * Selected Contract Group to be saved as part of Contract that will be created when user submits the form
56
- */
57
24
  groupSelected: ContractGroupSelected
58
- /**
59
- * Shows a loading spinner and disables the Select HTML Element when Contract Groups are loading
60
- */
61
25
  groupsAreLoading: boolean
62
- /**
63
- * Shows a loading spinner and disables the submit button while a new Contract Group is being created
64
- */
65
26
  groupIsCreating: boolean
66
- /**
67
- * Error message displayed to the end user when the new Contract Group could not be created
68
- */
69
27
  groupCreateError: string | null
70
- /**
71
- * The object that contains details for the new Contract Group that will be created when user submits the form
72
- */
73
28
  groupForm: ContractGroupCreateForm
74
29
  }
@@ -1,4 +1,4 @@
1
- import { ContractCreateForm, ContractGroupCreateForm } from "./types"
1
+ import { Contract, ContractCreateForm, ContractGroupCreateForm } from "./types"
2
2
  import { WindowHapiUtils } from "../_window/utils.types"
3
3
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
4
 
@@ -6,6 +6,7 @@ export type WindowHapiUtilsContract = WindowHapiModuleWithConstructorArgs<
6
6
  {
7
7
  getInitialContractForm: () => ContractCreateForm
8
8
  getInitialGroupForm: () => ContractGroupCreateForm
9
+ getContractNameWithGroupSuffix: (contract: Contract) => string
9
10
  },
10
11
  { readonly utils: WindowHapiUtils }
11
12
  >
@@ -1,18 +1,7 @@
1
1
  export type DebuggingState = {
2
- /**
3
- * Shows or hides the debugging tool on Campaign Create Form's fields for Product & Contract steps
4
- */
5
2
  campaignFormDebuggerIsShown: boolean
6
- /**
7
- * Shows translation keys in place of translations for ease of development
8
- */
9
3
  localeDebuggingIsEnabled: boolean
10
- /**
11
- * Encompasses widgets that may become available (or upon request) with a red border and a name so communication while making requests is easier.
12
- */
13
4
  componentDebuggingIsEnabled: boolean
14
- /**
15
- * Enables console logs (all HAPI Elements) logs
16
- */
17
5
  consoleLogsAreEnabled: boolean
6
+ isAIFeaturesEnabled: boolean
18
7
  }
package/modal/enums.ts CHANGED
@@ -11,4 +11,7 @@ export enum ModalKeys {
11
11
  campaignCopyConfirmation = "campaign-confirm-copy",
12
12
  basketRemoveProductConfirmation = "remove-product-from-basket",
13
13
  contractRemoveConfirmation = "contract-remove-confirmation",
14
+ contractGroupConflictInfo = "contract-group-conflict-info",
15
+ filePicker = "file-picker",
16
+ contractPostingRequirementsSmartFillSuccess = "contract-posting-requirements-smart-fill-success",
14
17
  }
package/modal/types.ts CHANGED
@@ -2,6 +2,7 @@ import { Product } from "../product/types"
2
2
  import { Contract } from "../contract/types"
3
3
  import { ModalKeys, ModalZone } from "./enums"
4
4
  import { AnyNonFunction } from "../common/types"
5
+ import { TransformedPostingRequirement } from "../campaign"
5
6
 
6
7
  export type ProductDetailModalProps = {
7
8
  id: string
@@ -12,6 +13,21 @@ export type BasketRemoveProductConfirmationModalProps = {
12
13
  }
13
14
  export type CampaignTakeOfflineConfirmationModalProps = { campaignId: string }
14
15
  export type ContractRemoveConfirmationModalProps = { contractId: string }
16
+ export type ContractGroupConflictInfoModalProps = {
17
+ contract: Contract
18
+ conflictingContracts: Contract[]
19
+ }
20
+ export type ContractPostingRequirementsSmartFillResponseModalProps = {
21
+ response: Record<string, any>
22
+ postingRequirements: Record<string, TransformedPostingRequirement>
23
+ contractId: string
24
+ }
25
+ export type FilePickerOptions = {
26
+ accept?: string[]
27
+ uploadInBackground?: boolean
28
+ maxFiles?: number
29
+ maxSize?: number
30
+ }
15
31
  export type BasketModalProps = {}
16
32
  export type WalletModalProps = {}
17
33
 
@@ -21,6 +37,8 @@ export type ModalProps = AnyNonFunction<
21
37
  | BasketRemoveProductConfirmationModalProps
22
38
  | CampaignTakeOfflineConfirmationModalProps
23
39
  | ContractRemoveConfirmationModalProps
40
+ | ContractGroupConflictInfoModalProps
41
+ | ContractPostingRequirementsSmartFillResponseModalProps
24
42
  | BasketModalProps
25
43
  | WalletModalProps
26
44
  >
@@ -28,6 +46,7 @@ export type ModalProps = AnyNonFunction<
28
46
  export type ModalOptions = {
29
47
  showCloseButton?: boolean
30
48
  showBackdrop?: boolean
49
+ unstyled?: boolean
31
50
  disableVerticalScroll?: boolean
32
51
  }
33
52
 
@@ -21,5 +21,5 @@ export enum OrderJourneyStepKey {
21
21
  export enum OrderJourneyPaymentMethod {
22
22
  atsManaged = "ats-managed",
23
23
  wallet = "wallet",
24
- purchaseOrder = "purchase-order",
24
+ purchaseOrder = "purchase_order",
25
25
  }
@@ -0,0 +1,16 @@
1
+ import {
2
+ HapiServiceFunctionWithLifecycleHooks,
3
+ WindowHapiService,
4
+ } from "../_window/service.types"
5
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
6
+
7
+ export type OrderJourneyServiceSwitchToNextStepHandler = () => Promise<void>
8
+ export type OrderJourneyServiceSwitchToPreviousStepHandler = () => Promise<void>
9
+
10
+ export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
11
+ {
12
+ switchToNextStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToNextStepHandler>
13
+ switchToPreviousStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToPreviousStepHandler>
14
+ },
15
+ { readonly service: WindowHapiService }
16
+ >
@@ -1,5 +1,11 @@
1
1
  import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
2
- import { OrderJourneyStep, OrderJourneyContractStep } from "./types"
2
+ import {
3
+ OrderJourneyStep,
4
+ OrderJourneyContractStep,
5
+ OrderJourneyUTMStepData,
6
+ OrderJourneyUTMStepValidations,
7
+ OrderJourneyOrderReviewStepData,
8
+ } from "./types"
3
9
  import { MessageDescriptor } from "react-intl"
4
10
  import { NestedValidatorKeys, UseValidatorResult } from "../common/types"
5
11
 
@@ -15,9 +21,9 @@ export type OrderJourneyState = {
15
21
  stepActive: OrderJourneyStep | null
16
22
  stepNext: OrderJourneyStep | null
17
23
  stepsPopulatedAreHidden: boolean
24
+ stepIsSwitching: boolean
18
25
  paymentMethodsAvailable: OrderJourneyPaymentMethod[]
19
26
  paymentMethodsEnabled: OrderJourneyPaymentMethod[]
20
- paymentMethodActive: OrderJourneyPaymentMethod | null
21
27
  hidePrefilledFields: boolean
22
28
  orderErrors: Record<string, any> | null
23
29
  /* Onboarding */
@@ -82,11 +88,11 @@ export type OrderJourneyState = {
82
88
  contractStepsValidations: Record<string, UseValidatorResult> | null
83
89
  /* UTM Codes */
84
90
  utmCodesStep: OrderJourneyStep
85
- utmCodesStepData: Record<string, any>
86
- utmCodesStepValidations: UseValidatorResult
91
+ utmCodesStepData: OrderJourneyUTMStepData
92
+ utmCodesStepValidations: OrderJourneyUTMStepValidations
87
93
  /* Order Review */
88
94
  orderReviewStep: OrderJourneyStep
89
- orderReviewStepData: Record<string, any>
95
+ orderReviewStepData: OrderJourneyOrderReviewStepData
90
96
  orderReviewStepValidations: UseValidatorResult
91
97
  /* Payment Method */
92
98
  paymentMethodStep: OrderJourneyStep
@@ -1,18 +1,24 @@
1
1
  import { MessageDescriptor } from "react-intl"
2
2
  import { OrderJourneyStepKey } from "./enums"
3
+ import { UseValidatorResult } from "../common"
3
4
 
4
- export type OrderJourneyStepBlurredFields = Record<
5
- string,
6
- | boolean
7
- | Record<string, boolean>
8
- | Record<string, Record<string, boolean> | boolean>
9
- >
5
+ export type OrderJourneyStepBlurredFields = {
6
+ [k: string]:
7
+ | boolean
8
+ | Record<string, boolean | OrderJourneyStepBlurredFields>
9
+ }
10
10
 
11
- export type OrderJourneyStepErrorMessages = Record<
12
- string,
13
- | MessageDescriptor
14
- | Record<string, MessageDescriptor | Record<string, MessageDescriptor>>
15
- >
11
+ export type OrderJourneyStepErrorMessage = Record<string, MessageDescriptor>
12
+
13
+ export type OrderJourneyStepErrorMessages = {
14
+ [k: string]:
15
+ | MessageDescriptor
16
+ | Record<string, MessageDescriptor | OrderJourneyStepErrorMessage>
17
+ }
18
+
19
+ export type OrderJourneyStepHideFields = {
20
+ [k: string]: boolean | Record<string, boolean | OrderJourneyStepHideFields>
21
+ }
16
22
 
17
23
  export type OrderJourneyStepKeyType = OrderJourneyStepKey | string
18
24
  export type OrderJourneyStep = {
@@ -22,10 +28,42 @@ export type OrderJourneyStep = {
22
28
  isSubmitted?: boolean
23
29
  blurredFields?: OrderJourneyStepBlurredFields
24
30
  errorMessagesIntlDescriptors?: OrderJourneyStepErrorMessages
25
- hideFields?: Record<string, boolean>
31
+ hideFields?: OrderJourneyStepHideFields
26
32
  }
27
33
 
28
34
  export type OrderJourneyContractStep = Omit<
29
35
  OrderJourneyStep,
30
36
  "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
31
37
  >
38
+
39
+ export type UTMMap = {
40
+ value: string
41
+ mapToName: boolean
42
+ key: string
43
+ }
44
+
45
+ export type OrderJourneyUTMStepData = {
46
+ settings: UTMMap[]
47
+ productUTMs: Record<string, UTMMap[]>
48
+ }
49
+
50
+ export type OrderJourneyUTMStepValidations = {
51
+ settings: {
52
+ name: UseValidatorResult
53
+ value: UseValidatorResult
54
+ }
55
+ productUTMs: Record<
56
+ string,
57
+ {
58
+ settings: {
59
+ name: UseValidatorResult
60
+ value: UseValidatorResult
61
+ }
62
+ }
63
+ >
64
+ areAllValid: boolean
65
+ }
66
+
67
+ export type OrderJourneyOrderReviewStepData = {
68
+ accordionsOpen: OrderJourneyStepKey[]
69
+ }
@@ -1,11 +1,19 @@
1
1
  import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
2
2
  import { WindowHapiUtils } from "../_window/utils.types"
3
3
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+ import { Contract } from "../contract"
5
+ import { Product } from "../product"
4
6
 
5
7
  export type WindowHapiUtilsOrderJourney = WindowHapiModuleWithConstructorArgs<
6
8
  {
7
9
  stepKeys: typeof OrderJourneyStepKey
8
10
  paymentMethodKeys: typeof OrderJourneyPaymentMethod
11
+ updateProductUTMsFromBasketItemData: (
12
+ basketItemData: (Contract | Product)[],
13
+ ) => void
14
+ updateOrderReviewAccordionStatesFromBasketItemData: (
15
+ basketItemData: (Contract | Product)[],
16
+ ) => void
9
17
  },
10
18
  { readonly utils: WindowHapiUtils }
11
19
  >
@@ -1,25 +1,42 @@
1
1
  import {
2
2
  ZodArray,
3
3
  ZodBoolean,
4
+ ZodNativeEnum,
4
5
  ZodObject,
5
6
  ZodOptional,
6
7
  ZodRecord,
7
8
  ZodString,
8
9
  ZodTypeAny,
10
+ ZodUnion,
9
11
  } from "zod"
10
12
  import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
11
13
  import { ZodIntlDescriptor } from "../common/validations.types"
12
14
 
13
15
  export type ZodOrderJourneyStep = ZodObject<{
14
16
  key: ZodString
15
- titleIntlDescriptor: ZodIntlDescriptor
16
- descriptionIntlDescriptor: ZodIntlDescriptor
17
+ titleIntlDescriptor: ZodOptional<ZodIntlDescriptor>
18
+ descriptionIntlDescriptor: ZodOptional<ZodIntlDescriptor>
17
19
  isSubmitted: ZodOptional<ZodBoolean>
18
20
  blurredFields: ZodOptional<ZodRecord<ZodString, ZodTypeAny>>
19
21
  errorMessagesIntlDescriptors: ZodOptional<ZodRecord<ZodString, ZodTypeAny>>
20
22
  }>
21
23
 
22
24
  export type ZodOrderJourneySteps = ZodArray<ZodOrderJourneyStep>
25
+ export type ZodOrderJourneyUTMCodeMap = ZodObject<{
26
+ mapToName: ZodBoolean
27
+ value: ZodString
28
+ key: ZodString
29
+ }>
30
+ export type ZodOrderJourneyUTMCodeMaps = ZodArray<ZodOrderJourneyUTMCodeMap>
31
+ export type ZodOrderJourneyUTMCodesStepData = ZodObject<{
32
+ settings: ZodOrderJourneyUTMCodeMaps
33
+ productUTMs: ZodRecord<ZodString, ZodOrderJourneyUTMCodeMaps>
34
+ }>
35
+ export type ZodOrderJourneyOrderReviewStepData = ZodObject<{
36
+ accordionsOpen: ZodArray<
37
+ ZodUnion<[ZodNativeEnum<typeof OrderJourneyStepKey>, ZodString]>
38
+ >
39
+ }>
23
40
  export type WindowHapiValidationsOrderJourney = {
24
41
  supportedStepKeys: OrderJourneyStepKey[]
25
42
  stepKeysRegex: RegExp
@@ -31,4 +48,8 @@ export type WindowHapiValidationsOrderJourney = {
31
48
  paymentMethods: ZodArray<ZodString>
32
49
  supportedPaymentMethods: OrderJourneyPaymentMethod[]
33
50
  paymentMethodsRegex: RegExp
51
+ utmMap: ZodOrderJourneyUTMCodeMap
52
+ utmMaps: ZodOrderJourneyUTMCodeMaps
53
+ utmCodesStepData: ZodOrderJourneyUTMCodesStepData
54
+ orderReviewStepData: ZodOrderJourneyOrderReviewStepData
34
55
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.8.0",
4
+ "version": "1.9.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -10,84 +10,29 @@ import { PaginationResponseV1 } from "../common/types"
10
10
 
11
11
  export type ProductState = {
12
12
  /* Products */
13
- /**
14
- * Array of Products to be listed on Products Landing and Products List widgets. As user applies filters and sorting, this value gets overwritten
15
- */
16
13
  recommendedProducts: Product[]
17
- /**
18
- * Indicates if recommended products are loading
19
- */
20
14
  recommendedProductsAreLoading: boolean
21
- /**
22
- * Array of Products to be listed on Contracts Add Channel Selector Dropdown
23
- */
24
15
  productsWithContractsSupport: ProductSupportingContractsPartial[]
25
- /**
26
- * Indicates whether the Products with Contracts support is loading (mainly used for showing a loading spinner on the Select element when the user is searching for a Product when creating a contract)
27
- */
28
16
  productsWithContractsSupportAreLoading: boolean
29
- /**
30
- * Array of Products to be listed on Products Landing and Products List widgets. As user applies filters and sorting, this value gets overwritten
31
- */
32
17
  products: Product[]
33
- /**
34
- Offset and limit style pagination meta
35
- */
36
18
  productsPaginationMeta: PaginationResponseV1 | null
37
- /**
38
- * Indicates if products are loading
39
- */
40
19
  productsAreLoading: boolean
41
- /**
42
- * The value of Product name in the Input HTML Element that is used to fetch new Product results from the API
43
- */
44
20
  productNameInput: string
45
- /**
46
- * The selected Product region IDs that is used to fetch new Product results from the API
47
- */
48
21
  jobRegionsIdsSelected: number[]
49
22
  /* Locations */
50
- /**
51
- * Array of Locations that are lazily loaded with the input given in `jobRegionsIdsSelected`
52
- */
53
23
  jobRegions: ProductLocation[]
54
24
  /* Job Titles */
55
- /**
56
- * Array of Job Titles that are lazily loaded with the input given in `jobTitlesIdsSelected`
57
- */
58
25
  jobTitles: ProductJobTitle[]
59
- /**
60
- * The selected Job Title IDs that are used to fetch new Product results from the API
61
- */
62
26
  jobTitlesIdsSelected: number[]
63
27
  /* Job Functions */
64
- /**
65
- * Array of Job Functions that are lazily loaded with the input given in `jobTitlesIdsSelected`
66
- */
67
28
  jobFunctions: ProductJobFunction[]
68
- /**
69
- * Shows a loading spinner and disables the Select HTML Element while locations are loading
70
- */
71
29
  jobFunctionsAreLoading: boolean
72
- /**
73
- * The value of Job Function in the Input HTML Element that lazy loads `jobFunctions`
74
- */
75
30
  jobFunctionsInput: string
76
- /**
77
- * The selected Job Function IDs that are used to fetch new Product results from the API
78
- */
79
31
  jobFunctionsIdsSelected: number[]
80
32
  /* Industries */
81
- /**
82
- * The selected Job Industry ID that is used to fetch new Product results from the API
83
- */
84
33
  jobIndustriesIdsSelected: number[]
85
- /**
86
- * Array of Industries that are lazily loaded with the input given in `jobIndustriesIdsSelected`
87
- */
88
34
  jobIndustries: ProductIndustry[]
89
- /**
90
- * Shows a loading spinner and disables the Select HTML Element while locations are loading
91
- */
92
35
  jobIndustriesAreLoading: boolean
36
+ /* Search Text */
37
+ searchTextInput: string
93
38
  }
package/product/types.ts CHANGED
@@ -64,14 +64,16 @@ export type Product = {
64
64
  } & ProductLogos &
65
65
  ProductType
66
66
 
67
+ export type ProductBoardType =
68
+ | "aggregator"
69
+ | "job board"
70
+ | "service"
71
+ | "social media"
72
+ | "publication"
73
+ | "community"
74
+
67
75
  export type ProductType = {
68
- type:
69
- | "aggregator"
70
- | "job board"
71
- | "service"
72
- | "social media"
73
- | "publication"
74
- | "community"
76
+ type: ProductBoardType
75
77
  }
76
78
 
77
79
  export type ProductLogos = {
@@ -100,6 +102,8 @@ export type ProductLocationPlaceType =
100
102
  | "continent"
101
103
  | "country"
102
104
  | "region"
105
+ | "place"
106
+ | "district"
103
107
 
104
108
  export type ProductLocation = {
105
109
  bounding_box: any[]
@@ -116,6 +120,7 @@ export type ProductFilterQueryParams = {
116
120
  jobIndustriesIdsSelected: number[]
117
121
  filterProductRecommendations: ProductFilterRecommendations
118
122
  filterMyContractSupportedOnly: boolean
123
+ searchTextInput: string
119
124
  }
120
125
 
121
126
  export type ProductSearchFilters = {
package/theming/types.ts CHANGED
@@ -39,6 +39,7 @@ declare const useTheme: UseThemeFactory<DefaultTheme>
39
39
 
40
40
  export type ThemeGlobalStyles = {
41
41
  borderRadius: string
42
+ borderColor: string
42
43
 
43
44
  primaryBackgroundColor: string
44
45
  primaryTextColor: string
@@ -67,6 +68,9 @@ export type ThemeGlobalStyles = {
67
68
 
68
69
  accentBackgroundColor: string
69
70
  accentTextColor: string
71
+
72
+ scrollBarTrackColor: string
73
+ scrollBarThumbColor: string
70
74
  }
71
75
 
72
76
  export type HapiThemingThemeProvider = Theming<HapiTheme>["ThemeProvider"]
@@ -98,6 +102,7 @@ export type HapiThemeRule =
98
102
  | "buttonFaded"
99
103
  | "buttonAccent"
100
104
  | "badgeBase"
105
+ | "formFieldLabel"
101
106
  | "formFieldBase"
102
107
  | "inputSelectBase"
103
108
  | "input"
@@ -3,6 +3,8 @@ import { WindowHapiModuleWithConstructorArgs } from "../_window"
3
3
 
4
4
  export type WindowHapiServiceUI = WindowHapiModuleWithConstructorArgs<
5
5
  {
6
+ onIframeLoaded: (callback: (iframeName: string) => void) => void
7
+ onIframeUnloaded: (callback: (iframeName: string) => void) => void
6
8
  setStyleAttribute: (
7
9
  selector: string,
8
10
  attributeName: string,
@@ -11,12 +13,12 @@ export type WindowHapiServiceUI = WindowHapiModuleWithConstructorArgs<
11
13
  setStyle: (selector: string, style: any) => Promise<void>
12
14
  addClass: (selector: string, className: string) => Promise<void>
13
15
  removeClass: (selector: string, className: string) => Promise<void>
14
- appendChild: (
15
- containerSelector: string,
16
+ appendChildToSlot: (
17
+ slotId: string,
16
18
  element: HTMLElement,
17
19
  ) => Promise<void>
18
- removeChild: (
19
- containerSelector: string,
20
+ removeChildFromSlot: (
21
+ slotId: string,
20
22
  elementSelector: string,
21
23
  ) => Promise<void>
22
24
  hideElement: (elementSelector: string) => Promise<void>
@@ -6,53 +6,17 @@ import {
6
6
  } from "./types"
7
7
 
8
8
  export type WalletState = {
9
- /**
10
- * User's Wallet that can hold credits to be used on Creating/Ordering a Campaign
11
- */
12
9
  wallet: Wallet | null
13
- /**
14
- * User's balance in dollars converted from cents through `wallet.balance`. **This value is a computed getter meaning that it cannot be set from outside**
15
- */
16
10
  balanceInUSD: number | null
17
- /**
18
- * Indicates whether or not user has enough credits/balance to Order a Campaign
19
- */
20
11
  balanceIsEnoughToOrderCampaign: boolean
21
- /**
22
- * Shows a loading spinner while wallet is loading
23
- */
24
12
  walletIsLoading: boolean
25
- /**
26
- * The request body to be sent to HAPI Backend Service to create a payment intent. **This value is a computed getter meaning that it cannot be set from outside**
27
- */
28
13
  paymentIntentRequestBody: WalletPaymentIntentRequest | null
29
14
  paymentIntentClientSecret: string | null
30
- /**
31
- * Shows a loading spinner while PaymentIntent is creating
32
- */
33
15
  topUpIsLoading: boolean
34
- /**
35
- * A custom amount to specify for the top up of balance
36
- */
37
16
  topUpAmount: number
38
- /**
39
- * A minimum amount enforced by an ATS for the top up of balance
40
- */
41
17
  topUpMinAmount: number
42
- /**
43
- * A minimum amount's currency enforced by an ATS for the top up of balance
44
- */
45
18
  topUpMinAmountCurrency: ProductPriceCurrency
46
- /**
47
- * Indicates if user has agreed to terms of service
48
- */
49
19
  topUpTermsOfServiceIsAgreed: boolean
50
- /**
51
- * Step of the popup. **Should not be edited from outside**
52
- */
53
20
  topUpCurrentStepIndex: number
54
- /**
55
- * An array of payment method types that Stripe accepts https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_types to specify which types of payment methods the end user can use
56
- */
57
21
  topUpPaymentMethodTypes: WalletPaymentIntentPaymentMethod[]
58
22
  }