@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.
Files changed (188) hide show
  1. package/enums.ts +41 -0
  2. package/package.json +5 -7
  3. package/src/_window/api.types.ts +59 -0
  4. package/src/_window/auth.types.ts +11 -0
  5. package/src/_window/config.types.ts +30 -0
  6. package/src/_window/events.types.ts +157 -0
  7. package/src/_window/index.ts +16 -0
  8. package/src/_window/instances.types.ts +18 -0
  9. package/src/_window/qa.types.ts +28 -0
  10. package/src/_window/routing.types.ts +21 -0
  11. package/src/_window/sdk.types.ts +147 -0
  12. package/src/_window/service.types.ts +67 -0
  13. package/src/_window/state.types.ts +112 -0
  14. package/src/_window/ui.types.ts +13 -0
  15. package/src/_window/utils.types.ts +34 -0
  16. package/src/_window/validation.types.ts +43 -0
  17. package/src/_window/window.ts +56 -0
  18. package/src/alert/enums.ts +22 -0
  19. package/src/alert/functions.types.ts +13 -0
  20. package/src/alert/index.ts +9 -0
  21. package/src/alert/service.types.ts +15 -0
  22. package/src/alert/state.initial.ts +16 -0
  23. package/src/alert/state.types.ts +27 -0
  24. package/src/alert/state.validations.ts +11 -0
  25. package/src/alert/types.ts +63 -0
  26. package/src/ats/api.types.ts +16 -0
  27. package/src/ats/functions.types.ts +7 -0
  28. package/src/ats/index.ts +9 -0
  29. package/src/ats/service.types.ts +17 -0
  30. package/src/ats/state.initial.ts +5 -0
  31. package/src/ats/state.types.ts +5 -0
  32. package/src/ats/state.validations.ts +6 -0
  33. package/src/ats/types.ts +19 -0
  34. package/src/basket/consts.ts +1 -0
  35. package/src/basket/functions.types.ts +40 -0
  36. package/src/basket/index.ts +12 -0
  37. package/src/basket/service.types.ts +32 -0
  38. package/src/basket/state.initial.ts +11 -0
  39. package/src/basket/state.types.ts +34 -0
  40. package/src/basket/state.validations.ts +12 -0
  41. package/src/basket/types.ts +4 -0
  42. package/src/basket/utils.ts +79 -0
  43. package/src/basket/utils.types.ts +10 -0
  44. package/src/basket/validations.types.ts +25 -0
  45. package/src/campaign/api.types.ts +45 -0
  46. package/src/campaign/consts.ts +1 -0
  47. package/src/campaign/enums.ts +17 -0
  48. package/src/campaign/functions.types.ts +90 -0
  49. package/src/campaign/index.ts +15 -0
  50. package/src/campaign/qa.types.ts +12 -0
  51. package/src/campaign/service.types.ts +48 -0
  52. package/src/campaign/state.initial.ts +84 -0
  53. package/src/campaign/state.types.ts +55 -0
  54. package/src/campaign/state.validations.ts +16 -0
  55. package/src/campaign/types.ts +237 -0
  56. package/src/campaign/utils.ts +53 -0
  57. package/src/campaign/utils.types.ts +59 -0
  58. package/src/campaign/validations.types.ts +215 -0
  59. package/src/common/LocalStorage.ts +123 -0
  60. package/src/common/browser.ts +2 -0
  61. package/src/common/color.ts +9 -0
  62. package/src/common/events/EventCommand/enums.ts +49 -0
  63. package/src/common/events/EventCommand/index.ts +4 -0
  64. package/src/common/events/EventCommand/types.ts +18 -0
  65. package/src/common/events/index.ts +4 -0
  66. package/src/common/events/types.ts +52 -0
  67. package/src/common/immutable.ts +28 -0
  68. package/src/common/index.ts +22 -0
  69. package/src/common/instances/Instance.ts +13 -0
  70. package/src/common/instances/consts.ts +1 -0
  71. package/src/common/instances/index.ts +4 -0
  72. package/src/common/json.ts +25 -0
  73. package/src/common/logger/Logger.ts +70 -0
  74. package/src/common/logger/enums.ts +12 -0
  75. package/src/common/logger/index.ts +5 -0
  76. package/src/common/logger/types.ts +7 -0
  77. package/src/common/logger-datadog/LoggerDatadog.ts +42 -0
  78. package/src/common/logger-datadog/index.ts +3 -0
  79. package/src/common/misc.ts +114 -0
  80. package/src/common/promise.ts +161 -0
  81. package/src/common/proxy.ts +77 -0
  82. package/src/common/qa.types.ts +9 -0
  83. package/src/common/regExTest.ts +12 -0
  84. package/src/common/tree.ts +148 -0
  85. package/src/common/types.ts +110 -0
  86. package/src/common/utm.ts +19 -0
  87. package/src/common/validations.types.ts +89 -0
  88. package/src/common/validators.ts +21 -0
  89. package/src/common/webComponents.ts +26 -0
  90. package/src/config/functions.types.ts +23 -0
  91. package/src/config/index.ts +5 -0
  92. package/src/config/state.initial.ts +11 -0
  93. package/src/config/state.types.ts +15 -0
  94. package/src/consts.ts +980 -0
  95. package/src/contract/api.types.ts +47 -0
  96. package/src/contract/consts.ts +1 -0
  97. package/src/contract/functions.types.ts +112 -0
  98. package/src/contract/index.ts +14 -0
  99. package/src/contract/qa.types.ts +12 -0
  100. package/src/contract/service.types.ts +54 -0
  101. package/src/contract/state.initial.ts +39 -0
  102. package/src/contract/state.types.ts +74 -0
  103. package/src/contract/state.validations.ts +21 -0
  104. package/src/contract/types.ts +145 -0
  105. package/src/contract/utils.ts +36 -0
  106. package/src/contract/utils.types.ts +11 -0
  107. package/src/contract/validations.types.ts +104 -0
  108. package/src/debugging/functions.types.ts +34 -0
  109. package/src/debugging/index.ts +6 -0
  110. package/src/debugging/state.initial.ts +10 -0
  111. package/src/debugging/state.types.ts +18 -0
  112. package/src/debugging/state.validations.ts +10 -0
  113. package/src/index.ts +22 -0
  114. package/src/language/consts.ts +6 -0
  115. package/src/language/en.ts +530 -0
  116. package/src/language/functions.types.ts +29 -0
  117. package/src/language/index.ts +11 -0
  118. package/src/language/qa.types.ts +19 -0
  119. package/src/language/state.initial.ts +13 -0
  120. package/src/language/state.types.ts +25 -0
  121. package/src/language/state.validations.ts +10 -0
  122. package/src/language/utils.ts +17 -0
  123. package/src/language/validations.types.ts +13 -0
  124. package/src/modal/consts.ts +6 -0
  125. package/src/modal/enums.ts +14 -0
  126. package/src/modal/functions.types.ts +22 -0
  127. package/src/modal/index.ts +11 -0
  128. package/src/modal/service.types.ts +32 -0
  129. package/src/modal/state.initial.ts +9 -0
  130. package/src/modal/state.types.ts +8 -0
  131. package/src/modal/state.validations.ts +6 -0
  132. package/src/modal/store.types.ts +5 -0
  133. package/src/modal/types.ts +44 -0
  134. package/src/orderJourney/consts.ts +289 -0
  135. package/src/orderJourney/enums.ts +25 -0
  136. package/src/orderJourney/functions.types.ts +140 -0
  137. package/src/orderJourney/index.ts +13 -0
  138. package/src/orderJourney/qa.types.ts +16 -0
  139. package/src/orderJourney/state.initial.ts +401 -0
  140. package/src/orderJourney/state.types.ts +99 -0
  141. package/src/orderJourney/state.validations.ts +78 -0
  142. package/src/orderJourney/types.ts +31 -0
  143. package/src/orderJourney/utils.ts +7 -0
  144. package/src/orderJourney/utils.types.ts +11 -0
  145. package/src/orderJourney/validations.types.ts +34 -0
  146. package/src/product/api.types.ts +62 -0
  147. package/src/product/consts.ts +1 -0
  148. package/src/product/enums.ts +11 -0
  149. package/src/product/functions.types.ts +156 -0
  150. package/src/product/index.ts +14 -0
  151. package/src/product/qa.types.ts +11 -0
  152. package/src/product/service.types.ts +68 -0
  153. package/src/product/state.initial.ts +28 -0
  154. package/src/product/state.types.ts +93 -0
  155. package/src/product/state.validations.ts +25 -0
  156. package/src/product/types.ts +161 -0
  157. package/src/product/utils.types.ts +22 -0
  158. package/src/product/validations.types.ts +189 -0
  159. package/src/routing/functions.types.ts +48 -0
  160. package/src/routing/index.ts +5 -0
  161. package/src/routing/state.initial.ts +10 -0
  162. package/src/routing/state.types.ts +30 -0
  163. package/src/theming/consts.ts +7727 -0
  164. package/src/theming/functions.types.ts +13 -0
  165. package/src/theming/index.ts +11 -0
  166. package/src/theming/qa.types.ts +11 -0
  167. package/src/theming/state.initial.ts +16 -0
  168. package/src/theming/state.types.ts +6 -0
  169. package/src/theming/state.validations.ts +8 -0
  170. package/src/theming/types.ts +123 -0
  171. package/src/theming/utils.ts +581 -0
  172. package/src/theming/validations.types.ts +62 -0
  173. package/src/types.ts +229 -0
  174. package/src/ui/index.ts +3 -0
  175. package/src/ui/service.types.ts +26 -0
  176. package/src/utils.ts +3 -0
  177. package/src/wallet/api.types.ts +33 -0
  178. package/src/wallet/consts.ts +3 -0
  179. package/src/wallet/functions.types.ts +58 -0
  180. package/src/wallet/index.ts +11 -0
  181. package/src/wallet/service.types.ts +26 -0
  182. package/src/wallet/state.initial.ts +18 -0
  183. package/src/wallet/state.types.ts +58 -0
  184. package/src/wallet/state.validations.ts +18 -0
  185. package/src/wallet/types.ts +65 -0
  186. package/src/wallet/validations.types.ts +18 -0
  187. package/tsconfig.json +41 -0
  188. package/index.d.ts +0 -5207
