@vonq/hapi-elements-types 1.5.0 → 1.7.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/{src/_window → _window}/api.types.ts +9 -7
- package/_window/auth.types.ts +13 -0
- package/_window/config.types.ts +5 -0
- package/{src/_window → _window}/events.types.ts +15 -14
- package/_window/instances.types.ts +27 -0
- package/{src/_window → _window}/qa.types.ts +7 -5
- package/{src/_window → _window}/routing.types.ts +6 -4
- package/{src/_window → _window}/sdk.types.ts +29 -27
- package/{src/_window → _window}/service.types.ts +9 -7
- package/{src/_window → _window}/state.types.ts +55 -53
- package/_window/ui.types.ts +15 -0
- package/{src/_window → _window}/utils.types.ts +7 -5
- package/{src/_window → _window}/validation.types.ts +7 -5
- package/_window/window.ts +140 -0
- package/alert/index.ts +6 -0
- package/{src/alert → alert}/service.types.ts +2 -2
- package/alert/state.types.ts +9 -0
- package/{src/ats → ats}/api.types.ts +2 -2
- package/ats/index.ts +6 -0
- package/{src/ats → ats}/service.types.ts +2 -2
- package/{src/ats → ats}/state.types.ts +1 -1
- package/basket/index.ts +7 -0
- package/{src/basket → basket}/service.types.ts +2 -2
- package/{src/basket → basket}/state.types.ts +1 -1
- package/{src/basket → basket}/utils.types.ts +2 -2
- package/{src/campaign → campaign}/api.types.ts +2 -2
- package/campaign/index.ts +10 -0
- package/campaign/qa.types.ts +12 -0
- package/{src/campaign → campaign}/service.types.ts +2 -2
- package/{src/campaign → campaign}/state.types.ts +1 -1
- package/{src/campaign → campaign}/utils.types.ts +2 -2
- package/{enums.ts → common/enums.ts} +2 -1
- package/{src/common → common}/events/types.ts +6 -6
- package/common/index.ts +7 -0
- package/common/logger/types.ts +18 -0
- package/{src/common → common}/qa.types.ts +2 -2
- package/{src/common → common}/types.ts +5 -6
- package/common/validator/types.ts +4 -0
- package/{src/contract → contract}/api.types.ts +2 -2
- package/contract/index.ts +9 -0
- package/{src/contract → contract}/qa.types.ts +2 -2
- package/{src/contract → contract}/service.types.ts +2 -2
- package/{src/contract → contract}/state.types.ts +1 -1
- package/{src/contract → contract}/utils.types.ts +2 -2
- package/{src/common/logger-datadog → debugging}/index.ts +1 -1
- package/{src/debugging → debugging}/state.types.ts +1 -1
- package/index.ts +18 -0
- package/language/index.ts +5 -0
- package/{src/language → language}/qa.types.ts +2 -2
- package/{src/language → language}/state.types.ts +1 -1
- package/modal/index.ts +6 -0
- package/{src/modal → modal}/service.types.ts +2 -2
- package/{src/modal → modal}/state.types.ts +1 -1
- package/orderJourney/index.ts +8 -0
- package/{src/orderJourney → orderJourney}/qa.types.ts +2 -2
- package/{src/orderJourney → orderJourney}/state.types.ts +1 -1
- package/{src/orderJourney → orderJourney}/utils.types.ts +2 -2
- package/package.json +16 -5
- package/{src/product → product}/api.types.ts +2 -2
- package/product/index.ts +10 -0
- package/{src/product → product}/qa.types.ts +2 -2
- package/{src/product → product}/service.types.ts +2 -2
- package/{src/product → product}/state.types.ts +1 -1
- package/{src/product → product}/utils.types.ts +2 -2
- package/routing/index.ts +3 -0
- package/theming/index.ts +6 -0
- package/{src/theming → theming}/qa.types.ts +2 -2
- package/{src/theming → theming}/state.types.ts +1 -1
- package/{src/theming → theming}/types.ts +38 -1
- package/tsconfig.json +7 -12
- package/{src/ui → ui}/service.types.ts +2 -2
- package/{src/wallet → wallet}/api.types.ts +2 -2
- package/wallet/index.ts +7 -0
- package/{src/wallet → wallet}/service.types.ts +2 -2
- package/{src/wallet → wallet}/state.types.ts +1 -1
- package/src/_window/auth.types.ts +0 -11
- package/src/_window/config.types.ts +0 -30
- package/src/_window/instances.types.ts +0 -18
- package/src/_window/ui.types.ts +0 -13
- package/src/_window/window.ts +0 -56
- package/src/alert/functions.types.ts +0 -13
- package/src/alert/index.ts +0 -9
- package/src/alert/state.initial.ts +0 -16
- package/src/alert/state.types.ts +0 -27
- package/src/alert/state.validations.ts +0 -11
- package/src/ats/functions.types.ts +0 -7
- package/src/ats/index.ts +0 -9
- package/src/ats/state.initial.ts +0 -5
- package/src/ats/state.validations.ts +0 -6
- package/src/basket/consts.ts +0 -1
- package/src/basket/functions.types.ts +0 -40
- package/src/basket/index.ts +0 -12
- package/src/basket/state.initial.ts +0 -11
- package/src/basket/state.validations.ts +0 -12
- package/src/basket/utils.ts +0 -79
- package/src/campaign/consts.ts +0 -1
- package/src/campaign/functions.types.ts +0 -90
- package/src/campaign/index.ts +0 -15
- package/src/campaign/qa.types.ts +0 -12
- package/src/campaign/state.initial.ts +0 -84
- package/src/campaign/state.validations.ts +0 -16
- package/src/campaign/utils.ts +0 -53
- package/src/common/LocalStorage.ts +0 -123
- package/src/common/browser.ts +0 -2
- package/src/common/color.ts +0 -9
- package/src/common/immutable.ts +0 -28
- package/src/common/index.ts +0 -22
- package/src/common/instances/Instance.ts +0 -13
- package/src/common/instances/consts.ts +0 -1
- package/src/common/instances/index.ts +0 -4
- package/src/common/json.ts +0 -25
- package/src/common/logger/Logger.ts +0 -70
- package/src/common/logger/index.ts +0 -5
- package/src/common/logger/types.ts +0 -7
- package/src/common/logger-datadog/LoggerDatadog.ts +0 -42
- package/src/common/misc.ts +0 -114
- package/src/common/promise.ts +0 -161
- package/src/common/proxy.ts +0 -77
- package/src/common/regExTest.ts +0 -12
- package/src/common/tree.ts +0 -148
- package/src/common/utm.ts +0 -19
- package/src/common/validators.ts +0 -21
- package/src/common/webComponents.ts +0 -26
- package/src/config/functions.types.ts +0 -23
- package/src/config/index.ts +0 -5
- package/src/config/state.initial.ts +0 -11
- package/src/config/state.types.ts +0 -15
- package/src/consts.ts +0 -980
- package/src/contract/consts.ts +0 -1
- package/src/contract/functions.types.ts +0 -112
- package/src/contract/index.ts +0 -14
- package/src/contract/state.initial.ts +0 -39
- package/src/contract/state.validations.ts +0 -21
- package/src/contract/utils.ts +0 -36
- package/src/debugging/functions.types.ts +0 -34
- package/src/debugging/index.ts +0 -6
- package/src/debugging/state.initial.ts +0 -10
- package/src/debugging/state.validations.ts +0 -10
- package/src/index.ts +0 -22
- package/src/language/consts.ts +0 -6
- package/src/language/en.ts +0 -530
- package/src/language/functions.types.ts +0 -29
- package/src/language/index.ts +0 -11
- package/src/language/state.initial.ts +0 -13
- package/src/language/state.validations.ts +0 -10
- package/src/language/utils.ts +0 -17
- package/src/modal/consts.ts +0 -6
- package/src/modal/functions.types.ts +0 -22
- package/src/modal/index.ts +0 -11
- package/src/modal/state.initial.ts +0 -9
- package/src/modal/state.validations.ts +0 -6
- package/src/modal/store.types.ts +0 -5
- package/src/orderJourney/consts.ts +0 -289
- package/src/orderJourney/functions.types.ts +0 -140
- package/src/orderJourney/index.ts +0 -13
- package/src/orderJourney/state.initial.ts +0 -401
- package/src/orderJourney/state.validations.ts +0 -78
- package/src/orderJourney/utils.ts +0 -7
- package/src/product/consts.ts +0 -1
- package/src/product/functions.types.ts +0 -156
- package/src/product/index.ts +0 -14
- package/src/product/state.initial.ts +0 -28
- package/src/product/state.validations.ts +0 -25
- package/src/routing/functions.types.ts +0 -48
- package/src/routing/index.ts +0 -5
- package/src/routing/state.initial.ts +0 -10
- package/src/theming/consts.ts +0 -7727
- package/src/theming/functions.types.ts +0 -13
- package/src/theming/index.ts +0 -11
- package/src/theming/state.initial.ts +0 -16
- package/src/theming/state.validations.ts +0 -8
- package/src/theming/utils.ts +0 -581
- package/src/types.ts +0 -229
- package/src/utils.ts +0 -3
- package/src/wallet/consts.ts +0 -3
- package/src/wallet/functions.types.ts +0 -58
- package/src/wallet/index.ts +0 -11
- package/src/wallet/state.initial.ts +0 -18
- package/src/wallet/state.validations.ts +0 -18
- /package/{src/_window → _window}/index.ts +0 -0
- /package/{src/alert → alert}/enums.ts +0 -0
- /package/{src/alert → alert}/types.ts +0 -0
- /package/{src/ats → ats}/types.ts +0 -0
- /package/{src/basket → basket}/types.ts +0 -0
- /package/{src/basket → basket}/validations.types.ts +0 -0
- /package/{src/campaign → campaign}/enums.ts +0 -0
- /package/{src/campaign → campaign}/types.ts +0 -0
- /package/{src/campaign → campaign}/validations.types.ts +0 -0
- /package/{src/common → common}/events/EventCommand/enums.ts +0 -0
- /package/{src/common → common}/events/EventCommand/index.ts +0 -0
- /package/{src/common → common}/events/EventCommand/types.ts +0 -0
- /package/{src/common → common}/events/index.ts +0 -0
- /package/{src/common → common}/logger/enums.ts +0 -0
- /package/{src/common → common}/validations.types.ts +0 -0
- /package/{src/contract → contract}/types.ts +0 -0
- /package/{src/contract → contract}/validations.types.ts +0 -0
- /package/{src/language → language}/validations.types.ts +0 -0
- /package/{src/modal → modal}/enums.ts +0 -0
- /package/{src/modal → modal}/types.ts +0 -0
- /package/{src/orderJourney → orderJourney}/enums.ts +0 -0
- /package/{src/orderJourney → orderJourney}/types.ts +0 -0
- /package/{src/orderJourney → orderJourney}/validations.types.ts +0 -0
- /package/{src/product → product}/enums.ts +0 -0
- /package/{src/product → product}/types.ts +0 -0
- /package/{src/product → product}/validations.types.ts +0 -0
- /package/{src/routing → routing}/state.types.ts +0 -0
- /package/{src/theming → theming}/validations.types.ts +0 -0
- /package/{src/ui → ui}/index.ts +0 -0
- /package/{src/wallet → wallet}/types.ts +0 -0
- /package/{src/wallet → wallet}/validations.types.ts +0 -0
@@ -1,40 +0,0 @@
|
|
1
|
-
import { BasketProduct } from "./types"
|
2
|
-
import { Product } from "../product/types"
|
3
|
-
import { Contract } from "../contract/types"
|
4
|
-
|
5
|
-
export type BasketStoreClearHandler = () => void
|
6
|
-
export type BasketStoreAddProductOrContractByIdHandler = (
|
7
|
-
contractOrProductId: string,
|
8
|
-
isProduct: boolean,
|
9
|
-
) => void
|
10
|
-
export type BasketStoreRemoveProductOrContractByIdHandler = (
|
11
|
-
contractOrProductId: string,
|
12
|
-
) => void
|
13
|
-
export type BasketStoreSetProductsMetaHandler = (
|
14
|
-
productOrContractIds: BasketProduct[],
|
15
|
-
) => void
|
16
|
-
export type BasketStoreSetProductsAreLoadingHandler = (
|
17
|
-
isLoading: boolean,
|
18
|
-
) => void
|
19
|
-
export type BasketStoreSetProductsHandler = (
|
20
|
-
data: (Product | Contract)[],
|
21
|
-
) => void
|
22
|
-
|
23
|
-
export type BasketStoreFunctions = {
|
24
|
-
/**
|
25
|
-
* Removes all products and contracts from Basket
|
26
|
-
*/
|
27
|
-
clear: BasketStoreClearHandler
|
28
|
-
/**
|
29
|
-
* Sets the array of Products and/or Contracts to be displayed in the Basket
|
30
|
-
*/
|
31
|
-
setProducts: BasketStoreSetProductsHandler
|
32
|
-
/**
|
33
|
-
* Shows a loading spinner in the Basket when `products` are loading
|
34
|
-
*/
|
35
|
-
setProductsAreLoading: BasketStoreSetProductsAreLoadingHandler
|
36
|
-
/**
|
37
|
-
* Sets array of objects with `id: string | number` for and `isProduct: boolean` so that the up-to-date data can be loaded from the API and set to `products`
|
38
|
-
*/
|
39
|
-
setProductsMeta: BasketStoreSetProductsMetaHandler
|
40
|
-
}
|
package/src/basket/index.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
// created from 'create-ts-index'
|
2
|
-
|
3
|
-
export * from './consts';
|
4
|
-
export * from './functions.types';
|
5
|
-
export * from './service.types';
|
6
|
-
export * from './state.initial';
|
7
|
-
export * from './state.types';
|
8
|
-
export * from './state.validations';
|
9
|
-
export * from './types';
|
10
|
-
export * from './utils';
|
11
|
-
export * from './utils.types';
|
12
|
-
export * from './validations.types';
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { BasketStoreState } from "./state.types"
|
2
|
-
|
3
|
-
export const initialBasketStoreState: BasketStoreState = {
|
4
|
-
totalInUSD: 0,
|
5
|
-
totalInEUR: 0,
|
6
|
-
totalInGBP: 0,
|
7
|
-
totalInDisplayCurrency: 0,
|
8
|
-
productsMeta: [],
|
9
|
-
products: [],
|
10
|
-
productsAreLoading: false,
|
11
|
-
}
|
@@ -1,12 +0,0 @@
|
|
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
|
-
}
|
package/src/basket/utils.ts
DELETED
@@ -1,79 +0,0 @@
|
|
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
|
-
}
|
package/src/campaign/consts.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export const CAMPAIGN_CREATE_FORM_LOCALSTORAGE_KEY = "createCampaignForm"
|
@@ -1,90 +0,0 @@
|
|
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
|
-
}
|
package/src/campaign/index.ts
DELETED
@@ -1,15 +0,0 @@
|
|
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';
|
package/src/campaign/qa.types.ts
DELETED
@@ -1,12 +0,0 @@
|
|
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
|
-
>
|
@@ -1,84 +0,0 @@
|
|
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
|
-
}
|
@@ -1,16 +0,0 @@
|
|
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
|
-
}
|
package/src/campaign/utils.ts
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
import { TransformedPostingRequirement } from "./types"
|
2
|
-
|
3
|
-
export const getShouldDisplayPostingRequirement = (
|
4
|
-
requirement: TransformedPostingRequirement,
|
5
|
-
form: Record<string, any>,
|
6
|
-
) => {
|
7
|
-
const getIsFacetVisible = (
|
8
|
-
operation: string,
|
9
|
-
operationValues: any[],
|
10
|
-
value: any,
|
11
|
-
) => {
|
12
|
-
if (operation == "equal") {
|
13
|
-
return value == operationValues
|
14
|
-
} else if (operation == "in") {
|
15
|
-
if (Array.isArray(value)) {
|
16
|
-
const values = value.map((val) => val.value)
|
17
|
-
return operationValues.some((operationValue) =>
|
18
|
-
values.includes(operationValue),
|
19
|
-
)
|
20
|
-
}
|
21
|
-
return operationValues.includes(value)
|
22
|
-
} else if (operation === "notempty") {
|
23
|
-
if (typeof value === "string") {
|
24
|
-
return value.trim() !== ""
|
25
|
-
} else if (Array.isArray(value)) {
|
26
|
-
return value.length > 0
|
27
|
-
} else if (typeof value === "object") {
|
28
|
-
return Object.keys(value).length > 0
|
29
|
-
} else {
|
30
|
-
return !!value
|
31
|
-
}
|
32
|
-
}
|
33
|
-
return false
|
34
|
-
}
|
35
|
-
let shouldShow = true
|
36
|
-
if (!requirement.display_rules?.show?.length) return true
|
37
|
-
const foundRule = requirement.display_rules.show.findIndex((rule) => {
|
38
|
-
const facetCheckValue = form[rule.facet]
|
39
|
-
if (facetCheckValue === undefined) {
|
40
|
-
shouldShow = false
|
41
|
-
}
|
42
|
-
return getIsFacetVisible(
|
43
|
-
rule.op,
|
44
|
-
rule.value,
|
45
|
-
typeof facetCheckValue === "object" &&
|
46
|
-
!Array.isArray(facetCheckValue)
|
47
|
-
? facetCheckValue?.value
|
48
|
-
: facetCheckValue,
|
49
|
-
)
|
50
|
-
})
|
51
|
-
shouldShow = foundRule != -1
|
52
|
-
return shouldShow
|
53
|
-
}
|
@@ -1,123 +0,0 @@
|
|
1
|
-
import { isBrowser } from "./browser"
|
2
|
-
|
3
|
-
export default class LocalStorage {
|
4
|
-
private static localStorageFull: boolean = false
|
5
|
-
|
6
|
-
static set(key: string, value: any): void {
|
7
|
-
try {
|
8
|
-
if (isBrowser && !this.localStorageFull) {
|
9
|
-
localStorage.setItem(key, JSON.stringify(value))
|
10
|
-
}
|
11
|
-
} catch (e) {
|
12
|
-
try {
|
13
|
-
if (isBrowser && !this.localStorageFull) {
|
14
|
-
localStorage.setItem(key, JSON.stringify(value))
|
15
|
-
}
|
16
|
-
} catch (error) {
|
17
|
-
this.localStorageFull = true
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
static setPlain(key: string, value: any): void {
|
23
|
-
if (isBrowser) {
|
24
|
-
localStorage.setItem(key, value)
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
static remove(key: string): void {
|
29
|
-
if (isBrowser) {
|
30
|
-
localStorage.removeItem(key)
|
31
|
-
this.localStorageFull = false
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
static get(key: string): any {
|
36
|
-
if (isBrowser) {
|
37
|
-
const data = localStorage.getItem(key)
|
38
|
-
const value = !!data ? JSON.parse(data) : ""
|
39
|
-
return value
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
static getOrDefault<T>(key: string, defaultValue: T): T {
|
44
|
-
let response = defaultValue
|
45
|
-
if (isBrowser) {
|
46
|
-
const data = localStorage.getItem(key)
|
47
|
-
response = !!data ? JSON.parse(data) : defaultValue
|
48
|
-
}
|
49
|
-
return response
|
50
|
-
}
|
51
|
-
|
52
|
-
static getPlain(key: string): any {
|
53
|
-
if (isBrowser) {
|
54
|
-
return localStorage.getItem(key)
|
55
|
-
}
|
56
|
-
return null
|
57
|
-
}
|
58
|
-
|
59
|
-
// use with caution
|
60
|
-
static clear(): void {
|
61
|
-
if (isBrowser) {
|
62
|
-
localStorage.clear()
|
63
|
-
this.localStorageFull = false
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
static clearSpecific(keyChoice: (key: string) => boolean): void {
|
68
|
-
if (isBrowser) {
|
69
|
-
Object.keys(localStorage).forEach(
|
70
|
-
(key) => keyChoice(key) && localStorage.removeItem(key),
|
71
|
-
)
|
72
|
-
this.localStorageFull = false
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
static setWithExpiry = (key: string, value: any, ttl: number) => {
|
77
|
-
const now = new Date()
|
78
|
-
const item = {
|
79
|
-
value: value,
|
80
|
-
expiry: now.getTime() + ttl,
|
81
|
-
}
|
82
|
-
|
83
|
-
// New thing
|
84
|
-
localStorage.setItem(key, JSON.stringify(item))
|
85
|
-
}
|
86
|
-
|
87
|
-
static getWithExpiry = (key: string) => {
|
88
|
-
const itemStr = localStorage.getItem(key)
|
89
|
-
|
90
|
-
if (!itemStr) {
|
91
|
-
return null
|
92
|
-
}
|
93
|
-
|
94
|
-
const item = JSON.parse(itemStr)
|
95
|
-
const now = new Date()
|
96
|
-
|
97
|
-
if (now.getTime() > item.expiry) {
|
98
|
-
localStorage.removeItem(key)
|
99
|
-
return null
|
100
|
-
}
|
101
|
-
return item.value
|
102
|
-
}
|
103
|
-
|
104
|
-
static loadState = () => {
|
105
|
-
try {
|
106
|
-
const state = this.getWithExpiry("state")
|
107
|
-
if (state === null) {
|
108
|
-
return undefined
|
109
|
-
}
|
110
|
-
return state
|
111
|
-
} catch (err) {
|
112
|
-
return undefined
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
static saveState = (state: any) => {
|
117
|
-
try {
|
118
|
-
this.setWithExpiry("state", state, 30 * 24 * 60 * 60 * 1000) // Days * Hours * Minutes * Seconds * millis
|
119
|
-
} catch {
|
120
|
-
// ignore write errors
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}
|
package/src/common/browser.ts
DELETED
package/src/common/color.ts
DELETED
package/src/common/immutable.ts
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
import { isObject } from "./misc"
|
2
|
-
import isEqual from "lodash/isEqual"
|
3
|
-
|
4
|
-
export const mergeDeepOverwriteArrays = (original: any, _overwrites: any) => {
|
5
|
-
const output = Object.assign({}, original)
|
6
|
-
const overwrites = Object.assign({}, _overwrites)
|
7
|
-
|
8
|
-
if (isObject(overwrites) && Object.keys(overwrites).length > 0) {
|
9
|
-
Object.keys(overwrites).forEach((key) => {
|
10
|
-
const value = overwrites[key]
|
11
|
-
if (Array.isArray(value) && !isEqual(output[key], value)) {
|
12
|
-
output[key] = value
|
13
|
-
} else if (
|
14
|
-
isObject(value) &&
|
15
|
-
!isEqual(
|
16
|
-
output[key],
|
17
|
-
mergeDeepOverwriteArrays(output[key], value),
|
18
|
-
)
|
19
|
-
) {
|
20
|
-
output[key] = mergeDeepOverwriteArrays(output[key], value)
|
21
|
-
} else if (!isEqual(output[key], value)) {
|
22
|
-
output[key] = value
|
23
|
-
}
|
24
|
-
})
|
25
|
-
}
|
26
|
-
|
27
|
-
return output
|
28
|
-
}
|
package/src/common/index.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
// created from 'create-ts-index'
|
2
|
-
|
3
|
-
export * from './events';
|
4
|
-
export * from './instances';
|
5
|
-
export * from './logger';
|
6
|
-
export * from './logger-datadog';
|
7
|
-
export * from './LocalStorage';
|
8
|
-
export * from './browser';
|
9
|
-
export * from './color';
|
10
|
-
export * from './immutable';
|
11
|
-
export * from './json';
|
12
|
-
export * from './misc';
|
13
|
-
export * from './promise';
|
14
|
-
export * from './proxy';
|
15
|
-
export * from './qa.types';
|
16
|
-
export * from './regExTest';
|
17
|
-
export * from './tree';
|
18
|
-
export * from './types';
|
19
|
-
export * from './utm';
|
20
|
-
export * from './validations.types';
|
21
|
-
export * from './validators';
|
22
|
-
export * from './webComponents';
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Logger } from "../logger/Logger"
|
2
|
-
import { BaseService } from "../types"
|
3
|
-
|
4
|
-
export default class HapiInstance implements BaseService {
|
5
|
-
logger: Logger
|
6
|
-
name: string
|
7
|
-
window?: Window
|
8
|
-
constructor(private _name: string, private _window?: Window) {
|
9
|
-
this.name = _name
|
10
|
-
this.logger = new Logger(this.name)
|
11
|
-
this.window = _window
|
12
|
-
}
|
13
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export const atsInstanceName: string = "ats"
|
package/src/common/json.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
export const decycle = (obj: any, stack: any[] = []): any => {
|
2
|
-
if (!obj || typeof obj !== "object") return obj
|
3
|
-
|
4
|
-
if (stack.includes(obj)) return null
|
5
|
-
|
6
|
-
let s = stack.concat([obj])
|
7
|
-
|
8
|
-
return Array.isArray(obj)
|
9
|
-
? obj.map((x) => decycle(x, s))
|
10
|
-
: Object.fromEntries(
|
11
|
-
Object.entries(obj)
|
12
|
-
.filter(
|
13
|
-
([k]) =>
|
14
|
-
k !== "window" &&
|
15
|
-
k !== "_window" &&
|
16
|
-
k !== "core" &&
|
17
|
-
k !== "events" &&
|
18
|
-
k !== "state",
|
19
|
-
)
|
20
|
-
.map(([k, v]) => [
|
21
|
-
k.startsWith("_") ? k.replace("_", "") : k,
|
22
|
-
decycle(v, s),
|
23
|
-
]),
|
24
|
-
)
|
25
|
-
}
|