@vonq/hapi-elements-types 1.25.0 → 1.27.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.
@@ -0,0 +1,52 @@
1
+ import { RecursivePartial } from "../common"
2
+ import { Campaign, CampaignOrderRequestBody } from "../campaign"
3
+
4
+ export enum ExperimentalSuggestionEndpointName {
5
+ "postingRequirements" = "posting_requirements",
6
+ "vacancyFields" = "vacancy_fields",
7
+ "primaryTaxonomy" = "primary_taxonomy",
8
+ }
9
+
10
+ export type ExperimentalSuggestionResponseStatus =
11
+ | "new"
12
+ | "pending"
13
+ | "error"
14
+ | "done"
15
+
16
+ export type ExperimentalSuggestionCreateRequestData<P> = {
17
+ contract_id?: string
18
+ payload: P
19
+ }
20
+
21
+ export type ExperimentalSuggestionGetResponseData<P, R> = {
22
+ id: string
23
+ status: ExperimentalSuggestionResponseStatus
24
+ contract_id?: string
25
+ type: ExperimentalSuggestionEndpointName
26
+ payload: P
27
+ response: R
28
+ }
29
+
30
+ export type ExperimentalSuggestionPostingRequirementsCreateRequestPayload =
31
+ RecursivePartial<CampaignOrderRequestBody>
32
+
33
+ export type ExperimentalSuggestionPostingRequirementsGetResponseData = Record<
34
+ string,
35
+ string | null | number | any[]
36
+ >
37
+
38
+ export type ExperimentalSuggestionVacancyFieldsCreateRequestPayload = {
39
+ description: string
40
+ }
41
+
42
+ export type ExperimentalSuggestionVacancyFieldsGetResponseData =
43
+ RecursivePartial<Campaign>
44
+
45
+ export type ExperimentalSuggestionPrimaryTaxonomyCreateRequestPayload = {
46
+ description: string
47
+ }
48
+
49
+ export type ExperimentalSuggestionPrimaryTaxonomyGetResponseData = Record<
50
+ string,
51
+ string
52
+ >
@@ -11,6 +11,7 @@ import {
11
11
  import { WindowHapiUtilsModal } from "../modal/utils.types"
12
12
  import { WindowHapiUtilsRouter } from "../routing/utils.types"
13
13
  import { WindowHapiUtilsLanguage } from "../language/utils.types"
14
+ import { WindowHapiUtilsAlert } from "../alert/utils.types"
14
15
 
15
16
  export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
16
17
  {
@@ -44,6 +45,7 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
44
45
  modal: WindowHapiUtilsModal
45
46
  router: WindowHapiUtilsRouter
46
47
  language: WindowHapiUtilsLanguage
48
+ alert: WindowHapiUtilsAlert
47
49
 
48
50
  utilities: {
49
51
  [WindowHapiModuleName.basket]: WindowHapiUtilsBasket
@@ -54,6 +56,7 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
54
56
  [WindowHapiModuleName.modal]: WindowHapiUtilsModal
55
57
  [WindowHapiModuleName.router]: WindowHapiUtilsRouter
56
58
  [WindowHapiModuleName.language]: WindowHapiUtilsLanguage
59
+ [WindowHapiModuleName.alert]: WindowHapiUtilsAlert
57
60
  }
58
61
  },
59
62
  { readonly core: WindowHapiClassInterface }
package/alert/enums.ts CHANGED
@@ -3,6 +3,7 @@ export enum AlertKey {
3
3
  topupSuccess = "topup-success",
4
4
  contractRemoveSuccess = "contract-removed",
5
5
  contractCreateSuccess = "contract-created",
6
+ contractEditSuccess = "contract-edited",
6
7
  contractGroupCreateSuccess = "contract-group-created",
7
8
  campaignTakeOfflineSuccess = "campaign-take-offline-success",
8
9
  campaignProductTakeOfflineSuccess = "campaign-product-take-offline-success",
@@ -14,6 +15,7 @@ export enum AlertKey {
14
15
  productAddToBasket = "add-product-to-basket-success",
15
16
  productRemoveFromBasket = "remove-product-from-basket-warning",
16
17
  utmCodeConfirmation = "utm-code-confirmation",
18
+ __experimentalCampaignVacancyFieldsSmartFillEmpty = "__experimental-campaign-vacancy-fields-smart-fill-empty",
17
19
  }
18
20
 
19
21
  export enum AlertType {
@@ -10,6 +10,7 @@ export type WindowHapiServiceAlert = WindowHapiModuleWithConstructorArgs<
10
10
  props: any | undefined,
11
11
  options: AlertOptions,
12
12
  ) => void
13
+ hide: (key: AlertKey) => void
13
14
  },
14
15
  { readonly service: WindowHapiService }
15
16
  >
package/alert/types.ts CHANGED
@@ -11,6 +11,10 @@ export type ContractCreateSuccessAlertProps = {
11
11
  contractName: string
12
12
  }
13
13
 
14
+ export type ContractEditSuccessAlertProps = {
15
+ contractName: string
16
+ }
17
+
14
18
  export type ContractRemoveSuccessAlertProps = {
15
19
  contractName: string
16
20
  }
@@ -32,6 +36,8 @@ export type UTMCodesSuccessAlertProps = {
32
36
  type: "save" | "reset"
33
37
  }
34
38
 
39
+ export type ExperimentalCampaignVacancyFieldsAIPrefillEmptyAlertProps = {}
40
+
35
41
  export type ButtonCopySuccessAlertProps = {}
36
42
 
37
43
  export type CampaignOrderSuccessAlertProps = {}
@@ -0,0 +1,10 @@
1
+ import { WindowHapiUtils } from "../_window/utils.types"
2
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
3
+ import { AlertKey } from "./enums"
4
+
5
+ export type WindowHapiUtilsAlert = WindowHapiModuleWithConstructorArgs<
6
+ {
7
+ alertKeys: typeof AlertKey
8
+ },
9
+ { readonly utils: WindowHapiUtils }
10
+ >
package/ats/types.ts CHANGED
@@ -24,6 +24,7 @@ export type ATSUserSettings = {
24
24
  can_use_wallets: boolean
25
25
  can_pay_with_direct_charge: boolean
26
26
  invoice_currency: string | null
27
+ ai_suggestions: boolean
27
28
  }
28
29
  export type ATSSettings = {
29
30
  payment_settings: ATSUserPaymentSetting[]
package/campaign/enums.ts CHANGED
@@ -9,6 +9,7 @@ export enum EmploymentType {
9
9
  }
10
10
 
11
11
  export enum SalaryPeriod {
12
- MONTHLY = "monthly",
13
- YEARLY = "yearly",
12
+ hourly = "hourly",
13
+ monthly = "monthly",
14
+ yearly = "yearly",
14
15
  }
@@ -7,6 +7,7 @@ export type WindowHapiQACampaign = WindowHapiModuleWithConstructorArgs<
7
7
  useMockCampaignForm: () => CampaignCreateForm
8
8
  getRandomCampaignId: () => Promise<string>
9
9
  setCampaignFormDebuggerIsShown: (isEnabled: boolean) => boolean
10
+ setCampaignCardDebuggerIsShown: (isEnabled: boolean) => boolean
10
11
  },
11
12
  { readonly qa: WindowHapiQA }
12
13
  >
@@ -24,6 +24,11 @@ import {
24
24
  OrderJourneyOrderErrors,
25
25
  OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid,
26
26
  } from "../orderJourney"
27
+ import {
28
+ FormFacetsFieldType,
29
+ PostingRequirement,
30
+ TransformedPostingRequirement,
31
+ } from "../common"
27
32
 
28
33
  export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
29
34
  {
@@ -73,6 +78,9 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
73
78
  newErrors: OrderJourneyOrderErrorsCampaignIsValidButPostingRequirementsInvalid,
74
79
  indexOfNewPostingRequirements: number,
75
80
  ) => OrderJourneyOrderErrors
81
+ getPostingRequirementFormFieldType: (
82
+ requirement: TransformedPostingRequirement | PostingRequirement,
83
+ ) => FormFacetsFieldType
76
84
  },
