@vonq/hapi-elements-types 1.4.0 → 1.5.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/enums.ts +41 -0
- package/package.json +5 -7
- package/src/_window/api.types.ts +59 -0
- package/src/_window/auth.types.ts +11 -0
- package/src/_window/config.types.ts +30 -0
- package/src/_window/events.types.ts +157 -0
- package/src/_window/index.ts +16 -0
- package/src/_window/instances.types.ts +18 -0
- package/src/_window/qa.types.ts +28 -0
- package/src/_window/routing.types.ts +21 -0
- package/src/_window/sdk.types.ts +147 -0
- package/src/_window/service.types.ts +67 -0
- package/src/_window/state.types.ts +112 -0
- package/src/_window/ui.types.ts +13 -0
- package/src/_window/utils.types.ts +34 -0
- package/src/_window/validation.types.ts +43 -0
- package/src/_window/window.ts +56 -0
- package/src/alert/enums.ts +22 -0
- package/src/alert/functions.types.ts +13 -0
- package/src/alert/index.ts +9 -0
- package/src/alert/service.types.ts +15 -0
- package/src/alert/state.initial.ts +16 -0
- package/src/alert/state.types.ts +27 -0
- package/src/alert/state.validations.ts +11 -0
- package/src/alert/types.ts +63 -0
- package/src/ats/api.types.ts +16 -0
- package/src/ats/functions.types.ts +7 -0
- package/src/ats/index.ts +9 -0
- package/src/ats/service.types.ts +17 -0
- package/src/ats/state.initial.ts +5 -0
- package/src/ats/state.types.ts +5 -0
- package/src/ats/state.validations.ts +6 -0
- package/src/ats/types.ts +19 -0
- package/src/basket/consts.ts +1 -0
- package/src/basket/functions.types.ts +40 -0
- package/src/basket/index.ts +12 -0
- package/src/basket/service.types.ts +32 -0
- package/src/basket/state.initial.ts +11 -0
- package/src/basket/state.types.ts +34 -0
- package/src/basket/state.validations.ts +12 -0
- package/src/basket/types.ts +4 -0
- package/src/basket/utils.ts +79 -0
- package/src/basket/utils.types.ts +10 -0
- package/src/basket/validations.types.ts +25 -0
- package/src/campaign/api.types.ts +45 -0
- package/src/campaign/consts.ts +1 -0
- package/src/campaign/enums.ts +17 -0
- package/src/campaign/functions.types.ts +90 -0
- package/src/campaign/index.ts +15 -0
- package/src/campaign/qa.types.ts +12 -0
- package/src/campaign/service.types.ts +48 -0
- package/src/campaign/state.initial.ts +84 -0
- package/src/campaign/state.types.ts +55 -0
- package/src/campaign/state.validations.ts +16 -0
- package/src/campaign/types.ts +237 -0
- package/src/campaign/utils.ts +53 -0
- package/src/campaign/utils.types.ts +59 -0
- package/src/campaign/validations.types.ts +215 -0
- package/src/common/LocalStorage.ts +123 -0
- package/src/common/browser.ts +2 -0
- package/src/common/color.ts +9 -0
- package/src/common/events/EventCommand/enums.ts +49 -0
- package/src/common/events/EventCommand/index.ts +4 -0
- package/src/common/events/EventCommand/types.ts +18 -0
- package/src/common/events/index.ts +4 -0
- package/src/common/events/types.ts +52 -0
- package/src/common/immutable.ts +28 -0
- package/src/common/index.ts +22 -0
- package/src/common/instances/Instance.ts +13 -0
- package/src/common/instances/consts.ts +1 -0
- package/src/common/instances/index.ts +4 -0
- package/src/common/json.ts +25 -0
- package/src/common/logger/Logger.ts +70 -0
- package/src/common/logger/enums.ts +12 -0
- package/src/common/logger/index.ts +5 -0
- package/src/common/logger/types.ts +7 -0
- package/src/common/logger-datadog/LoggerDatadog.ts +42 -0
- package/src/common/logger-datadog/index.ts +3 -0
- package/src/common/misc.ts +114 -0
- package/src/common/promise.ts +161 -0
- package/src/common/proxy.ts +77 -0
- package/src/common/qa.types.ts +9 -0
- package/src/common/regExTest.ts +12 -0
- package/src/common/tree.ts +148 -0
- package/src/common/types.ts +110 -0
- package/src/common/utm.ts +19 -0
- package/src/common/validations.types.ts +89 -0
- package/src/common/validators.ts +21 -0
- package/src/common/webComponents.ts +26 -0
- package/src/config/functions.types.ts +23 -0
- package/src/config/index.ts +5 -0
- package/src/config/state.initial.ts +11 -0
- package/src/config/state.types.ts +15 -0
- package/src/consts.ts +980 -0
- package/src/contract/api.types.ts +47 -0
- package/src/contract/consts.ts +1 -0
- package/src/contract/functions.types.ts +112 -0
- package/src/contract/index.ts +14 -0
- package/src/contract/qa.types.ts +12 -0
- package/src/contract/service.types.ts +54 -0
- package/src/contract/state.initial.ts +39 -0
- package/src/contract/state.types.ts +74 -0
- package/src/contract/state.validations.ts +21 -0
- package/src/contract/types.ts +145 -0
- package/src/contract/utils.ts +36 -0
- package/src/contract/utils.types.ts +11 -0
- package/src/contract/validations.types.ts +104 -0
- package/src/debugging/functions.types.ts +34 -0
- package/src/debugging/index.ts +6 -0
- package/src/debugging/state.initial.ts +10 -0
- package/src/debugging/state.types.ts +18 -0
- package/src/debugging/state.validations.ts +10 -0
- package/src/index.ts +22 -0
- package/src/language/consts.ts +6 -0
- package/src/language/en.ts +530 -0
- package/src/language/functions.types.ts +29 -0
- package/src/language/index.ts +11 -0
- package/src/language/qa.types.ts +19 -0
- package/src/language/state.initial.ts +13 -0
- package/src/language/state.types.ts +25 -0
- package/src/language/state.validations.ts +10 -0
- package/src/language/utils.ts +17 -0
- package/src/language/validations.types.ts +13 -0
- package/src/modal/consts.ts +6 -0
- package/src/modal/enums.ts +14 -0
- package/src/modal/functions.types.ts +22 -0
- package/src/modal/index.ts +11 -0
- package/src/modal/service.types.ts +32 -0
- package/src/modal/state.initial.ts +9 -0
- package/src/modal/state.types.ts +8 -0
- package/src/modal/state.validations.ts +6 -0
- package/src/modal/store.types.ts +5 -0
- package/src/modal/types.ts +44 -0
- package/src/orderJourney/consts.ts +289 -0
- package/src/orderJourney/enums.ts +25 -0
- package/src/orderJourney/functions.types.ts +140 -0
- package/src/orderJourney/index.ts +13 -0
- package/src/orderJourney/qa.types.ts +16 -0
- package/src/orderJourney/state.initial.ts +401 -0
- package/src/orderJourney/state.types.ts +99 -0
- package/src/orderJourney/state.validations.ts +78 -0
- package/src/orderJourney/types.ts +31 -0
- package/src/orderJourney/utils.ts +7 -0
- package/src/orderJourney/utils.types.ts +11 -0
- package/src/orderJourney/validations.types.ts +34 -0
- package/src/product/api.types.ts +62 -0
- package/src/product/consts.ts +1 -0
- package/src/product/enums.ts +11 -0
- package/src/product/functions.types.ts +156 -0
- package/src/product/index.ts +14 -0
- package/src/product/qa.types.ts +11 -0
- package/src/product/service.types.ts +68 -0
- package/src/product/state.initial.ts +28 -0
- package/src/product/state.types.ts +93 -0
- package/src/product/state.validations.ts +25 -0
- package/src/product/types.ts +161 -0
- package/src/product/utils.types.ts +22 -0
- package/src/product/validations.types.ts +189 -0
- package/src/routing/functions.types.ts +48 -0
- package/src/routing/index.ts +5 -0
- package/src/routing/state.initial.ts +10 -0
- package/src/routing/state.types.ts +30 -0
- package/src/theming/consts.ts +7727 -0
- package/src/theming/functions.types.ts +13 -0
- package/src/theming/index.ts +11 -0
- package/src/theming/qa.types.ts +11 -0
- package/src/theming/state.initial.ts +16 -0
- package/src/theming/state.types.ts +6 -0
- package/src/theming/state.validations.ts +8 -0
- package/src/theming/types.ts +123 -0
- package/src/theming/utils.ts +581 -0
- package/src/theming/validations.types.ts +62 -0
- package/src/types.ts +229 -0
- package/src/ui/index.ts +3 -0
- package/src/ui/service.types.ts +26 -0
- package/src/utils.ts +3 -0
- package/src/wallet/api.types.ts +33 -0
- package/src/wallet/consts.ts +3 -0
- package/src/wallet/functions.types.ts +58 -0
- package/src/wallet/index.ts +11 -0
- package/src/wallet/service.types.ts +26 -0
- package/src/wallet/state.initial.ts +18 -0
- package/src/wallet/state.types.ts +58 -0
- package/src/wallet/state.validations.ts +18 -0
- package/src/wallet/types.ts +65 -0
- package/src/wallet/validations.types.ts +18 -0
- package/tsconfig.json +41 -0
- package/index.d.ts +0 -5207
@@ -0,0 +1,34 @@
|
|
1
|
+
import { Product } from "../product/types"
|
2
|
+
import { BasketProduct } from "./types"
|
3
|
+
import { Contract } from "../contract/types"
|
4
|
+
|
5
|
+
export type BasketStoreState = {
|
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
totalInGBP: number
|
26
|
+
/**
|
27
|
+
* 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**
|
28
|
+
*/
|
29
|
+
totalInDisplayCurrency: number
|
30
|
+
/**
|
31
|
+
* Shows a spinner in Basket when the data for Products and/or Contracts is being fetched from the API
|
32
|
+
*/
|
33
|
+
productsAreLoading: boolean
|
34
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { BasketStoreState } from "./state.types"
|
2
|
+
import { StateValidations } from "../_window/state.types"
|
3
|
+
|
4
|
+
export const basketStoreStateValidations: StateValidations<BasketStoreState> = {
|
5
|
+
productsMeta: "basket.productsMeta",
|
6
|
+
products: "basket.products",
|
7
|
+
productsAreLoading: "common.genericBoolean",
|
8
|
+
totalInEUR: "throwHasNoSetterError",
|
9
|
+
totalInGBP: "throwHasNoSetterError",
|
10
|
+
totalInUSD: "throwHasNoSetterError",
|
11
|
+
totalInDisplayCurrency: "throwHasNoSetterError",
|
12
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { Product } from "../product/types"
|
2
|
+
import { Contract } from "../contract/types"
|
3
|
+
import { ProductPriceCurrency } from "../product/enums"
|
4
|
+
import { BasketProduct } from "./types"
|
5
|
+
|
6
|
+
export const getIsBasketProductContract = (product: Product | Contract) => {
|
7
|
+
return (product as Contract).contract_id !== undefined
|
8
|
+
}
|
9
|
+
export const getIsBasketProductProduct = (product: Product | Contract) => {
|
10
|
+
return (product as Product).product_id !== undefined
|
11
|
+
}
|
12
|
+
export const getBasketProductId = (product: Product | Contract) => {
|
13
|
+
const isProduct = getIsBasketProductProduct(product)
|
14
|
+
return isProduct
|
15
|
+
? (product as Product).product_id
|
16
|
+
: (product as Contract).contract_id
|
17
|
+
}
|
18
|
+
export const getBasketProductTitle = (product: Product | Contract) => {
|
19
|
+
const isProduct = getIsBasketProductProduct(product)
|
20
|
+
return isProduct
|
21
|
+
? (product as Product).title
|
22
|
+
: (product as Contract).product.title
|
23
|
+
}
|
24
|
+
|
25
|
+
export const getBasketProductPrice = (
|
26
|
+
product: Product | Contract,
|
27
|
+
displayCurrency: ProductPriceCurrency,
|
28
|
+
) => {
|
29
|
+
if ((product as Product).product_id) {
|
30
|
+
const price = (product as Product).vonq_price.find(
|
31
|
+
(price) => price.currency === displayCurrency,
|
32
|
+
)
|
33
|
+
if (price) {
|
34
|
+
return price
|
35
|
+
}
|
36
|
+
return undefined
|
37
|
+
} else {
|
38
|
+
return undefined
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
export const getBasketProductBoardType = (product: Product | Contract) => {
|
43
|
+
if ((product as Product).product_id) {
|
44
|
+
return (product as Product).type
|
45
|
+
} else {
|
46
|
+
return (product as Contract).channel?.type
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
export const getBasketProductTimeToProcess = (product: Product | Contract) => {
|
51
|
+
if ((product as Product).product_id) {
|
52
|
+
return `${(product as Product).time_to_process.period} ${
|
53
|
+
(product as Product).time_to_process.range
|
54
|
+
}`
|
55
|
+
} else {
|
56
|
+
return undefined
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
export const getBasketProductDuration = (product: Product | Contract) => {
|
61
|
+
if ((product as Product).product_id) {
|
62
|
+
return `${(product as Product).duration.period} ${
|
63
|
+
(product as Product).duration.range
|
64
|
+
}`
|
65
|
+
} else {
|
66
|
+
return undefined
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
export const getIsProductOrContractInBasket = (
|
71
|
+
contractOrProductId: string,
|
72
|
+
productsMeta: BasketProduct[],
|
73
|
+
) => {
|
74
|
+
const alreadyInBasket = productsMeta.find(
|
75
|
+
(basketProduct) => basketProduct.id === contractOrProductId,
|
76
|
+
)
|
77
|
+
|
78
|
+
return alreadyInBasket !== undefined
|
79
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { BasketProduct } from "./types"
|
2
|
+
import { ModuleWithConstructorArgs } from "../types"
|
3
|
+
import { WindowHapiUtils } from "../_window/utils.types"
|
4
|
+
|
5
|
+
export type WindowHapiUtilsBasket = ModuleWithConstructorArgs<
|
6
|
+
{
|
7
|
+
getInitialBasketProductsMeta: () => BasketProduct[]
|
8
|
+
},
|
9
|
+
{ readonly utils: WindowHapiUtils }
|
10
|
+
>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import {
|
2
|
+
ZodArray,
|
3
|
+
ZodBoolean,
|
4
|
+
ZodNumber,
|
5
|
+
ZodObject,
|
6
|
+
ZodString,
|
7
|
+
ZodUnion,
|
8
|
+
} from "zod"
|
9
|
+
import { ZodProduct } from "../product/validations.types"
|
10
|
+
import { ZodContract } from "../contract/validations.types"
|
11
|
+
|
12
|
+
export type ZodContractsOrProducts = ZodArray<
|
13
|
+
ZodUnion<[ZodProduct, ZodContract]>
|
14
|
+
>
|
15
|
+
export type ZodBasketProductMeta = ZodObject<{
|
16
|
+
id: ZodUnion<[ZodString, ZodNumber]>
|
17
|
+
isProduct: ZodBoolean
|
18
|
+
}>
|
19
|
+
export type ZodBasketProductsMeta = ZodArray<ZodBasketProductMeta>
|
20
|
+
|
21
|
+
export type WindowHapiValidationsBasket = {
|
22
|
+
contractsOrProducts: ZodContractsOrProducts
|
23
|
+
productMeta: ZodBasketProductMeta
|
24
|
+
productsMeta: ZodBasketProductsMeta
|
25
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { AxiosRequestConfig } from "axios"
|
2
|
+
import {
|
3
|
+
Campaign,
|
4
|
+
CampaignOrderRequestBody,
|
5
|
+
TaxonomyEducationAndSeniorityLevel,
|
6
|
+
} from "./types"
|
7
|
+
import { ProductSupportingContractsComplete } from "../product/types"
|
8
|
+
import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
|
9
|
+
import { PaginatedAPIResponseV2 } from "../common/types"
|
10
|
+
import { ModuleWithConstructorArgs } from "../types"
|
11
|
+
|
12
|
+
export type WindowHapiAPICampaignConfigs = {
|
13
|
+
getCampaigns: AxiosRequestConfig
|
14
|
+
getCampaign: AxiosRequestConfig
|
15
|
+
getCampaignDetail: AxiosRequestConfig
|
16
|
+
setCampaignCancellation: AxiosRequestConfig
|
17
|
+
getEducationLevels: AxiosRequestConfig
|
18
|
+
getSeniorities: AxiosRequestConfig
|
19
|
+
orderCampaign: AxiosRequestConfig
|
20
|
+
}
|
21
|
+
export type WindowHapiAPICampaignRequests = {
|
22
|
+
getCampaigns: (
|
23
|
+
offset?: number,
|
24
|
+
limit?: number,
|
25
|
+
) => Promise<PaginatedAPIResponseV2<Campaign>>
|
26
|
+
getCampaign: (campaignId: string) => Promise<Campaign>
|
27
|
+
getCampaignDetail: (
|
28
|
+
campaignId: string,
|
29
|
+
detail: "status",
|
30
|
+
) => Promise<ProductSupportingContractsComplete>
|
31
|
+
setCampaignCancellation: (
|
32
|
+
campaignId: string,
|
33
|
+
body: Partial<Campaign>,
|
34
|
+
) => Promise<ProductSupportingContractsComplete>
|
35
|
+
getEducationLevels: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
|
36
|
+
getSeniorities: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
|
37
|
+
orderCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
|
38
|
+
}
|
39
|
+
export type WindowHapiAPICampaign = ModuleWithConstructorArgs<
|
40
|
+
WindowHapiAPIModule<
|
41
|
+
WindowHapiAPICampaignRequests,
|
42
|
+
WindowHapiAPICampaignConfigs
|
43
|
+
>,
|
44
|
+
{ readonly api: WindowHapiAPI }
|
45
|
+
>
|
@@ -0,0 +1 @@
|
|
1
|
+
export const CAMPAIGN_CREATE_FORM_LOCALSTORAGE_KEY = "createCampaignForm"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export enum EmploymentType {
|
2
|
+
permanent = "permanent",
|
3
|
+
temporary = "temporary",
|
4
|
+
fixed_term = "fixed_term",
|
5
|
+
fixed_term_with_option_for_permanent = "fixed_term_with_option_for_permanent",
|
6
|
+
freelance = "freelance",
|
7
|
+
traineeship = "traineeship",
|
8
|
+
internship = "internship",
|
9
|
+
}
|
10
|
+
|
11
|
+
export enum SalaryPeriod {
|
12
|
+
DAILY = "daily",
|
13
|
+
MONTHLY = "monthly",
|
14
|
+
HOURLY = "hourly",
|
15
|
+
WEEKLY = "weekly",
|
16
|
+
YEARLY = "yearly",
|
17
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/* Campaign */
|
2
|
+
|
3
|
+
import {
|
4
|
+
Campaign,
|
5
|
+
CampaignCreateForm,
|
6
|
+
TaxonomyEducationAndSeniorityLevel,
|
7
|
+
TaxonomySeniority,
|
8
|
+
} from "./types"
|
9
|
+
import { PaginationResponseV2, RecursivePartial } from "../common/types"
|
10
|
+
|
11
|
+
export type CampaignStoreSetCampaignsHandler = (campaigns: Campaign[]) => void
|
12
|
+
export type CampaignStoreSetCampaignsPaginationMetaHandler = (
|
13
|
+
meta: PaginationResponseV2 | null,
|
14
|
+
) => void
|
15
|
+
export type CampaignStoreSetCampaignsAreLoadingHandler = (
|
16
|
+
isLoading: boolean,
|
17
|
+
) => void
|
18
|
+
export type CampaignStoreSetCampaignHandler = (
|
19
|
+
campaignId: string,
|
20
|
+
campaign: Partial<Campaign>,
|
21
|
+
) => void
|
22
|
+
export type CampaignStoreSetCampaignFormHandler = (
|
23
|
+
campaign: RecursivePartial<CampaignCreateForm>,
|
24
|
+
replaceAsIs?: boolean,
|
25
|
+
) => void
|
26
|
+
export type CampaignStoreSetCampaignIsCreatingHandler = (
|
27
|
+
isCreating: boolean,
|
28
|
+
) => void
|
29
|
+
|
30
|
+
/* Education Levels */
|
31
|
+
export type CampaignStoreSetEducationLevelsHandler = (
|
32
|
+
educationLevels: TaxonomyEducationAndSeniorityLevel[],
|
33
|
+
) => void
|
34
|
+
export type CampaignStoreSetEducationLevelsAreLoadingHandler = (
|
35
|
+
isLoading: boolean,
|
36
|
+
) => void
|
37
|
+
|
38
|
+
/* Seniorities */
|
39
|
+
export type CampaignStoreSetSenioritiesHandler = (
|
40
|
+
seniorities: TaxonomySeniority[],
|
41
|
+
) => void
|
42
|
+
export type CampaignStoreSetSenioritiesAreLoadingHandler = (
|
43
|
+
isLoading: boolean,
|
44
|
+
) => void
|
45
|
+
|
46
|
+
export type CampaignStoreFunctions = {
|
47
|
+
/* Campaign */
|
48
|
+
/**
|
49
|
+
* The function that sets the value of `campaigns`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
50
|
+
*/
|
51
|
+
setCampaigns: CampaignStoreSetCampaignsHandler
|
52
|
+
/**
|
53
|
+
* The function that sets the value of `campaignsPaginationMeta`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
54
|
+
*/
|
55
|
+
setCampaignsPaginationMeta: CampaignStoreSetCampaignsPaginationMetaHandler
|
56
|
+
/**
|
57
|
+
* The function that sets the value of `campaignsAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
58
|
+
*/
|
59
|
+
setCampaignsAreLoading: CampaignStoreSetCampaignsAreLoadingHandler
|
60
|
+
/**
|
61
|
+
* The function that updates properties of a Campaign in the array of `campaigns` by given Campaign ID. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
62
|
+
*/
|
63
|
+
setCampaign: CampaignStoreSetCampaignHandler
|
64
|
+
/**
|
65
|
+
* The function that updates properties of `campaignForm`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
66
|
+
*/
|
67
|
+
setCampaignForm: CampaignStoreSetCampaignFormHandler
|
68
|
+
/**
|
69
|
+
* The function that sets the value of `campaignIsCreating`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
70
|
+
*/
|
71
|
+
setCampaignIsCreating: CampaignStoreSetCampaignIsCreatingHandler
|
72
|
+
/* Education Levels */
|
73
|
+
/**
|
74
|
+
* The function that sets the value of `educationLevels`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
75
|
+
*/
|
76
|
+
setEducationLevels: CampaignStoreSetEducationLevelsHandler
|
77
|
+
/**
|
78
|
+
* The function that sets the value of `educationLevelsAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
79
|
+
*/
|
80
|
+
setEducationLevelsAreLoading: CampaignStoreSetEducationLevelsAreLoadingHandler
|
81
|
+
/* Seniorities */
|
82
|
+
/**
|
83
|
+
* The function that sets the value of `seniorities`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
84
|
+
*/
|
85
|
+
setSeniorities: CampaignStoreSetSenioritiesHandler
|
86
|
+
/**
|
87
|
+
* The function that sets the value of `senioritiesAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
|
88
|
+
*/
|
89
|
+
setSenoritiesAreLoading: CampaignStoreSetSenioritiesAreLoadingHandler
|
90
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// created from 'create-ts-index'
|
2
|
+
|
3
|
+
export * from './api.types';
|
4
|
+
export * from './consts';
|
5
|
+
export * from './enums';
|
6
|
+
export * from './functions.types';
|
7
|
+
export * from './qa.types';
|
8
|
+
export * from './service.types';
|
9
|
+
export * from './state.initial';
|
10
|
+
export * from './state.types';
|
11
|
+
export * from './state.validations';
|
12
|
+
export * from './types';
|
13
|
+
export * from './utils';
|
14
|
+
export * from './utils.types';
|
15
|
+
export * from './validations.types';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { MockCampaignCreateForm } from "../consts"
|
2
|
+
import { ModuleWithConstructorArgs } from "../types"
|
3
|
+
import { WindowHapiQA } from "../_window/qa.types"
|
4
|
+
|
5
|
+
export type WindowHapiQACampaign = ModuleWithConstructorArgs<
|
6
|
+
{
|
7
|
+
useMockCampaignForm: () => MockCampaignCreateForm
|
8
|
+
getRandomCampaignId: () => Promise<string>
|
9
|
+
setCampaignFormDebuggerIsShown: (isEnabled: boolean) => boolean
|
10
|
+
},
|
11
|
+
{ readonly qa: WindowHapiQA }
|
12
|
+
>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import {
|
2
|
+
HapiServiceFunctionWithLifecycleHooks,
|
3
|
+
WindowHapiService,
|
4
|
+
} from "../_window/service.types"
|
5
|
+
import { ProductSupportingContractsComplete } from "../product/types"
|
6
|
+
import { Campaign, TaxonomyEducationAndSeniorityLevel } from "./types"
|
7
|
+
import { PaginatedAPIResponseV2 } from "../common/types"
|
8
|
+
import { ModuleWithConstructorArgs } from "../types"
|
9
|
+
|
10
|
+
export type CampaignServiceGetCampaignsHandler = (
|
11
|
+
offset?: number,
|
12
|
+
limit?: number,
|
13
|
+
) => Promise<PaginatedAPIResponseV2<Campaign>>
|
14
|
+
export type CampaignServiceGetCampaignDetailHandler = (
|
15
|
+
campaignId: string,
|
16
|
+
detail: "status",
|
17
|
+
) => Promise<ProductSupportingContractsComplete>
|
18
|
+
export type CampaignServiceGetCampaignHandler = (
|
19
|
+
campaignId: string,
|
20
|
+
) => Promise<ProductSupportingContractsComplete>
|
21
|
+
export type CampaignServiceSetCampaignCancellationHandler = (
|
22
|
+
campaignId: string,
|
23
|
+
body: Partial<Campaign>,
|
24
|
+
) => Promise<ProductSupportingContractsComplete>
|
25
|
+
export type CampaignServiceGetEducationLevelsHandler = () => Promise<
|
26
|
+
TaxonomyEducationAndSeniorityLevel[]
|
27
|
+
>
|
28
|
+
export type CampaignServiceGetSenioritiesHandler = () => Promise<
|
29
|
+
TaxonomyEducationAndSeniorityLevel[]
|
30
|
+
>
|
31
|
+
export type CampaignServiceOrderCampaignHandler = () => Promise<Campaign>
|
32
|
+
export type CampaignServiceCopyCampaignHandler = (
|
33
|
+
campaign: Campaign,
|
34
|
+
) => Promise<Campaign>
|
35
|
+
|
36
|
+
export type WindowHapiServiceCampaign = ModuleWithConstructorArgs<
|
37
|
+
{
|
38
|
+
getCampaigns: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignsHandler>
|
39
|
+
getCampaignDetail: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignDetailHandler>
|
40
|
+
getCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignHandler>
|
41
|
+
setCampaignCancellation: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSetCampaignCancellationHandler>
|
42
|
+
getEducationLevels: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetEducationLevelsHandler>
|
43
|
+
getSeniorities: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetSenioritiesHandler>
|
44
|
+
orderCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceOrderCampaignHandler>
|
45
|
+
copyCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceCopyCampaignHandler>
|
46
|
+
},
|
47
|
+
{ readonly service: WindowHapiService }
|
48
|
+
>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import { EmploymentType, SalaryPeriod } from "./enums"
|
2
|
+
import { CampaignStoreState } from "./state.types"
|
3
|
+
|
4
|
+
export const initialCampaignStoreState: CampaignStoreState = {
|
5
|
+
campaigns: [],
|
6
|
+
campaignsPaginationMeta: {
|
7
|
+
limit: 20,
|
8
|
+
offset: 0,
|
9
|
+
},
|
10
|
+
campaignsAreLoading: false,
|
11
|
+
campaignForm: {
|
12
|
+
recruiterInfo: {
|
13
|
+
name: "",
|
14
|
+
emailAddress: "",
|
15
|
+
},
|
16
|
+
postingDetails: {
|
17
|
+
title: "",
|
18
|
+
description: "",
|
19
|
+
organization: {
|
20
|
+
name: "",
|
21
|
+
companyLogo: "",
|
22
|
+
},
|
23
|
+
contactInfo: {
|
24
|
+
name: "",
|
25
|
+
emailAddress: "",
|
26
|
+
phoneNumber: "",
|
27
|
+
},
|
28
|
+
workingLocation: {
|
29
|
+
addressLine1: "",
|
30
|
+
addressLine2: "",
|
31
|
+
postcode: "",
|
32
|
+
city: "",
|
33
|
+
country: "",
|
34
|
+
allowsRemoteWork: 0,
|
35
|
+
},
|
36
|
+
yearsOfExperience: 0,
|
37
|
+
employmentType: EmploymentType.permanent,
|
38
|
+
weeklyWorkingHours: {
|
39
|
+
from: 0,
|
40
|
+
to: 0,
|
41
|
+
},
|
42
|
+
salaryIndication: {
|
43
|
+
period: SalaryPeriod.MONTHLY,
|
44
|
+
range: {
|
45
|
+
from: 0,
|
46
|
+
to: 0,
|
47
|
+
currency: "",
|
48
|
+
},
|
49
|
+
},
|
50
|
+
jobPageUrl: "",
|
51
|
+
applicationUrl: "",
|
52
|
+
},
|
53
|
+
targetGroup: {
|
54
|
+
educationLevel: [],
|
55
|
+
seniority: [],
|
56
|
+
industry: [],
|
57
|
+
jobCategory: [],
|
58
|
+
},
|
59
|
+
orderedProducts: [],
|
60
|
+
orderedProductsSpecs: {},
|
61
|
+
campaignName: "",
|
62
|
+
companyId: "",
|
63
|
+
},
|
64
|
+
campaignIsCreating: false,
|
65
|
+
/* Education Levels */
|
66
|
+
educationLevels: [],
|
67
|
+
educationLevelsAreLoading: false,
|
68
|
+
/* Seniorities */
|
69
|
+
seniorities: [],
|
70
|
+
senioritiesAreLoading: false,
|
71
|
+
/* Employment Types */
|
72
|
+
employmentTypes: [
|
73
|
+
{ value: EmploymentType.permanent, label: "Permanent" },
|
74
|
+
{ value: EmploymentType.temporary, label: "Temporary" },
|
75
|
+
{ value: EmploymentType.fixed_term, label: "Fixed term" },
|
76
|
+
{
|
77
|
+
value: EmploymentType.fixed_term_with_option_for_permanent,
|
78
|
+
label: "Fixed term with option for permanent",
|
79
|
+
},
|
80
|
+
{ value: EmploymentType.freelance, label: "Freelance" },
|
81
|
+
{ value: EmploymentType.traineeship, label: "Traineeship" },
|
82
|
+
{ value: EmploymentType.internship, label: "Internship" },
|
83
|
+
],
|
84
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import {
|
2
|
+
Campaign,
|
3
|
+
CampaignCreateForm,
|
4
|
+
TaxonomyEducationAndSeniorityLevel,
|
5
|
+
TaxonomyEmploymentTypes,
|
6
|
+
TaxonomySeniority,
|
7
|
+
} from "./types"
|
8
|
+
import { PaginationResponseV2 } from "../common/types"
|
9
|
+
|
10
|
+
export type CampaignStoreState = {
|
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
|
+
campaigns: Campaign[]
|
16
|
+
/**
|
17
|
+
* An object that holds information like next URL, previous URL and count for pagination purposes
|
18
|
+
*/
|
19
|
+
campaignsPaginationMeta: PaginationResponseV2
|
20
|
+
/**
|
21
|
+
* Used to show a loading spinner in Campaign widgets that show list of campaigns
|
22
|
+
*/
|
23
|
+
campaignsAreLoading: boolean
|
24
|
+
/**
|
25
|
+
* Object used to create (order) a campaign
|
26
|
+
*/
|
27
|
+
campaignForm: CampaignCreateForm
|
28
|
+
/**
|
29
|
+
* Shows a loading spinner and disables the buttons in Campaign Create Form while creating a Campaign
|
30
|
+
*/
|
31
|
+
campaignIsCreating: boolean
|
32
|
+
/* Education Levels */
|
33
|
+
/**
|
34
|
+
* Array of Education Levels that end user will select via a Select HTML element
|
35
|
+
*/
|
36
|
+
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
|
+
educationLevelsAreLoading: boolean
|
41
|
+
/* Seniorities */
|
42
|
+
/**
|
43
|
+
* Array of Seniorities that end user will select via a Select HTML element
|
44
|
+
*/
|
45
|
+
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
|
+
senioritiesAreLoading: boolean
|
50
|
+
/* Employment Types */
|
51
|
+
/**
|
52
|
+
* Array of Employment Types that end user will select via a Select HTML element
|
53
|
+
*/
|
54
|
+
employmentTypes: TaxonomyEmploymentTypes[]
|
55
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { CampaignStoreState } from "./state.types"
|
2
|
+
import { StateValidations } from "../_window/state.types"
|
3
|
+
|
4
|
+
export const campaignStoreStateValidations: StateValidations<CampaignStoreState> =
|
5
|
+
{
|
6
|
+
campaigns: "campaign.campaigns",
|
7
|
+
campaignsPaginationMeta: "common.paginationMetaV2",
|
8
|
+
campaignsAreLoading: "common.genericBoolean",
|
9
|
+
campaignIsCreating: "common.genericBoolean",
|
10
|
+
campaignForm: "campaign.campaignForm",
|
11
|
+
educationLevels: "campaign.educationLevels",
|
12
|
+
educationLevelsAreLoading: "common.genericBoolean",
|
13
|
+
seniorities: "campaign.seniorities",
|
14
|
+
senioritiesAreLoading: "common.genericBoolean",
|
15
|
+
employmentTypes: "campaign.employmentTypes",
|
16
|
+
}
|