@vonq/hapi-elements-types 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -8
- package/src/_window/api.types.ts +61 -0
- package/src/_window/auth.types.ts +13 -0
- package/src/_window/config.types.ts +5 -0
- package/src/_window/events.types.ts +158 -0
- package/src/_window/index.ts +16 -0
- package/src/_window/instances.types.ts +27 -0
- package/src/_window/qa.types.ts +30 -0
- package/src/_window/routing.types.ts +23 -0
- package/src/_window/sdk.types.ts +149 -0
- package/src/_window/service.types.ts +69 -0
- package/src/_window/state.types.ts +114 -0
- package/src/_window/ui.types.ts +15 -0
- package/src/_window/utils.types.ts +36 -0
- package/src/_window/validation.types.ts +45 -0
- package/src/_window/window.ts +140 -0
- package/src/alert/enums.ts +22 -0
- package/src/alert/index.ts +6 -0
- package/src/alert/service.types.ts +15 -0
- package/src/alert/state.types.ts +9 -0
- package/src/alert/types.ts +63 -0
- package/src/ats/api.types.ts +16 -0
- package/src/ats/index.ts +6 -0
- package/src/ats/service.types.ts +17 -0
- package/src/ats/state.types.ts +5 -0
- package/src/ats/types.ts +19 -0
- package/src/basket/index.ts +7 -0
- package/src/basket/service.types.ts +32 -0
- package/src/basket/state.types.ts +34 -0
- package/src/basket/types.ts +4 -0
- package/src/basket/utils.types.ts +10 -0
- package/src/basket/validations.types.ts +25 -0
- package/src/campaign/api.types.ts +45 -0
- package/src/campaign/enums.ts +17 -0
- package/src/campaign/index.ts +10 -0
- package/src/campaign/qa.types.ts +12 -0
- package/src/campaign/service.types.ts +48 -0
- package/src/campaign/state.types.ts +55 -0
- package/src/campaign/types.ts +237 -0
- package/src/campaign/utils.types.ts +59 -0
- package/src/campaign/validations.types.ts +215 -0
- package/src/common/enums.ts +42 -0
- package/src/common/events/EventCommand/enums.ts +49 -0
- package/src/common/events/EventCommand/index.ts +4 -0
- package/src/common/events/EventCommand/types.ts +18 -0
- package/src/common/events/index.ts +4 -0
- package/src/common/events/types.ts +52 -0
- package/src/common/index.ts +7 -0
- package/src/common/logger/enums.ts +12 -0
- package/src/common/logger/types.ts +18 -0
- package/src/common/qa.types.ts +9 -0
- package/src/common/types.ts +109 -0
- package/src/common/validations.types.ts +89 -0
- package/src/common/validator/types.ts +4 -0
- package/src/contract/api.types.ts +47 -0
- package/src/contract/index.ts +9 -0
- package/src/contract/qa.types.ts +12 -0
- package/src/contract/service.types.ts +54 -0
- package/src/contract/state.types.ts +74 -0
- package/src/contract/types.ts +145 -0
- package/src/contract/utils.types.ts +11 -0
- package/src/contract/validations.types.ts +104 -0
- package/src/debugging/index.ts +3 -0
- package/src/debugging/state.types.ts +18 -0
- package/src/index.ts +18 -0
- package/src/language/index.ts +5 -0
- package/src/language/qa.types.ts +19 -0
- package/src/language/state.types.ts +25 -0
- package/src/language/validations.types.ts +13 -0
- package/src/modal/enums.ts +14 -0
- package/src/modal/index.ts +6 -0
- package/src/modal/service.types.ts +32 -0
- package/src/modal/state.types.ts +8 -0
- package/src/modal/types.ts +44 -0
- package/src/orderJourney/enums.ts +25 -0
- package/src/orderJourney/index.ts +8 -0
- package/src/orderJourney/qa.types.ts +16 -0
- package/src/orderJourney/state.types.ts +99 -0
- package/src/orderJourney/types.ts +31 -0
- package/src/orderJourney/utils.types.ts +11 -0
- package/src/orderJourney/validations.types.ts +34 -0
- package/src/product/api.types.ts +62 -0
- package/src/product/enums.ts +11 -0
- package/src/product/index.ts +10 -0
- package/src/product/qa.types.ts +11 -0
- package/src/product/service.types.ts +68 -0
- package/src/product/state.types.ts +93 -0
- package/src/product/types.ts +161 -0
- package/src/product/utils.types.ts +22 -0
- package/src/product/validations.types.ts +189 -0
- package/src/routing/index.ts +3 -0
- package/src/routing/state.types.ts +30 -0
- package/src/theming/index.ts +6 -0
- package/src/theming/qa.types.ts +11 -0
- package/src/theming/state.types.ts +6 -0
- package/src/theming/types.ts +123 -0
- package/src/theming/validations.types.ts +62 -0
- package/src/ui/index.ts +3 -0
- package/src/ui/service.types.ts +26 -0
- package/src/wallet/api.types.ts +33 -0
- package/src/wallet/index.ts +7 -0
- package/src/wallet/service.types.ts +26 -0
- package/src/wallet/state.types.ts +58 -0
- package/src/wallet/types.ts +65 -0
- package/src/wallet/validations.types.ts +18 -0
- package/tsconfig.json +36 -0
- package/index.d.ts +0 -5207
package/package.json
CHANGED
@@ -1,26 +1,35 @@
|
|
1
1
|
{
|
2
2
|
"private": false,
|
3
3
|
"name": "@vonq/hapi-elements-types",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.6.0",
|
5
5
|
"description": "This package contains Typescript definitions for HAPI Elements",
|
6
6
|
"author": "VONQ HAPI Team",
|
7
7
|
"license": "BSD-3-Clause",
|
8
8
|
"type": "module",
|
9
9
|
"scripts": {
|
10
|
-
"build:types": "tsc -d --declarationMap --emitDeclarationOnly",
|
11
10
|
"version:minor": "npm version minor",
|
12
|
-
"
|
11
|
+
"build:types": "tsc -d --declarationMap --emitDeclarationOnly",
|
12
|
+
"publish:types": "npm publish --access public",
|
13
|
+
"generate:index": "cti create ./src"
|
13
14
|
},
|
15
|
+
"main": "src/index.ts",
|
14
16
|
"types": "index.d.ts",
|
15
|
-
"
|
16
|
-
"
|
17
|
-
|
18
|
-
"devDependencies": {
|
17
|
+
"dependencies": {
|
18
|
+
"@datadog/browser-logs": "^4.34.2",
|
19
|
+
"axios": "^1.3.4",
|
19
20
|
"color": "^4.2.3",
|
21
|
+
"is-promise": "^4.0.0",
|
22
|
+
"lodash": "^4.17.21",
|
20
23
|
"mobx": "^6.8.0",
|
21
24
|
"react": "^18.2.0",
|
22
|
-
"
|
25
|
+
"react-intl": "^6.2.10",
|
26
|
+
"react-toastify": "^9.1.1",
|
27
|
+
"theming": "^3.3.0",
|
23
28
|
"validator": "^13.9.0",
|
24
29
|
"zod": "^3.20.6"
|
30
|
+
},
|
31
|
+
"devDependencies": {
|
32
|
+
"create-ts-index": "^1.14.0",
|
33
|
+
"typescript": "^4.9.5"
|
25
34
|
}
|
26
35
|
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import {
|
2
|
+
AxiosRequestConfig,
|
3
|
+
AxiosResponse,
|
4
|
+
RawAxiosRequestConfig,
|
5
|
+
RawAxiosRequestHeaders,
|
6
|
+
} from "axios"
|
7
|
+
import { WindowHapiModuleName } from "../common/enums"
|
8
|
+
import { WindowHapiAPIATS } from "../ats/api.types"
|
9
|
+
import { WindowHapiAPICampaign } from "../campaign/api.types"
|
10
|
+
import { WindowHapiAPIContract } from "../contract/api.types"
|
11
|
+
import { WindowHapiAPIProduct } from "../product/api.types"
|
12
|
+
import { WindowHapiAPIWallet } from "../wallet/api.types"
|
13
|
+
import {
|
14
|
+
WindowHapiModuleWithConstructorArgs,
|
15
|
+
WindowHapiClassInterface,
|
16
|
+
} from "./window"
|
17
|
+
import { WindowHapiLogger } from "../common/logger/types"
|
18
|
+
|
19
|
+
export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
20
|
+
logger: WindowHapiLogger
|
21
|
+
configs: ModuleConfig
|
22
|
+
setBaseURL: (url: string) => void
|
23
|
+
setBaseConfig: (config: Record<string, RawAxiosRequestConfig>) => void
|
24
|
+
setResourceConfig: (
|
25
|
+
resourceKey: keyof ModuleConfig,
|
26
|
+
config: RawAxiosRequestConfig,
|
27
|
+
) => void
|
28
|
+
} & ModuleType
|
29
|
+
export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
|
30
|
+
headers?: any
|
31
|
+
}
|
32
|
+
export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
33
|
+
{
|
34
|
+
/* Common */
|
35
|
+
request: <T = any, R = AxiosResponse<T>, D = any>(
|
36
|
+
config: Partial<HapiRequestConfig<D>>,
|
37
|
+
) => Promise<R>
|
38
|
+
baseURL: string
|
39
|
+
setBaseURL: (url: string) => void
|
40
|
+
setBaseConfig: (params: Record<string, Record<string, string>>) => void
|
41
|
+
baseTimeout: number
|
42
|
+
setBaseTimeout: (timeout: number) => void
|
43
|
+
baseHeaders: RawAxiosRequestHeaders
|
44
|
+
headers: RawAxiosRequestHeaders
|
45
|
+
setHeaders: (headers: RawAxiosRequestHeaders) => void
|
46
|
+
baseRequestConfig: RawAxiosRequestConfig<any>
|
47
|
+
[WindowHapiModuleName.contract]: WindowHapiAPIContract
|
48
|
+
[WindowHapiModuleName.wallet]: WindowHapiAPIWallet
|
49
|
+
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
50
|
+
[WindowHapiModuleName.campaign]: WindowHapiAPICampaign
|
51
|
+
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
52
|
+
modules: {
|
53
|
+
[WindowHapiModuleName.contract]: WindowHapiAPIContract
|
54
|
+
[WindowHapiModuleName.wallet]: WindowHapiAPIWallet
|
55
|
+
[WindowHapiModuleName.product]: WindowHapiAPIProduct
|
56
|
+
[WindowHapiModuleName.campaign]: WindowHapiAPICampaign
|
57
|
+
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
58
|
+
}
|
59
|
+
},
|
60
|
+
{ readonly core: WindowHapiClassInterface }
|
61
|
+
>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import {
|
2
|
+
WindowHapiModuleWithConstructorArgs,
|
3
|
+
WindowHapiClassInterface,
|
4
|
+
} from "./window"
|
5
|
+
|
6
|
+
export type WindowHapiAuth = WindowHapiModuleWithConstructorArgs<
|
7
|
+
{
|
8
|
+
partnerId: string | undefined
|
9
|
+
clientId: string | undefined
|
10
|
+
clientToken: string | undefined
|
11
|
+
},
|
12
|
+
{ readonly core: WindowHapiClassInterface }
|
13
|
+
>
|
@@ -0,0 +1,158 @@
|
|
1
|
+
import {
|
2
|
+
WindowHapiEventCommandNames,
|
3
|
+
WindowHapiEventCommandStatus,
|
4
|
+
WindowHapiEventCommandData,
|
5
|
+
} from "../common/events/EventCommand/types"
|
6
|
+
import {
|
7
|
+
WindowHapiEventCommandCallbackHandler,
|
8
|
+
WindowHapiEventMediatorGetInstancesHandler,
|
9
|
+
WindowHapiEventMediatorInstances,
|
10
|
+
WindowHapiEventCommand,
|
11
|
+
WindowHapiEventStrategy,
|
12
|
+
WindowHapiEventListener,
|
13
|
+
} from "../common/events/types"
|
14
|
+
import {
|
15
|
+
WindowHapiModuleWithConstructorArgs,
|
16
|
+
WindowHapiClassInterface,
|
17
|
+
} from "./window"
|
18
|
+
import { WindowHapiSubmoduleName } from "../common/enums"
|
19
|
+
import { WindowHapiInstance } from "./instances.types"
|
20
|
+
|
21
|
+
export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
|
22
|
+
{
|
23
|
+
findEventsPendingResolveOrReject: (
|
24
|
+
events: WindowHapiEventCommand[],
|
25
|
+
id: string,
|
26
|
+
) => WindowHapiEventCommand | undefined
|
27
|
+
findOrCreate: (
|
28
|
+
events: WindowHapiEventCommand[],
|
29
|
+
name: WindowHapiEventCommandNames,
|
30
|
+
value: WindowHapiEventCommandData,
|
31
|
+
instances: WindowHapiEventMediatorInstances,
|
32
|
+
id?: string,
|
33
|
+
) => WindowHapiEventCommand
|
34
|
+
create: (
|
35
|
+
name: WindowHapiEventCommandNames,
|
36
|
+
data: WindowHapiEventCommandData,
|
37
|
+
getInstances: WindowHapiEventMediatorGetInstancesHandler,
|
38
|
+
id?: string,
|
39
|
+
status?: WindowHapiEventCommandStatus,
|
40
|
+
) => WindowHapiEventCommand
|
41
|
+
},
|
42
|
+
{ readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
|
43
|
+
>
|
44
|
+
|
45
|
+
export type WindowHapiEventMediatorCreateAndDispatchHandler = (
|
46
|
+
name: WindowHapiEventCommandNames,
|
47
|
+
data?: WindowHapiEventCommandData,
|
48
|
+
id?: string,
|
49
|
+
status?: WindowHapiEventCommandStatus,
|
50
|
+
) => Promise<WindowHapiEventCommand | undefined>
|
51
|
+
|
52
|
+
export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
|
53
|
+
{
|
54
|
+
createAndDispatch: WindowHapiEventMediatorCreateAndDispatchHandler
|
55
|
+
createAndDispatchDebounced: (
|
56
|
+
leading: boolean,
|
57
|
+
) => WindowHapiEventMediatorCreateAndDispatchHandler
|
58
|
+
removeListener: (name: WindowHapiEventCommandNames) => void
|
59
|
+
onMessageReceived: (
|
60
|
+
eventCommand: WindowHapiEventCommand,
|
61
|
+
) => Promise<WindowHapiEventCommand>
|
62
|
+
onMessage: (messageEvent: MessageEvent) => Promise<void>
|
63
|
+
runCallbacks: (eventCommand: WindowHapiEventCommand) => void
|
64
|
+
onRequestFullfilledOrTimedOut: (
|
65
|
+
resolve: any,
|
66
|
+
reject: any,
|
67
|
+
request: WindowHapiEventCommand,
|
68
|
+
) => void
|
69
|
+
dispatchEvent: (
|
70
|
+
eventCommand: WindowHapiEventCommand,
|
71
|
+
) => Promise<WindowHapiEventCommand | undefined>
|
72
|
+
retryEvent: (
|
73
|
+
eventCommand: WindowHapiEventCommand,
|
74
|
+
) => Promise<WindowHapiEventCommand | undefined>
|
75
|
+
acknowledgeEvent: (event: WindowHapiEventCommand) => void
|
76
|
+
rejectEvent: (event: WindowHapiEventCommand) => Promise<void>
|
77
|
+
resolveEvent: (event: WindowHapiEventCommand) => Promise<void>
|
78
|
+
removeMessageEventListener: (_window: Window) => void
|
79
|
+
addMessageEventListener: (_window: Window) => void
|
80
|
+
getEventListener: (
|
81
|
+
name: WindowHapiEventCommandNames,
|
82
|
+
id?: string,
|
83
|
+
) => WindowHapiEventListener | undefined
|
84
|
+
addEventListener: (
|
85
|
+
name: WindowHapiEventCommandNames,
|
86
|
+
callback: WindowHapiEventCommandCallbackHandler,
|
87
|
+
id?: string,
|
88
|
+
) => WindowHapiEventListener
|
89
|
+
removeEventListener: (eventId: string) => void
|
90
|
+
},
|
91
|
+
{
|
92
|
+
readonly getInstances: WindowHapiEventMediatorGetInstancesHandler
|
93
|
+
readonly eventStorage: WindowHapiEventStorage
|
94
|
+
readonly eventFactory: WindowHapiEventFactory
|
95
|
+
readonly eventStateStrategy?: WindowHapiEventStrategy
|
96
|
+
readonly eventRoutingStrategy?: WindowHapiEventStrategy
|
97
|
+
readonly eventDOMStrategy?: WindowHapiEventStrategy
|
98
|
+
readonly eventConfigStrategy?: WindowHapiEventStrategy
|
99
|
+
readonly eventAppStrategy?: WindowHapiEventStrategy
|
100
|
+
readonly eventApiStrategy?: WindowHapiEventStrategy
|
101
|
+
readonly eventServiceStrategy?: WindowHapiEventStrategy
|
102
|
+
readonly eventQAStrategy?: WindowHapiEventStrategy
|
103
|
+
}
|
104
|
+
>
|
105
|
+
|
106
|
+
export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
|
107
|
+
{
|
108
|
+
cache: (WindowHapiEventCommand | WindowHapiEventListener)[]
|
109
|
+
listeners: WindowHapiEventListener[]
|
110
|
+
getFullfilledRequest: (eventCommandId: string) => WindowHapiEventCommand
|
111
|
+
replaceById: (eventCommand: WindowHapiEventCommand) => void
|
112
|
+
getEventById: (
|
113
|
+
eventCommandId: string,
|
114
|
+
) => WindowHapiEventCommand | WindowHapiEventListener | undefined
|
115
|
+
add: (
|
116
|
+
eventCommand: WindowHapiEventCommand | WindowHapiEventListener,
|
117
|
+
) => void
|
118
|
+
remove: (id: string) => void
|
119
|
+
removeByName: (name: string) => void
|
120
|
+
getEventsByName: (name: string) => WindowHapiEventCommand[]
|
121
|
+
},
|
122
|
+
{ readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
|
123
|
+
>
|
124
|
+
|
125
|
+
export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
126
|
+
{
|
127
|
+
hasAddedWindowMessageEvent: boolean
|
128
|
+
addInternalEventListeners: () => void
|
129
|
+
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
|
+
eventFactory: WindowHapiEventFactory
|
140
|
+
eventMediator: WindowHapiEventMediator
|
141
|
+
eventStorage: WindowHapiEventStorage
|
142
|
+
eventRoutingStrategy: WindowHapiEventStrategy
|
143
|
+
eventAppStrategy: WindowHapiEventStrategy
|
144
|
+
eventApiStrategy: WindowHapiEventStrategy
|
145
|
+
eventStateStrategy: WindowHapiEventStrategy
|
146
|
+
eventServiceStrategy: WindowHapiEventStrategy
|
147
|
+
eventQAStrategy: WindowHapiEventStrategy
|
148
|
+
getInstances: () => {
|
149
|
+
source: WindowHapiInstance
|
150
|
+
targets: WindowHapiInstance[]
|
151
|
+
}
|
152
|
+
handleEventWithDataRequest: (
|
153
|
+
event: WindowHapiEventCommand,
|
154
|
+
coreModuleName: WindowHapiSubmoduleName,
|
155
|
+
) => Promise<void>
|
156
|
+
},
|
157
|
+
{ readonly core: WindowHapiClassInterface }
|
158
|
+
>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// created from 'create-ts-index'
|
2
|
+
|
3
|
+
export * from './api.types';
|
4
|
+
export * from './auth.types';
|
5
|
+
export * from './config.types';
|
6
|
+
export * from './events.types';
|
7
|
+
export * from './instances.types';
|
8
|
+
export * from './qa.types';
|
9
|
+
export * from './routing.types';
|
10
|
+
export * from './sdk.types';
|
11
|
+
export * from './service.types';
|
12
|
+
export * from './state.types';
|
13
|
+
export * from './ui.types';
|
14
|
+
export * from './utils.types';
|
15
|
+
export * from './validation.types';
|
16
|
+
export * from './window';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import {
|
2
|
+
WindowHapiClassInterface,
|
3
|
+
WindowHapiModuleWithConstructorArgs,
|
4
|
+
} from "./window"
|
5
|
+
import { WindowHapiLogger } from "../common/logger/types"
|
6
|
+
|
7
|
+
export type WindowHapiInstances = WindowHapiModuleWithConstructorArgs<
|
8
|
+
{
|
9
|
+
instances: WindowHapiInstance[]
|
10
|
+
getFrameWindowByName: (name: string) => Window | undefined
|
11
|
+
hasInstance: (instanceName: string) => boolean
|
12
|
+
getInstanceByName: (
|
13
|
+
instanceName: string,
|
14
|
+
) => WindowHapiInstance | undefined
|
15
|
+
addInstanceByName: (instanceName: string, window: Window) => void
|
16
|
+
addInstance: (instance: WindowHapiInstance) => void
|
17
|
+
removeInstance: (instanceName: string) => void
|
18
|
+
onAfterAddInstance: (instance: WindowHapiInstance) => void
|
19
|
+
onAfterRemoveInstance: (instance: WindowHapiInstance) => void
|
20
|
+
},
|
21
|
+
{ readonly core: WindowHapiClassInterface }
|
22
|
+
>
|
23
|
+
export type WindowHapiInstance = {
|
24
|
+
logger: WindowHapiLogger
|
25
|
+
name: string
|
26
|
+
window?: Window
|
27
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
2
|
+
import {
|
3
|
+
WindowHapiModuleWithConstructorArgs,
|
4
|
+
WindowHapiClassInterface,
|
5
|
+
} from "./window"
|
6
|
+
import { WindowHapiQACampaign } from "../campaign/qa.types"
|
7
|
+
import { WindowHapiQACommon } from "../common/qa.types"
|
8
|
+
import { WindowHapiQAOrderJourney } from "../orderJourney/qa.types"
|
9
|
+
import { WindowHapiQAContract } from "../contract/qa.types"
|
10
|
+
import { WindowHapiQATheming } from "../theming/qa.types"
|
11
|
+
import { WindowHapiQALanguage } from "../language/qa.types"
|
12
|
+
import { WindowHapiQAProduct } from "../product/qa.types"
|
13
|
+
|
14
|
+
export type WindowHapiQA = WindowHapiModuleWithConstructorArgs<
|
15
|
+
{
|
16
|
+
[WindowHapiModuleName.campaign]: WindowHapiQACampaign
|
17
|
+
[WindowHapiModuleName.product]: WindowHapiQAProduct
|
18
|
+
[WindowHapiModuleName.contract]: WindowHapiQAContract
|
19
|
+
[WindowHapiModuleName.orderJourney]: WindowHapiQAOrderJourney
|
20
|
+
[WindowHapiModuleName.theming]: WindowHapiQATheming
|
21
|
+
[WindowHapiModuleName.language]: WindowHapiQALanguage
|
22
|
+
[WindowHapiModuleName.common]: WindowHapiQACommon
|
23
|
+
|
24
|
+
isDebugPanelOpen: boolean
|
25
|
+
getDebugPanelButtonEl: () => HTMLElement | null
|
26
|
+
addDebugPanelToDOM: () => void
|
27
|
+
setDebugPanelPosition: (buttonEl: HTMLElement | null) => void
|
28
|
+
},
|
29
|
+
{ readonly core: WindowHapiClassInterface }
|
30
|
+
>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import {
|
2
|
+
WindowHapiModuleWithConstructorArgs,
|
3
|
+
WindowHapiClassInterface,
|
4
|
+
} from "./window"
|
5
|
+
|
6
|
+
export type WindowHapiRoutingQueryParams = Record<string, string | string[]>
|
7
|
+
|
8
|
+
export type WindowHapiRouting = WindowHapiModuleWithConstructorArgs<
|
9
|
+
{
|
10
|
+
locationChangeInterval: number | undefined
|
11
|
+
currentPathname: string
|
12
|
+
startingPathname: string
|
13
|
+
origin: string
|
14
|
+
queryParams: WindowHapiRoutingQueryParams
|
15
|
+
setCurrentPathname: (pathname: string) => void
|
16
|
+
setStartingPathname: (pathname: string) => void
|
17
|
+
changeHref: (href: string) => void
|
18
|
+
setOrigin: (origin: string) => void
|
19
|
+
setQueryParams: (params: WindowHapiRoutingQueryParams) => void
|
20
|
+
onRouteChange: () => void
|
21
|
+
},
|
22
|
+
{ readonly core: WindowHapiClassInterface }
|
23
|
+
>
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
2
|
+
import { WindowHapiServiceAlert } from "../alert/service.types"
|
3
|
+
import { WindowHapiStateModule } from "./state.types"
|
4
|
+
import { AlertState } from "../alert/state.types"
|
5
|
+
import { WindowHapiServiceBasket } from "../basket/service.types"
|
6
|
+
import { BasketState } from "../basket/state.types"
|
7
|
+
import { WindowHapiUtilsBasket } from "../basket/utils.types"
|
8
|
+
import { WindowHapiServiceCampaign } from "../campaign/service.types"
|
9
|
+
import { CampaignState } from "../campaign/state.types"
|
10
|
+
import { WindowHapiUtilsCampaign } from "../campaign/utils.types"
|
11
|
+
import { WindowHapiServiceContract } from "../contract/service.types"
|
12
|
+
import { ContractState } from "../contract/state.types"
|
13
|
+
import { WindowHapiUtilsContract } from "../contract/utils.types"
|
14
|
+
import { DebuggingState } from "../debugging/state.types"
|
15
|
+
import { LanguageState } from "../language/state.types"
|
16
|
+
import { WindowHapiServiceModal } from "../modal/service.types"
|
17
|
+
import { ModalState } from "../modal/state.types"
|
18
|
+
import { OrderJourneyState } from "../orderJourney/state.types"
|
19
|
+
import { WindowHapiUtilsOrderJourney } from "../orderJourney/utils.types"
|
20
|
+
import { WindowHapiServiceProduct } from "../product/service.types"
|
21
|
+
import { ProductState } from "../product/state.types"
|
22
|
+
import { WindowHapiUtilsProduct } from "../product/utils.types"
|
23
|
+
import { ThemingState } from "../theming/state.types"
|
24
|
+
import { WindowHapiServiceWallet } from "../wallet/service.types"
|
25
|
+
import { WalletState } from "../wallet/state.types"
|
26
|
+
import { WindowHapiValidationsBasket } from "../basket/validations.types"
|
27
|
+
import { WindowHapiValidationsCampaign } from "../campaign/validations.types"
|
28
|
+
import { WindowHapiValidationsContract } from "../contract/validations.types"
|
29
|
+
import { WindowHapiValidationsLanguage } from "../language/validations.types"
|
30
|
+
import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.types"
|
31
|
+
import { WindowHapiValidationsProduct } from "../product/validations.types"
|
32
|
+
import { WindowHapiValidationsTheming } from "../theming/validations.types"
|
33
|
+
import { WindowHapiValidationsWallet } from "../wallet/validations.types"
|
34
|
+
import { WindowHapiAPICampaign } from "../campaign/api.types"
|
35
|
+
import { WindowHapiAPIContract } from "../contract/api.types"
|
36
|
+
import { WindowHapiAPIProduct } from "../product/api.types"
|
37
|
+
import { WindowHapiAPIWallet } from "../wallet/api.types"
|
38
|
+
import {
|
39
|
+
WindowHapiModuleWithConstructorArgs,
|
40
|
+
WindowHapiClassInterface,
|
41
|
+
} from "./window"
|
42
|
+
import { WindowHapiServiceUI } from "../ui/service.types"
|
43
|
+
|
44
|
+
export type WindowHapiSDKModule<
|
45
|
+
APIModule,
|
46
|
+
ServiceModule,
|
47
|
+
ValidationModule,
|
48
|
+
StateModule,
|
49
|
+
UtilsModule = any,
|
50
|
+
> = {
|
51
|
+
api?: APIModule
|
52
|
+
state?: StateModule
|
53
|
+
service?: ServiceModule
|
54
|
+
validation?: ValidationModule
|
55
|
+
utils?: UtilsModule
|
56
|
+
}
|
57
|
+
|
58
|
+
export type WindowHapiSDKAlert = WindowHapiSDKModule<
|
59
|
+
undefined,
|
60
|
+
WindowHapiServiceAlert,
|
61
|
+
undefined,
|
62
|
+
WindowHapiStateModule<AlertState>
|
63
|
+
>
|
64
|
+
export type WindowHapiSDKBasket = WindowHapiSDKModule<
|
65
|
+
undefined,
|
66
|
+
WindowHapiServiceBasket,
|
67
|
+
WindowHapiValidationsBasket,
|
68
|
+
WindowHapiStateModule<BasketState>,
|
69
|
+
WindowHapiUtilsBasket
|
70
|
+
>
|
71
|
+
export type WindowHapiSDKCampaign = WindowHapiSDKModule<
|
72
|
+
WindowHapiAPICampaign,
|
73
|
+
WindowHapiServiceCampaign,
|
74
|
+
WindowHapiValidationsCampaign,
|
75
|
+
WindowHapiStateModule<CampaignState>,
|
76
|
+
WindowHapiUtilsCampaign
|
77
|
+
>
|
78
|
+
export type WindowHapiSDKContract = WindowHapiSDKModule<
|
79
|
+
WindowHapiAPIContract,
|
80
|
+
WindowHapiServiceContract,
|
81
|
+
WindowHapiValidationsContract,
|
82
|
+
WindowHapiStateModule<ContractState>,
|
83
|
+
WindowHapiUtilsContract
|
84
|
+
>
|
85
|
+
export type WindowHapiSDKDebugging = WindowHapiSDKModule<
|
86
|
+
undefined,
|
87
|
+
undefined,
|
88
|
+
undefined,
|
89
|
+
WindowHapiStateModule<DebuggingState>
|
90
|
+
>
|
91
|
+
export type WindowHapiSDKLanguage = WindowHapiSDKModule<
|
92
|
+
undefined,
|
93
|
+
undefined,
|
94
|
+
WindowHapiValidationsLanguage,
|
95
|
+
WindowHapiStateModule<LanguageState>
|
96
|
+
>
|
97
|
+
export type WindowHapiSDKOrderJourney = WindowHapiSDKModule<
|
98
|
+
undefined,
|
99
|
+
undefined,
|
100
|
+
WindowHapiValidationsOrderJourney,
|
101
|
+
WindowHapiStateModule<OrderJourneyState>,
|
102
|
+
WindowHapiUtilsOrderJourney
|
103
|
+
>
|
104
|
+
export type WindowHapiSDKProduct = WindowHapiSDKModule<
|
105
|
+
WindowHapiAPIProduct,
|
106
|
+
WindowHapiServiceProduct,
|
107
|
+
WindowHapiValidationsProduct,
|
108
|
+
WindowHapiStateModule<ProductState>,
|
109
|
+
WindowHapiUtilsProduct
|
110
|
+
>
|
111
|
+
export type WindowHapiSDKTheming = WindowHapiSDKModule<
|
112
|
+
undefined,
|
113
|
+
undefined,
|
114
|
+
WindowHapiValidationsTheming,
|
115
|
+
WindowHapiStateModule<ThemingState>
|
116
|
+
>
|
117
|
+
export type WindowHapiSDKWallet = WindowHapiSDKModule<
|
118
|
+
WindowHapiAPIWallet,
|
119
|
+
WindowHapiServiceWallet,
|
120
|
+
WindowHapiValidationsWallet,
|
121
|
+
WindowHapiStateModule<WalletState>
|
122
|
+
>
|
123
|
+
export type WindowHapiSDKUI = WindowHapiSDKModule<
|
124
|
+
undefined,
|
125
|
+
WindowHapiServiceUI,
|
126
|
+
undefined,
|
127
|
+
undefined
|
128
|
+
>
|
129
|
+
export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
|
130
|
+
{
|
131
|
+
[WindowHapiModuleName.contract]: WindowHapiSDKContract
|
132
|
+
[WindowHapiModuleName.basket]: WindowHapiSDKBasket
|
133
|
+
[WindowHapiModuleName.campaign]: WindowHapiSDKCampaign
|
134
|
+
[WindowHapiModuleName.wallet]: WindowHapiSDKWallet
|
135
|
+
[WindowHapiModuleName.product]: WindowHapiSDKProduct
|
136
|
+
[WindowHapiModuleName.orderJourney]: WindowHapiSDKOrderJourney
|
137
|
+
[WindowHapiModuleName.theming]: WindowHapiSDKTheming
|
138
|
+
[WindowHapiModuleName.language]: WindowHapiSDKLanguage
|
139
|
+
[WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
|
140
|
+
[WindowHapiModuleName.alert]: WindowHapiSDKAlert
|
141
|
+
},
|
142
|
+
{ readonly core: WindowHapiClassInterface }
|
143
|
+
>
|
144
|
+
export type WindowHapiSDKModal = WindowHapiSDKModule<
|
145
|
+
undefined,
|
146
|
+
WindowHapiServiceModal,
|
147
|
+
undefined,
|
148
|
+
WindowHapiStateModule<ModalState>
|
149
|
+
>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
2
|
+
import { WindowHapiServiceAlert } from "../alert/service.types"
|
3
|
+
import { WindowHapiServiceBasket } from "../basket/service.types"
|
4
|
+
import { WindowHapiServiceCampaign } from "../campaign/service.types"
|
5
|
+
import { WindowHapiServiceContract } from "../contract/service.types"
|
6
|
+
import { WindowHapiServiceProduct } from "../product/service.types"
|
7
|
+
import { WindowHapiServiceWallet } from "../wallet/service.types"
|
8
|
+
import { WindowHapiServiceModal } from "../modal/service.types"
|
9
|
+
import { WindowHapiServiceUI } from "../ui/service.types"
|
10
|
+
import { WindowHapiServiceATS } from "../ats/service.types"
|
11
|
+
import {
|
12
|
+
WindowHapiClassInterface,
|
13
|
+
WindowHapiModuleWithConstructorArgs,
|
14
|
+
} from "./window"
|
15
|
+
import { WindowHapiLogger } from "../common/logger/types"
|
16
|
+
|
17
|
+
export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
|
18
|
+
| void
|
19
|
+
| never
|
20
|
+
| Promise<void | never>
|
21
|
+
|
22
|
+
export type HapiServiceFunctionLifecycleHookHandler = (
|
23
|
+
callback: HapiServiceFunctionLifecycleHookCallbackHandler,
|
24
|
+
) => void
|
25
|
+
|
26
|
+
export type HapiServiceFunctionWithLifecycleHooks<HandlerType> = {
|
27
|
+
run: HandlerType
|
28
|
+
onStart: HapiServiceFunctionLifecycleHookHandler
|
29
|
+
onSuccess: HapiServiceFunctionLifecycleHookHandler
|
30
|
+
onFailure: HapiServiceFunctionLifecycleHookHandler
|
31
|
+
onFinish: HapiServiceFunctionLifecycleHookHandler
|
32
|
+
}
|
33
|
+
|
34
|
+
export type HapiServiceBase = {
|
35
|
+
__serviceName: WindowHapiModuleName
|
36
|
+
logger: WindowHapiLogger
|
37
|
+
init: () => void
|
38
|
+
}
|
39
|
+
export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
40
|
+
{
|
41
|
+
[WindowHapiModuleName.alert]: WindowHapiServiceAlert
|
42
|
+
[WindowHapiModuleName.basket]: WindowHapiServiceBasket
|
43
|
+
[WindowHapiModuleName.campaign]: WindowHapiServiceCampaign
|
44
|
+
[WindowHapiModuleName.contract]: WindowHapiServiceContract
|
45
|
+
[WindowHapiModuleName.product]: WindowHapiServiceProduct
|
46
|
+
[WindowHapiModuleName.wallet]: WindowHapiServiceWallet
|
47
|
+
[WindowHapiModuleName.modal]: WindowHapiServiceModal
|
48
|
+
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
49
|
+
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
50
|
+
services: {
|
51
|
+
[WindowHapiModuleName.alert]: WindowHapiServiceAlert
|
52
|
+
[WindowHapiModuleName.basket]: WindowHapiServiceBasket
|
53
|
+
[WindowHapiModuleName.campaign]: WindowHapiServiceCampaign
|
54
|
+
[WindowHapiModuleName.contract]: WindowHapiServiceContract
|
55
|
+
[WindowHapiModuleName.product]: WindowHapiServiceProduct
|
56
|
+
[WindowHapiModuleName.wallet]: WindowHapiServiceWallet
|
57
|
+
[WindowHapiModuleName.modal]: WindowHapiServiceModal
|
58
|
+
[WindowHapiModuleName.ui]: WindowHapiServiceUI
|
59
|
+
[WindowHapiModuleName.ats]: WindowHapiServiceATS
|
60
|
+
}
|
61
|
+
|
62
|
+
decorateFunctionWithLifecycleEvents: <HandlerType extends Function>(
|
63
|
+
service: HapiServiceBase,
|
64
|
+
propertyName: string,
|
65
|
+
fn: HandlerType,
|
66
|
+
) => HapiServiceFunctionWithLifecycleHooks<HandlerType>
|
67
|
+
},
|
68
|
+
{ readonly core: WindowHapiClassInterface }
|
69
|
+
>
|