77
85
  { readonly utils: WindowHapiUtils }
78
86
  >
@@ -8,6 +8,7 @@ export type LogOutput = (
8
8
 
9
9
  export type WindowHapiLogger = {
10
10
  id: string
11
+ isEnabled: boolean
11
12
  setIsEnabled: (isEnabled: boolean) => void
12
13
  debug: (...objects: any[]) => void
13
14
  info: (...objects: any[]) => void
@@ -15,4 +16,4 @@ export type WindowHapiLogger = {
15
16
  error: (...objects: any[]) => void
16
17
  timeStart: (message: string) => void
17
18
  timeEnd: (message: string) => void
18
- }
19
+ }
package/common/types.ts CHANGED
@@ -268,10 +268,10 @@ export type FormFacetsFieldType =
268
268
  | "select-tree-async"
269
269
  | "select-tree"
270
270
  | "select-tree-autocomplete"
271
- | "input-tag"
272
- | "date"
273
271
  | "select-autocomplete"
274
272
  | "select-multi-autocomplete"
273
+ | "input-tag"
274
+ | "date"
275
275
  | "heading"
276
276
  | "file-upload"
277
277
  | "unknown"
@@ -4,7 +4,7 @@ import {
4
4
  ContractCreateForm,
5
5
  ContractGroup,
6
6
  ContractGroupCreateForm,
7
- ContractUpdateForm,
7
+ ContractEditForm,
8
8
  } from "./types"
9
9
  import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
10
10
  import { PaginatedAPIResponseV1, PaginationLimitOffset } from "../common/types"
@@ -15,7 +15,7 @@ export type WindowHapiAPIContractConfigs = {
15
15
  getContractsByIds: AxiosRequestConfig
16
16
  getContract: AxiosRequestConfig
17
17
  createContract: AxiosRequestConfig
18
- updateContract: AxiosRequestConfig
18
+ saveContract: AxiosRequestConfig
19
19
  removeContract: AxiosRequestConfig
20
20
  getPostingRequirementOptions: AxiosRequestConfig
21
21
  getGroups: AxiosRequestConfig
@@ -32,10 +32,7 @@ export type WindowHapiAPIContractRequests = {
32
32
  ) => Promise<PaginatedAPIResponseV1<Contract>>
33
33
  getContract: (contractId: string) => Promise<Contract>
34
34
  createContract: (contract: ContractCreateForm) => Promise<Contract>
35
- updateContract: (
36
- contractId: string,
37
- contract: ContractUpdateForm,
38
- ) => Promise<Contract>
35
+ saveContract: (contract: ContractEditForm) => Promise<Contract>
39
36
  getPostingRequirementOptions: (
40
37
  contractId: string,
41
38
  fieldName: string,
@@ -27,6 +27,7 @@ export type ContractServiceGetContractsLabeledHandler = (
27
27
  labels?: Record<string, string> | null,
28
28
  ) => Promise<PaginatedAPIResponseV1<Contract>>
29
29
  export type ContractServiceCreateContractHandler = () => Promise<Contract>
30
+ export type ContractServiceSaveContractHandler = () => Promise<Contract>
30
31
  export type ContractServiceRemoveContractHandler = (
31
32
  contractId: string,
32
33
  ) => Promise<void>
@@ -44,6 +45,7 @@ export type WindowHapiServiceContract = WindowHapiModuleWithConstructorArgs<
44
45
  getContractGroups: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractGroupsHandler>
45
46
  createContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceCreateContractHandler>
46
47
  removeContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceRemoveContractHandler>
48
+ saveContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceSaveContractHandler>
47
49
  createContractGroup: HapiServiceFunctionWithLifecycleHooks<ContractServiceCreateContractGroupHandler>
48
50
  getContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractHandler>
49
51
  initiateOauthLogin: (
@@ -5,7 +5,7 @@ import {
5
5
  ContractGroup,
6
6
  ContractGroupCreateForm,
7
7
  ContractGroupSelected,
8
- ContractUpdateForm,
8
+ ContractEditForm,
9
9
  } from "./types"
10
10
  import { PaginationResponseV1 } from "../common/types"
11
11
 
@@ -17,7 +17,7 @@ export type ContractState = {
17
17
  contractSelectedId: string | number | null
18
18
  contractSelected: ProductSupportingContractsComplete | null
19
19
  contractSelectedIsLoading: boolean
20
- contractForm: ContractCreateForm | ContractUpdateForm
20
+ contractForm: ContractCreateForm | ContractEditForm
21
21
  contractCreateError: any
22
22
  contractFormIsValid: boolean | null
23
23
  /* Contracts Groups */
package/contract/types.ts CHANGED
@@ -24,7 +24,7 @@ export type ContractPurchasePrice = {
24
24
  export type ContractCreateFormCredentials = Record<string, string>
25
25
 
26
26
  export type ContractCreateForm = {
27
- id?: number
27
+ id?: number | string
28
28
  credentials?: ContractCreateFormCredentials
29
29
  facets?: any | null
30
30
  expiry_date: string | null
@@ -35,10 +35,10 @@ export type ContractCreateForm = {
35
35
  posting_duration_days: number | null
36
36
  allow_renegotiation: boolean
37
37
  labels: Record<string, string> | null
38
- posting_requirements_defaults: Record<string, string> | null
38
+ posting_requirements_defaults: Record<string, string | string[]> | null
39
39
  }
40
40
 
41
- export type ContractUpdateForm = Omit<ContractCreateForm, "id">
41
+ export type ContractEditForm = ContractCreateForm
42
42
 
43
43
  export type ContractGroupCreateForm = {
44
44
  name: string
@@ -46,6 +46,7 @@ export type ContractGroupCreateForm = {
46
46
 
47
47
  export type ContractChannel = ProductLogos &
48
48
  ProductType & {
49
+ allows_edit?: boolean
49
50
  id: number
50
51
  name: string
51
52
  url: string
@@ -65,6 +66,7 @@ export type Contract = {
65
66
  purchase_price: ContractPurchasePrice | null
66
67
  posting_duration_days: number | null
67
68
  group: ContractGroup | null
69
+ posting_requirements_defaults: Record<string, string | string[]> | null
68
70
  }
69
71
 
70
72
  export type ContractGroup = {
@@ -34,10 +34,12 @@ export type ZodContractProduct = ZodObject<{
34
34
  title: ZodString
35
35
  }>
36
36
  export type ZodContractPurchasePrice = ZodOptional<
37
- ZodObject<{
38
- amount: ZodNullable<ZodNumber>
39
- currency: ZodNullable<ZodString>
40
- }>
37
+ ZodNullable<
38
+ ZodObject<{
39
+ amount: ZodNullable<ZodNumber>
40
+ currency: ZodNullable<ZodString>
41
+ }>
42
+ >
41
43
  >
42
44
  export type ZodContractGroup = ZodObject<{
43
45
  id: ZodOptional<ZodString>
@@ -52,7 +54,7 @@ export type ZodContractGroupCreateForm = ZodObject<{
52
54
  name: ZodString
53
55
  }>
54
56
  export type ZodContractCreateForm = ZodObject<{
55
- id: ZodOptional<ZodNumber>
57
+ id: ZodOptional<ZodUnion<[ZodNumber, ZodString]>>
56
58
  credentials: ZodOptional<ZodObject<any>>
57
59
  facets: ZodContractFacets
58
60
  alias: ZodContractAlias
@@ -1,5 +1,6 @@
1
1
  export type DebuggingState = {
2
2
  campaignFormDebuggerIsShown: boolean
3
+ campaignCardDebuggerIsShown: boolean
3
4
  localeDebuggingIsEnabled: boolean
4
5
  componentDebuggingIsEnabled: boolean
5
6
  consoleLogsAreEnabled: boolean
package/modal/enums.ts CHANGED
@@ -21,10 +21,11 @@ export enum ModalKeys {
21
21
  contractEdit = "contract-edit",
22
22
  contractGroupConflictInfo = "contract-group-conflict-info",
23
23
  filePicker = "file-picker",
24
- contractPostingRequirementsSmartFillSuccess = "contract-posting-requirements-smart-fill-success",
25
24
  "mediaEditor" = "media-editor",
26
25
  "uploadWidget" = "upload-widget",
27
26
  "mediaLibrary" = "media-library",
27
+ __experimentalContractPostingRequirementsSmartFillSuccess = "__experimental-contract-posting-requirements-smart-fill-success",
28
+ __experimentalCampaignVacancyFieldsSmartFillSuccess = "__experimental-campaign-vacancy-fields-smart-fill-success",
28
29
  }
29
30
 
30
31
  export enum FilePickerModalPropsActionFor {
package/modal/types.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { Product } from "../product/types"
2
2
  import { Contract } from "../contract/types"
3
3
  import { FilePickerModalPropsActionFor, ModalKeys, ModalZone } from "./enums"
4
- import { AnyNonFunction, TransformedPostingRequirement } from "../common/types"
4
+ import {
5
+ AnyNonFunction,
6
+ RecursivePartial,
7
+ TransformedPostingRequirement,
8
+ } from "../common/types"
5
9
  import { Campaign } from "../campaign"
6
10
  import { OrderJourneyPaymentMethod } from "../orderJourney"
7
11
  import { PickerDisplayMode } from "filestack-js"
@@ -20,6 +24,7 @@ export type CampaignProductTakeOfflineConfirmationModalProps = {
20
24
  productId: string
21
25
  }
22
26
  export type ContractRemoveConfirmationModalProps = { contractId: string }
27
+ export type ContractEditJourneyModalProps = { contractId: string }
23
28
  export type ContractGroupConflictInfoModalProps = {
24
29
  contract: Contract
25
30
  conflictingContracts: Contract[]
@@ -44,6 +49,9 @@ export type ContractPostingRequirementsSmartFillResponseModalProps = {
44
49
  postingRequirements: Record<string, TransformedPostingRequirement>
45
50
  contractId: string
46
51
  }
52
+ export type CampaignVacancyFieldsSmartFillResponseModalProps = {
53
+ response: RecursivePartial<Campaign>
54
+ }
47
55
  export type FilePickerOptions = {
48
56
  accept?: string[]
49
57
  uploadInBackground?: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.25.0",
4
+ "version": "1.27.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",