@vonq/hapi-elements-types 1.3.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 (187) hide show
  1. package/enums.ts +41 -0
  2. package/package.json +6 -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
@@ -0,0 +1,34 @@
1
+ import { Product } from "../product/types"
2
+ import { BasketProduct } from "./types"
3
+ import { Contract } from "../contract/types"
4
+
5
+ export type BasketStoreState = {
6
+ /**
7
+ * Array of `BasketProduct`s. The price or other properties of a Product or Contract may change therefore this variable only contains ID of Product or Contract and whether it is a Product or not; via the `isProduct: boolean` variable. Elements of this array then are fetched from the API with their latest information and then set as `products`.
8
+ */
9
+ productsMeta: BasketProduct[]
10
+ /**
11
+ * Array of Products and/or Contracts. This variable is auto-populated with the response received from the API for the Products and Contracts inside `productsMeta`
12
+ */
13
+ products: (Product | Contract)[]
14
+ /**
15
+ * Sum of prices of Products and/or Contracts in EUR currency. **This value is a computed getter meaning that it cannot be set from outside**
16
+ */
17
+ totalInEUR: number
18
+ /**
19
+ * Sum of prices of Products and/or Contracts in USD currency. **This value is a computed getter meaning that it cannot be set from outside**
20
+ */
21
+ totalInUSD: number
22
+ /**
23
+ * Sum of prices of Products and/or Contracts in GBP currency. **This value is a computed getter meaning that it cannot be set from outside**
24
+ */
25
+ totalInGBP: number
26
+ /**
27
+ * Sum of prices of Products and/or Contracts in the current display currency that is used throughout the widgets. **This value is a computed getter meaning that it cannot be set from outside**
28
+ */
29
+ totalInDisplayCurrency: number
30
+ /**
31
+ * Shows a spinner in Basket when the data for Products and/or Contracts is being fetched from the API
32
+ */
33
+ productsAreLoading: boolean
34
+ }
@@ -0,0 +1,12 @@
1
+ import { BasketStoreState } from "./state.types"
2
+ import { StateValidations } from "../_window/state.types"
3
+
4
+ export const basketStoreStateValidations: StateValidations<BasketStoreState> = {
5
+ productsMeta: "basket.productsMeta",
6
+ products: "basket.products",
7
+ productsAreLoading: "common.genericBoolean",
8
+ totalInEUR: "throwHasNoSetterError",
9
+ totalInGBP: "throwHasNoSetterError",
10
+ totalInUSD: "throwHasNoSetterError",
11
+ totalInDisplayCurrency: "throwHasNoSetterError",
12
+ }
@@ -0,0 +1,4 @@
1
+ export type BasketProduct = {
2
+ id: number | string // Product ID or Contract ID
3
+ isProduct: boolean
4
+ }
@@ -0,0 +1,79 @@
1
+ import { Product } from "../product/types"
2
+ import { Contract } from "../contract/types"
3
+ import { ProductPriceCurrency } from "../product/enums"
4
+ import { BasketProduct } from "./types"
5
+
6
+ export const getIsBasketProductContract = (product: Product | Contract) => {
7
+ return (product as Contract).contract_id !== undefined
8
+ }
9
+ export const getIsBasketProductProduct = (product: Product | Contract) => {
10
+ return (product as Product).product_id !== undefined
11
+ }
12
+ export const getBasketProductId = (product: Product | Contract) => {
13
+ const isProduct = getIsBasketProductProduct(product)
14
+ return isProduct
15
+ ? (product as Product).product_id
16
+ : (product as Contract).contract_id
17
+ }
18
+ export const getBasketProductTitle = (product: Product | Contract) => {
19
+ const isProduct = getIsBasketProductProduct(product)
20
+ return isProduct
21
+ ? (product as Product).title
22
+ : (product as Contract).product.title
23
+ }
24
+
25
+ export const getBasketProductPrice = (
26
+ product: Product | Contract,
27
+ displayCurrency: ProductPriceCurrency,
28
+ ) => {
29
+ if ((product as Product).product_id) {
30
+ const price = (product as Product).vonq_price.find(
31
+ (price) => price.currency === displayCurrency,
32
+ )
33
+ if (price) {
34
+ return price
35
+ }
36
+ return undefined
37
+ } else {
38
+ return undefined
39
+ }
40
+ }
41
+
42
+ export const getBasketProductBoardType = (product: Product | Contract) => {
43
+ if ((product as Product).product_id) {
44
+ return (product as Product).type
45
+ } else {
46
+ return (product as Contract).channel?.type
47
+ }
48
+ }
49
+
50
+ export const getBasketProductTimeToProcess = (product: Product | Contract) => {
51
+ if ((product as Product).product_id) {
52
+ return `${(product as Product).time_to_process.period} ${
53
+ (product as Product).time_to_process.range
54
+ }`
55
+ } else {
56
+ return undefined
57
+ }
58
+ }
59
+
60
+ export const getBasketProductDuration = (product: Product | Contract) => {
61
+ if ((product as Product).product_id) {
62
+ return `${(product as Product).duration.period} ${
63
+ (product as Product).duration.range
64
+ }`
65
+ } else {
66
+ return undefined
67
+ }
68
+ }
69
+
70
+ export const getIsProductOrContractInBasket = (
71
+ contractOrProductId: string,
72
+ productsMeta: BasketProduct[],
73
+ ) => {
74
+ const alreadyInBasket = productsMeta.find(
75
+ (basketProduct) => basketProduct.id === contractOrProductId,
76
+ )
77
+
78
+ return alreadyInBasket !== undefined
79
+ }
@@ -0,0 +1,10 @@
1
+ import { BasketProduct } from "./types"
2
+ import { ModuleWithConstructorArgs } from "../types"
3
+ import { WindowHapiUtils } from "../_window/utils.types"
4
+
5
+ export type WindowHapiUtilsBasket = ModuleWithConstructorArgs<
6
+ {
7
+ getInitialBasketProductsMeta: () => BasketProduct[]
8
+ },
9
+ { readonly utils: WindowHapiUtils }
10
+ >
@@ -0,0 +1,25 @@
1
+ import {
2
+ ZodArray,
3
+ ZodBoolean,
4
+ ZodNumber,
5
+ ZodObject,
6
+ ZodString,
7
+ ZodUnion,
8
+ } from "zod"
9
+ import { ZodProduct } from "../product/validations.types"
10
+ import { ZodContract } from "../contract/validations.types"
11
+
12
+ export type ZodContractsOrProducts = ZodArray<
13
+ ZodUnion<[ZodProduct, ZodContract]>
14
+ >
15
+ export type ZodBasketProductMeta = ZodObject<{
16
+ id: ZodUnion<[ZodString, ZodNumber]>
17
+ isProduct: ZodBoolean
18
+ }>
19
+ export type ZodBasketProductsMeta = ZodArray<ZodBasketProductMeta>
20
+
21
+ export type WindowHapiValidationsBasket = {
22
+ contractsOrProducts: ZodContractsOrProducts
23
+ productMeta: ZodBasketProductMeta
24
+ productsMeta: ZodBasketProductsMeta
25
+ }
@@ -0,0 +1,45 @@
1
+ import { AxiosRequestConfig } from "axios"
2
+ import {
3
+ Campaign,
4
+ CampaignOrderRequestBody,
5
+ TaxonomyEducationAndSeniorityLevel,
6
+ } from "./types"
7
+ import { ProductSupportingContractsComplete } from "../product/types"
8
+ import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
9
+ import { PaginatedAPIResponseV2 } from "../common/types"
10
+ import { ModuleWithConstructorArgs } from "../types"
11
+
12
+ export type WindowHapiAPICampaignConfigs = {
13
+ getCampaigns: AxiosRequestConfig
14
+ getCampaign: AxiosRequestConfig
15
+ getCampaignDetail: AxiosRequestConfig
16
+ setCampaignCancellation: AxiosRequestConfig
17
+ getEducationLevels: AxiosRequestConfig
18
+ getSeniorities: AxiosRequestConfig
19
+ orderCampaign: AxiosRequestConfig
20
+ }
21
+ export type WindowHapiAPICampaignRequests = {
22
+ getCampaigns: (
23
+ offset?: number,
24
+ limit?: number,
25
+ ) => Promise<PaginatedAPIResponseV2<Campaign>>
26
+ getCampaign: (campaignId: string) => Promise<Campaign>
27
+ getCampaignDetail: (
28
+ campaignId: string,
29
+ detail: "status",
30
+ ) => Promise<ProductSupportingContractsComplete>
31
+ setCampaignCancellation: (
32
+ campaignId: string,
33
+ body: Partial<Campaign>,
34
+ ) => Promise<ProductSupportingContractsComplete>
35
+ getEducationLevels: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
36
+ getSeniorities: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
37
+ orderCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
38
+ }
39
+ export type WindowHapiAPICampaign = ModuleWithConstructorArgs<
40
+ WindowHapiAPIModule<
41
+ WindowHapiAPICampaignRequests,
42
+ WindowHapiAPICampaignConfigs
43
+ >,
44
+ { readonly api: WindowHapiAPI }
45
+ >
@@ -0,0 +1 @@
1
+ export const CAMPAIGN_CREATE_FORM_LOCALSTORAGE_KEY = "createCampaignForm"
@@ -0,0 +1,17 @@
1
+ export enum EmploymentType {
2
+ permanent = "permanent",
3
+ temporary = "temporary",
4
+ fixed_term = "fixed_term",
5
+ fixed_term_with_option_for_permanent = "fixed_term_with_option_for_permanent",
6
+ freelance = "freelance",
7
+ traineeship = "traineeship",
8
+ internship = "internship",
9
+ }
10
+
11
+ export enum SalaryPeriod {
12
+ DAILY = "daily",
13
+ MONTHLY = "monthly",
14
+ HOURLY = "hourly",
15
+ WEEKLY = "weekly",
16
+ YEARLY = "yearly",
17
+ }
@@ -0,0 +1,90 @@
1
+ /* Campaign */
2
+
3
+ import {
4
+ Campaign,
5
+ CampaignCreateForm,
6
+ TaxonomyEducationAndSeniorityLevel,
7
+ TaxonomySeniority,
8
+ } from "./types"
9
+ import { PaginationResponseV2, RecursivePartial } from "../common/types"
10
+
11
+ export type CampaignStoreSetCampaignsHandler = (campaigns: Campaign[]) => void
12
+ export type CampaignStoreSetCampaignsPaginationMetaHandler = (
13
+ meta: PaginationResponseV2 | null,
14
+ ) => void
15
+ export type CampaignStoreSetCampaignsAreLoadingHandler = (
16
+ isLoading: boolean,
17
+ ) => void
18
+ export type CampaignStoreSetCampaignHandler = (
19
+ campaignId: string,
20
+ campaign: Partial<Campaign>,
21
+ ) => void
22
+ export type CampaignStoreSetCampaignFormHandler = (
23
+ campaign: RecursivePartial<CampaignCreateForm>,
24
+ replaceAsIs?: boolean,
25
+ ) => void
26
+ export type CampaignStoreSetCampaignIsCreatingHandler = (
27
+ isCreating: boolean,
28
+ ) => void
29
+
30
+ /* Education Levels */
31
+ export type CampaignStoreSetEducationLevelsHandler = (
32
+ educationLevels: TaxonomyEducationAndSeniorityLevel[],
33
+ ) => void
34
+ export type CampaignStoreSetEducationLevelsAreLoadingHandler = (
35
+ isLoading: boolean,
36
+ ) => void
37
+
38
+ /* Seniorities */
39
+ export type CampaignStoreSetSenioritiesHandler = (
40
+ seniorities: TaxonomySeniority[],
41
+ ) => void
42
+ export type CampaignStoreSetSenioritiesAreLoadingHandler = (
43
+ isLoading: boolean,
44
+ ) => void
45
+
46
+ export type CampaignStoreFunctions = {
47
+ /* Campaign */
48
+ /**
49
+ * The function that sets the value of `campaigns`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
50
+ */
51
+ setCampaigns: CampaignStoreSetCampaignsHandler
52
+ /**
53
+ * The function that sets the value of `campaignsPaginationMeta`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
54
+ */
55
+ setCampaignsPaginationMeta: CampaignStoreSetCampaignsPaginationMetaHandler
56
+ /**
57
+ * The function that sets the value of `campaignsAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
58
+ */
59
+ setCampaignsAreLoading: CampaignStoreSetCampaignsAreLoadingHandler
60
+ /**
61
+ * The function that updates properties of a Campaign in the array of `campaigns` by given Campaign ID. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
62
+ */
63
+ setCampaign: CampaignStoreSetCampaignHandler
64
+ /**
65
+ * The function that updates properties of `campaignForm`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
66
+ */
67
+ setCampaignForm: CampaignStoreSetCampaignFormHandler
68
+ /**
69
+ * The function that sets the value of `campaignIsCreating`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
70
+ */
71
+ setCampaignIsCreating: CampaignStoreSetCampaignIsCreatingHandler
72
+ /* Education Levels */
73
+ /**
74
+ * The function that sets the value of `educationLevels`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
75
+ */
76
+ setEducationLevels: CampaignStoreSetEducationLevelsHandler
77
+ /**
78
+ * The function that sets the value of `educationLevelsAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
79
+ */
80
+ setEducationLevelsAreLoading: CampaignStoreSetEducationLevelsAreLoadingHandler
81
+ /* Seniorities */
82
+ /**
83
+ * The function that sets the value of `seniorities`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
84
+ */
85
+ setSeniorities: CampaignStoreSetSenioritiesHandler
86
+ /**
87
+ * The function that sets the value of `senioritiesAreLoading`. Refer to [CampaignStoreState](/docs/sdk/campaigns/#campaignstorestate) for more details.
88
+ */
89
+ setSenoritiesAreLoading: CampaignStoreSetSenioritiesAreLoadingHandler
90
+ }
@@ -0,0 +1,15 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from './api.types';
4
+ export * from './consts';
5
+ export * from './enums';
6
+ export * from './functions.types';
7
+ export * from './qa.types';
8
+ export * from './service.types';
9
+ export * from './state.initial';
10
+ export * from './state.types';
11
+ export * from './state.validations';
12
+ export * from './types';
13
+ export * from './utils';
14
+ export * from './utils.types';
15
+ export * from './validations.types';
@@ -0,0 +1,12 @@
1
+ import { MockCampaignCreateForm } from "../consts"
2
+ import { ModuleWithConstructorArgs } from "../types"
3
+ import { WindowHapiQA } from "../_window/qa.types"
4
+
5
+ export type WindowHapiQACampaign = ModuleWithConstructorArgs<
6
+ {
7
+ useMockCampaignForm: () => MockCampaignCreateForm
8
+ getRandomCampaignId: () => Promise<string>
9
+ setCampaignFormDebuggerIsShown: (isEnabled: boolean) => boolean
10
+ },
11
+ { readonly qa: WindowHapiQA }
12
+ >
@@ -0,0 +1,48 @@
1
+ import {
2
+ HapiServiceFunctionWithLifecycleHooks,
3
+ WindowHapiService,
4
+ } from "../_window/service.types"
5
+ import { ProductSupportingContractsComplete } from "../product/types"
6
+ import { Campaign, TaxonomyEducationAndSeniorityLevel } from "./types"
7
+ import { PaginatedAPIResponseV2 } from "../common/types"
8
+ import { ModuleWithConstructorArgs } from "../types"
9
+
10
+ export type CampaignServiceGetCampaignsHandler = (
11
+ offset?: number,
12
+ limit?: number,
13
+ ) => Promise<PaginatedAPIResponseV2<Campaign>>
14
+ export type CampaignServiceGetCampaignDetailHandler = (
15
+ campaignId: string,
16
+ detail: "status",
17
+ ) => Promise<ProductSupportingContractsComplete>
18
+ export type CampaignServiceGetCampaignHandler = (
19
+ campaignId: string,
20
+ ) => Promise<ProductSupportingContractsComplete>
21
+ export type CampaignServiceSetCampaignCancellationHandler = (
22
+ campaignId: string,
23
+ body: Partial<Campaign>,
24
+ ) => Promise<ProductSupportingContractsComplete>
25
+ export type CampaignServiceGetEducationLevelsHandler = () => Promise<
26
+ TaxonomyEducationAndSeniorityLevel[]
27
+ >
28
+ export type CampaignServiceGetSenioritiesHandler = () => Promise<
29
+ TaxonomyEducationAndSeniorityLevel[]
30
+ >
31
+ export type CampaignServiceOrderCampaignHandler = () => Promise<Campaign>
32
+ export type CampaignServiceCopyCampaignHandler = (
33
+ campaign: Campaign,
34
+ ) => Promise<Campaign>
35
+
36
+ export type WindowHapiServiceCampaign = ModuleWithConstructorArgs<
37
+ {
38
+ getCampaigns: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignsHandler>
39
+ getCampaignDetail: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignDetailHandler>
40
+ getCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignHandler>
41
+ setCampaignCancellation: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSetCampaignCancellationHandler>
42
+ getEducationLevels: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetEducationLevelsHandler>
43
+ getSeniorities: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetSenioritiesHandler>
44
+ orderCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceOrderCampaignHandler>
45
+ copyCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceCopyCampaignHandler>
46
+ },
47
+ { readonly service: WindowHapiService }
48
+ >
@@ -0,0 +1,84 @@
1
+ import { EmploymentType, SalaryPeriod } from "./enums"
2
+ import { CampaignStoreState } from "./state.types"
3
+
4
+ export const initialCampaignStoreState: CampaignStoreState = {
5
+ campaigns: [],
6
+ campaignsPaginationMeta: {
7
+ limit: 20,
8
+ offset: 0,
9
+ },
10
+ campaignsAreLoading: false,
11
+ campaignForm: {
12
+ recruiterInfo: {
13
+ name: "",
14
+ emailAddress: "",
15
+ },
16
+ postingDetails: {
17
+ title: "",
18
+ description: "",
19
+ organization: {
20
+ name: "",
21
+ companyLogo: "",
22
+ },
23
+ contactInfo: {
24
+ name: "",
25
+ emailAddress: "",
26
+ phoneNumber: "",
27
+ },
28
+ workingLocation: {
29
+ addressLine1: "",
30
+ addressLine2: "",
31
+ postcode: "",
32
+ city: "",
33
+ country: "",
34
+ allowsRemoteWork: 0,
35
+ },
36
+ yearsOfExperience: 0,
37
+ employmentType: EmploymentType.permanent,
38
+ weeklyWorkingHours: {
39
+ from: 0,
40
+ to: 0,
41
+ },
42
+ salaryIndication: {
43
+ period: SalaryPeriod.MONTHLY,
44
+ range: {
45
+ from: 0,
46
+ to: 0,
47
+ currency: "",
48
+ },
49
+ },
50
+ jobPageUrl: "",
51
+ applicationUrl: "",
52
+ },
53
+ targetGroup: {
54
+ educationLevel: [],
55
+ seniority: [],
56
+ industry: [],
57
+ jobCategory: [],
58
+ },
59
+ orderedProducts: [],
60
+ orderedProductsSpecs: {},
61
+ campaignName: "",
62
+ companyId: "",
63
+ },
64
+ campaignIsCreating: false,
65
+ /* Education Levels */
66
+ educationLevels: [],
67
+ educationLevelsAreLoading: false,
68
+ /* Seniorities */
69
+ seniorities: [],
70
+ senioritiesAreLoading: false,
71
+ /* Employment Types */
72
+ employmentTypes: [
73
+ { value: EmploymentType.permanent, label: "Permanent" },
74
+ { value: EmploymentType.temporary, label: "Temporary" },
75
+ { value: EmploymentType.fixed_term, label: "Fixed term" },
76
+ {
77
+ value: EmploymentType.fixed_term_with_option_for_permanent,
78
+ label: "Fixed term with option for permanent",
79
+ },
80
+ { value: EmploymentType.freelance, label: "Freelance" },
81
+ { value: EmploymentType.traineeship, label: "Traineeship" },
82
+ { value: EmploymentType.internship, label: "Internship" },
83
+ ],
84
+ }
@@ -0,0 +1,55 @@
1
+ import {
2
+ Campaign,
3
+ CampaignCreateForm,
4
+ TaxonomyEducationAndSeniorityLevel,
5
+ TaxonomyEmploymentTypes,
6
+ TaxonomySeniority,
7
+ } from "./types"
8
+ import { PaginationResponseV2 } from "../common/types"
9
+
10
+ export type CampaignStoreState = {
11
+ /* Campaign */
12
+ /**
13
+ * Array of Campaign Objects for listing in Campaigns Landing and Campaigns List (both Card and Accordion Table Layout) widgets
14
+ */
15
+ campaigns: Campaign[]
16
+ /**
17
+ * An object that holds information like next URL, previous URL and count for pagination purposes
18
+ */
19
+ campaignsPaginationMeta: PaginationResponseV2
20
+ /**
21
+ * Used to show a loading spinner in Campaign widgets that show list of campaigns
22
+ */
23
+ campaignsAreLoading: boolean
24
+ /**
25
+ * Object used to create (order) a campaign
26
+ */
27
+ campaignForm: CampaignCreateForm
28
+ /**
29
+ * Shows a loading spinner and disables the buttons in Campaign Create Form while creating a Campaign
30
+ */
31
+ campaignIsCreating: boolean
32
+ /* Education Levels */
33
+ /**
34
+ * Array of Education Levels that end user will select via a Select HTML element
35
+ */
36
+ educationLevels: TaxonomyEducationAndSeniorityLevel[]
37
+ /**
38
+ * Used to show a loading spinner and also disable the Select HTML element while values for Education Levels is loading
39
+ */
40
+ educationLevelsAreLoading: boolean
41
+ /* Seniorities */
42
+ /**
43
+ * Array of Seniorities that end user will select via a Select HTML element
44
+ */
45
+ seniorities: TaxonomySeniority[]
46
+ /**
47
+ * Used to show a loading spinner and also disable the Select HTML element while values for Seniorities is loading
48
+ */
49
+ senioritiesAreLoading: boolean
50
+ /* Employment Types */
51
+ /**
52
+ * Array of Employment Types that end user will select via a Select HTML element
53
+ */
54
+ employmentTypes: TaxonomyEmploymentTypes[]
55
+ }
@@ -0,0 +1,16 @@
1
+ import { CampaignStoreState } from "./state.types"
2
+ import { StateValidations } from "../_window/state.types"
3
+
4
+ export const campaignStoreStateValidations: StateValidations<CampaignStoreState> =
5
+ {
6
+ campaigns: "campaign.campaigns",
7
+ campaignsPaginationMeta: "common.paginationMetaV2",
8
+ campaignsAreLoading: "common.genericBoolean",
9
+ campaignIsCreating: "common.genericBoolean",
10
+ campaignForm: "campaign.campaignForm",
11
+ educationLevels: "campaign.educationLevels",
12
+ educationLevelsAreLoading: "common.genericBoolean",
13
+ seniorities: "campaign.seniorities",
14
+ senioritiesAreLoading: "common.genericBoolean",
15
+ employmentTypes: "campaign.employmentTypes",
16
+ }