@vonq/hapi-elements-types 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_window/api.types.ts +28 -0
- package/_window/auth.types.ts +1 -0
- package/_window/events.types.ts +15 -14
- package/_window/instances.types.ts +2 -0
- package/_window/sdk.types.ts +3 -1
- package/_window/service.types.ts +4 -0
- package/_window/state.types.ts +15 -8
- package/_window/utils.types.ts +5 -4
- package/_window/window.ts +5 -0
- package/alert/enums.ts +1 -0
- package/alert/types.ts +3 -0
- package/ats/api.types.ts +12 -1
- package/ats/service.types.ts +8 -1
- package/ats/state.types.ts +2 -1
- package/ats/types.ts +22 -0
- package/basket/service.types.ts +10 -4
- package/basket/state.types.ts +0 -24
- package/basket/utils.types.ts +38 -0
- package/campaign/service.types.ts +1 -0
- package/campaign/state.types.ts +0 -30
- package/campaign/types.ts +14 -8
- package/campaign/utils.types.ts +1 -3
- package/campaign/validations.types.ts +16 -7
- package/common/enums.ts +2 -0
- package/common/events/EventCommand/enums.ts +6 -4
- package/common/events/EventCommand/types.ts +2 -0
- package/common/events/types.ts +4 -1
- package/common/qa.types.ts +2 -0
- package/common/validations.types.ts +2 -0
- package/contract/state.types.ts +0 -45
- package/contract/types.ts +3 -1
- package/contract/utils.types.ts +2 -1
- package/debugging/state.types.ts +1 -12
- package/modal/enums.ts +4 -0
- package/modal/types.ts +24 -0
- package/orderJourney/enums.ts +2 -2
- package/orderJourney/service.types.ts +16 -0
- package/orderJourney/state.types.ts +11 -6
- package/orderJourney/types.ts +45 -12
- package/orderJourney/utils.types.ts +10 -0
- package/orderJourney/validations.types.ts +23 -2
- package/package.json +1 -1
- package/product/state.types.ts +2 -57
- package/product/types.ts +13 -8
- package/product/validations.types.ts +2 -1
- package/theming/types.ts +6 -0
- package/ui/service.types.ts +6 -4
- package/wallet/state.types.ts +0 -36
package/_window/api.types.ts
CHANGED
@@ -15,6 +15,7 @@ import {
|
|
15
15
|
WindowHapiClassInterface,
|
16
16
|
} from "./window"
|
17
17
|
import { WindowHapiLogger } from "../common/logger/types"
|
18
|
+
import { ATSUserTokenResponse } from "../ats"
|
18
19
|
|
19
20
|
export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
20
21
|
logger: WindowHapiLogger
|
@@ -29,12 +30,34 @@ export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
|
29
30
|
export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
|
30
31
|
headers?: any
|
31
32
|
}
|
33
|
+
|
34
|
+
export type WindowHapiAPIOnChangeJWTTokenHandler = (
|
35
|
+
newToken: string,
|
36
|
+
oldToken?: string,
|
37
|
+
) => string
|
38
|
+
|
39
|
+
export type WindowHapiAPIRefreshJWTTokenHandler = () => Promise<
|
40
|
+
ATSUserTokenResponse | undefined
|
41
|
+
>
|
42
|
+
|
43
|
+
export type WindowHapiAPIValidateJWTTokenHandler = () => Promise<boolean>
|
44
|
+
|
32
45
|
export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
33
46
|
{
|
34
47
|
/* Common */
|
35
48
|
request: <T = any, R = AxiosResponse<T>, D = any>(
|
36
49
|
config: Partial<HapiRequestConfig<D>>,
|
37
50
|
) => Promise<R>
|
51
|
+
jwtHeaderKey: string
|
52
|
+
jwtRefreshIntervalInSeconds: number
|
53
|
+
setJWTRefreshIntervalInSeconds: (seconds: number) => void
|
54
|
+
jwtRefreshInterval: number | undefined
|
55
|
+
jwtTokenRefreshCallback:
|
56
|
+
| WindowHapiAPIOnChangeJWTTokenHandler
|
57
|
+
| undefined
|
58
|
+
onJWTTokenRefresh: (token: string) => void
|
59
|
+
refreshJWTToken: WindowHapiAPIRefreshJWTTokenHandler
|
60
|
+
validateJWTToken: WindowHapiAPIValidateJWTTokenHandler
|
38
61
|
baseURL: string
|
39
62
|
setBaseURL: (url: string) => void
|
40
63
|
setBaseConfig: (params: Record<string, Record<string, string>>) => void
|
@@ -44,6 +67,11 @@ export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
|
44
67
|
headers: RawAxiosRequestHeaders
|
45
68
|
setHeaders: (headers: RawAxiosRequestHeaders) => void
|
46
69
|
baseRequestConfig: RawAxiosRequestConfig<any>
|
70
|
+
makeDataRequest: (
|
71
|
+
method: "get" | "put" | "patch",
|
72
|
+
endpoint: string,
|
73
|
+
data?: any,
|
74
|
+
) => Promise<any>
|
47
75
|
[WindowHapiModuleName.contract]: WindowHapiAPIContract
|
48
76
|
[WindowHapiModuleName.wallet]: WindowHapiAPIWallet
|
49
77
|
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
package/_window/auth.types.ts
CHANGED
@@ -7,6 +7,7 @@ export type WindowHapiAuth = WindowHapiModuleWithConstructorArgs<
|
|
7
7
|
{
|
8
8
|
partnerId: string | undefined
|
9
9
|
clientId: string | undefined
|
10
|
+
partnerToken: string | undefined // used for impersonation
|
10
11
|
clientToken: string | undefined
|
11
12
|
},
|
12
13
|
{ readonly core: WindowHapiClassInterface }
|
package/_window/events.types.ts
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
import {
|
2
|
+
WindowHapiEventCommandData,
|
2
3
|
WindowHapiEventCommandNames,
|
3
4
|
WindowHapiEventCommandStatus,
|
4
|
-
WindowHapiEventCommandData,
|
5
5
|
} from "../common/events/EventCommand/types"
|
6
6
|
import {
|
7
|
+
WindowHapiEventCommand,
|
7
8
|
WindowHapiEventCommandCallbackHandler,
|
9
|
+
WindowHapiEventListener,
|
8
10
|
WindowHapiEventMediatorGetInstancesHandler,
|
9
11
|
WindowHapiEventMediatorInstances,
|
10
|
-
WindowHapiEventCommand,
|
11
12
|
WindowHapiEventStrategy,
|
12
|
-
WindowHapiEventListener,
|
13
13
|
} from "../common/events/types"
|
14
14
|
import {
|
15
|
-
WindowHapiModuleWithConstructorArgs,
|
16
15
|
WindowHapiClassInterface,
|
16
|
+
WindowHapiModuleWithConstructorArgs,
|
17
17
|
} from "./window"
|
18
18
|
import { WindowHapiSubmoduleName } from "../common/enums"
|
19
19
|
import { WindowHapiInstance } from "./instances.types"
|
@@ -30,6 +30,9 @@ export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
|
|
30
30
|
value: WindowHapiEventCommandData,
|
31
31
|
instances: WindowHapiEventMediatorInstances,
|
32
32
|
id?: string,
|
33
|
+
status?: WindowHapiEventCommandStatus,
|
34
|
+
createdAt?: string,
|
35
|
+
updatedAt?: string,
|
33
36
|
) => WindowHapiEventCommand
|
34
37
|
create: (
|
35
38
|
name: WindowHapiEventCommandNames,
|
@@ -37,6 +40,8 @@ export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
|
|
37
40
|
getInstances: WindowHapiEventMediatorGetInstancesHandler,
|
38
41
|
id?: string,
|
39
42
|
status?: WindowHapiEventCommandStatus,
|
43
|
+
createdAt?: string,
|
44
|
+
updatedAt?: string,
|
40
45
|
) => WindowHapiEventCommand
|
41
46
|
},
|
42
47
|
{ readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
|
@@ -47,6 +52,7 @@ export type WindowHapiEventMediatorCreateAndDispatchHandler = (
|
|
47
52
|
data?: WindowHapiEventCommandData,
|
48
53
|
id?: string,
|
49
54
|
status?: WindowHapiEventCommandStatus,
|
55
|
+
getInstances?: WindowHapiEventMediatorGetInstancesHandler,
|
50
56
|
) => Promise<WindowHapiEventCommand | undefined>
|
51
57
|
|
52
58
|
export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
|
@@ -117,7 +123,9 @@ export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
|
|
117
123
|
) => void
|
118
124
|
remove: (id: string) => void
|
119
125
|
removeByName: (name: string) => void
|
120
|
-
getEventsByName: (
|
126
|
+
getEventsByName: (
|
127
|
+
name: string,
|
128
|
+
) => (WindowHapiEventCommand | WindowHapiEventListener)[]
|
121
129
|
},
|
122
130
|
{ readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
|
123
131
|
>
|
@@ -127,15 +135,6 @@ export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
|
127
135
|
hasAddedWindowMessageEvent: boolean
|
128
136
|
addInternalEventListeners: () => void
|
129
137
|
removeInternalEventListeners: () => void
|
130
|
-
createSDKEventListener: (
|
131
|
-
property: string,
|
132
|
-
callback: (data: any) => void,
|
133
|
-
) => void
|
134
|
-
sdkEventListenerCallback: (
|
135
|
-
data: WindowHapiEventCommandData,
|
136
|
-
_property: string,
|
137
|
-
callback: (data: WindowHapiEventCommandData) => void,
|
138
|
-
) => void
|
139
138
|
eventFactory: WindowHapiEventFactory
|
140
139
|
eventMediator: WindowHapiEventMediator
|
141
140
|
eventStorage: WindowHapiEventStorage
|
@@ -145,6 +144,8 @@ export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
|
145
144
|
eventStateStrategy: WindowHapiEventStrategy
|
146
145
|
eventServiceStrategy: WindowHapiEventStrategy
|
147
146
|
eventQAStrategy: WindowHapiEventStrategy
|
147
|
+
eventDOMStrategy: WindowHapiEventStrategy
|
148
|
+
eventConfigStrategy: WindowHapiEventStrategy
|
148
149
|
getInstances: () => {
|
149
150
|
source: WindowHapiInstance
|
150
151
|
targets: WindowHapiInstance[]
|
@@ -7,6 +7,7 @@ import { WindowHapiLogger } from "../common/logger/types"
|
|
7
7
|
export type WindowHapiInstances = WindowHapiModuleWithConstructorArgs<
|
8
8
|
{
|
9
9
|
instances: WindowHapiInstance[]
|
10
|
+
readyInstances: string[]
|
10
11
|
getFrameWindowByName: (name: string) => Window | undefined
|
11
12
|
hasInstance: (instanceName: string) => boolean
|
12
13
|
getInstanceByName: (
|
@@ -17,6 +18,7 @@ export type WindowHapiInstances = WindowHapiModuleWithConstructorArgs<
|
|
17
18
|
removeInstance: (instanceName: string) => void
|
18
19
|
onAfterAddInstance: (instance: WindowHapiInstance) => void
|
19
20
|
onAfterRemoveInstance: (instance: WindowHapiInstance) => void
|
21
|
+
setInstanceReadyByName: (instanceName: string, isReady: boolean) => void
|
20
22
|
},
|
21
23
|
{ readonly core: WindowHapiClassInterface }
|
22
24
|
>
|
package/_window/sdk.types.ts
CHANGED
@@ -41,6 +41,7 @@ import {
|
|
41
41
|
} from "./window"
|
42
42
|
import { WindowHapiServiceUI } from "../ui/service.types"
|
43
43
|
import { ATSState, WindowHapiAPIATS, WindowHapiServiceATS } from "../ats"
|
44
|
+
import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
|
44
45
|
|
45
46
|
export type WindowHapiSDKModule<
|
46
47
|
APIModule,
|
@@ -97,7 +98,7 @@ export type WindowHapiSDKLanguage = WindowHapiSDKModule<
|
|
97
98
|
>
|
98
99
|
export type WindowHapiSDKOrderJourney = WindowHapiSDKModule<
|
99
100
|
undefined,
|
100
|
-
|
101
|
+
WindowHapiServiceOrderJourney,
|
101
102
|
WindowHapiValidationsOrderJourney,
|
102
103
|
WindowHapiStateModule<OrderJourneyState>,
|
103
104
|
WindowHapiUtilsOrderJourney
|
@@ -147,6 +148,7 @@ export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
|
|
147
148
|
[WindowHapiModuleName.language]: WindowHapiSDKLanguage
|
148
149
|
[WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
|
149
150
|
[WindowHapiModuleName.alert]: WindowHapiSDKAlert
|
151
|
+
[WindowHapiModuleName.ui]: WindowHapiSDKUI
|
150
152
|
},
|
151
153
|
{ readonly core: WindowHapiClassInterface }
|
152
154
|
>
|
package/_window/service.types.ts
CHANGED
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
WindowHapiModuleWithConstructorArgs,
|
14
14
|
} from "./window"
|
15
15
|
import { WindowHapiLogger } from "../common/logger/types"
|
16
|
+
import { WindowHapiServiceOrderJourney } from "../orderJourney/service.types"
|
16
17
|
|
17
18
|
export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
|
18
19
|
| void
|
@@ -35,6 +36,7 @@ export type HapiServiceBase = {
|
|
35
36
|
__serviceName: WindowHapiModuleName
|
36
37
|
logger: WindowHapiLogger
|
37
38
|
init: () => void
|
39
|
+
propertiesThatShouldNotBeDocumented: string[]
|
38
40
|
}
|
39
41
|
export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
40
42
|
{
|
@@ -45,6 +47,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
45
47
|
[WindowHapiModuleName.product]: WindowHapiServiceProduct
|
46
48
|
[WindowHapiModuleName.wallet]: WindowHapiServiceWallet
|
47
49
|
[WindowHapiModuleName.modal]: WindowHapiServiceModal
|
50
|
+
[WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
|
48
51
|
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
49
52
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
50
53
|
services: {
|
@@ -55,6 +58,7 @@ export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
|
55
58
|
[WindowHapiModuleName.product]: WindowHapiServiceProduct
|
56
59
|
[WindowHapiModuleName.wallet]: WindowHapiServiceWallet
|
57
60
|
[WindowHapiModuleName.modal]: WindowHapiServiceModal
|
61
|
+
[WindowHapiModuleName.orderJourney]: WindowHapiServiceOrderJourney
|
58
62
|
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
59
63
|
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
60
64
|
}
|
package/_window/state.types.ts
CHANGED
@@ -41,11 +41,10 @@ export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
|
|
41
41
|
[WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
|
42
42
|
[WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
|
43
43
|
[WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
|
44
|
-
|
45
|
-
name: string,
|
46
|
-
) => WindowHapiStateModule<any> | undefined
|
44
|
+
basePropertiesThatShouldNotBeDocumented: string[]
|
47
45
|
handleDefaultStateFromQueryParams: (params: string | string[]) => void
|
48
|
-
|
46
|
+
onBeforeStateChange: () => void
|
47
|
+
onAfterStateChange: () => void
|
49
48
|
stores: {
|
50
49
|
alert: WindowHapiStateModule<AlertState>
|
51
50
|
basket: WindowHapiStateModule<BasketState>
|
@@ -80,18 +79,20 @@ export type WindowHapiStatesJSON = {
|
|
80
79
|
[WindowHapiModuleName.ats]: ATSState
|
81
80
|
}
|
82
81
|
|
83
|
-
export type WindowHapiStateBase = {
|
82
|
+
export type WindowHapiStateBase<T> = {
|
84
83
|
propertiesThatShouldNotBeDocumented: string[]
|
85
|
-
|
84
|
+
__elementsStateModuleName: string
|
86
85
|
toJSON: any
|
86
|
+
addClassPropertiesObserver: () => void
|
87
|
+
validations: StateValidations<T>
|
87
88
|
}
|
88
89
|
|
89
90
|
export type HapiStateValueWithListener<T> = {
|
90
|
-
|
91
|
+
onChange: (callback: WindowHapiEventCommandCallbackHandler) => void
|
91
92
|
value: T
|
92
93
|
}
|
93
94
|
|
94
|
-
export type WindowHapiStateModule<T> = WindowHapiStateBase & {
|
95
|
+
export type WindowHapiStateModule<T> = WindowHapiStateBase<T> & {
|
95
96
|
[P in keyof T]:
|
96
97
|
| T[P]
|
97
98
|
| HapiStateValueWithListener<T[P]>
|
@@ -113,3 +114,9 @@ export type StateValidationKey =
|
|
113
114
|
export type StateValidations<State> = {
|
114
115
|
[P in keyof State]: StateValidationKey | undefined
|
115
116
|
}
|
117
|
+
|
118
|
+
export type WindowHapiStateModuleState<T> = {
|
119
|
+
[K in keyof T]: T[K]
|
120
|
+
} & {
|
121
|
+
state?: WindowHapiState
|
122
|
+
}
|
package/_window/utils.types.ts
CHANGED
@@ -8,14 +8,15 @@ import {
|
|
8
8
|
WindowHapiModuleWithConstructorArgs,
|
9
9
|
WindowHapiClassInterface,
|
10
10
|
} from "./window"
|
11
|
+
import { RecursivePartial } from "../common"
|
11
12
|
|
12
13
|
export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
13
14
|
{
|
14
15
|
isObject: (item: any) => boolean
|
15
|
-
mergeDeepOverwriteArrays: (
|
16
|
-
original:
|
17
|
-
overwrites:
|
18
|
-
) =>
|
16
|
+
mergeDeepOverwriteArrays: <T>(
|
17
|
+
original: T,
|
18
|
+
overwrites: RecursivePartial<T>,
|
19
|
+
) => T
|
19
20
|
getComponentNameIndexSuffix: (instanceName: string) => string
|
20
21
|
getIframeLoadingSpinner: () => HTMLDivElement
|
21
22
|
product: WindowHapiUtilsProduct
|
package/_window/window.ts
CHANGED
@@ -85,13 +85,16 @@ export type WindowHapiConfigSubmodule = {
|
|
85
85
|
apiHost: string
|
86
86
|
initialState: RecursivePartial<any>
|
87
87
|
partnerId: string
|
88
|
+
partnerToken: string
|
88
89
|
clientId: string
|
89
90
|
clientToken: string
|
90
91
|
loadingSpinnerDefaultFillColor: string
|
91
92
|
appOrigin: string
|
93
|
+
docsOrigin: string
|
92
94
|
enableLogs: boolean
|
93
95
|
webComponents: HapiWebComponent[]
|
94
96
|
isInvalidToken: boolean
|
97
|
+
isAllowedToUseDevelopmentEnvironment: boolean
|
95
98
|
useJWTAuthHeaders: boolean
|
96
99
|
addModal: boolean
|
97
100
|
addAlertBar: boolean
|
@@ -120,6 +123,8 @@ export type WindowHapiClassInterface = {
|
|
120
123
|
service: WindowHapiServiceSubmodule
|
121
124
|
instance: WindowHapiInstance
|
122
125
|
qa: WindowHapiQASubmodule
|
126
|
+
isProduction: boolean
|
127
|
+
enableLogs: boolean
|
123
128
|
}
|
124
129
|
|
125
130
|
export type WindowHapi = {
|
package/alert/enums.ts
CHANGED
@@ -5,6 +5,7 @@ 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
9
|
campaignOrderSuccess = "campaign-order-success",
|
9
10
|
campaignCopySuccess = "campaign-copy-success",
|
10
11
|
buttonCopySuccess = "copy-button-success",
|
package/alert/types.ts
CHANGED
@@ -36,6 +36,8 @@ export type CampaignOrderSuccessAlertProps = {}
|
|
36
36
|
|
37
37
|
export type CampaignCopySuccessAlertProps = {}
|
38
38
|
|
39
|
+
export type DiscardedContractsDuringCampaignCopyAlertProps = {}
|
40
|
+
|
39
41
|
export type CampaignTakeOfflineSuccessAlertProps = {}
|
40
42
|
|
41
43
|
export type ProductAddToBasketSuccessAlertProps = {}
|
@@ -44,6 +46,7 @@ export type ProductRemoveFromBasketWarningAlertProps = {}
|
|
44
46
|
|
45
47
|
export type AlertProps = AnyNonFunction<
|
46
48
|
| ContractCreateSuccessAlertProps
|
49
|
+
| DiscardedContractsDuringCampaignCopyAlertProps
|
47
50
|
| ContractRemoveSuccessAlertProps
|
48
51
|
| ContractGroupCreateSuccessAlertProps
|
49
52
|
| BackendErrorMessageAlertProps
|
package/ats/api.types.ts
CHANGED
@@ -1,14 +1,25 @@
|
|
1
1
|
import { AxiosRequestConfig } from "axios/index"
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
ATSDataResponse,
|
4
|
+
ATSMessage,
|
5
|
+
ATSSettings,
|
6
|
+
ATSUserTokenResponse,
|
7
|
+
} from "./types"
|
3
8
|
import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
|
4
9
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
5
10
|
|
6
11
|
export type WindowHapiAPIATSConfigs = {
|
7
12
|
getUserSettings: AxiosRequestConfig<any>
|
13
|
+
refreshJWTToken: AxiosRequestConfig<any>
|
14
|
+
validateJWTToken: AxiosRequestConfig<any>
|
8
15
|
}
|
9
16
|
|
10
17
|
export type WindowHapiAPIATSRequests = {
|
11
18
|
getUserSettings: () => Promise<ATSSettings>
|
19
|
+
refreshJWTToken: () => Promise<ATSUserTokenResponse>
|
20
|
+
validateJWTToken: () => Promise<boolean>
|
21
|
+
getMessages: () => Promise<ATSMessage[]>
|
22
|
+
sendMessage: (ticket: ATSMessage) => Promise<ATSMessage[]>
|
12
23
|
}
|
13
24
|
export type WindowHapiAPIATS = WindowHapiModuleWithConstructorArgs<
|
14
25
|
WindowHapiAPIModule<WindowHapiAPIATSRequests, WindowHapiAPIATSConfigs>,
|
package/ats/service.types.ts
CHANGED
@@ -2,16 +2,23 @@ import {
|
|
2
2
|
HapiServiceFunctionWithLifecycleHooks,
|
3
3
|
WindowHapiService,
|
4
4
|
} from "../_window/service.types"
|
5
|
-
import { ATSSettings } from "./types"
|
5
|
+
import { ATSMessage, ATSSettings } from "./types"
|
6
6
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
7
7
|
|
8
8
|
export type ATSServiceGetUserSettingsHandler = () => Promise<
|
9
9
|
ATSSettings | undefined
|
10
10
|
>
|
11
|
+
export type ATSServiceGetMessagesHandler = () => Promise<ATSMessage[]>
|
12
|
+
|
13
|
+
export type ATSServiceSendMessageHandler = (
|
14
|
+
message: ATSMessage,
|
15
|
+
) => Promise<ATSMessage[]>
|
11
16
|
|
12
17
|
export type WindowHapiServiceATS = WindowHapiModuleWithConstructorArgs<
|
13
18
|
{
|
14
19
|
getUserSettings: HapiServiceFunctionWithLifecycleHooks<ATSServiceGetUserSettingsHandler>
|
20
|
+
getMessages: HapiServiceFunctionWithLifecycleHooks<ATSServiceGetMessagesHandler>
|
21
|
+
sendMessage: HapiServiceFunctionWithLifecycleHooks<ATSServiceSendMessageHandler>
|
15
22
|
},
|
16
23
|
{ readonly service: WindowHapiService }
|
17
24
|
>
|
package/ats/state.types.ts
CHANGED
package/ats/types.ts
CHANGED
@@ -5,6 +5,10 @@ export type ATSUserPaymentSetting = {
|
|
5
5
|
max_outstanding_balance: string
|
6
6
|
max_purchase_order: string
|
7
7
|
min_topup: string
|
8
|
+
gateway: {
|
9
|
+
provider: "stripe"
|
10
|
+
publishable_key: string
|
11
|
+
}
|
8
12
|
payment_method_types: WalletPaymentIntentPaymentMethod[] | null
|
9
13
|
}
|
10
14
|
export type ATSUserSettings = {
|
@@ -17,3 +21,21 @@ export type ATSSettings = {
|
|
17
21
|
payment_settings: ATSUserPaymentSetting[]
|
18
22
|
settings: ATSUserSettings
|
19
23
|
}
|
24
|
+
|
25
|
+
export type ATSUserTokenResponse = {
|
26
|
+
token: string
|
27
|
+
}
|
28
|
+
|
29
|
+
export type ATSMessage = {
|
30
|
+
id?: string
|
31
|
+
sender: "ats" | "vonq"
|
32
|
+
createdAt?: string
|
33
|
+
message: string
|
34
|
+
}
|
35
|
+
|
36
|
+
export type ATSDataResponse = {
|
37
|
+
data: {
|
38
|
+
messages: ATSMessage[]
|
39
|
+
}
|
40
|
+
type: "elements"
|
41
|
+
}
|
package/basket/service.types.ts
CHANGED
@@ -7,9 +7,9 @@ import {
|
|
7
7
|
} from "../_window/service.types"
|
8
8
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
9
9
|
|
10
|
-
export type BasketServiceGetProductsHandler = (
|
11
|
-
|
12
|
-
>
|
10
|
+
export type BasketServiceGetProductsHandler = (
|
11
|
+
products?: BasketProduct[],
|
12
|
+
) => Promise<(Product | Contract)[]>
|
13
13
|
export type BasketServiceAddProductOrContractByIdHandler = (
|
14
14
|
contractOrProductId: string,
|
15
15
|
isProduct: boolean,
|
@@ -17,15 +17,21 @@ export type BasketServiceAddProductOrContractByIdHandler = (
|
|
17
17
|
export type BasketServiceRemoveProductOrContractByIdHandler = (
|
18
18
|
contractOrProductId: string,
|
19
19
|
) => void
|
20
|
+
export type BasketServiceRemoveContractsWithConflictingGroupsHandler = (
|
21
|
+
contractThatUserTriedToAdd: Contract,
|
22
|
+
) => void
|
23
|
+
export type BasketServiceKeepContractsWithConflictingGroupsHandler = () => void
|
20
24
|
|
21
25
|
export type WindowHapiServiceBasket = WindowHapiModuleWithConstructorArgs<
|
22
26
|
{
|
23
|
-
|
27
|
+
onAfterGetBasketData: (
|
24
28
|
basketItemData: (Contract | Product)[],
|
25
29
|
) => BasketProduct[]
|
26
30
|
getProducts: HapiServiceFunctionWithLifecycleHooks<BasketServiceGetProductsHandler>
|
27
31
|
addProductOrContractById: HapiServiceFunctionWithLifecycleHooks<BasketServiceAddProductOrContractByIdHandler>
|
28
32
|
removeProductOrContractById: HapiServiceFunctionWithLifecycleHooks<BasketServiceRemoveProductOrContractByIdHandler>
|
33
|
+
removeContractsWithConflictingGroups: HapiServiceFunctionWithLifecycleHooks<BasketServiceRemoveContractsWithConflictingGroupsHandler>
|
34
|
+
keepContractsWithConflictingGroups: HapiServiceFunctionWithLifecycleHooks<BasketServiceKeepContractsWithConflictingGroupsHandler>
|
29
35
|
clear: () => BasketProduct[]
|
30
36
|
},
|
31
37
|
{ readonly service: WindowHapiService }
|
package/basket/state.types.ts
CHANGED
@@ -3,36 +3,12 @@ import { BasketProduct } from "./types"
|
|
3
3
|
import { Contract } from "../contract/types"
|
4
4
|
|
5
5
|
export type BasketState = {
|
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
6
|
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
7
|
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
8
|
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
9
|
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
10
|
totalInGBP: number
|
26
|
-
/**
|
27
|
-
* Sum of prices of Products and/or Contracts in AUD currency. **This value is a computed getter meaning that it cannot be set from outside**
|
28
|
-
*/
|
29
11
|
totalInAUD: number
|
30
|
-
/**
|
31
|
-
* 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**
|
32
|
-
*/
|
33
12
|
totalInDisplayCurrency: number
|
34
|
-
/**
|
35
|
-
* Shows a spinner in Basket when the data for Products and/or Contracts is being fetched from the API
|
36
|
-
*/
|
37
13
|
productsAreLoading: boolean
|
38
14
|
}
|
package/basket/utils.types.ts
CHANGED
@@ -1,10 +1,48 @@
|
|
1
1
|
import { BasketProduct } from "./types"
|
2
2
|
import { WindowHapiUtils } from "../_window/utils.types"
|
3
3
|
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
4
|
+
import {
|
5
|
+
Product,
|
6
|
+
ProductBoardType,
|
7
|
+
ProductPrice,
|
8
|
+
ProductPriceCurrency,
|
9
|
+
} from "../product"
|
10
|
+
import { Contract } from "../contract"
|
11
|
+
import {
|
12
|
+
getBasketProductBoardType,
|
13
|
+
getConflictingContractsWithDifferentGroupsInBasket,
|
14
|
+
} from "../../common/basket/utils"
|
15
|
+
import { Campaign, CampaignCreateForm } from "../campaign"
|
4
16
|
|
5
17
|
export type WindowHapiUtilsBasket = WindowHapiModuleWithConstructorArgs<
|
6
18
|
{
|
7
19
|
getInitialBasketProductsMeta: () => BasketProduct[]
|
20
|
+
getBasketProductId: (product: Product | Contract) => string
|
21
|
+
getBasketProductTitle: (product: Product | Contract) => string
|
22
|
+
getIsBasketProductContract: (product: Product | Contract) => boolean
|
23
|
+
getIsBasketProductProduct: (product: Product | Contract) => boolean
|
24
|
+
getBasketProductPrice: (
|
25
|
+
product: Product | Contract,
|
26
|
+
displayCurrency: ProductPriceCurrency,
|
27
|
+
) => ProductPrice | undefined
|
28
|
+
getBasketProductBoardType: (
|
29
|
+
product: Product | Contract,
|
30
|
+
) => ProductBoardType | undefined
|
31
|
+
getBasketProductTimeToProcess: (
|
32
|
+
product: Product | Contract,
|
33
|
+
) => string | undefined
|
34
|
+
getBasketProductDuration: (
|
35
|
+
product: Product | Contract,
|
36
|
+
) => string | undefined
|
37
|
+
getIsProductOrContractInBasket: (
|
38
|
+
contractOrProductId: string,
|
39
|
+
productsMeta: BasketProduct[],
|
40
|
+
) => boolean
|
41
|
+
getConflictingContractsWithDifferentGroupsInBasket: (
|
42
|
+
contract: Contract,
|
43
|
+
basketProducts: (Contract | Product)[],
|
44
|
+
) => (Product | Contract)[]
|
45
|
+
getBasketProductMetaFromCampaignForm: (form: Campaign) => any[]
|
8
46
|
},
|
9
47
|
{ readonly utils: WindowHapiUtils }
|
10
48
|
>
|
@@ -31,6 +31,7 @@ export type CampaignServiceGetSenioritiesHandler = () => Promise<
|
|
31
31
|
export type CampaignServiceOrderCampaignHandler = () => Promise<Campaign>
|
32
32
|
export type CampaignServiceCopyCampaignHandler = (
|
33
33
|
campaign: Campaign,
|
34
|
+
withExistingProducts: boolean,
|
34
35
|
) => Promise<Campaign>
|
35
36
|
|
36
37
|
export type WindowHapiServiceCampaign = WindowHapiModuleWithConstructorArgs<
|
package/campaign/state.types.ts
CHANGED
@@ -9,47 +9,17 @@ import { PaginationResponseV2 } from "../common/types"
|
|
9
9
|
|
10
10
|
export type CampaignState = {
|
11
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
12
|
campaigns: Campaign[]
|
16
|
-
/**
|
17
|
-
* An object that holds information like next URL, previous URL and count for pagination purposes
|
18
|
-
*/
|
19
13
|
campaignsPaginationMeta: PaginationResponseV2
|
20
|
-
/**
|
21
|
-
* Used to show a loading spinner in Campaign widgets that show list of campaigns
|
22
|
-
*/
|
23
14
|
campaignsAreLoading: boolean
|
24
|
-
/**
|
25
|
-
* Object used to create (order) a campaign
|
26
|
-
*/
|
27
15
|
campaignForm: CampaignCreateForm
|
28
|
-
/**
|
29
|
-
* Shows a loading spinner and disables the buttons in Campaign Create Form while creating a Campaign
|
30
|
-
*/
|
31
16
|
campaignIsCreating: boolean
|
32
17
|
/* Education Levels */
|
33
|
-
/**
|
34
|
-
* Array of Education Levels that end user will select via a Select HTML element
|
35
|
-
*/
|
36
18
|
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
19
|
educationLevelsAreLoading: boolean
|
41
20
|
/* Seniorities */
|
42
|
-
/**
|
43
|
-
* Array of Seniorities that end user will select via a Select HTML element
|
44
|
-
*/
|
45
21
|
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
22
|
senioritiesAreLoading: boolean
|
50
23
|
/* Employment Types */
|
51
|
-
/**
|
52
|
-
* Array of Employment Types that end user will select via a Select HTML element
|
53
|
-
*/
|
54
24
|
employmentTypes: TaxonomyEmploymentTypes[]
|
55
25
|
}
|