@vonq/hapi-elements-types 1.30.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.
- package/alert/service.types.ts +1 -0
- package/alert/types.ts +1 -0
- package/basket/state.types.ts +1 -0
- package/campaign/qa.types.ts +1 -1
- package/campaign/state.types.ts +2 -0
- package/campaign/types.ts +16 -4
- package/campaign/validations.types.ts +22 -9
- package/common/types.ts +4 -3
- package/common/validations.types.ts +2 -2
- package/common/validator/types.ts +22 -4
- package/language/service.types.ts +3 -1
- package/orderJourney/state.types.ts +1 -0
- package/package.json +1 -1
- package/theming/types.ts +1 -0
package/alert/service.types.ts
CHANGED
package/alert/types.ts
CHANGED
package/basket/state.types.ts
CHANGED
@@ -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
|
}
|
package/campaign/qa.types.ts
CHANGED
@@ -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
|
package/campaign/state.types.ts
CHANGED
@@ -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
|
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
|
@@ -130,6 +130,14 @@ export type CampaignDetailedStatus = {
|
|
130
130
|
orderedProductsStatuses: CampaignDetailsStatusOrderedProductStatus[]
|
131
131
|
}
|
132
132
|
|
133
|
+
export type CampaignDraftOldBackwardsCompatability = {
|
134
|
+
// there is a recipe /docs/recipes/order-journey-campaign-recipes/campaign-order-success-event/
|
135
|
+
// it says if payment method is direct-charge, BE returns `draftCampaignId` instead of `campaignId`
|
136
|
+
// during migration from PKB-drafts to non-PKB drafts, I think this got removed
|
137
|
+
// HE should continue to support it
|
138
|
+
draftCampaignId?: string
|
139
|
+
}
|
140
|
+
|
133
141
|
export type CampaignDraft = {
|
134
142
|
campaignId: string
|
135
143
|
isDraft: boolean
|
@@ -146,6 +154,7 @@ export type CampaignDraftV2 = {
|
|
146
154
|
}
|
147
155
|
|
148
156
|
export type Campaign = Pick<CampaignDraft, "campaignId"> &
|
157
|
+
CampaignDraftOldBackwardsCompatability &
|
149
158
|
CampaignDraftV2 & {
|
150
159
|
labels: Record<string, string> | null
|
151
160
|
currency: ProductPriceCurrency
|
@@ -207,7 +216,7 @@ export type CampaignCreateFormPostingDetails = {
|
|
207
216
|
yearsOfExperience: number
|
208
217
|
employmentType: EmploymentType
|
209
218
|
weeklyWorkingHours: CampaignPostingDetailsWeeklyWorkingHours
|
210
|
-
salaryIndication: CampaignPostingDetailsSalaryIndication
|
219
|
+
salaryIndication: CampaignPostingDetailsSalaryIndication | null
|
211
220
|
contactInfo: CampaignPostingDetailsContactInfo | null
|
212
221
|
jobPageUrl: string
|
213
222
|
applicationUrl: string
|
@@ -230,6 +239,9 @@ export type CampaignCreateForm = {
|
|
230
239
|
heStateSnapshotId?: string
|
231
240
|
}
|
232
241
|
|
242
|
+
export type CampaignCreateFormDraft = CampaignCreateForm &
|
243
|
+
Pick<Campaign, "campaignId">
|
244
|
+
|
233
245
|
export type CampaignEditForm = Omit<
|
234
246
|
CampaignCreateForm,
|
235
247
|
| "companyId"
|
@@ -54,14 +54,16 @@ export type ZodCampaignPostingDetailsOrganization = ZodObject<{
|
|
54
54
|
companyLogo: ZodString
|
55
55
|
name: ZodString
|
56
56
|
}>
|
57
|
-
export type ZodCampaignPostingDetailsSalaryIndication =
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
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:
|
3
|
-
isNotEmptyObject:
|
4
|
-
isNotZero:
|
5
|
-
isHandledByBackend:
|
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