@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.
Files changed (107) hide show
  1. package/package.json +17 -8
  2. package/src/_window/api.types.ts +61 -0
  3. package/src/_window/auth.types.ts +13 -0
  4. package/src/_window/config.types.ts +5 -0
  5. package/src/_window/events.types.ts +158 -0
  6. package/src/_window/index.ts +16 -0
  7. package/src/_window/instances.types.ts +27 -0
  8. package/src/_window/qa.types.ts +30 -0
  9. package/src/_window/routing.types.ts +23 -0
  10. package/src/_window/sdk.types.ts +149 -0
  11. package/src/_window/service.types.ts +69 -0
  12. package/src/_window/state.types.ts +114 -0
  13. package/src/_window/ui.types.ts +15 -0
  14. package/src/_window/utils.types.ts +36 -0
  15. package/src/_window/validation.types.ts +45 -0
  16. package/src/_window/window.ts +140 -0
  17. package/src/alert/enums.ts +22 -0
  18. package/src/alert/index.ts +6 -0
  19. package/src/alert/service.types.ts +15 -0
  20. package/src/alert/state.types.ts +9 -0
  21. package/src/alert/types.ts +63 -0
  22. package/src/ats/api.types.ts +16 -0
  23. package/src/ats/index.ts +6 -0
  24. package/src/ats/service.types.ts +17 -0
  25. package/src/ats/state.types.ts +5 -0
  26. package/src/ats/types.ts +19 -0
  27. package/src/basket/index.ts +7 -0
  28. package/src/basket/service.types.ts +32 -0
  29. package/src/basket/state.types.ts +34 -0
  30. package/src/basket/types.ts +4 -0
  31. package/src/basket/utils.types.ts +10 -0
  32. package/src/basket/validations.types.ts +25 -0
  33. package/src/campaign/api.types.ts +45 -0
  34. package/src/campaign/enums.ts +17 -0
  35. package/src/campaign/index.ts +10 -0
  36. package/src/campaign/qa.types.ts +12 -0
  37. package/src/campaign/service.types.ts +48 -0
  38. package/src/campaign/state.types.ts +55 -0
  39. package/src/campaign/types.ts +237 -0
  40. package/src/campaign/utils.types.ts +59 -0
  41. package/src/campaign/validations.types.ts +215 -0
  42. package/src/common/enums.ts +42 -0
  43. package/src/common/events/EventCommand/enums.ts +49 -0
  44. package/src/common/events/EventCommand/index.ts +4 -0
  45. package/src/common/events/EventCommand/types.ts +18 -0
  46. package/src/common/events/index.ts +4 -0
  47. package/src/common/events/types.ts +52 -0
  48. package/src/common/index.ts +7 -0
  49. package/src/common/logger/enums.ts +12 -0
  50. package/src/common/logger/types.ts +18 -0
  51. package/src/common/qa.types.ts +9 -0
  52. package/src/common/types.ts +109 -0
  53. package/src/common/validations.types.ts +89 -0
  54. package/src/common/validator/types.ts +4 -0
  55. package/src/contract/api.types.ts +47 -0
  56. package/src/contract/index.ts +9 -0
  57. package/src/contract/qa.types.ts +12 -0
  58. package/src/contract/service.types.ts +54 -0
  59. package/src/contract/state.types.ts +74 -0
  60. package/src/contract/types.ts +145 -0
  61. package/src/contract/utils.types.ts +11 -0
  62. package/src/contract/validations.types.ts +104 -0
  63. package/src/debugging/index.ts +3 -0
  64. package/src/debugging/state.types.ts +18 -0
  65. package/src/index.ts +18 -0
  66. package/src/language/index.ts +5 -0
  67. package/src/language/qa.types.ts +19 -0
  68. package/src/language/state.types.ts +25 -0
  69. package/src/language/validations.types.ts +13 -0
  70. package/src/modal/enums.ts +14 -0
  71. package/src/modal/index.ts +6 -0
  72. package/src/modal/service.types.ts +32 -0
  73. package/src/modal/state.types.ts +8 -0
  74. package/src/modal/types.ts +44 -0
  75. package/src/orderJourney/enums.ts +25 -0
  76. package/src/orderJourney/index.ts +8 -0
  77. package/src/orderJourney/qa.types.ts +16 -0
  78. package/src/orderJourney/state.types.ts +99 -0
  79. package/src/orderJourney/types.ts +31 -0
  80. package/src/orderJourney/utils.types.ts +11 -0
  81. package/src/orderJourney/validations.types.ts +34 -0
  82. package/src/product/api.types.ts +62 -0
  83. package/src/product/enums.ts +11 -0
  84. package/src/product/index.ts +10 -0
  85. package/src/product/qa.types.ts +11 -0
  86. package/src/product/service.types.ts +68 -0
  87. package/src/product/state.types.ts +93 -0
  88. package/src/product/types.ts +161 -0
  89. package/src/product/utils.types.ts +22 -0
  90. package/src/product/validations.types.ts +189 -0
  91. package/src/routing/index.ts +3 -0
  92. package/src/routing/state.types.ts +30 -0
  93. package/src/theming/index.ts +6 -0
  94. package/src/theming/qa.types.ts +11 -0
  95. package/src/theming/state.types.ts +6 -0
  96. package/src/theming/types.ts +123 -0
  97. package/src/theming/validations.types.ts +62 -0
  98. package/src/ui/index.ts +3 -0
  99. package/src/ui/service.types.ts +26 -0
  100. package/src/wallet/api.types.ts +33 -0
  101. package/src/wallet/index.ts +7 -0
  102. package/src/wallet/service.types.ts +26 -0
  103. package/src/wallet/state.types.ts +58 -0
  104. package/src/wallet/types.ts +65 -0
  105. package/src/wallet/validations.types.ts +18 -0
  106. package/tsconfig.json +36 -0
  107. package/index.d.ts +0 -5207
