@vonq/hapi-elements-types 1.8.0 → 1.10.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 (48) hide show
  1. package/_window/api.types.ts +28 -0
  2. package/_window/auth.types.ts +1 -0
  3. package/_window/events.types.ts +15 -14
  4. package/_window/instances.types.ts +2 -0
  5. package/_window/sdk.types.ts +3 -1
  6. package/_window/service.types.ts +4 -0
  7. package/_window/state.types.ts +15 -8
  8. package/_window/utils.types.ts +5 -4
  9. package/_window/window.ts +5 -0
  10. package/alert/enums.ts +1 -0
  11. package/alert/types.ts +3 -0
  12. package/ats/api.types.ts +12 -1
  13. package/ats/service.types.ts +8 -1
  14. package/ats/state.types.ts +2 -1
  15. package/ats/types.ts +22 -0
  16. package/basket/service.types.ts +10 -4
  17. package/basket/state.types.ts +0 -24
  18. package/basket/utils.types.ts +38 -0
  19. package/campaign/service.types.ts +1 -0
  20. package/campaign/state.types.ts +0 -30
  21. package/campaign/types.ts +14 -8
  22. package/campaign/utils.types.ts +1 -3
  23. package/campaign/validations.types.ts +16 -7
  24. package/common/enums.ts +2 -0
  25. package/common/events/EventCommand/enums.ts +6 -4
  26. package/common/events/EventCommand/types.ts +2 -0
  27. package/common/events/types.ts +4 -1
  28. package/common/qa.types.ts +2 -0
  29. package/common/validations.types.ts +2 -0
  30. package/contract/state.types.ts +0 -45
  31. package/contract/types.ts +3 -1
  32. package/contract/utils.types.ts +2 -1
  33. package/debugging/state.types.ts +1 -12
  34. package/modal/enums.ts +4 -0
  35. package/modal/types.ts +24 -0
  36. package/orderJourney/enums.ts +2 -2
  37. package/orderJourney/service.types.ts +16 -0
  38. package/orderJourney/state.types.ts +11 -6
  39. package/orderJourney/types.ts +45 -12
  40. package/orderJourney/utils.types.ts +10 -0
  41. package/orderJourney/validations.types.ts +23 -2
  42. package/package.json +1 -1
  43. package/product/state.types.ts +2 -57
  44. package/product/types.ts +13 -8
  45. package/product/validations.types.ts +2 -1
  46. package/theming/types.ts +6 -0
  47. package/ui/service.types.ts +6 -4
  48. package/wallet/state.types.ts +0 -36
package/campaign/types.ts CHANGED
@@ -2,6 +2,7 @@ import { ProductDuration, ProductIndustry } from "../product/types"
2
2
  import { ContractPostingRequirement } from "../contract/types"
3
3
  import { ProductPriceCurrency } from "../product/enums"
4
4
  import { EmploymentType, SalaryPeriod } from "./enums"
5
+ import { OrderJourneyPaymentMethod } from "../orderJourney"
5
6
 
