@vonq/hapi-elements-types 1.5.0 → 1.7.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/{src/_window → _window}/api.types.ts +9 -7
- package/_window/auth.types.ts +13 -0
- package/_window/config.types.ts +5 -0
- package/{src/_window → _window}/events.types.ts +15 -14
- package/_window/instances.types.ts +27 -0
- package/{src/_window → _window}/qa.types.ts +7 -5
- package/{src/_window → _window}/routing.types.ts +6 -4
- package/{src/_window → _window}/sdk.types.ts +29 -27
- package/{src/_window → _window}/service.types.ts +9 -7
- package/{src/_window → _window}/state.types.ts +55 -53
- package/_window/ui.types.ts +15 -0
- package/{src/_window → _window}/utils.types.ts +7 -5
- package/{src/_window → _window}/validation.types.ts +7 -5
- package/_window/window.ts +140 -0
- package/alert/index.ts +6 -0
- package/{src/alert → alert}/service.types.ts +2 -2
- package/alert/state.types.ts +9 -0
- package/{src/ats → ats}/api.types.ts +2 -2
- package/ats/index.ts +6 -0
- package/{src/ats → ats}/service.types.ts +2 -2
- package/{src/ats → ats}/state.types.ts +1 -1
- package/basket/index.ts +7 -0
- package/{src/basket → basket}/service.types.ts +2 -2
- package/{src/basket → basket}/state.types.ts +1 -1
- package/{src/basket → basket}/utils.types.ts +2 -2
- package/{src/campaign → campaign}/api.types.ts +2 -2
- package/campaign/index.ts +10 -0
- package/campaign/qa.types.ts +12 -0
- package/{src/campaign → campaign}/service.types.ts +2 -2
- package/{src/campaign → campaign}/state.types.ts +1 -1
- package/{src/campaign → campaign}/utils.types.ts +2 -2
- package/{enums.ts → common/enums.ts} +2 -1
- package/{src/common → common}/events/types.ts +6 -6
- package/common/index.ts +7 -0
- package/common/logger/types.ts +18 -0
- package/{src/common → common}/qa.types.ts +2 -2
- package/{src/common → common}/types.ts +5 -6
- package/common/validator/types.ts +4 -0
- package/{src/contract → contract}/api.types.ts +2 -2
- package/contract/index.ts +9 -0
- package/{src/contract → contract}/qa.types.ts +2 -2
- package/{src/contract → contract}/service.types.ts +2 -2
- package/{src/contract → contract}/state.types.ts +1 -1
- package/{src/contract → contract}/utils.types.ts +2 -2
- package/{src/common/logger-datadog → debugging}/index.ts +1 -1
- package/{src/debugging → debugging}/state.types.ts +1 -1
- package/index.ts +18 -0
- package/language/index.ts +5 -0
- package/{src/language → language}/qa.types.ts +2 -2
- package/{src/language → language}/state.types.ts +1 -1
- package/modal/index.ts +6 -0
- package/{src/modal → modal}/service.types.ts +2 -2
- package/{src/modal → modal}/state.types.ts +1 -1
- package/orderJourney/index.ts +8 -0
- package/{src/orderJourney → orderJourney}/qa.types.ts +2 -2
- package/{src/orderJourney → orderJourney}/state.types.ts +1 -1
- package/{src/orderJourney → orderJourney}/utils.types.ts +2 -2
- package/package.json +16 -5
- package/{src/product → product}/api.types.ts +2 -2
- package/product/index.ts +10 -0
- package/{src/product → product}/qa.types.ts +2 -2
- package/{src/product → product}/service.types.ts +2 -2
- package/{src/product → product}/state.types.ts +1 -1
- package/{src/product → product}/utils.types.ts +2 -2
- package/routing/index.ts +3 -0
- package/theming/index.ts +6 -0
- package/{src/theming → theming}/qa.types.ts +2 -2
- package/{src/theming → theming}/state.types.ts +1 -1
- package/{src/theming → theming}/types.ts +38 -1
- package/tsconfig.json +7 -12
- package/{src/ui → ui}/service.types.ts +2 -2
- package/{src/wallet → wallet}/api.types.ts +2 -2
- package/wallet/index.ts +7 -0
- package/{src/wallet → wallet}/service.types.ts +2 -2
- package/{src/wallet → wallet}/state.types.ts +1 -1
- package/src/_window/auth.types.ts +0 -11
- package/src/_window/config.types.ts +0 -30
- package/src/_window/instances.types.ts +0 -18
- package/src/_window/ui.types.ts +0 -13
- package/src/_window/window.ts +0 -56
- package/src/alert/functions.types.ts +0 -13
- package/src/alert/index.ts +0 -9
- package/src/alert/state.initial.ts +0 -16
- package/src/alert/state.types.ts +0 -27
- package/src/alert/state.validations.ts +0 -11
- package/src/ats/functions.types.ts +0 -7
- package/src/ats/index.ts +0 -9
- package/src/ats/state.initial.ts +0 -5
- package/src/ats/state.validations.ts +0 -6
- package/src/basket/consts.ts +0 -1
- package/src/basket/functions.types.ts +0 -40
- package/src/basket/index.ts +0 -12
- package/src/basket/state.initial.ts +0 -11
- package/src/basket/state.validations.ts +0 -12
- package/src/basket/utils.ts +0 -79
- package/src/campaign/consts.ts +0 -1
- package/src/campaign/functions.types.ts +0 -90
- package/src/campaign/index.ts +0 -15
- package/src/campaign/qa.types.ts +0 -12
- package/src/campaign/state.initial.ts +0 -84
- package/src/campaign/state.validations.ts +0 -16
- package/src/campaign/utils.ts +0 -53
- package/src/common/LocalStorage.ts +0 -123
- package/src/common/browser.ts +0 -2
- package/src/common/color.ts +0 -9
- package/src/common/immutable.ts +0 -28
- package/src/common/index.ts +0 -22
- package/src/common/instances/Instance.ts +0 -13
- package/src/common/instances/consts.ts +0 -1
- package/src/common/instances/index.ts +0 -4
- package/src/common/json.ts +0 -25
- package/src/common/logger/Logger.ts +0 -70
- package/src/common/logger/index.ts +0 -5
- package/src/common/logger/types.ts +0 -7
- package/src/common/logger-datadog/LoggerDatadog.ts +0 -42
- package/src/common/misc.ts +0 -114
- package/src/common/promise.ts +0 -161
- package/src/common/proxy.ts +0 -77
- package/src/common/regExTest.ts +0 -12
- package/src/common/tree.ts +0 -148
- package/src/common/utm.ts +0 -19
- package/src/common/validators.ts +0 -21
- package/src/common/webComponents.ts +0 -26
- package/src/config/functions.types.ts +0 -23
- package/src/config/index.ts +0 -5
- package/src/config/state.initial.ts +0 -11
- package/src/config/state.types.ts +0 -15
- package/src/consts.ts +0 -980
- package/src/contract/consts.ts +0 -1
- package/src/contract/functions.types.ts +0 -112
- package/src/contract/index.ts +0 -14
- package/src/contract/state.initial.ts +0 -39
- package/src/contract/state.validations.ts +0 -21
- package/src/contract/utils.ts +0 -36
- package/src/debugging/functions.types.ts +0 -34
- package/src/debugging/index.ts +0 -6
- package/src/debugging/state.initial.ts +0 -10
- package/src/debugging/state.validations.ts +0 -10
- package/src/index.ts +0 -22
- package/src/language/consts.ts +0 -6
- package/src/language/en.ts +0 -530
- package/src/language/functions.types.ts +0 -29
- package/src/language/index.ts +0 -11
- package/src/language/state.initial.ts +0 -13
- package/src/language/state.validations.ts +0 -10
- package/src/language/utils.ts +0 -17
- package/src/modal/consts.ts +0 -6
- package/src/modal/functions.types.ts +0 -22
- package/src/modal/index.ts +0 -11
- package/src/modal/state.initial.ts +0 -9
- package/src/modal/state.validations.ts +0 -6
- package/src/modal/store.types.ts +0 -5
- package/src/orderJourney/consts.ts +0 -289
- package/src/orderJourney/functions.types.ts +0 -140
- package/src/orderJourney/index.ts +0 -13
- package/src/orderJourney/state.initial.ts +0 -401
- package/src/orderJourney/state.validations.ts +0 -78
- package/src/orderJourney/utils.ts +0 -7
- package/src/product/consts.ts +0 -1
- package/src/product/functions.types.ts +0 -156
- package/src/product/index.ts +0 -14
- package/src/product/state.initial.ts +0 -28
- package/src/product/state.validations.ts +0 -25
- package/src/routing/functions.types.ts +0 -48
- package/src/routing/index.ts +0 -5
- package/src/routing/state.initial.ts +0 -10
- package/src/theming/consts.ts +0 -7727
- package/src/theming/functions.types.ts +0 -13
- package/src/theming/index.ts +0 -11
- package/src/theming/state.initial.ts +0 -16
- package/src/theming/state.validations.ts +0 -8
- package/src/theming/utils.ts +0 -581
- package/src/types.ts +0 -229
- package/src/utils.ts +0 -3
- package/src/wallet/consts.ts +0 -3
- package/src/wallet/functions.types.ts +0 -58
- package/src/wallet/index.ts +0 -11
- package/src/wallet/state.initial.ts +0 -18
- package/src/wallet/state.validations.ts +0 -18
- /package/{src/_window → _window}/index.ts +0 -0
- /package/{src/alert → alert}/enums.ts +0 -0
- /package/{src/alert → alert}/types.ts +0 -0
- /package/{src/ats → ats}/types.ts +0 -0
- /package/{src/basket → basket}/types.ts +0 -0
- /package/{src/basket → basket}/validations.types.ts +0 -0
- /package/{src/campaign → campaign}/enums.ts +0 -0
- /package/{src/campaign → campaign}/types.ts +0 -0
- /package/{src/campaign → campaign}/validations.types.ts +0 -0
- /package/{src/common → common}/events/EventCommand/enums.ts +0 -0
- /package/{src/common → common}/events/EventCommand/index.ts +0 -0
- /package/{src/common → common}/events/EventCommand/types.ts +0 -0
- /package/{src/common → common}/events/index.ts +0 -0
- /package/{src/common → common}/logger/enums.ts +0 -0
- /package/{src/common → common}/validations.types.ts +0 -0
- /package/{src/contract → contract}/types.ts +0 -0
- /package/{src/contract → contract}/validations.types.ts +0 -0
- /package/{src/language → language}/validations.types.ts +0 -0
- /package/{src/modal → modal}/enums.ts +0 -0
- /package/{src/modal → modal}/types.ts +0 -0
- /package/{src/orderJourney → orderJourney}/enums.ts +0 -0
- /package/{src/orderJourney → orderJourney}/types.ts +0 -0
- /package/{src/orderJourney → orderJourney}/validations.types.ts +0 -0
- /package/{src/product → product}/enums.ts +0 -0
- /package/{src/product → product}/types.ts +0 -0
- /package/{src/product → product}/validations.types.ts +0 -0
- /package/{src/routing → routing}/state.types.ts +0 -0
- /package/{src/theming → theming}/validations.types.ts +0 -0
- /package/{src/ui → ui}/index.ts +0 -0
- /package/{src/wallet → wallet}/types.ts +0 -0
- /package/{src/wallet → wallet}/validations.types.ts +0 -0
@@ -1,21 +1,23 @@
|
|
1
|
-
import { Logger } from "../common/logger/Logger"
|
2
1
|
import {
|
3
2
|
AxiosRequestConfig,
|
4
3
|
AxiosResponse,
|
5
4
|
RawAxiosRequestConfig,
|
6
5
|
RawAxiosRequestHeaders,
|
7
6
|
} from "axios"
|
8
|
-
import {
|
9
|
-
import { WindowHapiModuleName } from "../../enums"
|
7
|
+
import { WindowHapiModuleName } from "../common/enums"
|
10
8
|
import { WindowHapiAPIATS } from "../ats/api.types"
|
11
9
|
import { WindowHapiAPICampaign } from "../campaign/api.types"
|
12
10
|
import { WindowHapiAPIContract } from "../contract/api.types"
|
13
11
|
import { WindowHapiAPIProduct } from "../product/api.types"
|
14
12
|
import { WindowHapiAPIWallet } from "../wallet/api.types"
|
15
|
-
import {
|
13
|
+
import {
|
14
|
+
WindowHapiModuleWithConstructorArgs,
|
15
|
+
WindowHapiClassInterface,
|
16
|
+
} from "./window"
|
17
|
+
import { WindowHapiLogger } from "../common/logger/types"
|
16
18
|
|
17
19
|
export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
18
|
-
logger:
|
20
|
+
logger: WindowHapiLogger
|
19
21
|
configs: ModuleConfig
|
20
22
|
setBaseURL: (url: string) => void
|
21
23
|
setBaseConfig: (config: Record<string, RawAxiosRequestConfig>) => void
|
@@ -27,7 +29,7 @@ export type WindowHapiAPIModule<ModuleType, ModuleConfig> = {
|
|
27
29
|
export type HapiRequestConfig<T> = Omit<AxiosRequestConfig<T>, "headers"> & {
|
28
30
|
headers?: any
|
29
31
|
}
|
30
|
-
export type WindowHapiAPI =
|
32
|
+
export type WindowHapiAPI = WindowHapiModuleWithConstructorArgs<
|
31
33
|
{
|
32
34
|
/* Common */
|
33
35
|
request: <T = any, R = AxiosResponse<T>, D = any>(
|
@@ -55,5 +57,5 @@ export type WindowHapiAPI = ModuleWithConstructorArgs<
|
|
55
57
|
[WindowHapiModuleName.ats]: WindowHapiAPIATS
|
56
58
|
}
|
57
59
|
},
|
58
|
-
{ readonly core:
|
60
|
+
{ readonly core: WindowHapiClassInterface }
|
59
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
|
+
>
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ModuleWithConstructorArgs } from "../types"
|
2
1
|
import {
|
3
2
|
WindowHapiEventCommandNames,
|
4
3
|
WindowHapiEventCommandStatus,
|
@@ -10,14 +9,16 @@ import {
|
|
10
9
|
WindowHapiEventMediatorInstances,
|
11
10
|
WindowHapiEventCommand,
|
12
11
|
WindowHapiEventStrategy,
|
12
|
+
WindowHapiEventListener,
|
13
13
|
} from "../common/events/types"
|
14
|
-
import {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
import
|
14
|
+
import {
|
15
|
+
WindowHapiModuleWithConstructorArgs,
|
16
|
+
WindowHapiClassInterface,
|
17
|
+
} from "./window"
|
18
|
+
import { WindowHapiSubmoduleName } from "../common/enums"
|
19
|
+
import { WindowHapiInstance } from "./instances.types"
|
19
20
|
|
20
|
-
export type WindowHapiEventFactory =
|
21
|
+
export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<
|
21
22
|
{
|
22
23
|
findEventsPendingResolveOrReject: (
|
23
24
|
events: WindowHapiEventCommand[],
|
@@ -48,7 +49,7 @@ export type WindowHapiEventMediatorCreateAndDispatchHandler = (
|
|
48
49
|
status?: WindowHapiEventCommandStatus,
|
49
50
|
) => Promise<WindowHapiEventCommand | undefined>
|
50
51
|
|
51
|
-
export type WindowHapiEventMediator =
|
52
|
+
export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
|
52
53
|
{
|
53
54
|
createAndDispatch: WindowHapiEventMediatorCreateAndDispatchHandler
|
54
55
|
createAndDispatchDebounced: (
|
@@ -79,12 +80,12 @@ export type WindowHapiEventMediator = ModuleWithConstructorArgs<
|
|
79
80
|
getEventListener: (
|
80
81
|
name: WindowHapiEventCommandNames,
|
81
82
|
id?: string,
|
82
|
-
) =>
|
83
|
+
) => WindowHapiEventListener | undefined
|
83
84
|
addEventListener: (
|
84
85
|
name: WindowHapiEventCommandNames,
|
85
86
|
callback: WindowHapiEventCommandCallbackHandler,
|
86
87
|
id?: string,
|
87
|
-
) =>
|
88
|
+
) => WindowHapiEventListener
|
88
89
|
removeEventListener: (eventId: string) => void
|
89
90
|
},
|
90
91
|
{
|
@@ -102,7 +103,7 @@ export type WindowHapiEventMediator = ModuleWithConstructorArgs<
|
|
102
103
|
}
|
103
104
|
>
|
104
105
|
|
105
|
-
export type WindowHapiEventStorage =
|
106
|
+
export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
|
106
107
|
{
|
107
108
|
cache: (WindowHapiEventCommand | WindowHapiEventListener)[]
|
108
109
|
listeners: WindowHapiEventListener[]
|
@@ -121,7 +122,7 @@ export type WindowHapiEventStorage = ModuleWithConstructorArgs<
|
|
121
122
|
{ readonly getInstances: WindowHapiEventMediatorGetInstancesHandler }
|
122
123
|
>
|
123
124
|
|
124
|
-
export type WindowHapiEvents =
|
125
|
+
export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<
|
125
126
|
{
|
126
127
|
hasAddedWindowMessageEvent: boolean
|
127
128
|
addInternalEventListeners: () => void
|
@@ -150,8 +151,8 @@ export type WindowHapiEvents = ModuleWithConstructorArgs<
|
|
150
151
|
}
|
151
152
|
handleEventWithDataRequest: (
|
152
153
|
event: WindowHapiEventCommand,
|
153
|
-
coreModuleName:
|
154
|
+
coreModuleName: WindowHapiSubmoduleName,
|
154
155
|
) => Promise<void>
|
155
156
|
},
|
156
|
-
{ readonly core:
|
157
|
+
{ readonly core: WindowHapiClassInterface }
|
157
158
|
>
|
@@ -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
|
+
}
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import { WindowHapiModuleName } from "
|
2
|
-
import {
|
3
|
-
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
2
|
+
import {
|
3
|
+
WindowHapiModuleWithConstructorArgs,
|
4
|
+
WindowHapiClassInterface,
|
5
|
+
} from "./window"
|
4
6
|
import { WindowHapiQACampaign } from "../campaign/qa.types"
|
5
7
|
import { WindowHapiQACommon } from "../common/qa.types"
|
6
8
|
import { WindowHapiQAOrderJourney } from "../orderJourney/qa.types"
|
@@ -9,7 +11,7 @@ import { WindowHapiQATheming } from "../theming/qa.types"
|
|
9
11
|
import { WindowHapiQALanguage } from "../language/qa.types"
|
10
12
|
import { WindowHapiQAProduct } from "../product/qa.types"
|
11
13
|
|
12
|
-
export type WindowHapiQA =
|
14
|
+
export type WindowHapiQA = WindowHapiModuleWithConstructorArgs<
|
13
15
|
{
|
14
16
|
[WindowHapiModuleName.campaign]: WindowHapiQACampaign
|
15
17
|
[WindowHapiModuleName.product]: WindowHapiQAProduct
|
@@ -24,5 +26,5 @@ export type WindowHapiQA = ModuleWithConstructorArgs<
|
|
24
26
|
addDebugPanelToDOM: () => void
|
25
27
|
setDebugPanelPosition: (buttonEl: HTMLElement | null) => void
|
26
28
|
},
|
27
|
-
{ readonly core:
|
29
|
+
{ readonly core: WindowHapiClassInterface }
|
28
30
|
>
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import {
|
2
|
+
WindowHapiModuleWithConstructorArgs,
|
3
|
+
WindowHapiClassInterface,
|
4
|
+
} from "./window"
|
3
5
|
|
4
6
|
export type WindowHapiRoutingQueryParams = Record<string, string | string[]>
|
5
7
|
|
6
|
-
export type WindowHapiRouting =
|
8
|
+
export type WindowHapiRouting = WindowHapiModuleWithConstructorArgs<
|
7
9
|
{
|
8
10
|
locationChangeInterval: number | undefined
|
9
11
|
currentPathname: string
|
@@ -17,5 +19,5 @@ export type WindowHapiRouting = ModuleWithConstructorArgs<
|
|
17
19
|
setQueryParams: (params: WindowHapiRoutingQueryParams) => void
|
18
20
|
onRouteChange: () => void
|
19
21
|
},
|
20
|
-
{ readonly core:
|
22
|
+
{ readonly core: WindowHapiClassInterface }
|
21
23
|
>
|
@@ -1,29 +1,28 @@
|
|
1
|
-
import { WindowHapiModuleName } from "
|
2
|
-
import { ModuleWithConstructorArgs } from "../types"
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
3
2
|
import { WindowHapiServiceAlert } from "../alert/service.types"
|
4
3
|
import { WindowHapiStateModule } from "./state.types"
|
5
|
-
import {
|
4
|
+
import { AlertState } from "../alert/state.types"
|
6
5
|
import { WindowHapiServiceBasket } from "../basket/service.types"
|
7
|
-
import {
|
6
|
+
import { BasketState } from "../basket/state.types"
|
8
7
|
import { WindowHapiUtilsBasket } from "../basket/utils.types"
|
9
8
|
import { WindowHapiServiceCampaign } from "../campaign/service.types"
|
10
|
-
import {
|
9
|
+
import { CampaignState } from "../campaign/state.types"
|
11
10
|
import { WindowHapiUtilsCampaign } from "../campaign/utils.types"
|
12
11
|
import { WindowHapiServiceContract } from "../contract/service.types"
|
13
|
-
import {
|
12
|
+
import { ContractState } from "../contract/state.types"
|
14
13
|
import { WindowHapiUtilsContract } from "../contract/utils.types"
|
15
|
-
import {
|
16
|
-
import {
|
14
|
+
import { DebuggingState } from "../debugging/state.types"
|
15
|
+
import { LanguageState } from "../language/state.types"
|
17
16
|
import { WindowHapiServiceModal } from "../modal/service.types"
|
18
|
-
import {
|
19
|
-
import {
|
17
|
+
import { ModalState } from "../modal/state.types"
|
18
|
+
import { OrderJourneyState } from "../orderJourney/state.types"
|
20
19
|
import { WindowHapiUtilsOrderJourney } from "../orderJourney/utils.types"
|
21
20
|
import { WindowHapiServiceProduct } from "../product/service.types"
|
22
|
-
import {
|
21
|
+
import { ProductState } from "../product/state.types"
|
23
22
|
import { WindowHapiUtilsProduct } from "../product/utils.types"
|
24
|
-
import {
|
23
|
+
import { ThemingState } from "../theming/state.types"
|
25
24
|
import { WindowHapiServiceWallet } from "../wallet/service.types"
|
26
|
-
import {
|
25
|
+
import { WalletState } from "../wallet/state.types"
|
27
26
|
import { WindowHapiValidationsBasket } from "../basket/validations.types"
|
28
27
|
import { WindowHapiValidationsCampaign } from "../campaign/validations.types"
|
29
28
|
import { WindowHapiValidationsContract } from "../contract/validations.types"
|
@@ -36,7 +35,10 @@ import { WindowHapiAPICampaign } from "../campaign/api.types"
|
|
36
35
|
import { WindowHapiAPIContract } from "../contract/api.types"
|
37
36
|
import { WindowHapiAPIProduct } from "../product/api.types"
|
38
37
|
import { WindowHapiAPIWallet } from "../wallet/api.types"
|
39
|
-
import {
|
38
|
+
import {
|
39
|
+
WindowHapiModuleWithConstructorArgs,
|
40
|
+
WindowHapiClassInterface,
|
41
|
+
} from "./window"
|
40
42
|
import { WindowHapiServiceUI } from "../ui/service.types"
|
41
43
|
|
42
44
|
export type WindowHapiSDKModule<
|
@@ -57,66 +59,66 @@ export type WindowHapiSDKAlert = WindowHapiSDKModule<
|
|
57
59
|
undefined,
|
58
60
|
WindowHapiServiceAlert,
|
59
61
|
undefined,
|
60
|
-
WindowHapiStateModule<
|
62
|
+
WindowHapiStateModule<AlertState>
|
61
63
|
>
|
62
64
|
export type WindowHapiSDKBasket = WindowHapiSDKModule<
|
63
65
|
undefined,
|
64
66
|
WindowHapiServiceBasket,
|
65
67
|
WindowHapiValidationsBasket,
|
66
|
-
WindowHapiStateModule<
|
68
|
+
WindowHapiStateModule<BasketState>,
|
67
69
|
WindowHapiUtilsBasket
|
68
70
|
>
|
69
71
|
export type WindowHapiSDKCampaign = WindowHapiSDKModule<
|
70
72
|
WindowHapiAPICampaign,
|
71
73
|
WindowHapiServiceCampaign,
|
72
74
|
WindowHapiValidationsCampaign,
|
73
|
-
WindowHapiStateModule<
|
75
|
+
WindowHapiStateModule<CampaignState>,
|
74
76
|
WindowHapiUtilsCampaign
|
75
77
|
>
|
76
78
|
export type WindowHapiSDKContract = WindowHapiSDKModule<
|
77
79
|
WindowHapiAPIContract,
|
78
80
|
WindowHapiServiceContract,
|
79
81
|
WindowHapiValidationsContract,
|
80
|
-
WindowHapiStateModule<
|
82
|
+
WindowHapiStateModule<ContractState>,
|
81
83
|
WindowHapiUtilsContract
|
82
84
|
>
|
83
85
|
export type WindowHapiSDKDebugging = WindowHapiSDKModule<
|
84
86
|
undefined,
|
85
87
|
undefined,
|
86
88
|
undefined,
|
87
|
-
WindowHapiStateModule<
|
89
|
+
WindowHapiStateModule<DebuggingState>
|
88
90
|
>
|
89
91
|
export type WindowHapiSDKLanguage = WindowHapiSDKModule<
|
90
92
|
undefined,
|
91
93
|
undefined,
|
92
94
|
WindowHapiValidationsLanguage,
|
93
|
-
WindowHapiStateModule<
|
95
|
+
WindowHapiStateModule<LanguageState>
|
94
96
|
>
|
95
97
|
export type WindowHapiSDKOrderJourney = WindowHapiSDKModule<
|
96
98
|
undefined,
|
97
99
|
undefined,
|
98
100
|
WindowHapiValidationsOrderJourney,
|
99
|
-
WindowHapiStateModule<
|
101
|
+
WindowHapiStateModule<OrderJourneyState>,
|
100
102
|
WindowHapiUtilsOrderJourney
|
101
103
|
>
|
102
104
|
export type WindowHapiSDKProduct = WindowHapiSDKModule<
|
103
105
|
WindowHapiAPIProduct,
|
104
106
|
WindowHapiServiceProduct,
|
105
107
|
WindowHapiValidationsProduct,
|
106
|
-
WindowHapiStateModule<
|
108
|
+
WindowHapiStateModule<ProductState>,
|
107
109
|
WindowHapiUtilsProduct
|
108
110
|
>
|
109
111
|
export type WindowHapiSDKTheming = WindowHapiSDKModule<
|
110
112
|
undefined,
|
111
113
|
undefined,
|
112
114
|
WindowHapiValidationsTheming,
|
113
|
-
WindowHapiStateModule<
|
115
|
+
WindowHapiStateModule<ThemingState>
|
114
116
|
>
|
115
117
|
export type WindowHapiSDKWallet = WindowHapiSDKModule<
|
116
118
|
WindowHapiAPIWallet,
|
117
119
|
WindowHapiServiceWallet,
|
118
120
|
WindowHapiValidationsWallet,
|
119
|
-
WindowHapiStateModule<
|
121
|
+
WindowHapiStateModule<WalletState>
|
120
122
|
>
|
121
123
|
export type WindowHapiSDKUI = WindowHapiSDKModule<
|
122
124
|
undefined,
|
@@ -124,7 +126,7 @@ export type WindowHapiSDKUI = WindowHapiSDKModule<
|
|
124
126
|
undefined,
|
125
127
|
undefined
|
126
128
|
>
|
127
|
-
export type WindowHapiSDK =
|
129
|
+
export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
|
128
130
|
{
|
129
131
|
[WindowHapiModuleName.contract]: WindowHapiSDKContract
|
130
132
|
[WindowHapiModuleName.basket]: WindowHapiSDKBasket
|
@@ -137,11 +139,11 @@ export type WindowHapiSDK = ModuleWithConstructorArgs<
|
|
137
139
|
[WindowHapiModuleName.debugging]: WindowHapiSDKDebugging
|
138
140
|
[WindowHapiModuleName.alert]: WindowHapiSDKAlert
|
139
141
|
},
|
140
|
-
{ readonly core:
|
142
|
+
{ readonly core: WindowHapiClassInterface }
|
141
143
|
>
|
142
144
|
export type WindowHapiSDKModal = WindowHapiSDKModule<
|
143
145
|
undefined,
|
144
146
|
WindowHapiServiceModal,
|
145
147
|
undefined,
|
146
|
-
WindowHapiStateModule<
|
148
|
+
WindowHapiStateModule<ModalState>
|
147
149
|
>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { WindowHapiModuleName } from "
|
2
|
-
import { ModuleWithConstructorArgs } from "../types"
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
3
2
|
import { WindowHapiServiceAlert } from "../alert/service.types"
|
4
3
|
import { WindowHapiServiceBasket } from "../basket/service.types"
|
5
4
|
import { WindowHapiServiceCampaign } from "../campaign/service.types"
|
@@ -9,8 +8,11 @@ import { WindowHapiServiceWallet } from "../wallet/service.types"
|
|
9
8
|
import { WindowHapiServiceModal } from "../modal/service.types"
|
10
9
|
import { WindowHapiServiceUI } from "../ui/service.types"
|
11
10
|
import { WindowHapiServiceATS } from "../ats/service.types"
|
12
|
-
import {
|
13
|
-
|
11
|
+
import {
|
12
|
+
WindowHapiClassInterface,
|
13
|
+
WindowHapiModuleWithConstructorArgs,
|
14
|
+
} from "./window"
|
15
|
+
import { WindowHapiLogger } from "../common/logger/types"
|
14
16
|
|
15
17
|
export type HapiServiceFunctionLifecycleHookCallbackHandler = () =>
|
16
18
|
| void
|
@@ -31,10 +33,10 @@ export type HapiServiceFunctionWithLifecycleHooks<HandlerType> = {
|
|
31
33
|
|
32
34
|
export type HapiServiceBase = {
|
33
35
|
__serviceName: WindowHapiModuleName
|
34
|
-
logger:
|
36
|
+
logger: WindowHapiLogger
|
35
37
|
init: () => void
|
36
38
|
}
|
37
|
-
export type WindowHapiService =
|
39
|
+
export type WindowHapiService = WindowHapiModuleWithConstructorArgs<
|
38
40
|
{
|
39
41
|
[WindowHapiModuleName.alert]: WindowHapiServiceAlert
|
40
42
|
[WindowHapiModuleName.basket]: WindowHapiServiceBasket
|
@@ -63,5 +65,5 @@ export type WindowHapiService = ModuleWithConstructorArgs<
|
|
63
65
|
fn: HandlerType,
|
64
66
|
) => HapiServiceFunctionWithLifecycleHooks<HandlerType>
|
65
67
|
},
|
66
|
-
{ readonly core:
|
68
|
+
{ readonly core: WindowHapiClassInterface }
|
67
69
|
>
|
@@ -1,19 +1,21 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
1
|
+
import { AlertState } from "../alert/state.types"
|
2
|
+
import { BasketState } from "../basket/state.types"
|
3
|
+
import { CampaignState } from "../campaign/state.types"
|
4
|
+
import { ContractState } from "../contract/state.types"
|
5
|
+
import { DebuggingState } from "../debugging/state.types"
|
6
|
+
import { LanguageState } from "../language/state.types"
|
7
|
+
import { ProductState } from "../product/state.types"
|
8
|
+
import { ThemingState } from "../theming/state.types"
|
9
|
+
import { OrderJourneyState } from "../orderJourney/state.types"
|
10
|
+
import { WalletState } from "../wallet/state.types"
|
11
|
+
import { ModalState } from "../modal/state.types"
|
12
12
|
import { WindowHapiEventCommandCallbackHandler } from "../common/events/types"
|
13
|
-
import { WindowHapiModuleName } from "
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
|
13
|
+
import { WindowHapiModuleName } from "../common/enums"
|
14
|
+
import { ATSState } from "../ats/state.types"
|
15
|
+
import {
|
16
|
+
WindowHapiModuleWithConstructorArgs,
|
17
|
+
WindowHapiClassInterface,
|
18
|
+
} from "./window"
|
17
19
|
import { WindowHapiValidationsCommon } from "../common/validations.types"
|
18
20
|
import { WindowHapiValidationsBasket } from "../basket/validations.types"
|
19
21
|
import { WindowHapiValidationsCampaign } from "../campaign/validations.types"
|
@@ -25,57 +27,57 @@ import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.t
|
|
25
27
|
import { WindowHapiValidationsWallet } from "../wallet/validations.types"
|
26
28
|
import { WindowHapiValidations } from "./validation.types"
|
27
29
|
|
28
|
-
export type WindowHapiState =
|
30
|
+
export type WindowHapiState = WindowHapiModuleWithConstructorArgs<
|
29
31
|
{
|
30
|
-
[WindowHapiModuleName.alert]: WindowHapiStateModule<
|
31
|
-
[WindowHapiModuleName.basket]: WindowHapiStateModule<
|
32
|
-
[WindowHapiModuleName.campaign]: WindowHapiStateModule<
|
33
|
-
[WindowHapiModuleName.contract]: WindowHapiStateModule<
|
34
|
-
[WindowHapiModuleName.debugging]: WindowHapiStateModule<
|
35
|
-
[WindowHapiModuleName.language]: WindowHapiStateModule<
|
36
|
-
[WindowHapiModuleName.product]: WindowHapiStateModule<
|
37
|
-
[WindowHapiModuleName.theming]: WindowHapiStateModule<
|
38
|
-
[WindowHapiModuleName.orderJourney]: WindowHapiStateModule<
|
39
|
-
[WindowHapiModuleName.wallet]: WindowHapiStateModule<
|
40
|
-
[WindowHapiModuleName.modal]: WindowHapiStateModule<
|
41
|
-
[WindowHapiModuleName.ats]: WindowHapiStateModule<
|
32
|
+
[WindowHapiModuleName.alert]: WindowHapiStateModule<AlertState>
|
33
|
+
[WindowHapiModuleName.basket]: WindowHapiStateModule<BasketState>
|
34
|
+
[WindowHapiModuleName.campaign]: WindowHapiStateModule<CampaignState>
|
35
|
+
[WindowHapiModuleName.contract]: WindowHapiStateModule<ContractState>
|
36
|
+
[WindowHapiModuleName.debugging]: WindowHapiStateModule<DebuggingState>
|
37
|
+
[WindowHapiModuleName.language]: WindowHapiStateModule<LanguageState>
|
38
|
+
[WindowHapiModuleName.product]: WindowHapiStateModule<ProductState>
|
39
|
+
[WindowHapiModuleName.theming]: WindowHapiStateModule<ThemingState>
|
40
|
+
[WindowHapiModuleName.orderJourney]: WindowHapiStateModule<OrderJourneyState>
|
41
|
+
[WindowHapiModuleName.wallet]: WindowHapiStateModule<WalletState>
|
42
|
+
[WindowHapiModuleName.modal]: WindowHapiStateModule<ModalState>
|
43
|
+
[WindowHapiModuleName.ats]: WindowHapiStateModule<ATSState>
|
42
44
|
getModuleByName: (
|
43
45
|
name: string,
|
44
46
|
) => WindowHapiStateModule<any> | undefined
|
45
47
|
handleDefaultStateFromQueryParams: (params: string | string[]) => void
|
46
48
|
shouldPreventStateDispatch: boolean
|
47
49
|
stores: {
|
48
|
-
alert: WindowHapiStateModule<
|
49
|
-
basket: WindowHapiStateModule<
|
50
|
-
campaign: WindowHapiStateModule<
|
51
|
-
contract: WindowHapiStateModule<
|
52
|
-
debugging: WindowHapiStateModule<
|
53
|
-
language: WindowHapiStateModule<
|
54
|
-
product: WindowHapiStateModule<
|
55
|
-
theming: WindowHapiStateModule<
|
56
|
-
orderJourney: WindowHapiStateModule<
|
57
|
-
wallet: WindowHapiStateModule<
|
58
|
-
modal: WindowHapiStateModule<
|
59
|
-
ats: WindowHapiStateModule<
|
50
|
+
alert: WindowHapiStateModule<AlertState>
|
51
|
+
basket: WindowHapiStateModule<BasketState>
|
52
|
+
campaign: WindowHapiStateModule<CampaignState>
|
53
|
+
contract: WindowHapiStateModule<ContractState>
|
54
|
+
debugging: WindowHapiStateModule<DebuggingState>
|
55
|
+
language: WindowHapiStateModule<LanguageState>
|
56
|
+
product: WindowHapiStateModule<ProductState>
|
57
|
+
theming: WindowHapiStateModule<ThemingState>
|
58
|
+
orderJourney: WindowHapiStateModule<OrderJourneyState>
|
59
|
+
wallet: WindowHapiStateModule<WalletState>
|
60
|
+
modal: WindowHapiStateModule<ModalState>
|
61
|
+
ats: WindowHapiStateModule<ATSState>
|
60
62
|
}
|
61
63
|
toJSON: Record<string, any>
|
62
64
|
},
|
63
|
-
{ readonly core:
|
65
|
+
{ readonly core: WindowHapiClassInterface }
|
64
66
|
>
|
65
67
|
|
66
68
|
export type WindowHapiStatesJSON = {
|
67
|
-
[WindowHapiModuleName.alert]:
|
68
|
-
[WindowHapiModuleName.basket]:
|
69
|
-
[WindowHapiModuleName.campaign]:
|
70
|
-
[WindowHapiModuleName.contract]:
|
71
|
-
[WindowHapiModuleName.debugging]:
|
72
|
-
[WindowHapiModuleName.language]:
|
73
|
-
[WindowHapiModuleName.product]:
|
74
|
-
[WindowHapiModuleName.theming]:
|
75
|
-
[WindowHapiModuleName.orderJourney]:
|
76
|
-
[WindowHapiModuleName.wallet]:
|
77
|
-
[WindowHapiModuleName.modal]:
|
78
|
-
[WindowHapiModuleName.ats]:
|
69
|
+
[WindowHapiModuleName.alert]: AlertState
|
70
|
+
[WindowHapiModuleName.basket]: BasketState
|
71
|
+
[WindowHapiModuleName.campaign]: CampaignState
|
72
|
+
[WindowHapiModuleName.contract]: ContractState
|
73
|
+
[WindowHapiModuleName.debugging]: DebuggingState
|
74
|
+
[WindowHapiModuleName.language]: LanguageState
|
75
|
+
[WindowHapiModuleName.product]: ProductState
|
76
|
+
[WindowHapiModuleName.theming]: ThemingState
|
77
|
+
[WindowHapiModuleName.orderJourney]: OrderJourneyState
|
78
|
+
[WindowHapiModuleName.wallet]: WalletState
|
79
|
+
[WindowHapiModuleName.modal]: ModalState
|
80
|
+
[WindowHapiModuleName.ats]: ATSState
|
79
81
|
}
|
80
82
|
|
81
83
|
export type WindowHapiStateBase = {
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import {
|
2
|
+
WindowHapiModuleWithConstructorArgs,
|
3
|
+
WindowHapiClassInterface,
|
4
|
+
} from "./window"
|
5
|
+
|
6
|
+
export type WindowHapiUI = WindowHapiModuleWithConstructorArgs<
|
7
|
+
{
|
8
|
+
addUIElementToBody: (
|
9
|
+
elementName: "he-ui-modals" | "he-ui-alertbar",
|
10
|
+
) => void
|
11
|
+
toggleModal: () => void
|
12
|
+
toggleAlertbar: () => void
|
13
|
+
},
|
14
|
+
{ readonly core: WindowHapiClassInterface }
|
15
|
+
>
|
@@ -1,13 +1,15 @@
|
|
1
|
-
import { WindowHapiModuleName } from "
|
2
|
-
import { ModuleWithConstructorArgs } from "../types"
|
1
|
+
import { WindowHapiModuleName } from "../common/enums"
|
3
2
|
import { WindowHapiUtilsProduct } from "../product/utils.types"
|
4
3
|
import { WindowHapiUtilsContract } from "../contract/utils.types"
|
5
4
|
import { WindowHapiUtilsCampaign } from "../campaign/utils.types"
|
6
5
|
import { WindowHapiUtilsBasket } from "../basket/utils.types"
|
7
6
|
import { WindowHapiUtilsOrderJourney } from "../orderJourney/utils.types"
|
8
|
-
import {
|
7
|
+
import {
|
8
|
+
WindowHapiModuleWithConstructorArgs,
|
9
|
+
WindowHapiClassInterface,
|
10
|
+
} from "./window"
|
9
11
|
|
10
|
-
export type WindowHapiUtils =
|
12
|
+
export type WindowHapiUtils = WindowHapiModuleWithConstructorArgs<
|
11
13
|
{
|
12
14
|
isObject: (item: any) => boolean
|
13
15
|
mergeDeepOverwriteArrays: (
|
@@ -30,5 +32,5 @@ export type WindowHapiUtils = ModuleWithConstructorArgs<
|
|
30
32
|
[WindowHapiModuleName.orderJourney]: WindowHapiUtilsOrderJourney
|
31
33
|
}
|
32
34
|
},
|
33
|
-
{ readonly core:
|
35
|
+
{ readonly core: WindowHapiClassInterface }
|
34
36
|
>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { z } from "zod"
|
2
|
-
import { WindowHapiModuleName } from "
|
3
|
-
import {
|
4
|
-
|
2
|
+
import { WindowHapiModuleName } from "../common/enums"
|
3
|
+
import {
|
4
|
+
WindowHapiModuleWithConstructorArgs,
|
5
|
+
WindowHapiClassInterface,
|
6
|
+
} from "./window"
|
5
7
|
import { WindowHapiValidationsCommon } from "../common/validations.types"
|
6
8
|
import { WindowHapiValidationsProduct } from "../product/validations.types"
|
7
9
|
import { WindowHapiValidationsContract } from "../contract/validations.types"
|
@@ -12,7 +14,7 @@ import { WindowHapiValidationsTheming } from "../theming/validations.types"
|
|
12
14
|
import { WindowHapiValidationsLanguage } from "../language/validations.types"
|
13
15
|
import { WindowHapiValidationsOrderJourney } from "../orderJourney/validations.types"
|
14
16
|
|
15
|
-
export type WindowHapiValidations =
|
17
|
+
export type WindowHapiValidations = WindowHapiModuleWithConstructorArgs<
|
16
18
|
{
|
17
19
|
validator: typeof z
|
18
20
|
messages: Record<string, string | Function>
|
@@ -35,7 +37,7 @@ export type WindowHapiValidations = ModuleWithConstructorArgs<
|
|
35
37
|
) => void
|
36
38
|
runSDKEventsValidations: (callback: Function) => void
|
37
39
|
},
|
38
|
-
{ readonly core:
|
40
|
+
{ readonly core: WindowHapiClassInterface }
|
39
41
|
>
|
40
42
|
|
41
43
|
export type ValidationSubmoduleConstructorArgs = {
|