@@ -0,0 +1,47 @@
1
+ import { AxiosRequestConfig } from "axios"
2
+ import {
3
+ Contract,
4
+ ContractCreateForm,
5
+ ContractGroup,
6
+ ContractGroupCreateForm,
7
+ } from "./types"
8
+ import { WindowHapiAPI, WindowHapiAPIModule } from "../_window/api.types"
9
+ import { PaginatedAPIResponseV1, PaginationLimitOffset } from "../common/types"
10
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
11
+
12
+ export type WindowHapiAPIContractConfigs = {
13
+ getContracts: AxiosRequestConfig
14
+ getContractsByIds: AxiosRequestConfig
15
+ getContract: AxiosRequestConfig
16
+ createContract: AxiosRequestConfig
17
+ removeContract: AxiosRequestConfig
18
+ getPostingRequirementOptions: AxiosRequestConfig
19
+ getGroups: AxiosRequestConfig
20
+ createGroup: AxiosRequestConfig
21
+ }
22
+ export type WindowHapiAPIContractRequests = {
23
+ getContracts: (
24
+ limitOffset?: PaginationLimitOffset,
25
+ ) => Promise<PaginatedAPIResponseV1<Contract>>
26
+ getContractsByIds: (
27
+ contractIds: (string | number)[],
28
+ limitOffset?: PaginationLimitOffset,
29
+ ) => Promise<PaginatedAPIResponseV1<Contract>>
30
+ getContract: (contractId: string) => Promise<Contract>
31
+ createContract: (contract: ContractCreateForm) => Promise<Contract>
32
+ getPostingRequirementOptions: (
33
+ contractId: string,
34
+ fieldName: string,
35
+ autocompleteRequestOptions: Record<string, string | string[]>,
36
+ ) => Promise<any>
37
+ getGroups: () => Promise<ContractGroup[]>
38
+ createGroup: (group: ContractGroupCreateForm) => Promise<ContractGroup>
39
+ removeContract: (contractId: string) => Promise<Contract>
40
+ }
41
+ export type WindowHapiAPIContract = WindowHapiModuleWithConstructorArgs<
42
+ WindowHapiAPIModule<
43
+ WindowHapiAPIContractRequests,
44
+ WindowHapiAPIContractConfigs
45
+ >,
46
+ { readonly api: WindowHapiAPI }
47
+ >
@@ -0,0 +1,9 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./api.types"
4
+ export * from "./qa.types"
5
+ export * from "./service.types"
6
+ export * from "./state.types"
7
+ export * from "./types"
8
+ export * from "./utils.types"
9
+ export * from "./validations.types"
@@ -0,0 +1,12 @@
1
+ import { ContractCreateForm, ContractGroupCreateForm } from "./types"
2
+ import { WindowHapiQA } from "../_window/qa.types"
3
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+
5
+ export type WindowHapiQAContract = WindowHapiModuleWithConstructorArgs<
6
+ {
7
+ getRandomContractId: () => Promise<string>
8
+ useMockContractForm: () => ContractCreateForm
9
+ useMockGroupForm: () => ContractGroupCreateForm
10
+ },
11
+ { readonly qa: WindowHapiQA }
12
+ >
@@ -0,0 +1,54 @@
1
+ import {
2
+ HapiServiceFunctionWithLifecycleHooks,
3
+ WindowHapiService,
4
+ } from "../_window/service.types"
5
+ import { OrderJourneyStepKey } from "../orderJourney/enums"
6
+ import {
7
+ Contract,
8
+ ContractCredential,
9
+ ContractGroup,
10
+ ContractPostingRequirementsAutocompleteRequestOption,
11
+ } from "./types"
12
+ import { PaginatedAPIResponseV1 } from "../common/types"
13
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
14
+
15
+ export type ContractServiceGetContractPostingRequirementOptionsHandler = (
16
+ contractId: string,
17
+ fieldName: string,
18
+ autocompleteRequestOptions: ContractPostingRequirementsAutocompleteRequestOption[],
19
+ ) => Promise<any>
20
+ export type ContractServiceGetContractsHandler = (
21
+ offset: number,
22
+ ) => Promise<PaginatedAPIResponseV1<Contract>>
23
+ export type ContractServiceGetContractGroupsHandler = () => Promise<
24
+ ContractGroup[]
25
+ >
26
+ export type ContractServiceCreateContractHandler = () => Promise<Contract>
27
+ export type ContractServiceRemoveContractHandler = (
28
+ contractId: string,
29
+ ) => Promise<void>
30
+ export type ContractServiceCreateContractGroupHandler =
31
+ () => Promise<ContractGroup>
32
+ export type ContractServiceGetContractHandler = (
33
+ id: string,
34
+ ) => Promise<Contract>
35
+
36
+ export type WindowHapiServiceContract = WindowHapiModuleWithConstructorArgs<
37
+ {
38
+ getContractPostingRequirementOptions: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractPostingRequirementOptionsHandler>
39
+ getContracts: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractsHandler>
40
+ getContractGroups: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractGroupsHandler>
41
+ createContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceCreateContractHandler>
42
+ removeContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceRemoveContractHandler>
43
+ createContractGroup: HapiServiceFunctionWithLifecycleHooks<ContractServiceCreateContractGroupHandler>
44
+ getContract: HapiServiceFunctionWithLifecycleHooks<ContractServiceGetContractHandler>
45
+ initiateOauthLogin: (
46
+ contractId: string | number,
47
+ orderJourneyStepActive: OrderJourneyStepKey,
48
+ credential: ContractCredential,
49
+ ) => void
50
+ setDefaultContractForm: () => void
51
+ setDefaultContractGroupForm: () => void
52
+ },
53
+ { readonly service: WindowHapiService }
54
+ >
@@ -0,0 +1,74 @@
1
+ import { ProductSupportingContractsComplete } from "../product/types"
2
+ import {
3
+ Contract,
4
+ ContractCreateForm,
5
+ ContractGroup,
6
+ ContractGroupCreateForm,
7
+ ContractGroupSelected,
8
+ } from "./types"
9
+ import { PaginationResponseV1 } from "../common/types"
10
+
11
+ export type ContractState = {
12
+ /* Contracts */
13
+ /**
14
+ * Array of Contracts to be displayed in Contracts Landing or Contracts List widgets.
15
+ */
16
+ contracts: Contract[]
17
+ /**
18
+ * An object that holds information like next URL, previous URL and count for pagination purposes
19
+ */
20
+ contractsPaginationMeta: PaginationResponseV1
21
+ /**
22
+ * Shows a loading spinner when the Contracts are loading
23
+ */
24
+ contractsAreLoading: boolean
25
+ /**
26
+ * Selected Channel ID that will trigger an API request to fetch the data then to populate `contractSelected`
27
+ */
28
+ contractSelectedId: string | number | null
29
+ /**
30
+ * Selected Channel that will be part of the Contract when user submits the form
31
+ */
32
+ contractSelected: ProductSupportingContractsComplete | null
33
+ /**
34
+ * Shows a loading spinner when the properties required for the Contract are being loaded from the API
35
+ */
36
+ contractSelectedIsLoading: boolean
37
+ /**
38
+ * The object that contains details for the new Contract that will be created when user submits the form
39
+ */
40
+ contractForm: ContractCreateForm
41
+ /**
42
+ * Error(s) received from the API when user submits the form
43
+ */
44
+ contractCreateError: any
45
+ /**
46
+ * Client-side validation result of the `contractForm`. **This value is a computed getter meaning that it cannot be set from outside**
47
+ */
48
+ contractFormIsValid: boolean | null
49
+ /* Contracts Groups */
50
+ /**
51
+ * Array of Contract Groups for user to select during creation of a new Contract.
52
+ */
53
+ groups: ContractGroup[]
54
+ /**
55
+ * Selected Contract Group to be saved as part of Contract that will be created when user submits the form
56
+ */
57
+ groupSelected: ContractGroupSelected
58
+ /**
59
+ * Shows a loading spinner and disables the Select HTML Element when Contract Groups are loading
60
+ */
61
+ groupsAreLoading: boolean
62
+ /**
63
+ * Shows a loading spinner and disables the submit button while a new Contract Group is being created
64
+ */
65
+ groupIsCreating: boolean
66
+ /**
67
+ * Error message displayed to the end user when the new Contract Group could not be created
68
+ */
69
+ groupCreateError: string | null
70
+ /**
71
+ * The object that contains details for the new Contract Group that will be created when user submits the form
72
+ */
73
+ groupForm: ContractGroupCreateForm
74
+ }
@@ -0,0 +1,145 @@
1
+ import { ProductLogos, ProductType } from "../product/types"
2
+
3
+ export type ContractProduct = {
4
+ product_id: string
5
+ title: string
6
+ }
7
+
8
+ export type ContractCredential = {
9
+ description?: string | null
10
+ label: string
11
+ name: string
12
+ sort: string
13
+ url: string | null
14
+ options: any[] | null
15
+ }
16
+
17
+ export type ContractFacet = {}
18
+
19
+ export type ContractPostingRequirementType =
20
+ | "SELECT"
21
+ | "SELECT-MAP_ONLY"
22
+ | "TEXT"
23
+ | "MULTIPLE"
24
+ | "HIER"
25
+ | "TEXTEXPAND"
26
+ | "DATE"
27
+ | "TEXTAREA"
28
+ | "AUTOCOMPLETE"
29
+ | "STATISCH"
30
+
31
+ export type ContractPostingRequirementRule = {
32
+ rule: string
33
+ data: string
34
+ }
35
+
36
+ export type ContractPostingRequirementDisplayRuleShow = {
37
+ facet: string
38
+ value: any
39
+ op: "notempty" | "equal" | "in"
40
+ }
41
+
42
+ export type ContractPostingRequirementDisplayRule = {
43
+ show: ContractPostingRequirementDisplayRuleShow[]
44
+ }
45
+
46
+ export type ContractPostingRequirementAutocompleteParametersSourceSingle = {
47
+ field?: string
48
+ facet?: string
49
+ }
50
+
51
+ export type ContractPostingRequirementAutocompleteParametersSourceMultiple = {
52
+ [
53
+ key: string
54
+ ]: ContractPostingRequirementAutocompleteParametersSourceSingle[]
55
+ }
56
+
57
+ export type ContractPostingRequirementParametersSource =
58
+ | ContractPostingRequirementAutocompleteParametersSourceSingle
59
+ | ContractPostingRequirementAutocompleteParametersSourceMultiple
60
+
61
+ export type ContractPostingRequirementAutocomplete = {
62
+ required_parameters: string[] | null
63
+ parameters_source: ContractPostingRequirementParametersSource | null
64
+ }
65
+
66
+ export type ContractPostingRequirement = {
67
+ name: string
68
+ label: string
69
+ description?: string
70
+ display_rules: ContractPostingRequirementDisplayRule | null
71
+ autocomplete: ContractPostingRequirementAutocomplete | null
72
+ options: ContractPostingRequirementOption[] | null
73
+ required: boolean
74
+ sort: string
75
+ type: ContractPostingRequirementType
76
+ rules?: ContractPostingRequirementRule[] | null
77
+ }
78
+
79
+ export type ContractPostingRequirementOption = {
80
+ default?: string
81
+ key: string
82
+ label: string
83
+ data?: any[]
84
+ labels?: Record<"default", string>
85
+ sort: string
86
+ parent?: string
87
+ }
88
+
89
+ export type ContractPurchasePrice = {
90
+ amount: number | null
91
+ currency: string | null
92
+ }
93
+
94
+ export type ContractCreateFormCredentials = Record<string, string>
95
+
96
+ export type ContractCreateForm = {
97
+ id?: number
98
+ credentials?: ContractCreateFormCredentials
99
+ facets?: any
100
+ expiry_date: string | null
101
+ alias: string | null
102
+ purchase_price: ContractPurchasePrice
103
+ credits: string | null
104
+ followed_instructions: boolean
105
+ allow_renegotiation: boolean
106
+ }
107
+
108
+ export type ContractGroupCreateForm = {
109
+ name: string
110
+ }
111
+
112
+ export type ContractChannel = ProductLogos &
113
+ ProductType & {
114
+ id: number
115
+ name: string
116
+ url: string
117
+ }
118
+
119
+ export type Contract = {
120
+ channel?: ContractChannel
121
+ alias: string
122
+ channel_id: number
123
+ class_name: string
124
+ contract_id: string
125
+ credits: number | null
126
+ customer_id: string
127
+ expiry_date: string | null
128
+ facets?: any[]
129
+ product: ContractProduct
130
+ purchase_price: ContractPurchasePrice | null
131
+ group: ContractGroup | null
132
+ }
133
+
134
+ export type ContractGroup = {
135
+ id: string
136
+ idx: number
137
+ igb_customer_id: string
138
+ name: string
139
+ }
140
+
141
+ export type ContractGroupSelected = ContractGroup | "add-new" | null
142
+ export type ContractPostingRequirementsAutocompleteRequestOption = {
143
+ key: string
144
+ value: string | string[]
145
+ }
@@ -0,0 +1,11 @@
1
+ import { ContractCreateForm, ContractGroupCreateForm } from "./types"
2
+ import { WindowHapiUtils } from "../_window/utils.types"
3
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+
5
+ export type WindowHapiUtilsContract = WindowHapiModuleWithConstructorArgs<
6
+ {
7
+ getInitialContractForm: () => ContractCreateForm
8
+ getInitialGroupForm: () => ContractGroupCreateForm
9
+ },
10
+ { readonly utils: WindowHapiUtils }
11
+ >
@@ -0,0 +1,104 @@
1
+ import {
2
+ ZodAny,
3
+ ZodArray,
4
+ ZodBoolean,
5
+ ZodNull,
6
+ ZodNullable,
7
+ ZodNumber,
8
+ ZodObject,
9
+ ZodOptional,
10
+ ZodRecord,
11
+ ZodString,
12
+ ZodUnion,
13
+ } from "zod"
14
+ import {
15
+ ZodProductLogosWithSizes,
16
+ ZodProductLogoUrl,
17
+ ZodProductWithContractSupportComplete,
18
+ } from "../product/validations.types"
19
+
20
+ export type ZodContractAlias = ZodOptional<ZodNullable<ZodString>>
21
+ export type ZodContractExpiryDate = ZodOptional<ZodNullable<ZodString>>
22
+ export type ZodContractCredits = ZodOptional<
23
+ ZodNullable<ZodUnion<[ZodNumber, ZodString]>>
24
+ >
25
+ export type ZodContractFacets = ZodOptional<ZodAny>
26
+ export type ZodContractChannel = ZodObject<{
27
+ id: ZodNumber
28
+ name: ZodString
29
+ url: ZodString
30
+ type: ZodString
31
+ }>
32
+ export type ZodContractProduct = ZodObject<{
33
+ product_id: ZodString
34
+ title: ZodString
35
+ }>
36
+ export type ZodContractPurchasePrice = ZodOptional<
37
+ ZodObject<{
38
+ amount: ZodNullable<ZodNumber>
39
+ currency: ZodNullable<ZodString>
40
+ }>
41
+ >
42
+ export type ZodContractGroup = ZodObject<{
43
+ id: ZodOptional<ZodString>
44
+ idx: ZodOptional<ZodNumber>
45
+ igb_customer_id: ZodOptional<ZodString>
46
+ name: ZodString
47
+ }>
48
+ export type ZodContractGroupSelected = ZodUnion<
49
+ [ZodString, ZodContractGroup, ZodNull]
50
+ >
51
+ export type ZodContractGroupCreateForm = ZodObject<{
52
+ name: ZodString
53
+ }>
54
+ export type ZodContractCreateForm = ZodObject<{
55
+ id: ZodOptional<ZodNumber>
56
+ credentials: ZodOptional<ZodObject<any>>
57
+ facets: ZodContractFacets
58
+ alias: ZodContractAlias
59
+ expiry_date: ZodContractExpiryDate
60
+ purchase_price: ZodContractPurchasePrice
61
+ credits: ZodContractCredits
62
+ followed_instructions: ZodOptional<ZodBoolean>
63
+ allow_renegotiation: ZodOptional<ZodBoolean>
64
+ }>
65
+ export type ZodContractPostingRequirementAutocompleteRequestOptions = ZodRecord<
66
+ ZodString,
67
+ ZodUnion<[ZodString, ZodArray<ZodString>]>
68
+ >
69
+
70
+ export type ZodContract = ZodObject<{
71
+ channel: ZodOptional<ZodContractChannel>
72
+ alias: ZodContractAlias
73
+ channel_id: ZodNumber
74
+ class_name: ZodString
75
+ contract_id: ZodString
76
+ customer_id: ZodString
77
+ facets: ZodContractFacets
78
+ credits: ZodContractCredits
79
+ expiry_date: ZodContractExpiryDate
80
+ logo_rectangle_url: ZodOptional<ZodNullable<ZodProductLogosWithSizes>>
81
+ logo_square_url: ZodOptional<ZodNullable<ZodProductLogosWithSizes>>
82
+ logo_url: ZodOptional<ZodNullable<ZodProductLogoUrl>>
83
+ product: ZodContractProduct
84
+ purchase_price: ZodNullable<ZodContractPurchasePrice>
85
+ group: ZodNullable<ZodContractGroup>
86
+ }>
87
+ export type WindowHapiValidationsContract = {
88
+ channel: ZodContractChannel
89
+ product: ZodContractProduct
90
+ contractPurchasePrice: ZodContractPurchasePrice
91
+ contractExpiryDate: ZodContractExpiryDate
92
+ contractAlias: ZodContractAlias
93
+ contractCredits: ZodContractCredits
94
+ contractFacets: ZodOptional<ZodAny>
95
+ contractForm: ZodContractCreateForm
96
+ contract: ZodContract
97
+ contractSelected: ZodNullable<ZodProductWithContractSupportComplete>
98
+ contracts: ZodArray<ZodContract>
99
+ group: ZodContractGroup
100
+ groupSelected: ZodContractGroupSelected
101
+ groups: ZodArray<ZodContractGroup>
102
+ groupForm: ZodContractGroupCreateForm
103
+ postingRequirementAutocompleteRequestOptions: ZodContractPostingRequirementAutocompleteRequestOptions
104
+ }
@@ -0,0 +1,3 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./state.types"
@@ -0,0 +1,18 @@
1
+ export type DebuggingState = {
2
+ /**
3
+ * Shows or hides the debugging tool on Campaign Create Form's fields for Product & Contract steps
4
+ */
5
+ campaignFormDebuggerIsShown: boolean
6
+ /**
7
+ * Shows translation keys in place of translations for ease of development
8
+ */
9
+ localeDebuggingIsEnabled: boolean
10
+ /**
11
+ * Encompasses widgets that may become available (or upon request) with a red border and a name so communication while making requests is easier.
12
+ */
13
+ componentDebuggingIsEnabled: boolean
14
+ /**
15
+ * Enables console logs (all HAPI Elements) logs
16
+ */
17
+ consoleLogsAreEnabled: boolean
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./_window"
4
+ export * from "./alert"
5
+ export * from "./ats"
6
+ export * from "./basket"
7
+ export * from "./campaign"
8
+ export * from "./common"
9
+ export * from "./contract"
10
+ export * from "./debugging"
11
+ export * from "./language"
12
+ export * from "./modal"
13
+ export * from "./orderJourney"
14
+ export * from "./product"
15
+ export * from "./routing"
16
+ export * from "./theming"
17
+ export * from "./ui"
18
+ export * from "./wallet"
@@ -0,0 +1,5 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./qa.types"
4
+ export * from "./state.types"
5
+ export * from "./validations.types"
@@ -0,0 +1,19 @@
1
+ import { ProductPriceCurrency } from "../product/enums"
2
+ import { LanguageStoreTranslations } from "./state.types"
3
+ import { WindowHapiQA } from "../_window/qa.types"
4
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
5
+
6
+ export type WindowHapiQALanguage = WindowHapiModuleWithConstructorArgs<
7
+ {
8
+ setLocale: (locale: string) => string
9
+ setDisplayCurrency: (
10
+ currency: ProductPriceCurrency,
11
+ ) => ProductPriceCurrency
12
+ setTranslationByLocaleAndKey: (
13
+ locale: string,
14
+ key: string,
15
+ message: string,
16
+ ) => LanguageStoreTranslations
17
+ },
18
+ { readonly qa: WindowHapiQA }
19
+ >
@@ -0,0 +1,25 @@
1
+ import { ProductPriceCurrency } from "../product/enums"
2
+
3
+ export type LanguageStoreLocaleTranslations = Record<string, string>
4
+ export type LanguageStoreTranslations = Record<
5
+ string,
6
+ LanguageStoreLocaleTranslations
7
+ >
8
+ export type LanguageState = {
9
+ /**
10
+ * Locale of the user (navigator language) in RFC 5646 that can be changed via setLocale function
11
+ */
12
+ locale: string
13
+ /**
14
+ * An object containing key-value parts where the key is the i18n key such as `test.example-string` and the value is the actual translation. Translations will be loaded by current locale and fallbacks will be used from American English defaults we have.
15
+ */
16
+ translations: LanguageStoreTranslations
17
+ /**
18
+ * Current Display Currency of all the widgets
19
+ */
20
+ displayCurrency: ProductPriceCurrency
21
+ /**
22
+ * Array of supported currencies. **This value changes automatically when user scrolls and should not be set from outside**
23
+ */
24
+ supportedCurrencies: ProductPriceCurrency[]
25
+ }
@@ -0,0 +1,13 @@
1
+ import { ZodRecord, ZodString } from "zod"
2
+ import { ProductPriceCurrency } from "../product/enums"
3
+
4
+ export type ZodTranslations = ZodRecord<
5
+ ZodString,
6
+ ZodRecord<ZodString, ZodString>
7
+ >
8
+ export type WindowHapiValidationsLanguage = {
9
+ translations: ZodTranslations
10
+ supportedCurrencies: ProductPriceCurrency[]
11
+ supportedCurrenciesRegex: RegExp
12
+ displayCurrency: ZodString
13
+ }
@@ -0,0 +1,14 @@
1
+ export enum ModalZone {
2
+ "primary" = "primary",
3
+ "secondary" = "secondary",
4
+ }
5
+
6
+ export enum ModalKeys {
7
+ wallet = "layout-wallet-modal",
8
+ basket = "layout-basket-modal",
9
+ productInfo = "product-info",
10
+ campaignTakeOfflineConfirmation = "campaign-confirm-take-offline",
11
+ campaignCopyConfirmation = "campaign-confirm-copy",
12
+ basketRemoveProductConfirmation = "remove-product-from-basket",
13
+ contractRemoveConfirmation = "contract-remove-confirmation",
14
+ }
@@ -0,0 +1,6 @@
1
+ // created from 'create-ts-index'
2
+
3
+ export * from "./enums"
4
+ export * from "./service.types"
5
+ export * from "./state.types"
6
+ export * from "./types"
@@ -0,0 +1,32 @@
1
+ import { ModalOptions } from "./types"
2
+ import { ModalKeys, ModalZone } from "./enums"
3
+ import { Product } from "../product/types"
4
+ import { Contract } from "../contract/types"
5
+ import { IObservableValue } from "mobx"
6
+ import { AnyNonFunction } from "../common/types"
7
+ import { WindowHapiService } from "../_window/service.types"
8
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
9
+
10
+ export type WindowHapiServiceModal = WindowHapiModuleWithConstructorArgs<
11
+ {
12
+ openModal: (
13
+ key: ModalKeys,
14
+ props: AnyNonFunction<
15
+ | { product: Product }
16
+ | {
17
+ onClickAccept: (
18
+ productOrContract: Product | Contract,
19
+ ) => void
20
+ onClickDecline: () => void
21
+ basketProduct: Product | Contract
22
+ }
23
+ | { campaignId: string }
24
+ | { partnerId?: IObservableValue<string> }
25
+ >,
26
+ options?: ModalOptions,
27
+ zone?: ModalZone,
28
+ ) => void
29
+ closeModal: (key: ModalKeys) => void
30
+ },
31
+ { readonly service: WindowHapiService }
32
+ >
@@ -0,0 +1,8 @@
1
+ import { Modals } from "./types"
2
+
3
+ export type ModalState = {
4
+ /**
5
+ * An object of modals that are seperated into different layers
6
+ */
7
+ modals: Modals
8
+ }