@vonq/hapi-elements-types 1.5.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.
Files changed (156) hide show
  1. package/package.json +15 -4
  2. package/src/_window/api.types.ts +9 -7
  3. package/src/_window/auth.types.ts +6 -4
  4. package/src/_window/config.types.ts +0 -25
  5. package/src/_window/events.types.ts +15 -14
  6. package/src/_window/instances.types.ts +19 -10
  7. package/src/_window/qa.types.ts +7 -5
  8. package/src/_window/routing.types.ts +6 -4
  9. package/src/_window/sdk.types.ts +29 -27
  10. package/src/_window/service.types.ts +9 -7
  11. package/src/_window/state.types.ts +55 -53
  12. package/src/_window/ui.types.ts +6 -4
  13. package/src/_window/utils.types.ts +7 -5
  14. package/src/_window/validation.types.ts +7 -5
  15. package/src/_window/window.ts +126 -42
  16. package/src/alert/index.ts +4 -7
  17. package/src/alert/service.types.ts +2 -2
  18. package/src/alert/state.types.ts +1 -19
  19. package/src/ats/api.types.ts +2 -2
  20. package/src/ats/index.ts +4 -7
  21. package/src/ats/service.types.ts +2 -2
  22. package/src/ats/state.types.ts +1 -1
  23. package/src/basket/index.ts +5 -10
  24. package/src/basket/service.types.ts +2 -2
  25. package/src/basket/state.types.ts +1 -1
  26. package/src/basket/utils.types.ts +2 -2
  27. package/src/campaign/api.types.ts +2 -2
  28. package/src/campaign/index.ts +8 -13
  29. package/src/campaign/qa.types.ts +4 -4
  30. package/src/campaign/service.types.ts +2 -2
  31. package/src/campaign/state.types.ts +1 -1
  32. package/src/campaign/utils.types.ts +2 -2
  33. package/{enums.ts → src/common/enums.ts} +2 -1
  34. package/src/common/events/types.ts +6 -6
  35. package/src/common/index.ts +5 -20
  36. package/src/common/logger/types.ts +11 -0
  37. package/src/common/qa.types.ts +2 -2
  38. package/src/common/types.ts +5 -6
  39. package/src/common/validator/types.ts +4 -0
  40. package/src/contract/api.types.ts +2 -2
  41. package/src/contract/index.ts +7 -12
  42. package/src/contract/qa.types.ts +2 -2
  43. package/src/contract/service.types.ts +2 -2
  44. package/src/contract/state.types.ts +1 -1
  45. package/src/contract/utils.types.ts +2 -2
  46. package/src/debugging/index.ts +1 -4
  47. package/src/debugging/state.types.ts +1 -1
  48. package/src/index.ts +16 -20
  49. package/src/language/index.ts +3 -9
  50. package/src/language/qa.types.ts +2 -2
  51. package/src/language/state.types.ts +1 -1
  52. package/src/modal/index.ts +4 -9
  53. package/src/modal/service.types.ts +2 -2
  54. package/src/modal/state.types.ts +1 -1
  55. package/src/orderJourney/index.ts +6 -11
  56. package/src/orderJourney/qa.types.ts +2 -2
  57. package/src/orderJourney/state.types.ts +1 -1
  58. package/src/orderJourney/utils.types.ts +2 -2
  59. package/src/product/api.types.ts +2 -2
  60. package/src/product/index.ts +8 -12
  61. package/src/product/qa.types.ts +2 -2
  62. package/src/product/service.types.ts +2 -2
  63. package/src/product/state.types.ts +1 -1
  64. package/src/product/utils.types.ts +2 -2
  65. package/src/routing/index.ts +1 -3
  66. package/src/theming/index.ts +4 -9
  67. package/src/theming/qa.types.ts +2 -2
  68. package/src/theming/state.types.ts +1 -1
  69. package/src/ui/service.types.ts +2 -2
  70. package/src/wallet/api.types.ts +2 -2
  71. package/src/wallet/index.ts +5 -9
  72. package/src/wallet/service.types.ts +2 -2
  73. package/src/wallet/state.types.ts +1 -1
  74. package/tsconfig.json +6 -11
  75. package/src/alert/functions.types.ts +0 -13
  76. package/src/alert/state.initial.ts +0 -16
  77. package/src/alert/state.validations.ts +0 -11
  78. package/src/ats/functions.types.ts +0 -7
  79. package/src/ats/state.initial.ts +0 -5
  80. package/src/ats/state.validations.ts +0 -6
  81. package/src/basket/consts.ts +0 -1
  82. package/src/basket/functions.types.ts +0 -40
  83. package/src/basket/state.initial.ts +0 -11
  84. package/src/basket/state.validations.ts +0 -12
  85. package/src/basket/utils.ts +0 -79
  86. package/src/campaign/consts.ts +0 -1
  87. package/src/campaign/functions.types.ts +0 -90
  88. package/src/campaign/state.initial.ts +0 -84
  89. package/src/campaign/state.validations.ts +0 -16
  90. package/src/campaign/utils.ts +0 -53
  91. package/src/common/LocalStorage.ts +0 -123
  92. package/src/common/browser.ts +0 -2
  93. package/src/common/color.ts +0 -9
  94. package/src/common/immutable.ts +0 -28
  95. package/src/common/instances/Instance.ts +0 -13
  96. package/src/common/instances/consts.ts +0 -1
  97. package/src/common/instances/index.ts +0 -4
  98. package/src/common/json.ts +0 -25
  99. package/src/common/logger/Logger.ts +0 -70
  100. package/src/common/logger/index.ts +0 -5
  101. package/src/common/logger-datadog/LoggerDatadog.ts +0 -42
  102. package/src/common/logger-datadog/index.ts +0 -3
  103. package/src/common/misc.ts +0 -114
  104. package/src/common/promise.ts +0 -161
  105. package/src/common/proxy.ts +0 -77
  106. package/src/common/regExTest.ts +0 -12
  107. package/src/common/tree.ts +0 -148
  108. package/src/common/utm.ts +0 -19
  109. package/src/common/validators.ts +0 -21
  110. package/src/common/webComponents.ts +0 -26
  111. package/src/config/functions.types.ts +0 -23
  112. package/src/config/index.ts +0 -5
  113. package/src/config/state.initial.ts +0 -11
  114. package/src/config/state.types.ts +0 -15
  115. package/src/consts.ts +0 -980
  116. package/src/contract/consts.ts +0 -1
  117. package/src/contract/functions.types.ts +0 -112
  118. package/src/contract/state.initial.ts +0 -39
  119. package/src/contract/state.validations.ts +0 -21
  120. package/src/contract/utils.ts +0 -36
  121. package/src/debugging/functions.types.ts +0 -34
  122. package/src/debugging/state.initial.ts +0 -10
  123. package/src/debugging/state.validations.ts +0 -10
  124. package/src/language/consts.ts +0 -6
  125. package/src/language/en.ts +0 -530
  126. package/src/language/functions.types.ts +0 -29
  127. package/src/language/state.initial.ts +0 -13
  128. package/src/language/state.validations.ts +0 -10
  129. package/src/language/utils.ts +0 -17
  130. package/src/modal/consts.ts +0 -6
  131. package/src/modal/functions.types.ts +0 -22
  132. package/src/modal/state.initial.ts +0 -9
  133. package/src/modal/state.validations.ts +0 -6
  134. package/src/modal/store.types.ts +0 -5
  135. package/src/orderJourney/consts.ts +0 -289
  136. package/src/orderJourney/functions.types.ts +0 -140
  137. package/src/orderJourney/state.initial.ts +0 -401
  138. package/src/orderJourney/state.validations.ts +0 -78
  139. package/src/orderJourney/utils.ts +0 -7
  140. package/src/product/consts.ts +0 -1
  141. package/src/product/functions.types.ts +0 -156
  142. package/src/product/state.initial.ts +0 -28
  143. package/src/product/state.validations.ts +0 -25
  144. package/src/routing/functions.types.ts +0 -48
  145. package/src/routing/state.initial.ts +0 -10
  146. package/src/theming/consts.ts +0 -7727
  147. package/src/theming/functions.types.ts +0 -13
  148. package/src/theming/state.initial.ts +0 -16
  149. package/src/theming/state.validations.ts +0 -8
  150. package/src/theming/utils.ts +0 -581
  151. package/src/types.ts +0 -229
  152. package/src/utils.ts +0 -3
  153. package/src/wallet/consts.ts +0 -3
  154. package/src/wallet/functions.types.ts +0 -58
  155. package/src/wallet/state.initial.ts +0 -18
  156. package/src/wallet/state.validations.ts +0 -18
