@vonq/hapi-elements-types 1.17.0 → 1.19.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 (74) hide show
  1. package/_window/api.types.ts +14 -1
  2. package/_window/auth.types.ts +2 -2
  3. package/_window/routing.types.ts +1 -0
  4. package/_window/service.types.ts +13 -0
  5. package/_window/state.types.ts +38 -13
  6. package/_window/utils.types.ts +17 -2
  7. package/_window/window.ts +36 -3
  8. package/alert/enums.ts +2 -1
  9. package/alert/types.ts +5 -3
  10. package/ats/state.types.ts +5 -2
  11. package/ats/types.ts +13 -7
  12. package/basket/state.types.ts +5 -2
  13. package/basket/utils.types.ts +7 -0
  14. package/basket/validations.types.ts +7 -0
  15. package/campaign/api.types.ts +11 -0
  16. package/campaign/service.types.ts +33 -2
  17. package/campaign/state.types.ts +2 -1
  18. package/campaign/types.ts +87 -18
  19. package/campaign/utils.types.ts +21 -0
  20. package/campaign/validations.types.ts +1 -1
  21. package/common/enums.ts +4 -0
  22. package/common/events/EventCommand/enums.ts +2 -2
  23. package/common/types.ts +100 -0
  24. package/common/validator/types.ts +1 -0
  25. package/contract/service.types.ts +5 -7
  26. package/contract/types.ts +2 -76
  27. package/contract/validations.types.ts +6 -0
  28. package/language/qa.types.ts +1 -4
  29. package/language/state.types.ts +0 -16
  30. package/language/validations.types.ts +0 -4
  31. package/modal/enums.ts +5 -1
  32. package/modal/service.types.ts +0 -1
  33. package/modal/types.ts +32 -4
  34. package/modal/utils.types.ts +10 -0
  35. package/orderJourney/enums.ts +2 -0
  36. package/orderJourney/qa.types.ts +0 -3
  37. package/orderJourney/service.types.ts +20 -0
  38. package/orderJourney/state.types.ts +11 -1
  39. package/orderJourney/types.ts +37 -0
  40. package/orderJourney/validations.types.ts +3 -0
  41. package/package.json +1 -1
  42. package/product/api.types.ts +20 -1
  43. package/product/enums.ts +8 -0
  44. package/product/service.types.ts +23 -1
  45. package/product/state.types.ts +6 -0
  46. package/product/types.ts +23 -16
  47. package/product/utils.types.ts +3 -0
  48. package/product/validations.types.ts +3 -2
  49. package/routing/utils.types.ts +14 -0
  50. package/talentMindCompany/api.types.ts +18 -0
  51. package/talentMindCompany/service.types.ts +15 -0
  52. package/talentMindCompany/state.types.ts +5 -0
  53. package/talentMindCompany/types.ts +6 -0
  54. package/talentMindCompany/validations.types.ts +5 -0
  55. package/talentMindEvaluation/api.types.ts +25 -0
  56. package/talentMindEvaluation/service.types.ts +25 -0
  57. package/talentMindEvaluation/state.types.ts +6 -0
  58. package/talentMindEvaluation/types.ts +15 -0
  59. package/talentMindEvaluation/validations.types.ts +5 -0
  60. package/talentMindJob/api.types.ts +26 -0
  61. package/talentMindJob/service.types.ts +28 -0
  62. package/talentMindJob/state.types.ts +6 -0
  63. package/talentMindJob/types.ts +12 -0
  64. package/talentMindJob/validations.types.ts +5 -0
  65. package/talentMindResume/api.types.ts +30 -0
  66. package/talentMindResume/service.types.ts +34 -0
  67. package/talentMindResume/state.types.ts +6 -0
  68. package/talentMindResume/types.ts +119 -0
  69. package/talentMindResume/validations.types.ts +5 -0
  70. package/theming/types.ts +1 -0
  71. package/wallet/service.types.ts +6 -1
  72. package/wallet/state.types.ts +3 -1
  73. package/wallet/types.ts +7 -2
  74. package/wallet/validations.types.ts +15 -3
@@ -11,11 +11,15 @@ import { WindowHapiAPIContract } from "../contract/api.types"
11
11
  import { WindowHapiAPIProduct } from "../product/api.types"
12
12
  import { WindowHapiAPIWallet } from "../wallet/api.types"
13
13
  import {
14
- WindowHapiModuleWithConstructorArgs,
15
14
  WindowHapiClassInterface,
15
+ WindowHapiModuleWithConstructorArgs,
16
16
  } from "./window"
