@vonq/hapi-elements-types 1.31.0 → 1.32.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.
@@ -9,6 +9,7 @@ export type WindowHapiServiceAlert = WindowHapiModuleWithConstructorArgs<
9
9
  key: AlertKey,
10
10
  props: any | undefined,
11
11
  options: AlertOptions,
12
+ id: string,
12
13
  ) => void
13
14
  hide: (key: AlertKey) => void
14
15
  },
package/alert/types.ts CHANGED
@@ -68,6 +68,7 @@ export type AlertProps = AnyNonFunction<
68
68
  >
69
69
 
70
70
  export type Alert = {
71
+ id: string
71
72
  key: AlertKey
72
73
  props: AlertProps | undefined
73
74
  options: AlertOptions
@@ -12,6 +12,7 @@ export type BasketState = {
12
12
  totalInWalletCurrency: number
13
13
  totalExceedsMaxPurchaseOrder: boolean
14
14
  productsAreLoading: boolean
15
+ productIdsBeingAdded: (string | number)[]
15
16
  deliveryAndProcessingTimes: ProductOrderDeliveryTime | null
16
17
  deliveryAndProcessingTimesAreLoading: boolean
17
18
  }
@@ -4,7 +4,7 @@ import { CampaignCreateForm } from "./types"
4
4
 
5
5
  export type WindowHapiQACampaign = WindowHapiModuleWithConstructorArgs<
6
6
  {
7
- useMockCampaignForm: () => CampaignCreateForm
7
+ useMockCampaignForm: () => Promise<CampaignCreateForm>
8
8
  getRandomCampaignId: () => Promise<string>
9
9
  setCampaignFormDebuggerIsShown: (isEnabled: boolean) => boolean
10
10
  setCampaignCardDebuggerIsShown: (isEnabled: boolean) => boolean
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Campaign,
3
3
  CampaignCreateForm,
4
+ CampaignCreateFormDraft,
4
5
  CampaignEditForm,
5
6
  TaxonomyEducationAndSeniorityLevel,
6
7
  TaxonomyEmploymentTypes,
@@ -14,6 +15,7 @@ export type CampaignState = {
14
15
  campaignsPaginationMeta: PaginationResponseV2
15
16
  campaignsAreLoading: boolean
16
17
  campaignForm: CampaignCreateForm | CampaignEditForm
18
+ campaignFormDraft: CampaignCreateFormDraft | null
17
19
  campaignIsCreating: boolean
18
20
  /* Education Levels */
19
21
  educationLevels: TaxonomyEducationAndSeniorityLevel[]
package/campaign/types.ts CHANGED
@@ -46,11 +46,11 @@ export type CampaignPostingDetailsOrganization = {
46
46
  export type CampaignProductPostingDetailsSalaryIndicationRange = {
47
47
  currency?: string | null
48
48
  from?: number | null
49
- to: number
49
+ to?: number | null
50
50
  }
51
51
 
52
52
  export type CampaignPostingDetailsSalaryIndication = {
53
- period: SalaryPeriod
53
+ period: SalaryPeriod | null
54
54
  range: CampaignProductPostingDetailsSalaryIndicationRange
55
55
  }
56
56
 
@@ -76,7 +76,7 @@ export type CampaignPostingDetails = {
76
76
  employmentType: EmploymentType
77
77
  jobPageUrl: string
78
78
  organization: CampaignPostingDetailsOrganization
79
- salaryIndication: CampaignPostingDetailsSalaryIndication
79
+ salaryIndication: CampaignPostingDetailsSalaryIndication | null
80
80
  title: string
81
81
  weeklyWorkingHours: CampaignPostingDetailsWeeklyWorkingHours
82
82
  workingLocation: CampaignPostingDetailsWorkingLocation
@@ -216,7 +216,7 @@ export type CampaignCreateFormPostingDetails = {
216
216
  yearsOfExperience: number
217
217
  employmentType: EmploymentType
218
218
  weeklyWorkingHours: CampaignPostingDetailsWeeklyWorkingHours
219
- salaryIndication: CampaignPostingDetailsSalaryIndication
219
+ salaryIndication: CampaignPostingDetailsSalaryIndication | null
220
220
  contactInfo: CampaignPostingDetailsContactInfo | null
221
221
  jobPageUrl: string
222
222
  applicationUrl: string
@@ -239,6 +239,9 @@ export type CampaignCreateForm = {
239
239
  heStateSnapshotId?: string
240
240
  }
241
241
 
242
+ export type CampaignCreateFormDraft = CampaignCreateForm &
243
+ Pick<Campaign, "campaignId">
244
+
242
245
  export type CampaignEditForm = Omit<
243
246
  CampaignCreateForm,
244
247
  | "companyId"
@@ -54,14 +54,16 @@ export type ZodCampaignPostingDetailsOrganization = ZodObject<{
54
54
  companyLogo: ZodString
55
55
  name: ZodString
56
56
  }>
57
- export type ZodCampaignPostingDetailsSalaryIndication = ZodObject<{
58
- period: ZodString
59
- range: ZodObject<{
60
- currency: ZodOptional<ZodNullable<ZodString>>
61
- from: ZodOptional<ZodNullable<ZodNumber>>
62
- to: ZodNumber
57
+ export type ZodCampaignPostingDetailsSalaryIndication = ZodNullable<
58
+ ZodObject<{
59
+ period: ZodOptional<ZodNullable<ZodString>>
60
+ range: ZodObject<{
61
+ currency: ZodOptional<ZodNullable<ZodString>>
62
+ from: ZodOptional<ZodNullable<ZodNumber>>
63
+ to: ZodOptional<ZodNullable<ZodNumber>>
64
+ }>
63
65
  }>
64
- }>
66
+ >
65
67
  export type ZodCampaignPostingDetailsWeeklyWorkingHours = ZodObject<{
66
68
  from: ZodOptional<ZodNullable<ZodNumber>>
67
69
  to: ZodNumber
@@ -193,7 +195,7 @@ export type ZodCampaignCreateFormTargetGroup = ZodObject<{
193
195
  }>
194
196
  >
195
197
  }>
196
- export type ZodCampaignCreateForm = ZodObject<{
198
+ export type ZodCampaignCreateFormRaw = {
197
199
  labels: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodString>>>
198
200
  companyId: ZodString
199
201
  campaignName: ZodOptional<ZodNullable<ZodString>>
@@ -206,7 +208,16 @@ export type ZodCampaignCreateForm = ZodObject<{
206
208
  postingDetails: ZodCampaignCreateFormPostingDetails
207
209
  orderedProductsSpecs: ZodCampaignCreateFormOrderedProductSpecs
208
210
  orderedProducts: ZodArray<ZodString>
209
- }>
211
+ }
212
+ export type ZodCampaignCreateForm = ZodObject<ZodCampaignCreateFormRaw>
213
+ export type ZodCampaignCampaignIdRaw = {
214
+ campaignId: ZodString
215
+ }
216
+ export type ZodCampaignCreateFormDraftPartials =
217
+ ZodObject<ZodCampaignCampaignIdRaw>
218
+ export type ZodCampaignCreateFormDraft = ZodNullable<
219
+ ZodObject<ZodCampaignCreateFormRaw & ZodCampaignCampaignIdRaw>
220
+ >
210
221
  export type WindowHapiValidationsCampaign = {
211
222
  status: string[]
212
223
  draftStatus: CampaignDraftStatus[]
@@ -241,6 +252,8 @@ export type WindowHapiValidationsCampaign = {
241
252
  campaign: ZodCampaign
242
253
  campaigns: ZodCampaigns
243
254
  campaignForm: ZodCampaignCreateForm
255
+ campaignFormDraft: ZodCampaignCreateFormDraft
256
+ campaignFormDraftPartials: ZodCampaignCreateFormDraftPartials
244
257
  campaignFormTargetGroup: ZodCampaignCreateFormTargetGroup
245
258
  campaignFormPostingDetails: ZodCampaignCreateFormPostingDetails
246
259
  campaignFormOrderedProductsSpecs: ZodCampaignCreateFormOrderedProductSpecs
package/common/types.ts CHANGED
@@ -82,12 +82,13 @@ export type ValidatorKey =
82
82
  | "isPostalCodeLocales"
83
83
  >
84
84
  | keyof Validators
85
+ export type ValidatorKeyMap = {
86
+ [k: string]: ValidatorKey | NestedValidatorKeys
87
+ }
85
88
  export type NestedValidatorKeys =
86
89
  | ValidatorKey
87
90
  | ValidatorKey[]
88
- | {
89
- [k: string]: ValidatorKey | NestedValidatorKeys
90
- }
91
+ | ValidatorKeyMap
91
92
  export type BaseService = {
92
93
  logger: WindowHapiLogger
93
94
  }
@@ -13,6 +13,7 @@ import {
13
13
  ZodUnion,
14
14
  ZodUnknown,
15
15
  } from "zod"
16
+ import { Validators } from "./validator"
16
17
 
17
18
  export type ZodIntlDescriptor = ZodObject<{
18
19
  id: ZodString
@@ -55,7 +56,6 @@ export type ZodPaginationResponseV2 = ZodObject<
55
56
  } & ZodPaginationLimitOffsetDefinition
56
57
  >
57
58
  export type WindowHapiValidationsCommon = {
58
- isURL: (url: string) => boolean | never
59
59
  genericBoolean: ZodBoolean
60
60
  genericNumber: ZodNumber
61
61
  genericNumberArray: ZodArray<ZodNumber>
@@ -90,4 +90,4 @@ export type WindowHapiValidationsCommon = {
90
90
  url: ZodString
91
91
  apiResourceRegex: RegExp
92
92
  apiResource: ZodString
93
- }
93
+ } & Validators
@@ -1,6 +1,24 @@
1
+ export type ValidatorsIsNotEmptyHandler = (
2
+ value: string | Record<string, any> | any[],
3
+ ) => boolean
4
+
5
+ export type ValidatorsIsNotEmptyObjectHandler = (
6
+ value: Object | undefined | null,
7
+ ) => boolean
8
+
9
+ export type ValidatorsIsNotZeroHandler = (value: number) => boolean
10
+
11
+ export type ValidatorsIsHandledByBackendHandler = (value: any) => false
12
+
13
+ export type ValidatorsIsURLHandler = (value: string) => boolean
14
+
15
+ export type ValidatorsIsRegExpHandler = (value: string) => boolean
16
+
1
17
  export type Validators = {
2
- isNotEmpty: (value: string | Record<string, any> | any[]) => boolean
3
- isNotEmptyObject: (value: Object | undefined | null) => boolean
4
- isNotZero: (value: number) => boolean
5
- isHandledByBackend: (value: any) => false
18
+ isNotEmpty: ValidatorsIsNotEmptyHandler
19
+ isNotEmptyObject: ValidatorsIsNotEmptyObjectHandler
20
+ isNotZero: ValidatorsIsNotZeroHandler
21
+ isHandledByBackend: ValidatorsIsHandledByBackendHandler
22
+ isURL: ValidatorsIsURLHandler
23
+ isRegExp: ValidatorsIsRegExpHandler
6
24
  }
@@ -2,6 +2,8 @@ import { WindowHapiService } from "../_window/service.types"
2
2
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
3
3
 
4
4
  export type WindowHapiServiceLanguage = WindowHapiModuleWithConstructorArgs<
5
- {},
5
+ {
6
+ resetAndRefreshTaxonomies: () => void
7
+ },
6
8
  { readonly service: WindowHapiService }
7
9
  >
@@ -83,6 +83,7 @@ export type OrderJourneyState = {
83
83
  /* Posting Details */
84
84
  postingDetailsStep: OrderJourneyStep
85
85
  postingDetailsStepData: Record<string, any>
86
+ postingDetailsStepValidators: NestedValidatorKeys
86
87
  postingDetailsStepValidations: UseValidatorResult
87
88
  /* Organization */
88
89
  organizationStep: OrderJourneyStep
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.31.0",
4
+ "version": "1.32.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
package/theming/types.ts CHANGED
@@ -168,6 +168,7 @@ export type HapiThemeRule =
168
168
  | "headingFive"
169
169
  | "headingSix"
170
170
  | "alert"
171
+ | "alertProgressBar"
171
172
 
172
173
  export type HapiThemeComponentVariant =
173
174
  | "primary"