6
7
  export type CampaignProductSpecs = {
7
8
  contractId: string | null
@@ -116,11 +117,13 @@ export type Campaign = {
116
117
  campaignName: string | null
117
118
  companyId: string
118
119
  createdOn: string
120
+ poNumber: string | null
119
121
  customerId: string
120
122
  orderReference: string | null
121
123
  orderedProducts: string[]
122
124
  orderedProductsSpecs: CampaignProductSpecs[]
123
125
  postingDetails: CampaignPostingDetails
126
+ paymentMethod: OrderJourneyPaymentMethod
124
127
  postings: CampaignPosting[]
125
128
  recruiterInfo: CampaignRecruiterInfo
126
129
  status: CampaignStatus
@@ -139,7 +142,7 @@ export type CampaignCreateFormTargetGroupIndustry = ProductIndustry
139
142
 
140
143
  export type CampaignCreateFormTargetGroupJobCategory = {
141
144
  label: string
142
- value: number
145
+ value: number | string
143
146
  }
144
147
 
145
148
  export type CampaignCreateFormTargetGroup = {
@@ -160,8 +163,10 @@ export type CampaignCreateFormOrderedProductSpec =
160
163
 
161
164
  export type CampaignCreateForm = {
162
165
  companyId: string
166
+ currency: ProductPriceCurrency
163
167
  campaignName?: string | null
164
- poNumber?: string
168
+ poNumber: string | null
169
+ paymentMethod: OrderJourneyPaymentMethod | null
165
170
  targetGroup: CampaignCreateFormTargetGroup
166
171
  recruiterInfo: CampaignRecruiterInfo
167
172
  postingDetails: {
@@ -173,7 +178,7 @@ export type CampaignCreateForm = {
173
178
  employmentType: EmploymentType
174
179
  weeklyWorkingHours: CampaignPostingDetailsWeeklyWorkingHours
175
180
  salaryIndication: CampaignPostingDetailsSalaryIndication
176
- contactInfo: CampaignPostingDetailsContactInfo
181
+ contactInfo: CampaignPostingDetailsContactInfo | null
177
182
  jobPageUrl: string
178
183
  applicationUrl: string
179
184
  }
@@ -182,9 +187,9 @@ export type CampaignCreateForm = {
182
187
  }
183
188
 
184
189
  export type CampaignOrderRequestBodyOrderedProductsSpec = {
185
- contractId: string
190
+ contractId?: string
186
191
  utm: string
187
- productId: string
192
+ productId?: string
188
193
  postingRequirements?: any
189
194
  }
190
195
 
@@ -192,8 +197,9 @@ export type CampaignOrderRequestBody = {
192
197
  companyId: string
193
198
  campaignName: string | null | undefined
194
199
  walletId?: string
195
- poNumber?: string
200
+ poNumber?: string | null
196
201
  recruiterInfo: Omit<CampaignRecruiterInfo, "id">
202
+ paymentMethod: OrderJourneyPaymentMethod | null
197
203
  postingDetails: CampaignPostingDetails
198
204
  targetGroup: CampaignTargetGroup
199
205
  orderedProducts: string[]
@@ -211,12 +217,12 @@ export type TaxonomyEducationLevelName = CampaignTaxonomyNameWithLanguage
211
217
  export type TaxonomySeniorityName = CampaignTaxonomyNameWithLanguage
212
218
 
213
219
  export type TaxonomySeniority = {
214
- id: number
220
+ id: number | string
215
221
  name: TaxonomySeniorityName[]
216
222
  }
217
223
 
218
224
  export type TaxonomyEducationAndSeniorityLevel = {
219
- id: number
225
+ id: number | string
220
226
  name: TaxonomyEducationLevelName[]
221
227
  }
222
228
 
@@ -26,9 +26,7 @@ export type WindowHapiUtilsCampaign = WindowHapiModuleWithConstructorArgs<
26
26
  campaign: Partial<Campaign>,
27
27
  ) => void
28
28
  getOrderCampaignRequestBody: () => CampaignOrderRequestBody
29
- getCopyCampaignRequestBody: (
30
- campaign: Campaign,
31
- ) => CampaignOrderRequestBody
29
+ getCopyCampaignRequestBody: (campaign: Campaign) => CampaignCreateForm
32
30
  getPostBodyValuesForTargetGroupProperty: (
33
31
  selectValue:
34
32
  | CampaignCreateFormTargetGroupEducationLevel[]
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  ZodAny,
3
3
  ZodArray,
4
+ ZodBoolean,
5
+ ZodNativeEnum,
4
6
  ZodNullable,
5
7
  ZodNumber,
6
8
  ZodObject,
@@ -10,6 +12,7 @@ import {
10
12
  ZodUnion,
11
13
  } from "zod"
12
14
  import { ZodProductDuration } from "../product/validations.types"
15
+ import { OrderJourneyPaymentMethod } from "../orderJourney"
13
16
 
14
17
  export type ZodCampaignTotalPrice = ZodObject<{
15
18
  amount: ZodNumber
@@ -26,7 +29,7 @@ export type ZodCampaignRecruiterInfo = ZodObject<{
26
29
  }>
27
30
  export type ZodCampaignTargetGroupData = ZodObject<{
28
31
  description: ZodString
29
- vonqId: ZodString
32
+ vonqId: ZodUnion<[ZodNumber, ZodString]>
30
33
  }>
31
34
  export type ZodCampaignTargetGroupDatas = ZodArray<ZodCampaignTargetGroupData>
32
35
  export type ZodCampaignTargetGroup = ZodObject<{
@@ -68,7 +71,9 @@ export type ZodCampaignPostingDetailsWorkingLocationPostCodeDefinition = {
68
71
  export type ZodCampaignPostingDetailsWorkingLocationAddressDetailsDefinition = {
69
72
  addressLine1: ZodString
70
73
  addressLine2: ZodOptional<ZodNullable<ZodString>>
71
- allowsRemoteWork: ZodOptional<ZodNullable<ZodNumber>>
74
+ allowsRemoteWork: ZodOptional<
75
+ ZodNullable<ZodUnion<[ZodNumber, ZodBoolean]>>
76
+ >
72
77
  city: ZodString
73
78
  country: ZodString
74
79
  postcode: ZodString
@@ -82,13 +87,13 @@ export type ZodCampaignTaxonomyNameWithLanguage = ZodObject<{
82
87
  value: ZodString
83
88
  }>
84
89
  export type ZodCampaignTaxonomyEducationLevel = ZodObject<{
85
- id: ZodNumber
90
+ id: ZodUnion<[ZodNumber, ZodString]>
86
91
  name: ZodArray<ZodCampaignTaxonomyNameWithLanguage>
87
92
  }>
88
93
  export type ZodCampaignTaxonomyEducationLevels =
89
94
  ZodArray<ZodCampaignTaxonomyEducationLevel>
90
95
  export type ZodCampaignTaxonomySeniority = ZodObject<{
91
- id: ZodNumber
96
+ id: ZodUnion<[ZodNumber, ZodString]>
92
97
  name: ZodArray<ZodCampaignTaxonomyNameWithLanguage>
93
98
  }>
94
99
  export type ZodCampaignTaxonomySeniorities =
@@ -131,7 +136,7 @@ export type ZodCampaign = ZodObject<{
131
136
  campaignName: ZodNullable<ZodString>
132
137
  companyId: ZodString
133
138
  createdOn: ZodString
134
- customerId: ZodString
139
+ customerId: ZodNullable<ZodString>
135
140
  orderReference: ZodNullable<ZodString>
136
141
  orderedProducts: ZodArray<ZodString>
137
142
  orderedProductsSpecs: ZodCampaignOrderedProductSpecs
@@ -160,17 +165,21 @@ export type ZodCampaignCreateFormPostingDetails = ZodObject<{
160
165
  export type ZodCampaignCreateFormTargetGroup = ZodObject<{
161
166
  educationLevel: ZodCampaignTaxonomyEducationLevels
162
167
  seniority: ZodCampaignTaxonomySeniorities
163
- industry: ZodArray<ZodObject<{ id: ZodNumber; name: ZodString }>>
168
+ industry: ZodArray<
169
+ ZodObject<{ id: ZodUnion<[ZodNumber, ZodString]>; name: ZodString }>
170
+ >
164
171
  jobCategory: ZodArray<
165
172
  ZodObject<{
166
173
  label: ZodString
167
- value: ZodNumber
174
+ value: ZodUnion<[ZodNumber, ZodString]>
168
175
  }>
169
176
  >
170
177
  }>
171
178
  export type ZodCampaignCreateForm = ZodObject<{
172
179
  companyId: ZodString
173
180
  campaignName: ZodOptional<ZodNullable<ZodString>>
181
+ poNumber: ZodNullable<ZodString>
182
+ paymentMethod: ZodNullable<ZodNativeEnum<typeof OrderJourneyPaymentMethod>>
174
183
  targetGroup: ZodCampaignCreateFormTargetGroup
175
184
  recruiterInfo: ZodCampaignRecruiterInfo
176
185
  postingDetails: ZodCampaignCreateFormPostingDetails
package/common/enums.ts CHANGED
@@ -16,6 +16,8 @@ export enum WindowHapiSubmoduleName {
16
16
  }
17
17
 
18
18
  export enum WindowHapiModuleName {
19
+ router = "router",
20
+ config = "config",
19
21
  ats = "ats",
20
22
  basket = "basket",
21
23
  campaign = "campaign",
@@ -1,10 +1,6 @@
1
1
  export enum WindowHapiEventCommandName {
2
2
  /* State */
3
3
  stateHydrate = "state:hydrate",
4
- stateTransfer = "state:transfer",
5
- stateRestore = "state:restore",
6
- stateLoad = "state:load",
7
- stateInit = "state:init",
8
4
 
9
5
  /* Service */
10
6
  serviceLoad = "service:load",
@@ -17,11 +13,13 @@ export enum WindowHapiEventCommandName {
17
13
 
18
14
  /* Config */
19
15
  configSetPartnerId = "config:partnerId",
16
+ configSetPartnerToken = "config:partnerToken", // used for impersonation purposes
20
17
  configSetClientId = "config:clientId",
21
18
  configSetAreLogsEnabled = "config:areLogsEnabled",
22
19
 
23
20
  /* App */
24
21
  appLoad = "app:load",
22
+ appReady = "app:ready",
25
23
 
26
24
  /* API */
27
25
  apiRequest = "api:request",
@@ -30,6 +28,8 @@ export enum WindowHapiEventCommandName {
30
28
  qaRequest = "qa:request",
31
29
 
32
30
  /* DOM */
31
+ iframeLoaded = "dom:iframe-loaded",
32
+ iframeUnloaded = "dom:iframe-unloaded",
33
33
  domAppendChild = "dom:append-child",
34
34
  domElementEvent = "dom:element-event",
35
35
  domRemoveChild = "dom:remove-child",
@@ -39,6 +39,8 @@ export enum WindowHapiEventCommandName {
39
39
  domAddClass = "dom:add-class",
40
40
  domRemoveClass = "dom:remove-class",
41
41
  domSlotAvailable = "dom:slot-available",
42
+ domElementMounted = "dom:element-mounted",
43
+ domElementUnmounted = "dom:element-unmounted",
42
44
 
43
45
  /* Location */
44
46
  locationSetHref = "location:href",
@@ -3,11 +3,13 @@ import { WindowHapiEventCommandName } from "./enums"
3
3
  export type WindowHapiEventCommandNames =
4
4
  | WindowHapiEventCommandName
5
5
  | `dom:element-event-${string}`
6
+ | `state:change-event-${string}`
6
7
 
7
8
  export type WindowHapiEventCommandData =
8
9
  | [string]
9
10
  | [string, ...any[]]
10
11
  | [...any[]]
12
+ | any
11
13
  | undefined
12
14
 
13
15
  export type WindowHapiEventCommandStatus =
@@ -34,7 +34,10 @@ export type WindowHapiEventCommand = {
34
34
  toJSON: Record<string, any>
35
35
  }
36
36
 
37
- export type WindowHapiEventCommandCallbackHandler = (data: any) => void
37
+ export type WindowHapiEventCommandCallbackHandler = (
38
+ data: any,
39
+ event: WindowHapiEventCommand | WindowHapiEventListener,
40
+ ) => void
38
41
  export type WindowHapiEventCommandCommitHandler = (
39
42
  ...args: any[]
40
43
  ) => void | never | Promise<void | never>
@@ -4,6 +4,8 @@ import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
4
  export type WindowHapiQACommon = WindowHapiModuleWithConstructorArgs<
5
5
  {
6
6
  setComponentDebuggingIsEnabled: (isEnabled: boolean) => boolean
7
+ setIsAIFeaturesEnabled: (isEnabled: boolean) => boolean
8
+ refreshPage: () => void
7
9
  },
8
10
  { readonly qa: WindowHapiQA }
9
11
  >
@@ -55,6 +55,7 @@ export type ZodPaginationResponseV2 = ZodObject<
55
55
  } & ZodPaginationLimitOffsetDefinition
56
56
  >
57
57
  export type WindowHapiValidationsCommon = {
58
+ isURL: (url: string) => boolean | never
58
59
  genericBoolean: ZodBoolean
59
60
  genericNumber: ZodNumber
60
61
  genericNumberArray: ZodArray<ZodNumber>
@@ -66,6 +67,7 @@ export type WindowHapiValidationsCommon = {
66
67
  ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>
67
68
  >
68
69
  genericRecordBoolean: ZodRecord<ZodString, ZodBoolean>
70
+ genericRecordAny: ZodRecord<ZodString, ZodAny>
69
71
  genericRecordString: ZodRecord<ZodString, ZodString>
70
72
  genericStringOrNumber: ZodUnion<[ZodNumber, ZodString]>
71
73
  genericNullableStringOrNumber: ZodNullable<ZodUnion<[ZodNumber, ZodString]>>
@@ -10,65 +10,20 @@ import { PaginationResponseV1 } from "../common/types"
10
10
 
11
11
  export type ContractState = {
12
12
  /* Contracts */
13
- /**
14
- * Array of Contracts to be displayed in Contracts Landing or Contracts List widgets.
15
- */
16
13
  contracts: Contract[]
17
- /**
18
- * An object that holds information like next URL, previous URL and count for pagination purposes
19
- */
20
14
  contractsPaginationMeta: PaginationResponseV1
21
- /**
22
- * Shows a loading spinner when the Contracts are loading
23
- */
24
15
  contractsAreLoading: boolean
25
- /**
26
- * Selected Channel ID that will trigger an API request to fetch the data then to populate `contractSelected`
27
- */
28
16
  contractSelectedId: string | number | null
29
- /**
30
- * Selected Channel that will be part of the Contract when user submits the form
31
- */
32
17
  contractSelected: ProductSupportingContractsComplete | null
33
- /**
34
- * Shows a loading spinner when the properties required for the Contract are being loaded from the API
35
- */
36
18
  contractSelectedIsLoading: boolean
37
- /**
38
- * The object that contains details for the new Contract that will be created when user submits the form
39
- */
40
19
  contractForm: ContractCreateForm
41
- /**
42
- * Error(s) received from the API when user submits the form
43
- */
44
20
  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
21
  contractFormIsValid: boolean | null
49
22
  /* Contracts Groups */
50
- /**
51
- * Array of Contract Groups for user to select during creation of a new Contract.
52
- */
53
23
  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
24
  groupSelected: ContractGroupSelected
58
- /**
59
- * Shows a loading spinner and disables the Select HTML Element when Contract Groups are loading
60
- */
61
25
  groupsAreLoading: boolean
62
- /**
63
- * Shows a loading spinner and disables the submit button while a new Contract Group is being created
64
- */
65
26
  groupIsCreating: boolean
66
- /**
67
- * Error message displayed to the end user when the new Contract Group could not be created
68
- */
69
27
  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
28
  groupForm: ContractGroupCreateForm
74
29
  }
package/contract/types.ts CHANGED
@@ -5,13 +5,15 @@ export type ContractProduct = {
5
5
  title: string
6
6
  }
7
7
 
8
+ export type ContractCredentialOption = { key: string; label: string }
9
+
8
10
  export type ContractCredential = {
9
11
  description?: string | null
10
12
  label: string
11
13
  name: string
12
14
  sort: string
13
15
  url: string | null
14
- options: any[] | null
16
+ options: ContractCredentialOption[] | null
15
17
  }
16
18
 
17
19
  export type ContractFacet = {}
@@ -1,4 +1,4 @@
1
- import { ContractCreateForm, ContractGroupCreateForm } from "./types"
1
+ import { Contract, ContractCreateForm, ContractGroupCreateForm } from "./types"
2
2
  import { WindowHapiUtils } from "../_window/utils.types"
3
3
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
4
 
@@ -6,6 +6,7 @@ export type WindowHapiUtilsContract = WindowHapiModuleWithConstructorArgs<
6
6
  {
7
7
  getInitialContractForm: () => ContractCreateForm
8
8
  getInitialGroupForm: () => ContractGroupCreateForm
9
+ getContractNameWithGroupSuffix: (contract: Contract) => string
9
10
  },
10
11
  { readonly utils: WindowHapiUtils }
11
12
  >
@@ -1,18 +1,7 @@
1
1
  export type DebuggingState = {
2
- /**
3
- * Shows or hides the debugging tool on Campaign Create Form's fields for Product & Contract steps
4
- */
5
2
  campaignFormDebuggerIsShown: boolean
6
- /**
7
- * Shows translation keys in place of translations for ease of development
8
- */
9
3
  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
4
  componentDebuggingIsEnabled: boolean
14
- /**
15
- * Enables console logs (all HAPI Elements) logs
16
- */
17
5
  consoleLogsAreEnabled: boolean
6
+ isAIFeaturesEnabled: boolean
18
7
  }
package/modal/enums.ts CHANGED
@@ -9,6 +9,10 @@ export enum ModalKeys {
9
9
  productInfo = "product-info",
10
10
  campaignTakeOfflineConfirmation = "campaign-confirm-take-offline",
11
11
  campaignCopyConfirmation = "campaign-confirm-copy",
12
+ campaignCopySelection = "contract-copy-selection",
12
13
  basketRemoveProductConfirmation = "remove-product-from-basket",
13
14
  contractRemoveConfirmation = "contract-remove-confirmation",
15
+ contractGroupConflictInfo = "contract-group-conflict-info",
16
+ filePicker = "file-picker",
17
+ contractPostingRequirementsSmartFillSuccess = "contract-posting-requirements-smart-fill-success",
14
18
  }
package/modal/types.ts CHANGED
@@ -2,6 +2,7 @@ import { Product } from "../product/types"
2
2
  import { Contract } from "../contract/types"
3
3
  import { ModalKeys, ModalZone } from "./enums"
4
4
  import { AnyNonFunction } from "../common/types"
5
+ import { Campaign, TransformedPostingRequirement } from "../campaign"
5
6
 
6
7
  export type ProductDetailModalProps = {
7
8
  id: string
@@ -12,6 +13,25 @@ export type BasketRemoveProductConfirmationModalProps = {
12
13
  }
13
14
  export type CampaignTakeOfflineConfirmationModalProps = { campaignId: string }
14
15
  export type ContractRemoveConfirmationModalProps = { contractId: string }
16
+ export type ContractGroupConflictInfoModalProps = {
17
+ contract: Contract
18
+ conflictingContracts: Contract[]
19
+ }
20
+ export type CampaignCopySelectionModalProps = {
21
+ products: (Product | Contract)[]
22
+ campaign: Campaign
23
+ }
24
+ export type ContractPostingRequirementsSmartFillResponseModalProps = {
25
+ response: Record<string, any>
26
+ postingRequirements: Record<string, TransformedPostingRequirement>
27
+ contractId: string
28
+ }
29
+ export type FilePickerOptions = {
30
+ accept?: string[]
31
+ uploadInBackground?: boolean
32
+ maxFiles?: number
33
+ maxSize?: number
34
+ }
15
35
  export type BasketModalProps = {}
16
36
  export type WalletModalProps = {}
17
37
 
@@ -21,13 +41,17 @@ export type ModalProps = AnyNonFunction<
21
41
  | BasketRemoveProductConfirmationModalProps
22
42
  | CampaignTakeOfflineConfirmationModalProps
23
43
  | ContractRemoveConfirmationModalProps
44
+ | ContractGroupConflictInfoModalProps
45
+ | ContractPostingRequirementsSmartFillResponseModalProps
24
46
  | BasketModalProps
25
47
  | WalletModalProps
26
48
  >
27
49
 
28
50
  export type ModalOptions = {
29
51
  showCloseButton?: boolean
52
+ showBottomCloseButton?: boolean
30
53
  showBackdrop?: boolean
54
+ unstyled?: boolean
31
55
  disableVerticalScroll?: boolean
32
56
  }
33
57
 
@@ -19,7 +19,7 @@ export enum OrderJourneyStepKey {
19
19
  }
20
20
 
21
21
  export enum OrderJourneyPaymentMethod {
22
- atsManaged = "ats-managed",
22
+ atsManaged = "ats_managed",
23
23
  wallet = "wallet",
24
- purchaseOrder = "purchase-order",
24
+ purchaseOrder = "purchase_order",
25
25
  }
@@ -0,0 +1,16 @@
1
+ import {
2
+ HapiServiceFunctionWithLifecycleHooks,
3
+ WindowHapiService,
4
+ } from "../_window/service.types"
5
+ import { WindowHapiModuleWithConstructorArgs } from "../_window"
6
+
7
+ export type OrderJourneyServiceSwitchToNextStepHandler = () => Promise<void>
8
+ export type OrderJourneyServiceSwitchToPreviousStepHandler = () => Promise<void>
9
+
10
+ export type WindowHapiServiceOrderJourney = WindowHapiModuleWithConstructorArgs<
11
+ {
12
+ switchToNextStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToNextStepHandler>
13
+ switchToPreviousStep: HapiServiceFunctionWithLifecycleHooks<OrderJourneyServiceSwitchToPreviousStepHandler>
14
+ },
15
+ { readonly service: WindowHapiService }
16
+ >
@@ -1,5 +1,11 @@
1
1
  import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
2
- import { OrderJourneyStep, OrderJourneyContractStep } from "./types"
2
+ import {
3
+ OrderJourneyStep,
4
+ OrderJourneyContractStep,
5
+ OrderJourneyUTMStepData,
6
+ OrderJourneyUTMStepValidations,
7
+ OrderJourneyOrderReviewStepData,
8
+ } from "./types"
3
9
  import { MessageDescriptor } from "react-intl"
4
10
  import { NestedValidatorKeys, UseValidatorResult } from "../common/types"
5
11
 
@@ -15,9 +21,9 @@ export type OrderJourneyState = {
15
21
  stepActive: OrderJourneyStep | null
16
22
  stepNext: OrderJourneyStep | null
17
23
  stepsPopulatedAreHidden: boolean
24
+ stepIsSwitching: boolean
18
25
  paymentMethodsAvailable: OrderJourneyPaymentMethod[]
19
26
  paymentMethodsEnabled: OrderJourneyPaymentMethod[]
20
- paymentMethodActive: OrderJourneyPaymentMethod | null
21
27
  hidePrefilledFields: boolean
22
28
  orderErrors: Record<string, any> | null
23
29
  /* Onboarding */
@@ -76,17 +82,16 @@ export type OrderJourneyState = {
76
82
  string,
77
83
  Record<string, MessageDescriptor>
78
84
  >
79
- contractStepsHideFields: Record<string, boolean>
80
85
  contractStepsValidators: Record<string, Record<string, NestedValidatorKeys>>
81
86
  contractStepsData: Record<string, Record<string, any>>
82
87
  contractStepsValidations: Record<string, UseValidatorResult> | null
83
88
  /* UTM Codes */
84
89
  utmCodesStep: OrderJourneyStep
85
- utmCodesStepData: Record<string, any>
86
- utmCodesStepValidations: UseValidatorResult
90
+ utmCodesStepData: OrderJourneyUTMStepData
91
+ utmCodesStepValidations: OrderJourneyUTMStepValidations
87
92
  /* Order Review */
88
93
  orderReviewStep: OrderJourneyStep
89
- orderReviewStepData: Record<string, any>
94
+ orderReviewStepData: OrderJourneyOrderReviewStepData
90
95
  orderReviewStepValidations: UseValidatorResult
91
96
  /* Payment Method */
92
97
  paymentMethodStep: OrderJourneyStep
@@ -1,18 +1,20 @@
1
1
  import { MessageDescriptor } from "react-intl"
2
2
  import { OrderJourneyStepKey } from "./enums"
3
+ import { UseValidatorResult } from "../common"
3
4
 
4
- export type OrderJourneyStepBlurredFields = Record<
5
- string,
6
- | boolean
7
- | Record<string, boolean>
8
- | Record<string, Record<string, boolean> | boolean>
9
- >
5
+ export type OrderJourneyStepBlurredFields = {
6
+ [k: string]:
7
+ | boolean
8
+ | Record<string, boolean | OrderJourneyStepBlurredFields>
9
+ }
10
10
 
11
- export type OrderJourneyStepErrorMessages = Record<
12
- string,
13
- | MessageDescriptor
14
- | Record<string, MessageDescriptor | Record<string, MessageDescriptor>>
15
- >
11
+ export type OrderJourneyStepErrorMessage = Record<string, MessageDescriptor>
12
+
13
+ export type OrderJourneyStepErrorMessages = {
14
+ [k: string]:
15
+ | MessageDescriptor
16
+ | Record<string, MessageDescriptor | OrderJourneyStepErrorMessage>
17
+ }
16
18
 
17
19
  export type OrderJourneyStepKeyType = OrderJourneyStepKey | string
18
20
  export type OrderJourneyStep = {
@@ -22,10 +24,41 @@ export type OrderJourneyStep = {
22
24
  isSubmitted?: boolean
23
25
  blurredFields?: OrderJourneyStepBlurredFields
24
26
  errorMessagesIntlDescriptors?: OrderJourneyStepErrorMessages
25
- hideFields?: Record<string, boolean>
26
27
  }
27
28
 
28
29
  export type OrderJourneyContractStep = Omit<
29
30
  OrderJourneyStep,
30
31
  "blurredFields" | "isSubmitted" | "errorMessagesIntlDescriptors"
31
32
  >
33
+
34
+ export type UTMMap = {
35
+ value: string
36
+ mapToName: boolean
37
+ key: string
38
+ }
39
+
40
+ export type OrderJourneyUTMStepData = {
41
+ settings: UTMMap[]
42
+ productUTMs: Record<string, UTMMap[]>
43
+ }
44
+
45
+ export type OrderJourneyUTMStepValidations = {
46
+ settings: {
47
+ name: UseValidatorResult
48
+ value: UseValidatorResult
49
+ }
50
+ productUTMs: Record<
51
+ string,
52
+ {
53
+ settings: {
54
+ name: UseValidatorResult
55
+ value: UseValidatorResult
56
+ }
57
+ }
58
+ >
59
+ areAllValid: boolean
60
+ }
61
+
62
+ export type OrderJourneyOrderReviewStepData = {
63
+ accordionsOpen: OrderJourneyStepKey[]
64
+ }
@@ -1,11 +1,21 @@
1
1
  import { OrderJourneyPaymentMethod, OrderJourneyStepKey } from "./enums"
2
2
  import { WindowHapiUtils } from "../_window/utils.types"
3
3
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
4
+ import { Contract } from "../contract"
5
+ import { Product } from "../product"
6
+ import { orderJourneyGetContractIdFromContractStepKey } from "../../common/orderJourney/utils"
4
7
 
5
8
  export type WindowHapiUtilsOrderJourney = WindowHapiModuleWithConstructorArgs<
6
9
  {
7
10
  stepKeys: typeof OrderJourneyStepKey
8
11
  paymentMethodKeys: typeof OrderJourneyPaymentMethod
12
+ orderJourneyGetContractIdFromContractStepKey: (key: string) => string
13
+ updateProductUTMsFromBasketItemData: (
14
+ basketItemData: (Contract | Product)[],
15
+ ) => void
16
+ updateOrderReviewAccordionStatesFromBasketItemData: (
17
+ basketItemData: (Contract | Product)[],
18
+ ) => void
9
19
  },
10
20
  { readonly utils: WindowHapiUtils }
11
21
  >