package/src/types.ts DELETED
@@ -1,229 +0,0 @@
1
- import React from "react"
2
- import { WindowHapiState } from "./_window/state.types"
3
- import { WindowHapiAuth } from "./_window/auth.types"
4
- import { WindowHapiUI } from "./_window/ui.types"
5
- import HapiInstance from "./common/instances/Instance"
6
- import { WindowHapiQA } from "./_window/qa.types"
7
- import { ProductStoreState } from "./product/state.types"
8
- import { ProductStoreFunctions } from "./product/functions.types"
9
- import { BasketStoreState } from "./basket/state.types"
10
- import { BasketStoreFunctions } from "./basket/functions.types"
11
- import { ModalStore } from "./modal/store.types"
12
- import { ModalStoreState } from "./modal/state.types"
13
- import { ModalStoreFunctions } from "./modal/functions.types"
14
- import { ContractStoreState } from "./contract/state.types"
15
- import { ContractStoreFunctions } from "./contract/functions.types"
16
- import { AlertStoreState } from "./alert/state.types"
17
- import { AlertStoreFunctions } from "./alert/functions.types"
18
- import { OrderJourneyStoreState } from "./orderJourney/state.types"
19
- import { OrderJourneyStoreFunctions } from "./orderJourney/functions.types"
20
- import { CampaignStoreState } from "./campaign/state.types"
21
- import { CampaignStoreFunctions } from "./campaign/functions.types"
22
- import { WalletStoreState } from "./wallet/state.types"
23
- import { WalletStoreFunctions } from "./wallet/functions.types"
24
- import { ThemeStoreState } from "./theming/state.types"
25
- import { ThemeStoreFunctions } from "./theming/functions.types"
26
- import { RouterStoreState } from "./routing/state.types"
27
- import { RouterStoreFunctions } from "./routing/functions.types"
28
- import { ConfigStoreState } from "./config/state.types"
29
- import { ConfigStoreFunctions } from "./config/functions.types"
30
- import { LanguageStoreState } from "./language/state.types"
31
- import { LanguageStoreFunctions } from "./language/functions.types"
32
- import { DebuggingStoreState } from "./debugging/state.types"
33
- import { DebuggingStoreFunctions } from "./debugging/functions.types"
34
- import { IntlShape } from "react-intl"
35
- import { Logger } from "./common/logger/Logger"
36
- import { IReactionDisposer } from "mobx"
37
- import { ATSStoreState } from "./ats/state.types"
38
- import { ATSStoreFunctions } from "./ats/functions.types"
39
- import { WindowHapiValidations } from "./_window/validation.types"
40
- import { WindowHapiUtils } from "./_window/utils.types"
41
- import { WindowHapiRouting } from "./_window/routing.types"
42
- import { WindowHapiInstances } from "./_window/instances.types"
43
- import { WindowHapiSDK } from "./_window/sdk.types"
44
- import { WindowHapiService } from "./_window/service.types"
45
- import { WindowHapiEvents } from "./_window/events.types"
46
- import { WindowHapiAPI } from "./_window/api.types"
47
- import { WindowHapiConfig } from "./_window/config.types"
48
- import { RecursivePartial } from "./common/types"
49
-
50
- export type ComponentWithChildren = {
51
- children?: React.ReactNode
52
- }
53
-
54
- export type WindowHAPIInterface = {
55
- hapiState: WindowHapiState
56
- hapiAuth: WindowHapiAuth
57
- hapiConfig: WindowHapiConfig
58
- hapiEvents: WindowHapiEvents
59
- hapiInstances: WindowHapiInstances
60
- hapiRouting: WindowHapiRouting
61
- hapiUI: WindowHapiUI
62
- hapiUtils: WindowHapiUtils
63
- hapiInstance: HapiInstance
64
- hapiValidation: WindowHapiValidations
65
- hapi: WindowHapiSDK
66
- hapiApi: WindowHapiAPI
67
- hapiService: WindowHapiService
68
- hapiQA: WindowHapiQA
69
- __hapi: IRootStore
70
- __mobxToJS: <T>(source: T, options?: any) => T
71
- }
72
- export type BaseStoreFunctions = {
73
- init: () => void
74
- }
75
- export type CreateLoggerHandler = (
76
- source?: string,
77
- isEnabled?: boolean,
78
- ) => Logger
79
- export type IRootStore = {
80
- store: Stores
81
- rehydrateStore: (
82
- storeName: keyof Stores,
83
- storeData: RecursivePartial<Stores[keyof Stores]>,
84
- ) => void
85
- intl: IntlShape
86
- createLogger: CreateLoggerHandler
87
-
88
- sourceInstance: HapiInstance
89
- targetInstances: HapiInstance[]
90
- }
91
- export type BaseStoreVariables = {
92
- rootStore: IRootStore
93
- }
94
- export type BaseStoreVariablesAndFunctions = BaseStoreVariables &
95
- BaseStoreFunctions
96
- export type BaseStore<State, Functions> = BaseStoreVariablesAndFunctions &
97
- State &
98
- Functions
99
- export type ConfigStore = BaseStore<ConfigStoreState, ConfigStoreFunctions>
100
- export type ConfigStoreType = StoryFactoryType<
101
- ConfigStore,
102
- ConfigStoreState,
103
- ConfigStoreFunctions
104
- >
105
- export type ATSStore = BaseStore<ATSStoreState, ATSStoreFunctions>
106
- export type ATSStoreType = StoryFactoryType<
107
- ATSStore,
108
- ATSStoreState,
109
- ATSStoreFunctions
110
- >
111
- export type LanguageStore = BaseStore<
112
- LanguageStoreState,
113
- LanguageStoreFunctions
114
- >
115
- export type LanguageStoreType = StoryFactoryType<
116
- LanguageStore,
117
- LanguageStoreState,
118
- LanguageStoreFunctions
119
- >
120
- export type AlertStore = BaseStore<AlertStoreState, AlertStoreFunctions>
121
- export type AlertStoreType = StoryFactoryType<
122
- AlertStore,
123
- AlertStoreState,
124
- AlertStoreFunctions
125
- >
126
- export type ThemeStore = BaseStore<ThemeStoreState, ThemeStoreFunctions>
127
- export type ThemeStoreType = StoryFactoryType<
128
- ThemeStore,
129
- ThemeStoreState,
130
- ThemeStoreFunctions
131
- >
132
- export type RouterStore = BaseStore<RouterStoreState, RouterStoreFunctions>
133
- export type RouterStoreType = StoryFactoryType<
134
- RouterStore,
135
- RouterStoreState,
136
- RouterStoreFunctions
137
- >
138
- export type ContractStore = BaseStore<
139
- ContractStoreState,
140
- ContractStoreFunctions
141
- >
142
- export type ContractStoreType = StoryFactoryType<
143
- ContractStore,
144
- ContractStoreState,
145
- ContractStoreFunctions
146
- >
147
- export type ProductStore = BaseStore<ProductStoreState, ProductStoreFunctions>
148
- export type ProductStoreType = StoryFactoryType<
149
- ProductStore,
150
- ProductStoreState,
151
- ProductStoreFunctions
152
- >
153
- export type CampaignStore = BaseStore<
154
- CampaignStoreState,
155
- CampaignStoreFunctions
156
- >
157
- export type CampaignStoreType = StoryFactoryType<
158
- CampaignStore,
159
- CampaignStoreState,
160
- CampaignStoreFunctions
161
- >
162
- export type WalletStore = BaseStore<WalletStoreState, WalletStoreFunctions>
163
- export type WalletStoreType = StoryFactoryType<
164
- WalletStore,
165
- WalletStoreState,
166
- WalletStoreFunctions
167
- >
168
- export type BasketStore = BaseStore<BasketStoreState, BasketStoreFunctions>
169
- export type BasketStoreType = StoryFactoryType<
170
- BasketStore,
171
- BasketStoreState,
172
- BasketStoreFunctions
173
- >
174
- export type ModalStoreType = StoryFactoryType<
175
- ModalStore,
176
- ModalStoreState,
177
- ModalStoreFunctions
178
- >
179
- export type OrderJourneyStore = BaseStore<
180
- OrderJourneyStoreState,
181
- OrderJourneyStoreFunctions
182
- >
183
- export type OrderJourneyStoreType = StoryFactoryType<
184
- OrderJourneyStore,
185
- OrderJourneyStoreState,
186
- OrderJourneyStoreFunctions
187
- >
188
- export type DebuggingStore = BaseStore<
189
- DebuggingStoreState,
190
- DebuggingStoreFunctions
191
- >
192
- export type DebuggingStoreType = StoryFactoryType<
193
- DebuggingStore,
194
- DebuggingStoreState,
195
- DebuggingStoreFunctions
196
- >
197
- export type Stores = {
198
- atsStore: ATSStoreType
199
- configStore: ConfigStoreType
200
- languageStore: LanguageStoreType
201
- alertStore: AlertStoreType
202
- themeStore: ThemeStoreType
203
- contractStore: ContractStoreType
204
- productStore: ProductStoreType
205
- routerStore: RouterStoreType
206
- campaignStore: CampaignStoreType
207
- modalStore: ModalStoreType
208
- walletStore: WalletStoreType
209
- basketStore: BasketStoreType
210
- orderJourneyStore: OrderJourneyStoreType
211
- debuggingStore: DebuggingStoreType
212
- }
213
- export type CommonStoreVariablesAndFunctions = {
214
- init: (...args: any[]) => void | Promise<void>
215
- logger: Logger
216
- classObserver: StoreClassObserver | undefined
217
- toJSON: JSON
218
- }
219
- export type StoreClassObserver = IReactionDisposer
220
- export type StoreFactory<Store, _StoreState, _StoreFunctions> =
221
- CommonStoreVariablesAndFunctions
222
- export type StoryFactoryType<Store, _StoreState, _StoreFunctions> =
223
- StoreFactory<Store, _StoreState, _StoreFunctions> &
224
- _StoreState &
225
- _StoreFunctions
226
- export type DemoATSLayoutType = "technical" | "product-oriented"
227
-
228
- export type ModuleWithConstructorArgs<Module, ConstructorArgs> = Module &
229
- ConstructorArgs
package/src/utils.ts DELETED
@@ -1,3 +0,0 @@
1
- export const isZodInstance = (object: Record<any, any>) => {
2
- return object?._def && object?.parse
3
- }
@@ -1,3 +0,0 @@
1
- export const WALLET_BILLING_PORTAL_LINK_EXPIRY_IN_MINUTES = 4.5 //normally its 5 but lets make it 4.5
2
- export const WALLET_BILLING_PORTAL_LINK_EXPIRY_IN_SECONDS =
3
- WALLET_BILLING_PORTAL_LINK_EXPIRY_IN_MINUTES * 60
@@ -1,58 +0,0 @@
1
- import { ProductPriceCurrency } from "../product/enums"
2
- import { Wallet, WalletPaymentIntentPaymentMethod } from "./types"
3
-
4
- export type WalletStoreSetWalletHandler = (wallet: Wallet) => void
5
- export type WalletStoreSetIsWalletLoadingHandler = (isLoading: boolean) => void
6
- export type WalletStoreSetTopUpIsLoadingHandler = (isLoading: boolean) => void
7
- export type WalletStoreSetTopUpAmountHandler = (amount: number) => void
8
- export type WalletStoreSetTopUpMinAmountHandler = (amount: number) => void
9
- export type WalletStoreSetTopUpMinAmountCurrencyHandler = (
10
- currency: ProductPriceCurrency,
11
- ) => void
12
- export type WalletStoreSetTopUpTermsOfServiceIsAgreedHandler = (
13
- isAgreed: boolean,
14
- ) => void
15
- export type WalletStoreSetStripeClientSecretHandler = (client: string) => void
16
- export type WalletStoreSetTopUpCurrentStepIndexHandler = (step: number) => void
17
- export type WalletStoreSetTopUpPaymentMethodTypesHandler = (
18
- type: WalletPaymentIntentPaymentMethod[],
19
- ) => void
20
-
21
- export type WalletStoreFunctions = {
22
- /**
23
- * The function that sets the value of `wallet`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
24
- */
25
- setWallet: WalletStoreSetWalletHandler
26
- /**
27
- * The function that sets the value of `walletIsLoading`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
28
- */
29
- setWalletIsLoading: WalletStoreSetIsWalletLoadingHandler
30
- /**
31
- * The function that sets the value of `topUpIsLoading`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
32
- */
33
- setTopUpIsLoading: WalletStoreSetTopUpIsLoadingHandler
34
- /**
35
- * The function that sets the value of `topUpAmount`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
36
- */
37
- setTopUpAmount: WalletStoreSetTopUpAmountHandler
38
- /**
39
- * The function that sets the value of `topUpMinAmount`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
40
- */
41
- setTopUpMinAmount: WalletStoreSetTopUpMinAmountHandler
42
- /**
43
- * The function that sets the value of `topUpMinAmountCurrency`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
44
- */
45
- setTopUpMinAmountCurrency: WalletStoreSetTopUpMinAmountCurrencyHandler
46
- /**
47
- * The function that sets the value of `topUpTermsOfServiceIsAgreed`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
48
- */
49
- setTopUpTermsOfServiceIsAgreed: WalletStoreSetTopUpTermsOfServiceIsAgreedHandler
50
- /**
51
- * The function that sets the value of `topUpCurrentStepIndex`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
52
- */
53
- setTopUpCurrentStepIndex: WalletStoreSetTopUpCurrentStepIndexHandler
54
- /**
55
- * The function that sets the value of `topUpPaymentMethodTypes`. Refer to [WalletStoreState](/docs/sdk/wallet/#walletstorestate) for more details.
56
- */
57
- setTopUpPaymentMethodTypes: WalletStoreSetTopUpPaymentMethodTypesHandler
58
- }
@@ -1,18 +0,0 @@
1
- import { ProductPriceCurrency } from "../product/enums"
2
- import { WalletStoreState } from "./state.types"
3
-
4
- export const initialWalletStoreState: WalletStoreState = {
5
- balanceIsEnoughToOrderCampaign: false,
6
- balanceInUSD: null,
7
- paymentIntentRequestBody: null,
8
- paymentIntentClientSecret: null,
9
- topUpPaymentMethodTypes: ["card"],
10
- wallet: null,
11
- walletIsLoading: false,
12
- topUpIsLoading: false,
13
- topUpAmount: 0,
14
- topUpMinAmount: 0,
15
- topUpMinAmountCurrency: ProductPriceCurrency.USD,
16
- topUpTermsOfServiceIsAgreed: false,
17
- topUpCurrentStepIndex: 0,
18
- }
@@ -1,18 +0,0 @@
1
- import { WalletStoreState } from "./state.types"
2
- import { StateValidations } from "../_window/state.types"
3
-
4
- export const walletStoreStateValidations: StateValidations<WalletStoreState> = {
5
- wallet: "wallet.wallet",
6
- walletIsLoading: "common.genericBoolean",
7
- balanceInUSD: "throwHasNoSetterError",
8
- balanceIsEnoughToOrderCampaign: "throwHasNoSetterError",
9
- topUpPaymentMethodTypes: "common.genericStringArray",
10
- paymentIntentRequestBody: "throwHasNoSetterError",
11
- paymentIntentClientSecret: "common.genericNullableString",
12
- topUpIsLoading: "common.genericBoolean",
13
- topUpAmount: "common.genericNumber",
14
- topUpMinAmount: "common.genericNumber",
15
- topUpMinAmountCurrency: "product.currency",
16
- topUpTermsOfServiceIsAgreed: "common.genericBoolean",
17
- topUpCurrentStepIndex: "common.genericNumber",
18
- }