@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
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Wallet, WalletATSSettings, WalletPaymentIntentRequest } from "./types"
|
2
|
+
import {
|
3
|
+
HapiServiceFunctionWithLifecycleHooks,
|
4
|
+
WindowHapiService,
|
5
|
+
} from "../_window/service.types"
|
6
|
+
import { WindowHapiModuleWithConstructorArgs } from "../_window"
|
7
|
+
|
8
|
+
export type WalletServiceGetATSSettingsHandler =
|
9
|
+
() => Promise<WalletATSSettings>
|
10
|
+
export type WalletServiceGetWalletHandler = (
|
11
|
+
preventSettingIsLoading?: boolean,
|
12
|
+
) => Promise<Wallet>
|
13
|
+
export type WalletServiceCreateWalletHandler = () => Promise<Wallet>
|
14
|
+
|
15
|
+
export type WindowHapiServiceWallet = WindowHapiModuleWithConstructorArgs<
|
16
|
+
{
|
17
|
+
getATSSettings: HapiServiceFunctionWithLifecycleHooks<WalletServiceGetATSSettingsHandler>
|
18
|
+
getWallet: HapiServiceFunctionWithLifecycleHooks<WalletServiceGetWalletHandler>
|
19
|
+
createWallet: HapiServiceFunctionWithLifecycleHooks<WalletServiceCreateWalletHandler>
|
20
|
+
createPaymentIntent: (
|
21
|
+
paymentParams: WalletPaymentIntentRequest,
|
22
|
+
) => Promise<void>
|
23
|
+
resetTopUpState: () => void
|
24
|
+
},
|
25
|
+
{ readonly service: WindowHapiService }
|
26
|
+
>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { ProductPriceCurrency } from "../product/enums"
|
2
|
+
import {
|
3
|
+
Wallet,
|
4
|
+
WalletPaymentIntentPaymentMethod,
|
5
|
+
WalletPaymentIntentRequest,
|
6
|
+
} from "./types"
|
7
|
+
|
8
|
+
export type WalletState = {
|
9
|
+
/**
|
10
|
+
* User's Wallet that can hold credits to be used on Creating/Ordering a Campaign
|
11
|
+
*/
|
12
|
+
wallet: Wallet | null
|
13
|
+
/**
|
14
|
+
* User's balance in dollars converted from cents through `wallet.balance`. **This value is a computed getter meaning that it cannot be set from outside**
|
15
|
+
*/
|
16
|
+
balanceInUSD: number | null
|
17
|
+
/**
|
18
|
+
* Indicates whether or not user has enough credits/balance to Order a Campaign
|
19
|
+
*/
|
20
|
+
balanceIsEnoughToOrderCampaign: boolean
|
21
|
+
/**
|
22
|
+
* Shows a loading spinner while wallet is loading
|
23
|
+
*/
|
24
|
+
walletIsLoading: boolean
|
25
|
+
/**
|
26
|
+
* The request body to be sent to HAPI Backend Service to create a payment intent. **This value is a computed getter meaning that it cannot be set from outside**
|
27
|
+
*/
|
28
|
+
paymentIntentRequestBody: WalletPaymentIntentRequest | null
|
29
|
+
paymentIntentClientSecret: string | null
|
30
|
+
/**
|
31
|
+
* Shows a loading spinner while PaymentIntent is creating
|
32
|
+
*/
|
33
|
+
topUpIsLoading: boolean
|
34
|
+
/**
|
35
|
+
* A custom amount to specify for the top up of balance
|
36
|
+
*/
|
37
|
+
topUpAmount: number
|
38
|
+
/**
|
39
|
+
* A minimum amount enforced by an ATS for the top up of balance
|
40
|
+
*/
|
41
|
+
topUpMinAmount: number
|
42
|
+
/**
|
43
|
+
* A minimum amount's currency enforced by an ATS for the top up of balance
|
44
|
+
*/
|
45
|
+
topUpMinAmountCurrency: ProductPriceCurrency
|
46
|
+
/**
|
47
|
+
* Indicates if user has agreed to terms of service
|
48
|
+
*/
|
49
|
+
topUpTermsOfServiceIsAgreed: boolean
|
50
|
+
/**
|
51
|
+
* Step of the popup. **Should not be edited from outside**
|
52
|
+
*/
|
53
|
+
topUpCurrentStepIndex: number
|
54
|
+
/**
|
55
|
+
* An array of payment method types that Stripe accepts https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_types to specify which types of payment methods the end user can use
|
56
|
+
*/
|
57
|
+
topUpPaymentMethodTypes: WalletPaymentIntentPaymentMethod[]
|
58
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { ProductPriceCurrency } from "../product/enums"
|
2
|
+
|
3
|
+
export type WalletBalanceInCents = {
|
4
|
+
USD: number
|
5
|
+
}
|
6
|
+
|
7
|
+
export type Wallet = {
|
8
|
+
balance: WalletBalanceInCents
|
9
|
+
created_date: string
|
10
|
+
has_billing_details: boolean
|
11
|
+
id: string
|
12
|
+
}
|
13
|
+
|
14
|
+
export type WalletATSSettings = {
|
15
|
+
topUpAmount: number
|
16
|
+
topUpMinAmount: number
|
17
|
+
topUpPaymentMethodTypes: WalletPaymentIntentPaymentMethod[]
|
18
|
+
topUpMinAmountCurrency: ProductPriceCurrency
|
19
|
+
}
|
20
|
+
|
21
|
+
export type WalletCreateForm = {
|
22
|
+
customerName: string
|
23
|
+
}
|
24
|
+
|
25
|
+
export type WalletBillingPortalLinkResponse = {
|
26
|
+
billingPortalLink: string
|
27
|
+
}
|
28
|
+
|
29
|
+
export type WalletPaymentIntentPaymentMethod =
|
30
|
+
| "card"
|
31
|
+
| "acss_debit"
|
32
|
+
| "affirm"
|
33
|
+
| "afterpay_clearpay"
|
34
|
+
| "alipay"
|
35
|
+
| "au_becs_debit"
|
36
|
+
| "bacs_debit"
|
37
|
+
| "bancontact"
|
38
|
+
| "blik"
|
39
|
+
| "boleto"
|
40
|
+
| "card_present"
|
41
|
+
| "eps"
|
42
|
+
| "fpx"
|
43
|
+
| "giropay"
|
44
|
+
| "grabpay"
|
45
|
+
| "ideal"
|
46
|
+
| "klarna"
|
47
|
+
| "konbini"
|
48
|
+
| "link"
|
49
|
+
| "oxxo"
|
50
|
+
| "p24"
|
51
|
+
| "paynow"
|
52
|
+
| "pix"
|
53
|
+
| "promptpay"
|
54
|
+
| "sepa_debit"
|
55
|
+
| "sofort"
|
56
|
+
| "us_bank_account"
|
57
|
+
| "wechat_pay"
|
58
|
+
|
59
|
+
export type WalletPaymentIntentRequest = {
|
60
|
+
walletId: string
|
61
|
+
partnerId: string
|
62
|
+
amount: number
|
63
|
+
agreeTerms: boolean
|
64
|
+
paymentMethodTypes?: WalletPaymentIntentPaymentMethod[]
|
65
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ZodBoolean, ZodNullable, ZodNumber, ZodObject, ZodString } from "zod"
|
2
|
+
|
3
|
+
export type ZodWalletBalance = ZodObject<{
|
4
|
+
USD: ZodNumber
|
5
|
+
}>
|
6
|
+
export type ZodWallet = ZodObject<{
|
7
|
+
balance: ZodWalletBalance
|
8
|
+
created_date: ZodString
|
9
|
+
has_billing_details: ZodBoolean
|
10
|
+
id: ZodString
|
11
|
+
}>
|
12
|
+
export type ZodWalletCreateForm = ZodObject<{
|
13
|
+
customerName: ZodString
|
14
|
+
}>
|
15
|
+
export type WindowHapiValidationsWallet = {
|
16
|
+
wallet: ZodNullable<ZodWallet>
|
17
|
+
walletForm: ZodWalletCreateForm
|
18
|
+
}
|
package/tsconfig.json
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "es2015",
|
4
|
+
"lib": [
|
5
|
+
"dom",
|
6
|
+
"dom.iterable",
|
7
|
+
"esnext"
|
8
|
+
],
|
9
|
+
"allowJs": true,
|
10
|
+
"skipLibCheck": true,
|
11
|
+
"strict": true,
|
12
|
+
"noEmit": false,
|
13
|
+
"esModuleInterop": true,
|
14
|
+
"moduleResolution": "node",
|
15
|
+
"module": "commonjs",
|
16
|
+
"resolveJsonModule": true,
|
17
|
+
"isolatedModules": false,
|
18
|
+
"jsx": "preserve",
|
19
|
+
"incremental": false,
|
20
|
+
"experimentalDecorators": true,
|
21
|
+
"baseUrl": "./",
|
22
|
+
"outFile": "index.d.ts",
|
23
|
+
"forceConsistentCasingInFileNames": true
|
24
|
+
},
|
25
|
+
"include": [
|
26
|
+
"./src/**/*",
|
27
|
+
],
|
28
|
+
"exclude": [
|
29
|
+
"node_modules",
|
30
|
+
"../ats/**/*",
|
31
|
+
"../common/**/*",
|
32
|
+
"../src/**/*",
|
33
|
+
"./index.d.ts",
|
34
|
+
"./index.d.ts.map"
|
35
|
+
]
|
36
|
+
}
|