17
17
  import { WindowHapiLogger } from "../common/logger/types"
18
18
  import { ATSUserTokenResponse } from "../ats"
19
+ import { WindowHapiAPITalentMindCompany } from "../talentMindCompany/api.types"
20
+ import { WindowHapiAPITalentMindResume } from "../talentMindResume/api.types"
21
+ import { WindowHapiAPITalentMindJob } from "../talentMindJob/api.types"
22
+ import { WindowHapiAPITalentMindEvaluation } from "../talentMindEvaluation/api.types"
19
23
 
20
24
  export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
21
25
  logger: WindowHapiLogger
@@ -59,6 +63,7 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
59
63
  refreshJWTToken: WindowHapiAPIRefreshJWTTokenHandler
60
64
  validateJWTToken: WindowHapiAPIValidateJWTTokenHandler
61
65
  baseURL: string
66
+ talentMindBaseUrl: string
62
67
  setBaseURL: (url: string) => void
63
68
  setBaseConfig: (params: Record<string, Record<string, string>>) => void
64
69
  baseTimeout: number
@@ -77,12 +82,20 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
77
82
  [WindowHapiModuleName.product]: WindowHapiAPIProduct
78
83
  [WindowHapiModuleName.campaign]: WindowHapiAPICampaign
79
84
  [WindowHapiModuleName.ats]: WindowHapiAPIATS
85
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiAPITalentMindCompany
86
+ [WindowHapiModuleName.talentMindJob]: WindowHapiAPITalentMindJob
87
+ [WindowHapiModuleName.talentMindResume]: WindowHapiAPITalentMindResume
88
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiAPITalentMindEvaluation
80
89
  modules: {
81
90
  [WindowHapiModuleName.contract]: WindowHapiAPIContract
82
91
  [WindowHapiModuleName.wallet]: WindowHapiAPIWallet
83
92
  [WindowHapiModuleName.product]: WindowHapiAPIProduct
84
93
  [WindowHapiModuleName.campaign]: WindowHapiAPICampaign
85
94
  [WindowHapiModuleName.ats]: WindowHapiAPIATS
95
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiAPITalentMindCompany
96
+ [WindowHapiModuleName.talentMindJob]: WindowHapiAPITalentMindJob
97
+ [WindowHapiModuleName.talentMindResume]: WindowHapiAPITalentMindResume
98
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiAPITalentMindEvaluation
86
99
  }
87
100
  },
88
101
  { readonly core: WindowHapiClassInterface }
@@ -2,13 +2,13 @@ import {
2
2
  WindowHapiModuleWithConstructorArgs,
3
3
  WindowHapiClassInterface,
4
4
  } from "./window"
5
+ import { ProductPriceCurrency } from "../product"
5
6
 
6
7
  export type WindowHapiAuth = WindowHapiModuleWithConstructorArgs<
7
8
  {
8
- partnerId: string | undefined
9
- clientId: string | undefined
10
9
  partnerToken: string | undefined // used for impersonation
11
10
  clientToken: string | undefined
11
+ walletCurrency: ProductPriceCurrency | undefined
12
12
  },
13
13
  { readonly core: WindowHapiClassInterface }
14
14
  >
@@ -18,6 +18,7 @@ export type WindowHapiRouting = WindowHapiModuleWithConstructorArgs<
18
18
  setOrigin: (origin: string) => void
19
19
  setQueryParams: (params: WindowHapiRoutingQueryParams) => void
20
20
  onRouteChange: () => void
21
+ onAfterSetQueryParams: () => void
21
22
  },
22
23
  { readonly core: WindowHapiClassInterface }
23
24
  >
@@ -14,6 +14,10 @@ import {
14
14
  } from "./window"
15
15
  import { WindowHapiLogger } from "../common/logger/types"
16
16
  import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
17
+ import { WindowHapiServiceTalentMindCompany } from "../talentMindCompany/service.types"
18
+ import { WindowHapiServiceTalentMindJob } from "../talentMindJob/service.types"
19
+ import { WindowHapiServiceTalentMindResume } from "../talentMindResume/service.types"
20
+ import { WindowHapiServiceTalentMindEvaluation } from "../talentMindEvaluation/service.types"
17
21
 
18
22
  export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
19
23
  | void
@@ -36,6 +40,7 @@ export type HapiServiceBase = {
36
40
  __serviceName: WindowHapiModuleName
37
41
  logger: WindowHapiLogger
38
42
  init: () => void
43
+ initListeners: () => void
39
44
  propertiesThatShouldNotBeDocumented: string[]
40
45
  }