@@ -0,0 +1,78 @@
1
+ import { OrderJourneyStoreState } from "./state.types"
2
+ import { StateValidations } from "../_window/state.types"
3
+
4
+ export const orderJourneyStoreStateValidations: StateValidations<OrderJourneyStoreState> =
5
+ {
6
+ stepsPopulatedAreHidden: "common.genericBoolean",
7
+ hidePrefilledFields: "common.genericBoolean",
8
+ contractStepsHideFields: "common.genericRecordBoolean",
9
+ stepsEnabled: "orderJourney.stepKeys",
10
+ paymentMethodActive: "orderJourney.paymentMethod",
11
+ paymentMethodsEnabled: "orderJourney.paymentMethods",
12
+ paymentMethodsAvailable: "orderJourney.paymentMethods",
13
+ steps: "throwHasNoSetterError",
14
+ stepPreviousIndex: "throwHasNoSetterError",
15
+ stepActiveIndex: "common.genericNumber",
16
+ stepNextIndex: "throwHasNoSetterError",
17
+ stepPrevious: "throwHasNoSetterError",
18
+ stepActive: "throwHasNoSetterError",
19
+ stepNext: "throwHasNoSetterError",
20
+ stepFirstIndex: "throwHasNoSetterError",
21
+ stepLastIndex: "throwHasNoSetterError",
22
+ orderErrors: "common.genericAny",
23
+ onboardingStep: "orderJourney.step",
24
+ onboardingStepData: "throwHasNoSetterError",
25
+ onboardingStepValidations: "throwHasNoSetterError",
26
+ selectProductsStep: "orderJourney.step",
27
+ selectProductsStepData: "throwHasNoSetterError",
28
+ selectProductsStepValidations: "throwHasNoSetterError",
29
+ addContractsStep: "orderJourney.step",
30
+ addContractsStepData: "throwHasNoSetterError",
31
+ addContractsStepValidations: "throwHasNoSetterError",
32
+ selectContractsStep: "orderJourney.step",
33
+ selectContractsStepData: "throwHasNoSetterError",
34
+ selectContractsStepValidations: "throwHasNoSetterError",
35
+ basketSummaryStep: "orderJourney.step",
36
+ basketSummaryStepData: "throwHasNoSetterError",
37
+ basketSummaryStepValidations: "throwHasNoSetterError",
38
+ targetGroupStep: "orderJourney.step",
39
+ targetGroupStepData: "throwHasNoSetterError",
40
+ targetGroupStepValidations: "throwHasNoSetterError",
41
+ recruiterInfoStep: "orderJourney.step",
42
+ recruiterInfoStepData: "throwHasNoSetterError",
43
+ recruiterInfoStepValidations: "throwHasNoSetterError",
44
+ postingDetailsStep: "orderJourney.step",
45
+ postingDetailsStepData: "throwHasNoSetterError",
46
+ postingDetailsStepValidations: "throwHasNoSetterError",
47
+ organizationStep: "orderJourney.step",
48
+ organizationStepData: "throwHasNoSetterError",
49
+ organizationStepValidations: "throwHasNoSetterError",
50
+ contactInfoStep: "orderJourney.step",
51
+ contactInfoStepData: "throwHasNoSetterError",
52
+ contactInfoStepValidations: "throwHasNoSetterError",
53
+ workingLocationStep: "orderJourney.step",
54
+ workingLocationStepData: "throwHasNoSetterError",
55
+ workingLocationStepValidations: "throwHasNoSetterError",
56
+ urlsStep: "orderJourney.step",
57
+ urlsStepData: "throwHasNoSetterError",
58
+ urlsStepValidations: "throwHasNoSetterError",
59
+ contractSteps: "throwHasNoSetterError",
60
+ contractStepsValidators: "common.genericRecordString",
61
+ contractStepsBlurredFields: "common.genericRecordBoolean",
62
+ contractStepsErrorMessages: "common.genericRecordString",
63
+ contractStepsSubmittedSteps: "common.genericRecordBoolean",
64
+ contractStepsData: "throwHasNoSetterError",
65
+ contractStepsValidations: "throwHasNoSetterError",
66
+ utmCodesStep: "orderJourney.step",
67
+ utmCodesStepData: "throwHasNoSetterError",
68
+ utmCodesStepValidations: "throwHasNoSetterError",
69
+ orderReviewStep: "orderJourney.step",
70
+ orderReviewStepData: "throwHasNoSetterError",
71
+ orderReviewStepValidations: "throwHasNoSetterError",
72
+ paymentMethodStep: "orderJourney.step",
73
+ paymentMethodStepData: "throwHasNoSetterError",
74
+ paymentMethodStepValidations: "throwHasNoSetterError",
75
+ orderConfirmationStep: "orderJourney.step",
76
+ orderConfirmationStepData: "throwHasNoSetterError",
77
+ orderConfirmationStepValidations: "throwHasNoSetterError",
78
+ }
@@ -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,7 @@
1
+ import { OrderJourneyStepKey } from "./enums"
2
+
3
+ export const orderJourneyGetContractStepKey = (contractId: string) =>
4
+ `${OrderJourneyStepKey.contractChannelPostingRequirements}-${contractId}`
5
+
6
+ export const orderJourneyGetContractIdFromContractStepKey = (key: string) =>
7
+ key.split(`${OrderJourneyStepKey.contractChannelPostingRequirements}-`)[1]
@@ -0,0 +1,11 @@
1
+ import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
2
+ import { ModuleWithConstructorArgs } from "../types"
3
+ import { WindowHapiUtils } from "../_window/utils.types"
4
+
5
+ export type WindowHapiUtilsOrderJourney = ModuleWithConstructorArgs<
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 { ModuleWithConstructorArgs } from "../types"
15
+ import {
16
+ WindowHapiAPIATSConfigs,
17
+ WindowHapiAPIATSRequests,
18
+ } from "../ats/api.types"
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 = ModuleWithConstructorArgs<
57
+ WindowHapiAPIModule<
58
+ WindowHapiAPIProductRequests,
59
+ WindowHapiAPIProductConfigs
60
+ >,
61
+ { readonly api: WindowHapiAPI }
62
+ >
@@ -0,0 +1 @@
1
+ export const PRODUCTS_FILTERS_MAX_MULTI_SELECT_LIMIT = 1 //when 0 it is unlimited
@@ -0,0 +1,11 @@
1
+ export enum ProductFilterRecommendations {
2
+ "all" = "all",
3
+ "only" = "only",
4
+ "without" = "without",
5
+ }
6
+
7
+ export enum ProductPriceCurrency {
8
+ "USD" = "USD",
9
+ "EUR" = "EUR",
10
+ "GBP" = "GBP",
11
+ }
@@ -0,0 +1,156 @@
1
+ /* Products */
2
+
3
+ import {
4
+ Product,
5
+ ProductIndustry,
6
+ ProductJobFunction,
7
+ ProductJobTitle,
8
+ ProductLocation,
9
+ ProductSupportingContractsPartial,
10
+ } from "./types"
11
+ import { PaginationResponseV1 } from "../common/types"
12
+
13
+ export type ProductStoreSetPaginationMetaHandler = (
14
+ meta: PaginationResponseV1 | null,
15
+ ) => void
16
+ export type ProductStoreSetProductsHandler = (products: Product[]) => void
17
+ export type ProductStoreSetRecommendedProductsHandler = (
18
+ products: Product[],
19
+ ) => void
20
+ export type ProductStoreSetRelevantProductsHandler = (
21
+ products: Product[],
22
+ ) => void
23
+ export type ProductStoreSetMyContractsOnlyProductsHandler = (
24
+ products: Product[],
25
+ ) => void
26
+ export type ProductStoreSetProductsAreLoadingHandler = (
27
+ isLoading: boolean,
28
+ ) => void
29
+ export type ProductStoreSetFilterProductNameHandler = (name: string) => void
30
+ export type ProductStoreSetFilterSelectedProductRegionIdHandler = (
31
+ id: number[],
32
+ ) => void
33
+ /* Locations */
34
+ export type ProductStoreSetLocationsHandler = (
35
+ locations: ProductLocation[],
36
+ ) => void
37
+ /* Job Titles*/
38
+ export type ProductStoreSetJobTitlesHandler = (
39
+ titles: ProductJobTitle[],
40
+ ) => void
41
+ export type ProductStoreSetFilterSelectedJobTitleIdsHandler = (
42
+ id: number[],
43
+ ) => void
44
+ /* Job Functions */
45
+ export type ProductStoreSetJobFunctionsHandler = (
46
+ functions: ProductJobFunction[],
47
+ ) => void
48
+ export type ProductStoreSetIsLoadingJobFunctionsHandler = (
49
+ isLoading: boolean,
50
+ ) => void
51
+ export type ProductStoreSetFilterJobFunctionHandler = (
52
+ functionName: string,
53
+ ) => void
54
+ export type ProductStoreSetFilterSelectedJobFunctionIdsHandler = (
55
+ id: number[],
56
+ ) => void
57
+ /* Industries */
58
+ export type ProductStoreSetIndustriesHandler = (
59
+ industries: ProductIndustry[],
60
+ ) => void
61
+ export type ProductStoreSetIsLoadingIndustriesHandler = (
62
+ isLoading: boolean,
63
+ ) => void
64
+ export type ProductStoreSetFilterSelectedJobIndustryIdHandler = (
65
+ id: number[],
66
+ ) => void
67
+
68
+ /* Products that only support My Contracts */
69
+ export type ProductStoreSetProductsWithContractsSupportHandler = (
70
+ productsWithContractsSupport: ProductSupportingContractsPartial[],
71
+ ) => void
72
+ export type ProductStoreSetProductsWithContractsSupportAreLoadingHandler = (
73
+ isLoading: boolean,
74
+ ) => void
75
+
76
+ export type ProductStoreFunctions = {
77
+ /* Products */
78
+ /**
79
+ * The function that sets the value of either `productsPaginationMeta`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
80
+ */
81
+ setPaginationMeta: ProductStoreSetPaginationMetaHandler
82
+ /**
83
+ * The function that sets the value of `products`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
84
+ */
85
+ setProducts: ProductStoreSetProductsHandler
86
+ /**
87
+ * The function that sets the value of `recommendedProducts`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
88
+ */
89
+ setRecommendedProducts: ProductStoreSetRecommendedProductsHandler
90
+ /**
91
+ * The function that sets the value of `productsAreLoading`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
92
+ */
93
+ setProductsAreLoading: ProductStoreSetProductsAreLoadingHandler
94
+ /**
95
+ * The function that sets the value of `filterProductName`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
96
+ */
97
+ setProductNameInput: ProductStoreSetFilterProductNameHandler
98
+ /**
99
+ * The function that sets the value of `filterSelectedProductRegionId`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
100
+ */
101
+ setJobRegionsIdsSelected: ProductStoreSetFilterSelectedProductRegionIdHandler
102
+ /* Locations */
103
+ /**
104
+ * The function that sets the value of `locations`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
105
+ */
106
+ setJobRegions: ProductStoreSetLocationsHandler
107
+ /* Job Titles */
108
+ /**
109
+ * The function that sets the value of `jobTitles`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
110
+ */
111
+ setJobTitles: ProductStoreSetJobTitlesHandler
112
+ /**
113
+ * The function that sets the value of `filterSelectedJobTitleIds`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
114
+ */
115
+ setJobTitlesIdsSelected: ProductStoreSetFilterSelectedJobTitleIdsHandler
116
+ /* Job Functions */
117
+ /**
118
+ * The function that sets the value of `jobFunctions`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
119
+ */
120
+ setJobFunctions: ProductStoreSetJobFunctionsHandler
121
+ /**
122
+ * The function that sets the value of `isLoadingJobFunctions`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
123
+ */
124
+ setJobFunctionsAreLoading: ProductStoreSetIsLoadingJobFunctionsHandler
125
+ /**
126
+ * The function that sets the value of `filterJobFunction`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
127
+ */
128
+ setJobFunctionsInput: ProductStoreSetFilterJobFunctionHandler
129
+ /**
130
+ * The function that sets the value of `filterSelectedJobFunctionIds`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
131
+ */
132
+ setJobFunctionsIdsSelected: ProductStoreSetFilterSelectedJobFunctionIdsHandler
133
+ /* Industries */
134
+ /**
135
+ * The function that sets the value of `industries`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
136
+ */
137
+ setJobIndustries: ProductStoreSetIndustriesHandler
138
+ /**
139
+ * The function that sets the value of `isLoadingIndustries`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
140
+ */
141
+ setJobIndustriesAreLoading: ProductStoreSetIsLoadingIndustriesHandler
142
+ /**
143
+ * The function that sets the value of `filterSelectedJobIndustryId`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
144
+ */
145
+ setJobIndustriesIdsSelected: ProductStoreSetFilterSelectedJobIndustryIdHandler
146
+ /* Sort By */
147
+ /* Products that only support My Contracts */
148
+ /**
149
+ * The function that sets the value of `productsWithContractsSupport`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
150
+ */
151
+ setProductsWithContractsSupport: ProductStoreSetProductsWithContractsSupportHandler
152
+ /**
153
+ * The function that sets the value of `productsWithContractsSupportAreLoading`. Refer to [ProductStoreState](/docs/sdk/products/#productstorestate) for more details.
154
+ */
155
+ setProductsWithContractsSupportAreLoading: ProductStoreSetProductsWithContractsSupportAreLoadingHandler
156
+ }
@@ -0,0 +1,14 @@
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.types';
14
+ export * from './validations.types';
@@ -0,0 +1,11 @@
1
+ import { ModuleWithConstructorArgs } from "../types"
2
+ import { WindowHapiQA } from "../_window/qa.types"
3
+
4
+ export type WindowHapiQAProduct = ModuleWithConstructorArgs<
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 { ModuleWithConstructorArgs } from "../types"
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 = ModuleWithConstructorArgs<
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,28 @@
1
+ import { ProductStoreState } from "./state.types"
2
+
3
+ export const initialProductStoreState: ProductStoreState = {
4
+ /* Products */
5
+ recommendedProducts: [],
6
+ recommendedProductsAreLoading: false,
7
+ productsWithContractsSupport: [],
8
+ productsWithContractsSupportAreLoading: false,
9
+ products: [],
10
+ productsAreLoading: false,
11
+ productsPaginationMeta: null,
12
+ productNameInput: "",
13
+ jobRegionsIdsSelected: [],
14
+ /* Locations */
15
+ jobRegions: [],
16
+ /* Job Titles */
17
+ jobTitles: [],
18
+ jobTitlesIdsSelected: [],
19
+ /* Job Functions */
20
+ jobFunctions: [],
21
+ jobFunctionsAreLoading: false,
22
+ jobFunctionsInput: "",
23
+ jobFunctionsIdsSelected: [],
24
+ /* Industries */
25
+ jobIndustries: [],
26
+ jobIndustriesAreLoading: false,
27
+ jobIndustriesIdsSelected: [],
28
+ }
@@ -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 ProductStoreState = {
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
+ }
@@ -0,0 +1,25 @@
1
+ import { ProductStoreState } from "./state.types"
2
+ import { StateValidations } from "../_window/state.types"
3
+
4
+ export const productStoreStoreStateValidations: StateValidations<ProductStoreState> =
5
+ {
6
+ recommendedProducts: "product.products",
7
+ recommendedProductsAreLoading: "common.genericBoolean",
8
+ productsWithContractsSupport: "product.productsWithContractSupport",
9
+ productsWithContractsSupportAreLoading: "common.genericBoolean",
10
+ products: "common.products",
11
+ productsAreLoading: "common.genericBoolean",
12
+ productsPaginationMeta: "product.productsPaginationMeta",
13
+ productNameInput: "common.genericString",
14
+ jobRegionsIdsSelected: "common.genericNumberArray",
15
+ jobRegions: "product.productLocations",
16
+ jobTitles: "product.jobTitles",
17
+ jobTitlesIdsSelected: "common.genericNumberArray",
18
+ jobFunctions: "product.jobFunctions",
19
+ jobFunctionsAreLoading: "common.genericBoolean",
20
+ jobFunctionsInput: "common.genericString",
21
+ jobFunctionsIdsSelected: "common.genericNumberArray",
22
+ jobIndustries: "product.industries",
23
+ jobIndustriesAreLoading: "common.genericBoolean",
24
+ jobIndustriesIdsSelected: "common.genericNumberArray",
25
+ }