@vonq/hapi-elements-types 1.4.0 → 1.6.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/package.json +17 -8
- package/src/_window/api.types.ts +61 -0
- package/src/_window/auth.types.ts +13 -0
- package/src/_window/config.types.ts +5 -0
- package/src/_window/events.types.ts +158 -0
- package/src/_window/index.ts +16 -0
- package/src/_window/instances.types.ts +27 -0
- package/src/_window/qa.types.ts +30 -0
- package/src/_window/routing.types.ts +23 -0
- package/src/_window/sdk.types.ts +149 -0
- package/src/_window/service.types.ts +69 -0
- package/src/_window/state.types.ts +114 -0
- package/src/_window/ui.types.ts +15 -0
- package/src/_window/utils.types.ts +36 -0
- package/src/_window/validation.types.ts +45 -0
- package/src/_window/window.ts +140 -0
- package/src/alert/enums.ts +22 -0
- package/src/alert/index.ts +6 -0
- package/src/alert/service.types.ts +15 -0
- package/src/alert/state.types.ts +9 -0
- package/src/alert/types.ts +63 -0
- package/src/ats/api.types.ts +16 -0
- package/src/ats/index.ts +6 -0
- package/src/ats/service.types.ts +17 -0
- package/src/ats/state.types.ts +5 -0
- package/src/ats/types.ts +19 -0
- package/src/basket/index.ts +7 -0
- package/src/basket/service.types.ts +32 -0
- package/src/basket/state.types.ts +34 -0
- package/src/basket/types.ts +4 -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/enums.ts +17 -0
- package/src/campaign/index.ts +10 -0
- package/src/campaign/qa.types.ts +12 -0
- package/src/campaign/service.types.ts +48 -0
- package/src/campaign/state.types.ts +55 -0
- package/src/campaign/types.ts +237 -0
- package/src/campaign/utils.types.ts +59 -0
- package/src/campaign/validations.types.ts +215 -0
- package/src/common/enums.ts +42 -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/index.ts +7 -0
- package/src/common/logger/enums.ts +12 -0
- package/src/common/logger/types.ts +18 -0
- package/src/common/qa.types.ts +9 -0
- package/src/common/types.ts +109 -0
- package/src/common/validations.types.ts +89 -0
- package/src/common/validator/types.ts +4 -0
- package/src/contract/api.types.ts +47 -0
- package/src/contract/index.ts +9 -0
- package/src/contract/qa.types.ts +12 -0
- package/src/contract/service.types.ts +54 -0
- package/src/contract/state.types.ts +74 -0
- package/src/contract/types.ts +145 -0
- package/src/contract/utils.types.ts +11 -0
- package/src/contract/validations.types.ts +104 -0
- package/src/debugging/index.ts +3 -0
- package/src/debugging/state.types.ts +18 -0
- package/src/index.ts +18 -0
- package/src/language/index.ts +5 -0
- package/src/language/qa.types.ts +19 -0
- package/src/language/state.types.ts +25 -0
- package/src/language/validations.types.ts +13 -0
- package/src/modal/enums.ts +14 -0
- package/src/modal/index.ts +6 -0
- package/src/modal/service.types.ts +32 -0
- package/src/modal/state.types.ts +8 -0
- package/src/modal/types.ts +44 -0
- package/src/orderJourney/enums.ts +25 -0
- package/src/orderJourney/index.ts +8 -0
- package/src/orderJourney/qa.types.ts +16 -0
- package/src/orderJourney/state.types.ts +99 -0
- package/src/orderJourney/types.ts +31 -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/enums.ts +11 -0
- package/src/product/index.ts +10 -0
- package/src/product/qa.types.ts +11 -0
- package/src/product/service.types.ts +68 -0
- package/src/product/state.types.ts +93 -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/index.ts +3 -0
- package/src/routing/state.types.ts +30 -0
- package/src/theming/index.ts +6 -0
- package/src/theming/qa.types.ts +11 -0
- package/src/theming/state.types.ts +6 -0
- package/src/theming/types.ts +123 -0
- package/src/theming/validations.types.ts +62 -0
- package/src/ui/index.ts +3 -0
- package/src/ui/service.types.ts +26 -0
- package/src/wallet/api.types.ts +33 -0
- package/src/wallet/index.ts +7 -0
- package/src/wallet/service.types.ts +26 -0
- package/src/wallet/state.types.ts +58 -0
- package/src/wallet/types.ts +65 -0
- package/src/wallet/validations.types.ts +18 -0
- package/tsconfig.json +36 -0
- package/index.d.ts +0 -5207
@@ -0,0 +1,44 @@
|
|
1
|
+
import { Product } from "../product/types"
|
2
|
+
import { Contract } from "../contract/types"
|
3
|
+
import { ModalKeys, ModalZone } from "./enums"
|
4
|
+
import { AnyNonFunction } from "../common/types"
|
5
|
+
|
6
|
+
export type ProductDetailModalProps = {
|
7
|
+
id: string
|
8
|
+
}
|
9
|
+
export type UTMCodesModalProps = {}
|
10
|
+
export type BasketRemoveProductConfirmationModalProps = {
|
11
|
+
basketProduct: Product | Contract
|
12
|
+
}
|
13
|
+
export type CampaignTakeOfflineConfirmationModalProps = { campaignId: string }
|
14
|
+
export type ContractRemoveConfirmationModalProps = { contractId: string }
|
15
|
+
export type BasketModalProps = {}
|
16
|
+
export type WalletModalProps = {}
|
17
|
+
|
18
|
+
export type ModalProps = AnyNonFunction<
|
19
|
+
| ProductDetailModalProps
|
20
|
+
| UTMCodesModalProps
|
21
|
+
| BasketRemoveProductConfirmationModalProps
|
22
|
+
| CampaignTakeOfflineConfirmationModalProps
|
23
|
+
| ContractRemoveConfirmationModalProps
|
24
|
+
| BasketModalProps
|
25
|
+
| WalletModalProps
|
26
|
+
>
|
27
|
+
|
28
|
+
export type ModalOptions = {
|
29
|
+
showCloseButton?: boolean
|
30
|
+
showBackdrop?: boolean
|
31
|
+
disableVerticalScroll?: boolean
|
32
|
+
}
|
33
|
+
|
34
|
+
export type Modal = {
|
35
|
+
zone: ModalZone
|
36
|
+
key: ModalKeys
|
37
|
+
props: ModalProps | undefined
|
38
|
+
options: ModalOptions
|
39
|
+
}
|
40
|
+
|
41
|
+
export type Modals = {
|
42
|
+
[ModalZone.primary]: Modal | null
|
43
|
+
[ModalZone.secondary]: Modal | null
|
44
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export enum OrderJourneyStepKey {
|
2
|
+
searchRecommendProducts = "search-recommend-products",
|
3
|
+
selectProducts = "select-products",
|
4
|
+
addContracts = "add-contracts",
|
5
|
+
selectContracts = "select-contracts",
|
6
|
+
basketSummary = "basket-summary",
|
7
|
+
targetGroup = "target-group",
|
8
|
+
recruiterInfo = "recruiter-info",
|
9
|
+
postingDetails = "posting-details",
|
10
|
+
postingOrganization = "posting-organization",
|
11
|
+
postingContactInfo = "posting-contact-info",
|
12
|
+
postingWorkingLocation = "posting-working-location",
|
13
|
+
postingURLs = "posting-urls",
|
14
|
+
contractChannelPostingRequirements = "contract-channel-posting-requirements",
|
15
|
+
postingUTMCodes = "posting-utm-codes",
|
16
|
+
orderReview = "order-review",
|
17
|
+
paymentMethod = "payment-method",
|
18
|
+
orderConfirmation = "order-confirmation",
|
19
|
+
}
|
20
|
+
|
21
|
+
export enum OrderJourneyPaymentMethod {
|
22
|
+
atsManaged = "ats-managed",
|
23
|
+
wallet = "wallet",
|
24
|
+
purchaseOrder = "purchase-order",
|
25
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
|
2
|
+
import { WindowHapiQA } from "../_window/qa.types"
|
3
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
4
|
+
|
5
|
+
export type WindowHapiQAOrderJourney = WindowHapiModuleWithConstructorArgs<
|
6
|
+
{
|
7
|
+
setEnabledSteps: (steps: OrderJourneyStepKey[]) => OrderJourneyStepKey[]
|
8
|
+
setEnabledPaymentMethods: (
|
9
|
+
methods: OrderJourneyPaymentMethod[],
|
10
|
+
) => OrderJourneyPaymentMethod[]
|
11
|
+
setPaymentMethodActive: (
|
12
|
+
method: OrderJourneyPaymentMethod | null,
|
13
|
+
) => OrderJourneyPaymentMethod | null
|
14
|
+
},
|
15
|
+
{ readonly qa: WindowHapiQA }
|
16
|
+
>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
|
2
|
+
import { OrderJourneyStep, OrderJourneyContractStep } from "./types"
|
3
|
+
import { MessageDescriptor } from "react-intl"
|
4
|
+
import { NestedValidatorKeys, UseValidatorResult } from "../common/types"
|
5
|
+
|
6
|
+
export type OrderJourneyState = {
|
7
|
+
stepsEnabled: OrderJourneyStepKey[]
|
8
|
+
steps: OrderJourneyStep[]
|
9
|
+
stepPreviousIndex: number
|
10
|
+
stepActiveIndex: number
|
11
|
+
stepNextIndex: number
|
12
|
+
stepFirstIndex: number
|
13
|
+
stepLastIndex: number
|
14
|
+
stepPrevious: OrderJourneyStep | null
|
15
|
+
stepActive: OrderJourneyStep | null
|
16
|
+
stepNext: OrderJourneyStep | null
|
17
|
+
stepsPopulatedAreHidden: boolean
|
18
|
+
paymentMethodsAvailable: OrderJourneyPaymentMethod[]
|
19
|
+
paymentMethodsEnabled: OrderJourneyPaymentMethod[]
|
20
|
+
paymentMethodActive: OrderJourneyPaymentMethod | null
|
21
|
+
hidePrefilledFields: boolean
|
22
|
+
orderErrors: Record<string, any> | null
|
23
|
+
/* Onboarding */
|
24
|
+
onboardingStep: OrderJourneyStep
|
25
|
+
onboardingStepData: Record<string, any>
|
26
|
+
onboardingStepValidations: UseValidatorResult
|
27
|
+
/* Select Products */
|
28
|
+
selectProductsStep: OrderJourneyStep
|
29
|
+
selectProductsStepData: Record<string, any>
|
30
|
+
selectProductsStepValidations: UseValidatorResult
|
31
|
+
/* Add Contracts */
|
32
|
+
addContractsStep: OrderJourneyStep
|
33
|
+
addContractsStepData: Record<string, any>
|
34
|
+
addContractsStepValidations: UseValidatorResult
|
35
|
+
/* Select Contracts */
|
36
|
+
selectContractsStep: OrderJourneyStep
|
37
|
+
selectContractsStepData: Record<string, any>
|
38
|
+
selectContractsStepValidations: UseValidatorResult
|
39
|
+
/* Basket Summary */
|
40
|
+
basketSummaryStep: OrderJourneyStep
|
41
|
+
basketSummaryStepData: Record<string, any>
|
42
|
+
basketSummaryStepValidations: UseValidatorResult
|
43
|
+
/* Target Group */
|
44
|
+
targetGroupStep: OrderJourneyStep
|
45
|
+
targetGroupStepData: Record<string, any>
|
46
|
+
targetGroupStepValidations: UseValidatorResult
|
47
|
+
/* Recruiter Info */
|
48
|
+
recruiterInfoStep: OrderJourneyStep
|
49
|
+
recruiterInfoStepData: Record<string, any>
|
50
|
+
recruiterInfoStepValidations: UseValidatorResult
|
51
|
+
/* Posting Details */
|
52
|
+
postingDetailsStep: OrderJourneyStep
|
53
|
+
postingDetailsStepData: Record<string, any>
|
54
|
+
postingDetailsStepValidations: UseValidatorResult
|
55
|
+
/* Organization */
|
56
|
+
organizationStep: OrderJourneyStep
|
57
|
+
organizationStepData: Record<string, any>
|
58
|
+
organizationStepValidations: UseValidatorResult
|
59
|
+
/* Contact Info */
|
60
|
+
contactInfoStep: OrderJourneyStep
|
61
|
+
contactInfoStepData: Record<string, any>
|
62
|
+
contactInfoStepValidations: UseValidatorResult
|
63
|
+
/* Working Location */
|
64
|
+
workingLocationStep: OrderJourneyStep
|
65
|
+
workingLocationStepData: Record<string, any>
|
66
|
+
workingLocationStepValidations: UseValidatorResult
|
67
|
+
/* URLs */
|
68
|
+
urlsStep: OrderJourneyStep
|
69
|
+
urlsStepData: Record<string, any>
|
70
|
+
urlsStepValidations: UseValidatorResult
|
71
|
+
/* Contract Fields */
|
72
|
+
contractSteps: OrderJourneyContractStep[]
|
73
|
+
contractStepsBlurredFields: Record<string, Record<string, boolean>>
|
74
|
+
contractStepsSubmittedSteps: Record<string, boolean>
|
75
|
+
contractStepsErrorMessages: Record<
|
76
|
+
string,
|
77
|
+
Record<string, MessageDescriptor>
|
78
|
+
>
|
79
|
+
contractStepsHideFields: Record<string, boolean>
|
80
|
+
contractStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
|
81
|
+
contractStepsData: Record<string, Record<string, any>>
|
82
|
+
contractStepsValidations: Record<string, UseValidatorResult> | null
|
83
|
+
/* UTM Codes */
|
84
|
+
utmCodesStep: OrderJourneyStep
|
85
|
+
utmCodesStepData: Record<string, any>
|
86
|
+
utmCodesStepValidations: UseValidatorResult
|
87
|
+
/* Order Review */
|
88
|
+
orderReviewStep: OrderJourneyStep
|
89
|
+
orderReviewStepData: Record<string, any>
|
90
|
+
orderReviewStepValidations: UseValidatorResult
|
91
|
+
/* Payment Method */
|
92
|
+
paymentMethodStep: OrderJourneyStep
|
93
|
+
paymentMethodStepData: Record<string, any>
|
94
|
+
paymentMethodStepValidations: UseValidatorResult
|
95
|
+
/* Order Confirmation */
|
96
|
+
orderConfirmationStep: OrderJourneyStep
|
97
|
+
orderConfirmationStepData: Record<string, any>
|
98
|
+
orderConfirmationStepValidations: UseValidatorResult
|
99
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { MessageDescriptor } from "react-intl"
|
2
|
+
import { OrderJourneyStepKey } from "./enums"
|
3
|
+
|
4
|
+
export type OrderJourneyStepBlurredFields = Record<
|
5
|
+
string,
|
6
|
+
| boolean
|
7
|
+
| Record<string, boolean>
|
8
|
+
| Record<string, Record<string, boolean> | boolean>
|
9
|
+
>
|
10
|
+
|
11
|
+
export type OrderJourneyStepErrorMessages = Record<
|
12
|
+
string,
|
13
|
+
| MessageDescriptor
|
14
|
+
| Record<string, MessageDescriptor | Record<string, MessageDescriptor>>
|
15
|
+
>
|
16
|
+
|
17
|
+
export type OrderJourneyStepKeyType = OrderJourneyStepKey | string
|
18
|
+
export type OrderJourneyStep = {
|
19
|
+
key: OrderJourneyStepKeyType
|
20
|
+
titleIntlDescriptor?: MessageDescriptor
|
21
|
+
descriptionIntlDescriptor?: MessageDescriptor
|
22
|
+
isSubmitted?: boolean
|
23
|
+
blurredFields?: OrderJourneyStepBlurredFields
|
24
|
+
errorMessagesIntlDescriptors?: OrderJourneyStepErrorMessages
|
25
|
+
hideFields?: Record<string, boolean>
|
26
|
+
}
|
27
|
+
|
28
|
+
export type OrderJourneyContractStep = Omit<
|
29
|
+
OrderJourneyStep,
|
30
|
+
"blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
|
31
|
+
>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
|
2
|
+
import { WindowHapiUtils } from "../_window/utils.types"
|
3
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
4
|
+
|
5
|
+
export type WindowHapiUtilsOrderJourney = WindowHapiModuleWithConstructorArgs<
|
6
|
+
{
|
7
|
+
stepKeys: typeof OrderJourneyStepKey
|
8
|
+
paymentMethodKeys: typeof OrderJourneyPaymentMethod
|
9
|
+
},
|
10
|
+
{ readonly utils: WindowHapiUtils }
|
11
|
+
>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import {
|
2
|
+
ZodArray,
|
3
|
+
ZodBoolean,
|
4
|
+
ZodObject,
|
5
|
+
ZodOptional,
|
6
|
+
ZodRecord,
|
7
|
+
ZodString,
|
8
|
+
ZodTypeAny,
|
9
|
+
} from "zod"
|
10
|
+
import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
|
11
|
+
import { ZodIntlDescriptor } from "../common/validations.types"
|
12
|
+
|
13
|
+
export type ZodOrderJourneyStep = ZodObject<{
|
14
|
+
key: ZodString
|
15
|
+
titleIntlDescriptor: ZodIntlDescriptor
|
16
|
+
descriptionIntlDescriptor: ZodIntlDescriptor
|
17
|
+
isSubmitted: ZodOptional<ZodBoolean>
|
18
|
+
blurredFields: ZodOptional<ZodRecord<ZodString, ZodTypeAny>>
|
19
|
+
errorMessagesIntlDescriptors: ZodOptional<ZodRecord<ZodString, ZodTypeAny>>
|
20
|
+
}>
|
21
|
+
|
22
|
+
export type ZodOrderJourneySteps = ZodArray<ZodOrderJourneyStep>
|
23
|
+
export type WindowHapiValidationsOrderJourney = {
|
24
|
+
supportedStepKeys: OrderJourneyStepKey[]
|
25
|
+
stepKeysRegex: RegExp
|
26
|
+
stepKey: ZodString
|
27
|
+
stepKeys: ZodArray<ZodString>
|
28
|
+
step: ZodOrderJourneyStep
|
29
|
+
steps: ZodOrderJourneySteps
|
30
|
+
paymentMethod: ZodString
|
31
|
+
paymentMethods: ZodArray<ZodString>
|
32
|
+
supportedPaymentMethods: OrderJourneyPaymentMethod[]
|
33
|
+
paymentMethodsRegex: RegExp
|
34
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { AxiosRequestConfig } from "axios"
|
2
|
+
import {
|
3
|
+
Product,
|
4
|
+
ProductIndustry,
|
5
|
+
ProductJobFunction,
|
6
|
+
ProductJobTitle,
|
7
|
+
ProductLocation,
|
8
|
+
ProductSupportingContractsComplete,
|
9
|
+
ProductSupportingContractsPartial,
|
10
|
+
ProductWithSupportForContractsFilters,
|
11
|
+
} from "./types"
|
12
|
+
import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
|
13
|
+
import { PaginatedAPIResponseV1, PaginationLimitOffset } from "../common/types"
|
14
|
+
import {
|
15
|
+
WindowHapiAPIATSConfigs,
|
16
|
+
WindowHapiAPIATSRequests,
|
17
|
+
} from "../ats/api.types"
|
18
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
19
|
+
|
20
|
+
export type WindowHapiAPIProductConfigs = {
|
21
|
+
getProduct: AxiosRequestConfig
|
22
|
+
getProductSupportingContracts: AxiosRequestConfig
|
23
|
+
getProducts: AxiosRequestConfig
|
24
|
+
getProductsSupportingContracts: AxiosRequestConfig
|
25
|
+
searchProducts: AxiosRequestConfig
|
26
|
+
getIndustries: AxiosRequestConfig
|
27
|
+
getJobFunctions: AxiosRequestConfig
|
28
|
+
getJobTitles: AxiosRequestConfig
|
29
|
+
getLocations: AxiosRequestConfig
|
30
|
+
}
|
31
|
+
export type WindowHapiAPIProductRequests = {
|
32
|
+
getProduct: (productId: number | string) => Promise<Product>
|
33
|
+
getProductSupportingContracts: (
|
34
|
+
productId: number | string,
|
35
|
+
) => Promise<ProductSupportingContractsComplete>
|
36
|
+
getProducts: (
|
37
|
+
productIds: (number | string)[],
|
38
|
+
limitOffset?: PaginationLimitOffset,
|
39
|
+
allowOrders?: boolean,
|
40
|
+
) => Promise<PaginatedAPIResponseV1<Product>>
|
41
|
+
searchProducts: (
|
42
|
+
filters?: URLSearchParams,
|
43
|
+
limitOffset?: PaginationLimitOffset,
|
44
|
+
) => Promise<PaginatedAPIResponseV1<Product>>
|
45
|
+
getProductsSupportingContracts: (
|
46
|
+
filters?: ProductWithSupportForContractsFilters,
|
47
|
+
limitOffset?: PaginationLimitOffset,
|
48
|
+
) => Promise<PaginatedAPIResponseV1<ProductSupportingContractsPartial>>
|
49
|
+
getIndustries: () => Promise<ProductIndustry[]>
|
50
|
+
getJobFunctions: () => Promise<ProductJobFunction[]>
|
51
|
+
getJobTitles: (
|
52
|
+
text?: string,
|
53
|
+
) => Promise<PaginatedAPIResponseV1<ProductJobTitle>>
|
54
|
+
getLocations: (searchParam: string) => Promise<ProductLocation[]>
|
55
|
+
}
|
56
|
+
export type WindowHapiAPIProduct = WindowHapiModuleWithConstructorArgs<
|
57
|
+
WindowHapiAPIModule<
|
58
|
+
WindowHapiAPIProductRequests,
|
59
|
+
WindowHapiAPIProductConfigs
|
60
|
+
>,
|
61
|
+
{ readonly api: WindowHapiAPI }
|
62
|
+
>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// created from 'create-ts-index'
|
2
|
+
|
3
|
+
export * from "./api.types"
|
4
|
+
export * from "./enums"
|
5
|
+
export * from "./qa.types"
|
6
|
+
export * from "./service.types"
|
7
|
+
export * from "./state.types"
|
8
|
+
export * from "./types"
|
9
|
+
export * from "./utils.types"
|
10
|
+
export * from "./validations.types"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { WindowHapiQA } from "../_window/qa.types"
|
2
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
3
|
+
|
4
|
+
export type WindowHapiQAProduct = WindowHapiModuleWithConstructorArgs<
|
5
|
+
{
|
6
|
+
useMockFilters: () => Promise<void>
|
7
|
+
getRandomChannelIdThatSupportsContracts: () => Promise<number>
|
8
|
+
getRandomProductId: () => Promise<string>
|
9
|
+
},
|
10
|
+
{ readonly qa: WindowHapiQA }
|
11
|
+
>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import {
|
2
|
+
HapiServiceFunctionWithLifecycleHooks,
|
3
|
+
WindowHapiService,
|
4
|
+
} from "../_window/service.types"
|
5
|
+
import {
|
6
|
+
Product,
|
7
|
+
ProductFilterQueryParams,
|
8
|
+
ProductIndustry,
|
9
|
+
ProductJobFunction,
|
10
|
+
ProductJobTitle,
|
11
|
+
ProductLocation,
|
12
|
+
ProductSupportingContractsComplete,
|
13
|
+
ProductSupportingContractsPartial,
|
14
|
+
} from "./types"
|
15
|
+
import { PaginatedAPIResponseV1, PaginationResponseV1 } from "../common/types"
|
16
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
17
|
+
|
18
|
+
export type ProductServiceGetFilteredProductsHandler = (
|
19
|
+
meta?: PaginationResponseV1 | null,
|
20
|
+
filters?: Partial<ProductFilterQueryParams>,
|
21
|
+
) => Promise<Product[]>
|
22
|
+
export type ProductServiceGetProductWithContractsSupportByIdHandler = (
|
23
|
+
id: string | number,
|
24
|
+
) => Promise<ProductSupportingContractsComplete>
|
25
|
+
export type ProductServiceGetProductsWithContractsSupportHandler = (
|
26
|
+
queryParams?: any,
|
27
|
+
) => Promise<ProductSupportingContractsPartial[]>
|
28
|
+
export type ProductServiceGetRecommendedProductsHandler = () => Promise<
|
29
|
+
Product[]
|
30
|
+
>
|
31
|
+
export type ProductServiceGetProductHandler = (
|
32
|
+
productId: number | string,
|
33
|
+
) => Promise<Product>
|
34
|
+
export type ProductServiceGetProductsHandler = (
|
35
|
+
queryParams: URLSearchParams,
|
36
|
+
shouldAppendResults?: boolean,
|
37
|
+
) => Promise<{
|
38
|
+
products: Product[]
|
39
|
+
paginationMeta?: PaginationResponseV1
|
40
|
+
}>
|
41
|
+
export type ProductServiceGetLocationsHandler = (
|
42
|
+
text: string,
|
43
|
+
) => Promise<ProductLocation[]>
|
44
|
+
export type ProductServiceGetJobTitlesHandler = (
|
45
|
+
text?: string,
|
46
|
+
) => Promise<PaginatedAPIResponseV1<ProductJobTitle>>
|
47
|
+
export type ProductServiceGetJobFunctionsHandler = () => Promise<
|
48
|
+
ProductJobFunction[]
|
49
|
+
>
|
50
|
+
export type ProductServiceGetIndustriesHandler = () => Promise<
|
51
|
+
ProductIndustry[]
|
52
|
+
>
|
53
|
+
|
54
|
+
export type WindowHapiServiceProduct = WindowHapiModuleWithConstructorArgs<
|
55
|
+
{
|
56
|
+
getProductWithContractsSupportById: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductWithContractsSupportByIdHandler>
|
57
|
+
getProductsWithContractsSupport: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductsWithContractsSupportHandler>
|
58
|
+
getFilteredProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetFilteredProductsHandler>
|
59
|
+
getRecommendedProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetRecommendedProductsHandler>
|
60
|
+
getProducts: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductsHandler>
|
61
|
+
getProduct: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetProductHandler>
|
62
|
+
getLocations: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetLocationsHandler>
|
63
|
+
getJobTitles: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobTitlesHandler>
|
64
|
+
getJobFunctions: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetJobFunctionsHandler>
|
65
|
+
getIndustries: HapiServiceFunctionWithLifecycleHooks<ProductServiceGetIndustriesHandler>
|
66
|
+
},
|
67
|
+
{ readonly service: WindowHapiService }
|
68
|
+
>
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import {
|
2
|
+
Product,
|
3
|
+
ProductIndustry,
|
4
|
+
ProductJobFunction,
|
5
|
+
ProductJobTitle,
|
6
|
+
ProductLocation,
|
7
|
+
ProductSupportingContractsPartial,
|
8
|
+
} from "./types"
|
9
|
+
import { PaginationResponseV1 } from "../common/types"
|
10
|
+
|
11
|
+
export type ProductState = {
|
12
|
+
/* Products */
|
13
|
+
/**
|
14
|
+
* Array of Products to be listed on Products Landing and Products List widgets. As user applies filters and sorting, this value gets overwritten
|
15
|
+
*/
|
16
|
+
recommendedProducts: Product[]
|
17
|
+
/**
|
18
|
+
* Indicates if recommended products are loading
|
19
|
+
*/
|
20
|
+
recommendedProductsAreLoading: boolean
|
21
|
+
/**
|
22
|
+
* Array of Products to be listed on Contracts Add Channel Selector Dropdown
|
23
|
+
*/
|
24
|
+
productsWithContractsSupport: ProductSupportingContractsPartial[]
|
25
|
+
/**
|
26
|
+
* Indicates whether the Products with Contracts support is loading (mainly used for showing a loading spinner on the Select element when the user is searching for a Product when creating a contract)
|
27
|
+
*/
|
28
|
+
productsWithContractsSupportAreLoading: boolean
|
29
|
+
/**
|
30
|
+
* Array of Products to be listed on Products Landing and Products List widgets. As user applies filters and sorting, this value gets overwritten
|
31
|
+
*/
|
32
|
+
products: Product[]
|
33
|
+
/**
|
34
|
+
Offset and limit style pagination meta
|
35
|
+
*/
|
36
|
+
productsPaginationMeta: PaginationResponseV1 | null
|
37
|
+
/**
|
38
|
+
* Indicates if products are loading
|
39
|
+
*/
|
40
|
+
productsAreLoading: boolean
|
41
|
+
/**
|
42
|
+
* The value of Product name in the Input HTML Element that is used to fetch new Product results from the API
|
43
|
+
*/
|
44
|
+
productNameInput: string
|
45
|
+
/**
|
46
|
+
* The selected Product region IDs that is used to fetch new Product results from the API
|
47
|
+
*/
|
48
|
+
jobRegionsIdsSelected: number[]
|
49
|
+
/* Locations */
|
50
|
+
/**
|
51
|
+
* Array of Locations that are lazily loaded with the input given in `jobRegionsIdsSelected`
|
52
|
+
*/
|
53
|
+
jobRegions: ProductLocation[]
|
54
|
+
/* Job Titles */
|
55
|
+
/**
|
56
|
+
* Array of Job Titles that are lazily loaded with the input given in `jobTitlesIdsSelected`
|
57
|
+
*/
|
58
|
+
jobTitles: ProductJobTitle[]
|
59
|
+
/**
|
60
|
+
* The selected Job Title IDs that are used to fetch new Product results from the API
|
61
|
+
*/
|
62
|
+
jobTitlesIdsSelected: number[]
|
63
|
+
/* Job Functions */
|
64
|
+
/**
|
65
|
+
* Array of Job Functions that are lazily loaded with the input given in `jobTitlesIdsSelected`
|
66
|
+
*/
|
67
|
+
jobFunctions: ProductJobFunction[]
|
68
|
+
/**
|
69
|
+
* Shows a loading spinner and disables the Select HTML Element while locations are loading
|
70
|
+
*/
|
71
|
+
jobFunctionsAreLoading: boolean
|
72
|
+
/**
|
73
|
+
* The value of Job Function in the Input HTML Element that lazy loads `jobFunctions`
|
74
|
+
*/
|
75
|
+
jobFunctionsInput: string
|
76
|
+
/**
|
77
|
+
* The selected Job Function IDs that are used to fetch new Product results from the API
|
78
|
+
*/
|
79
|
+
jobFunctionsIdsSelected: number[]
|
80
|
+
/* Industries */
|
81
|
+
/**
|
82
|
+
* The selected Job Industry ID that is used to fetch new Product results from the API
|
83
|
+
*/
|
84
|
+
jobIndustriesIdsSelected: number[]
|
85
|
+
/**
|
86
|
+
* Array of Industries that are lazily loaded with the input given in `jobIndustriesIdsSelected`
|
87
|
+
*/
|
88
|
+
jobIndustries: ProductIndustry[]
|
89
|
+
/**
|
90
|
+
* Shows a loading spinner and disables the Select HTML Element while locations are loading
|
91
|
+
*/
|
92
|
+
jobIndustriesAreLoading: boolean
|
93
|
+
}
|