@vonq/hapi-elements-types 1.24.0 → 1.26.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 {
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
  >
@@ -16,7 +16,6 @@ import {
16
16
  import { PaginatedAPIResponseV2 } from "../common/types"
17
17
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
18
18
  import { AlertKey } from "../alert"
19
- import { EmploymentType } from "./enums"
20
19
 
21
20
  export type CampaignServiceGetCampaignsHandler = (
22
21
  offset?: number,
@@ -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
  >
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,6 +4,7 @@ import {
4
4
  ContractCreateForm,
5
5
  ContractGroup,
6
6
  ContractGroupCreateForm,
7
+ ContractEditForm,
7
8
  } from "./types"
8
9
  import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
9
10
  import { PaginatedAPIResponseV1, PaginationLimitOffset } from "../common/types"
@@ -14,6 +15,7 @@ export type WindowHapiAPIContractConfigs = {
14
15
  getContractsByIds: AxiosRequestConfig
15
16
  getContract: AxiosRequestConfig
16
17
  createContract: AxiosRequestConfig
18
+ saveContract: AxiosRequestConfig
17
19
  removeContract: AxiosRequestConfig
18
20
  getPostingRequirementOptions: AxiosRequestConfig
19
21
  getGroups: AxiosRequestConfig
@@ -30,6 +32,7 @@ export type WindowHapiAPIContractRequests = {
30
32
  ) => Promise<PaginatedAPIResponseV1<Contract>>
31
33
  getContract: (contractId: string) => Promise<Contract>
32
34
  createContract: (contract: ContractCreateForm) => Promise<Contract>
35
+ saveContract: (contract: ContractEditForm) => Promise<Contract>
33
36
  getPostingRequirementOptions: (
34
37
  contractId: string,
35
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,6 +5,7 @@ import {
5
5
  ContractGroup,
6
6
  ContractGroupCreateForm,
7
7
  ContractGroupSelected,
8
+ ContractEditForm,
8
9
  } from "./types"
9
10
  import { PaginationResponseV1 } from "../common/types"
10
11
 
@@ -16,7 +17,7 @@ export type ContractState = {
16
17
  contractSelectedId: string | number | null
17
18
  contractSelected: ProductSupportingContractsComplete | null
18
19
  contractSelectedIsLoading: boolean
19
- contractForm: ContractCreateForm
20
+ contractForm: ContractCreateForm | ContractEditForm
20
21
  contractCreateError: any
21
22
  contractFormIsValid: boolean | null
22
23
  /* Contracts Groups */
package/contract/types.ts CHANGED
@@ -24,25 +24,29 @@ 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
- facets?: any
29
+ facets?: any | null
30
30
  expiry_date: string | null
31
31
  alias: string | null
32
- purchase_price: ContractPurchasePrice
32
+ purchase_price: ContractPurchasePrice | null
33
33
  credits: string | null
34
34
  followed_instructions: boolean
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 | string[]> | null
38
39
  }
39
40
 
41
+ export type ContractEditForm = ContractCreateForm
42
+
40
43
  export type ContractGroupCreateForm = {
41
44
  name: string
42
45
  }
43
46
 
44
47
  export type ContractChannel = ProductLogos &
45
48
  ProductType & {
49
+ allows_edit?: boolean
46
50
  id: number
47
51
  name: string
48
52
  url: string
@@ -58,11 +62,11 @@ export type Contract = {
58
62
  credits: number | null
59
63
  customer_id: string
60
64
  expiry_date: string | null
61
- facets?: any[]
62
65
  product: ContractProduct
63
66
  purchase_price: ContractPurchasePrice | null
64
67
  posting_duration_days: number | null
65
68
  group: ContractGroup | null
69
+ posting_requirements_defaults: Record<string, string | string[]> | null
66
70
  }
67
71
 
68
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
@@ -18,12 +18,14 @@ export enum ModalKeys {
18
18
  basketProductBundleParentClashConfirmation = "basket-product-bundle-parent-clash-confirmation",
19
19
  basketProductBundleChildClashConfirmation = "basket-product-bundle-child-clash-confirmation",
20
20
  contractRemoveConfirmation = "contract-remove-confirmation",
21
+ contractEdit = "contract-edit",
21
22
  contractGroupConflictInfo = "contract-group-conflict-info",
22
23
  filePicker = "file-picker",
23
- contractPostingRequirementsSmartFillSuccess = "contract-posting-requirements-smart-fill-success",
24
24
  "mediaEditor" = "media-editor",
25
25
  "uploadWidget" = "upload-widget",
26
26
  "mediaLibrary" = "media-library",
27
+ __experimentalContractPostingRequirementsSmartFillSuccess = "__experimental-contract-posting-requirements-smart-fill-success",
28
+ __experimentalCampaignVacancyFieldsSmartFillSuccess = "__experimental-campaign-vacancy-fields-smart-fill-success",
27
29
  }
28
30
 
29
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.24.0",
4
+ "version": "1.26.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -25,6 +25,9 @@ export type ProductServiceGetFilteredProductsHandler = (
25
25
  filters?: Partial<ProductFilterQueryParams>,
26
26
  ) => Promise<Product[]>
27
27
  export type ProductServiceLoadMoreProductsHandler = () => Promise<Product[]>
28
+ export type ProductServiceLoadMoreFreeAddOnProductsHandler = () => Promise<
29
+ Product[]
30
+ >
28
31
  export type ProductServiceGetProductWithContractsSupportByIdHandler = (
29
32
  id: string | number,
30
33
  ) => Promise<ProductSupportingContractsComplete>
@@ -34,6 +37,7 @@ export type ProductServiceGetProductsWithContractsSupportHandler = (
34
37
  export type ProductServiceGetRecommendedProductsHandler = () => Promise<
35
38
  Product[]
36
39
  >
40
+ export type ProductServiceGetFreeAddOnProductsHandler = () => Promise<Product[]>
37
41
  export type ProductServiceGetProductHandler = (
38
42
  productId: number | string,
39
43
  ) => Promise<Product>
@@ -76,11 +80,13 @@ export type ProductServiceGetProductPostingRequirementsHandler = (
76
80
  export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
77
81
  {
78
82
  loadMoreProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceLoadMoreProductsHandler>
83
+ loadMoreFreeAddOnProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceLoadMoreFreeAddOnProductsHandler>
79
84
  setArbitraryJobTitle: ProductServiceSetArbitraryJobTitle
80
85
  getProductWithContractsSupportById: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductWithContractsSupportByIdHandler>
81
86
  getProductsWithContractsSupport: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductsWithContractsSupportHandler>
82
87
  getFilteredProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetFilteredProductsHandler>
83
88
  getRecommendedProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetRecommendedProductsHandler>
89
+ getFreeAddOnProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetFreeAddOnProductsHandler>
84
90
  getProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductsHandler>
85
91
  getProduct: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductHandler>
86
92
  getLocations: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetLocationsHandler>
@@ -13,6 +13,9 @@ export type ProductState = {
13
13
  /* Products */
14
14
  recommendedProducts: Product[]
15
15
  recommendedProductsAreLoading: boolean
16
+ freeAddOnProducts: Product[]
17
+ freeAddOnProductsAreLoading: boolean
18
+ freeAddOnProductsPaginationMeta: PaginationResponseV1 | null
16
19
  productsWithContractsSupport: ProductSupportingContractsPartial[]
17
20
  productsWithContractsSupportAreLoading: boolean
18
21
  products: Product[]