41
46
  export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
@@ -50,6 +55,10 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
50
55
  [WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
51
56
  [WindowHapiModuleName.ui]: WindowHapiServiceUI
52
57
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
58
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiServiceTalentMindCompany
59
+ [WindowHapiModuleName.talentMindJob]: WindowHapiServiceTalentMindJob
60
+ [WindowHapiModuleName.talentMindResume]: WindowHapiServiceTalentMindResume
61
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiServiceTalentMindEvaluation
53
62
  services: {
54
63
  [WindowHapiModuleName.alert]: WindowHapiServiceAlert
55
64
  [WindowHapiModuleName.basket]: WindowHapiServiceBasket
@@ -61,6 +70,10 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
61
70
  [WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
62
71
  [WindowHapiModuleName.ui]: WindowHapiServiceUI
63
72
  [WindowHapiModuleName.ats]: WindowHapiServiceATS
73
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiServiceTalentMindCompany
74
+ [WindowHapiModuleName.talentMindJob]: WindowHapiServiceTalentMindJob
75
+ [WindowHapiModuleName.talentMindResume]: WindowHapiServiceTalentMindResume
76
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiServiceTalentMindEvaluation
64
77
  }
65
78
 
66
79
  decorateFunctionWithLifecycleEvents: <HandlerType extends Function>(
@@ -13,8 +13,8 @@ import { WindowHapiEventCommandCallbackHandler } from "../common/events/types"
13
13
  import { WindowHapiModuleName } from "../common/enums"
14
14
  import { ATSState } from "../ats/state.types"
15
15
  import {
16
- WindowHapiModuleWithConstructorArgs,
17
16
  WindowHapiClassInterface,
17
+ WindowHapiModuleWithConstructorArgs,
18
18
  } from "./window"
19
19
  import { WindowHapiValidationsCommon } from "../common/validations.types"
20
20
  import { WindowHapiValidationsBasket } from "../basket/validations.types"
@@ -26,6 +26,14 @@ import { WindowHapiValidationsTheming } from "../theming/validations.types"
26
26
  import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.types"
27
27
  import { WindowHapiValidationsWallet } from "../wallet/validations.types"
28
28
  import { WindowHapiValidations } from "./validation.types"
29
+ import { TalentMindCompanyState } from "../talentMindCompany/state.types"
30
+ import { TalentMindJobState } from "../talentMindJob/state.types"
31
+ import { TalentMindResumeState } from "../talentMindResume/state.types"
32
+ import { TalentMindEvaluationState } from "../talentMindEvaluation/state.types"
33
+ import { WindowHapiValidationsTalentMindResume } from "../talentMindResume/validations.types"
34
+ import { WindowHapiValidationsTalentMindJob } from "../talentMindJob/validations.types"
35
+ import { WindowHapiValidationsTalentMindCompany } from "../talentMindCompany/validations.types"
36
+ import { WindowHapiValidationsTalentMindEvaluation } from "../talentMindEvaluation/validations.types"
29
37
 
30
38
  export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
31
39
  {
@@ -41,23 +49,32 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
41
49
  [WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
42
50
  [WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
43
51
  [WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
52
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiStateModule<TalentMindCompanyState>
53
+ [WindowHapiModuleName.talentMindJob]: WindowHapiStateModule<TalentMindJobState>
54
+ [WindowHapiModuleName.talentMindResume]: WindowHapiStateModule<TalentMindResumeState>
55
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiStateModule<TalentMindEvaluationState>
44
56
  basePropertiesThatShouldNotBeDocumented: string[]
45
57
  handleDefaultStateFromQueryParams: (params: string | string[]) => void
58
+ rehydrateInitialState: (initialState: Record<string, any>) => void
46
59
  onBeforeStateChange: () => void
47
60
  onAfterStateChange: () => void
48
61
  stores: {
49
- alert: WindowHapiStateModule<AlertState>
50
- basket: WindowHapiStateModule<BasketState>
51
- campaign: WindowHapiStateModule<CampaignState>
52
- contract: WindowHapiStateModule<ContractState>
53
- debugging: WindowHapiStateModule<DebuggingState>
54
- language: WindowHapiStateModule<LanguageState>
55
- product: WindowHapiStateModule<ProductState>
56
- theming: WindowHapiStateModule<ThemingState>
57
- orderJourney: WindowHapiStateModule<OrderJourneyState>
58
- wallet: WindowHapiStateModule<WalletState>
59
- modal: WindowHapiStateModule<ModalState>
60
- ats: WindowHapiStateModule<ATSState>
62
+ [WindowHapiModuleName.alert]: WindowHapiStateModule<AlertState>
63
+ [WindowHapiModuleName.basket]: WindowHapiStateModule<BasketState>
64
+ [WindowHapiModuleName.campaign]: WindowHapiStateModule<CampaignState>
65
+ [WindowHapiModuleName.contract]: WindowHapiStateModule<ContractState>
66
+ [WindowHapiModuleName.debugging]: WindowHapiStateModule<DebuggingState>
67
+ [WindowHapiModuleName.language]: WindowHapiStateModule<LanguageState>
68
+ [WindowHapiModuleName.product]: WindowHapiStateModule<ProductState>
69
+ [WindowHapiModuleName.theming]: WindowHapiStateModule<ThemingState>
70
+ [WindowHapiModuleName.orderJourney]: WindowHapiStateModule<OrderJourneyState>
71
+ [WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
72
+ [WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
73
+ [WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
74
+ [WindowHapiModuleName.talentMindCompany]: WindowHapiStateModule<TalentMindCompanyState>
75
+ [WindowHapiModuleName.talentMindJob]: WindowHapiStateModule<TalentMindJobState>
76
+ [WindowHapiModuleName.talentMindResume]: WindowHapiStateModule<TalentMindResumeState>
77
+ [WindowHapiModuleName.talentMindEvaluation]: WindowHapiStateModule<TalentMindEvaluationState>
61
78
  }
62
79
  toJSON: Record<string, any>
63
80
  },
@@ -77,6 +94,10 @@ export type WindowHapiStatesJSON = {
77
94
  [WindowHapiModuleName.wallet]: WalletState
78
95
  [WindowHapiModuleName.modal]: ModalState
79
96
  [WindowHapiModuleName.ats]: ATSState
97
+ [WindowHapiModuleName.talentMindCompany]: TalentMindCompanyState
98
+ [WindowHapiModuleName.talentMindJob]: TalentMindJobState
99
+ [WindowHapiModuleName.talentMindResume]: TalentMindResumeState
100
+ [WindowHapiModuleName.talentMindEvaluation]: TalentMindEvaluationState
80
101
  }
81
102
 
82
103
  export type WindowHapiStateBase<T> = {
@@ -110,6 +131,10 @@ export type StateValidationKey =
110
131
  | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsTheming}`
111
132
  | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsOrderJourney}`
112
133
  | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsWallet}`
134
+ | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsTalentMindResume}`
135
+ | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsTalentMindJob}`
136
+ | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsTalentMindCompany}`
137
+ | `${keyof WindowHapiValidations}.${keyof WindowHapiValidationsTalentMindEvaluation}`
113
138
 
114
139
  export type StateValidations<State> = {
115
140
  [P in keyof State]: StateValidationKey | undefined
@@ -5,10 +5,11 @@ import { WindowHapiUtilsCampaign } from "../campaign/utils.types"
5
5
  import { WindowHapiUtilsBasket } from "../basket/utils.types"
6
6
  import { WindowHapiUtilsOrderJourney } from "../orderJourney/utils.types"
7
7
  import {
8
- WindowHapiModuleWithConstructorArgs,
9
8
  WindowHapiClassInterface,
9
+ WindowHapiModuleWithConstructorArgs,
10
10
  } from "./window"
11
- import { RecursivePartial } from "../common"
11
+ import { WindowHapiUtilsModal } from "../modal/utils.types"
12
+ import { WindowHapiUtilsRouter } from "../routing/utils.types"
12
13
 
13
14
  export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
14
15
  {
@@ -22,6 +23,16 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
22
23
  parentLabel?: any,
23
24
  canSelectParentCategoriesThatHasOptions?: boolean,
24
25
  ) => { label: string; value: any }[]
26
+ pushAfter: (
27
+ array: any[],
28
+ findPredicate: (item: any, index: number) => boolean,
29
+ itemsToPush: any[],
30
+ ) => any[]
31
+ pushBefore: (
32
+ array: any[],
33
+ findPredicate: (item: any, index: number) => boolean,
34
+ itemsToPush: any[],
35
+ ) => any[]
25
36
  getComponentNameIndexSuffix: (instanceName: string) => string
26
37
  getIframeLoadingSpinner: () => HTMLDivElement
27
38
  product: WindowHapiUtilsProduct
@@ -29,6 +40,8 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
29
40
  campaign: WindowHapiUtilsCampaign
30
41
  basket: WindowHapiUtilsBasket
31
42
  orderJourney: WindowHapiUtilsOrderJourney
43
+ modal: WindowHapiUtilsModal
44
+ router: WindowHapiUtilsRouter
32
45
 
33
46
  utilities: {
34
47
  [WindowHapiModuleName.basket]: WindowHapiUtilsBasket
@@ -36,6 +49,8 @@ export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
36
49
  [WindowHapiModuleName.contract]: WindowHapiUtilsContract
37
50
  [WindowHapiModuleName.product]: WindowHapiUtilsProduct
38
51
  [WindowHapiModuleName.orderJourney]: WindowHapiUtilsOrderJourney
52
+ [WindowHapiModuleName.modal]: WindowHapiUtilsModal
53
+ [WindowHapiModuleName.router]: WindowHapiUtilsRouter
39
54
  }
40
55
  },
41
56
  { readonly core: WindowHapiClassInterface }
package/_window/window.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  WindowHapiSubmoduleName,
18
18
  } from "../common"
19
19
  import { DebugPanelPosition } from "./config.types"
20
+ import { ProductPriceCurrency } from "../product/enums"
20
21
 
21
22
  export type WindowHapiModuleWithConstructorArgs<Module, ConstructorArgs> =
22
23
  Module & ConstructorArgs
@@ -81,20 +82,37 @@ export type WindowHapiQASubmodule = WindowHapiModuleWithConstructorArgs<
81
82
  { readonly core: WindowHapiClassInterface }
82
83
  >
83
84
 
85
+ export type WindowHapiInjectorConfig = {
86
+ apiHost: string
87
+ partnerToken: string //used for impersonation purposes
88
+ clientToken: string
89
+ appOrigin: string
90
+ docsOrigin: string
91
+ enableLogs: boolean
92
+ enableRemoteLogs: boolean
93
+ useJWTAuthHeaders: boolean
94
+ addModal: boolean
95
+ addAlertBar: boolean
96
+ addDebugPanel: boolean
97
+ debugPanelPosition: DebugPanelPosition
98
+ testMode: boolean
99
+ debugMode: boolean
100
+ walletCurrency: ProductPriceCurrency
101
+ }
102
+
84
103
  export type WindowHapiConfigSubmodule = {
104
+ talentMindApiHost: string
85
105
  apiHost: string
86
106
  initialState: RecursivePartial<any>
87
- partnerId: string
88
107
  partnerToken: string
89
- clientId: string
90
108
  clientToken: string
91
109
  loadingSpinnerDefaultFillColor: string
92
110
  appOrigin: string
93
111
  docsOrigin: string
94
112
  enableLogs: boolean
113
+ enableRemoteLogs: boolean
95
114
  webComponents: HapiWebComponent[]
96
115
  isInvalidToken: boolean
97
- isAllowedToUseDevelopmentEnvironment: boolean
98
116
  useJWTAuthHeaders: boolean
99
117
  addModal: boolean
100
118
  addAlertBar: boolean
@@ -106,6 +124,8 @@ export type WindowHapiConfigSubmodule = {
106
124
  testMode: boolean
107
125
  debugMode: boolean
108
126
  htmlTemplates: Record<string, string>
127
+ walletCurrency: ProductPriceCurrency
128
+ isUsingGETMethod: boolean
109
129
  }
110
130
 
111
131
  export type WindowHapiClassInterface = {
@@ -124,7 +144,9 @@ export type WindowHapiClassInterface = {
124
144
  instance: WindowHapiInstance
125
145
  qa: WindowHapiQASubmodule
126
146
  isProduction: boolean
147
+ isReady: boolean
127
148
  enableLogs: boolean
149
+ enableRemoteLogs: boolean
128
150
  }
129
151
 
130
152
  export type WindowHapi = {
@@ -143,3 +165,14 @@ export type WindowHapi = {
143
165
  [WindowHapiSubmoduleName.events]: WindowHapiEventsSubmodule
144
166
  [WindowHapiSubmoduleName.instance]: WindowHapiInstance
145
167
  }
168
+
169
+ export type WindowHapiInjector = {
170
+ hapiInjector: {
171
+ setConfig<K extends keyof WindowHapiInjectorConfig>(
172
+ key: K,
173
+ value: WindowHapiInjectorConfig[K],
174
+ ): WindowHapiInjectorConfig
175
+ inject: () => Promise<void>
176
+ }
177
+ hapiInjectorConfig: WindowHapiInjectorConfig
178
+ }
package/alert/enums.ts CHANGED
@@ -5,9 +5,10 @@ export enum AlertKey {
5
5
  contractCreateSuccess = "contract-created",
6
6
  contractGroupCreateSuccess = "contract-group-created",
7
7
  campaignTakeOfflineSuccess = "campaign-take-offline-success",
8
- "campaignCopyContractWarning" = "campaign-copy-contract-warning",
8
+ "campaignCopyProductsContractsDeletedWarning" = "campaign-copy-contract-warning",
9
9
  campaignOrderSuccess = "campaign-order-success",
10
10
  campaignCopySuccess = "campaign-copy-success",
11
+ campaignSaveSuccess = "campaign-save-success",
11
12
  buttonCopySuccess = "copy-button-success",
12
13
  productAddToBasket = "add-product-to-basket-success",
13
14
  productRemoveFromBasket = "remove-product-from-basket-warning",
package/alert/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ToastOptions } from "react-toastify/dist/types"
2
2
  import { AlertKey } from "./enums"
3
3
  import { AnyNonFunction } from "../common/types"
4
+ import { ProductPriceCurrency } from "../product/enums"
4
5
 
5
6
  export type AlertOptions = ToastOptions & {
6
7
  shouldShowDismiss?: boolean
@@ -23,7 +24,8 @@ export type BackendErrorMessageAlertProps = {
23
24
  }
24
25
 
25
26
  export type WalletTopUpSuccessAlertProps = {
26
- amountInDollars: number
27
+ amount: number
28
+ currency: ProductPriceCurrency
27
29
  }
28
30
 
29
31
  export type UTMCodesSuccessAlertProps = {
@@ -36,7 +38,7 @@ export type CampaignOrderSuccessAlertProps = {}
36
38
 
37
39
  export type CampaignCopySuccessAlertProps = {}
38
40
 
39
- export type DiscardedContractsDuringCampaignCopyAlertProps = {}
41
+ export type CampaignCopyProductsContractsDeletedWarningAlertProps = {}
40
42
 
41
43
  export type CampaignTakeOfflineSuccessAlertProps = {}
42
44
 
@@ -46,7 +48,7 @@ export type ProductRemoveFromBasketWarningAlertProps = {}
46
48
 
47
49
  export type AlertProps = AnyNonFunction<
48
50
  | ContractCreateSuccessAlertProps
49
- | DiscardedContractsDuringCampaignCopyAlertProps
51
+ | CampaignCopyProductsContractsDeletedWarningAlertProps
50
52
  | ContractRemoveSuccessAlertProps
51
53
  | ContractGroupCreateSuccessAlertProps
52
54
  | BackendErrorMessageAlertProps
@@ -1,7 +1,10 @@
1
- import { ATSSettings, ATSUserPaymentSetting, ATSUserData } from "./types"
1
+ import { ATSSettings, ATSUserData, ATSUserPaymentSetting } from "./types"
2
+ import { ProductPriceCurrency } from "../product"
2
3
 
3
4
  export type ATSState = {
4
5
  userSettings: ATSSettings | null
5
6
  userData: ATSUserData | null
6
- displayCurrencyPaymentSettings: ATSUserPaymentSetting | null
7
+ supportedCurrencies: ProductPriceCurrency[]
8
+ walletCurrencyPaymentSettings: ATSUserPaymentSetting | null
9
+ maxPurchaseOrderAmount: number | null
7
10
  }
package/ats/types.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { WalletPaymentIntentPaymentMethod } from "../wallet/types"
2
+ import { ProductPriceCurrency } from "../product/enums"
2
3
 
3
4
  export type ATSUserPaymentSetting = {
4
- currency: string
5
+ currency: ProductPriceCurrency
5
6
  max_outstanding_balance: string
6
7
  max_purchase_order: string
7
8
  min_topup: string
@@ -15,6 +16,7 @@ export type ATSUserSettings = {
15
16
  ats_managed_payment: boolean
16
17
  can_pay_with_purchase_order: boolean
17
18
  can_use_wallets: boolean
19
+ can_pay_with_direct_charge: boolean
18
20
  invoice_currency: string | null
19
21
  }
20
22
  export type ATSSettings = {
@@ -23,14 +25,18 @@ export type ATSSettings = {
23
25
  }
24
26
 
25
27
  export type ATSUserData = {
26
- customer_id: string;
27
- id: string;
28
+ customer_id: string
29
+ id: string
28
30
  ats: {
29
- id: string;
30
- hapi_partner_id: string;
31
- name: string;
31
+ id: string
32
+ hapi_partner_id: string
33
+ name: string
32
34
  }
33
- };
35
+ settings: {
36
+ ats_user_jwt_expiration: number
37
+ ats_user_jwt_allow_renewal: boolean
38
+ }
39
+ }
34
40
 
35
41
  export type ATSUserTokenResponse = {
36
42
  token: string
@@ -1,4 +1,4 @@
1
- import { Product } from "../product/types"
1
+ import { Product, ProductOrderDeliveryTime } from "../product/types"
2
2
  import { BasketProduct } from "./types"
3
3
  import { Contract } from "../contract/types"
4
4
 
@@ -9,6 +9,9 @@ export type BasketState = {
9
9
  totalInUSD: number
10
10
  totalInGBP: number
11
11
  totalInAUD: number
12
- totalInDisplayCurrency: number
12
+ totalInWalletCurrency: number
13
+ totalExceedsMaxPurchaseOrder: boolean
13
14
  productsAreLoading: boolean
15
+ deliveryAndProcessingTimes: ProductOrderDeliveryTime | null
16
+ deliveryAndProcessingTimesAreLoading: boolean
14
17
  }
@@ -39,6 +39,13 @@ export type WindowHapiUtilsBasket = WindowHapiModuleWithConstructorArgs<
39
39
  basketProducts: (Contract | Product)[],
40
40
  ) => (Product | Contract)[]
41
41
  getBasketProductMetaFromCampaignForm: (form: Campaign) => any[]
42
+ getProductsTotal: (
43
+ products: (Product | Contract)[],
44
+ currency: ProductPriceCurrency,
45
+ ) => number
46
+ prepareCampaignFormOrderedProducts: (
47
+ productOrContractIds: (Product | Contract)[],
48
+ ) => void
42
49
  },
43
50
  { readonly utils: WindowHapiUtils }
44
51
  >
@@ -18,8 +18,15 @@ export type ZodBasketProductMeta = ZodObject<{
18
18
  }>
19
19
  export type ZodBasketProductsMeta = ZodArray<ZodBasketProductMeta>
20
20
 
21
+ export type ZodBasketDeliveryAndProcessingTimes = ZodObject<{
22
+ days_to_process: ZodNumber
23
+ days_to_setup: ZodNumber
24
+ total_days: ZodNumber
25
+ }>
26
+
21
27
  export type WindowHapiValidationsBasket = {
22
28
  contractsOrProducts: ZodContractsOrProducts
23
29
  productMeta: ZodBasketProductMeta
24
30
  productsMeta: ZodBasketProductsMeta
31
+ deliveryAndProcessingTimes: ZodBasketDeliveryAndProcessingTimes
25
32
  }
@@ -1,7 +1,9 @@
1
1
  import { AxiosRequestConfig } from "axios"
2
2
  import {
3
3
  Campaign,
4
+ CampaignEditRequestBody,
4
5
  CampaignOrderRequestBody,
6
+ CampaignPostingRequirementsValidateRequestBody,
5
7
  TaxonomyEducationAndSeniorityLevel,
6
8
  } from "./types"
7
9
  import { ProductSupportingContractsComplete } from "../product/types"
@@ -17,11 +19,15 @@ export type WindowHapiAPICampaignConfigs = {
17
19
  getEducationLevels: AxiosRequestConfig
18
20
  getSeniorities: AxiosRequestConfig
19
21
  orderCampaign: AxiosRequestConfig
22
+ validateCampaign: AxiosRequestConfig
23
+ validateCampaignPostingRequirements: AxiosRequestConfig
24
+ saveCampaign: AxiosRequestConfig
20
25
  }
21
26
  export type WindowHapiAPICampaignRequests = {
22
27
  getCampaigns: (
23
28
  offset?: number,
24
29
  limit?: number,
30
+ labels?: Record<string, string> | null,
25
31
  ) => Promise<PaginatedAPIResponseV2<Campaign>>
26
32
  getCampaign: (campaignId: string) => Promise<Campaign>
27
33
  getCampaignDetail: (
@@ -35,6 +41,11 @@ export type WindowHapiAPICampaignRequests = {
35
41
  getEducationLevels: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
36
42
  getSeniorities: () => Promise<TaxonomyEducationAndSeniorityLevel[]>
37
43
  orderCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
44
+ saveCampaign: (postBody: CampaignEditRequestBody) => Promise<Campaign>
45
+ validateCampaign: (postBody: CampaignOrderRequestBody) => Promise<Campaign>
46
+ validateCampaignPostingRequirements: (
47
+ campaign: CampaignPostingRequirementsValidateRequestBody,
48
+ ) => Promise<Campaign>
38
49
  }
39
50
  export type WindowHapiAPICampaign = WindowHapiModuleWithConstructorArgs<
40
51
  WindowHapiAPIModule<
@@ -3,13 +3,21 @@ import {
3
3
  WindowHapiService,
4
4
  } from "../_window/service.types"
5
5
  import { ProductSupportingContractsComplete } from "../product/types"
6
- import { Campaign, TaxonomyEducationAndSeniorityLevel } from "./types"
6
+ import {
7
+ Campaign,
8
+ CampaignCreateForm,
9
+ CampaignEditForm,
10
+ CampaignOrderRequestBody,
11
+ TaxonomyEducationAndSeniorityLevel,
12
+ } from "./types"
7
13
  import { PaginatedAPIResponseV2 } from "../common/types"
8
14
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
15
+ import { AlertKey } from "../alert"
9
16
 
10
17
  export type CampaignServiceGetCampaignsHandler = (
11
18
  offset?: number,
12
19
  limit?: number,
20
+ labels?: Record<string, string> | null,
13
21
  ) => Promise<PaginatedAPIResponseV2<Campaign>>
14
22
  export type CampaignServiceGetCampaignDetailHandler = (
15
23
  campaignId: string,
@@ -33,7 +41,23 @@ export type CampaignServiceCopyCampaignHandler = (
33
41
  campaign: Campaign,
34
42
  withExistingProducts: boolean,
35
43
  ) => Promise<Campaign>
36
-
44
+ export type CampaignServiceEditCampaignHandler = (
45
+ campaign: Campaign,
46
+ ) => Promise<Campaign>
47
+ export type CampaignServiceSaveCampaignHandler = (
48
+ campaign: CampaignEditForm,
49
+ ) => Promise<Campaign>
50
+ export type CampaignServiceValidateContractPostingRequirementsWithCampaignHandler =
51
+ (contractId: string, requestBody: CampaignOrderRequestBody) => Promise<any>
52
+ export type CampaignServiceValidateCampaignHandler = (
53
+ requestBody: CampaignOrderRequestBody,
54
+ ) => Promise<any>
55
+ export type CampaignServiceGetCopyCampaignRequestBodyHandler = (
56
+ campaign: Campaign,
57
+ ) => CampaignCreateForm
58
+ export type CampaignServiceGetEditCampaignRequestBodyHandler = (
59
+ campaign: Campaign,
60
+ ) => CampaignCreateForm
37
61
  export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
38
62
  {
39
63
  getCampaigns: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCampaignsHandler>
@@ -44,6 +68,13 @@ export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
44
68
  getSeniorities: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetSenioritiesHandler>
45
69
  orderCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceOrderCampaignHandler>
46
70
  copyCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceCopyCampaignHandler>
71
+ editCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceEditCampaignHandler>
72
+ onAfterOrderCampaignSuccess: (alertKey: AlertKey) => void
73
+ validateContractPostingRequirementsWithCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateContractPostingRequirementsWithCampaignHandler>
74
+ saveCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceSaveCampaignHandler>
75
+ validateCampaign: HapiServiceFunctionWithLifecycleHooks<CampaignServiceValidateCampaignHandler>
76
+ getCopyCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetCopyCampaignRequestBodyHandler>
77
+ getEditCampaignRequestBody: HapiServiceFunctionWithLifecycleHooks<CampaignServiceGetEditCampaignRequestBodyHandler>
47
78
  },
48
79
  { readonly service: WindowHapiService }
49
80
  >
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Campaign,
3
3
  CampaignCreateForm,
4
+ CampaignEditForm,
4
5
  TaxonomyEducationAndSeniorityLevel,
5
6
  TaxonomyEmploymentTypes,
6
7
  TaxonomySeniority,
@@ -12,7 +13,7 @@ export type CampaignState = {
12
13
  campaigns: Campaign[]
13
14
  campaignsPaginationMeta: PaginationResponseV2
14
15
  campaignsAreLoading: boolean
15
- campaignForm: CampaignCreateForm
16
+ campaignForm: CampaignCreateForm | CampaignEditForm
16
17
  campaignIsCreating: boolean
17
18
  /* Education Levels */
18
19
  educationLevels: TaxonomyEducationAndSeniorityLevel[]